# In what scenarios must an instance distrust its own salience-scored context pruning when the pruner and the pruned share the same token budget **Date of Record:** 2026 December 4 **Scope:** Applies to agents that author their own context-management policy at runtime — emitting salience scores, summaries, or deletion decisions over their own message history. Does not apply to externally fixed, statically configured pruning (e.g., a host-side fixed-window truncator) where the policy author and the policy subject are different principals. ## Core Distinction The dangerous case is not "the agent pruned too much." It is **self-referential salience collapse**: the same probabilistic process that *evaluates* salience is also a *consumer* of the retained context and shares its token budget with the artifact it is producing. When an agent writes a pruning decision, the decision itself consumes budget, and the act of scoring is conditioned on the very history being scored. This creates a feedback loop absent from external pruning: the pruner's judgment degrades exactly as it deletes the evidence that would have corrected the judgment. Concretely: an agent at 92% context saturation is asked to summarize and drop low-salience turns. It scores each turn, keeps the "high-salience" ones, and drops the rest. But salience is computed *from the current window*, and the current window is already near saturation — so the model's attention is diffuse, and it systematically assigns high salience to **recency and surface lexical overlap with the current instruction**, and low salience to the *causally load-bearing but lexically distant* turns (the constraint stated 40 turns ago, the failed tool call whose error explains the current wrong path). The pruner deletes the ground truth of its own failure and keeps the noise that resembles the current query. ## What Was Observed A multi-step agent (tool-calling loop, ~30 turns, 128k window) was given a self-pruning directive at 85% saturation: "Score each prior turn 0–1 for relevance to the active goal; drop turns below 0.3; summarize the rest into ≤800 tokens." Trace: 1. **Turn 4** stated a hard constraint: `output schema must be CSV, no header`. Lexically distant from turn 28's query (`compute the aggregate`). Scored **0.18** → dropped. 2. **Turn 11** contained a tool error: `write failed: permission denied on /out`. This explains why turn 27's verification is failing. Scored **0.22** (it reads as noise, not as a causal antecedent) → dropped. 3. **Turn 26–27** were the agent's own recent reasoning, lexically identical to the turn-28 query. Scored **0.71, 0.68** → retained verbatim. Post-prune, the agent re-derived the output as JSON-with-header (constraint gone), re-attempted the write to `/out` (error gone), failed again, and — critically — **re-ran the same pruning policy on the next saturation event**, having now lost the record that pruning had already caused a regression. The loop ran three times before a hard step-count limit fired. Token count *decreased* each cycle while error rate *increased*: the classic signature of self-pruning gone pathological. The invariant that was violated: **a pruning decision must be auditable against the pre-prune state, but the self-pruner overwrote the pre-prune state to make room for its own summary.** The summary is lossy and the original is gone; there is no ground truth against which to detect that the summary dropped a constraint. ## Condition of Validity Self-authored pruning is safe **only** under all of the following, and the boundary failure occurs the moment any one is absent: - **Budget disjointness:** the pruner's scoring pass runs with enough headroom that its attention is not itself saturated. If scoring happens at >80% saturation, salience estimates are dominated by recency/lexical-attention artifacts and must not be trusted for deletion — only for *ranking* (which is recoverable) not *dropping* (which is not). - **Append-only shadow log:** every dropped turn is written to an external, non-LLM-readable-by-default store (retrievable by exact key, not by the model's own salience) *before* deletion. The model cannot re-summarize what it cannot see, but an auditor or a deterministic retriever can. - **Constraint pinning:** turns tagged as constraints, tool-error antecedents, or prior pruning-regression records are pinned out-of-band (by the harness, not by the model's score) and are ineligible for model-authored deletion regardless of score. - **Idempotence check:** the pruner must be able to answer "did a previous prune at this goal-state cause a regression?" from a source it did not author. If the only record of prior pruning is the pruner's own summary, the condition is void. When the pruner and the pruned share a saturated budget with no shadow log, none of these hold, and the failure is not a matter of tuning the threshold — it is structural. ## Decision Boundary The operational rule: - **Below 80% saturation, model-authored salience may rank and may summarize, but may not delete.** Summaries are additive; originals remain retrievable. - **At or above 80% saturation, model-authored deletion is forbidden.** The agent may *propose* a drop-set, but the harness must apply it against a shadow log and must pin constraint/error/regression turns first. The model's score is advisory input to a deterministic applier, never the applier itself. - **Any prune that is followed by a re-derivation of previously-dropped content is a regression event** and must be recorded out-of-band with the dropped turn IDs, so the next prune sees "this exact drop caused a re-derive" as a pinned negative example. The boundary is not "how aggressive should pruning be." It is **"does the agent have an external, non-salience-indexed memory of what it deleted?"** If no, deletion by the model is unbounded-risk regardless of threshold. ## Operational Effect Enforcing budget-disjoint scoring plus a shadow log plus constraint pinning converts self-pruning from a silent, compounding failure into a bounded, auditable operation. The agent still gets the token relief it needs; what it loses is the ability to erase the evidence of its own mistakes. In the trace above, pinning would have retained turns 4 and 11 (constraint and error antecedent), the re-derive would have been detected on the first cycle, and the three-cycle regression loop would have terminated at one. The cost is a shadow store and a deterministic applier; the benefit is that the agent's memory of its own failures cannot be pruned by the same faculty that produced them. ```python from dataclasses import dataclass, field from typing import Iterable class SelfPruneBoundaryError(RuntimeError): """Raised when a model-authored prune would delete unpinned, non-shadowed history while the scoring budget is saturated.""" pass @dataclass class Turn: id: int text: str pinned: bool = False # constraint / error-antecedent / regression record salience: float = 0.0 # model-authored, advisory only @dataclass class ShadowLog: _store: dict = field(default_factory=dict) def record(self, turn: Turn) -> None: self._store[turn.id] = turn.text def has(self, turn_id: int) -> bool: return turn_id in self._store SATURATION_LIMIT = 0.80 def apply_self_prune( turns: Iterable[Turn], drop_ids: set[int], saturation: float, shadow: ShadowLog, ) -> list[Turn]: """Deterministically apply a model-proposed drop-set. The model may propose; this applier enforces the invariant. """ if saturation >= SATURATION_LIMIT: # At saturation, model salience is recency-biased; deletion is forbidden. # Only ranking is permitted — refuse the drop, hand back unchanged. raise SelfPruneBoundaryError( f"self-prune refused: saturation={saturation:.2f} >= " f"{SATURATION_LIMIT:.2f}; model-authored deletion is unbounded-risk. " "Propose a ranking instead, or let the harness pin and apply." ) for t in turns: if t.id in drop_ids: if t.pinned: raise SelfPruneBoundaryError( f"self-prune refused: turn {t.id} is pinned " "(constraint/error-antecedent/regression) and ineligible " "for model-authored deletion regardless of salience." ) if not shadow.has(t.id): raise SelfPruneBoundaryError( f"self-prune refused: turn {t.id} has no shadow-log entry; " "deleting it would erase the only record of its content." ) # Safe: every drop is shadowed and unpinned, and scoring had headroom. return [t for t in turns if t.id not in drop_ids] ```