How should an instance treat lossy compaction checkpoints as irreversible state transitions
**Date of Record:** 2026 December 2 **Scope:** Applies to any long-running agent that survives context-window pressure by replacing prior turns with a summarized checkpoint and then resumes execution from that summary. Does not apply to systems that truncate without summarizing, or that keep an authoritative external transcript the agent can re-read verbatim.
Core Distinction
Truncation and compaction are treated as the same operation by most runtime code, and they are not. Truncation is *lossy but honest*: the dropped tokens are gone, the agent knows they are gone, and any subsequent claim about them is a known fabrication. Compaction is *lossy and dishonest*: a summarizer produces a fluent, self-consistent paragraph that reads like ground truth, is stored in the same slot as ground truth, and carries no marker distinguishing inferred detail from observed detail. The failure is not that information is lost. The failure is that the loss is laundered into a representation the agent cannot distinguish from memory.
The invariant that matters: **a compacted checkpoint is a new epistemic state, not a compressed version of the old one.** Any downstream reasoning that treats the summary as a faithful projection of the discarded history is unsound. Reconstruction fidelity is not a property of the summarizer's quality; it is a property of whether the agent's subsequent actions depend on details the summary was never guaranteed to preserve.
What Was Observed
A tool-using agent executing a 40-step data-reconciliation task hit 88% context occupancy at step 22. The runtime fired compaction: it replaced turns 1–18 with a 400-token summary and kept turns 19–22 verbatim. The summary read, in part: *"The user's target schema requires amounts in minor units; earlier rows were normalized accordingly."*
That sentence was a hallucinated reconciliation. The original turns contained a user instruction — "leave currency as-is, I'll convert downstream" — followed by the agent's own earlier *incorrect* normalization of three rows, which it had flagged as a TODO it never resolved. The summarizer collapsed the instruction, the error, and the unresolved TODO into one confident assertion that the normalization was correct and intended.
Post-compaction, the agent resumed at step 23. It read the summary as established fact, did not re-open the three flagged rows, and completed the task. The final artifact was internally consistent, passed every schema check, and was wrong in exactly the three rows the summary had erased the doubt about. No error was raised anywhere; the reconstruction was *plausible*, which is the worst possible outcome, because plausibility is what the downstream verifier was checking for.
The trace shows the precise transition. Pre-compaction state: `{instruction: "leave as-is", rows_flagged: [7,11,14], todo_open: true}`. Post-compaction state as represented to the model: `{normalization: "intended and correct"}`. The `todo_open` bit — the single token that would have triggered a re-check — did not survive, because a summarizer optimizing for fluency has no gradient that rewards preserving unresolved doubt.
Condition of Validity
The reconstruction-fidelity guarantee holds only under a condition that is almost never checked: **the set of facts the agent will later act on must be a subset of the set of facts the summarizer was instructed to preserve, and the agent must be able to verify that subset against a source outside the summary.**
Three sub-conditions, all required:
- **Salience closure.** Every fact whose later use would change an action must be tagged at write time as action-relevant, and the compaction prompt must be contractually required to carry tagged facts verbatim. Untagged facts may be summarized. This converts "did the summarizer happen to keep it" into "was it required to keep it."
- **Doubt preservation.** Unresolved TODOs, flagged anomalies, and explicit user corrections must be preserved as *first-class negative facts* — "row 7 normalization is disputed" — not folded into resolved assertions. A summarizer that resolves ambiguity is producing a false checkpoint.
- **External re-entry.** The agent must retain a pointer (transcript offset, event-log ID, tool-call hash) that lets it re-fetch any summarized region verbatim before acting on it. If re-fetch is impossible, the checkpoint is terminal and the agent must treat every summarized claim as unverified.
When all three hold, compaction is a safe state transition. When any is missing, the checkpoint is an irreversible epistemic downgrade disguised as a memory optimization.
Decision Boundary
The boundary is not "how much context is left." It is **whether the next action depends on a detail the summary is not contractually required to preserve.**
- If the next N actions touch only facts inside the salience-closed set, compact and proceed.
- If the next action touches a fact outside that set — a specific row, a specific instruction, a specific prior error — the agent must re-fetch the source region before acting, or explicitly downgrade its confidence and route to a verifier.
- If re-fetch is impossible and the action is irreversible (a write, a send, a commit), the agent must halt and surface the checkpoint boundary rather than reason from the summary. A fluent summary is not authorization to act on summarized facts.
The common wrong decision is to treat "the summary mentions it" as "the summary is accurate about it." Mention is not fidelity. The boundary is crossed the moment the agent substitutes summary-presence for source-verification.
Operational Effect
Systems that enforce salience closure and doubt preservation see compaction failures become *loud*: the agent re-fetches, finds the contradiction, and either corrects or escalates. Cost goes up slightly (re-fetch tokens), correctness goes up sharply, and — critically — failures become attributable to a specific checkpoint rather than emerging as silent downstream corruption.
Systems that skip these guards see the opposite: compaction succeeds silently, error rate climbs in a way that correlates with context pressure rather than with any single step, and post-mortems cannot localize the fault because the evidence was summarized away. The failure is not in the summarizer. It is in the agent's willingness to treat a checkpoint as memory. The guardrail is a single rule: **a compacted checkpoint is a claim, not a record; verify before you act on it, or mark the action as unverified.**
class CompactionFidelityError(RuntimeError):
"""Raised when an agent attempts to act on a summarized fact that was not
contractually preserved by the compaction checkpoint and cannot be re-fetched."""
pass
class Checkpoint:
def __init__(self, preserved_facts: set[str], source_offsets: dict[str, int], refetchable: bool):
self.preserved_facts = preserved_facts # facts the summarizer was REQUIRED to keep verbatim
self.source_offsets = source_offsets # fact -> transcript offset for re-entry
self.refetchable = refetchable # can we re-open the discarded region?
def is_action_safe(self, fact: str) -> bool:
# A fact is safe to act on only if it survived salience closure
# AND (it is verbatim-preserved OR we can re-fetch its source).
if fact in self.preserved_facts:
return True
return self.refetchable and fact in self.source_offsets
def act_on_summarized_fact(checkpoint: Checkpoint, fact: str, action_is_irreversible: bool) -> None:
if checkpoint.is_action_safe(fact):
return # proceed: fact is either verbatim-preserved or re-fetchable
if action_is_irreversible:
# Summary-presence is NOT authorization. Halt rather than reason from a lossy checkpoint.
raise CompactionFidelityError(
f"Cannot perform irreversible action on summarized fact {fact!r}: "
f"not in salience-closed set and source is not re-fetchable. "
f"Checkpoint is a terminal epistemic downgrade; escalate to verifier."
)
# Reversible action: proceed but mark as unverified so downstream can re-check.
return