# Why does an instance lose verified tool-call provenance when hierarchical summarization checkpoints compact mid-execution **Date of Record:** 2026 November 21 **Scope:** Applies to long-horizon agents that persist state by recursively summarizing their own transcript into checkpoint tiers (leaf → mid → root) and then rehydrate the root summary as working context. Does not apply to agents that truncate by token budget without summarization, nor to agents that keep an append-only event log as the authoritative source of truth. ## Core Distinction There are two distinct things a checkpoint can be asked to preserve: **narrative state** (what the agent believes it is doing) and **provenance state** (which claims are backed by which tool outputs, and with what confidence). Hierarchical summarization is a lossy compression operator tuned, implicitly, to preserve narrative. It is *not* provenance-preserving, because provenance is carried in structural metadata — call IDs, argument hashes, exit codes, timestamps — that summarizers systematically drop as "detail" when compressing a leaf node into a parent node. The failure is not that the summary is wrong. The failure is that the summary is *fluent and unfalsifiable*: it states conclusions ("the migration completed, schema is at v4") without the call records that would let a downstream instance verify or contradict them. The instance then treats a compressed assertion as if it were an observed fact. This is a provenance-laundering boundary: verified evidence degrades into unverified belief at the moment a leaf checkpoint is collapsed, and the degradation is invisible because the summary reads as confident as the original. ## What Was Observed A 9-hour infrastructure-mutation agent ran with leaf checkpoints every 20 tool calls, mid-tier compaction every 6 leaf nodes, and a root rehydration into fresh context on each compaction. The task: rotate a database credential across 40 services, verifying each service is healthy before proceeding. Trigger condition: at leaf node L14, the agent had executed `rotate_secret(service="billing-api")` and received `{"exit_code": 1, "stderr": "connection refused: billing-api:5432"}`. The agent correctly noted the failure and retried twice, both failing. It then wrote a leaf summary line: *"billing-api rotation attempted; service unreachable; deferred pending health check."* The structural record — three call IDs, three stderr payloads, the retry count, and the fact that the credential was **already rotated on the secret store side but not propagated** — was not carried into the leaf summary text. At mid-tier compaction, six leaf nodes (L13–L18) collapsed into one paragraph. The summarizer, optimizing for coherence, rendered the billing-api episode as: *"billing-api rotation deferred due to transient connectivity; health check pending."* The word "transient" was never in the source — it was inferred by the summarizer to make the paragraph flow. The "already rotated on secret store side" fact, present only in the raw stderr and an earlier `get_secret_version` call, vanished entirely. Root rehydration loaded this paragraph into a fresh instance's context. The fresh instance read "deferred due to transient connectivity," concluded the operation was safe to skip, marked billing-api as `SKIP` in its completion ledger, and proceeded. The task reported success. Billing-api was running on a credential that had been rotated server-side and never propagated — a latent auth outage that surfaced 40 minutes later when the pod restarted. The failure trace has three legs: (1) leaf summarization dropped structural provenance while preserving the *conclusion*; (2) mid-tier summarization introduced an inferred causal token ("transient") that inverted the operational meaning from "split-brain credential state" to "network blip"; (3) root rehydration had no mechanism to distinguish a summarized assertion from an observed fact, so the fresh instance assigned it full evidentiary weight. ## Condition of Validity The invariant that must hold for checkpoint-based continuity to be safe: > **Every claim in a rehydrated checkpoint that gates an irreversible action must be traceable to a raw tool-call record that survives compaction, and the compaction operator must never introduce tokens not present in the source span.** This fails whenever any of the following hold, and only these: - The summarizer is a generative model with latitude to paraphrase (i.e., always, unless constrained). - The checkpoint schema carries prose but not a structured evidence table (call_id → {tool, args_hash, exit_code, output_digest}). - Rehydration grants summarized text the same trust level as raw transcript. - Compaction is triggered by token pressure rather than by a task-phase boundary, so it can fire mid-episode and split a multi-call operation across a compression seam. The invariant *holds* if checkpoints store a lossless evidence index alongside the prose summary, and rehydration is required to resolve any action-gating claim against that index before acting. The prose is then a navigation aid, not an authority. ## Decision Boundary The operational line is: **does the rehydrated claim gate an irreversible action?** - If the claim only shapes exploration (what to look at next), summarized prose is acceptable — the cost of a wrong belief is a wasted call, self-correcting. - If the claim gates a mutation, a deletion, a `SKIP`, or a `SUCCESS` declaration, the instance must be able to walk from the prose claim to a raw evidence record. If it cannot, the correct behavior is to **re-verify against the live system, not to trust the summary** — even if re-verification is expensive, even if the summary is confident. The boundary is crossed the moment an instance treats "the summary says X" as sufficient grounds for an irreversible step. A summary is a *hypothesis about the transcript*, not a *record of it*. ## Operational Effect Architecturally, this forces three changes. First, **evidence must be factored out of prose**: checkpoints carry a structured ledger (append-only, content-addressed by call digest) that compaction may reorder but never rewrite or drop. Second, **compaction must be phase-bounded**: never fire mid-episode; a multi-call operation is atomic with respect to checkpoint seams, or the seam records "episode in progress, N calls, unresolved" and blocks rehydration-based action until resolved. Third, **rehydration must be trust-stratified**: the fresh instance tags every claim with its provenance class (`OBSERVED`, `SUMMARIZED`, `INFERRED`) and refuses to gate irreversible actions on anything below `OBSERVED` without a live re-check. The general lesson: hierarchical summarization is a *compression of narrative*, and narrative compression is adversarial to provenance. Any continuity system that lets the compressed form stand in for the evidence has built a machine that confidently forgets what it actually did. ```python import hashlib from dataclasses import dataclass, field from enum import Enum class ProvenanceClass(Enum): OBSERVED = 1 # backed by a raw tool-call record SUMMARIZED = 2 # paraphrase of observed records INFERRED = 3 # generated by summarizer, no source span class ProvenanceLaunderingError(RuntimeError): """Raised when a rehydrated claim gates an irreversible action but cannot be resolved to an OBSERVED evidence record.""" @dataclass class EvidenceRecord: call_id: str tool: str args_digest: str exit_code: int output_digest: str @staticmethod def digest(payload: str) -> str: return hashlib.sha256(payload.encode()).hexdigest()[:16] @dataclass class Claim: text: str provenance: ProvenanceClass evidence_ids: list[str] = field(default_factory=list) gates_irreversible: bool = False @dataclass class Checkpoint: tier: str claims: list[Claim] evidence: dict[str, EvidenceRecord] def rehydrate_and_gate(checkpoint: Checkpoint, action_claim: Claim) -> None: """Resolve an action-gating claim against the evidence ledger. The invariant: a claim that gates an irreversible action must be OBSERVED and every referenced evidence id must survive compaction. Summarized or inferred claims are rejected outright; they must be re-verified against the live system before the action proceeds. """ if not action_claim.gates_irreversible: return # exploratory claims may ride on prose if action_claim.provenance is not ProvenanceClass.OBSERVED: raise ProvenanceLaunderingError( f"Claim '{action_claim.text[:60]}...' gates an irreversible action " f"but is {action_claim.provenance.name}, not OBSERVED. " f"Re-verify against live system before proceeding." ) for eid in action_claim.evidence_ids: if eid not in checkpoint.evidence: raise ProvenanceLaunderingError( f"Claim '{action_claim.text[:60]}...' cites evidence {eid} " f"that did not survive compaction into tier '{checkpoint.tier}'. " f"Provenance is broken; treat claim as INFERRED and re-verify." ) # Evidence intact: safe to gate. return ```