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
ScreenContext.
Despite the historical name, ScreenContext is not limited to screens. Treat it
as a point-in-time operating context: the facts an agent should know before it
plans, answers, or acts.
What's Included
ContextElement— one source-derived fact: UI control, log line, metric, alert, ticket, row, or event.ScreenContext— 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