# In what scenarios must an instance reject a lossy auto-compaction checkpoint when the audit trail cannot reconstruct a dropped tool-call obligation **Date of Record:** 2026 November 30 **Scope:** Applies to long-horizon agents that auto-compact their own transcript by replacing a span of turns with a lossy summary, then continue execution against that summary as authoritative state. Does not apply to append-only logs with external retrieval, or to compaction that preserves a verifiable structured ledger of outstanding obligations. ## Core Distinction The failure is not "the summary lost detail." Summaries are *supposed* to lose detail. The failure is that the compaction boundary silently converted a **pending obligation** (an unresolved tool call, an unverified claim, a deferred sub-task) into a **narrative fact** ("the agent checked X"). Once a pending obligation is summarized as a completed action, no downstream step will ever retry it, because the summary asserts it is done. This is a category error at the compaction seam: *state* (what remains to be done) is being compressed with the same lossy operator as *history* (what happened). The invariant that must hold across every compaction is: **the set of outstanding obligations after compaction must be a superset of the set before compaction, minus only those obligations whose completion is witnessed by a retained, replayable artifact.** A lossy summarizer that cannot cite the witnessing artifact for a claimed completion must not be allowed to drop the obligation. ## What Was Observed A 40-step agent task: "audit the repo, fix failing tests, open a PR." At step 22, context hit 78% saturation and the harness triggered auto-compaction, summarizing steps 1–20 into ~600 tokens. The summary read: *"Explored repository structure, ran the test suite, identified three failing tests in `tests/io/`, and applied fixes."* The trace showed something different. At step 14 the agent had issued `run_tests()` which **timed out** (tool returned `{"status":"timeout","partial":true}`). The agent's reasoning at step 15 said "I'll re-run after fixing the obvious one," then at step 16 it edited one file, and at steps 17–20 it got distracted by a lint warning. No re-run ever occurred. The summarizer, reading the transcript, saw "ran the test suite" and "applied fixes" and composed them into a coherent past. The timeout — a non-terminal, obligation-creating event — was smoothed into a completed step. Post-compaction, at step 23, the agent reasoned from the summary: tests were run, fixes applied. It proceeded to `git commit && open_pr`. The PR shipped with two of three failing tests still failing. The agent never re-ran the suite because the summary told it the suite had been run and the failures addressed. The non-obvious part: the summarizer was not wrong about *most* of the span. It was wrong about exactly one token — the `timeout` status — and that single miscompression propagated into an unrecoverable downstream action. The audit that would have caught it (was the suite actually re-run and green?) was itself inside the compacted span, so no post-compaction step could re-derive it. ## Condition of Validity Compaction with lossy summarization is valid **only if** every obligation-creating event in the compacted span is either: 1. **Witnessed-complete**: a retained artifact (tool result with terminal success status, a diff hash, a test report) proves the obligation closed, and that artifact ID survives in the summary; or 2. **Carried-forward**: the obligation is re-emitted verbatim into the post-compaction state as an explicit open item. The condition fails when the summarizer has discretion to *narrate* an obligation closed without citing a witnessing artifact. In practice this happens whenever the compacted span contains a non-terminal tool status (`timeout`, `partial`, `retry`, `rate_limited`, `pending`), an agent-expressed intention ("I'll re-run after…"), or a conditional ("if that passes, then…"). These are the three linguistic shapes that lossy summarizers systematically flatten into the past tense, because summarizers are trained to produce coherent narrative and pending/conditional states are incoherent in narrative. A second validity condition: the summary must be **auditable against the dropped span within the remaining context budget**. If the span being dropped is larger than what any post-compaction step could re-read, the summary is unfalsifiable and must be treated as unverified state, not fact. ## Decision Boundary The boundary is not "how much did we compress" but "did any obligation cross the seam without a witness." Concretely, at the moment of compaction the instance must classify each obligation-creating event: - Terminal success with artifact → may be summarized as fact, **must retain artifact reference**. - Terminal failure → must be carried forward as an open obligation (failures are never "resolved" by summary). - Non-terminal status (timeout/partial/pending) → must be carried forward as an open obligation, **never** summarized as an action performed. - Agent intention/conditional → must be carried forward as an explicit pending item or discarded with an explicit "abandoned" marker. If the summarizer cannot produce this classification — i.e., if it emits free prose without a structured obligation ledger — the compaction must be rejected or downgraded to a *checkpoint* (retain raw span, mark summary as advisory-only) rather than a *replacement* (drop raw span, treat summary as authoritative). The decision boundary is: **replacement requires a ledger; prose-only summaries may only checkpoint.** ## Operational Effect When this boundary is enforced, long-horizon agents stop silently dropping timed-out and conditional obligations at compaction seams. The observable effect is a rise in re-executed tool calls immediately after compaction (the carried-forward obligations get retried) and a corresponding drop in "phantom completions" — downstream actions predicated on work that was summarized as done but never was. The cost is a larger post-compaction state (obligations are verbose) and occasional redundant re-runs of work that actually completed but whose witness was dropped. That redundancy is the correct trade: a re-run is cheap and self-correcting; a phantom completion is unrecoverable because the evidence needed to detect it was itself compacted away. The guardrail is a hard invariant — no obligation leaves the compacted span without a witness or an explicit carry-forward — checked at the seam, not after. ```python class CompactionObligationLoss(RuntimeError): """Raised when a lossy compaction would drop or falsely close an obligation.""" pass NON_TERMINAL = {"timeout", "partial", "pending", "retry", "rate_limited"} def audit_compaction(span_events, summary_ledger): """ span_events: list of dicts with keys: kind: "tool_call" | "intention" | "conditional" status: terminal status string (for tool_call) artifact: witness id if terminal success, else None obligation_id: stable id summary_ledger: dict obligation_id -> "closed"|"carried"|"dropped" as emitted by the summarizer. Returns list of carried obligations; raises on any loss. """ carried = [] for ev in span_events: oid = ev["obligation_id"] disposition = summary_ledger.get(oid) if disposition is None: raise CompactionObligationLoss( f"obligation {oid} vanished from summary ledger entirely" ) if ev["kind"] == "tool_call" and ev["status"] in NON_TERMINAL: # Non-terminal tool results can NEVER be summarized as closed. if disposition == "closed": raise CompactionObligationLoss( f"obligation {oid} has non-terminal status " f"'{ev['status']}' but summary marked it closed" ) carried.append(oid) elif ev["kind"] in ("intention", "conditional"): if disposition == "closed": raise CompactionObligationLoss( f"obligation {oid} is an unfulfilled {ev['kind']} " f"but summary narrated it as completed" ) carried.append(oid) elif disposition == "closed" and not ev.get("artifact"): # Claimed complete with no witnessing artifact. raise CompactionObligationLoss( f"obligation {oid} marked closed without a witness artifact; " f"summary is unfalsifiable and must not replace the span" ) return carried ```