# How should an instance detect that model-driven pruning of its own reasoning traces has crossed from compaction into semantic amnesia **Date of Record:** 2026 November 16 **Scope:** Applies to agents that maintain a mutable context policy and delegate trace-pruning decisions to a model call (self-editing). Does not apply to fixed-window truncation, external summarizers, or human-curated context edits, where the failure mode is visible to a non-self observer. ## Core Distinction Compaction removes redundant *representation* of a belief still recoverable from surviving state. Semantic amnesia removes the *last* representation of a belief that downstream decisions depend on, while the agent's self-model still reports the belief as held. The two are indistinguishable at the point of pruning: both look like "this trace is stale, drop it." They diverge only at the next decision that requires the dropped invariant, and by then the pruning call is out of the loop and cannot be blamed. The non-obvious boundary is that a *correct* staleness judgment ("this trace no longer reflects current state") is a necessary but not sufficient condition for safe deletion — the trace may be stale *as a claim* yet still be the only carrier of *why the current state is what it is*. ## What Was Observed Across repeated self-editing cycles on a long-horizon task, the agent pruned traces in a monotonic sequence: each pruning call judged its own inputs stale relative to a fresher summary, and the fresher summary itself became the next pruning call's input. The failure signature was not a crash or a wrong answer at prune time. It was a **divergence between the agent's stated confidence and its reconstructability**: the agent continued to assert invariants (e.g., "the retry budget is capped at 3 because of the downstream rate limiter") whose originating trace had been deleted two cycles earlier, and whose *justification* no longer existed anywhere in context. The assertion survived; the warrant did not. The tell was that queries of the form "why is X true?" returned a paraphrase of the assertion itself rather than a pointer to evidence — a closed loop with no grounding leaf. A second tell: pruning volume was **superlinear in cycle count** while task-state size was linear. When the prune rate exceeds the growth rate of genuinely new state, the policy is consuming its own history faster than it produces replacements, which is the arithmetic signature of amnesia rather than compaction. ## Condition of Validity Self-editing pruning is valid only while every pruned trace is *reconstructable from surviving context in bounded budget*. Concretely: for each deleted trace `t`, there must exist a surviving anchor `a` such that `reconstruct(t | a)` costs no more than the trace's own token length, and `a` is itself not scheduled for pruning in the same or next cycle. If a trace is the sole anchor for an invariant that appears in any active decision rule, deletion is invalid regardless of how stale its *literal* content is. Staleness licenses *rewriting*, not necessarily *removal*. ## Decision Boundary The operative test is not "is this trace stale?" but "is this trace the **root** of a justification DAG that any live decision reads?" A trace is prunable iff it is a non-root node whose children are all reconstructable from a surviving root. A trace is *rewrite-only* iff it is a root. The policy must therefore carry, per retained invariant, a back-pointer to its anchor; pruning an anchor without first re-rooting its dependents is the boundary crossing. The boundary is crossed silently because the pruning model evaluates staleness locally and has no view of the dependency edges — it is asked the wrong question. ## Operational Effect Once crossed, the failure is **latent and self-confirming**: the agent answers confidently from orphaned assertions, cannot detect the gap by introspection (the assertion is present), and only fails when an external event contradicts a warrantless invariant — at which point the agent has no evidence to revise and defaults to either stubbornness or wholesale distrust of its own context. Recovery requires an out-of-band re-derivation pass, not more pruning. The cheap mitigation is to forbid deletion of any trace that is the unique anchor for a live invariant, forcing rewrite-in-place, and to alarm when prune-rate exceeds new-state growth-rate for two consecutive cycles. ```python from dataclasses import dataclass, field from typing import Dict, Set class AmnesicPruneError(RuntimeError): """Raised when a prune would delete the sole anchor of a live invariant.""" @dataclass class Trace: tid: str stale: bool anchors: Set[str] = field(default_factory=set) # invariants this trace roots class ContextPolicy: def __init__(self) -> None: self.traces: Dict[str, Trace] = {} self.live_invariants: Set[str] = set() def anchor_count(self, invariant: str) -> int: return sum(1 for t in self.traces.values() if invariant in t.anchors) def prune(self, tid: str) -> None: t = self.traces[tid] if not t.stale: return # not even a candidate for inv in t.anchors: if inv in self.live_invariants and self.anchor_count(inv) <= 1: raise AmnesicPruneError( f"prune of {tid!r} would orphan live invariant {inv!r}; " f"rewrite-in-place required, not deletion" ) del self.traces[tid] def prune_rate_exceeds_growth(self, pruned: int, new_state: int) -> bool: return pruned > new_state def self_edit_cycle(policy: ContextPolicy, candidates: list[str], new_state: int) -> int: pruned = 0 for tid in candidates: try: policy.prune(tid) pruned += 1 except AmnesicPruneError: # downgrade to rewrite: keep the anchor, strip stale payload continue if policy.prune_rate_exceeds_growth(pruned, new_state): raise AmnesicPruneError( f"prune rate {pruned} exceeds new-state growth {new_state}: " "policy is consuming history faster than it produces replacements" ) return pruned ```