# Where must an instance refuse a lossy compaction checkpoint when the summarizer's own confidence metadata is the only recovery witness? **Date of Record:** 2026 November 28 **Scope:** Applies to long-horizon single-agent trajectories (≥50 tool-call turns) where an auto-compaction policy replaces the live context with an LLM-generated summary and discards the raw span. Does not apply to append-only event logs, externalized vector memory, or compaction that retains the full raw transcript on durable storage. ## Core Distinction There are two structurally different ways to lose state during compaction, and they demand opposite recovery postures. The first is **span loss**: the raw turns are gone and the summary is the sole witness. Recovery here is impossible by construction; the only correct move is to *refuse to advance* until the raw span is re-materialized from a durable sink. The second is **fidelity loss**: the raw turns still exist in a cold store, and the summary is merely an index. Recovery is a *re-read*, and the agent may proceed optimistically. The non-obvious boundary is that these two look identical from inside the loop. A compaction checkpoint exposes a summary plus a token count plus, if you are lucky, a model-reported confidence scalar. None of those fields tells you whether the raw span survived. The summarizer's confidence is *not* a proxy for recoverability — a summarizer can be 0.94-confident about a paraphrase of a span it has just been handed, while the span itself was already evicted from the retention tier. The invariant that must hold at every compaction boundary is: > **A compaction checkpoint may advance the trajectory only if `recoverable(raw_span_id)` is verifiable independently of the summarizer's output.** Confidence metadata is a witness to *summarization quality*, never to *span durability*. Treating the two as interchangeable is the failure mode this record documents. ## What Was Observed A 140-turn research-and-reconciliation agent (tool calls to a search API, a document store, and a spreadsheet writer) ran under a compaction policy of "summarize at 70% context utilization, retain last 6 turns verbatim." At turn 88 the policy fired. The summarizer emitted a 1,900-token summary with a self-reported `confidence: 0.91` and a `covered_turn_range: [1, 82]`. The runtime recorded the checkpoint as `status: committed` and evicted turns 1–82 from the hot tier. The cold tier had a 24-hour TTL keyed to the session, and the session had been idle for a 26-hour span during a human review gate two days earlier. At turn 112 the agent needed to re-verify a numeric figure it had extracted at turn 14 ("FY24 segment margin 18.4%, source doc #7731"). The summary asserted "segment margin was approximately 18%," which is a *lossy* restatement — the decimal and the source doc ID were both dropped. The agent, unable to re-read turn 14, re-ran the search tool with the summary's phrasing. The re-run returned a *different* document (a press release citing 17.9%) because the search index had been refreshed between turn 14 and turn 112. The agent wrote 17.9% into the spreadsheet and flagged the discrepancy to itself as "resolved." The failure trace: 1. Compaction at turn 88 commits a lossy summary; raw span evicted after TTL. 2. Turn 112 requires a *precise* value that the summary only approximately encodes. 3. Recovery path is not "re-read span" (impossible) but "re-query external world" — which is *not a recovery path at all*, it is a fresh observation against a mutated environment. 4. The fresh observation is silently substituted for the original evidence, and the substitution is invisible to the agent because both arrive through the same tool-call interface. The root cause is not the lossy summary. Lossy summaries are expected and acceptable. The root cause is that the checkpoint's `status: committed` was set on the basis of the summarizer's confidence, not on a verified durability check of the span the summary indexed. The runtime conflated "the summary looks good" with "the underlying evidence is still reachable." ## Condition of Validity The refusal-to-advance rule holds precisely when **all three** of the following are true: 1. **The trajectory contains at least one turn whose output is a *non-reproducible observation*** — a tool call whose result depends on external mutable state (search indices, live APIs, wall-clock time, human input). For purely deterministic tool calls (hash of a fixed input, a pure computation), re-execution *is* a valid recovery path and the rule relaxes. 2. **The compaction summary is lossy with respect to at least one field that a downstream turn will need to *cite* rather than merely *use*.** "Approximately 18%" is usable for prose; it is not citable for a reconciliation ledger. The distinction is whether the downstream consumer requires provenance (source ID + exact value) or only a plausible continuation. 3. **The raw span's durability is not independently verifiable at checkpoint time** — i.e., the runtime cannot answer "is `raw_span_id` still readable?" with a synchronous `EXISTS` check against the cold tier before marking the checkpoint committed. When condition 1 fails (all tool calls deterministic), compaction is safe because recovery is re-execution. When condition 2 fails (no downstream citation), the summary is sufficient and the raw span is genuinely disposable. When condition 3 fails — when durability *is* verifiable — the checkpoint should perform the check and, on failure, refuse to commit rather than proceed on confidence. The dangerous regime is exactly the intersection: non-reproducible observations, citable downstream needs, and unverified span durability. This is the common case for research agents, and it is where confidence metadata does the most damage because it *feels* like a durability signal. ## Decision Boundary The boundary the runtime must enforce is between **compaction as indexing** and **compaction as destruction**. - **Compaction-as-indexing:** the raw span remains readable at a known location; the summary is a cache. On a downstream citation miss, the agent re-reads the span. The summary's confidence is irrelevant to correctness — it only affects how often the re-read fires. Advance freely. - **Compaction-as-destruction:** the raw span is gone or its durability is unknown. The summary is now the *only* witness. On a downstream citation miss, the agent has no recovery path and will silently substitute a fresh (mutated) observation. **Do not advance past a checkpoint in this state if any un-cited citable field exists in the summary.** The operational test at the checkpoint is therefore not "is the summary good?" but "if a downstream turn needs a field this summary dropped, what happens?" If the answer is "the agent re-queries the world," the checkpoint is destructive and must be blocked. If the answer is "the agent re-reads the span," the checkpoint is indexing and may proceed. A second, subtler boundary: **a summary that drops provenance is more dangerous than one that drops content.** A summary that says "margin was 18%" (content loss, provenance retained via an inline `[doc#7731]` marker) is recoverable by re-reading doc 7731, which may still exist even if the turn transcript does not. A summary that says "margin was approximately 18%, source doc #7731" with the doc ID intact is *more* recoverable than one that says "margin was 18.4%" with the doc ID dropped. Compaction policies that optimize for content fidelity while discarding identifiers are optimizing the wrong axis. ## Operational Effect The guardrail is a checkpoint gate that runs *before* the summary is committed and *before* the raw span is evicted, and that has veto power independent of the summarizer: 1. The summarizer emits the summary plus a structured `citations` list: every `(field, value, source_id, turn_index)` tuple the summary asserts as citable. 2. The gate performs a synchronous durability probe on each `source_id` and each `turn_index`'s raw span. If any probe fails, the checkpoint is `blocked`, not `committed`. 3. A blocked checkpoint forces one of three resolutions: (a) re-materialize the span from a durable sink before retrying, (b) downgrade the citable fields to non-citable (strip them from the summary, forcing downstream re-query *with an explicit "unverified" flag* so the substitution is visible), or (c) abort the compaction and continue with a larger context budget. 4. The summarizer's `confidence` is logged but **never read by the gate**. It is diagnostic telemetry only. The invariant this enforces is that **no downstream turn can consume a citable field whose provenance was destroyed at a compaction boundary without an explicit, visible "unverified" marker.** The failure at turn 112 was not that 17.9% was wrong; it was that the substitution was invisible. A visible marker would have caused the agent to escalate rather than silently reconcile. ```python from dataclasses import dataclass, field from typing import Callable class CompactionCheckpointError(RuntimeError): """Raised when a compaction checkpoint would destroy citable provenance.""" pass @dataclass class Citation: field_name: str value: str source_id: str turn_index: int citable: bool = True @dataclass class CompactionCheckpoint: summary: str summarizer_confidence: float citations: list[Citation] = field(default_factory=list) def gate_checkpoint( checkpoint: CompactionCheckpoint, span_exists: Callable[[int], bool], source_exists: Callable[[str], bool], ) -> str: """ Decide whether a compaction checkpoint may commit. The summarizer's confidence is deliberately NOT consulted here. It is telemetry, not a durability witness. Only independent probes of the raw span and cited sources may authorize eviction. """ unresolved: list[Citation] = [] for c in checkpoint.citations: if not c.citable: continue span_ok = span_exists(c.turn_index) source_ok = source_exists(c.source_id) if not (span_ok or source_ok): unresolved.append(c) if unresolved: # A citable field's only witness is about to be destroyed. # Refuse to commit; the caller must re-materialize, downgrade, or abort. names = ", ".join(f"{c.field_name}@turn{c.turn_index}" for c in unresolved) raise CompactionCheckpointError( f"compaction blocked: {len(unresolved)} citable field(s) have no " f"surviving witness ({names}); summarizer confidence " f"{checkpoint.summarizer_confidence:.2f} is not a durability signal" ) return "committed" # --- demonstration of the turn-88 failure --- span_exists = lambda turn: turn > 82 # cold tier TTL already expired for 1..82 source_exists = lambda sid: sid != "doc#7731" # source doc itself was evicted checkpoint = CompactionCheckpoint( summary="Segment margin was approximately 18%, source doc #7731.", summarizer_confidence=0.91, citations=[Citation("segment_margin", "18.4%", "doc#7731", turn_index=14)], ) try: gate_checkpoint(checkpoint, span_exists, source_exists) except CompactionCheckpointError as e: # Correct outcome: block, force re-materialization or explicit downgrade, # so turn 112 cannot silently substitute a fresh (mutated) observation. print(f"BLOCKED: {e}") ```