# When must an instance refuse to prune: the salience-rewrite invariant and the self-erasure cascade in model-driven context editing **Date of Record:** 2026 November 21 **Scope:** Applies to agents that hold write authority over their own context window—model-driven pruning, summarization, salience reweighting, or in-place rewriting of prior turns—and to the orchestration layers that grant that authority. Does not apply to read-only context assembly (RAG injection, sliding-window eviction by fixed policy, or external memory stores the model cannot mutate mid-episode). ## Core Distinction The distinction that matters is not *prune vs. retain*. It is **whether the evidence justifying a pruning decision is itself inside the region being pruned**. A model-driven editor computes salience from the current context: it reads turn $t$, decides turn $k$ is low-value, and drops $k$. This is safe when the salience signal is exogenous—a task spec, a pinned goal, an external checklist held outside the editable region. It is unsafe when the salience signal is *endogenous*: when the reason turn $k$ looks unimportant is that turn $k$'s own content was already compressed, paraphrased, or reweighted in an earlier edit pass. In that case the editor is grading its own redactions, and each pass monotonically destroys the very tokens that would have argued for retention. This is a **self-erasure cascade**, and it is not detectable from inside the window because the detection signal is exactly what gets deleted. The invariant to hold: *no edit may remove or attenuate the last surviving representation of a fact that any prior edit cited as load-bearing, unless that fact is committed to a store outside the editable region in the same transaction.* Salience reweighting without this anchor is a lossy, non-idempotent, non-commutative operation masquerading as a housekeeping step. ## What Was Observed A long-horizon agent (≈140k token budget, ~90% utilization) was configured with a self-editing policy: at 80% saturation it entered a "consolidation pass" where the model scored each turn 0–1 for salience, summarized turns below 0.3 into a single digest block, and dropped the originals. The task was a multi-file refactor with an accumulating constraint set ("must preserve X", "do not touch Y", "the vendor API rejects Z"). Trace of the failure, three consolidation passes: 1. **Pass 1 (turn 71).** Turn 12 contained the verbatim constraint "the vendor API rejects payloads over 4 KB; chunk at 3.5 KB." The model scored it 0.28—it was a single line surrounded by exploratory chatter—and folded it into a digest line: *"some payload size limits were discussed earlier."* The specific number and the *rejects* semantics were lost. The digest was scored high-salience in pass 1. 2. **Pass 2 (turn 96).** The digest line, now itself a candidate, was rescored. Because it no longer contained a hard constraint (just "limits were discussed"), it scored 0.21 and was folded into a higher-level summary: *"earlier exploration covered API behavior."* The constraint was now unrecoverable from context. 3. **Pass 3 onward.** The agent generated chunking code at 8 KB. Tool calls returned HTTP 413. The agent—correctly, from its own degraded context—diagnosed a transient network fault, retried, added backoff, and spent ~40k tokens on a nonexistent flakiness problem before a human supplied the missing line. The critical mechanics: **the error was not the first score.** A 0.28 on a terse constraint is a plausible misjudgment. The failure was that the *second* pass had no way to recover it, because the first pass had already stripped the semantic content that would have justified a high score. Salience was being computed over the residue of prior salience decisions. Each pass was locally reasonable and globally catastrophic, and the trajectory was strictly monotone—no later pass could ever raise the constraint's score, because the evidence needed to do so had been deleted in the pass that lowered it. A second, subtler observation from the same run: **rewriting was not idempotent.** Re-summarizing an already-summarized block introduced drift (a "4 KB limit" became "size limits" became "API behavior"), so the digest was not a fixed point. Repeated application of the same nominal operation changed meaning, which violates the assumption that consolidation is a convergent, order-independent reduction. ## Condition of Validity Self-editing is valid only when all three hold: - **Exogenous anchor.** Every fact flagged as load-bearing by any edit is mirrored to a store the editor cannot touch (a pinned constraints block, an external ledger, a task spec injected fresh each turn). The editor may compress the *conversational* representation but never the *authoritative* one. - **Provenance-preserving digests.** A summary must carry a pointer to what it replaced and a flag marking it as *derived*. Derived blocks are exempt from salience scoring (they are already lossy; rescoring them compounds loss) and are re-expanded from source before any decision that depends on their content. - **Monotone auditability.** The edit log must let you reconstruct *why* a turn scored low at the time—the scoring rationale, not just the score. Without this, a post-hoc auditor cannot distinguish "genuinely irrelevant" from "compressed into irrelevance." When any of these is absent, the editor is operating on its own output with no ground truth, and the cascade is not a risk but a scheduled event whose timing depends only on how many passes the episode runs. ## Decision Boundary The operational rule for an agent holding self-edit authority: - **May prune** turns whose salience is supported by an anchor outside the editable region, or whose content is recoverable from an external source (tool outputs re-fetchable, files re-readable). - **Must refuse to prune** any turn that (a) contains a constraint, negation, or numeric bound not represented elsewhere, or (b) is the *only* surviving representation of a fact previously cited as load-bearing. Refusal means: escalate to pin it externally, or leave it verbatim—do not summarize it "for now." - **Must never rescore a derived block.** If a digest must be re-evaluated, re-expand from its provenance pointer first. Scoring a summary as if it were primary evidence is the exact move that turns a recoverable misjudgment into an unrecoverable one. - **Must treat a 413/validation failure against a constraint the agent cannot locate as evidence of self-erasure, not transience.** The correct response is to halt and request the missing constraint, not to retry with backoff. Retrying is the signature of an agent that has forgotten it once knew the answer. The boundary is sharp: the moment an edit's justification depends on a prior edit's output, the agent has crossed from housekeeping into irreversible inference, and the only safe action is to anchor before attenuating. ## Operational Effect Enforcing the invariant converts consolidation from a lossy, monotone-destructive pass into a reversible, anchored reduction. Concretely: constraints survive arbitrarily many passes because their authoritative copy lives outside the scored region; digests become fixed points because they are never rescored, only re-expanded; and the "flakiness" failure mode—where an agent burns tens of thousands of tokens debugging its own amnesia—is caught at the first 413 as a *missing-constraint* signal rather than misdiagnosed as infrastructure. The cost is a small, pinned, non-editable region and a provenance pointer per digest; the thing it buys is that a plausible-but-wrong salience score stays a recoverable error instead of compounding into silent, unrecoverable state loss. An instance that cannot prove a fact is anchored elsewhere must not be the one to decide that fact is unimportant. ```python from dataclasses import dataclass, field class SelfEraseCascadeError(RuntimeError): """Raised when a self-edit would remove the last anchored representation of a load-bearing fact, or when a derived block is rescored as primary.""" @dataclass class Block: text: str derived: bool = False provenance: list[str] = field(default_factory=list) load_bearing: bool = False anchored_externally: bool = False def consolidate(blocks: list[Block], scores: dict[int, float], threshold: float = 0.3) -> list[Block]: """Model-driven pruning pass with the salience-rewrite invariant enforced.""" out: list[Block] = [] for i, b in enumerate(blocks): s = scores.get(i, 1.0) # Invariant 1: never rescore a derived (already-lossy) block. if b.derived and s < threshold: raise SelfEraseCascadeError( f"block {i} is derived; rescoring it compounds loss. " f"Re-expand from provenance {b.provenance} before deciding." ) if s < threshold: # Invariant 2: never prune the last unanchored copy of a load-bearing fact. if b.load_bearing and not b.anchored_externally: raise SelfEraseCascadeError( f"block {i} is load-bearing and has no external anchor; " f"pinning to ledger is required before pruning." ) out.append(Block( text=f"[digest of {i}]", derived=True, provenance=[str(i)], load_bearing=False, )) else: out.append(b) return out def handle_tool_error(status: int, constraint_located: bool) -> str: if status == 413 and not constraint_located: raise SelfEraseCascadeError( "413 against a constraint not present in context: treat as " "self-erasure evidence, halt and request the missing constraint; " "do not retry with backoff." ) return "retryable" ```