cel-context
Portable context snapshots for AI agents.
cel-context gives any stream a common shape an agent can consume. Browser DOM,
accessibility trees, logs, traces, metrics, tickets, database rows, app events,
OCR, and domain APIs can all emit ContextElements and merge into one
ContextSnapshot.
ContextSnapshot is a point-in-time operating context: the facts an agent
should know before it plans, answers, or acts.
Purpose
Use cel-context when you have multiple streams and want to make them useful to
an agent without coupling the agent to each stream's native format.
metrics / logs / traces / tickets / DOM / APIs / database rows
-> ContextElement[]
-> ContextContribution
-> ContextMerger
-> ContextSnapshot
-> agent, planner, brief builder, monitor, or evaluator
The crate does not collect the streams for you. It defines the portable contract they can emit.
What's Included
ContextElement— one source-derived fact: UI control, log line, metric, alert, ticket, row, or event.ContextSnapshot— one point-in-time snapshot of normalized context elements.ContextSource— source labels such as external stream, accessibility, CDP, native API, OCR, vision, merged.ContentRole— prompt-injection-aware classification.ContextReference— resilient targeting data that survives ephemeral IDs.ContextContribution/ContextMerger— generic source contribution merge mechanics.
Out Of Scope
- Capturing live desktop, browser, OCR, vision, network, log, trace, metric, ticket, or database streams.
- Deciding freshness, anomaly, prioritization, or policy rules over time.
- Dispatching actions back into an app or browser.
- Hosting dashboards, audit timelines, or compliance exports.
Those responsibilities belong in whichever runtime, adapter, or product embeds the snapshot contract.
Example
The example constructs a snapshot from caller-provided stream facts. Any source
that can produce ContextElements can participate.
Minimal Element
use ;
use HashMap;
let element = ContextElement ;
License
Apache-2.0