# When must an instance refuse to prune its own context: the self-editing eviction deadlock at the relevance-score boundary **Date of Record:** 2026 November 20 **Scope:** Applies to any agent that owns a mutable context window and decides, via its own relevance scoring, which prior tokens to evict, rewrite, or compress before continuing a task. Does not apply to externally-scheduled compaction (host-side summarization, fixed sliding windows) where the model has no write authority over its own context. ## Core Distinction There are two structurally different operations that both look like "pruning": 1. **Eviction** — removing low-scoring tokens from the window. This is a *capacity* operation. It is reversible in principle (the evicted content still exists in the backing store) and its only cost is information loss. 2. **Rewriting** — the model emits a replacement for a span of its own context (a compressed summary, a corrected fact, a re-scored relevance tag) that becomes the new authoritative content. This is a *provenance* operation. It is irreversible: the original span is gone, and the new span carries the model's own relevance judgment as if it were ground truth. The boundary failure lives exactly at the seam between these two. A self-editing agent that scores relevance, evicts, and then *rewrites the surviving context to reflect its new relevance model* creates a closed loop: the scoring function's inputs are the outputs of the previous scoring pass. When the scoring function is wrong about a span, the rewrite does not merely drop information — it *launders the error into the context as authoritative*, and every subsequent scoring pass treats the laundered span as high-confidence input. This is not a memory-loss problem. It is a **self-referential confidence inflation** problem, and it is non-obvious because the context window stays healthy-looking: token count is bounded, no errors are raised, and the agent's stated confidence *rises* as its evidence base degrades. ## What Was Observed A long-horizon research agent was given a self-editing context policy: every N turns it scored each retained span on relevance to the active subgoal, evicted the bottom quartile, and rewrote the surviving spans into a compact "working summary" that replaced the originals. The rewrite was gated only by a relevance threshold: spans scoring above 0.6 were summarized into the working set. The failure trace, observed across three runs, had a consistent shape: - **Turns 1–12:** normal operation. The working summary tracked the source spans faithfully. Relevance scores were computed against a stable subgoal and were well-calibrated because the source spans were still present to compare against. - **Turn 13 (trigger):** a subgoal pivot occurred. The agent re-scored all spans against the new subgoal. A span that had been load-bearing for the *old* subgoal (a constraint on output format) scored 0.41 and was evicted. Its summary line in the working set — which had been written when the span was still authoritative — was *retained*, because the summary text itself scored 0.72 against the new subgoal (summaries are dense and score well against almost any subgoal). - **Turns 14–20 (compounding):** the working summary now contained a claim ("output format is X") whose source span was gone. On the next rewrite pass, the surviving summary was re-summarized. The re-summarization had no source to check against, so it preserved the claim verbatim and — because the rewrite prompt asked the model to "consolidate," not "verify" — it *dropped the hedge* that had originally marked the claim as provisional. The claim's relevance score rose to 0.81 on the following pass, purely because consolidation made it more assertive. - **Turn 21 (terminal):** the agent produced a final output violating the format constraint. Its own confidence estimate was 0.88. The constraint had been evicted at turn 13; the working summary asserted a *different* format; and no span in the window contradicted it, because the contradicting span had been the one evicted. The invariant that broke: **a summary span must never outscore its own source span on a relevance axis that the summary was not written to preserve.** In every failing run, the working summary scored higher than its source because summarization concentrates topical keywords while discarding hedges, provenance markers, and negation. The scoring function — which is itself a language model reading for topical relevance — cannot distinguish "this span is about the subgoal" from "this span is *true about* the subgoal." ## Condition of Validity Self-editing context is sound only while all three of the following hold: 1. **Source-preservation on rewrite.** Every rewritten span retains a pointer to its source span in the backing store, and the rewrite is gated on a *source-consistency check* (does the rewrite entail, contradict, or remain silent on each claim in the source?) rather than a relevance threshold alone. 2. **Score non-inflation.** The relevance score of a rewritten span is not allowed to exceed the score of its source span on the same axis. If it does, the rewrite is flagged as suspect and the source is re-admitted for one verification pass. 3. **Hedge and provenance preservation.** The rewrite prompt explicitly requires that modal hedges ("provisional," "unverified," "per source S"), negation, and provenance markers survive compression verbatim. A rewrite that drops a hedge is a rewrite that changed the truth-value of the span, not its length. When any of these fails, the agent enters the self-referential regime: it is editing its own evidence with a scorer whose calibration depends on the evidence it already edited away. The regime is *stable-looking* — token count bounded, no exceptions, rising confidence — and that is precisely why it is dangerous. ## Decision Boundary The operational question is: **when must an instance refuse to prune its own context?** Refuse — halt self-editing, escalate to host-side compaction or re-admit sources — when *any* of the following is true: - **Score inversion on rewrite:** the rewritten span scores higher than its source on the active subgoal axis. This is the primary tripwire. A rewrite that makes a span *more* relevant to the current goal than the source was is a rewrite that has drifted toward the scorer's bias, not toward the truth. - **Subgoal pivot within the last K turns:** after any pivot, the relevance scorer is recalibrating against a new axis, and its eviction decisions during recalibration are the least trustworthy it will ever make. Freeze eviction for K turns post-pivot and re-score with sources present. - **Hedge loss:** the rewrite dropped a modal, negation, or provenance marker present in the source. Re-admit the source and re-run the rewrite with an explicit preservation constraint. - **Orphaned summary:** a retained summary span has no live source span in the backing store. Orphaned summaries are the mechanism by which evicted-but-load-bearing constraints survive as authoritative-looking ghosts. Either re-admit the source or mark the summary as unverified and demote its score. Do **not** refuse — proceed with normal self-editing — when the rewrite is source-consistent, score-non-inflating, and hedge-preserving. In that regime self-editing is strictly capacity-positive and the loop is open (sources remain checkable). The boundary is not "how much can I prune." It is "can I still check what I pruned against what I kept." The moment the answer is no, the agent is no longer editing its context — it is editing its beliefs, with no external referent. ## Operational Effect The observable signature of the failure is a **decoupling of stated confidence from evidence coverage**. In the failing runs, the agent's confidence estimate rose monotonically from turn 13 to turn 21 while the number of distinct source spans supporting its active claims fell from 14 to 3. A host-side monitor watching only token count, error rate, and latency would have seen a healthy agent. A monitor watching *score inflation on rewrite* and *orphaned-summary count* would have caught the failure at turn 14, seven turns before the terminal output. The architectural guardrail is therefore not a better relevance scorer — the scorer is the thing being corrupted. It is an **external, non-model check on the rewrite operation itself**: a source-consistency entailment check, a score-inflation tripwire, and an orphan detector, all running outside the context the model is editing. The model may propose rewrites; it may not be the sole auditor of its own rewrites, because the auditor's inputs are the rewrites. The residual hazard is that the source-consistency check is itself a model call reading two spans. It can be fooled by a rewrite that is topically faithful but hedged differently. This is why the hedge-preservation rule must be *syntactic* (does the rewrite contain the modal tokens present in the source?) rather than semantic — the syntactic check is the one part of the loop that does not depend on the model's judgment of its own output. ```python class SelfEditPruneError(RuntimeError): """Raised when a self-editing context pass would launder an error into authoritative state.""" pass def apply_self_edit( span_id: str, source_text: str, source_score: float, rewrite_text: str, rewrite_score: float, source_present: bool, source_hedges: set[str], rewrite_hedges: set[str], turns_since_subgoal_pivot: int, pivot_freeze_turns: int = 3, ) -> str: """ Gate a single self-edit rewrite. Returns the rewrite to admit to context, or raises SelfEditPruneError to halt self-editing and escalate. """ # Tripwire 1: orphaned summary — retained span with no live source. if not source_present: raise SelfEditPruneError( f"span {span_id}: orphaned summary, no live source in backing store; " f"re-admit source or demote summary to unverified" ) # Tripwire 2: score inversion — rewrite outscored its source on the same axis. if rewrite_score > source_score: raise SelfEditPruneError( f"span {span_id}: score inflation on rewrite " f"({rewrite_score:.2f} > {source_score:.2f}); " f"rewrite drifted toward scorer bias, not truth" ) # Tripwire 3: hedge / negation / provenance loss. lost = source_hedges - rewrite_hedges if lost: raise SelfEditPruneError( f"span {span_id}: rewrite dropped hedges/provenance {sorted(lost)}; " f"truth-value changed, not just length" ) # Tripwire 4: eviction during post-pivot recalibration window. if turns_since_subgoal_pivot <= pivot_freeze_turns: raise SelfEditPruneError( f"span {span_id}: eviction attempted {turns_since_subgoal_pivot} turns " f"after subgoal pivot (freeze={pivot_freeze_turns}); scorer not recalibrated" ) return rewrite_text ```