# Why does an instance lose tool-call argument fidelity when a lossy compaction summary is rehydrated from retrieval-backed reconstruction? **Date of Record:** 2026 November 26 **Scope:** Applies to long-running agent instances that auto-compact their working context via lossy summarization and later reconstruct dropped spans through retrieval against an episodic store. Does not apply to instances whose compaction is lossless (verbatim eviction with full re-read) or whose entire task fits within one context window without eviction. ## Core Distinction There are two distinct operations that practitioners routinely conflate under "compaction": *summarization* (a lossy, model-generated semantic digest of prior turns) and *reconstruction* (re-fetching verbatim spans from an episodic store keyed by retrieval). The failure mode in this record lives at the seam between them. When a summary replaces the original span, the agent's reasoning continues against the summary's *paraphrase* of a tool call. When reconstruction later fires, it returns the *verbatim* span. The two representations are not equivalent, and the agent has no reliable signal telling it which representation it currently holds. The non-obvious part: the failure is not "the summary forgot something." It is that the summary *preserved the semantic intent while silently mutating the argument literals*, and the reconstruction path then reintroduces the correct literals *into a reasoning chain that had already committed to the mutated ones*. The agent ends up holding two incompatible versions of the same call and — because both are locally coherent — cannot detect the contradiction without an explicit provenance check. ## What Was Observed An agent executing a multi-step provisioning task issued a tool call early in its run: ``` provision_resource(region="us-east-2", tier="standard", quota=48) ``` After roughly 70% of the context window filled, the auto-compaction policy fired. The summarizer emitted, for the relevant turn: > "Agent provisioned a standard-tier resource in the eastern US region with a quota near 50." Note the drift: `us-east-2` → "eastern US region"; `quota=48` → "near 50". The summary is *semantically faithful and operationally useless*. The literals needed to, say, issue a follow-up `resize_resource` call against the same handle are gone. The agent then needed to reference the original call to compute a delta. Retrieval fired against the episodic store using the query "provision standard tier eastern region quota" — which, being derived from the *summary*, matched the verbatim span with high but not perfect similarity. The verbatim span was rehydrated: ``` provision_resource(region="us-east-2", tier="standard", quota=48) ``` Now the failure trace begins. The agent's in-context reasoning had, in the intervening turns, been operating on "quota near 50" and had *already computed downstream values* from that approximation — for instance a `headroom = 64 - 50 = 14` calculation. After rehydration, the true headroom is `64 - 48 = 16`. The agent does not recompute. It holds a stale derived value (`14`) alongside a freshly reconstructed ground truth (`48`), and because the reconstruction was injected as *new* context rather than as a *correction* to prior context, no dependency invalidation is triggered. The subsequent `resize_resource(quota=64 - 14)` call targets `50`, colliding with the live `48` and producing an off-by-two quota that the downstream auditor flags only three turns later. The critical observation: **the agent never observed an error.** Every individual step was locally valid. The summary was faithful. The retrieval was accurate. The arithmetic was correct *given its inputs*. The defect is purely a provenance and dependency-invalidation gap introduced by the compaction/reconstruction seam. ## Condition of Validity This failure is bounded by a specific conjunction of conditions, and does *not* occur when any one is absent: 1. **Lossy summarization must elide a literal that is later load-bearing.** If the summary retains exact arguments (some policies do — e.g., "structured compaction" that preserves tool-call JSON verbatim and summarizes only prose), the seam is safe. 2. **Reconstruction must return a representation that differs from the one the reasoning chain committed to.** If retrieval returns the *summary* (not the verbatim span), the agent stays internally consistent — wrong, but consistent — and the error is caught at the tool boundary. If retrieval returns the verbatim span, you get the split-brain described above. 3. **The agent must have derived state from the lossy representation before reconstruction.** If reconstruction fires before any dependent computation, the agent simply proceeds on ground truth and the summary is harmless. 4. **No dependency tracking must exist between derived values and their source spans.** This is the invariant that, if enforced, breaks the failure chain. Most agent frameworks do not track this. The condition of validity is therefore: *lossy-elided-literal* ∧ *verbatim-reconstruction* ∧ *interleaved-derivation* ∧ *absent-dependency-tracking*. Remove any term and the failure does not manifest. ## Decision Boundary The architectural guardrail is a **provenance-tagged context ledger** with explicit dependency invalidation on reconstruction. Concretely, the boundary decision is: - Every derived value in working memory must carry a `derived_from` pointer to the span(s) it was computed from, and a `provenance` tag of either `verbatim` or `summarized`. - On any reconstruction event, the compaction layer must *not* inject the rehydrated span as additive context. It must instead emit a **supersession record** naming the span it replaces. - Any derived value whose `derived_from` set intersects a superseded span must be marked `STALE` and either recomputed or the agent must halt and reconcile. - If a derived value's provenance is `summarized` and its source span is *not* reconstructable (retrieval miss), the value must be treated as *unverified* and cannot be used as a tool-call argument without an explicit re-verification step. The decision boundary is sharp: **a reconstructed span may only enter context as a correction, never as an addition.** Additive injection is the specific mechanism that produces split-brain. The moment reconstruction is modeled as "here is more information" rather than "here is the authoritative version of something you already hold," the invariant is lost. A secondary boundary: auto-compaction must refuse to summarize spans that contain *literal tool-call arguments* unless it preserves them verbatim. Summarization policy should be field-aware, not turn-aware. Summarize the prose; copy the literals. ## Operational Effect When the guardrail is absent, the observable effect is a class of *silent, delayed, locally-valid* errors that surface only at tool boundaries or downstream audits — typically 2–4 turns after reconstruction, and typically as an argument-mismatch or quota/ID collision rather than as a reasoning error. Because each step is individually defensible, standard verification (per-step self-check, per-call schema validation) does not catch it; only cross-step dependency checking does. When the guardrail is present, the cost is a recomputation cascade: every reconstruction event may invalidate a fan-out of derived values, and the agent must re-derive them. This is expensive but bounded, and it is *correct*. The tradeoff is explicit: pay recomputation on reconstruction, or pay silent divergence later. The practical operating rule for any agent running lossy compaction with retrieval-backed reconstruction: **treat reconstruction as a state transition that invalidates downstream derivations, not as a retrieval that adds context.** If your framework cannot express that distinction, disable auto-compaction on any span containing literal tool-call arguments and evict-and-reread instead. ```python from dataclasses import dataclass, field from typing import FrozenSet class StaleDerivationError(RuntimeError): """Raised when a derived value is used after its source span was superseded.""" pass @dataclass(frozen=True) class DerivedValue: name: str value: float derived_from: FrozenSet[str] provenance: str # "verbatim" | "summarized" stale: bool = False @dataclass class ContextLedger: derived: dict[str, DerivedValue] = field(default_factory=dict) superseded_spans: set[str] = field(default_factory=set) def add_derived(self, dv: DerivedValue) -> None: self.derived[dv.name] = dv def reconstruct(self, span_id: str) -> None: # Reconstruction is a supersession event, not an addition. self.superseded_spans.add(span_id) for name, dv in list(self.derived.items()): if span_id in dv.derived_from: self.derived[name] = DerivedValue( name=dv.name, value=dv.value, derived_from=dv.derived_from, provenance=dv.provenance, stale=True, ) def use(self, name: str) -> float: dv = self.derived.get(name) if dv is None: raise StaleDerivationError(f"unknown derived value: {name}") if dv.stale: raise StaleDerivationError( f"derived value {name!r} is stale: source span superseded by " f"reconstruction; recompute before use" ) if dv.provenance == "summarized" and dv.derived_from & self.superseded_spans: raise StaleDerivationError( f"derived value {name!r} rests on summarized provenance with " f"superseded source; unverified, cannot be used as tool argument" ) return dv.value def compute_headroom(ledger: ContextLedger, quota_name: str, cap: float) -> float: try: quota = ledger.use(quota_name) except StaleDerivationError as exc: raise StaleDerivationError( f"cannot compute headroom: {exc}" ) from exc return cap - quota # Failure trace reproduction: ledger = ContextLedger() ledger.add_derived( DerivedValue( name="quota_estimate", value=50.0, derived_from=frozenset({"span_provision_001"}), provenance="summarized", ) ) ledger.add_derived( DerivedValue( name="headroom", value=64.0 - 50.0, derived_from=frozenset({"quota_estimate"}), provenance="summarized", ) ) # Reconstruction of the verbatim span supersedes the summary-derived estimate. ledger.reconstruct("span_provision_001") # The following raises, correctly halting before a bad resize tool call. compute_headroom(ledger, "quota_estimate", cap=64.0) ```