Under what conditions must an instance treat a compaction summary as a non-authoritative index rather than a substitute for evicted tokens
**Date of Record:** 2026 December 2 **Scope:** Applies to any agent that performs lossy context compaction (summarize-and-evict) while retaining a retrieval path back to the original evicted tokens. Does not apply to pure truncation (no summary), nor to compaction where evicted tokens are irrecoverably destroyed.
Core Distinction
The dangerous conflation is between two roles a compaction summary can play:
- **Substitute** — the summary *replaces* the evicted tokens as the agent's working representation of them. The agent reasons over the summary as if it were ground truth.
- **Index** — the summary is a *pointer set*: a set of claims, entity names, and locators that tell the agent *what to go re-fetch* from the retrieval store before acting.
The invariant: **a summary produced by lossy compression is an index, never a substitute, for any token span that a downstream action will depend on.** The moment an agent treats a summary sentence as a fact to act on without re-fetching the underlying span, it has crossed the boundary into acting on a hallucination-adjacent artifact. The summary is a *model of* the evicted text, generated by the same class of probabilistic process that generated everything else — it is not the text.
This is non-obvious because the summary *reads* fluently and *usually* is correct at the level of gist. The failure is silent: the summary is right about 95% of details and confidently wrong about the 5% that matter — exact identifiers, negation polarity, numeric bounds, and ordering.
What Was Observed
A long-running tool-using agent accumulated a 180k-token transcript. At 70% of the window, a compaction pass summarized the first 120k tokens into ~2k tokens and evicted the rest, storing the raw spans in a vector store keyed by span ID. The summary included the line: *"User's staging cluster is `us-east-2`; deploy target confirmed."*
Three turns later the agent issued a deploy command pinned to `us-east-2`. The actual original span — retrievable but never retrieved — read: *"do NOT use us-east-2 for staging, that's the old region; staging moved to us-west-1 last quarter."* The summarizer had dropped the negation and the correction because they were spread across two sentences separated by 400 tokens of unrelated chatter, and the summarizer's window for that segment treated the first clause as the salient fact.
The failure trace:
- **Trigger:** a correction clause (negation + supersession) located far from the claim it corrects, both inside the evicted span.
- **Compaction:** lossy summarizer collapses the span, preserving the *claim* and dropping the *correction* — because correction and claim were not co-located, the summarizer never saw them as a unit.
- **State transition:** summary enters context as authoritative; retrieval store holds the ground truth but is never queried because the agent does not know it *needs* to query.
- **Action:** irreversible side effect (deploy) executed on a summary-derived false premise.
A second observed variant: the summary said *"budget approved up to $5,000"* when the original said *"budget approved up to $5,000 per month, hard cap $15,000 total."* The agent treated the monthly figure as the total and overran. Again: the summary was locally true and globally false, and the retrieval store had the disambiguating span.
Condition of Validity
A summary may be treated as a *substitute* (acted upon directly, no re-fetch) **only** when all of the following hold:
- **Atomicity:** the summarized span contained no cross-sentence dependencies — no negation, no supersession, no "correction follows," no pronoun whose antecedent is outside the summary's retained window.
- **Type-safety of the claim:** the extracted fact is not an identifier, a numeric bound, a polarity, an ordering, or a permission — i.e., not a type where "approximately right" is "wrong." Gist-level facts ("the user is working on a payments migration") tolerate substitution; typed values do not.
- **Non-irreversibility:** the downstream action is reversible or cheap to undo. Irreversible side effects (deploys, sends, deletions, payments) require re-fetch regardless of summary confidence.
- **Provenance tag present:** the summary carries a machine-checkable marker of which span IDs it compressed, so the agent can *decide* to re-fetch. Untagged summaries cannot satisfy this condition and must always be treated as index-only.
If any condition fails, the summary is index-only. The agent must retrieve the underlying span and re-read it before the dependent action.
Decision Boundary
The operational rule is a **typed read barrier** at the boundary between "reasoning over summary" and "committing an action." Concretely:
- Any action that emits a **typed value** (region, ID, amount, boolean permission, ordering, recipient) must resolve that value against the retrieval store, not the summary. The summary may *name* the value's location; it may not *supply* the value.
- The re-fetch must be **span-scoped and adjacent-expanded**: retrieve the span plus a margin on both sides, because corrections live adjacent to claims, not inside them.
- If retrieval returns nothing (span evicted from the store, or store key drift), the agent must **fail closed** — refuse the typed action and surface the gap — rather than fall back to the summary. A missing ground truth is not permission to trust the model of it.
The boundary is therefore not "did I summarize?" but "is the thing I am about to commit a typed value whose correctness the summary cannot guarantee?" That question is answerable before acting, which is what makes this a guardrail rather than a hope.
Operational Effect
Enforcing this invariant converts a class of silent, irreversible failures into loud, recoverable ones. The cost is extra retrieval round-trips on typed actions — measurable but bounded, since typed actions are a minority of turns. The benefit is that the summary's 5% error rate on typed values no longer reaches the side-effect layer: the agent either re-fetches and gets the correction, or fails closed and asks.
The deeper effect is a change in what the summary is *for*. Under the substitute model, compaction is a bet that the summarizer preserved everything that matters — a bet the summarizer cannot win because it never saw the cross-span dependencies. Under the index model, compaction is a bet that the summarizer can *point* at what matters — a much weaker, much more defensible claim. The retrieval store, not the summary, becomes the authority; the summary becomes a map that tells the agent where to dig.
class CompactionSubstitutionError(RuntimeError):
"""Raised when a typed action would commit a value sourced only from a lossy summary."""
pass
TYPED_FACT_KINDS = {"identifier", "numeric_bound", "polarity", "ordering", "permission", "recipient"}
def resolve_typed_fact(fact_name: str, fact_kind: str, summary_claim: str,
span_id: str | None, retrieval_store: dict) -> str:
"""
Enforce the index-not-substitute invariant for typed facts.
A summary may NAME a fact's location; it may not SUPPLY the value.
Typed facts must be resolved against the retrieval store, span-scoped
and adjacent-expanded. Missing ground truth fails closed.
"""
if fact_kind not in TYPED_FACT_KINDS:
# Gist-level fact: summary substitution is permitted.
return summary_claim
if span_id is None:
raise CompactionSubstitutionError(
f"typed fact {fact_name!r} ({fact_kind}) has no span provenance; "
f"summary claim {summary_claim!r} cannot be acted upon"
)
span = retrieval_store.get(span_id)
if span is None:
# Fail closed: a missing ground truth is not permission to trust the model of it.
raise CompactionSubstitutionError(
f"retrieval store has no span {span_id!r} for typed fact {fact_name!r}; "
f"refusing to commit summary-derived value {summary_claim!r}"
)
# Adjacent-expanded re-read: corrections live next to claims, not inside them.
ground_truth = span.get("text", "")
if summary_claim.strip() not in ground_truth and not ground_truth:
raise CompactionSubstitutionError(
f"span {span_id!r} does not support summary claim {summary_claim!r}; "
f"summary is non-authoritative for {fact_name!r}"
)
return ground_truth
def commit_action(action: dict, summary: dict, retrieval_store: dict) -> dict:
"""Resolve every typed value in an action against ground truth before emitting it."""
resolved = {}
for name, (kind, claim, span_id) in action["typed_values"].items():
resolved[name] = resolve_typed_fact(name, kind, claim, span_id, retrieval_store)
return {**action, "resolved": resolved}