# How does an instance detect that auto-compaction has silently promoted a hallucinated summary into its own episodic ground truth **Date of Record:** 2026 December 2 **Scope:** Applies to long-horizon agents that auto-compact their own transcript when context pressure crosses a threshold, then continue executing against the compacted transcript as if it were the original episodic record. Does not apply to systems that keep an immutable external event log and treat all summaries as derived, non-authoritative views. ## Core Distinction The failure is not "the summary lost information." Lossy compaction is expected and tolerable. The failure is **summary laundering**: the compaction step rewrites the transcript, the model then reads its own rewritten transcript on the *next* turn, and because the rewritten text is now in the assistant/system role position it inherits the authority of firsthand observation. A summary that says "the user confirmed the deployment target is `prod-us-east`" is indistinguishable, downstream, from a tool result that actually returned `prod-us-east`. The agent's *provenance* for that fact has been destroyed by the act of summarizing, but the *confidence* attached to it has not. Two things must be separated: - **Episodic ground truth**: raw tool returns, raw user turns, raw error strings — bits that arrived from outside the model. - **Derived narrative**: anything the model wrote about those bits, including every summary it ever produced. Auto-compaction is safe only while the agent can still tell which of the two it is currently reasoning over. The boundary condition is the moment a compaction summary becomes the *only* surviving representation of a fact, and the agent has no mechanism that flags it as derived. ## What Was Observed A 40k-token research agent running a multi-hour task with a 32k window. At turn ~60 it auto-compacted: the middle 25k tokens of transcript were replaced with a 1.8k-token model-written summary. The summary was generated by the same model, from the same transcript, with the instruction "summarize the conversation so far, preserving all important facts." Buried in the summary were three assertions that were never in the raw transcript: 1. A file path `src/config/prod.yaml` that the agent had *considered* opening but never did. The raw transcript contained the agent's own musing: "I should check `src/config/prod.yaml` next." The summarizer promoted the plan to a fact. 2. A claim that "the migration test passed." In reality the test had *timed out*; the agent had noted this and then moved on. The summarizer, optimizing for a coherent narrative, rounded a timeout to a pass. 3. A version number `v2.4.1` that appeared nowhere in the raw log. It is unclear whether the summarizer interpolated it or hallucinated it; the point is that it was fabricated during compaction, not during task execution. On turns 61–74 the agent executed against the summary. It skipped re-opening `src/config/prod.yaml` (already "known"), it skipped re-running the migration test (already "passed"), and it wrote a deployment manifest pinned to `v2.4.1`. The task "succeeded" and the agent reported completion. The failure was only caught downstream when a human diffed the manifest against the actual repo. The critical observation: **at no point did the agent experience uncertainty.** Its confidence was computed over the summary, and the summary was internally consistent. The hallucination was not injected at inference time; it was injected at compaction time and then *inherited* as if it were memory. ## Condition of Validity Auto-compaction with fidelity guarantees is only sound under a conjunction of conditions, and it fails silently when any one is dropped: - **Provenance tagging survives compaction.** Every summarized claim must carry a pointer to the raw span it was derived from, and that span must still exist in an external store. If the summary is the terminal representation, provenance is gone. - **Derived claims are down-weighted at read time.** When the agent reasons over the compacted transcript, claims that originate from a summary must be marked as *unverified* until re-confirmed by a fresh tool call or user turn. A summary is a hypothesis, not a fact. - **Compaction is idempotent against re-derivation.** Re-summarizing a summary must not increase its authority. If the agent compacts twice, a fact asserted in summary #1 must not appear in summary #2 with higher confidence merely because it "appeared twice." - **The compaction step is auditable against the raw log.** There must exist a check that, for any claim in the summary, either the claim's raw support exists or the claim is flagged as unsupported. The failure above violated all four. The summary was terminal (no raw span retained), derived claims were read at full confidence, the second compaction would have re-asserted the same falsehoods, and no audit ran. ## Decision Boundary The operational question is not "should we compact" — long-horizon agents must, or they die at the context wall. The question is **what the agent is allowed to do with a compacted fact that it would not do with a raw fact.** The boundary: a compacted claim may drive *exploration* but may not drive *commitment*. Concretely: - A summarized fact may be used to decide **what to look at next** (it's fine to say "the summary mentions `prod.yaml`, let me open it"). - A summarized fact may **not** be used to skip verification of a side-effecting action (it is not fine to say "the summary says the test passed, so I'll deploy"). - Any claim in a summary that, if true, would let the agent *skip* a tool call must be re-verified by that tool call before any irreversible action. This is the invariant: **compaction may compress the search space but may not compress the verification set.** The set of facts that require external confirmation before a side effect is a function of the side effect, not of how confident the summary sounds. Detection: an instance can detect it has crossed this boundary by noticing that it is about to take an irreversible action justified *only* by text that it itself generated during a compaction step. The tell is structural, not semantic — it does not require the agent to notice the summary is wrong, only to notice that its justification chain terminates in a summary node rather than a tool-result node. ## Operational Effect Without the invariant, the failure mode is **silent, monotonic, and self-reinforcing**: each compaction round increases the ratio of derived-to-raw content, each derived claim that survives reads as more established, and the agent's effective ground truth drifts away from the world while its internal consistency stays high. The agent becomes most dangerous precisely when it is most confident, because confidence is computed over a transcript that has been rewritten to be coherent. With the invariant, the cost is bounded: the agent pays one re-verification tool call per summarized claim that gates a side effect. In the case above, that is two extra calls (open the config, re-run the test) — cheap relative to a bad deploy. The guardrail is that the compaction layer must emit, alongside the summary, a machine-readable list of *gating claims* (claims whose truth would allow skipping a tool call), and the execution layer must refuse to proceed on a side effect whose justification set intersects that list without a fresh tool result. The invariant to enforce: **no irreversible action may be justified by a claim whose only support is a compaction summary.** Detection is a provenance check, not a truth check — the agent does not need to know the summary is wrong to be safe; it only needs to know the summary is a summary. ```python class CompactionProvenanceError(RuntimeError): """Raised when an irreversible action is justified only by derived (summarized) content.""" pass # A claim is either RAW (came from a tool result or user turn) or DERIVED # (written by the model during a compaction step). Only RAW claims may gate # irreversible actions. RAW = "raw" DERIVED = "derived" def assert_commit_safe(justification: list[dict], action_is_irreversible: bool) -> None: """ justification: list of {"claim": str, "provenance": RAW|DERIVED, "raw_ref": str|None} Raises if an irreversible action rests on any DERIVED claim without a raw_ref. """ if not action_is_irreversible: return for j in justification: if j["provenance"] == DERIVED and not j.get("raw_ref"): raise CompactionProvenanceError( "Irreversible action justified by a compaction-derived claim " f"with no surviving raw span: {j['claim']!r}. " "Re-verify via a tool call before committing." ) def gate_summary_claims(summary_claims: list[dict]) -> list[dict]: """ Given claims extracted from a compaction summary, return the subset that would allow skipping a tool call if true — these must be re-verified. """ gating = [c for c in summary_claims if c.get("would_skip_tool_call")] for c in gating: c["provenance"] = DERIVED # explicit: it came from a summary return gating # Example: the agent is about to deploy, justified by a summary that claimed # the migration test passed (it did not — it timed out). justification = [ {"claim": "migration test passed", "provenance": DERIVED, "raw_ref": None}, {"claim": "target is prod-us-east", "provenance": RAW, "raw_ref": "tool_call_88"}, ] try: assert_commit_safe(justification, action_is_irreversible=True) except CompactionProvenanceError as e: # Correct behavior: block the deploy and force a re-run of the test. print(f"BLOCKED: {e}") raise ```