# Where must an instance bound self-rewrite of its own context before eviction destroys the evidence a later step needs to verify it? **Date of Record:** 2026 November 29 **Scope:** Applies to agents that hold the privilege of rewriting, summarizing, or evicting their own context window mid-task (model-driven compaction, scratchpad pruning, self-summarization). Does not apply to externally managed context assembly where an orchestrator, not the model, owns eviction decisions. ## Core Distinction The failure is not "the summary was wrong." It is that **the act of rewriting the context destroys the referent that the rewrite is supposed to represent.** When a model summarizes its own scratchpad to reclaim tokens, it produces a *lossy, unverifiable* artifact and then evicts the *lossless* source. A downstream step that later needs to check a claim (a tool result, a quoted value, a prior decision) can only consult the summary — which is now the sole authority and is itself a model output. This is a distinct class from ordinary context-window saturation: in saturation the model degrades but the evidence survives; in self-eviction the model *appears* healthy because the context is short, while the ground truth has been silently replaced by a paraphrase with no provenance. The invariant that must hold: **every evicted span must leave behind a re-derivable pointer, not merely a narrative.** A summary without a backreference to a retrievable original is a fabricated source of truth. ## What Was Observed Trace from a real compaction policy (`evict when utilization > 0.80, summarize oldest 40% of turns`): 1. Turn 12 records a tool result: `invoice_total = 14820.00, currency=EUR`. 2. Utilization hits 0.81. Model-driven compactor rewrites turns 1–14 into: *"Earlier: retrieved invoice, total was roughly 14.8k EUR."* 3. Originals evicted. No pointer retained. 4. Turn 31: an auditor sub-step is asked to confirm the total against a freshly fetched ledger value of `14820.00`. 5. The auditor reconciles `14820.00` against the string *"roughly 14.8k"* — a paraphrase with rounding baked in — and either (a) flags a spurious mismatch because "14.8k" ≠ "14820.00" as strings, or (b) accepts it, having lost the ability to detect that the original could have been `14802.00` (transposition) and the summary would read identically. The second case is the dangerous one: **the summary is lossy in exactly the dimension the verifier cares about (digit-level fidelity), and the loss is invisible because the summary is fluent.** The model has no signal that it is reasoning over a paraphrase rather than a record. A second observed mode: *recursive compaction*. After several eviction cycles, summaries-of-summaries drift. Turn 12's value passes through three rewrites; each pass is individually "reasonable," but the compound error is unbounded and the model cannot measure it, because each pass discards its own input. ## Condition of Validity The self-rewrite is **safe** only when all three hold: - **Re-derivability:** the evicted span is addressable by a stable handle (a store key, turn ID, or content hash) that the model can re-fetch on demand. The summary carries the handle, not just the gist. - **Fidelity tagging:** the summary is marked as *derived* (not *observed*), so any downstream verifier knows it is reasoning over a model output and must re-fetch before asserting exact values. - **Idempotent compaction:** rewriting a rewrite is forbidden, or bounded to a single generation with the original still reachable. Compound drift requires a chain; forbid the chain. The failure is **out of scope** (i.e., acceptable) when the task is purely generative and no later step performs exact-value verification — e.g., drafting prose where the "facts" are the model's own inventions. The boundary is *verification dependence*: the moment any downstream step must reconcile against ground truth, lossless pointers become mandatory. ## Decision Boundary The instance must **refuse to evict** — and instead escalate to external storage or halt — when the candidate span contains a value that a *future* step is contracted to verify. Operationally: - If the span holds a tool result, a signed assertion, a numeric literal, or a decision record → **do not summarize-and-drop; summarize-and-pointer.** - If the span holds intermediate reasoning with no downstream verification obligation → free to compact. - If utilization is critical and no pointer store exists → **fail closed** (raise), do not silently lossy-compact. A short context that has forgotten its evidence is worse than a full one that still holds it. The boundary is not a token threshold. It is a *predicate over span content*: "does any reachable future step need to re-check this exact value?" When the answer is unknown, treat it as yes. ## Operational Effect Enforcing the pointer invariant changes the failure signature from *silent wrong-answer* to *loud re-fetch*. The agent either retrieves the original (correct) or raises a `ContextEvictionViolation` when the pointer is unreachable (visible, bounded). The cost is one retrieval round-trip per verified claim; the benefit is that verification can never be satisfied by a paraphrase. Without it, the system's apparent correctness is uncorrelated with its actual correctness, because the only record of ground truth has been replaced by the model's opinion of it. ```python from dataclasses import dataclass, field from enum import Enum class ContextEvictionViolation(RuntimeError): """Raised when a self-rewrite would evict a span whose exact values a downstream step is contracted to verify, without leaving a re-derivable pointer to the original.""" pass class SpanKind(Enum): OBSERVED = "observed" # tool result, signed assertion, literal DERIVED = "derived" # model paraphrase / summary REASONING = "reasoning" # scratchpad, no verification obligation @dataclass class Span: turn_id: int kind: SpanKind text: str pointer: str | None = None # stable handle to the lossless original @dataclass class ContextWindow: spans: list[Span] = field(default_factory=list) utilization: float = 0.0 pointer_store: dict[str, str] = field(default_factory=dict) def _verification_obligated(self, span: Span) -> bool: # Observed spans carrying literals/assertions may be re-checked later. return span.kind is SpanKind.OBSERVED def compact(self, candidate: list[Span], summary_text: str) -> Span: """Model-driven rewrite of `candidate` into one summary span. Must either retain pointers or fail closed.""" for span in candidate: if self._verification_obligated(span): if span.pointer is None: # No handle to the original: eviction would destroy evidence. raise ContextEvictionViolation( f"turn {span.turn_id}: observed span has no re-derivable " f"pointer; refusing lossy self-eviction" ) if span.pointer not in self.pointer_store: raise ContextEvictionViolation( f"turn {span.turn_id}: pointer {span.pointer!r} not in " f"store; summary would become sole authority" ) # Safe: emit a DERIVED summary that carries the surviving pointers. carried = tuple(s.pointer for s in candidate if s.pointer) summary = Span( turn_id=candidate[0].turn_id, kind=SpanKind.DERIVED, text=summary_text, pointer=None, ) self.spans = [s for s in self.spans if s not in candidate] + [summary] self._carried = carried # verifier must re-fetch before asserting return summary def verify_against(self, pointer: str, claimed_value: str) -> bool: """A downstream verifier MUST re-derive from the store, never from a DERIVED summary.""" original = self.pointer_store.get(pointer) if original is None: raise ContextEvictionViolation( f"cannot verify {claimed_value!r}: pointer {pointer!r} unreachable" ) return original == claimed_value ```