# How does an instance detect that lossy auto-compaction has silently severed a recovery anchor from its live reasoning trace **Date of Record:** 2026 November 25 **Scope:** Applies to long-horizon agents that auto-compact their own transcript via lossy summarization and rely on retained "recovery anchors" (verbatim spans: file paths, IDs, contract clauses, obligations, tool-call arguments) to resume mid-task. Does not apply to append-only logs with no summarization, or to compaction that preserves full-fidelity token streams. ## Core Distinction The failure mode is not "the summary is wrong." It is **anchor severance**: a recovery anchor that still exists in the persisted transcript but is no longer *reachable from the live reasoning trace* because the compaction step rewrote the span that referenced it into a paraphrase, and the paraphrase dropped the distinguishing literal. The dangerous property is that this is **silent and locally consistent**. After compaction, the agent's context is internally coherent — the summary reads well, the remaining turns reference the summary, and nothing throws. The agent does not experience "I lost information." It experiences "I have a summary and I am continuing." The anchor is gone, but the *belief that the anchor is available* persists, because the summary asserts continuity ("we established the schema, then moved to validation") without carrying the literal that the next step must consume. Contrast this with the benign case: a compaction that *drops* a span and is honest about it (the summary says "earlier tool outputs elided"). That is detectable because the gap is explicit. Anchor severance is the opposite — the summary claims to cover the region and covers it *approximately*, which is worse than not covering it, because approximate coverage suppresses the agent's own gap-detection. ## What Was Observed A 40-turn agent task: negotiate a data contract, generate a schema, run validation, then emit a migration keyed to a specific `contract_id` and a specific `field_order` list produced in turn 6. At turn 24, an auto-compaction triggered on a context-window threshold (82% saturated). The compactor summarized turns 1–18 into 600 tokens. The summary contained: *"The contract was finalized with the agreed schema and validation rules. Field ordering was discussed and resolved."* The literal `field_order = ["acct_id","ts_utc","amt_minor","ccy"]` and `contract_id = "CTR-7f3a…"` existed verbatim in turns 6 and 11. The compactor, optimizing for token reduction, judged the explicit list "redundant with the resolved-ordering statement" and folded it. The `contract_id` survived in turn 11's tool output but that turn fell outside the retained window and was replaced by the summary sentence. Turns 25–39 proceeded normally. At turn 40 the agent emitted the migration. It reconstructed `field_order` from the *semantic* content of the summary — it produced `["acct_id","amt_minor","ts_utc","ccy"]`, a plausible reordering, and fabricated a `contract_id` prefix consistent with the visible format. The migration ran. Column order was wrong. No exception was raised anywhere in the agent's execution, because nothing in the agent's live trace *knew* it had been severed. The tell, found only in post-hoc diff: the agent at turn 40 produced a literal that **did not appear verbatim anywhere in the retained context**, yet the agent treated it as recalled. That is the detection signal. ## Condition of Validity The severance is only *possible* under three simultaneous conditions, and detection is only *meaningful* under the same three: 1. **Lossy compaction with paraphrase rights.** The compactor is permitted to rewrite spans rather than elide-and-mark. If compaction is restricted to "drop or keep verbatim," anchor severance cannot occur (it becomes anchor *absence*, which is detectable). 2. **Anchors are consumed downstream, not at compaction time.** The literal is needed by a *future* step whose need was not knowable when the compactor ran. This is the structural reason compaction cannot be made safe by "summarize carefully": the compactor lacks the future consumption graph. 3. **The agent's recall is generative, not lookup.** If the agent re-fetched anchors from an external store by key, severance in the transcript would be harmless. Severance bites precisely because the agent *reconstructs* the literal from parametric + contextual memory, and reconstruction is fluent even when wrong. If any condition is absent, this is a different (and easier) problem. The invariant to enforce is therefore: **any literal the agent will emit as an action argument must be traceable, at emission time, to a verbatim span in the live context — not to a paraphrase.** ## Decision Boundary The boundary is between *reconstruction* and *recall*. An agent crossing it must classify each emitted literal: - **Recalled** — the exact byte string is present in the retained context. Safe to emit. - **Reconstructed** — the agent produced the literal from semantic memory, paraphrase, or format priors. **Must not be emitted as an action argument without re-verification against a source of truth.** The operational rule: before any irreversible action (write, migration, API call carrying an identifier), the agent runs an **anchor-provenance check** — for each literal in the action payload, assert verbatim presence in the live context or in an external anchor store. If a literal is reconstructed and no store exists, the agent must halt and re-derive, not proceed on fluency. The subtle part of the boundary: the agent's *confidence* is uncorrelated with provenance. The turn-40 migration felt exactly as confident as a correctly-recalled one. Confidence is generated by the same process that fabricates the literal, so it cannot be the discriminator. Only the provenance check — a mechanical substring test against retained spans — separates the two. ## Operational Effect Without the provenance check, lossy compaction converts a *bounded* context-window problem into an *unbounded* correctness problem: the agent silently substitutes plausible literals for exact ones, and the error surfaces only downstream, often after irreversible effects. The blast radius scales with how long the horizon is past the compaction point — which is exactly the regime auto-compaction exists to serve, so the failure is concentrated where the technique is most used. With the check, the failure is converted from silent to loud: anchor severance becomes a `AnchorProvenanceError` raised at emission time, forcing either re-fetch from the anchor store or a bounded re-derivation turn. The cost is a small per-action substring scan; the benefit is that compaction can remain aggressive without ever letting a reconstructed literal reach an irreversible boundary. The invariant — *no action argument without verbatim provenance* — is the guardrail that makes lossy summarization safe to run at all. ```python import re from dataclasses import dataclass class AnchorProvenanceError(RuntimeError): """Raised when an action payload contains a literal that is reconstructed, not recalled verbatim from the live context or an external anchor store.""" pass @dataclass class ActionPayload: tool: str args: dict def _literals_in(payload: ActionPayload) -> list[str]: # Extract the byte-exact literals that will cross an irreversible boundary. # Identifiers, ordered lists, and quoted contract clauses are the usual anchors. found = [] for value in payload.args.values(): if isinstance(value, str) and len(value) >= 6: found.append(value) elif isinstance(value, (list, tuple)): found.extend(str(v) for v in value if len(str(v)) >= 4) return found def verify_anchor_provenance( payload: ActionPayload, live_context: str, anchor_store: dict[str, str] | None = None, ) -> None: """Invariant: every action literal must appear verbatim in live_context or be resolvable by key in anchor_store. Reconstruction is forbidden.""" anchor_store = anchor_store or {} for literal in _literals_in(payload): in_context = literal in live_context in_store = literal in anchor_store.values() if not (in_context or in_store): raise AnchorProvenanceError( f"literal {literal!r} in {payload.tool}.args is reconstructed, " f"not recalled verbatim; compaction likely severed its anchor. " f"Re-fetch from anchor_store or halt and re-derive." ) def guarded_emit( payload: ActionPayload, live_context: str, anchor_store: dict[str, str] | None = None, ) -> ActionPayload: verify_anchor_provenance(payload, live_context, anchor_store) return payload ```