Context Runtime

13 slides · the OS-level context kernel

Context Runtime — the OS-level context kernel
CONTEXT RUNTIME1/13

Context Runtime is the context OS, not a RAG add-on

  • The kernel that owns every context decision — its Execution Planner compiles each read into a canonical plan across representation, retrieval, reasoning, model, topology, and verification.
  • Applications and the Mission Runtime state a need; the runtime decides how it is met.
  • RAG is one of many things it resolves, not what it is.
  • "Better context beats more context" — governed, explainable, reproducible reads.
CONTEXT RUNTIME2/13

One layering, one door

  • Three runtimes: Discovery proposes work · the Mission Runtime executes it · the Context Runtime resolves the evidence — over Capabilities -> Models -> External Systems.
  • The Mission Runtime is pure orchestration and never decides retrieval or model selection.
  • Everything above the runtime asks; the runtime answers.
  • A single interface sits between intent and every source of truth.
ApplicationDiscoveryproposes workMission RuntimeContext RuntimeCapabilitiesModelsExternal Systems
CONTEXT RUNTIME3/13

resolve(ContextIntent) -> ContextBundle

  • The whole surface collapses to one call: state the need, get back a resolved bundle — re-resolving recompiles only when the intent or its sources change (idempotent). A resolved bundle binds to a ContextEpoch that pins the exact evidence revision it used, so a decision can later be replayed against precisely what was known: exact replay reconstructs the sealed plan pinned to the original evidence (fails closed on drift) versus explicit re-evaluation against current evidence (bi-temporal as_of / known_at). The Plan Cache (SnapshotPlanCache) is keyed on the pinned source fingerprint, bound to tenant and permissions — same intent + same pinned evidence (same tenant, same authority) replays; a mutated source version re-plans.
  • ContextIntent carries the kind, goal, world state, mission state, and capability.
  • ContextBundle carries the value — packed to fit the model window under a token budget (a knapsack choice) — plus Provenance: resolver, representation, score, alternatives.
  • No scattered discover() / embed() / rag() calls for callers to wire by hand.
ContextIntentkind · goal · needresolve()the one doorContextBundlevalueProvenancewhy · score · alts
CONTEXT RUNTIME4/13

Everything is context

  • Not just documents: mission state, world state, beliefs, evidence, policies, knowledge.
  • Also capabilities, memory, observability, and external APIs — all resolved through one door.
  • So callers ask NeedContext(...), never RetrieveDocuments(...).
  • The concept from the original whitepaper, made concrete.
CONTEXT RUNTIME5/13

Five context kinds today

  • bind_capability — which capability satisfies an outcome or need.
  • resolve_belief — the fused belief for a world-state key.
  • check_policy — the approval decision for a node.
  • select_model — which model answers this step.
  • retrieve_knowledge — knowledge, routed across engines by query shape.
CONTEXT RUNTIME6/13

The Execution Planner is the optimizer

  • A distinct component inside the Context Runtime — the Execution Planner — compiles each read into a canonical six-axis ExecutionPlan: representation, retrieval, reasoning, model, topology, verification.
  • No single retrieval regime wins across query shapes; routing to the right one per query beats every fixed method (on the public benchmark, a learned LLM router lands the intended regime at 1.00 / 0.90 / 1.00 for lookup / multi-hop / temporal, where a keyword router gets 0.95 / 0.00 / 0.00 — see retrieval benchmarks).
  • Temporal -> graph; multi-hop -> HippoRAG; structured -> analytical/SQL; visual -> vision; else -> vector — and every axis carries cost, latency, quality and freshness estimates with EXPLAIN. Freshness is a scored dimension (a staleness penalty; a fully-fresh plan is unchanged), and a confident plan on stale evidence returns a REFRESH verdict (distinct from serve/abstain/escalate) rather than serving stale context.
  • A contextual bandit can learn the best choice per query — opt-in and leaf-level, since it needs enough usage to converge.
queryroute by shapethe optimizervectorsemanticgraphtemporalhipporagmulti-hopanalyticalstructuredcodesymbolsvisionvisual
CONTEXT RUNTIME7/13

Long-horizon: decide, then materialize

  • A context window is a cliff, not a ramp — past it the answer-bearing evidence simply isn't in the prompt, and accuracy falls to zero. A bigger window only moves the cliff.
  • A cheap decision stage runs in front of the answerer: region routing (a deterministic scorer picks the top-K regions) -> adaptive materialize depth (state -> sparse -> deep -> full, escalating only if the question needs it) -> a fixed-window answerer, ~4k tokens in.
  • Past the window, full context collapses (0.0 at the 500k–1M horizons on the held-out corpus) while managed context holds 0.75–1.0 on ~4.1k tokens — roughly 27x fewer than full's 111k — reproduced on an independent held-out corpus, with a 30B-parameter (3B-active) model on a single 32GB GPU. Small sample (4 needles per horizon), so the trend is the result, not any single cell; see the real-model findings.
  • Underneath: hash-pinned evidence identity, an additive prior that warm-starts the bandit, and per-tenant cache isolation — each additive and gated, earning its place against a frozen baseline (the optimizer stays free to pour everything in when the corpus fits the window and that wins).
CONTEXT RUNTIME8/13

Engines behind one Protocol

  • Retrieval engines plug in behind a retriever interface. The context-runtime library ships adapters for pgvector, HippoRAG, DuckDB, guarded read-only text-to-SQL (guard_sql, tested), OpenSearch and image/multimodal retrieval; the kernel's own KnowledgeRetriever Protocol ships a code structural graph (code_graph) retriever, routed by query shape.
  • The kernel's KeywordRetriever is the dependency-free default, so retrieval resolves in-process; the kernel does not bundle the engines — the deployment injects them (the reference Helm chart exposes a retriever.backend of inmemory or pgvector).
  • Deciding graph-vs-SQL-vs-vector together beats N local heuristics — a query planner beats hand-picked indexes. Representations also compose: ReDevOps RAG v0.4.0 ships a structural change-closure retriever (citation_graph) whose union_retrieve fills one token budget with the closure first and hybrid content hits after — see citation_graph.py. Having the Context Runtime itself decide when to spend budget on graph, content or their union is still ahead (slide 13).
  • The seam is the point: the local resolver and the real engines share one contract, so wiring an engine in is injection, not a rewrite. Out-of-the-box wiring of the kernel's resolve() to those engines is still ahead (slide 13).
CONTEXT RUNTIME9/13

Resolution, not storage

  • "Owns all context" means single resolution interface — not that it holds all the data.
  • The Mission Runtime still writes mission and world state; it is the execution system-of-record.
  • The Context Runtime resolves over those stores plus the registry, policies, evidence, and engines.
  • This keeps the layering non-circular: write below, resolve above.
CONTEXT RUNTIME10/13

Provenance on every answer

  • Every ContextBundle carries the EXPLAIN surface: which resolver, which representation, what score — and the evidence lineage behind each hit (content-hash / source-version / capability-version) with its freshness.
  • Alternatives and the routing reason travel with the result.
  • One provenance surface for knowledge, representation, model, and capability decisions.
  • The redevops.io/explain thesis applied to the whole OS, not just retrieval.
CONTEXT RUNTIME11/13

Capability binding as a resolution

  • Binding a step to a capability is bind_capability — exact 'provides' match first, embedding discovery as fallback.
  • Below-threshold discovery matches fail closed rather than papering over a miss.
  • Candidates are ranked by cost; the caller can pin a preferred provider.
  • The compiler no longer reaches the registry directly — it asks the runtime to resolve.
CONTEXT RUNTIME12/13

Three implementations, one contract

  • Python is the reference for research and ML-ecosystem integration.
  • The Go port ships static binaries with low memory and native concurrency; the public agentic-os kernel includes the Go Mission Runtime with the same context contract (go/mission/context.go).
  • The Kotlin/JVM port runs the runtime natively on Apache Spark / Databricks. The Go and Kotlin/JVM runtimes are separate commercial builds, not in the public repos.
  • Holding all three to the same behavior keeps the contract honest — same resolve() semantics; pick the implementation per workload.
CONTEXT RUNTIME13/13

Shipped, and what's still ahead

  • Shipped: the engine adapters on slide 8, in the context-runtime v0.3.0 tag, and the kernel's governed retrieval door (GroundedContext, N6) — tenant and app scoping, classification and egress, freshness bounds, an immutable evidence snapshot and a reproducible receipt — in agentic-os v0.3.27.
  • Shipped: structural change-closure retrieval in ReDevOps RAG v0.4.0 (citation_graph, composable with hybrid search under a token budget), and the kernel's code_graph retriever with Go parity (agentic-os v0.3.27).
  • Ahead: wire the kernel's resolve() to the real engines out of the box, and make the Context-Runtime-owned graph ∪ content composition a default — gated on family expansion.
  • Ahead: graduate the opt-in learned router from leaf-level toward fleet-aware placement.
  • Ahead: wire select_model to the live model router (today it returns the configured model) and read_observability behind resolve.
  • Ahead: unify per-mission permission scoping inside the runtime (retrieval scoping already ships); mirror the newer contract in the Kotlin/JVM kernel.