Skip to main content

Module model

Module model 

Source
Expand description

Data model of the context compiler: the request/response value types.

Like crate::model, these are pure data with Serialize/Deserialize + JsonSchema derives, so the domain types double as the MCP wire types — no duplicate DTO layer. Invariants the compiler upholds over these shapes: same request ⇒ byte-identical CompiledContext (determinism), and the assembled content never exceeds the request’s token budget.

Structs§

CompilePolicy
Tuning knobs of one compilation. Default is the recommended profile.
CompileRequest
A full compile request: what to compile, under which budget, for whom.
CompiledContext
The compiler’s output: the assembled context plus its full audit trail.
CompiledSection
One contiguous block of the assembled output.
ContextDecision
The auditable record of what happened to one fragment and why.
ContextDecisionRef
A lightweight pointer to a past ContextDecision.
ContextFact
One asserted fact inside a WorkingContext.
ContextFragment
One unit of caller-supplied context to compile.
ContextSavings
Aggregated savings over the recorded compilation events (memory bridge).
ContextSource
The resolved original behind a ctx://source/<hash> handle (US-002: text sources; US-009 PR2 extends this with the fragment’s inline media, when it carried one). media is #[serde(default)]: every source stored before PR2, and every text-only fragment since, round-trips with media: None — the exact pre-PR2 shape for a caller reading only .content.
ContextWarning
A mechanical heads-up over one decision, surfaced in CompiledContext::warnings so a caller can check “was anything relevant cut?” without scanning every entry of decisions by hand (V2a-2 quick win). Only ContextAction::Retrieve decisions at or above the relevance threshold qualify.
ImportanceWeights
Usage-driven importance weights of the memory-bridge blend (US-002 of EPIC-P-071): how much a pulled memory’s learned RL confidence and its batch-relative recency tilt the fused similarity ranking.
LoadedWorkingContext
What a working-context lookup returns, on every surface: the MCP load_working_context tool AND the Node/Python/WASM bindings.
MediaRef
Inline media payload attached to a ContextFragment (US-009, PR1: screenshots/images only). ContextFragment::content stays the text/caption — often empty for a bare screenshot — while the pixels live here, base64-encoded so the JSON wire never needs a binary frame.
MemoryScope
Which memories the compiler may pull in alongside the caller’s fragments. Consumed by the memory bridge (US-002); carried in the request shape from the start so the wire contract does not change when it lands.
RetrievalHandle
A not-emitted fragment the caller can fetch back on demand.
SourceReference
A pointer from a compiled output back to one original fragment.
WorkingContext
The distilled working state of an agent session — small enough to carry across sessions, structured enough to resume from. Persisted and reloaded by the memory bridge (US-002) under type = working_context metadata.
WorkingContextIndex
The per-project index save_working_context maintains so list_working_contexts never has to scan the whole store: one system fact per project, appended (or refreshed) on every save. The REJECTED alternative was an approximate query_filtered scan over working-context facts (capped at MAX_RECALL_LIMIT, imprecise) — this index is exact and O(1) to read.
WorkingContextSession
One session recorded in a project’s working-context index (V2a-1’s list_working_contexts quick win).

Enums§

ContextAction
What the compiler decided to do with one fragment.
FidelityRisk
How much fidelity a compiled context may have lost versus its input.
SectionKind
Where a section sits in the assembled output.