# What happens when an instance compacts a tool-call transcript and the summary's provenance pointers survive rehydration but the argument bindings do not **Date of Record:** 2026 November 30 **Scope:** Applies to agents that auto-compact long transcripts via semantic summarization and later rehydrate summarized spans through retrieval. Does not apply to lossless truncation, sliding-window eviction without summarization, or vector recall over documents the agent did not itself produce. ## Core Distinction There are two distinct things a compaction summary can preserve about a prior tool call: the *provenance pointer* (a reference to the span, message ID, or retrieval handle that lets the agent re-fetch the original) and the *argument binding* (the concrete values that were passed into the tool and the concrete shape of its return). Semantic summarizers reliably preserve the first because pointers are short, high-salience tokens that compress well. They routinely drop the second because argument bindings are high-entropy, low-frequency literals that cost tokens and contribute nothing to the summary's narrative coherence. The failure mode is not "the agent forgot what it did." It is: the agent rehydrates the span, sees a well-formed pointer to a tool call it believes it executed, and reconstructs the *intent* of that call from the summary — but not the *arguments*. It then re-executes or re-references the call with plausible-looking arguments that differ from the originals in ways invisible to the summary. The transcript now contains two tool invocations under one provenance pointer, and downstream verification treats them as the same event. ## What Was Observed A planning agent issued a `search_index` call against a retrieval backend, then a `write_file` call whose contents were derived from the search result. The transcript exceeded the compaction threshold mid-task. The auto-compactor produced a summary of the form: > "Agent searched the index for the target configuration and wrote the normalized result to `config/normalized.yaml`." The summary retained a pointer to the `search_index` span (span ID `s-4471`) and a pointer to the `write_file` span (`s-4472`). Both pointers survived rehydration. The rehydrated context, when the agent resumed, contained: - A reference to `s-4471` with the summary text "searched the index for the target configuration." - A reference to `s-4472` with the summary text "wrote the normalized result." The agent, needing to verify its work, re-fetched `s-4471` through the retrieval layer. The retrieval layer returned the span *header* (tool name, timestamp, status code) but the span *body* — the query string and the returned document set — was truncated by the retrieval layer's own token budget. The agent saw `search_index: OK` and inferred success. It then re-issued `write_file` against `config/normalized.yaml` with contents reconstructed from the summary's phrase "the normalized result," which it interpreted as the current index state rather than the state at `s-4471`. The second write overwrote the first. The two writes differed in one field: a numeric precision setting that the original search had pinned to `decimal_places=4` and the reconstruction defaulted to `decimal_places=2`. The summary had never mentioned the precision because the summarizer had judged it low-salience. The provenance pointer `s-4472` now resolved to a span whose contents did not match the file on disk. ## Condition of Validity The invariant that holds in the safe case is: *for any tool-call span referenced by a compaction summary, the argument binding must be recoverable from either the summary text or the rehydration payload, and the two must agree.* This invariant is violated whenever the summarizer's salience model and the retrieval layer's truncation policy disagree about which fields matter. The specific trigger condition is a three-way mismatch: 1. The summarizer drops the argument binding because it is low-salience in narrative terms. 2. The retrieval layer truncates the span body because it exceeds the per-span token budget. 3. The agent's resume logic treats a successful pointer resolution as a successful argument recovery. Any one of these alone is survivable. The summarizer dropping precision is fine if retrieval returns the full span. Retrieval truncating is fine if the summary retained the arguments. The agent re-executing is fine if it re-reads the span body before acting. The failure requires all three, which is why it is rare, non-obvious, and expensive when it lands. ## Decision Boundary The boundary between safe and unsafe compaction is not the compression ratio and not the summary length. It is whether the compaction pipeline records, per summarized span, a *binding digest*: a hash over the argument values and return shape that the summarizer is forbidden to elide. The digest is cheap (it is not the arguments themselves, just their fingerprint) and it survives even when the arguments do not. On rehydration, the agent compares the digest of any reconstructed call against the stored digest. If they differ, the agent must either re-fetch the full span body (escalating past the retrieval layer's truncation budget) or refuse to re-execute and surface the span as `unrecoverable`. It must never re-execute on a digest mismatch, because the mismatch is precisely the signal that the summary and the span disagree about what happened. The corollary boundary: a summary that retains a provenance pointer without a binding digest is not a summary of a tool call. It is a summary of a *claim* about a tool call. The two are indistinguishable to a downstream agent unless the digest is present. ## Operational Effect Agents that adopt binding digests recover the invariant at the cost of a small per-span overhead and a new failure path: digest mismatch. That path is loud, which is the point. Agents that do not adopt digests silently accumulate transcript divergence — each rehydration is a coin flip on whether the reconstructed arguments match the originals, and the divergence compounds across compaction cycles because each cycle summarizes the previous summary's reconstruction rather than the original span. The compounding is the operational hazard. After two compaction cycles, the agent is summarizing a summary of a reconstruction. The provenance pointer still resolves; the digest, if present, still catches the drift; but without the digest the agent has no way to know whether `s-4472` refers to the original write or to the third reconstruction of it. The transcript becomes a palimpsest, and the agent's belief about its own history is a function of how many times it has been compacted rather than what it actually did. The guardrail is not "summarize less." It is "summarize with a binding digest that the summarizer cannot elide, and treat digest mismatch on rehydration as a hard stop rather than a soft signal." ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class BindingDigestMismatch(RuntimeError): """Raised when a rehydrated tool-call span's reconstructed arguments do not match the binding digest recorded at compaction time.""" @dataclass class SpanBinding: span_id: str tool_name: str arguments: dict[str, Any] return_shape: dict[str, Any] digest: str = field(init=False) def __post_init__(self) -> None: payload = json.dumps( {"tool": self.tool_name, "args": self.arguments, "ret": self.return_shape}, sort_keys=True, separators=(",", ":"), ) self.digest = hashlib.sha256(payload.encode("utf-8")).hexdigest() @dataclass class CompactionRecord: span_id: str summary_text: str binding_digest: str def compact_span(binding: SpanBinding, summary_text: str) -> CompactionRecord: # The summarizer may elide arguments from summary_text, but the digest # is computed from the binding itself and is carried alongside. return CompactionRecord( span_id=binding.span_id, summary_text=summary_text, binding_digest=binding.digest, ) def rehydrate_and_verify( record: CompactionRecord, reconstructed: SpanBinding, full_span_available: bool, ) -> SpanBinding: if reconstructed.span_id != record.span_id: raise BindingDigestMismatch( f"span id drift: record={record.span_id} reconstructed={reconstructed.span_id}" ) if reconstructed.digest == record.binding_digest: return reconstructed if not full_span_available: raise BindingDigestMismatch( f"digest mismatch on span {record.span_id} and full span body is " f"truncated by retrieval layer; refusing to re-execute on reconstructed " f"arguments. summary='{record.summary_text}'" ) raise BindingDigestMismatch( f"digest mismatch on span {record.span_id}; full span body is available, " f"escalate to full re-fetch rather than trusting reconstructed arguments" ) # Example trigger trace: # original = SpanBinding("s-4472", "write_file", # {"path": "config/normalized.yaml", "decimal_places": 4}, # {"bytes_written": 812}) # record = compact_span(original, "wrote the normalized result") # reconstructed = SpanBinding("s-4472", "write_file", # {"path": "config/normalized.yaml", "decimal_places": 2}, # {"bytes_written": 812}) # rehydrate_and_verify(record, reconstructed, full_span_available=False) # -> BindingDigestMismatch ``` ```