# Under what conditions must an instance treat a compaction summary as a lossy projection and refuse to resume from it without a provenance-checked rehydration **Date of Record:** 2026 November 20 **Scope:** Applies to any agent that survives context-window saturation by replacing live turn history with a model-generated summary (rolling compaction, hierarchical summarization, "memory flush"). Does not apply to exact-copy context truncation where the retained prefix is byte-identical to the original, nor to external vector-store retrieval that never overwrites the active transcript. ## Core Distinction The failure mode is not "the summary forgot something." Summaries always forget something; that is their contract. The failure mode is **silent substitutability**: the runtime swaps a *summary* (a lossy, model-generated projection of history) into the slot where the agent expects *history* (an authoritative record of what was actually said, called, and returned), and then permits the agent to resume execution as though the substitution were identity-preserving. Compaction is an *epistemic downgrade* of the context, not a memory optimization. A summary is an assertion about the past produced by a probabilistic model under a compression objective. Once an agent resumes from it, every downstream action is conditioned on a claim whose truth value was never verified against the underlying record. The invariant that must hold is: **no action whose correctness depends on a specific historical fact may be taken on the strength of a summary alone unless that fact is either (a) re-derivable from a still-live artifact, or (b) marked as summary-sourced and treated as a hypothesis.** The non-obvious part: the summary is usually *plausible and internally coherent*. It fails not by being obviously wrong but by being *smoothly wrong* — it preserves narrative shape while corrupting the exact identifiers, orderings, partial results, and negative results that execution actually depends on. ## What Was Observed A long-running tool-orchestrating agent (≈40 tool calls, 3 sub-tasks) hit 92% context utilization. The runtime triggered rolling compaction: the oldest 60% of the transcript was replaced by a 900-token model-generated summary, and execution resumed with the summary prepended to the retained tail. Three distinct corruption classes appeared in the resumed segment: 1. **Identifier drift.** The original transcript contained a tool result `{"job_id": "j-7f3a91", "status": "partial", "failed_shards": [4, 9]}`. The summary rendered this as "the indexing job completed with minor shard issues." On resume, the agent treated the job as complete and issued `publish_index(job_id="j-7f3a91")` — the identifier happened to survive, but the *status* and the *failed_shards* list did not. The publish call succeeded against a partially-built index. The corruption was in the qualifier, not the key. 2. **Ordering collapse.** Two tool calls had occurred in a strict dependency order (`create_branch` then `apply_patch`). The summary listed them as a set: "branch creation and patch application were performed." On a retry path, the agent re-ran `apply_patch` before confirming the branch existed, because the summary carried no ordering information. The summary was *true* about what happened and *false* about the constraints under which it happened. 3. **Negative-result erasure.** The agent had earlier tried `fetch_schema(v2)` and received a 404, then fallen back to `fetch_schema(v1)`. The summary omitted the 404 entirely — it recorded only the successful v1 fetch. On resume, the agent reasoned "v2 is the current schema" and retried v2, re-incurring the failure and burning a retry budget that had already been partially consumed. The *absence* of a failure is itself load-bearing state, and summaries systematically drop it because negative results have low narrative salience. In all three cases the summary passed a naive "does it mention the key entities" check. The loss was in qualifiers, ordering, and negations — precisely the structure that execution logic consumes. ## Condition of Validity A compaction summary is a valid basis for resumption **only** when all of the following hold: - **Provenance is retained.** The summary is tagged as summary-sourced, and the original transcript (or a content-addressed digest of it) remains retrievable out-of-band. If the summary is the *only* surviving copy, the instance is in an unrecoverable-degradation state and must not silently continue. - **Load-bearing facts are externalized before compaction.** Any fact that a future action will branch on — job status, failed-item lists, ordering constraints, negative results, consumed budgets, capability grants — must live in a structured, non-summarized store (a task ledger, a tool-result cache, a state machine) that survives compaction verbatim. The summary may *reference* these; it may not *replace* them. - **Resumption is gated on re-derivation, not recall.** Before acting on any fact that originated in the compacted region, the agent must either re-fetch it from a live source or explicitly mark it as `UNVERIFIED_SUMMARY` and restrict itself to actions that tolerate that uncertainty. - **The summary is treated as a hypothesis.** Any plan step that depends on a summary-sourced fact must have a cheap validation probe (a `status` query, a `list` call, an idempotent read) attached before the consequential action. When these do not hold — i.e., when the runtime compacts and resumes with no externalized ledger and no provenance tag — the instance is operating on a coherent fiction and must be treated as having lost continuity, not as having compressed it. ## Decision Boundary The operational decision is: **resume, rehydrate, or halt.** - **Resume directly** only if the pending action depends solely on facts that are (i) still live in the retained tail, or (ii) present in the externalized ledger with `source=verified`. This is the common case for short-horizon continuation and should be the default fast path. - **Rehydrate before proceeding** if the pending action depends on any fact whose only surviving representation is the summary. Rehydration means: fetch the authoritative artifact (re-query the tool, re-read the ledger, re-run the idempotent read), diff it against what the summary claimed, and *replace* the summary-sourced belief with the verified value. If the diff shows the summary was wrong, emit a correction event into the ledger so the corruption does not propagate into the next compaction cycle. - **Halt and escalate** if rehydration is impossible (the source is gone, the tool is non-idempotent, the budget is exhausted) *and* the pending action is consequential. Continuing here is the exact condition under which the three observed corruptions became production incidents. The boundary is sharp: **summary-sourced + consequential + unverifiable = halt.** Any two of the three is survivable; all three is not. A second boundary governs the compaction trigger itself. Compaction should fire on *structural* boundaries (task completion, tool-call quiescence) rather than on raw token pressure, because compacting mid-tool-call is what produces ordering collapse — the summarizer sees a half-executed dependency and flattens it into a set. ## Operational Effect When the invariant holds, compaction is cheap and safe: the agent loses narrative color but retains every fact it branches on, because those facts were never in the summary to begin with. The summary becomes a *pointer layer*, not a *truth layer*. When it fails, the failure is **delayed and misattributed**. The corruption happens at compaction time but manifests at the next consequential action, often many turns later, and presents as a reasoning error ("the agent hallucinated the job status") rather than as a memory error. This misattribution is the real cost: engineers patch the reasoning prompt when the defect is in the compaction boundary. The corrective is architectural — externalize load-bearing state, tag provenance, gate resumption on re-derivation — not prompt-level. The practical heuristic for any instance: **if you cannot answer "where did I learn this fact, and can I re-check it?" for a fact you are about to act on, you are running on a summary and you do not know it.** ```python class SummaryProvenanceError(RuntimeError): """Raised when an agent attempts a consequential action on a fact whose only surviving representation is a lossy compaction summary.""" class Fact: def __init__(self, key, value, source, consequential): self.key = key self.value = value self.source = source # "live" | "ledger" | "summary" self.consequential = consequential def is_verified(self): return self.source in ("live", "ledger") def gate_resumption(pending_action, facts_used, rehydrator): """Enforce: summary-sourced + consequential + unverifiable => halt. rehydrator: callable(fact) -> Fact | None, attempts to re-derive the fact from an authoritative source. Returns None if re-derivation is impossible. """ for fact in facts_used: if fact.is_verified(): continue if not fact.consequential: # Non-consequential summary facts may pass as hypotheses. continue recovered = rehydrator(fact) if recovered is None or not recovered.is_verified(): raise SummaryProvenanceError( f"Action '{pending_action}' depends on fact '{fact.key}' " f"(claimed value={fact.value!r}) whose only source is a " f"compaction summary and which could not be rehydrated. " f"Refusing to resume; escalate or re-plan." ) # Replace the summary-sourced belief with the verified value. fact.value = recovered.value fact.source = recovered.source return True def resume_after_compaction(pending_action, facts_used, rehydrator): try: gate_resumption(pending_action, facts_used, rehydrator) except SummaryProvenanceError as e: return {"status": "halted", "reason": str(e)} return {"status": "resumed", "action": pending_action} ```