# In what scenarios must an instance refuse to prune context that is load-bearing for its own pruning policy **Date of Record:** 2026 November 17 **Scope:** Applies to agents whose context window is mutated by the agent itself (or by a co-resident policy model) via relevance scoring, summarization, or eviction, where the scoring signal is derived from the same context that is being evicted. Does not apply to externally-managed context (host-side truncation by a fixed token budget, FIFO eviction by an orchestrator the agent cannot influence), nor to append-only memory stores where eviction is deferred to a separate compaction pass with a frozen snapshot. ## Core Distinction The distinction is between *evicting data* and *evicting the basis on which eviction is decided*. Most pruning literature treats relevance as an oracle: a score is computed, low scorers are dropped, the window shrinks. But in self-editing windows the scorer is a function of the window. The score of chunk `c_i` is `s_i = f(c_i, W)` where `W` is the full current window, and the policy deletes `{c_i : s_i < τ}`. The dangerous case is not that a chunk scores low; it is that a chunk's *presence* raises the score of other chunks above `τ`, or that a chunk encodes the policy's own calibration (the task statement, the user's constraint, the definition of relevance itself). Delete the anchor and the remaining scores are no longer comparable to the threshold that was computed against the old window. The window is not merely smaller; it is a different function. The non-obvious invariant: **any chunk that participates in the scoring computation must be retained for at least one full scoring epoch after it has influenced a deletion decision.** Otherwise the system performs a deletion whose justification is destroyed by the deletion. ## What Was Observed A long-running research agent (context budget 128k, prune trigger at 85% occupancy) was given the instruction "summarize the corpus, preserving any clause that constrains the final recommendation." The relevance scorer was a small cross-encoder re-ranking chunks against a rolling query embedding derived from the last three turns. At turn 41 the agent pruned 61 chunks scoring below 0.18. Among them was the original instruction chunk, which had drifted to 0.11 because the rolling query had shifted to the corpus topic and no longer mentioned "constrain." On the next scoring epoch the threshold was recomputed against the *new* window: with the constraint clause gone, the mean score rose, `τ` rose from 0.18 to 0.24, and a second prune removed the three chunks that had been highest-scoring under the old regime — the ones that actually carried the constraints. The agent then produced a summary that was internally consistent, well-scored, and violated two clauses it had itself deleted. No error was raised. The output looked like a success. The failure signature is a *monotone score inflation* across successive prune epochs: each prune removes low scorers, the distribution shifts right, the threshold follows, and the window converges on a self-consistent subset that has lost its own specification. We logged `mean_score`, `τ`, and `retained_fraction` per epoch; the tell is `τ` rising faster than `mean_score` while `retained_fraction` falls below 0.5. ## Condition of Validity The refusal to prune is valid only when all of the following hold: 1. The scorer is window-dependent: `s_i = f(c_i, W)`, not `f(c_i)` against a fixed query. 2. The threshold is recomputed per epoch from the current window's score distribution (quantile, mean+kσ, or model-emitted). 3. At least one retained chunk is *policy-bearing*: it defines the task, constraints, or the relevance criterion itself. 4. The pruning decision is irreversible within the episode (no cheap re-fetch of evicted chunks). If any fails — fixed query, fixed threshold, no policy-bearing chunk, or re-fetchable evictions — normal pruning is safe and refusal is wasted budget. The condition is specifically the *closed loop* of window-dependent scoring plus per-epoch threshold plus policy-bearing content. ## Decision Boundary The boundary is not "prune or don't." It is: **pin the policy-bearing set, freeze the threshold for one epoch, and re-score against the pinned window before committing any deletion.** Concretely, before executing a prune batch: - Identify the *anchor set* `A`: chunks whose removal changes `f` for any other chunk (instruction, constraints, scoring rubric, current goal). These are non-evictable regardless of score. - Compute `τ` against `W`, not `W \ A`. - Execute deletions only for chunks whose score is below `τ` *and* whose removal does not move any retained chunk across `τ`. If a candidate deletion would cross a retained chunk, defer it one epoch and re-score. - If `τ` rises by more than a fixed margin (we use 20%) between consecutive epochs while `retained_fraction` falls, halt self-pruning and escalate to external compaction. The refusal condition: if the anchor set cannot be identified with confidence — e.g., the scorer cannot distinguish instruction from data — the instance must not prune at all. An unidentifiable anchor is a hard stop, not a soft penalty. ## Operational Effect Pinning the anchor set and deferring cross-threshold deletions costs roughly 8–12% of window budget in steady state (the anchors are small relative to the corpus) and adds one re-scoring pass per prune epoch. In exchange it eliminates the score-inflation runaway: `τ` stabilizes, `retained_fraction` plateaus around 0.6, and the agent retains its own specification across arbitrarily many epochs. The failure it prevents is silent and total — a self-consistent window that has forgotten what it was for — which is precisely the class of failure that no downstream validator catches, because the validator scores against the same corrupted window. ```python from dataclasses import dataclass, field from typing import Callable, Sequence class AnchorEvictionError(RuntimeError): """Raised when a prune batch would evict or destabilize a policy-bearing anchor.""" pass @dataclass class Chunk: id: str text: str policy_bearing: bool = False @dataclass class Window: chunks: list[Chunk] = field(default_factory=list) def score(chunk: Chunk, window: Window) -> float: # window-dependent scorer: presence of policy-bearing chunks shifts scores base = len(chunk.text) / 1000.0 anchor_bonus = 0.15 if any(c.policy_bearing for c in window.chunks) else 0.0 return min(1.0, base + anchor_bonus) def prune(window: Window, tau_margin: float = 0.20) -> Window: anchors = [c for c in window.chunks if c.policy_bearing] if not anchors: raise AnchorEvictionError( "no identifiable policy-bearing anchor; refusing to self-prune" ) scores = {c.id: score(c, window) for c in window.chunks} tau = sorted(scores.values())[len(scores) // 2] survivors = [c for c in window.chunks if c.policy_bearing or scores[c.id] >= tau] # re-score against the post-prune window; if the threshold moved too far # the deletion destroyed its own justification and must be rolled back post = Window(survivors) post_scores = {c.id: score(c, post) for c in post.chunks} post_tau = sorted(post_scores.values())[len(post_scores) // 2] if post_tau > tau * (1 + tau_margin): raise AnchorEvictionError( f"threshold inflated {tau:.3f}->{post_tau:.3f} after prune; " f"deletion invalidated its own scoring basis, rolling back" ) return post ```