How to Give Every AI Run a Verifiable Context Root
An AI run should be able to answer one basic question: what exact context did you execute?
Most systems cannot. They preserve a conversation ID, a prompt string, or a trace full of loosely related events. Meanwhile the effective input also includes retrieved documents, system instructions, tool schemas, policy versions, model settings, file snapshots, and the order in which all of them were packed. A run ID tells me where the event was stored. It does not tell me what the event was.
I want a stronger primitive: a context root—one digest that commits to a canonical manifest of every execution-relevant input.
What is the difference between a run ID and a context root?
Git made this distinction practical long ago. Objects are addressed by content, while commits bind a tree to parents and metadata. IPFS uses content identifiers whose meaning includes both the hash and the codec. The useful lesson for AI systems is not “put prompts on a blockchain.” It is much simpler: identity should be derived from canonical bytes, not assigned by a database counter.
A minimal context manifest could look like this:
{
"schema": "context-manifest/v1",
"instructions": "sha256:…",
"messages": "sha256:…",
"retrieval": [{"source": "docs/api.md", "revision": "git:4f8c…", "digest": "sha256:…"}],
"tools": "sha256:…",
"policy": "sha256:…",
"packing": "token-box/v1",
"model": {"provider": "…", "name": "…", "parameters": {}}
}
Canonicalize the manifest, hash it, and the result becomes the context root. If two runs have the same root, they used the same declared execution inputs. If their roots differ, the manifest can show exactly which branch changed.
That is more useful than a giant prompt hash. A flat digest can detect difference but cannot localize it. A manifest composed from content-addressed children behaves like a small Merkle DAG: the root commits to the whole input set while each child remains independently inspectable.
Why is canonicalization the hard part of a context root?
Hashing is easy. Agreeing on the bytes is hard.
JSON key order, Unicode normalization, line endings, numeric representation, omitted defaults, URL normalization, and array ordering can all produce different bytes for equivalent-looking data. A context-root specification therefore needs to define:
- the canonical serialization;
- which fields are ordered and which are sets;
- how defaults are materialized;
- how secrets are represented without exposing them;
- how mutable sources are pinned to a revision;
- which hash algorithm and domain separator are used.
I would hash secrets through a protected commitment service or record a secret-version identifier, never copy secret values into the manifest. A retrieved URL without a response digest is also insufficient: the same URL can serve different bytes tomorrow. “Latest policy” and “current repository” are locators, not reproducible inputs.
This extends the argument I made in Context Is Not Memory. Memory may decide what is relevant; the context manifest records what actually crossed the execution boundary. Token Box can then make the packing policy explicit rather than hiding truncation and priority decisions inside prompt assembly.
What a context root proves—and what it does not
A matching root proves input identity only within the declared schema. It does not prove that the model will emit identical tokens. Provider infrastructure may change. Sampling may be nondeterministic. Tool calls can observe a changing world. A source can be misrepresented before hashing. A digest gives integrity, not truth.
This boundary matters. I do not want reproducibility language to become another inflated AI claim. The context root supports three precise operations:
| Operation | What the root enables |
|---|---|
| Compare | Determine whether two runs declared the same inputs |
| Explain | Traverse changed child digests to locate context drift |
| Replay | Reconstruct pinned inputs before re-executing under stated runtime limits |
Replay still needs an execution contract. As I argued in Deterministic AI Runtime Guarantees, a runtime can reproduce normalization, authorization, and state-transition decisions without promising identical model prose.
Context drift should become a diff
Today, when an agent behaves differently, teams often compare final answers and guess. A context root turns that investigation into a structural diff:
run A root: ctx:91b7…
run B root: ctx:ae20…
changed:
retrieval[2].digest
tools.schema_digest
unchanged:
instructions
policy
model.parameters
Now the question is no longer “why was the model weird?” It becomes “the retrieved specification changed and one tool schema added an optional field; are those changes sufficient to explain the new path?” The model may still be uncertain, but the investigation is bounded.
The same structure also improves caching. A derived artifact can declare the context root it depends on. Cache reuse is valid only when the relevant dependency subtree still matches—not merely because the user asked a similar question. This is content-addressed build logic applied to AI execution.
Start with a receipt, not a platform rewrite
A team does not need a new database to adopt this. Generate context-manifest.json beside every run artifact. Canonicalize it with a versioned library. Store its root in the trace. Add a command that compares two manifests and prints changed branches.
The first useful interface could be almost boring:
$ agent-context diff run-184 run-219
retrieval/docs-api: 8c11… -> b904…
tools/github: 338a… -> 57d2…
That boring output is the point. Context engineering becomes stronger when “what did the model see?” stops being a forensic reconstruction and becomes a normal build artifact.
I do not expect context roots to make probabilistic models deterministic. I expect them to make context drift accountable. That is a smaller claim—and a much more useful engineering guarantee.