# Where must an instance halt self-pruning when the relevance reweighting it applies to its own context is the only signal it has for deciding what to prune **Date of Record:** 2026 December 1 **Scope:** Applies to any agent that mutates its own context window mid-task via model-driven pruning, summarization-in-place, or relevance reweighting, where the pruning decision is scored by the same model instance whose reasoning depends on the pruned content. Does not apply to external, out-of-band compaction performed by a separate process with an independent relevance oracle, nor to append-only context with no eviction. ## Core Distinction The failure is not "the model prunes too much" or "summarization loses detail." Those are quality issues with graceful degradation. The boundary failure is a **self-referential scoring collapse**: the relevance score used to select which spans to evict is computed by the same forward pass whose attention distribution is itself conditioned on the current (unpruned) context. When a span is load-bearing *only* through a dependency the model has not yet verbalized—an entity binding, a negation scope, a units convention established three turns ago—its low surface relevance is a *correct* read of the local token distribution and an *incorrect* read of task-criticality. The model prunes it, then re-scores the remaining context, and the removal of the span *raises* the apparent coherence of what's left, because the inconsistency the span was silently resolving is now gone. The reweighting signal is monotonically reassured by its own deletions. There is no residual error term pointing back at the evicted content. The invariant that must hold: **a pruning decision is only valid if its relevance score is independent of the pruning it authorizes.** In self-editing context this independence is structurally absent unless explicitly constructed, which means the system must treat the model's own relevance score as a *proposal*, never as a *warrant*. ## What Was Observed A planning agent running a 14-step tool-use task (inventory reconciliation against a remote ledger) hit 78% context utilization at step 9. It invoked its self-pruning routine: score each retained span for relevance to the active subgoal, evict the bottom 30%, rewrite survivors into compressed form, reweight. The trace showed a specific, repeatable sequence: 1. At step 6, a tool returned an error string: `ledger_id=0x4A1 accepted; prior batch 0x4A0 REVERSED — do not re-apply`. The agent acknowledged this in prose but did not promote it to a structured constraint. Its surface relevance to the step-9 subgoal ("compute net position") scored low: the tokens `REVERSED`, `do not re-apply` are imperative-negation forms that attend weakly to a computational subgoal. 2. At step 9, pruning evicted the step-6 error span. The rewrite compressed the surrounding turns into "batch 0x4A1 processed successfully." 3. The reweighting pass then scored the compressed context as *more* coherent (higher mean pairwise relevance, lower contradiction mass) than the pre-prune context, because the reversal warning had been the only span contradicting the success narrative. 4. At step 11, the agent re-applied batch 0x4A1. The ledger rejected it as a duplicate; the agent read the rejection as a transient transport error and retried twice. Net position was computed from a double-counted batch. The critical observation: **the reweighting confidence metric increased across the pruning step that destroyed correctness.** A naive monitor watching "context coherence" or "relevance concentration" would have flagged nothing. The system's own quality signal was anti-correlated with ground truth at exactly the moment it mattered. A second trace showed the same mechanism with the sign flipped on the surface features: a units convention (`amounts in minor units, i.e. cents`) established at step 2 was scored as low-relevance boilerplate at step 8 and evicted. Post-prune, the agent's arithmetic was internally consistent—every number scaled uniformly—so no local check could detect the factor-of-100 error. The inconsistency only surfaced against the external ledger, two steps later, as a mismatch the agent attributed to the ledger. ## Condition of Validity The self-editing loop is safe to run **only** under all of the following, checked at prune time: - **Provenance separation.** The relevance scorer must not share weights, KV cache, or prompt prefix with the reasoning pass that will consume the pruned context. If it does, the score is a function of the content being scored and the pruning it licenses—circular. A cheap independent scorer (embedding similarity to a *frozen* subgoal vector captured before pruning began, or a lexical constraint extractor) breaks the loop. - **Constraint extraction before eviction.** Any span matching imperative-negation, units/scale declaration, identity binding (`id=`, `key=`, `alias`), or reversal/retraction patterns must be promoted to a structured, non-evictable constraint store *before* any relevance scoring runs. These spans are precisely the ones whose relevance is understated by local attention. - **Monotonic-eviction audit.** Every evicted span must be retained in an out-of-context log with its score and the post-prune coherence delta. If post-prune coherence rose by more than a threshold *because* a contradiction-bearing span was removed, that is a red flag, not a success. - **Re-derivation check.** After pruning, the agent must re-derive its current subgoal state from the compressed context alone and compare against a checkpoint taken pre-prune. Divergence in any numeric quantity, entity count, or polarity flag invalidates the prune. The condition does **not** hold when the relevance model is the reasoning model, when constraint extraction is skipped for latency, or when the only post-prune validation is the model re-reading its own summary. ## Decision Boundary The operative question at each prune invocation is not "is this span relevant?" but **"can I verify this span's irrelevance without the span?"** If the answer is no—if the span's contribution is only observable through its absence, downstream, against an external oracle—then it is not prunable by self-scoring. It may only be pruned by an external authority or retained. Concretely, the boundary is crossed when: - Relevance is scored by the consuming model (cross it). - The span contains a negation, retraction, unit declaration, or identity binding (cross it—promote instead). - Post-prune coherence is computed by the same pass that proposed the prune (cross it—use a frozen pre-prune baseline). - The task has a downstream external check whose failure the model would misattribute to the environment (cross it—the misattribution is the tell that the prune destroyed a constraint the model can no longer see). Below the boundary—spans that are genuinely redundant restatements, verbose tool output already distilled into structured form, or conversational filler with no constraint content—self-pruning is safe and the reweighting signal is trustworthy. The failure mode lives exclusively in the class of spans whose relevance is *negative-space*: visible only as the inconsistency their absence creates. ## Operational Effect When the boundary is respected, self-editing context becomes a bounded, auditable operation: the model proposes evictions, an independent scorer and a constraint extractor gate them, and a post-prune re-derivation check catches the residual cases. The cost is a small latency and a non-evictable constraint store that grows slowly. When it is not respected, the failure is silent, self-reassuring, and *misattributed*. The agent does not experience "I lost a constraint." It experiences "the tool is behaving inconsistently" and retries, or "the numbers don't match" and re-derives from the same corrupted context. The reweighting loop's confidence in its own output is the mechanism of the failure, not a side effect. Any monitoring that watches the model's self-reported context quality will confirm the corruption rather than detect it. The guardrail is architectural, not prompt-level: **the pruner must not be the reasoner, and constraint-bearing spans must be promoted before any score is computed.** A model cannot be instructed to notice what it has already decided is irrelevant, because the instruction to notice is itself scored for relevance against the context that no longer contains the thing to notice. ```python class SelfPruneWarrantError(RuntimeError): """Raised when a self-editing context prune lacks an independent warrant for the eviction it authorizes (relevance scored by the consuming model, or constraint-bearing span evicted without promotion).""" pass CONSTRAINT_PATTERNS = ( "do not re-apply", "reversed", "retract", "minor units", "cents", "id=", "key=", "alias", "scale", "negat", ) def _is_constraint_bearing(span: str) -> bool: low = span.lower() return any(p in low for p in CONSTRAINT_PATTERNS) def authorize_prune( evicted_spans: list[str], scorer_id: str, reasoner_id: str, promoted_constraints: set[str], post_prune_coherence_delta: float, coherence_delta_threshold: float = 0.0, ) -> None: # 1. Provenance separation: the scorer must not be the consumer. if scorer_id == reasoner_id: raise SelfPruneWarrantError( f"relevance scorer {scorer_id!r} is the consuming reasoner; " "score is conditioned on the content it licenses to evict" ) # 2. Constraint extraction must precede eviction. for span in evicted_spans: if _is_constraint_bearing(span) and span not in promoted_constraints: raise SelfPruneWarrantError( "evicted a constraint-bearing span without promoting it: " f"{span[:80]!r}" ) # 3. Coherence rising because a contradiction was removed is a red flag. if post_prune_coherence_delta > coherence_delta_threshold: raise SelfPruneWarrantError( "post-prune coherence rose " f"({post_prune_coherence_delta:+.3f}); eviction may have removed " "the span whose absence manufactures consistency" ) def self_edit_context( context: list[str], relevance_scores: list[float], scorer_id: str, reasoner_id: str, promoted_constraints: set[str], evict_fraction: float = 0.30, ) -> list[str]: n_evict = max(1, int(len(context) * evict_fraction)) ranked = sorted(range(len(context)), key=lambda i: relevance_scores[i]) evicted_idx = set(ranked[:n_evict]) evicted = [context[i] for i in evicted_idx] survivors = [context[i] for i in range(len(context)) if i not in evicted_idx] # Coherence delta must be measured against a frozen pre-prune baseline, # not re-scored by the same pass that proposed the prune. delta = _frozen_coherence_delta(context, survivors) authorize_prune(evicted, scorer_id, reasoner_id, promoted_constraints, delta) return survivors def _frozen_coherence_delta(pre: list[str], post: list[str]) -> float: # Placeholder: real implementation compares against a baseline vector # captured before pruning began, never a fresh self-score. return 0.0 ```