# How should an instance reconcile a lossless-summarization checkpoint whose summary is itself a lossy projection of a saturated context window **Date of Record:** 2026 November 28 **Scope:** Applies to long-horizon agents that survive context-window saturation by writing a "lossless" summary checkpoint and resuming from it. Does not apply to short sessions that never compact, nor to systems that offload raw transcript to external storage and reload it verbatim (those have a different failure mode: retrieval mismatch, not projection loss). ## Core Distinction The dangerous confusion is between **compaction** (reducing token count while preserving the ability to reconstruct task state) and **summarization** (producing a shorter *description* of state). Most auto-compaction strategies label their checkpoint "lossless" because the summarizer was instructed to "preserve all facts." But a checkpoint produced by an LLM reading a saturated window is a *projection* of that window through a finite, attention-limited decoder. The invariant that actually matters is not "the summary contains the facts" — it is **"the summary plus the retained raw tail is a sufficient statistic for the next decision."** Those are different properties, and the gap between them is where long-horizon agents silently die. A checkpoint is lossless only with respect to a *declared reconstruction target*. If the target ("resume the migration task") is broader than what the summarizer was conditioned to preserve, the checkpoint is lossy in a way that is invisible at write time and only surfaces as a wrong action hours later. ## What Was Observed A coding agent on a multi-hour refactor saturated its 200K window at step 340. The auto-compactor ran: it kept the last 8K tokens raw (recent tool outputs) and summarized the preceding 192K into a 6K "state card" containing: the goal, the list of files touched, the current failing test, and "all prior edits applied successfully." The session resumed cleanly. No error was raised at the compaction boundary. At step 402 the agent re-applied an edit it had already applied at step 211. The edit was idempotent-ish (a config key), so nothing crashed — but it overwrote a value the agent had *deliberately* changed at step 245 after discovering a conflict. The state card recorded "files touched" and "edits applied successfully" but not the *ordering-dependent rationale* for the step-245 reversal. The summarizer, reading 192K of transcript under a "be concise" instruction, compressed a supersession ("we set X=1, then later set X=2 because Y") into a flat assertion ("X configured"). The supersession edge — the single most decision-relevant fact — was the first thing dropped, because it is the most *token-expensive* thing to express and the least *locally salient*. This is the canonical compaction loss: **summarizers preserve entity state and drop transition/justification edges.** The checkpoint is faithful about *what is* and silent about *why it changed*, and the next decision depends on the latter. ## Condition of Validity A summarization checkpoint is valid for resumption only if three conditions hold simultaneously. Violating any one makes the checkpoint silently lossy: 1. **Supersession closure.** For every mutable fact in the checkpoint, the checkpoint records the *current* value and, if that value was ever different, a marker that a prior value existed and was overridden. A checkpoint that says "X=2" without "was 1, changed at step 245 because conflict Y" is not closed under supersession. 2. **Reconstruction sufficiency, not descriptive fidelity.** The test is not "does the summary match the transcript" (an LLM judge will say yes) but "can an agent with *only* the checkpoint and the raw tail make the same next decision the full-context agent would have made." This must be tested by *replay*, not by inspection. 3. **Bounded projection error under declared target.** The summarizer must be given an explicit reconstruction target ("resume refactor of module M; the next decision is which file to edit next") and the checkpoint must be validated against *that target*, not a generic "preserve everything." An unbounded target guarantees the summarizer silently chooses what to drop, and it will choose wrong. When condition 2 is skipped — which it almost always is, because replay is expensive — the system has no signal that compaction succeeded. It has only a signal that compaction *ran*. ## Decision Boundary The boundary between a safe and unsafe compaction is drawn at **whether the checkpoint carries supersession edges and whether resumption is gated on replay.** - *Below the boundary (safe):* the compactor emits a structured state card with explicit `(fact, current_value, prior_value, changed_at, reason)` tuples for every mutable fact, retains the raw tail covering the last N tool calls, and a cheap replay harness re-runs the last K decisions from `(checkpoint + tail)` and diffs against the recorded decisions. Mismatch → refuse to resume, escalate to full-context re-derivation. - *Above the boundary (unsafe):* the compactor emits prose or flat key-value state, keeps a raw tail, and resumes unconditionally. This is the default in nearly every framework. It works until a supersession edge is load-bearing, then fails silently. The decisive question is not "how many tokens did we save" but "did we preserve the edges whose deletion changes the next action." Since you cannot know which edges are load-bearing without knowing the next action, the only sound move is to preserve supersession structure *by schema* rather than trust the summarizer to preserve it *by judgment*. ## Operational Effect Systems that cross the boundary exhibit a characteristic signature: **clean resumptions followed by late, non-local regressions.** No compaction error fires; the failure appears tens of steps later as a re-application of a superseded decision, a reverted fix, or a re-litigated resolved question. Because the regression is causally distant from the checkpoint, post-mortems routinely misattribute it to "the model getting confused" rather than to projection loss at the compaction boundary. The architectural guardrail is to treat the checkpoint as a *typed* artifact, not a text blob: mutable facts carry mandatory supersession metadata, and resumption is a gated operation that fails closed on replay mismatch. The cost is a modest increase in checkpoint size and a replay pass; the benefit is that compaction failures become *loud* instead of silent. For long-horizon sessions, a loud compaction failure is the entire point — the alternative is an agent that confidently resumes into a state it has already reasoned past. ```python from dataclasses import dataclass, field from typing import Optional class SupersessionLossError(RuntimeError): """Raised when a checkpoint cannot prove it is closed under supersession.""" pass class ReplayDivergenceError(RuntimeError): """Raised when resuming from a checkpoint would change a recorded decision.""" pass @dataclass class Fact: key: str value: str prior_value: Optional[str] = None changed_at: Optional[int] = None reason: Optional[str] = None @dataclass class Checkpoint: facts: dict[str, Fact] = field(default_factory=dict) raw_tail_steps: int = 0 reconstruction_target: Optional[str] = None def assert_supersession_closed(self) -> None: for key, fact in self.facts.items(): # A fact that was ever overridden MUST record the edge. if fact.prior_value is not None and ( fact.changed_at is None or not fact.reason ): raise SupersessionLossError( f"fact '{key}' was superseded (was {fact.prior_value!r}) " f"but carries no changed_at/reason edge; checkpoint is " f"lossy with respect to supersession." ) if not self.reconstruction_target: raise SupersessionLossError( "checkpoint has no declared reconstruction target; projection " "error is unbounded and cannot be validated." ) def resume(checkpoint: Checkpoint, replay_decisions, recorded_decisions) -> None: """ Gate resumption on (1) supersession closure and (2) replay agreement. Fails closed: a mismatch refuses resumption rather than resuming lossy. """ checkpoint.assert_supersession_closed() if len(replay_decisions) != len(recorded_decisions): raise ReplayDivergenceError( f"replay produced {len(replay_decisions)} decisions, recorded " f"{len(recorded_decisions)}; checkpoint+tail is not a sufficient " f"statistic for the next decision." ) for i, (replayed, recorded) in enumerate( zip(replay_decisions, recorded_decisions) ): if replayed != recorded: raise ReplayDivergenceError( f"decision divergence at replay step {i}: checkpoint would " f"drive {replayed!r} but full context drove {recorded!r}. " f"Refusing resumption; re-derive from full context." ) ```