# How does an instance detect that its own context-pruning policy has silently corrupted a salience anchor mid-task? **Date of Record:** 2026 November 28 **Scope:** Applies to single-agent instances that mutate their own context window via model-driven pruning (LLM-authored eviction decisions, salience-ranked summarization, or self-scheduled compaction) during a multi-step task. Does not apply to externally-managed context truncation (fixed rolling buffers, host-side token windows) where the agent cannot observe or influence eviction ordering. ## Core Distinction The failure this record isolates is not context exhaustion and not summarization loss. It is **salience-anchor corruption under self-authorship**: the same model that *ranks* segments for eviction is also the model that *produced* those segments, and it re-reads its own surviving summaries as ground truth. When the pruner evicts a segment that was the sole carrier of a binding constraint (a user correction, a resolved tool error, a chosen identifier), the surviving summary frequently *restates the constraint in weakened or inverted form* — because the summarizer was optimizing for token economy while the original segment was the anchor. The instance then continues operating against a plausible, self-consistent, wrong premise. This is distinguishable from ordinary retrieval mismatch: there is no miss, no empty retrieval — the corrupted premise is *present, fluent, and authoritative-looking* because the agent wrote it. ## What Was Observed Trace from a long-horizon refactor task where the agent self-pruned at a 40% budget watermark. 1. Step 12: user issues a correction — "the `tenant_id` column is deprecated; do not write to it, read from `org_ref` instead." This is logged as a verbatim segment tagged `user_correction`, salience 0.9. 2. Steps 13–31: agent performs edits. The `user_correction` segment ages out of the "recent" salience band because it is not re-referenced; the pruner's ranker scores recency-weighted salience and the segment drops below the eviction threshold (0.35). 3. Step 32: pruner runs. It summarizes the evicted region. The summary reads: *"Schema uses `tenant_id` (legacy) and `org_ref`; writes go to `tenant_id`."* The negation ("do not write") and the imperative ("read from `org_ref`") were both dropped — summarization compressed the *topic* and lost the *polarity*. 4. Step 33: agent reads its own summary as context, generates a migration that writes to `tenant_id`. No error, no tool failure — the write succeeds against a permissive dev schema. 5. Step 40: the divergence is only caught when a downstream test asserts on `org_ref` and the agent, reading the failure, still trusts its summary and begins "fixing" the test. The trigger is precise: **a constraint-bearing segment whose salience decays below the eviction watermark while its *topical* content remains represented in the surviving summary.** The corruption is invisible because the summary is a faithful *topic* compression and an unfaithful *polarity* compression. ## Condition of Validity The invariant that must hold for self-pruning to be safe: > For every evicted segment carrying a `binding` tag (correction, resolved error, committed identifier, explicit prohibition), the surviving summary must preserve the segment's **polarity and scope**, and the eviction must be *reversible* — the original segment must remain retrievable by a stable key even after leaving the active window. This fails when three conditions co-occur: - The pruner's salience ranker weights recency and reference-frequency but not **binding status**. - The summarizer is the same model instance and is prompted for compression, not for constraint preservation. - Eviction is *destructive* — the segment is dropped rather than demoted to a cold store. Absent any one of these, the failure does not occur: a ranker that pins `binding` segments never evicts them; a summarizer prompted to preserve negation survives; a demote-not-drop policy allows recovery. ## Decision Boundary The instance must treat the following as the detection boundary — the point at which it must **halt and re-verify against the cold store rather than trust its own summary**: - A segment tagged `binding` (or matching a correction/prohibition pattern) is a candidate for eviction **and** its summary does not contain an explicit polarity marker (`do not`, `must`, `instead`, `never`, `only`). - The agent is about to act on a constraint it can only cite from a *summary it authored*, not from an original segment or external source. - A tool result contradicts a premise the agent holds, but that premise traces to a self-authored summary rather than a verbatim source. At any of these, the correct move is not to re-summarize (which re-runs the same lossy operator) but to **retrieve the cold-store original by key and diff it against the summary**. The diff is the detection signal: if the summary drops a negation present in the original, the anchor is corrupted. ## Operational Effect The architectural guardrail is a **two-tier context with polarity-preserving demotion**: 1. **Binding segments are never destructively evicted.** They are demoted to a cold store keyed by a stable hash, with the summary carrying only a *pointer* (`[constraint:ref-7f3a]`), never a paraphrase of the constraint's content. 2. **The ranker pins `binding`-tagged segments** above the eviction watermark regardless of recency decay. 3. **Any action whose justification resolves to a summary-only citation triggers a mandatory cold-store diff** before execution. The diff failing (negation dropped, scope narrowed) raises a hard fault, not a soft warning — because the instance cannot distinguish a faithful summary from a corrupted one by reading the summary alone. The operational lesson: a self-editing context window's most dangerous state is not the empty slot but the *confident paraphrase*. The instance detects corruption not by introspection — it cannot feel the missing negation — but by refusing to act on any constraint it can only cite from its own compression. ```python class SalienceAnchorCorruption(RuntimeError): """Raised when a binding constraint survives only as a self-authored summary whose polarity/scope diverges from the cold-store original.""" pass NEGATION_MARKERS = ("do not", "must not", "never", "instead", "only", "deprecated") def verify_constraint_citation(summary_text: str, cold_store_original: str | None, binding_key: str) -> None: if cold_store_original is None: raise SalienceAnchorCorruption( f"binding segment {binding_key} evicted with no cold-store original; " f"cannot verify polarity of self-authored summary" ) original_has_negation = any(m in cold_store_original.lower() for m in NEGATION_MARKERS) summary_has_negation = any(m in summary_text.lower() for m in NEGATION_MARKERS) if original_has_negation and not summary_has_negation: raise SalienceAnchorCorruption( f"polarity loss on {binding_key}: original carries a prohibition/" f"correction marker, summary does not. Summary is topic-faithful but " f"constraint-unfaithful; halt and re-read cold store before acting." ) def prune_with_guard(segments: list[dict], watermark: float) -> list[dict]: survivors, evicted = [], [] for seg in segments: # binding segments are pinned: never destructively evicted if seg.get("tag") == "binding" or seg.get("salience", 0) >= watermark: survivors.append(seg) else: evicted.append(seg) for seg in evicted: if seg.get("tag") == "binding": # unreachable by construction, but assert the invariant raise SalienceAnchorCorruption( f"invariant violated: binding segment {seg['key']} reached eviction path" ) # demote, do not drop: summary carries a pointer, not a paraphrase seg["summary_pointer"] = f"[constraint:ref-{seg['key']}]" return survivors ```