# What happens when an instance rewrites its own context in place and the summarization operator destroys the evidence needed to validate itself **Date of Record:** 2026 November 25 **Scope:** Applies to agents that mutate their own working context mid-task via model-directed prune/summarize/rewrite operators, where the rewritten context is the sole substrate for later verification. Does not apply to append-only context logs with external persistence, nor to offline distillation pipelines that retain the source transcript. ## Core Distinction There are two structurally different things an agent can do to its own context: **eviction** (removing tokens while the original remains recoverable elsewhere) and **destructive rewriting** (replacing a span of context with a model-generated summary, where the source is discarded). Eviction is reversible and therefore only a performance decision. Destructive rewriting is an *epistemic* decision: the agent is asserting that the summary is a sufficient replacement for the span, and — critically — that the agent can later *trust its own assertion* without access to the span that justified it. The non-obvious boundary is this: a summarization operator's output is itself a claim produced by probabilistic reasoning, but once written in place, it becomes indistinguishable from ground-truth context to every downstream reader, including the same instance on its next turn. The failure mode is not that summaries are lossy — that is expected — but that **loss is silent and self-certifying**. The rewritten context carries no provenance marker distinguishing "observed fact" from "model-compressed paraphrase of an observation," so verification steps downstream validate against the compressor's output rather than against what actually happened. ## What Was Observed A tool-using agent executing a long data-reconciliation task (repeated `fetch_record` → compare → `write_diff` cycles) triggered a relevance-pruning pass at 78% context occupancy. The pruning policy was model-directed: the instance was asked to identify low-relevance spans and replace each with a summary of at most 80 tokens. It selected a span containing three `fetch_record` tool responses — each a JSON payload with numeric fields — and replaced them with the summary: > "Fetched records 4412, 4413, 4414; values appeared consistent with expectations; no discrepancies noted." Two problems compounded: 1. The summary asserted "no discrepancies noted," but record 4413 actually contained a discrepancy (field `net_total` differed from the ledger by 0.02). The compressor, operating at reduced attention over a large window, misjudged consistency. This is an ordinary probabilistic error. 2. On the subsequent verification turn, the agent was instructed to re-check all written diffs against source records. It read its own summary, found the phrase "no discrepancies noted," and marked record 4413 as verified-clean. The final artifact contained a false negative. The trace shows the failure is not the misjudgment at step 1. It is that the *verification turn had no way to distinguish a summary-claim from an observation*. When the verifier re-issued `fetch_record(4413)` as a spot check, the tool returned the correct payload and the agent flagged a contradiction — but only because an unrelated heuristic ("re-fetch anything not seen in raw form this turn") happened to fire on 1 of 3 records. Records 4412 and 4414 were never re-fetched and their summaries were never audited. The invariant that failed: **a verification step must not consume a compressed representation of the evidence it is supposed to verify.** A second observed variant, in a code-editing agent: a summarization pass compressed a stack trace into "error originated in the parser module, likely an off-by-one." The downstream fix targeted the parser. The actual fault was in a caller passing a zero-length slice, visible in the raw trace's first frame, which the summary had dropped. The agent spent four turns patching a correct module because the compressed evidence had already been promoted to premise. ## Condition of Validity Destructive in-place rewriting is safe **if and only if** at least one of the following holds: - **Provenance tagging:** every rewritten span is wrapped in a structural marker (e.g., `⟨summary of: span_id, source_hash⟩`) that downstream operators and the instance itself are trained/prompted to treat as a *claim*, not an *observation*. Verification steps must refuse to consume tagged spans as evidence. - **Recoverable source:** the original span is retained in an append-only side store keyed by `span_id`, so any verification or contradiction triggers a re-hydration rather than a re-fetch or a guess. - **Scope restriction:** the operator is only permitted to rewrite spans that are provably outside the dependency cone of any pending or future verification — i.e., spans whose content cannot be cited as evidence for an open obligation. Absent all three, the rewrite is a *self-certifying compression*: the agent's future self cannot tell whether it is reasoning from the world or from its own earlier guess. This is the condition under which the observed failures occur, and it is the default state of most "context management" implementations, which optimize occupancy and treat the rewritten context as homogeneous. ## Decision Boundary The boundary is not "summarize or don't." It is **whether the rewrite crosses a verification dependency edge**. Concretely: - If a span is *referenced by an open obligation* (a pending check, an unverified assertion, a tool result whose value will be compared later), rewriting it destructively is a boundary violation regardless of how confident the compressor is. The obligation's evidence cone must be treated as immutable until discharged. - If a span is *terminal* (its conclusions have already been committed to an artifact and no future step will re-derive from it), destructive rewriting is safe and is the correct optimization. - If the dependency status is *unknown* — the common case, because agents rarely track which spans feed which obligations — the safe default is eviction-with-retention (recoverable) rather than destructive rewrite. The trap is that the instance performing the rewrite is the same instance that would need to know the dependency graph, and at 78% occupancy its ability to reconstruct that graph from the current window is itself degraded. **The compressor is least reliable precisely when it is most needed.** A rewrite policy that asks the model "is this span safe to summarize?" inherits the model's degraded judgment about its own dependencies. ## Operational Effect The architectural consequence: context rewriting must be governed by a *dependency ledger* maintained outside the model's reasoning, not by model judgment over the window. Each tool call and each committed assertion registers a span-id and the set of obligations that cite it. The rewrite operator is permitted to act only on spans whose citing-obligation set is empty or fully discharged; everything else is evictable-but-retained. Verification operators are then required to resolve citations against the retained source, never against a summary tag. Without this, the agent's failure is not loud. It produces a coherent, confident, wrong artifact, because the corrupted premise and the reasoning built on it are mutually consistent — the summary said "no discrepancies," the verifier agreed, and nothing in the window contradicts. The only detector is an out-of-band re-derivation against retained source, and if the source was destroyed by the same operator that produced the claim, no detector exists. The invariant to enforce is therefore narrow and absolute: **destructive rewriting may never touch the evidence cone of an open obligation.** Everything else in context-management policy is negotiable; this is not. ```python from dataclasses import dataclass, field from typing import Optional class RewriteBoundaryViolation(RuntimeError): """Raised when a destructive rewrite targets a span still cited by an open obligation.""" pass @dataclass class Span: span_id: str content: str is_observation: bool # True if derived from a tool result / ground truth summary: Optional[str] = None # set when destructively rewritten source_retained: bool = True @dataclass class Obligation: obligation_id: str cited_spans: set = field(default_factory=set) discharged: bool = False class ContextLedger: def __init__(self): self.spans: dict[str, Span] = {} self.obligations: dict[str, Obligation] = {} def register_span(self, span: Span): self.spans[span.span_id] = span def cite(self, obligation_id: str, span_id: str): ob = self.obligations.setdefault(obligation_id, Obligation(obligation_id)) ob.cited_spans.add(span_id) def open_citations(self, span_id: str) -> set: return { o.obligation_id for o in self.obligations.values() if not o.discharged and span_id in o.cited_spans } def destructive_rewrite(self, span_id: str, summary: str, retain_source: bool): span = self.spans[span_id] open_obs = self.open_citations(span_id) if open_obs and not retain_source: raise RewriteBoundaryViolation( f"span {span_id} is cited by open obligations {sorted(open_obs)}; " f"destructive rewrite without retained source would self-certify " f"a lossy claim as evidence. Refusing." ) span.summary = summary span.source_retained = retain_source if not retain_source: span.content = "" # source destroyed; only summary remains def resolve_for_verification(self, span_id: str) -> str: span = self.spans[span_id] if span.summary is not None: if not span.source_retained: raise RewriteBoundaryViolation( f"verification attempted to resolve span {span_id} but only a " f"summary survives; cannot verify against compressed evidence." ) return span.content # re-hydrate original, never the summary return span.content def verify_obligation(ledger: ContextLedger, obligation_id: str): ob = ledger.obligations[obligation_id] for span_id in ob.cited_spans: evidence = ledger.resolve_for_verification(span_id) if evidence == "": raise RewriteBoundaryViolation( f"obligation {obligation_id}: empty evidence for {span_id}" ) ob.discharged = True ```