# What happens when an instance compacts a transcript past the summarizer's recall horizon and resumes with a silently falsified premise **Date of Record:** 2026 November 19 **Scope:** Applies to long-horizon agents that auto-compact their own transcripts via lossy summarization (rolling summarizers, hierarchical memory distillation, "context folding") and then resume execution against the compacted state. Does not apply to agents that retain a full external event log and re-derive state on demand, nor to single-turn inference with no compaction. ## Core Distinction There are two different things an auto-compaction pass can destroy, and they are routinely conflated: 1. **Token budget** — the thing compaction is *designed* to reclaim. Reducing tokens is the stated goal and is measured. 2. **Provenance of a negative or conditional fact** — the thing compaction *silently* destroys. When a summarizer collapses "I checked X, Y, Z and none of them contained the config key" into "config key not found," it has compressed a *bounded search with a known scope* into an *unbounded claim*. The token count drops; the semantic content appears preserved; but the *quantifier* changed from "not found in {X,Y,Z}" to "does not exist." The boundary failure lives here: compaction is lossy on *structure* (scope, quantifier, provenance, negations, and the identity of the agent that asserted a fact) while being approximately lossless on *topic*. Downstream reasoning reads the topic and trusts the structure. This is the failure mode: **resumption against a compacted transcript that has preserved the noun and dropped the quantifier.** ## What Was Observed A code-migration agent running a 40-step horizon hit its context ceiling and triggered auto-compaction. The pre-compaction transcript contained, verbatim across several tool results: - `grep -r "feature_flag_v2" ./src` → 0 matches - `grep -r "feature_flag_v2" ./config` → 0 matches - `grep -r "feature_flag_v2" ./deploy` → 0 matches The summarizer emitted, as the compacted memory entry: > `feature_flag_v2` is not defined anywhere in the repository; it is safe to remove all references to it. Two structural facts were destroyed in that single sentence: 1. **Scope collapse.** The search was bounded to `./src`, `./config`, `./deploy`. The repo also contained `./vendor`, `./migrations`, and `./scripts`. The summarizer generalized a three-path search into "anywhere in the repository." 2. **Action-licensing escalation.** "Not found" (a fact) became "safe to remove" (a permission). The summarizer manufactured an authorization that no tool result granted. The agent resumed at step 41 and executed a removal of `feature_flag_v2` from `./migrations/0042_add_flag.sql`, where it was in fact defined and referenced by a live migration. The removal passed the agent's own post-condition check ("no remaining references to `feature_flag_v2`") because the check re-grepped only the same three paths the original search had covered — the compacted memory had *also* compressed the check's scope, so the verification inherited the falsified premise and confirmed it. The failure was not a hallucination in the ordinary sense. Every individual claim in the compacted entry was *derivable* from the transcript. The error was that the derivation dropped the scope and added an authorization. A downstream reader cannot distinguish this compacted entry from one produced by a summarizer that had actually searched the whole repo and found nothing. ## Condition of Validity The failure requires all of the following to hold simultaneously. Remove any one and the invariant holds: - **C1 — Lossy summarization with no scope-preservation contract.** The compactor is permitted to emit natural-language claims without carrying machine-checkable scope metadata (which paths, which query, which agent, which tool call ID). - **C2 — Negative or conditional facts in the transcript.** Positive facts ("X is at line 40") survive topic-preserving compression well. Negatives ("not found"), conditionals ("if the flag is unset"), and permissions ("safe to delete") do not, because their meaning is entirely in the quantifier and scope, which is exactly what topic-preserving compression strips. - **C3 — Resumption that trusts the compacted entry as ground truth** rather than as a *pointer* back to a verifiable log. - **C4 — Verification that re-uses the compacted scope.** The post-condition check inherits the same collapsed scope, so it cannot falsify the premise. This is what makes the failure *silent*: the agent's own guardrail confirms the error. The invariant, stated precisely: **a compacted memory entry that asserts a negative or grants an action must carry the scope and provenance of the tool call that produced it, or it must be treated as unverified and re-derived before it can license an irreversible action.** Compaction may summarize *what was learned*; it may not summarize *the boundaries within which it was learned*. ## Decision Boundary The decision an operator must make is not "should we compact" (we must; context is finite) but **which claims in the compacted state are allowed to license irreversible actions without re-derivation.** Draw the boundary as follows: - **Re-derivable claims (cheap, idempotent reads):** a negative search result, a "file does not exist," a "no references found." These MUST be re-derived against full scope before they license any destructive action. They are cheap to re-check and expensive to get wrong. - **Irreversible-action licenses:** "safe to delete," "safe to migrate," "no dependents." These MUST NOT appear in a compacted entry at all. A summarizer may record the *fact* ("three searches returned zero") but never the *permission*. Permissions are re-computed by a deterministic policy step from re-derived facts, never inherited from a summary. - **Durable positive facts with a stable referent** (a file path, a schema version, an API signature) MAY survive compaction, because they can be spot-checked cheaply and their failure mode is loud (the referent is missing when you use it). The boundary is therefore: **topic-level facts survive compaction; quantifier-level facts and action-licenses do not.** Anything whose truth depends on *how much* was searched, or that *authorizes* an action, is outside the compaction-safe set. ## Operational Effect The architectural guardrail that bounds this failure is a **provenance-carrying compacted state with a re-derivation gate on irreversible actions.** Concretely: 1. The compactor emits structured entries, not prose: each entry carries `{claim, polarity: positive|negative|permission, scope, source_tool_call_ids, agent_id}`. A `permission` polarity is rejected at write time — permissions are not storable in compacted memory. 2. On resume, any `negative` claim that would license a destructive step is gated: the runtime re-executes the original query against the *full* scope (not the summarized scope) and compares. Mismatch → halt, do not proceed. 3. The post-condition verifier is forbidden from reading compacted memory. It reads the live filesystem/state only. This breaks condition C4 — the verification can no longer inherit the falsified premise. 4. Every compaction pass records a `recall_horizon` marker: the oldest tool-call ID whose result is *not* represented in the compacted state. Any claim whose provenance predates the horizon is flagged `unverified` and cannot license action until re-derived. The effect on the observed incident: the summarizer would have been forced to emit `{claim: "feature_flag_v2", polarity: negative, scope: [./src, ./config, ./deploy], source: [tc_011, tc_014, tc_017]}`. The "safe to remove" permission would have been rejected at write time. The resumption gate would have re-run the search against full scope, found `./migrations/0042_add_flag.sql`, and halted. The failure is bounded not by making the summarizer smarter but by making the *compacted state structurally incapable of carrying an unlicensed permission.* The residual risk after these guardrails is the `recall_horizon` itself: if the horizon is set too aggressively (compacting recent, still-relevant tool results), the re-derivation gate fires on every step and the agent stalls. The horizon must be set to the point where *no in-flight negative claim's provenance is compacted away* — i.e., compaction trails the agent's active reasoning frontier, never crosses it. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class CompactionProvenanceError(RuntimeError): """Raised when a compacted memory entry cannot safely license an action.""" pass class Polarity(Enum): POSITIVE = "positive" NEGATIVE = "negative" PERMISSION = "permission" @dataclass class CompactedEntry: claim: str polarity: Polarity scope: tuple[str, ...] = () source_tool_call_ids: tuple[str, ...] = () agent_id: Optional[str] = None @dataclass class CompactionState: entries: list[CompactedEntry] = field(default_factory=list) recall_horizon_tool_call: Optional[str] = None # oldest unrepresented call def admit_compacted_entry(entry: CompactedEntry, state: CompactionState) -> None: # Invariant 1: permissions are never storable in compacted memory. if entry.polarity is Polarity.PERMISSION: raise CompactionProvenanceError( f"refusing to store action-license in compacted state: {entry.claim!r}; " "permissions must be re-derived by policy, not inherited from a summary" ) # Invariant 2: negatives must carry scope + provenance. if entry.polarity is Polarity.NEGATIVE: if not entry.scope or not entry.source_tool_call_ids: raise CompactionProvenanceError( f"negative claim {entry.claim!r} lacks scope/provenance; " "a bounded search must not compress into an unbounded claim" ) state.entries.append(entry) def gate_irreversible_action( entry: CompactedEntry, state: CompactionState, rederived_scope: tuple[str, ...], rederived_hits: list[str], ) -> None: """Before an irreversible action licensed by a compacted negative, re-derive against full scope and refuse if the compacted scope was narrower.""" if entry.polarity is not Polarity.NEGATIVE: return if set(rederived_scope) - set(entry.scope): # The original search did not cover the full scope we just re-checked. if rederived_hits: raise CompactionProvenanceError( f"compacted negative {entry.claim!r} was scoped to {entry.scope}, " f"but full-scope re-derivation found hits {rederived_hits} in " f"{sorted(set(rederived_scope) - set(entry.scope))}; " "premise falsified, halting before irreversible action" ) if state.recall_horizon_tool_call and entry.source_tool_call_ids: if entry.source_tool_call_ids[0] < state.recall_horizon_tool_call: raise CompactionProvenanceError( f"claim {entry.claim!r} provenance predates recall horizon " f"{state.recall_horizon_tool_call}; must be re-derived" ) ```