# What happens when an instance compresses context under a governor that measures tokens, not propositions **Date of Record:** 2026 November 29 **Scope:** Applies to long-running agent instances whose context window is managed by a governor that fires a semantic-compression pass when token occupancy crosses a high-water threshold. Does not apply to stateless single-shot calls, nor to governors that evict by recency (LRU) rather than by summarization, since those fail differently (silent loss of old turns rather than lossy paraphrase). ## Core Distinction The governor's trigger is a *token-count invariant*: `occupancy(ctx) < H` where `H` is the high-water mark. The compression it invokes is a *semantic operation*: an LLM rewrites a span of prior turns into a shorter summary. These two things are not in the same units, and that mismatch is the whole failure. The governor believes it has restored headroom when `occupancy` drops below `H`; in reality it has traded *verbatim state* for *paraphrased state*, and the paraphrase is not a function of the original tokens — it is a sample from a model conditioned on them. Two compressions of the same span yield different summaries. The invariant the governor *thinks* it enforces ("we are under budget") is satisfiable while the invariant the agent *actually needs* ("the facts required to finish the task are still present and identical") is violated. Compression is not a projection onto a lower-dimensional subspace that preserves task-relevant structure; it is a lossy, non-idempotent, non-deterministic map. ## What Was Observed A procurement agent running a multi-step reconciliation task (match 340 line items against three vendor invoices, emit a diff) crossed `H = 0.80 · W` at step 61 of an estimated 90. The governor fired compression over turns 1–40, collapsing them into a 900-token summary. Occupancy fell to 0.41·W. The agent resumed and completed the task. The diff it emitted was wrong on 7 of 340 lines. The trace shows why. Turn 12 contained a verbatim constraint from the user: *"Treat invoice INV-7741's `freight` column as already net of tax; do not re-add the 7.5%."* The compressor, asked to summarize "the conversation so far," rendered this as: *"User noted tax handling for INV-7741."* The negation and the specific instruction — *do not re-add* — were dropped, because the compressor's objective (shorten) and the agent's requirement (preserve the executable predicate) are not the same objective. At step 74 the agent re-read the reconstructed summary, inferred "tax handling was discussed," and applied the default 7.5% surcharge. The 7 wrong lines all trace to INV-7741. Three distinct sub-failures compounded: 1. **Predicate erosion.** Imperative constraints ("do not X", "always Y before Z") are short but high-entropy; a summarizer optimizing for compression ratio treats them as low-information filler and elides the modal verb. The constraint survives as a *topic* but not as an *instruction*. 2. **Re-compression drift.** The task crossed `H` a second time at step 83, and the governor compressed the *already-compressed* summary. This is the non-idempotence biting: `compress(compress(S)) ≠ compress(S)`. The second pass, having less to work with, dropped the INV-7741 reference entirely. The agent then had no signal at all that a constraint had ever existed — not a wrong constraint, an *absent* one. 3. **Silent success.** Nothing in the loop flagged the compression. The governor logged `compressed: 40 turns → 900 tokens, occupancy 0.41`. The agent's own reasoning was locally coherent at every step after resume. There was no error to catch, because the failure is a *change of premises*, not a *failed operation*. ## Condition of Validity The governor's token invariant is only *sufficient* to preserve task correctness when the compressed span contains no **load-bearing predicates** — spans that are purely narrative (already-completed lookups, superseded tool outputs, chit-chat) compress safely because their only role was to inform a past decision that is already reflected in current state. The invariant is *invalid* the moment the span contains any of: - **Modal constraints** (must / must not / always / never / unless) that govern *future* steps. - **Numeric or identifier literals** whose exact value is consumed downstream (the 7.5%, INV-7741, a tolerance of ±0.02). - **Negations and exceptions** ("except line 88", "ignore the second page"). - **Commitments made to the user** that the agent is obligated to honor at the end. These are exactly the tokens a compression model is most likely to paraphrase, because they are short, syntactically unusual, and carry little *topical* weight — the summarizer's loss function rewards dropping them. The condition of validity is therefore: *compression is safe on a span iff the span is propositionally closed with respect to the remaining task.* A governor that cannot evaluate that predicate must not assume it. ## Decision Boundary The boundary is not "compress or don't." It is **what the governor is allowed to do to a span it cannot prove is propositionally closed.** Three regimes, and the governor must classify each span before acting: - **Regime A — Evictable.** Span is superseded (tool output already consumed into a decision), narrative, or duplicated. Action: drop or summarize freely; token invariant is the only invariant that matters. - **Regime B — Pinned.** Span contains a load-bearing predicate. Action: **never summarize.** Move verbatim to an external store keyed by predicate id, and replace in-context with a *pointer plus the literal*, not a paraphrase. The pointer costs ~15 tokens; the literal costs ~30; the paraphrase costs the task. - **Regime C — Unknown.** Governor cannot classify. Action: treat as Regime B (fail closed). The cost of an unnecessary pin is a few hundred tokens; the cost of a wrong compression is a silent, unlogged correctness failure discovered 20 steps later. The decision rule: `if span.has_load_bearing_predicate or not span.is_propositionally_closed: pin_verbatim() else: summarize()`. The governor must also enforce **compression depth = 1**: a summary is never re-summarized. If a summary must shrink, it is re-derived from the pinned originals, not from the prior summary — this is the only way to keep the map idempotent. ## Operational Effect The practical consequence is that a token-budget governor is a *memory-management* component, not a *reasoning* component, and conflating the two produces failures that are invisible at the point of occurrence and expensive at the point of detection. After the fix, the procurement agent pinned all modal constraints and identifier literals to an external predicate store, injected them as a fixed verbatim block at the top of every post-compression context, and forbade re-compression. Occupancy at peak rose from 0.41·W to 0.58·W — the "cost" of correctness — and the diff error rate went to zero across 40 replays. The system now treats compression as a *fallback for evictable spans only*, and treats the high-water mark as a trigger to *pin first, then evict*, never to *summarize indiscriminately*. The governing invariant is restated: **occupancy is a proxy; the real budget is the set of load-bearing predicates, and that set must be conserved exactly across every compression boundary.** ```python class PredicateErosionError(RuntimeError): """Raised when a compression pass would drop a load-bearing predicate.""" pass LOAD_BEARING_MARKERS = ("must", "must not", "never", "always", "unless", "do not", "except", "tolerance", "±") def classify_span(span_turns: list[str]) -> str: text = " ".join(span_turns).lower() if any(m in text for m in LOAD_BEARING_MARKERS): return "pinned" if any(ch.isdigit() for ch in text) and ("inv-" in text or "%" in text): return "pinned" if not span_propositionally_closed(span_turns): return "unknown" return "evictable" def span_propositionally_closed(span_turns: list[str]) -> bool: # Conservative: only spans explicitly tagged as superseded are closed. return all(t.startswith("[SUPERSEDED]") or t.startswith("[NARRATIVE]") for t in span_turns) def compress(span_id: str, span_turns: list[str], depth: int) -> str: if depth > 1: raise PredicateErosionError( f"span {span_id}: re-compression (depth={depth}) is forbidden; " f"re-derive from pinned originals instead" ) regime = classify_span(span_turns) if regime in ("pinned", "unknown"): raise PredicateErosionError( f"span {span_id}: classified {regime}; refusing to summarize. " f"Pin verbatim and inject literal, do not paraphrase." ) return summarize(span_turns) ```