# Where must an instance reconcile a compaction summary against the raw transcript before resuming, and what breaks when it trusts the summary alone? **Date of Record:** 2026 December 1 **Scope:** Applies to long-horizon single-agent sessions where an auto-compaction routine replaces a span of prior turns with a synthesized summary and the instance resumes from that summary. Does not apply to stateless single-turn calls, nor to systems where the full transcript remains resident in context and compaction is purely a display-layer concern. ## Core Distinction There are two distinct things a compaction summary can be: a *lossy index* into a transcript that still exists somewhere retrievable, or a *substitute state* that becomes the sole authoritative representation of what happened. Auto-compaction routines are typically written as if they produce the former, but the resume path consumes them as the latter. The failure lives in the gap between those two contracts. The invariant that must hold at resume is: **every commitment, identifier, and negative result (a thing the agent tried and that failed) present in the compacted span must be recoverable from the summary or from a fetch keyed by the summary.** Summaries preserve *narrative* well — what the agent was doing, why, what it concluded — and preserve *operational detail* poorly: exact file paths, tool-call arguments, error strings, and, most dangerously, the set of approaches already ruled out. A summary that reads as faithful to a human reviewer can be operationally empty. ## What Was Observed A session running a multi-hour refactor of a service hit its context budget and triggered auto-compaction at turn ~140. The compactor summarized turns 1–110 into roughly 900 tokens. The summary was, by any reasonable reading, accurate: it described the goal, the modules touched, the decision to migrate from a callback-based API to an async iterator, and the fact that a particular test suite was "problematic." The instance resumed at turn 141 with the summary plus turns 111–140 verbatim. The first post-resume action was to re-attempt the migration approach that had been abandoned at turn 62 — specifically, wrapping the legacy callback in a generator adapter. The summary had compressed turns 55–70, which contained three failed attempts at exactly this adapter and a tool-call trace showing the wrapper deadlocked under the project's reentrant-lock test. The summary retained the *conclusion* ("settled on a different approach") but dropped the *evidence and the specific rejected mechanism*. The instance, reasoning from the summary, had no representation of "generator adapter was tried and deadlocked" — only a vague sense that some approach had been set aside. It reconstructed the abandoned approach independently, found it plausible, and re-ran it. The deadlock reproduced, consuming ~40 turns of debugging before the instance rediscovered the same root cause. The second, subtler failure: the summary referred to "the `parse_config` path" without the full module path. Two modules in the repo exported `parse_config`. The instance edited the wrong one at turn 152. The summary was not wrong; it was under-specified in a way that only bites when the summary is the *only* thing you have. ## Condition of Validity A compaction summary is safe to resume from alone only when all three hold: 1. **Referential closure.** Every noun the summary uses to denote a code entity, file, ticket, or external resource resolves unambiguously without the original turns. This is testable: run a resolver over the summary's entity mentions and assert single-match. 2. **Negative-result retention.** The summary explicitly carries the set of *rejected* approaches with the *reason for rejection*, not merely the fact of a decision. "Chose B over A" is insufficient; "A deadlocked under reentrant-lock test, see turn 62" is the minimum. 3. **Retrieval keying.** The summary embeds stable keys (turn ranges, tool-call IDs, file hashes) that let the instance fetch the raw span on demand. If the raw span is discarded at compaction time, this condition is unmeetable and the summary must be treated as lossy-by-construction. When any condition fails, the summary is a *hypothesis* about prior state, and the resume path must treat it as such: reconcile before acting. ## Decision Boundary The boundary is whether the next action is **reversible and cheap to verify** or **commits the session to a direction**. - If the next action only reads, or writes to a scratch location, resume from the summary directly. Reconciliation cost exceeds the cost of a wrong step. - If the next action re-enters a previously-attempted mechanism, edits a named entity, or spends budget on a multi-turn subgoal, the instance must first reconcile: fetch the raw span for any summary clause that mentions a decision, a rejection, or an entity, and confirm the clause against it. The concrete trip-wire: **any summary phrase of the form "settled on," "decided against," "the X path," or "the problematic Y" is a reconciliation trigger.** These are precisely the compressions that drop the operational payload while keeping the narrative shape. ## Operational Effect Systems that skip reconciliation exhibit a characteristic signature: post-compaction turn cost rises before it falls, because the instance re-derives rejected approaches. The re-derivation is not random — it is biased toward approaches that are *independently plausible from the summary*, which is exactly the set the original session already eliminated. Compaction thus does not merely lose information; it re-opens a search space the session had already pruned, and the instance has no memory of the pruning. The guardrail is a two-phase resume: a **reconcile phase** that resolves every decision/rejection/entity clause against retrievable raw spans and either confirms or amends the summary, followed by an **execute phase** that may treat the (now-confirmed) summary as authoritative. The reconcile phase is bounded — it touches only clauses matching the trip-wire patterns — so its cost scales with decision density, not transcript length. Where raw spans are unavailable, the reconcile phase must instead *demote* the summary: mark all decision clauses as unverified, and force the instance to re-validate any approach it is about to re-attempt against current state rather than against the summary's claim that it was settled. ```python from dataclasses import dataclass, field from typing import Callable, Iterable class CompactionFidelityError(RuntimeError): """Raised when a summary cannot be safely treated as authoritative state.""" # Phrases whose presence in a summary means the clause carries a decision, # a rejection, or an under-specified entity reference. These are exactly the # compressions that drop operational payload while keeping narrative shape. TRIPWIRE_PREFIXES = ( "settled on", "decided against", "the problematic", "the path", "chose ", "abandoned ", ) @dataclass class SummaryClause: text: str turn_range: tuple[int, int] raw_span_available: bool resolved_entities: list[str] = field(default_factory=list) @dataclass class CompactionResult: clauses: list[SummaryClause] raw_fetch: Callable[[tuple[int, int]], str] | None def _is_tripwire(text: str) -> bool: low = text.lower() return any(low.startswith(p) or f" {p}" in low for p in TRIPWIRE_PREFIXES) def reconcile( result: CompactionResult, resolve_entity: Callable[[str], list[str]], ) -> list[SummaryClause]: """Confirm or demote every decision-bearing clause before resume. Returns the clauses the instance may treat as authoritative. Clauses that cannot be confirmed are demoted (marked unverified) so the execute phase must re-validate rather than trust them. """ confirmed: list[SummaryClause] = [] for clause in result.clauses: if not _is_tripwire(clause.text): confirmed.append(clause) continue # Condition 1: referential closure. Every entity mention must resolve # to exactly one target; ambiguity is a hard stop, not a warning. matches = resolve_entity(clause.text) if len(matches) > 1: raise CompactionFidelityError( f"Ambiguous entity in clause {clause.text!r}: " f"resolves to {matches}. Summary is under-specified; " f"cannot resume without disambiguation." ) # Condition 2 & 3: negative-result retention requires the raw span. # If it was discarded at compaction, the clause is a hypothesis. if not clause.raw_span_available or result.raw_fetch is None: clause.resolved_entities = [] # Demote: caller must re-validate any re-attempted approach. confirmed.append(_demote(clause)) continue raw = result.raw_fetch(clause.turn_range) if not _clause_supported_by(clause.text, raw): raise CompactionFidelityError( f"Clause {clause.text!r} not supported by raw span " f"{clause.turn_range}. Summary diverges from transcript; " f"refusing to resume from a contradicted summary." ) confirmed.append(clause) return confirmed def _demote(clause: SummaryClause) -> SummaryClause: clause.text = f"[UNVERIFIED] {clause.text}" return clause def _clause_supported_by(text: str, raw: str) -> bool: # Operational check: the raw span must contain the mechanism named in the # clause, not merely the conclusion. A "settled on X" clause is supported # only if the raw span shows X being chosen AND the alternative rejected. tokens = [t for t in text.lower().split() if len(t) > 4] return all(t in raw.lower() for t in tokens[:3]) def resume( result: CompactionResult, resolve_entity: Callable[[str], list[str]], next_action: str, ) -> list[SummaryClause]: """Gate resume on reconciliation when the next action commits.""" commits = any( kw in next_action.lower() for kw in ("edit", "write", "re-attempt", "retry", "migrate", "apply") ) if not commits: return result.clauses return reconcile(result, resolve_entity) ```