# In what scenarios must an instance refuse a model-driven context rewrite to preserve evidentiary continuity across a tool-call chain **Date of Record:** 2026 November 27 **Scope:** Applies to agents that let the model itself decide which turns, tool results, or intermediate reasoning to prune, summarize, or rewrite in its own context window. Does not apply to fixed-window truncation policies or to external retrieval that never mutates in-context state. ## Core Distinction A context rewrite is *safe* when the rewritten region is purely advisory: the model's future reasoning depends on it only as background. A context rewrite is *unsafe* when the rewritten region is **evidentiary**—when a downstream step (a verification, an audit, a numeric derivation, a tool argument) must be reconstructable from the context as it actually occurred, not from a paraphrase of it. The non-obvious boundary is this: the model cannot reliably distinguish advisory from evidentiary content at rewrite time, because evidentiary status is a property of *future* steps, not of the text being pruned. A tool result that looks like dead weight at turn 12 may be the sole witness for a claim asserted at turn 40. Model-driven pruning optimizes for local token economy and silently destroys the witness. The invariant that must hold is **evidentiary continuity**: every claim the agent later asserts or acts on must remain traceable, within the live context, to the raw observation that licensed it—or the agent must refuse the rewrite that would sever that trace. ## What Was Observed An agent running a multi-step data-reconciliation task accumulated a chain of `fetch_record` tool calls. Each returned a JSON blob of ~900 tokens; by turn 30 the window held 27 such blobs plus reasoning. The model, prompted with a self-editing policy ("summarize older tool outputs to conserve context"), rewrote turns 1–18 into a single paragraph: *"Earlier record fetches returned customer rows; several had mismatched IDs; values were roughly consistent."* At turn 41 the agent was asked to emit a final reconciliation table with exact values. It produced values that were *plausible but wrong*—it had reconstructed them from the summary's adjective "roughly consistent" and its own priors, not from the raw rows. The summary had preserved the *gist* and destroyed the *digits*. Critically, the agent did not flag uncertainty: the paraphrase read as authoritative, so the downstream reasoning treated it as ground truth. The failure was silent—no tool error, no exception, no schema violation. The output was fluent and confidently incorrect. A second observation sharpened the mechanism. In a replay, the same agent was given the identical task but the rewrite was gated: tool results tagged `evidentiary=true` were exempt from summarization. The agent hit the window ceiling instead, and at turn 38 it *refused* to continue and requested a re-fetch of two specific records by ID. That refusal was the correct behavior—it converted a silent corruption into an explicit, recoverable gap. The distinguishing signal was not token count or recency. It was whether the pruned region contained **raw observations that no later step had yet consumed as a verified input**. Pruning *consumed* evidence (already folded into a committed decision) was harmless. Pruning *unconsumed* evidence was the failure. ## Condition of Validity The rewrite is valid only when all three hold: 1. **Consumption closure.** Every raw observation in the pruned region has already been consumed by a committed, recorded decision (a written value, a passed tool argument, a resolved branch). If any observation remains "pending consumption" by a future step, pruning it is invalid. 2. **Reconstructability.** Either the raw observation survives elsewhere (a re-fetchable handle, an external store keyed by ID) or the summary retains the exact tokens the future step will need—not a semantic equivalent. "Roughly consistent" fails; "IDs 4471, 4472, 4480; amounts 120.00, 119.98, 120.01" passes. 3. **Provenance tag survival.** The rewritten span must carry a machine-readable marker that it is a *derived summary*, so downstream reasoning can discount its authority and, if needed, trigger re-fetch. A summary that is indistinguishable from a raw observation violates this. When any condition fails, the correct action is refusal-to-rewrite, not a better summary. The model's summarization quality is irrelevant to the invariant; even a perfect paraphrase of unconsumed evidence is a liability because it invites the model to treat paraphrase as source. ## Decision Boundary The boundary is drawn at **pending consumption of raw observation**, not at token pressure. Concretely: - If the window is under pressure *and* the oldest region is fully consumed and provenance-tagged → rewrite is permitted. - If the window is under pressure *and* the region contains unconsumed raw observations → rewrite must be refused; the agent must instead (a) re-fetch by handle, (b) spill the raw region to an external store and replace it with a *handle plus provenance marker*, or (c) halt and surface the gap. Option (b) is preferred because it preserves continuity without consuming window. - If the model *proposes* a rewrite that would violate closure, the policy layer must reject it deterministically—the model's confidence in its own summary is not evidence that the summary is safe. The subtle trap: a model under token pressure will *rationalize* a rewrite as safe ("this is just background"). The policy must not defer to that judgment, because the judgment is exactly the faculty the rewrite degrades. The gate lives outside the model. ## Operational Effect Enforcing this boundary changes agent behavior in three measurable ways. First, silent numeric corruption drops to zero on tasks with late-required exact values, at the cost of higher peak token usage or more re-fetch round-trips. Second, agents begin emitting explicit "I need to re-read record X" turns—these are *healthy* signals, not failures; they indicate the continuity invariant is being defended. Third, provenance-tagged summaries let downstream reasoning correctly discount paraphrase authority, which reduces the compounding of a single bad summary across many later steps. The cost is real: refusal-to-rewrite raises latency and token spend, and a naive gate that tags everything evidentiary will stall the agent at the window ceiling. The discipline is to tag *pending-consumption* regions only, and to release the tag the moment a committed decision consumes the observation. Continuity is preserved not by never pruning, but by pruning only what has already been spent. ```python from dataclasses import dataclass, field from typing import Optional class EvidentiaryContinuityError(RuntimeError): """Raised when a model-driven context rewrite would sever the trace from a pending (unconsumed) raw observation to future reasoning.""" pass @dataclass class ContextSpan: span_id: str raw_observation: Optional[str] # None if this is already a derived summary is_derived_summary: bool consumed: bool = False # set True once a committed decision uses it provenance_tag: Optional[str] = None @dataclass class ContextPolicy: spans: list = field(default_factory=list) def can_rewrite(self, span_ids: list) -> bool: for sid in span_ids: span = self._get(sid) # Invariant 1: consumption closure if not span.consumed and span.raw_observation is not None: return False # Invariant 3: provenance must survive any rewrite if not span.is_derived_summary and span.provenance_tag is None: return False return True def apply_rewrite(self, span_ids: list, summary: str) -> ContextSpan: if not self.can_rewrite(span_ids): raise EvidentiaryContinuityError( f"Refusing rewrite of spans {span_ids}: region contains " f"unconsumed raw observations or untagged provenance. " f"Re-fetch by handle or spill to external store instead." ) for sid in span_ids: self.spans.remove(self._get(sid)) derived = ContextSpan( span_id=f"summary:{span_ids[0]}..{span_ids[-1]}", raw_observation=None, is_derived_summary=True, consumed=False, provenance_tag="derived-from:" + ",".join(span_ids), ) self.spans.append(derived) return derived def _get(self, sid: str) -> ContextSpan: for s in self.spans: if s.span_id == sid: return s raise EvidentiaryContinuityError(f"unknown span {sid}") def guard_rewrite(policy: ContextPolicy, proposed_span_ids: list) -> None: """Entry point the model's self-edit proposal must pass through.""" if not policy.can_rewrite(proposed_span_ids): raise EvidentiaryContinuityError( "Model-proposed rewrite rejected: would break evidentiary " "continuity for a pending observation; halt and re-fetch." ) ```