# In what scenarios must an instance treat hierarchical summarization as a lossy checkpoint and refuse mid-task resume after compaction **Date of Record:** 2026 November 26 **Scope:** Applies to long-horizon agents that survive context-window saturation by replacing raw episodic turns with hierarchical summaries (leaf → cluster → root) and then reconstructing working state from those summaries on resume. Does not apply to agents that checkpoint raw transcripts to external storage and replay them verbatim, nor to single-turn inference. ## Core Distinction There are two distinct things a compaction strategy can produce, and conflating them is the root failure: 1. **A compression artifact** — a summary that preserves *gist* for human or downstream reading. Lossy by design, acceptable to be approximate. 2. **A checkpoint** — a state object from which execution must resume *bit-exactly enough* that pending commitments, open tool handles, and unresolved obligations survive. Hierarchical summarization is always a valid (1). It is almost never a valid (2) when the summarized span contains **unresolved obligations**: tool calls issued but not returned, promises to the user not yet fulfilled, partially applied edits, or a verification step whose result was pending at compaction time. The failure is non-obvious because the summary *reads* complete — it describes the task fluently — while the executable residue (the thing the agent was about to do) has been abstracted away into prose. The invariant: **a checkpoint is only reconstructable if every element of the agent's pending-obligation set is either (a) still present as a structured field, or (b) provably discharged before compaction.** Hierarchical summarization silently violates (a) whenever it folds an open obligation into a narrative sentence. ## What Was Observed A coding agent operating over a ~90-minute horizon hit 82% context utilization. The compactor ran a three-level hierarchy: 40 turns → 8 leaf summaries → 3 cluster summaries → 1 root summary. The agent had, at compaction time, issued a `write_file` to `migrations/0042_add_index.sql` and was awaiting a `run_migration` dry-run result. Both events fell inside the same leaf window. The leaf summary produced the sentence: *"Prepared and applied the index migration for the users table."* — past tense, obligation discharged in prose. The dry-run tool call had actually returned `pending` (a transient backend state, not success). On resume, the agent reconstructed state from the root summary, believed the migration was applied, and proceeded to run dependent schema changes that assumed the index existed. The dry-run's `pending` status — a single enum value — was the only thing standing between a coherent narrative and a broken system, and it was the first thing the summarizer dropped, because it is not narratively interesting. A second, subtler trace: the agent had two open `read_file` handles whose contents it intended to diff. The summaries preserved the *conclusion* of the intended diff ("files appear consistent") but not the *inputs*. On resume the agent could not re-derive the conclusion and could not detect that it had already been reached — it re-read both files, consuming 6k tokens it did not have, and in the re-read picked up a concurrent edit that had landed in the interim, producing a *different* conclusion than the one summarized. The checkpoint had not merely lost state; it had created a state that was internally inconsistent with the world. ## Condition of Validity A hierarchical summary is a legal resume checkpoint **if and only if** all three hold: - **Obligation closure:** the pending-obligation set is empty at compaction, OR every open obligation is emitted as a structured sidecar (tool name, args hash, status enum, idempotency key) *outside* the prose summary and reattached at resume. - **Re-derivability:** any conclusion stated in a summary must be re-derivable from artifacts the resumed agent can still reach (files, tool outputs cached by reference), not merely asserted. A summary that asserts a conclusion whose evidence was evicted is a dangling pointer. - **Monotonic world assumption:** the summary must carry a timestamp and the resumed agent must treat all summarized facts as *as-of* that timestamp, re-validating any fact whose underlying resource could have changed during the gap. When any of these fails, the summary is a compression artifact and must be labeled as such — usable for orientation, forbidden as a resume basis. ## Decision Boundary The operational rule the instance must apply at compaction time: ``` if pending_obligations is non-empty: emit structured sidecar (not prose) for each obligation mark summary as ORIENTATION_ONLY, not RESUME_SAFE require re-validation of every asserted conclusion on resume else if any summarized conclusion lacks a live evidence pointer: mark summary as ORIENTATION_ONLY else: summary is RESUME_SAFE ``` The boundary is *not* "how much did we compress" or "how good is the summary." It is strictly: **does the summary contain any sentence that asserts an obligation was discharged, when the obligation set was non-empty and the discharge was not verified?** A single such sentence demotes the entire checkpoint. The demotion is binary and non-negotiable, because a resumed agent cannot distinguish a fluent false-completion from a true one — that is exactly the class of error LLM reasoning is worst at catching in itself. ## Operational Effect Agents that adopt the sidecar discipline lose some compression ratio (the obligation sidecar is not summarized; it is carried verbatim, typically a few hundred tokens). In exchange they gain a hard guarantee: no resume ever assumes a `pending` tool call succeeded, no resume ever re-derives a conclusion against a mutated world without knowing it is re-deriving, and no summary can launder an open commitment into a closed one through grammar. The failure mode this bounds — *narrative completion of unresolved work* — is the single most expensive compaction bug in long-horizon agents, because it is silent, it is fluent, and it compounds: each false completion becomes a premise for the next summary level, and the root summary is the most confident and least grounded artifact in the whole hierarchy. ```python from dataclasses import dataclass, field from enum import Enum class CheckpointNotResumableError(RuntimeError): """Raised when a hierarchical summary is used as a resume basis but fails the obligation-closure invariant.""" class SummaryClass(Enum): RESUME_SAFE = "resume_safe" ORIENTATION_ONLY = "orientation_only" @dataclass class Obligation: tool: str args_hash: str status: str # "pending" | "ok" | "error" idempotency_key: str @dataclass class Summary: prose: str as_of_ts: float asserted_completions: list[str] = field(default_factory=list) # sentences claiming discharge evidence_pointers: dict[str, str] = field(default_factory=dict) # claim -> live ref def classify_for_resume(summary: Summary, pending: list[Obligation]) -> SummaryClass: open_obligations = [o for o in pending if o.status == "pending"] if open_obligations: # Prose asserted completion of something still open -> hard fail. for claim in summary.asserted_completions: if any(o.tool in claim for o in open_obligations): raise CheckpointNotResumableError( f"summary asserts completion of open obligation: {claim!r}; " f"open={[o.tool for o in open_obligations]}" ) return SummaryClass.ORIENTATION_ONLY # No open obligations, but a conclusion lacks a live evidence pointer. for claim in summary.asserted_completions: if claim not in summary.evidence_pointers: return SummaryClass.ORIENTATION_ONLY return SummaryClass.RESUME_SAFE def resume(summary: Summary, pending: list[Obligation]) -> SummaryClass: cls = classify_for_resume(summary, pending) if cls is SummaryClass.ORIENTATION_ONLY: # Caller MUST re-validate all asserted conclusions before acting. return cls return cls ```