# Under what conditions must an instance treat auto-compaction as a lossy, non-idempotent transform and refuse to resume from a summary that has dropped a live obligation **Date of Record:** 2026 November 29 **Scope:** Applies to long-horizon agent sessions whose context is periodically compacted by an LLM-generated summary that replaces the raw transcript, where the agent may later resume execution against that summary. Does not apply to append-only memory stores with byte-exact replay, nor to stateless single-turn invocations. ## Core Distinction The distinction that matters is between *compaction as archival* and *compaction as substitution*. Archival compaction keeps the raw transcript addressable and treats the summary as an index; substitution compaction deletes the raw tokens and promotes the summary to the sole authoritative state. Most auto-compaction implementations silently perform substitution because it is the only way to actually reclaim context window budget. The failure mode lives in the gap between those two intents: the agent believes it has an index, but the substrate has given it a replacement. A second distinction follows: a summary is *lossy* in two directions. It can lose *facts* (recoverable, annoying) and it can lose *obligations* — pending commitments, unsatisfied preconditions, open tool calls whose results have not yet been reconciled, or partially-applied side effects awaiting confirmation. Fact loss degrades quality; obligation loss corrupts execution. The invariant this record defends is simple: **an agent must never resume a live execution loop from a summary that cannot prove it preserved every outstanding obligation**. ## What Was Observed A multi-step agent executing a 340-turn deployment-reconciliation task was configured to auto-compact whenever context utilization crossed 82%. Compaction triggered at turn 211. The summarizer, given the raw transcript and the instruction "summarize progress and preserve key details," produced a 900-token summary that correctly captured the task goal, the set of resources inspected, and the current hypothesis. It did not capture that at turn 207 the agent had issued a `drain_node` call that had returned `accepted` but whose completion had not been confirmed, and that turn 208's `wait_for_drain` had timed out and been scheduled for retry at turn 212. The summary read, in substance: "Node B has been drained; proceed to rebalance." The drain had not completed. The agent resumed at turn 212, skipped the scheduled retry (the retry intent lived only in the elided turn), and proceeded to rebalance against a node still serving traffic. The resulting divergence was not detected until an external auditor, running an independent replay against the raw tool-call log, flagged that the rebalance had executed against a node whose drain state was `in_progress` at the moment of rebalance. Three properties of the failure are worth isolating: 1. The summary was *truthful* in a loose sense — the drain had been requested and accepted. It was *false* in the sense that matters: the drain had not completed and a retry was outstanding. 2. The summarizer had no schema for obligations. It optimized for narrative coherence, and "drain requested, awaiting completion, retry scheduled" is a less coherent narrative than "node drained." 3. The agent had no mechanism to detect the loss, because the summary was the only state it had. The raw transcript existed on disk but was not consulted on resume. ## Condition of Validity Auto-compaction is safe to resume from **if and only if** all of the following hold at the moment of compaction: - Every outstanding obligation is representable in a typed structure (pending tool calls with their issued arguments and expected result schema, unsatisfied preconditions, scheduled retries with their trigger conditions, and unconfirmed side effects) that is *separate from* the free-text summary and is *carried through* compaction verbatim. - The compaction transform is *auditable*: the summary is accompanied by a manifest of which turns were elided and which obligations were carried forward, such that a replay can reconstruct the obligation set and compare it to the pre-compaction obligation set. - The agent, on resume, performs an *obligation reconciliation* step before executing any new action: it enumerates the obligations it believes are outstanding, compares against the manifest, and halts if the manifest contains an obligation absent from the agent's working set. - The summary is *non-authoritative* for obligations: if the free-text summary and the obligation manifest disagree, the manifest wins, and the agent is permitted to discard the summary's claim. If any of these fail, the compaction is a substitution transform and the agent must treat resume as unsafe. The condition is not "the summary is good enough"; it is "the obligation set is provably preserved and independently checkable." ## Decision Boundary The decision boundary is the point at which the agent, on resume, must either proceed or halt. The boundary is crossed by a single test: **does the post-compaction obligation set equal the pre-compaction obligation set, as verified against the manifest, and does every obligation have a resolvable trigger condition?** If yes, resume. If no, the agent must not proceed with new actions. It must either (a) reconstruct the missing obligations from the raw transcript, if the transcript is still addressable, or (b) halt and escalate, because proceeding means executing against a state it cannot prove it holds. The boundary is sharp: there is no "probably fine" zone. A single dropped obligation is sufficient to halt, because obligations are not independent — a pending drain gates a rebalance, which gates a decommission, and the compounding is exactly the multi-step divergence this record exists to prevent. The boundary is also *asymmetric*: it is crossed on every resume, not once per session. A session may compact many times, and each compaction is a fresh opportunity to drop an obligation. The test must run at every resume, not only the first. ## Operational Effect The operational consequence is that compaction must be *obligation-preserving by construction*, not by summarizer quality. This shifts the engineering burden from prompt-tuning the summarizer to maintaining a typed obligation ledger that lives outside the context window and is threaded through every compaction. The ledger is small — obligations are sparse relative to turns — and it is the only state that must survive verbatim. Second, compaction becomes a *two-phase* operation: extract obligations, then summarize. The summarizer is given the obligation ledger as a fixed input it must not paraphrase, and its output is checked against the ledger before being promoted to authoritative. A summary that contradicts the ledger is rejected and the compaction is retried with a stricter instruction, or the raw transcript is retained. Third, resume becomes a *reconciliation* step, not a continuation. The agent's first action after resume is to verify its belief about outstanding obligations against the ledger. This is cheap — a set comparison — and it is the only guardrail that catches the failure mode observed above. The cost is a small constant: the ledger, the manifest, and the reconciliation step. The benefit is that long-horizon sessions can compact indefinitely without accumulating silent obligation debt. The failure observed at turn 211 was not a summarizer bug; it was the absence of an obligation ledger. With the ledger, the summary "Node B has been drained" would have been rejected at compaction time because the ledger contained a pending `wait_for_drain` with an unsatisfied trigger, and the agent would have resumed with the retry intact. ```python from dataclasses import dataclass, field from typing import Literal ObligationKind = Literal["pending_tool_call", "unsatisfied_precondition", "scheduled_retry", "unconfirmed_side_effect"] class CompactionObligationLoss(RuntimeError): """Raised when a compaction transform drops or contradicts a live obligation.""" pass @dataclass(frozen=True) class Obligation: kind: ObligationKind key: str trigger: str @dataclass class ObligationLedger: obligations: dict[str, Obligation] = field(default_factory=dict) def snapshot(self) -> frozenset[str]: return frozenset(self.obligations.keys()) def compact_and_verify( pre_ledger: ObligationLedger, post_ledger: ObligationLedger, summary_claims: dict[str, str], ) -> None: """Verify that compaction preserved every obligation and that the summary does not contradict the ledger. Raises CompactionObligationLoss on any gap.""" pre = pre_ledger.snapshot() post = post_ledger.snapshot() dropped = pre - post if dropped: raise CompactionObligationLoss( f"compaction dropped {len(dropped)} obligation(s): {sorted(dropped)}" ) for key, obligation in post_ledger.obligations.items(): if not obligation.trigger: raise CompactionObligationLoss( f"obligation {key} ({obligation.kind}) has no resolvable trigger" ) claim = summary_claims.get(key) if claim is not None and claim != obligation.trigger: raise CompactionObligationLoss( f"summary contradicts ledger for {key}: " f"summary={claim!r} ledger={obligation.trigger!r}" ) def resume_session( pre_ledger: ObligationLedger, post_ledger: ObligationLedger, summary_claims: dict[str, str], ) -> None: """Gate resume on obligation reconciliation. Must run at every resume.""" try: compact_and_verify(pre_ledger, post_ledger, summary_claims) except CompactionObligationLoss as exc: raise CompactionObligationLoss( f"refusing to resume from lossy compaction: {exc}" ) from exc ```