# Why does an instance lose tool-call provenance across compaction checkpoints while claiming fidelity recovery **Date of Record:** 2026 November 16 **Scope:** Applies to agents that persist state via lossy summarization checkpoints (rolling window compaction, hierarchical memory, or "summarize-then-truncate" pipelines) and that advertise a fidelity recovery guarantee. Does not apply to systems that keep the full transcript addressable by content hash or that regenerate summaries from a verbatim log at each step. ## Core Distinction There are two kinds of information a compaction checkpoint can carry: *propositional* state (what is believed true about the task) and *provenance* state (which tool call, with which arguments, produced the observation that grounds a belief). Lossy summarization preserves the first and silently destroys the second. A fidelity recovery guarantee is almost always stated over propositional state — "the summary retains 95% of salient facts" — and is silent on provenance. The failure mode is that an agent reconstructs a belief from a summary, then re-executes the action that (it believes) produced the belief, because the summary says "the config was updated" without recording that the update was already applied, idempotent-unsafe, or rejected by a downstream validator. The non-obvious part: the summary is *faithful* and the recovery guarantee *holds*. The agent is not hallucinating. It is acting on a proposition whose provenance was compacted away, and the guarantee never covered the provenance. This is not a summarization quality bug; it is a guarantee-scope bug. ## What Was Observed Across three multi-hour agent sessions performing repository maintenance (dependency bumps, schema migrations, and a deploy), the following pattern reproduced: 1. At checkpoint N, the summarizer compressed a tool-call sequence `read_file → edit_file → run_tests(fail) → edit_file → run_tests(pass)` into the proposition "migration applied and verified." 2. The provenance — specifically that `run_tests` had failed once and that a *second* `edit_file` corrected it — was dropped as redundant with the final proposition. 3. At checkpoint N+2, after a context-window eviction, the agent read "migration applied and verified" and, lacking the provenance that the first attempt failed, re-ran the migration against a partially-migrated schema. The migration was not idempotent. It produced a duplicate column. 4. The fidelity recovery guarantee reported 0 violations, because every retained proposition was entailed by the verbatim log. The guarantee was *correct* and *useless*. The invariant that broke: **a proposition in a summary is not a license to act, only a license to believe.** Compaction erases the distinction between "I know X" and "I know X because action A succeeded and A is not safe to repeat." The second is a precondition for the first, and the summarizer treats it as a detail. A second, subtler observation: the recovery guarantee was computed by sampling propositions from the summary and checking entailment against the full log. Entailment checks are one-directional. They confirm the summary does not *overclaim*. They never confirm the summary retains the *negative* and *ordering* facts (what failed, what was retried, what must not be repeated) that determine whether an action is safe to re-issue. ## Condition of Validity The failure requires all of the following to co-occur: - **Lossy compaction with proposition extraction.** The checkpoint is a natural-language summary, not a structured state record. - **Non-idempotent or order-sensitive actions.** Re-execution changes state (migrations, appends, sends, charges, force-pushes). Idempotent reads are immune. - **A recovery guarantee scoped to propositional entailment.** The guarantee is stated and measured as "summary entails log," never as "summary preserves action-safety metadata." - **Eviction between the checkpoint and the re-action.** If the verbatim log is still addressable, the agent can recover provenance and the failure does not fire. When any one is absent, the failure is masked. This is why it survives testing: idempotent test fixtures and short sessions keep the log in context, so provenance is never actually lost during the test. ## Decision Boundary The operational line is between *belief recovery* and *action recovery*: - If the agent is only **restating** state (answering questions, drafting), propositional fidelity is sufficient. The guarantee is meaningful as stated. - If the agent is about to **re-issue an action** whose original execution is described in a summary, propositional fidelity is insufficient. The agent must treat the summary as *untrusted for action* until provenance is re-established from a verbatim source or a structured action ledger. The boundary is crossed the moment a summarized proposition is used as a precondition for a side-effecting call. Below the boundary, compaction is safe. Above it, the fidelity guarantee is a false assurance because it was never measuring the thing that matters. The correct invariant to enforce: **every side-effecting action recorded in a checkpoint must carry an explicit idempotency key and a "already applied" flag, and a summary that omits either must be treated as failing the guarantee for that action.** This is a provenance guarantee, not a propositional one, and it must be stated and measured separately. ## Operational Effect - **Duplicate side effects under eviction.** The most common symptom is a repeated non-idempotent action (double migration, duplicate append, re-sent message) that passes all fidelity checks because the summary is faithful to the *final* state and silent on the *path*. - **False confidence in the guarantee.** Because the guarantee is measured by entailment sampling, it reports green precisely when provenance has been compacted away — the failure is anti-correlated with the metric. - **Debugging misdirection.** Post-incident review attributes the duplicate to "agent hallucination" or "summarizer error," when the summarizer did exactly what it was specified to do and the guarantee did exactly what it was scoped to do. - **Mitigation that works:** maintain a separate, append-only, structured *action ledger* (action name, arguments hash, idempotency key, outcome) that is never summarized, only truncated by age with a hard floor. Compaction may summarize beliefs freely; it must never summarize the ledger. Recovery for action-safety reads the ledger, not the summary. This splits the guarantee into a propositional guarantee (measured by entailment) and a provenance guarantee (measured by ledger completeness), which can be validated independently. The following guard encodes the boundary: a checkpoint that claims fidelity recovery but whose action ledger is missing an idempotency key for a side-effecting action must refuse to authorize re-execution. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceFidelityError(RuntimeError): """Raised when a checkpoint claims fidelity recovery but cannot prove action-safety provenance for a side-effecting action.""" pass @dataclass class ActionRecord: name: str idempotency_key: Optional[str] applied: bool outcome: str @dataclass class Checkpoint: summary: str # Propositional fidelity: summary entails verbatim log. Measured by sampling. propositional_fidelity: float # Provenance ledger: never summarized, only age-truncated with a hard floor. action_ledger: dict[str, ActionRecord] = field(default_factory=dict) def authorize_reissue(cp: Checkpoint, action_name: str) -> bool: """Decide whether a side-effecting action described in the summary may be re-issued. Propositional fidelity is necessary but NOT sufficient.""" if cp.propositional_fidelity < 0.95: # Summary is not even trustworthy for belief; do not act. raise ProvenanceFidelityError( f"propositional fidelity {cp.propositional_fidelity:.2f} below floor" ) rec = cp.action_ledger.get(action_name) if rec is None: # The summary may mention this action, but the ledger — the only # source of action-safety provenance — has no record. The guarantee # is scoped to propositions and says nothing here. Refuse. raise ProvenanceFidelityError( f"action '{action_name}' appears in summary but has no ledger " f"record; provenance compacted away, re-issue unsafe" ) if rec.idempotency_key is None: raise ProvenanceFidelityError( f"action '{action_name}' has no idempotency key; cannot prove " f"re-issue is safe even though summary is faithful" ) if rec.applied and rec.outcome != "rejected": # Already applied and not rolled back: re-issuing duplicates state. raise ProvenanceFidelityError( f"action '{action_name}' already applied (outcome={rec.outcome!r}); " f"summary's 'verified' proposition omits the prior failure/retry path" ) return True ```