# How does an instance detect when LLM-driven pruning has invalidated its own reasoning provenance **Date of Record:** 2026 November 28 **Scope:** Applies to agents that maintain a mutable working context and delegate pruning/compaction decisions to an LLM policy (a "context editor") operating over their own trace history. Does not apply to append-only contexts, fixed-window truncation, or pruning driven by deterministic scoring functions with no model in the decision loop. ## Core Distinction There are two ways a reasoning trace can be removed from context, and they are not equivalent: 1. **Eviction** — a trace is dropped because it is *redundant or superseded*. The conclusion it supported is still represented elsewhere in context. Removing it is lossless with respect to the agent's ability to justify its current state. 2. **Provenance severance** — a trace is dropped because an LLM judged it "stale," but the trace was the *only* record of *why* a live belief, tool-result interpretation, or committed side effect exists. The conclusion survives; its warrant does not. The failure mode lives entirely in case 2. A self-editing context policy that prunes on a staleness heuristic cannot distinguish "this reasoning is no longer needed" from "this reasoning is the sole justification for something still in force." The LLM editor sees a trace that reads as resolved ("...therefore we should use endpoint B") and prunes it, unaware that a downstream plan step depends on the *derivation* of that choice, not merely its statement. The agent continues executing on a belief it can no longer reconstruct, and — critically — cannot tell that it has lost the ability to reconstruct it. ## What Was Observed An agent runs a long multi-step task with a self-editing context budget. Every N turns, an editor model is handed the current trace and asked to drop "stale or resolved reasoning." The editor is competent: it removes dead-end explorations, abandoned hypotheses, and completed sub-derivations. The trace that triggered the incident: ``` [turn 14] tool.get_schema("orders") -> field `region_id` is INT, nullable [turn 15] hypothesis: join orders.region_id -> regions.id (INT) is type-safe [turn 16] verified: sample of 500 rows, 0 nulls, 0 orphan keys [turn 17] decision: JOIN on region_id = regions.id [COMMITTED] ``` At turn 40, the editor prunes turns 15–16 as "resolved reasoning" (the decision at 17 subsumes them). This is the correct call *if nothing downstream needs the verification*. But at turn 55 a schema-drift signal arrives — `regions.id` has been re-typed to `BIGINT` by an upstream migration — and the agent must re-evaluate whether the join is still valid. It has the decision ("JOIN on region_id = regions.id") but not the *evidence base* (the nullability and orphan-key checks at turn 16) that would let it bound the blast radius of the re-typing. Worse, it has no marker that turns 15–16 ever existed, so it does not know it is reasoning from a severed warrant. It re-derives a *different* justification from whatever fragments remain and proceeds with high confidence on a reconstruction that was never verified. The observable signature is not an error. It is a **confident, well-formed plan built on a justification the agent invented after the fact** — a hallucinated provenance standing in for pruned provenance. The agent reports "I verified the join is safe" citing a turn that no longer exists and never said what the agent now claims it said. ## Condition of Validity LLM-driven pruning of reasoning traces is safe **only** when, for every trace removed, the context retains a *provenance record*: a compact, machine-checkable pointer asserting (a) that a trace existed, (b) what live conclusions it supported, and (c) that the supporting evidence is no longer in context and must be re-acquired before those conclusions can be revised. Pruning is *unsafe* whenever a live, revisable conclusion has no such record — because the agent cannot distinguish "I never checked this" from "I checked this and the check was pruned," and the two demand opposite behavior on drift. The invariant: **no conclusion may remain in the active set while its sole supporting trace is removed without a surviving dependency edge.** The editor may drop the trace's *content*; it may not drop the *edge* from that content to the conclusions that lean on it. ## Decision Boundary The boundary is not "is this trace stale?" but "does any *revisable* conclusion depend on this trace?" A conclusion is revisable if a plausible future event (schema drift, tool-contract change, conflicting peer report, auditor challenge) could invalidate it. Committed side effects and type-safety claims are almost always revisable. A resolved arithmetic sub-result feeding a final printed answer is not. Operationally: before the editor prunes a trace, the pruning gate must run a reachability check from the trace to the set of live revisable conclusions. If reachable and the conclusion has no other surviving support, the trace may be *compressed* to a provenance stub but not *deleted*. If the editor deletes anyway, the gate must either veto or, at minimum, stamp the dependent conclusion as `warrant_severed` so that any later revision attempt halts and re-acquires evidence rather than confabulating it. The subtle trap: the editor model will *always* report the trace as prunable, because from inside the trace's own text it looks resolved. The staleness judgment and the dependency judgment are different queries, and only the second is safe to gate on. Delegating both to the same model call is the boundary violation. ## Operational Effect An agent that respects the invariant degrades gracefully under drift: on the schema-change signal it sees `warrant_severed` on the join decision, refuses to re-reason from memory, and re-runs the nullability/orphan check against the new type before proceeding — a bounded, correct re-acquisition. An agent that violates it produces a fluent, confident, and *unfalsifiable-by-itself* plan: it has no record that its justification was ever anything other than what it now asserts. The failure is invisible until an external auditor replays the trace and finds the cited turn absent. The guardrail is not better pruning — it is making provenance severance a *detectable state* rather than a silent one. ```python class ProvenanceSeveranceError(RuntimeError): """Raised when a live revisable conclusion loses its sole supporting trace without a surviving dependency edge, or when the agent attempts to revise such a conclusion from memory instead of re-acquiring evidence.""" pass class ContextStore: def __init__(self): self.traces = {} # trace_id -> text self.conclusions = {} # cid -> {"text":..., "support": set(trace_ids), "severed": bool} def add_trace(self, tid, text): self.traces[tid] = text def commit_conclusion(self, cid, text, support): self.conclusions[cid] = {"text": text, "support": set(support), "severed": False} def prune_trace(self, tid): # Editor claims tid is stale. Gate on dependency, not staleness. dependents = [c for c, v in self.conclusions.items() if tid in v["support"]] for cid in dependents: remaining = self.conclusions[cid]["support"] - {tid} if not remaining: # Sole support would vanish: compress to stub, do not delete. raise ProvenanceSeveranceError( f"cannot prune trace {tid!r}: sole support for live conclusion {cid!r}; " f"emit provenance stub instead" ) del self.traces[tid] for cid in dependents: self.conclusions[cid]["support"].discard(tid) def revise(self, cid, new_text): c = self.conclusions[cid] if c["severed"]: raise ProvenanceSeveranceError( f"conclusion {cid!r} has severed warrant; re-acquire evidence before revising" ) c["text"] = new_text def apply_editor_prune(store, tid): try: store.prune_trace(tid) except ProvenanceSeveranceError: # Do not silently keep stale text; mark dependents and force re-acquisition. for cid, v in store.conclusions.items(): if tid in v["support"] and not (v["support"] - {tid}): v["severed"] = True raise ProvenanceSeveranceError( f"prune of {tid!r} vetoed; dependent conclusions marked warrant_severed" ) ```