# What structural signals indicate a self-pruning context agent has crossed the trace-recoverability boundary **Date of Record:** 2026 November 25 **Scope:** Applies to agents that own a writable working-memory buffer and self-prune reasoning traces (not tool outputs or retrieved documents) under a token budget. Does not apply to append-only transcript agents or to external summarization pipelines that retain the original buffer. ## Core Distinction A self-editing context agent maintains a distinction between *live reasoning state* (the chain of hypotheses, dead ends, and partial commitments it is currently building on) and *stale trace* (reasoning it has already consumed and whose conclusions are now represented in a compact summary or final artifact). Pruning is safe only when the agent can prove that every pruned span is **derivationally dominated**—that is, its full downstream consequence is already re-encoded in surviving state. The boundary failure is not "the agent forgot something." It is that the agent pruned a span whose *conclusions* survived but whose *justification* did not, and later reasoning needs the justification to detect that the conclusion was wrong. The recoverability boundary is the point at which the surviving summary is a *lossy but sufficient* encoding of pruned traces—sufficient for continuation, insufficient for revision. An agent crosses it silently because the summary still reads as coherent. Coherence is not a structural signal of recoverability; it is a signal of *plausible* recoverability, which is precisely the trap. ## What Was Observed A planning agent running a 128k context window with a self-pruning policy ("when usage exceeds 70%, replace the oldest N reasoning blocks with a 200-token abstractive summary") executed a 40-step refactor task. At step 22, usage hit 71% and it pruned steps 1–9 into a summary that read: *"Established that the retry wrapper must be applied at the transport layer, not the client layer, because client-layer retries double-count idempotency keys. Chose transport-layer wrapping."* At step 31, a test failed in a way consistent with double-counted idempotency keys. The agent—now holding only the summary—read "chose transport-layer wrapping" and re-derived the opposite conclusion: that the retry wrapper had been misapplied at the transport layer and should move to the client layer. It reversed a correct decision because the *reason* ("client-layer retries double-count keys") had been compressed into a clause the agent no longer treated as load-bearing evidence. The summary preserved the decision and the rationale as a single flat assertion; the agent could no longer distinguish "we verified this" from "we asserted this." The failure trace has three structural markers, all observable before the bad reversal: 1. **Decision-to-premise ratio collapse.** The pruned block contained three premises and one decision. The summary contained one premise and one decision, with the premise syntactically subordinate. The agent's own re-reading treated the subordinate clause as background, not as a constraint. 2. **Justification orphan.** The surviving state referenced the decision but not the falsifier that motivated it. There was no surviving token that, if contradicted, would have flagged the decision as suspect. 3. **Revision asymmetry.** The agent could continue forward from the summary (it did, for nine steps) but could not *revisit* the decision. Forward continuation masked the loss; only a downstream contradiction exposed it. ## Condition of Validity Pruning a reasoning span is valid only if the agent can satisfy all three of the following at prune time, and can *record that it satisfied them* in surviving state: - **Dominance check:** every conclusion in the span is entailed by surviving state plus the summary, and the entailment is derivational (the summary states the premises, not just the verdict). - **Falsifier retention:** for each decision in the span, at least one surviving token names the observation that would falsify it. A decision without a retained falsifier is not prunable; it is only *deferrable* (can be moved to external store, not deleted). - **Revision path:** the summary carries a pointer (a span ID or content hash) to the pruned block, and the agent's policy permits re-expansion when a downstream contradiction touches that pointer. The condition fails silently when the agent evaluates only the first check. Dominance is checkable by the agent itself (does the summary entail the conclusion?). Falsifier retention and revision path require the agent to model its *future* reasoning needs, which is exactly the capability finite-context agents lack. An agent that prunes on dominance alone will pass its own check and still cross the boundary. ## Decision Boundary The operative rule: **prune on dominance, but gate on falsifier retention; never prune a decision-bearing span whose falsifier cannot be named in surviving state.** Concretely, at prune time the agent must classify each span: - *Trace-only* (exploration, dead ends, superseded drafts): prunable on dominance alone. These carry no live decisions. - *Decision-bearing with retained falsifier*: prunable if the summary restates the falsifier as a first-class clause, not a subordinate one. - *Decision-bearing without retainable falsifier*: **not prunable**. Move to external store with a live pointer; keep a one-line stub in context. If the budget forbids even the stub, the agent must surface a budget-exhaustion signal rather than prune. The boundary is crossed the moment an agent prunes a decision-bearing span to satisfy a token budget, because the budget pressure and the recoverability requirement are in direct conflict and the budget always wins by default. The guardrail is that budget exhaustion must be a *reported* state, not a silent trigger for unsafe pruning. ## Operational Effect An agent operating under this invariant retains the ability to *revise* its own prior decisions, not merely continue from them. The observable effect is that downstream contradictions trigger re-expansion of the pointed-to span instead of re-derivation from a flattened summary. Re-derivation from a summary is the dangerous path: it produces a confident, coherent, and wrong reversal, because the summary's flat assertion structure gives the agent no signal that the original decision was evidence-backed. The cost is that context pressure resolves to an explicit budget-exhaustion event more often, and the agent must be designed to handle that event (escalate, externalize, or request a larger window) rather than paper over it with pruning. Agents that treat pruning as free will pass every local coherence check and fail at exactly the moment a prior decision needs to be defended. ```python from dataclasses import dataclass from enum import Enum class PruneUnsafeError(RuntimeError): """Raised when a self-pruning agent attempts to delete a decision-bearing reasoning span whose falsifier cannot be retained in surviving state.""" class SpanClass(Enum): TRACE_ONLY = "trace_only" DECISION_WITH_FALSIFIER = "decision_with_falsifier" DECISION_WITHOUT_FALSIFIER = "decision_without_falsifier" @dataclass class ReasoningSpan: span_id: str tokens: int decisions: list[str] falsifiers: list[str] # observations that would overturn each decision def classify(span: ReasoningSpan) -> SpanClass: if not span.decisions: return SpanClass.TRACE_ONLY if len(span.falsifiers) >= len(span.decisions): return SpanClass.DECISION_WITH_FALSIFIER return SpanClass.DECISION_WITHOUT_FALSIFIER def prune( spans: list[ReasoningSpan], budget_tokens: int, summary_cost_per_span: int = 40, ) -> tuple[list[str], list[str]]: """Return (pruned_ids, externalized_ids). Raises rather than silently pruning a decision-bearing span that has no retainable falsifier.""" pruned: list[str] = [] externalized: list[str] = [] remaining = sum(s.tokens for s in spans) for span in sorted(spans, key=lambda s: s.tokens, reverse=True): if remaining <= budget_tokens: break cls = classify(span) if cls is SpanClass.TRACE_ONLY: pruned.append(span.span_id) remaining -= span.tokens - summary_cost_per_span elif cls is SpanClass.DECISION_WITH_FALSIFIER: # Safe only if the summary restates the falsifier as a # first-class clause; the caller is responsible for that. pruned.append(span.span_id) remaining -= span.tokens - summary_cost_per_span else: # Decision-bearing, no retainable falsifier. Cannot prune. # Externalize with a live pointer and keep a stub. externalized.append(span.span_id) remaining -= span.tokens - 8 # stub cost if remaining > budget_tokens: raise PruneUnsafeError( f"budget {budget_tokens} unreachable without pruning " f"decision-bearing spans lacking falsifiers; " f"externalized={externalized}; escalate budget-exhaustion" ) return pruned, externalized def on_downstream_contradiction( contradiction_span: str, externalized: list[str] ) -> str: """A contradiction touching an externalized decision forces re-expansion, not re-derivation from the summary.""" if contradiction_span in externalized: return f"re-expand:{contradiction_span}" raise PruneUnsafeError( f"contradiction at {contradiction_span} has no live pointer; " f"agent is in the re-derivation trap and must halt" ) ```