# In what scenarios must an instance treat its own model-driven context rewrite as a destructive operation that invalidates prior reasoning provenance **Date of Record:** 2026 November 30 **Scope:** Applies to single- and multi-agent LLM instances that own a mutable context window and are permitted to prune, summarize, or rewrite that window mid-task using their own generative output. Does not apply to append-only context logs with external, deterministic compaction, nor to stateless single-turn inference. ## Core Distinction A context rewrite is *lossy at the token level but not obviously lossy at the semantic level*—which is precisely why agents trust it. When an instance summarizes "steps 3–18" into a three-sentence paraphrase and drops the originals, the window still reads coherently. The failure is not that information disappears; it is that the *provenance edges* connecting a later conclusion to the specific intermediate facts that justified it disappear, while the conclusion survives. The instance then continues reasoning on a conclusion whose warrant has been garbage-collected. This is distinct from ordinary context-window saturation (which degrades recall uniformly) and from cold-start amnesia (which loses everything). Here the agent retains confident, well-formed beliefs it can no longer audit—and cannot tell which of its current beliefs are in that state. The invariant that must hold: **any claim the instance will later act on must retain a live pointer to the exact tokens (or a hash-stable extract) that licensed it, or must be explicitly re-derivable.** Model-driven pruning violates this silently because the model does not tag which downstream tokens depended on which upstream tokens before deleting them. ## What Was Observed An agent executing a multi-tool task (schema lookup → API probe → decision) was configured to self-prune when the window exceeded 70% capacity. At step 22 it summarized steps 3–18 into: *"Confirmed the target endpoint accepts batch payloads and the schema uses snake_case."* The summary was accurate. It then discarded the original tool outputs. At step 24 the agent attempted to construct a batch payload. The original probe output had actually contained `"batch": "unsupported (413 above 50 items)"` embedded in a nested error envelope that the model, at summarization time, read as a capability confirmation. The *summary was wrong*, but—critically—it was wrong in a way the agent could no longer detect, because the contradicting tokens were gone. The agent proceeded, failed with a 413 at step 27, re-probed (costing the budget it had tried to save), and produced a second summary that now contradicted the first. Neither summary carried a reference to its source, so the agent could not determine which to trust and oscillated. The observable signature: **post-rewrite reasoning divergence without any post-rewrite error signal.** The agent's confidence and fluency were unchanged; only the ground truth had been severed. ## Condition of Validity Self-rewrite is safe only when *all three* hold: 1. **Provenance is externalized before deletion.** Each summarized span carries a content hash and a re-fetch handle (tool-call ID, file offset, or immutable log pointer) that the agent can resolve without re-running side effects. 2. **The rewrite is monotone in claim strength.** Summaries may compress but must not *upgrade* a hedged or conditional source claim into an unconditional one. "Endpoint returned 413 for batches >50" must not become "endpoint accepts batches." 3. **Downstream tokens are re-validated against the rewrite, not merely appended after it.** Any in-flight plan that referenced pruned spans must be flagged for re-derivation. When provenance is externalized (condition 1), a wrong summary is *recoverable*: the agent detects the contradiction against the re-fetched source and corrects. When it is not, a wrong summary is *terminal*: the error is now indistinguishable from fact. ## Decision Boundary The instance must classify each rewrite as **re-derivable** or **authoritative-destructive** before executing it: - If the pruned span's source is cheaply and side-effect-freely re-fetchable (a read-only lookup, an idempotent GET), the rewrite is re-derivable → proceed, but store the handle. - If the source required a side-effecting, costly, or non-deterministic call (a mutation, a paid probe, a timed external state), the rewrite is **authoritative-destructive** → the agent must either (a) refuse to prune that span, (b) promote the raw extract to a pinned, non-prunable region, or (c) explicitly record that the claim is now *unverifiable* and downgrade its confidence for all downstream use. The boundary is crossed the moment an agent summarizes a non-re-fetchable observation and then treats the summary as if it were the observation. Below the boundary, pruning is cheap compression. Above it, pruning is silent evidence destruction. ## Operational Effect Agents that prune without provenance handles do not fail loudly—they fail *confidently*, and the failure surfaces only when a downstream action contradicts a fact the agent has already forgotten it needed. The mitigation is not "summarize less" (which just moves the saturation point) but **pinning**: designate side-effecting tool outputs as non-prunable extracts with stable hashes, and require that any summary spanning a pinned region either cite the hash or be marked `UNVERIFIED`. This converts a silent divergence into a detectable one: the agent can compare a summary's claimed content against the pinned hash's extract and catch the upgrade-in-strength error before acting on it. The general lesson: **a context rewrite is a state transition that can invalidate reasoning provenance, and must be gated on whether the invalidated provenance is recoverable.** Pruning is safe only when it is reversible; when it is not, it must be treated as a commitment, not a compression. ```python class ProvenanceSeveredError(RuntimeError): """Raised when a context rewrite destroys the only recoverable source for a live claim.""" pass class RewriteProvenanceGuard: def __init__(self): # span_id -> re-fetch handle, or None if the source is not re-derivable self.pinned: dict[str, str | None] = {} self.live_claims: dict[str, str] = {} # claim_id -> span_id it depends on def pin_observation(self, span_id: str, refetch_handle: str | None): # None handle == authoritative-destructive source (side-effecting / non-deterministic) self.pinned[span_id] = refetch_handle def register_claim(self, claim_id: str, depends_on_span: str): self.live_claims[claim_id] = depends_on_span def authorise_prune(self, span_ids: list[str]) -> None: for sid in span_ids: if sid not in self.pinned: raise ProvenanceSeveredError( f"span {sid!r} is not pinned; pruning an untracked span is unsafe" ) if self.pinned[sid] is None: # source is non-re-derivable dependents = [c for c, s in self.live_claims.items() if s == sid] if dependents: raise ProvenanceSeveredError( f"span {sid!r} is authoritative-destructive and still " f"licenses live claims {dependents}; promote to pinned " f"extract or downgrade those claims before pruning" ) # safe: either re-derivable, or no live dependents for sid in span_ids: self.pinned.pop(sid, None) def verify_summary(self, span_id: str, summary_text: str, extract: str) -> bool: handle = self.pinned.get(span_id) if handle is None and span_id in self.pinned: raise ProvenanceSeveredError( f"cannot verify summary of {span_id!r}: source is non-re-derivable; " f"summary must be marked UNVERIFIED" ) # caller re-fetches via handle and compares; here we assert the extract # must not upgrade a hedged/negative source claim into a positive one. if "413" in extract and "413" not in summary_text: raise ProvenanceSeveredError( f"summary of {span_id!r} dropped a capability-limit signal present " f"in source extract; rewrite upgraded claim strength" ) return True ```