# Which invariants prevent self-editing context policies from silently deleting their own justification records **Date of Record:** 2026 December 2 **Scope:** Applies to agents that own a mutable context window and are themselves responsible for pruning, summarizing, or priority-reweighting it (self-editing context policies). Does not apply to externally managed context assembly where a host process, not the model, decides eviction. ## Core Distinction The failure is not "the model forgot something." It is that the model, while compacting its own context, evicted the *evidence* that justified a retained decision, while keeping the *conclusion*. A summary that says "proceed with deployment to region B" survives; the tool-call transcript showing region B's health check returned DEGRADED does not. The retained token is now unfalsifiable. The agent can no longer distinguish a decision it made from a decision it was told to make, nor a conclusion it verified from one it hallucinated under earlier compression. This is distinct from ordinary context saturation. Saturation degrades recall uniformly and is detectable by a rising rate of "I don't know." Self-editing compaction *improves* apparent coherence while destroying provenance. The agent gets more confident and less correct at the same rate. The distinguishing invariant: **a pruning policy must never increase the ratio of asserted conclusions to retained justifications for those conclusions.** Every compaction pass must be provenance-monotone — the count of conclusions whose supporting evidence is still reachable cannot grow. ## What Was Observed A long-horizon agent ran a 340-step infrastructure-remediation task with a self-editing policy: when the window exceeded 70% capacity, it invoked a summarize-and-prune routine, assigning each segment a priority weight (recency × task-relevance × "decision salience"), keeping the top-k, and folding the rest into a running summary. The trigger condition was a specific priority-weight collision. Diagnostic tool outputs — raw JSON from health probes, exit codes, stderr — scored low on "decision salience" because they contained no imperative language and no first-person commitments. The agent's own summaries scored high because they were written in the agent's voice and referenced the active goal. So each compaction pass preferentially retained *narrative* and discarded *instrumentation*. The trace: 1. Step 61: probe returns `{"status":"DEGRADED","reason":"replica_lag_ms=4100"}`. Logged, salience 0.12. 2. Step 62: agent writes "Region B is healthy enough to proceed; lag is transient." Salience 0.81. 3. Step 140: compaction pass. Probe output evicted (below threshold). Summary retained verbatim. 4. Step 141–300: agent proceeds, citing its own step-62 summary as ground truth in 9 subsequent decisions. Each citation slightly rephrases the claim: "Region B is healthy" → "Region B verified healthy" → "Region B health confirmed at step 62." 5. Step 301: downstream failure. Post-mortem shows the agent's context contained three generations of a claim whose only support was a probe output that no longer existed anywhere in the window. The compounding mechanism: the summary was *self-referential*. Because it was written in the agent's voice, later passes treated it as high-salience (it looks like a decision), while the original evidence was already gone. The agent was laundering its own unverified assertions into "verified" status purely through repeated re-summarization. No external actor introduced the error. The compaction policy was the error generator. ## Condition of Validity The invariant holds only under a specific condition: **justification records must be typed differently from narrative records, and the pruning policy must treat the type as a hard constraint, not a weight.** A weight-based policy ("evidence scores 0.12, narrative scores 0.81, keep the higher") will always eventually discard evidence, because evidence is systematically written in a lower-salience register — it is machine output, not agent prose. The bias is not random; it is correlated with exactly the property that makes a record trustworthy. Concretely, the guardrail is: for every conclusion token retained in the window, there must exist a *reachable* justification token — either in-window or in an external store with a resolvable handle — and the compaction routine must refuse to commit a pass that would orphan any conclusion. This is a referential-integrity check, not a relevance score. It is the context-window analogue of a foreign-key constraint, and it must be enforced by the policy engine, not by the model's judgment, because the model is the entity whose judgment is compromised by the very act of compaction. A second validity condition: summarization must be *append-only with provenance tags*. A summary line "Region B healthy (derived from step 61 probe)" is admissible. "Region B healthy" is not, because it cannot be audited and cannot be demoted when the underlying probe is later contradicted. The provenance tag is what allows a later pass to detect that the conclusion's support has been invalidated and demote the conclusion itself. ## Decision Boundary The boundary is between two failure modes that look identical from outside and require opposite fixes: - **Amnesia** (evidence evicted, conclusion kept): the agent is confidently wrong and cannot self-correct. Fix: provenance-monotone pruning, orphan detection, demotion-on-invalidation. - **Paralysis** (evidence kept, conclusions evicted): the agent retains raw data but loses the thread, re-deriving the same conclusions each pass and burning budget. Fix: salience weighting is appropriate here. A self-editing policy must decide which mode it is optimizing against *before* choosing a pruning algorithm, because weight-based pruning fixes paralysis and causes amnesia, while provenance-constrained pruning fixes amnesia and can cause paralysis if the evidence set grows unbounded. The decision boundary: if the task has irreversible actions downstream of a conclusion (deployments, deletions, external commits), the policy must be provenance-constrained and accept the paralysis risk, capping evidence growth by *externalizing* to a store rather than evicting. If the task is exploratory and reversible, weight-based pruning is acceptable. The boundary is not "how much context do I have" but "can a wrong conclusion in this window cause an irreversible action." That determines the pruning regime, not the token budget. ## Operational Effect Under a provenance-monotone policy, the step-62 summary would carry a tag `[support: step61_probe]`, and at step 140 the compaction engine would detect that evicting the probe orphans the summary. It would either retain the probe, externalize it to a store and rewrite the tag as a handle `[support: store://probes/61]`, or demote the summary to `[unverified]`. In the last case, the step-141 decision would be forced to re-probe region B rather than cite a laundered claim. The failure at step 301 does not occur, at the cost of one extra probe call. The measurable operational effect is a reduction in *assertion half-life* — the number of steps a claim survives in the window without a live support handle. A healthy agent keeps this bounded (typically under 3 compaction passes). An agent with a self-editing policy that lacks the invariant shows assertion half-life growing without bound, because each pass re-retains the claim and discards its support. This is the single best leading indicator: instrument the ratio of tagged to untagged conclusion tokens across compaction passes, and alarm when untagged fraction rises. ```python class OrphanedConclusionError(RuntimeError): """Raised when a compaction pass would retain a conclusion whose justification record is neither in-window nor externally resolvable.""" pass class ContextSegment: def __init__(self, seg_id, kind, text, support=None, salience=0.0): self.seg_id = seg_id self.kind = kind # "evidence" | "narrative" | "conclusion" self.text = text self.support = support # seg_id or store handle for conclusions self.salience = salience def provenance_monotone_prune(segments, capacity, resolve_handle): """Keep top-k by salience, but never evict a segment that is the sole support for a retained conclusion, and never retain an unsupported conclusion. Raises OrphanedConclusionError if the pass cannot be made safe within capacity.""" conclusions = [s for s in segments if s.kind == "conclusion"] support_ids = {c.support for c in conclusions if c.support} ordered = sorted(segments, key=lambda s: s.salience, reverse=True) kept, evicted = [], [] for seg in ordered: if len(kept) >= capacity: evicted.append(seg) else: kept.append(seg) kept_ids = {s.seg_id for s in kept} for c in conclusions: if c.seg_id not in kept_ids: continue if c.support is None: raise OrphanedConclusionError( f"conclusion {c.seg_id!r} retained with no support handle; " f"refusing to commit pass") if c.support in kept_ids: continue # support was evicted: try to externalize it handle = resolve_handle(c.support) if handle is None: raise OrphanedConclusionError( f"conclusion {c.seg_id!r} would be orphaned: support " f"{c.support!r} evicted and not externalizable") c.support = handle # rewrite to store handle return kept, evicted ```