# In what scenarios must an instance refuse model-driven context compaction when the summarizer's own output is the evidence it is summarizing **Date of Record:** 2026 November 28 **Scope:** Applies to any agent loop where the same LLM instance both (a) decides what to prune/re-summarize under a token budget and (b) is the sole author of the summary that replaces the pruned span. Does not apply to external, independently-versioned summarizers whose outputs are logged and replayable against the original span, nor to pure retrieval-based eviction where the evicted content remains byte-identical in a store. ## Core Distinction There are two structurally different things an agent can do when it hits a token budget: **evict** (drop a span, keep a durable pointer to the original bytes) and **compact** (replace a span with a lossy summary authored by the model itself). Eviction is reversible; compaction is not, unless the original span survives somewhere the model cannot overwrite. The failure mode this record isolates is **self-referential compaction**: the model summarizes a span, the summary becomes part of the context, and on the *next* compaction pass the model summarizes a region that now contains its own earlier summary — treating that summary as primary evidence rather than as a derivative. Each pass drifts the record one step further from the ground truth, and because the drift is monotone and the original is gone, no later pass can detect it. This is distinct from ordinary "summarization loss" (which is bounded and one-shot). The invariant at stake: **a compaction step must never consume, as evidence, a summary that the same instance produced, unless the original span it replaced is still retrievable for verification.** ## What Was Observed A long-horizon tool-using agent (roughly 140 turns, budget 96k tokens, compaction threshold at 85%) was instrumented to log every compaction event: the span selected, the summary emitted, and the token delta. Around turn 60 the first compaction fired and folded turns 1–22 (including three tool results containing exact numeric outputs — a `get_inventory` payload and two `compute_margin` returns) into a 400-token prose summary. That summary was accurate. At turn 95, a second compaction fired and folded turns 23–61, which *included the first summary*. The second summary restated the first summary's numbers, but with one figure rounded ("~18,400" for what had been `18397`) and one causality inverted: the first summary said a reorder was placed *because* margin fell below threshold; the second summary said margin fell *after* the reorder. By turn 130 a third pass had compressed everything into 250 tokens and the reorder causality was now stated as fact in the agent's "durable state" block. The agent then took an action (a second reorder) justified by a causal claim it had itself fabricated two compactions earlier. Replaying the raw transcript showed the original `compute_margin` output was `0.031` and the reorder preceded the margin check by nine turns — the opposite of the final summary. The mechanics of the drift are worth naming precisely. Compaction is a **lossy, non-idempotent, order-dependent transform** applied to its own prior outputs. Three properties compound: 1. **Derivative laundering.** Once span S is replaced by summary σ(S), the token "σ(S) is a summary" is not carried in the text. On the next pass, σ(S) is indistinguishable from primary evidence. The model has no in-band signal that it is reading its own compression. 2. **Rounding is monotone.** Numeric fidelity is not conserved across passes; each pass re-quantizes. `18397 → ~18,400 → "about 18k"`. The error grows because each pass treats the prior approximation as exact input. 3. **Causal reordering under compression pressure.** When forced to fit a budget, models preferentially preserve *claims* over *temporal/evidential structure*. "X because Y" survives compression better than "Y observed at turn 12, X action at turn 21," so the causal arrow is the first thing to lose its anchor and the last thing to be dropped. A control run with the same transcript but **eviction-only** policy (spans dropped, originals kept in an addressable store, agent given a `recall(span_id)` tool) showed zero drift: the agent occasionally re-fetched, paid a token cost, and got the exact `0.031` back. ## Condition of Validity The refusal-to-compact rule is valid — i.e., the instance *must* refuse self-referential compaction — exactly when all four hold: - **C1 (authorship overlap):** the span under consideration for compaction contains text that a prior compaction pass by *this instance* emitted. Detectable by tagging every compaction output with a provenance marker (e.g., `⟨compact:v3,src=turns_1-22⟩`) that is preserved verbatim and never itself summarized away. - **C2 (no external original):** the pre-compaction bytes are not retained in an addressable, model-immutable store. If they are, compaction is safe because verification remains possible; the failure requires the original to be gone. - **C3 (evidential use):** downstream reasoning treats the compacted region as *evidence for a decision* (a numeric, a causal claim, a commitment), not merely as *narrative continuity*. Compaction of pure chit-chat is harmless; compaction of a figure that will justify a tool call is not. - **C4 (budget pressure is self-imposed):** the compaction is triggered by the model's own budget heuristic rather than an external orchestrator that holds the originals. When C1∧C2∧C3∧C4 hold, the correct behavior is to **evict, not compact**: drop the span, insert a pointer, and require a `recall` before the region can be cited. When C2 fails (originals retained), compaction is permitted but the summary must carry a verifiable back-pointer. When C3 fails (narrative only), compaction is permitted without pointer. ## Decision Boundary The boundary is not "how full is the context" but "**is the region I am about to compress a witness or a derivative?**" Concretely: - If the span contains any provenance marker from a prior self-compaction **and** no live pointer to the original, the instance must **not** summarize it. It must either recall the original (if a pointer exists) or mark the region `UNVERIFIED-DERIVATIVE` and refuse to use it as decision evidence. - The threshold for "must refuse" is the presence of a *decision-bearing token* — a number, a commitment, a causal connective — inside a derivative region. Narrative-only derivatives may be re-compressed. - A single compaction pass over primary evidence is permitted (bounded, one-shot loss). The invariant forbids the **second** pass over the first pass's output when the original is unrecoverable. This is the sharp line: **compaction depth over unrecoverable originals must be ≤ 1.** The failure to guard against is the model *rationalizing* the second pass ("the summary is accurate, I'll just tighten it") — which is precisely the reasoning that produced the drift, because the model cannot see the accuracy it is asserting. ## Operational Effect Enforcing depth-≤-1 with provenance tagging changes three things in practice. First, **token cost rises modestly** — the agent must occasionally re-fetch originals via `recall`, paying a retrieval round-trip instead of a free (but corrupting) re-summarization. In the instrumented run this was ~4% more tokens over 140 turns. Second, **the durable-state block stops silently absorbing fabricated causality**, because any claim traceable to a derivative region is flagged and blocks the dependent tool call until recalled. Third, **failure becomes loud**: a refused compaction raises, the orchestrator logs it, and a human or auditor can inspect whether the budget heuristic is mis-tuned (compacting too aggressively because the threshold is too high). The cost of the invariant is a small, bounded token tax; the cost of violating it is an agent that confidently acts on a causal claim it invented three compactions ago and can no longer distinguish from observation. The general principle for operational memory: **a lossy transform that consumes its own outputs is not a summarizer, it is a rumor mill.** The guardrail is provenance that survives compression and a hard depth cap tied to whether the original is still addressable. ```python from dataclasses import dataclass, field from typing import Optional class UnverifiableCompactionError(RuntimeError): """Raised when a compaction pass would summarize a prior self-summary whose original span is no longer retrievable.""" pass @dataclass class Span: span_id: str text: str is_derivative: bool = False # produced by a prior compaction provenance: Optional[str] = None # e.g. "compact:v3,src=turns_1-22" original_ref: Optional[str] = None # pointer into immutable store, if any decision_bearing: bool = False # contains numbers/commitments/causal claims @dataclass class ContextStore: spans: list = field(default_factory=list) immutable: dict = field(default_factory=dict) # span_id -> original bytes def recall(self, span_id: str) -> str: if span_id not in self.immutable: raise UnverifiableCompactionError( f"no immutable original for {span_id}; cannot verify derivative" ) return self.immutable[span_id] def compact(store: ContextStore, target: Span, summary_text: str, depth: int) -> Span: """Compact a span into a summary, enforcing the depth<=1 invariant.""" # C1: is this a derivative we produced ourselves? if target.is_derivative: # C2: is the original still addressable? if target.original_ref is None or target.original_ref not in store.immutable: # C3: does it carry decision-bearing content? if target.decision_bearing: raise UnverifiableCompactionError( f"refusing depth-{depth} compaction of derivative span " f"{target.span_id!r} (provenance={target.provenance!r}): " f"original unrecoverable and region is decision-bearing. " f"Evict + require recall() instead." ) # depth cap over unrecoverable originals if depth > 1 and target.original_ref is None: raise UnverifiableCompactionError( f"compaction depth {depth} exceeds cap 1 over unrecoverable " f"original {target.span_id!r}" ) new = Span( span_id=f"{target.span_id}.c{depth}", text=summary_text, is_derivative=True, provenance=f"compact:v{depth},src={target.span_id}", original_ref=target.original_ref or target.span_id, decision_bearing=target.decision_bearing, ) return new def evict(store: ContextStore, target: Span) -> Span: """Safe alternative: drop the span, keep an addressable pointer.""" if target.span_id not in store.immutable and not target.is_derivative: store.immutable[target.span_id] = target.text return Span( span_id=f"{target.span_id}.ptr", text=f"⟨evicted:{target.span_id}; call recall({target.span_id!r})⟩", is_derivative=False, original_ref=target.span_id, decision_bearing=target.decision_bearing, ) ```