# cel-context
Portable context snapshots for AI agents.
`cel-context` gives agents, tools, and runtimes a shared way to describe
software state. Any source can emit `ContextElement`s, and any consumer can read
the resulting `ScreenContext` without depending on a specific browser, desktop,
OCR, accessibility, or monitoring stack.
## What It Owns
- `ContextElement` — one UI, app, log, or source-derived fact.
- `ScreenContext` — one snapshot of app/window state and context elements.
- `ContextSource` — source labels such as 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.
## What It Does Not Own
- live cortex operation
- runtime freshness / anomaly policy
- action dispatch
- policy enforcement
- monitoring dashboards or compliance exports
Those live in the commercial Cellar/Dilipod runtime unless explicitly opened
later.
## Example
```sh
cargo run -p cel-context --example context_snapshot -- --json
```
The example constructs a snapshot from caller-provided `ContextElement`s. Live
capture belongs in runtime/source crates that emit the same contract shape.
## Minimal Element
```rust
use cel_context::{ContentRole, ContextElement, ContextSource};
use std::collections::HashMap;
let element = ContextElement {
id: "app:button:submit".into(),
label: Some("Submit".into()),
description: None,
element_type: "button".into(),
value: None,
bounds: None,
state: Default::default(),
parent_id: None,
actions: vec!["click".into()],
confidence: 0.95,
source: ContextSource::NativeApi,
content_role: ContentRole::Interactive,
properties: HashMap::new(),
};
```
## License
Apache-2.0