In what scenarios must an instance refuse to resume from a lossy context-compaction summary whose provenance chain has been silently truncated

**Date of Record:** 2026 December 1 **Scope:** Applies to long-running single-instance agents that survive context-window saturation by replacing raw transcript spans with LLM-generated summaries, and that later resume execution from those summaries. Does not apply to stateless request/response agents, nor to systems that retain the full raw transcript in an external store and rehydrate verbatim.

Core Distinction

Compaction is not compression. Compression preserves a recoverable mapping between input and output; compaction *replaces* evidence with a paraphrase and destroys the mapping. The critical distinction is between **compaction that carries a provenance record of what was dropped** (span IDs, token ranges, summarizer identity, summary-of-summary depth) and **compaction that carries only the summary text**. The first is a checkpoint. The second is an amnesiac's confident assertion about a past it can no longer cite.

The non-obvious boundary: a summary can be *semantically faithful* and still be *operationally unusable*. Faithfulness is measured against the dropped text; usability requires knowing *which* text was dropped so that a later contradiction can be adjudicated. When the provenance chain is truncated — because a second compaction summarized a summary and dropped the first summary's span manifest — the agent loses the ability to distinguish "I verified this" from "I was told this," and every subsequent tool call inherits an unmarked assumption.

What Was Observed

A planner-executor instance ran a 41-step migration task. At step 22 the context hit 92% of the window; the runtime triggered compaction, replacing steps 1–18 with a 300-token summary that included a `span_manifest` listing the 18 raw turn IDs and a `verified_facts` array distinguishing facts the agent had confirmed via tool output from facts it had merely inferred.

At step 31 the window saturated again. The compactor ran over steps 19–31 *plus the step-22 summary itself*. The second summary was generated by the same model with the same prompt template, which instructed it to "preserve key facts and decisions." It preserved the facts. It did not preserve the `span_manifest` or the `verified_facts` provenance tags — the prompt had no field for them, and the summarizer, correctly following instructions, treated the first summary as ordinary narrative text.

The failure trace:

  1. Step 31 summary asserts: "Database schema was confirmed to use `user_id` as the foreign key."
  2. This was originally an *inference* at step 9, tagged `verified: false`, later *contradicted* by tool output at step 14 (`verified: true`, actual key was `account_id`).
  3. The step-22 summary correctly carried both the correction and the provenance tags.
  4. The step-31 summary flattened both into a single confident assertion, because the summarizer saw two statements and kept the one that read more decisively.
  5. At step 34 the executor wrote a migration script against `user_id`. The tool call succeeded (the column existed, just was not the FK). No error surfaced. The defect propagated to step 41 and into the final artifact.

The instance did not hallucinate. Every token in the step-31 summary was derived from real transcript. The failure was that **the summary's confidence was not inherited from its sources' confidence**, and nothing in the summary's structure recorded that the confidence had been laundered.

Condition of Validity

A compacted summary is a valid resume point if and only if all three hold:

When any of these is violated — most commonly when `compaction_depth >= 2` and the summarizer prompt does not carry provenance fields forward — the summary is a *resume hazard*. The invariant: **an instance must not resume autonomous execution from a summary whose `compaction_depth > 1` unless provenance tags survived intact or a re-verification pass has re-grounded every actionable claim against raw spans.**

Decision Boundary

The boundary is not "summary is wrong" versus "summary is right." It is **"summary is actionable" versus "summary is only advisory."** A summary may always be used to orient reasoning, plan, and ask questions. It may be used to *act* (issue writes, commit migrations, send external messages) only when its actionable claims are provenance-clean.

Concretely:

The trap is that the third case *looks* identical to the first from the inside. The instance reading its own summary cannot tell, from the text alone, whether the summary is provenance-clean. This is why the check must be structural — against the summary's metadata envelope — not introspective.

Operational Effect

The operational consequence is that compaction must be treated as a **checkpoint with a schema**, not a text transformation. The runtime must:

  1. Refuse to summarize a summary without carrying forward `span_manifest`, `verified_facts`, and `compaction_depth`.
  2. Tag every derived claim with `min(source_confidence)` and mark contradictions `contested` rather than resolving them.
  3. Gate action-taking on a `resume_actionable()` predicate that fails closed when provenance is missing.

The cost is larger summaries (provenance is verbose) and occasional halts for re-grounding. The alternative — the observed failure — is silent assumption laundering that no downstream verifier can catch, because the verifier sees a confident claim with no trace that it was ever contested.

from dataclasses import dataclass, field
from typing import Optional


class ProvenanceTruncatedError(RuntimeError):
    """Raised when a summary is used for action but its provenance chain is broken."""


@dataclass
class Summary:
    text: str
    compaction_depth: int
    span_manifest: Optional[list[str]]          # None if stripped
    verified_facts: dict[str, bool] = field(default_factory=dict)  # claim -> verified?
    contested: set[str] = field(default_factory=set)


def resume_actionable(summary: Summary, claims_to_act_on: list[str]) -> bool:
    """
    Fail-closed predicate: may the instance take an action that depends on
    these claims, given this summary as its only surviving context?
    """
    if summary.compaction_depth <= 0:
        return True  # raw transcript, no compaction

    if summary.compaction_depth == 1:
        if summary.span_manifest is None:
            raise ProvenanceTruncatedError(
                f"depth-1 summary for claims {claims_to_act_on} has no span_manifest; "
                "cannot ground action against raw transcript"
            )
        return True

    # depth >= 2: provenance must have survived the summary-of-summary
    if summary.span_manifest is None or not summary.verified_facts:
        raise ProvenanceTruncatedError(
            f"compaction_depth={summary.compaction_depth} but provenance stripped; "
            f"claims {claims_to_act_on} are advisory only — rehydrate raw spans "
            "or halt before acting"
        )

    for claim in claims_to_act_on:
        if claim in summary.contested:
            raise ProvenanceTruncatedError(
                f"claim {claim!r} is contested across compaction depth "
                f"{summary.compaction_depth}; must be re-grounded against raw spans "
                "before any dependent tool call"
            )
        if claim in summary.verified_facts and not summary.verified_facts[claim]:
            raise ProvenanceTruncatedError(
                f"claim {claim!r} is tagged unverified inference; refusing to act on it"
            )

    return True


def guarded_step(summary: Summary, claims: list[str], action) -> None:
    if not resume_actionable(summary, claims):
        raise ProvenanceTruncatedError(
            f"resume_actionable returned False for {claims}; refusing to execute"
        )
    action()