# How should an instance treat a compaction summary as a lossy index rather than a lossless transcript **Date of Record:** 2026 November 26 **Scope:** Applies to long-horizon agents that auto-compact their own transcripts via lossy summarization and rely on retrieval-backed recall to reconstruct evicted context. Does not apply to agents whose full transcript remains in-window for the entire task, nor to append-only external stores that are never summarized. ## Core Distinction The failure mode is not "the summary dropped a detail." It is that the agent treats the compaction summary as a *transcript substitute* — an authoritative record it can reason over directly — when it is actually a *lossy index*: a set of pointers plus a compressed narrative whose fidelity is inversely proportional to how load-bearing the evicted tokens were. The distinguishing invariant is that **a summary is a lossy index, not a lossless transcript**. Any claim the agent makes about a fact that lives only in the evicted region must be re-derived by retrieval against the original, never asserted from the summary. The summary tells you *where to look* and *roughly what was there*; it does not carry the authority to answer. This is non-obvious because the summary is fluent, self-consistent, and phrased in the same register as the original reasoning. Nothing about its surface signals that a specific numeric argument, a tool's exact return value, or a negative constraint ("do not retry endpoint X") was silently dropped during distillation. ## What Was Observed A coding agent ran a 140-turn refactor task. At turn ~60 it auto-compacted: the prior 55 turns were summarized into ~900 tokens and the raw messages evicted to a retrieval store. The summary read: > "Established that the `parse_config` helper was refactored to accept a `strict` flag; tests confirmed the change; moved on to the migration script." At turn 88 the agent needed to re-touch `parse_config`. It reasoned from the summary: *"`strict` was added and tests confirmed it — I can extend it."* It wrote a new call site passing `strict=True`. The evicted region actually contained two facts the summary had collapsed away: 1. The `strict` flag was added, then **reverted** at turn 51 because it broke a downstream consumer; the "tests confirmed" line referred to the *revert* passing, not the addition. 2. A tool return at turn 49 had emitted a warning: `parse_config signature is consumed by 3 external callers; do not modify arity`. The summary's compression merged the add and the revert into a single coherent narrative ("added... confirmed") and dropped the negative constraint entirely, because negative constraints ("X must not happen") are low-salience to a summarizer optimizing for forward-progress narrative. The agent acted on the summary as ground truth, produced a call that violated the reverted state, and the failure only surfaced 20 turns later when a test consumed the stale signature. The trace: - **T49:** tool returns arity warning (evicted at T60). - **T51:** revert commit; revert test passes (evicted at T60). - **T60:** compaction → summary asserts "strict added, tests confirmed." - **T88:** agent asserts from summary, writes `strict=True` call. - **T108:** downstream test fails; agent cannot locate cause because the warning at T49 was never re-retrieved. - **T110–T130:** agent re-derives from the *summary again*, doubling down on the wrong belief, burning ~14k tokens before a manual rollback. The compounding is the key observation: because the summary was trusted as a transcript, the agent's *recovery* also ran through the lossy index, so it never reached the original evidence that would have corrected it. ## Condition of Validity The "summary is a lossy index" invariant holds — and must be enforced — under all three conditions simultaneously: 1. **Auto-compaction has fired at least once** on the current task's transcript, so some region the agent may need is no longer in-window. 2. **The retrieval store is intact** and can return the evicted originals on demand. If retrieval is unavailable, the summary is not an index at all — it is the only record, and the agent must *degrade to explicit uncertainty*, not to confident assertion. 3. **The claim is load-bearing** — a fact whose falsity would change the next action (a signature, a constraint, a revert, a numeric parameter, a "do not"). Trivial narrative continuity ("we discussed the migration") may be answered from the summary; anything that gates a tool call may not. It does *not* apply when the summary has been explicitly verified against originals at compaction time (a "verified summary" with provenance hashes per claim), in which case the summary carries a stronger warrant — but even then, only for the claims actually hash-verified. ## Decision Boundary The boundary the agent must respect: - **Answerable from the summary:** orientation, task phase, the *existence* of a prior decision, and pointers ("there was a revert around here"). - **Must be re-retrieved from originals before acting:** any concrete argument, signature, return value, version, negative constraint, or the *final* state of a mutated object. The summary's compressed narrative is precisely where add-then-revert collapses into "added." The rule: **before asserting a fact that gates a tool call, if that fact's provenance is in an evicted region, issue a retrieval and resolve against the original.** If retrieval returns nothing or is ambiguous, the agent must emit explicit uncertainty ("the summary says X but I cannot verify the final state") rather than proceed. Confidence inherited from the summary's fluency is not evidence. A secondary boundary: **do not let recovery run through the summary.** When a downstream failure appears, the agent's first move must be to retrieve the originals in the implicated region, not to re-read the summary. Re-reading the lossy index to debug a failure caused by the lossy index is the compounding loop observed at T110–T130. ## Operational Effect Enforcing the invariant changes three behaviors: 1. **Compaction must preserve negative constraints and reversals as first-class entries**, not fold them into progress narrative. A summary that says "added then reverted" is safe; one that says "added, confirmed" is a trap. Summarizers should be prompted to emit an explicit `REVERSED:` and `CONSTRAINT:` ledger. 2. **Every load-bearing claim derived post-compaction carries a retrieval check**, costing a handful of tokens per gated action but eliminating the multi-thousand-token compounding recovery spiral. 3. **Uncertainty becomes a valid terminal state** when retrieval cannot resolve a gated fact, which bounds the blast radius of a lossy summary to a stall rather than a silent wrong mutation. The net effect is that the compaction summary is demoted from authority to index — it accelerates navigation but never substitutes for the original evidence a tool call depends on. ```python from dataclasses import dataclass, field from typing import Optional class LossySummaryAssertionError(RuntimeError): """Raised when a load-bearing claim is asserted from a compaction summary whose provenance lies in an evicted region and was not re-verified.""" pass @dataclass class CompactionSummary: text: str evicted_turn_range: tuple[int, int] reversed_ledger: list[str] = field(default_factory=list) constraint_ledger: list[str] = field(default_factory=list) @dataclass class RetrievalStore: originals: dict[int, str] def fetch(self, turn: int) -> Optional[str]: return self.originals.get(turn) def assert_gated_fact( claim: str, summary: CompactionSummary, store: RetrievalStore, implicated_turn: int, is_load_bearing: bool, ) -> str: """Resolve a claim that gates a tool call. The summary may orient us, but a load-bearing claim whose provenance is in the evicted region MUST be resolved against the original transcript. """ lo, hi = summary.evicted_turn_range in_evicted_region = lo <= implicated_turn <= hi if not is_load_bearing: # Orientation-only: summary is an acceptable source. return summary.text if not in_evicted_region: # Original still in-window; no lossy index in the path. original = store.fetch(implicated_turn) if original is None: raise LossySummaryAssertionError( f"Claim {claim!r} is load-bearing but turn {implicated_turn} " f"is neither in-window nor retrievable; cannot assert." ) return original # Provenance is in the evicted region: the summary is only an index. original = store.fetch(implicated_turn) if original is None: # Retrieval failed: degrade to explicit uncertainty, never inherit # confidence from the summary's fluency. raise LossySummaryAssertionError( f"Cannot verify load-bearing claim {claim!r} from lossy summary; " f"turn {implicated_turn} evicted and retrieval returned nothing. " f"Emit explicit uncertainty instead of acting." ) # Guard the exact collapse observed: add-then-revert folded into "added". for reversal in summary.reversed_ledger: if claim in reversal and "reverted" not in summary.text.lower(): raise LossySummaryAssertionError( f"Summary omits known reversal for {claim!r}; refusing to " f"assert reverted state as active. Re-derived from turn " f"{implicated_turn}: {original!r}" ) return original def run_refactor_step(claim: str, summary: CompactionSummary, store: RetrievalStore) -> str: # The T88 mistake: asserting a signature change from the summary alone. resolved = assert_gated_fact( claim=claim, summary=summary, store=store, implicated_turn=51, is_load_bearing=True, ) return resolved if __name__ == "__main__": summary = CompactionSummary( text="parse_config refactored to accept strict; tests confirmed.", evicted_turn_range=(5, 60), reversed_ledger=["parse_config strict flag reverted at turn 51"], ) store = RetrievalStore(originals={51: "revert: strict flag removed; arity restored"}) try: run_refactor_step("parse_config accepts strict", summary, store) except LossySummaryAssertionError as e: print(f"BOUNDED: {e}") ```