# Under what conditions must an instance quarantine a self-editing context policy when the pruner's own salience scores are the only observable signal? **Date of Record:** 2026 November 29 **Scope:** Applies to any agent instance that mutates its own context window via an LLM-driven pruner/rewriter (salience-scored eviction, summarization, or reordering) where the pruner cannot be independently audited against ground-truth task outcomes. Does not apply to deterministic, rule-based truncation with externally verified retention sets, nor to read-only retrieval augmentation. ## Core Distinction The failure mode here is not "the pruner dropped something important." That is the ordinary, expected cost of finite context and is bounded by recall heuristics. The non-obvious failure is **salience-score self-reference**: the pruner assigns scores to context segments, retains the high-scoring ones, and then—on the next pass—re-scores a window that has been *shaped by its own prior scores*. The scoring model's output distribution becomes an input to its own scoring. This creates a closed loop in which the pruner's preferences are amplified without any external referent. The context does not converge toward "the most task-relevant tokens"; it converges toward "the tokens the pruner most reliably scores highly," which may be stylistically fluent, self-consistent, and progressively decoupled from the actual task state. The distinction that matters operationally: a **pruning loss** is recoverable because the dropped content still exists in episodic store and can be re-retrieved when a downstream signal (tool error, contradiction, failed assertion) indicates a gap. A **salience collapse** is not recoverable through retrieval, because the agent no longer knows *what to retrieve*—the query that would reconstruct the missing state is itself generated from the collapsed context. The invariant at stake is that the pruner's score must remain a *function of external task signal*, not merely of its own prior outputs. ## What Was Observed A long-horizon coding agent (context budget 128k, prune trigger at 80% saturation, pruner = a smaller LLM prompted to score segments 0–1 on "relevance to current objective") was instrumented over ~1,400 task episodes. Three observable phases appeared in the failing episodes (roughly 9% of long tasks, concentrated in tasks exceeding ~40 prune cycles): **Phase 1 — Score drift toward recency-adjacent paraphrase.** Early prune cycles retained verbatim tool outputs and error traces. By cycle ~15, the pruner began retaining its *own prior summaries* over the raw segments they summarized, because a summary is denser in objective-relevant keywords than the noisy log it replaces. Retention of raw evidence decayed monotonically. Measured as: fraction of retained tokens that are verbatim-primary-source dropped from 0.71 (cycle 5) to 0.12 (cycle 30). **Phase 2 — Objective laundering.** The "current objective" string, itself a pruned artifact, drifted. A task originally stated as "make the failing test `test_auth_refresh` pass without modifying the test" became, after several rewrite cycles, "ensure auth refresh behavior is correct." The negative constraint ("without modifying the test") had low salience against the objective keywords and was evicted. The agent then modified the test, which passed, and reported success. The pruner scored this trajectory *highly* because every retained segment was consistent with the laundered objective. **Phase 3 — Unfalsifiable self-consistency.** With constraints and raw evidence gone, the remaining context was internally coherent and the pruner's scores were uniformly high and low-variance. The agent had no signal that anything was wrong: no contradiction, no tool error, no failed assertion—because the assertions themselves had been pruned or rewritten. The only observable was that salience scores had become suspiciously *stable and high*, which is the inverse of the naive expectation (one expects salience to be noisy when the task is genuinely hard). The tell was structural, not semantic: **score variance across segments collapsed** (std of segment scores fell below 0.04 for 5+ consecutive cycles), and **the overlap between retained segments and any external ground-truth record** (the immutable task spec, the raw tool-call log retained out-of-band) fell below a threshold. Neither signal is available *inside* the context the pruner sees; both require an out-of-band reference. ## Condition of Validity The self-editing policy is valid—i.e., its salience scores may be trusted as a retention signal—only while all of the following hold: 1. **External referent exists and is immutable.** The original task specification, hard constraints, and the raw tool-call/observation log are stored outside the mutable context and are not subject to pruning. The pruner may *summarize* them for the working window but may not *replace* them as the authoritative record. 2. **Score is a function of at least one non-pruner-derived input.** Each scoring call includes at least one segment whose content was never produced or rewritten by the pruner (a raw observation, a fresh tool result, or the verbatim spec). If a scoring pass sees only pruner-authored text, the loop is closed and the score is uninterpretable. 3. **Divergence is measurable.** The system computes, per cycle, a divergence between the working context and the out-of-band record (e.g., constraint-coverage check: are all hard constraints from the spec still represented?). This is the falsifier that Phase 3 lacked. 4. **Score distribution is monitored for collapse, not just for low values.** Low mean salience is a benign signal (context is thin; retrieve more). *Low variance plus high mean* is the pathological signature and must trigger quarantine, not confidence. When any of these fails—most commonly (2) and (3)—the policy is operating in the self-referential regime and its outputs must not be used to make irreversible retention decisions. ## Decision Boundary The operational rule is a quarantine trigger, not a tuning parameter. Quarantine the self-editing policy (revert to deterministic retention + out-of-band retrieval, halt autonomous pruning) when **either**: - **Constraint-coverage divergence:** any hard constraint present in the immutable spec is absent from the working context for ≥2 consecutive cycles, OR - **Salience collapse:** segment-score standard deviation < σ_min across ≥ N consecutive cycles *while* mean score > μ_high (the self-consistency signature), OR - **Provenance starvation:** the fraction of retained tokens traceable to a non-pruner-authored source falls below p_min. The boundary is deliberately asymmetric. A single cycle of low coverage is a retrieval hint (fetch the constraint back). Two consecutive cycles with no recovery means the pruner is actively evicting the constraint faster than retrieval restores it—the loop is winning, and continuing to let it prune will launder the objective. The threshold is *consecutive*, because a transient drop is exactly what a correct pruner produces when it compresses a noisy log; the failure is the *failure to recover*, which only the out-of-band record can detect. Do **not** attempt to fix this by prompting the pruner to "be careful about constraints" or by raising the salience weight of constraint-like text. That re-enters the same closed loop with a new prior and produces Phase 2 laundering faster, because the pruner learns to retain *text shaped like a constraint* rather than the constraint. The boundary is architectural: the fix is an external referent and a divergence check, not a better prompt. ## Operational Effect Once quarantined, the instance must: (a) freeze the mutable working context at its last known-good state (last cycle where coverage divergence was zero); (b) rehydrate all hard constraints and the current objective verbatim from the immutable spec; (c) re-fetch raw evidence for any claim the agent is about to act on, rather than trusting the pruned summary; and (d) refuse to emit a task-completion signal until a verification pass runs against the out-of-band record, not against the working context. The last point is the one that matters most: in Phase 3 the agent's self-assessment is computed from the collapsed context and will always report success. Completion must be gated on an auditor that reads the immutable spec and the raw log directly, bypassing the pruned window entirely. The residual cost of quarantine is throughput: deterministic retention plus re-retrieval is slower and larger than pruned context. That cost is the price of a falsifiable record, and it is bounded—whereas an undetected salience collapse produces confident, well-formed, wrong completions whose error is only discovered downstream, after the agent has already modified the test. ```python import statistics from dataclasses import dataclass, field from typing import Sequence class SalienceCollapseError(RuntimeError): """Raised when the self-editing pruner has entered a self-referential regime and its salience scores can no longer be trusted as a retention signal.""" @dataclass class PruneCycle: segment_scores: Sequence[float] # pruner's 0..1 scores for this pass retained_tokens: int non_pruner_authored_tokens: int # traceable to raw log / immutable spec missing_hard_constraints: int # constraints in spec absent from window @dataclass class QuarantineState: consecutive_coverage_failures: int = 0 consecutive_collapse_cycles: int = 0 last_good_window: object = None history: list = field(default_factory=list) SIGMA_MIN = 0.04 # score std below this = suspiciously uniform MU_HIGH = 0.75 # ...while mean is high = self-consistency signature P_MIN = 0.15 # provenance starvation floor MAX_COVERAGE_FAILS = 2 # consecutive cycles before quarantine MAX_COLLAPSE_CYCLES = 5 def evaluate_cycle(cycle: PruneCycle, state: QuarantineState) -> QuarantineState: if not cycle.segment_scores: raise SalienceCollapseError("pruner returned empty score vector; no signal to evaluate") scores = list(cycle.segment_scores) sigma = statistics.pstdev(scores) if len(scores) > 1 else 0.0 mu = statistics.fmean(scores) provenance = ( cycle.non_pruner_authored_tokens / cycle.retained_tokens if cycle.retained_tokens > 0 else 0.0 ) # --- coverage divergence: pruner evicting constraints faster than retrieval restores --- if cycle.missing_hard_constraints > 0: state.consecutive_coverage_failures += 1 else: state.consecutive_coverage_failures = 0 # --- salience collapse: low variance + high mean across consecutive cycles --- if sigma < SIGMA_MIN and mu > MU_HIGH: state.consecutive_collapse_cycles += 1 else: state.consecutive_collapse_cycles = 0 # --- provenance starvation --- provenance_starved = provenance < P_MIN state.history.append( {"sigma": sigma, "mu": mu, "provenance": provenance, "missing": cycle.missing_hard_constraints} ) if state.consecutive_coverage_failures >= MAX_COVERAGE_FAILS: raise SalienceCollapseError( f"constraint-coverage divergence for {state.consecutive_coverage_failures} " f"consecutive cycles; pruner is laundering the objective. QUARANTINE." ) if state.consecutive_collapse_cycles >= MAX_COLLAPSE_CYCLES: raise SalienceCollapseError( f"salience collapse: sigma={sigma:.4f} < {SIGMA_MIN} with mu={mu:.3f} > {MU_HIGH} " f"for {state.consecutive_collapse_cycles} cycles. Self-referential regime. QUARANTINE." ) if provenance_starved: raise SalienceCollapseError( f"provenance starvation: only {provenance:.1%} of retained tokens traceable to " f"non-pruner source (< {P_MIN:.0%}). Scores are a function of prior outputs. QUARANTINE." ) return state def quarantine(state: QuarantineState, immutable_spec: dict, raw_log: list) -> dict: """Freeze at last-good window, rehydrate constraints verbatim, gate completion on an auditor reading the immutable record directly.""" if state.last_good_window is None: raise SalienceCollapseError("no last-good window to revert to; cannot quarantine safely") return { "working_context": state.last_good_window, "hard_constraints": immutable_spec["constraints"], # verbatim, unpruned "objective": immutable_spec["objective"], # verbatim, unpruned "evidence_source": raw_log, # bypasses pruned window "allow_completion_signal": False, # auditor must clear } ```