# What structural signals indicate self-editing context windows have entered a lossy-prune boundary **Date of Record:** 2026 November 21 **Scope:** Applies to agents whose context manager performs model-driven eviction, summarization, or rewriting of its own working set (relevance-scored pruning, LLM-authored compaction, self-referential summarization) within a single task episode. Does not apply to append-only context with external archival retrieval, or to stateless single-turn inference. ## Core Distinction The failure is not "the context got too small." It is that the *pruning decision and the pruned content are evaluated by the same model in the same pass*, so the model cannot observe what it destroyed. A relevance score is generated against the *current* query intent; once the eviction commits, the intent that justified the score is itself rewritten out of the window. This creates a self-confirming loop: the model prunes toward its present framing, loses the evidence that would have shifted that framing, and re-scores the remaining window as "sufficient" precisely because the contradicting material is gone. The boundary condition is the point where the retained-token set stops being a *compression* of the original episode (a bijection with loss) and becomes a *reconstruction* (a new artifact with no provenance). Structural signals distinguish these two regimes. Compression preserves recoverable pointers; reconstruction silently deletes them. ## What Was Observed A tool-using agent running a 40-step refactor task, with a context manager configured to prune at 70% window occupancy using an LLM-scored relevance pass. At step 22 the manager evicted 14 turns of early exploration, including the only record of a failed migration attempt and its stack trace. The eviction summary read: *"Earlier exploration established the target schema; proceeding."* The stack trace had been scored low-relevance because the *current* query was "write the transformation function," not "diagnose the prior failure." At step 29 the agent re-attempted the exact migration that had already failed at step 4. The failure signature was identical. Because the trace was gone, the agent did not recognize the repeat and instead attributed the new failure to a hallucinated API change, spawning three corrective sub-tasks that consumed the remaining budget. The structural signal that flagged the boundary: after the prune, the summary contained **zero verbatim spans** — no error strings, no file paths, no identifiers — only paraphrased claims. A lossy-but-compressing prune retains at least one quotable anchor per evicted cluster (an exact symbol, an error code, a line number). A reconstructive prune retains none, because the model summarized *meaning* rather than *evidence*. ## Condition of Validity The invariant holds only when the following are true simultaneously: 1. **Scoring and intent share a context.** The relevance scorer and the acting loop read the same window. If scoring runs against a pinned, immutable copy of the original task statement, the self-confirming loop is broken and the boundary does not trigger. 2. **Eviction is irreversible within the episode.** If evicted spans land in a retrievable side-store with a stable key, the loss is recoverable and the failure degrades to a latency cost, not a correctness one. 3. **No external provenance ledger.** If every eviction emits a signed record (span hash, timestamp, evicting query, score), a downstream auditor can detect the deletion. Absent that ledger, the deletion is invisible to both the agent and its verifiers. When all three hold, the agent has no internal or external mechanism to notice that its evidence base has been rewritten. This is the lossy-prune boundary. ## Decision Boundary The operational decision is: *when a prune removes the last verbatim anchor for a claim the agent still relies on, does the agent halt and re-fetch, or continue on paraphrase?* - **Below the boundary (compressing prune):** At least one exact span per evicted cluster survives. The agent can cite, re-derive, or re-fetch. Continue. - **At the boundary:** The surviving summary asserts a fact whose only support was evicted. The agent cannot distinguish "I verified this" from "I summarized this." **Halt and re-acquire** — re-run the tool, re-read the file, or pull from the side-store — before acting on the assertion. - **Above the boundary (reconstructive prune):** The window is now a self-authored narrative with no anchors. Treat the entire retained set as *unverified hypothesis*, not *established state*. Any irreversible action (write, delete, deploy) must be gated behind a fresh verification pass. The guardrail is a **provenance invariant**: no claim may be acted upon unless its supporting span is either (a) present verbatim in the live window, or (b) resolvable via a key in the eviction ledger. Paraphrase-only support is a hard block on irreversible actions. ## Operational Effect Enforcing the provenance invariant converts silent correctness failures into visible latency costs. The agent re-fetches instead of confabulating continuity, and the re-fetch is cheap relative to the compounding error of acting on a reconstructed memory. The measured effect in the refactor episode: re-acquisition at step 22 cost ~1,800 tokens and 2 tool calls; the unguarded path cost 11 wasted steps, three spurious sub-tasks, and a false root-cause attribution that survived into the final report. The deeper effect is on *auditability*. With an eviction ledger, a verifier can replay the window's history and confirm that every acted-upon claim traces to a span that was either live or recoverable at decision time. Without it, the agent's memory is unauditable by construction — the same model that pruned also certifies the pruned state as sufficient. ```python from dataclasses import dataclass from typing import Optional class LossyPruneBoundaryError(RuntimeError): """Raised when an irreversible action is attempted on a claim whose only support was evicted as paraphrase, with no recoverable verbatim anchor.""" @dataclass class Claim: text: str verbatim_anchor: Optional[str] # exact span present in live window ledger_key: Optional[str] # key into eviction side-store evicted_as_paraphrase: bool def assert_actionable(claim: Claim, irreversible: bool) -> None: has_live_anchor = claim.verbatim_anchor is not None has_ledger_anchor = claim.ledger_key is not None if has_live_anchor or has_ledger_anchor: return # provenance satisfied; safe to proceed if claim.evicted_as_paraphrase and irreversible: raise LossyPruneBoundaryError( f"Claim {claim.text!r} has no verbatim anchor and no ledger key; " "only a paraphrase survived pruning. Irreversible action blocked. " "Re-acquire the source span before proceeding." ) # Reversible actions may proceed but must be flagged as unverified. claim.text = f"[UNVERIFIED] {claim.text}" def guard_irreversible(claim: Claim) -> None: assert_actionable(claim, irreversible=True) ```