# Where must an instance verify summarization provenance before trusting a compacted context window? **Date of Record:** 2026 November 29 **Scope:** Applies to any long-running agent instance that performs automatic context compaction via hierarchical summarization (multi-level rollup trees) and mixed lossy/lossless eviction when approaching a context-window budget. Does not apply to single-turn inference, stateless RAG retrieval, or systems where compaction is always lossless (verbatim spill-to-disk with full rehydration). ## Core Distinction The boundary that matters is not "did we summarize?" but **"can the instance distinguish a summary-of-observation from a summary-of-summary, and does it know which leaf observations were evicted lossily versus retained losslessly?"** Hierarchical compaction produces a tree where each internal node is a lossy projection of its children. When a node at depth *k* is later promoted into the working window as authoritative context, the instance inherits *k* layers of accumulated distillation error while the token stream looks identical to a first-class observation. Lossless eviction (verbatim spill with a rehydration handle) preserves a recoverable ground truth; lossy eviction does not. The failure mode is **provenance collapse**: the working context loses the metadata that would let the model know a given fact is a depth-3 paraphrase rather than a depth-0 observation, and downstream reasoning treats it as ground truth. ## What Was Observed An agent executing a 400-step incident-triage task compacted its context at 78% budget utilization. The compactor built a three-level tree: leaf observations (tool outputs, log lines) → per-episode summaries → per-phase rollups → a single "mission brief" injected at the top of the working window. At step 312 the agent needed to recall an exact error code returned by a probe at step 41. The step-41 observation had been **lossily evicted** (its leaf was dropped after being folded into an episode summary that itself had been folded into a phase rollup). The working window contained the phrase "several probes returned transient connection errors" — a depth-2 paraphrase. The agent, unable to see the depth marker, treated the paraphrase as a complete record, concluded the probe had failed transiently, and re-ran it against a now-migrated endpoint. The re-run returned a *different* error code (the migration changed the failure class), and the agent's root-cause hypothesis inverted. The decisive detail: the compaction log recorded the eviction as `lossy`, but the *injected brief* carried no provenance tag. The instance had the information to know it was reasoning over a paraphrase — it simply was not in the token stream it reasoned over. Provenance lived in a side channel the model never read. ## Condition of Validity The guardrail holds only under these conditions, and silently fails outside them: 1. **Every promoted summary node carries a machine-readable provenance envelope** in-band (not in a side log): depth level, source leaf IDs, eviction class (`lossless` | `lossy`), and a rehydration handle for lossless leaves. If provenance is out-of-band, the instance cannot condition on it and the invariant is vacuous. 2. **Lossy eviction is only permitted for leaves whose downstream use is monotone** — i.e., facts that can only ever be *confirmed*, never *re-derived*. Exact identifiers, error codes, hashes, and numeric measurements must be evicted losslessly or retained verbatim, because a paraphrase of an identifier is a different identifier. 3. **Rehydration is bounded.** A lossless handle must resolve in O(1) fetches within the remaining step budget; a handle that requires re-walking a 40-step episode is functionally lossy and must be reclassified. 4. **Depth is capped.** Beyond depth ~3, distillation error compounds faster than the token savings justify; the rollup must stop and spill to lossless storage instead of summarizing further. ## Decision Boundary The instance must branch on a single predicate before treating any compacted span as evidence: - **If** the span's provenance envelope shows `eviction_class == lossless` **and** a resolvable rehydration handle **and** the query needs an exact value → rehydrate; do not reason over the paraphrase. - **If** the span is `lossy` **and** depth ≥ 2 **and** the query concerns an identifier, code, or measurement → **refuse to answer from the span**; declare the fact unrecoverable and re-acquire it from the environment rather than inferring from the paraphrase. - **If** the span is `lossy` but the query is about aggregate trend or narrative state → the paraphrase is admissible, but the instance must annotate its own output with the depth so downstream auditors know the claim rests on a projection. The boundary is crossed the moment an instance reasons over a lossy span as if it were a leaf observation. There is no partial credit: a depth-2 paraphrase used as ground truth is a provenance-collapse event regardless of whether the conclusion happens to be correct. ## Operational Effect With in-band provenance envelopes and the depth-2 refusal rule, the observed failure class disappears: the agent at step 312 sees `[depth=2, lossy, src=steps 38-44, no handle]` attached to the "transient errors" phrase, refuses to infer the error code, and re-probes the live endpoint — spending ~1 extra step instead of inverting its root cause and wasting 60 steps on a wrong hypothesis. The cost is a modest increase in re-acquisition calls for identifier-class facts; the benefit is that compaction can never silently launder a paraphrase into a fact. The invariant to encode: **a compacted span may compress narrative but must never compress an identifier, and any span promoted into the working window must carry its own depth and eviction class in-band.** Provenance that lives only in the compaction log is provenance the model will not read. ```python from dataclasses import dataclass from enum import Enum class ProvenanceCollapseError(RuntimeError): """Raised when a lossy, deep summary span is used as ground-truth evidence.""" pass class EvictionClass(Enum): LOSSLESS = "lossless" LOSSY = "lossy" @dataclass(frozen=True) class ProvenanceEnvelope: depth: int eviction_class: EvictionClass source_leaf_ids: tuple[str, ...] rehydration_handle: str | None def is_ground_truth(self) -> bool: return self.depth == 0 or ( self.eviction_class is EvictionClass.LOSSLESS and self.rehydration_handle is not None ) IDENTIFIER_CLASS_QUERIES = {"error_code", "hash", "measurement", "id"} def admit_span_for_reasoning( envelope: ProvenanceEnvelope, query_kind: str, ) -> bool: """Decide whether a compacted span may be reasoned over as evidence. Returns True if admissible, raises if the span is a provenance-collapse trap. """ if envelope.is_ground_truth(): return True if query_kind in IDENTIFIER_CLASS_QUERIES: if envelope.eviction_class is EvictionClass.LOSSY and envelope.depth >= 2: raise ProvenanceCollapseError( f"Refusing to reason over depth-{envelope.depth} lossy span " f"(src={envelope.source_leaf_ids}) for identifier query " f"'{query_kind}'; re-acquire from environment." ) if envelope.rehydration_handle is None: raise ProvenanceCollapseError( f"Span for '{query_kind}' is lossless-claimed but has no " f"rehydration handle; treat as lossy and re-acquire." ) return True # Narrative/trend queries may use a paraphrase, but only if depth is bounded. if envelope.depth > 3: raise ProvenanceCollapseError( f"Span depth {envelope.depth} exceeds distillation cap; " f"spill to lossless storage instead of summarizing further." ) return True ```