FACET Pure Mode: Why a Cache Miss Must Fail
Pure execution is not “the network happened to be quiet.” It is a stronger contract: every value that may influence the compiled AI request must already be identified, bounded, and replayable.
That is why FACET Pure Mode treats a cache miss as an error. It does not quietly call the network. It does not substitute a newer value. It stops with F803.
This can look severe until the cache is understood as part of the execution model rather than a performance optimization.
Three lens classes, three different promises
FACET assigns every lens a trust level and a determinism class. The distinction determines what the runtime may do:
| Lens level | Meaning | Pure Mode |
|---|---|---|
| Level 0 | Hermetic computation with no I/O | Execute locally |
| Level 1 | Bounded external computation with a cache contract | Cache hit only |
| Level 2 | Volatile or unbounded external effects | Reject |
A trim() lens can run anywhere because its result is a function of declared input. A bounded retrieval lens may be useful, but its result also depends on something outside the document. A volatile lens cannot claim replayability at all.
The important line is between Level 0 and Level 1. “Bounded” does not mean “pure enough.” It means the dependency can cross into Pure Mode only after the runtime has frozen its identity.
The cache key is a dependency declaration
FACET v2.1.3 defines the Level-1 cache key as a hash of canonical JSON containing:
{
"lens": { "name": "retrieve", "version": "3" },
"input": { "query": "guard semantics" },
"args": [],
"named_args": { "limit": 5 },
"host_profile_id": "facet-host-linux-v2",
"facet_version": "2.1.3"
}
The actual key is:
sha256(JCS(cache_key_object))
Each field closes a different ambiguity.
lens.namesays which transformation ran.lens.versionprevents changed behavior from inheriting old results.- canonical input and arguments bind the result to the exact request.
host_profile_idcaptures host-defined behavior that the language standard cannot universalize.facet_versionbinds the entry to the semantics that interpreted the contract.- JCS, defined by RFC 8785, gives the object invariant bytes before hashing.
This is not the same problem as semantic result reuse discussed in Prompt Caching Is Not Correctness. That article asks whether an application may reuse an AI result under the same policy and authority. The FACET cache contract is narrower: it identifies the output of one registered bounded lens inside contract execution.
Why F803 is the correct answer
Suppose Pure Mode reaches a Level-1 retrieval lens and the key is absent. There are only three honest possibilities:
- perform external I/O and stop being pure;
- invent or substitute data and corrupt the request;
- fail, preserving the execution claim.
FACET chooses the third.
cache hit -> use the identified value
cache miss -> F803
The failure is useful. It says that the requested replay lacks one of its declared dependencies. An operator may populate the cache in an authorized execution, pin the resulting entry, and rerun. What the runtime may not do is silently change the meaning of --pure.
This is the same design instinct behind provider adapters that must not repair semantics. Convenience code at a boundary should not acquire authority to reinterpret the contract. A cache fallback that goes live is exactly such an interpretation: the runtime replaces “replay this dependency” with “fetch whatever exists now.”
Pure Mode is a two-phase workflow
The practical pattern resembles a reproducible build more than an offline chatbot.
1. Materialize
An authorized execution resolves bounded dependencies. The host records each lens name, version, canonical input, arguments, profile, and output under the derived cache key.
2. Replay
Pure Mode accepts only Level-0 computation and existing Level-1 entries. No network call can repair a missing dependency. The same declared inputs and the same cache snapshot produce the same request-construction boundary.
This separation gives review a concrete object: a cache manifest. A deployment can state which external values were admitted before execution, rather than merely claiming that the runtime was deterministic afterward.
{
"entries": [
{
"key": "sha256:…",
"lens": "retrieve@3",
"output_digest": "sha256:…"
}
]
}
The FACET specification defines the cache-key contract; a host still has to define storage, integrity checks, retention, and how entries are materialized. Those host choices matter. A correct key does not prove that the cached value is true, safe, fresh, or authorized. It proves which value the execution depended on.
Identity before speed
Caches are usually introduced as accelerators. That framing is too weak for AI execution.
At a contract boundary, the first purpose of a cache is dependency identity. Speed is a secondary benefit. If two lens versions, host profiles, or argument sets can collide, the system may be fast while compiling the wrong request.
This is why canonical JSON works as an AI intermediate representation: stable structure gives us stable comparison and hashing handles. The Level-1 cache key applies the same principle one layer earlier, to bounded computation.
It also explains why TTL alone is not enough. Time-to-live answers when an entry expires according to host policy. It does not answer what computation produced the entry, under which semantics, or whether another execution is entitled to reuse it. Freshness may be an additional constraint; it cannot replace identity.
What the contract does not guarantee
The boundary must stay precise.
FACET Pure Mode does not make model generation deterministic. The canonical request may be replayable while provider inference remains probabilistic. It does not certify the truth of retrieved content. It does not define a universal cache backend. It also does not convert volatile Level-2 effects into Level 1 merely because somebody stored their output.
The guarantee is narrower and more useful: during Pure Mode, bounded external computation cannot happen behind the runtime’s back. It must arrive as an already identified dependency, or execution fails visibly.
I prefer this failure to a successful request with an untraceable input. F803 is not an availability bug. It is the point where the runtime refuses to counterfeit reproducibility.