Why a Context Minimum Must Never Break the Budget
A context budget is not a target. It is an upper bound. If a packing algorithm can exceed it because one section declares an impossible minimum, the budget is only decorative.
FACET closes that gap with one small rule:
effective_min[i] = min(min[i], size[i])
The equation looks obvious after it is written down. Before it was normative, however, two individually reasonable conditions could leave a conforming implementation with no legal transition—and with a packed request larger than the declared Token Box budget.
This is the kind of edge case I care about in FACET. The language is useful only when its resource bounds survive hostile inputs, contradictory declarations, and independent implementations.
The impossible floor
In the Token Box Model, every context section has a measured size and may define a minimum amount of retained content. Flexible sections can be compressed, truncated, or dropped according to deterministic ordering rules. Critical sections follow a different path: if they alone exceed the budget, compilation fails with F901 rather than weakening the contract.
The subtle case sits between those two paths. Consider a flexible section whose actual content occupies 40 FACET Units but declares:
min: 100
size: 40
budget pressure: active
A naive algorithm may say:
- truncate only while
size > min; - drop only when
size == min.
For size = 40 and min = 100, neither condition is true. The section is flexible, but the declared floor is larger than the content it is supposed to protect. The packer cannot truncate it, cannot drop it, and may terminate while the total request still exceeds the budget.
Nothing probabilistic happened. The bug is entirely in the deterministic layer.
A minimum is a retention rule, not a reservation
The correction starts by defining what min means.
It is not a claim that the section already occupies that much space. It does not reserve missing content. It is a floor on content that remains if the section is retained.
That distinction produces the effective minimum:
effective_min = min(declared_min, current_size)
For the 40-unit section with min: 100, the effective minimum is 40. Under budget pressure, the packer can now reach a valid decision: retain the section at its actual size or drop it entirely when the algorithm reaches the drop boundary. It cannot invent 60 units, and it cannot use the oversized declaration as permission to violate the global budget.
This preserves two invariants at once:
- retained content is never truncated below a meaningful floor;
- the final packed layout never exceeds the declared budget.
When local metadata conflicts with a global resource bound, the semantics must say which promise wins. FACET makes the budget non-negotiable without pretending that an impossible floor describes real content.
The transition table matters more than the happy path
Packing algorithms often look correct when every declaration is internally consistent. Real conformance work starts with values that sit outside the expected shape.
A useful review table is small:
| Current size | Declared min |
Effective minimum | Legal result under pressure |
|---|---|---|---|
| 120 | 40 | 40 | truncate to 40, then drop if still necessary |
| 40 | 40 | 40 | retain or drop |
| 40 | 100 | 40 | retain or drop; never exceed the budget |
| 0 | 100 | 0 | keep empty or drop |
The third row is the specification test. If an implementation treats the declared minimum as an unconditional reservation, it can get stuck. If it silently clamps the final request above the budget, it has broken the Token Box contract. If it changes the source declaration, it has blurred the difference between authored metadata and derived layout state.
effective_min avoids all three mistakes because it is a derived value used by packing, not a rewrite of the contract.
Fail closed only where the contract is actually impossible
This rule does not replace critical-overflow handling. A critical section still cannot be truncated or dropped. If the fixed critical load exceeds the budget, FACET must fail with F901; I described that boundary in Why FACET Fails on Critical Context Overflow.
A flexible section with an oversized min is different. Its declaration is awkward, but a valid layout can still exist because the section is explicitly shrinkable and droppable. Rejecting the whole build would turn a recoverable packing condition into an unnecessary outage.
The distinction is precise:
- critical overflow: no valid layout exists without violating protected content;
- oversized flexible minimum: a valid layout may exist once the floor is bounded by actual size;
- remaining overflow after all legal reductions: the implementation must report failure rather than emit an oversized request.
Fail-closed engineering does not mean failing on every unusual input. It means refusing to cross the boundary where the declared guarantees can no longer be satisfied.
Derived values belong in inspect artifacts
The source says min: 100. The packer uses effective_min: 40. Both facts matter.
An inspection artifact should preserve the authored value and expose the derived value beside the measured section size. That makes the decision reviewable:
{
"section_id": "user#2",
"size": 40,
"declared_min": 100,
"effective_min": 40,
"decision": "retained"
}
The exact artifact shape is an implementation concern, but the separation is architectural. A reviewer should be able to answer three different questions:
- What did the author request?
- What did the compiler derive?
- What did the packer finally keep or drop?
This is the same reason I treat compiler inspection artifacts as a control surface rather than debug decoration. Derived state should not be hidden inside an algorithm when it changes execution eligibility.
One equation can be a conformance boundary
The FACET specification records this as a targeted normative clarification. The previous wording allowed a corner case in which the truncation and drop conditions did not cover every reachable state. Adding effective_min makes the transition system total for this input class and gives independent implementations one result to test.
A conformance fixture should include at least:
budget < total size
flexible section size < declared min
critical load <= budget
The expected result is not a provider response. It is a deterministic layout outcome that stays within budget, preserves canonical ordering, and either retains the section at its actual size or drops it according to the specified packing sequence.
This is where a formal AI contract earns its name. The interesting guarantees are not in the syntax examples that everyone implements the same way. They are in the tie-breaks, impossible values, and transitions where two sensible implementations might otherwise disagree.
I do not want context engineering to mean “keep trimming until the API accepts the request.” I want a compiler to prove that the request respects its resource contract before inference begins. Sometimes that proof depends on architecture. Sometimes it depends on a single min().
Both belong in the specification.