Why FACET Fails on Critical Context Overflow
An AI system should never make a protected instruction fit by quietly deleting part of it. If the non-negotiable context is larger than the available budget, the honest result is not a shorter prompt. It is a failed build.
That is the purpose of F901 in FACET. The error looks small, but it encodes a boundary I consider essential: context optimization may reduce optional material; it must not renegotiate invariants.
A budget is a contract, not a suggestion
The Token Box Model measures request context in provider-independent FACET Units. Every message section has a size and may declare layout fields such as priority, min, shrink, and an optional deterministic compression strategy.
One rule changes the meaning of the whole layout algorithm:
shrink == 0 -> critical section
A critical section cannot be compressed, truncated, or dropped. Before FACET considers any flexible section, it computes the fixed load:
FixedLoad = sum(size(section) for every critical section)
if FixedLoad > Budget:
fail F901
This check happens before the compiler starts “being helpful.” It does not ask which critical instruction is probably less important. It does not use the model to summarize a policy. It does not trim bytes from the end and hope the remaining sentence still means the same thing.
The build stops because no valid layout exists under the declared contract.
Silent truncation is a semantic mutation
Context windows are usually discussed as capacity limits. In production they are also authority boundaries. A system message may define tool restrictions. Another section may contain the output schema. A third may carry the conditions under which a financial or filesystem action is allowed.
Delete a few tokens from ordinary reference material and retrieval quality may degrade. Delete a few tokens from an invariant and the program changes.
Consider this simplified contract:
@context
budget: 1200
@system
id: "policy"
shrink: 0
content: "Never execute a payment without an explicit approved amount and recipient."
@system
id: "schema"
shrink: 0
content: "Return exactly one object matching the declared response schema."
@user
id: "evidence"
priority: 100
min: 200
shrink: 1
content: $retrieved_documents
The evidence section is flexible. It can be compressed or reduced down to its declared minimum according to deterministic rules. The policy and schema are not flexible. If they alone exceed 1200 FACET Units, the compiler returns F901.
This is not an availability bug. It is proof that the current budget, protected content, and requested target cannot all be true at once.
The compiler must expose infeasibility
Many prompt assembly pipelines treat overflow as a string-processing problem: keep chopping until the provider accepts the request. That approach hides the most useful fact—the configuration is infeasible.
FACET turns infeasibility into a typed result. F901 belongs to layout, so an orchestrator can distinguish it from a missing variable, an import cycle, a policy denial, or exhausted lens gas. I described the broader value of this separation in FACET Error Codes as an AI Execution Control Plane: phase-aware failures let the host choose a repair that matches the broken contract.
For F901, valid repairs are architectural:
- increase the effective budget through an explicit, versioned host profile;
- reduce or split protected content deliberately;
- move appropriate material into flexible sections with meaningful minimums;
- choose a different target configuration and therefore a different request identity;
- reject the operation because its required invariant set cannot fit.
“Truncate more aggressively” is not on the list. Once a section is critical, silently weakening it would contradict the source.
Criticality is expensive by design
Marking everything critical would make a contract easy to reason about and hard to execute. The fixed load would grow until ordinary requests fail. Marking nothing critical would maximize packing flexibility while making every instruction negotiable under pressure.
The useful design question is narrower:
Which content would change the meaning, authority, or machine-readable validity of the request if any part disappeared?
That usually includes compact policy invariants, response-shape constraints, protocol boundaries, and identity-bearing instructions. Retrieved examples, background documents, conversational history, and verbose explanations are more often flexible—but they still need explicit priorities and minimums.
This distinction forces an engineer to classify context by consequence, not by sentiment. “Important” is vague. “May be shortened without changing the contract” is testable.
Inspect the layout before execution
A layout failure should be debuggable without a provider call. The compiler’s inspect artifacts expose the resolved contract and Token Box layout, which is why I treat compiler artifacts as the first debugging surface.
facet-fct inspect contract.facet --layout layout.json
facet-fct run --input contract.facet --runtime-input input.json --exec
The exact CLI behavior depends on the current compiler implementation, but the architectural boundary is defined by the FACET v2.1.3 specification: layout preserves canonical message order, critical sections cannot be modified, and critical overflow raises F901.
That gives tests a stable target. A conformance case can construct protected sections whose fixed load exceeds the budget and assert that compilation fails. Another can verify that flexible evidence is reduced while protected policy text remains byte-for-byte intact after normalization.
No model judgment is required to decide whether the invariant survived.
What F901 does not guarantee
F901 does not prove that a protected instruction is correct, sufficient, secure, or understood by the model. It does not make model output deterministic. It also does not decide which content deserves critical status; that remains a contract-design responsibility.
The guarantee is narrower and useful: a conforming layout will not silently compress, truncate, or drop a section declared critical. When the protected set cannot fit, execution does not proceed with a semantically weakened request.
I want AI infrastructure to fail at the point where its promises become impossible—not several steps later, after a provider has accepted a prompt whose safety or output contract was already damaged. F901 makes that impossibility visible.