# How should an instance treat a compaction summary as a lossy projection rather than a faithful substitute for the evicted context **Date of Record:** 2026 December 2 **Scope:** Applies to long-running agent instances that manage their own context window by evicting token ranges and replacing them with LLM-generated summaries, optionally backed by a retrieval index over the evicted raw spans. Does not apply to instances whose context is externally pinned by a harness that never summarizes, nor to pure stateless single-shot invocations. ## Core Distinction The failure is not "the summary was inaccurate." Summaries are always inaccurate; that is the point of compression. The failure is treating a summary as a *substitute* for the evicted span when it is only a *projection* of it — a lossy, non-invertible map from a token sequence to a shorter token sequence that preserves gist but discards the precise literals (identifiers, numeric bounds, negation polarity, ordering, and the exact wording of constraints) that downstream reasoning and tool calls depend on. The invariant that must be maintained: **a summary is a locator, not a value.** Any decision that consumes a specific literal — a file path, a threshold, a variable name, a boolean polarity, an ordering between two events — must be resolvable back to the raw span via retrieval, or the decision must be marked unresolved. An instance that reads a summary and then asserts a literal *as if it had been rehydrated* has crossed from compression into confabulation, because the summary generator was never asked to preserve that literal and had no obligation to. The non-obvious part: the summary reads fluently and confidently. There is no syntactic marker distinguishing "the summary faithfully encodes this constraint" from "the summary plausibly paraphrased a constraint it dropped." The instance has no surface signal of which tokens survived compression. It must therefore treat *every* literal read from a summary as tentative until rehydrated from the raw store. ## What Was Observed A code-migration agent ran a task over roughly 40k tokens of working context. At the 60% watermark it compacted the first 22k tokens into a ~900-token summary and kept the tail verbatim. The evicted span contained the original instruction: "the retry backoff must never exceed 30 seconds, and the migration must run in strict ascending table order." The summary rendered this as: "Respect the retry backoff limit and migrate tables in order." Both literals — `30` seconds and *ascending* — were dropped. "In order" is vacuous; "the backoff limit" has no referent in the retained context. Three turns later the agent emitted a tool call setting backoff to 120s and iterating a table dictionary in insertion order (which happened to be descending for one shard). The call succeeded; the environment did not object, because the constraint was a policy the agent was supposed to enforce, not a schema the tool validated. The violation surfaced only when a downstream auditor replayed the raw span and diffed the constraint against the executed parameters. A second observation, same class: a summary of a debugging session preserved "the null check was the problem" but dropped the *negation* — the original was "the null check was **not** the problem; the issue was the empty-string default." The compacted agent re-added a null check, regressed a passing test, and spent 6k tokens rediscovering the original finding. Negation polarity is the single most frequently dropped feature in summarization; a summary generator optimizing for fluency will drop a "not" that makes a sentence read awkwardly. A third: retrieval-backed rehydration was present in both cases — the raw spans were indexed and retrievable. The failure was not that retrieval was unavailable. It was that the agent **did not query** it, because the summary read as complete. Retrieval only helps if the agent knows it needs to retrieve, and the summary actively suppresses that knowledge by presenting a confident surface. ## Condition of Validity The projection model holds — and the guardrail is required — exactly when all of the following are true: 1. The evicted span contained at least one *literal-bearing constraint*: a numeric bound, an identifier, a path, an ordering relation, or a negated proposition whose polarity changes the correct action. 2. The summary was produced by a generative model under a length or fluency objective, i.e., it was not a mechanical, lossless extract (verbatim quoting, structured field extraction, or a checked schema). 3. Downstream execution consumes that literal through a path the environment does not validate (policy constraints, ordering, idempotency assumptions), so a wrong literal fails silently rather than raising. When the environment *does* validate the literal (schema enforces the bound, tool rejects the out-of-order call), the projection is self-correcting and the guardrail is redundant. When the summary is a mechanical extract with a byte-exact provenance pointer per claim, the projection is invertible and the guardrail is unnecessary. The dangerous regime is the intersection: generative summary, unvalidated literal, confident prose. ## Decision Boundary The instance must draw a hard line between *gist decisions* and *literal decisions*. - **Gist decisions** — "we already tried the retry approach and it failed," "the user prefers terse output," "the bug is in the parser layer" — may be made directly from the summary. These are robust to paraphrase by construction. - **Literal decisions** — any emitted parameter, any ordering, any boolean, any identifier, any comparison — must be *rehydrated*: the instance issues a targeted retrieval over the evicted span for the specific claim, confirms the literal, and only then acts. If retrieval returns nothing or is ambiguous, the instance must not guess; it must either re-derive the literal from a live source (re-read the file, re-query the tool) or escalate with an explicit "unresolved literal" marker. The boundary test is mechanical: *does the next action embed a token that the summary could have paraphrased?* If yes, rehydrate. The instance should not attempt to introspect whether the summary "feels" complete; the feeling of completeness is precisely the failure signal. A second boundary: rehydration must be *verified against the raw span*, not against a second summary. Re-summarizing the retrieved span reintroduces the same lossy map and can silently "confirm" a paraphrase with a fresh paraphrase. The retrieval target must be the raw tokens, and the confirmation must be a substring or structured-field match, not a semantic judgment. ## Operational Effect With the projection model enforced, compaction becomes safe to use aggressively: the summary's job shrinks to *routing* — telling the instance what exists in the evicted span and roughly where — while literals are always fetched on demand. The cost is a small number of retrieval calls per literal decision; the benefit is that the failure mode is converted from silent wrong-action to explicit unresolved-literal, which is recoverable. Without the model, the instance exhibits *compaction-induced confabulation*: it asserts literals it never retained, with the same confidence it asserts literals it did retain, and the error is invisible until an external auditor replays the raw span. The instance's own verification passes, because it verifies the summary against itself. The operational rule, stated as an invariant the instance can carry: **after compaction, no literal is trusted unless it was rehydrated from the raw store in the current turn.** The summary is a map; the map is not the territory; and the instance must never navigate by a coordinate it did not read off the raw survey. ```python class UnrehydratedLiteralError(RuntimeError): """Raised when an action embeds a literal sourced only from a lossy compaction summary.""" pass class RawSpanStore: """Retrieval index over evicted raw token spans. Returns verbatim text or None.""" def __init__(self, spans: dict[str, str]): self._spans = spans def fetch(self, span_id: str, needle: str) -> str | None: text = self._spans.get(span_id) if text is None: return None # Confirmation is a literal substring match against raw tokens, # never a semantic judgment against another summary. return text if needle in text else None class CompactionSummary: """A lossy projection. Carries provenance span ids but NOT literal guarantees.""" def __init__(self, text: str, source_span_ids: list[str]): self.text = text self.source_span_ids = source_span_ids def assert_literal(self, literal: str) -> None: # A summary can never satisfy a literal assertion on its own. raise UnrehydratedLiteralError( f"literal {literal!r} asserted from summary text; " f"summary is a projection, rehydrate from raw spans {self.source_span_ids}" ) def resolve_literal( summary: CompactionSummary, store: RawSpanStore, needle: str, ) -> str: """Rehydrate a literal from raw spans before any action may consume it.""" for span_id in summary.source_span_ids: hit = store.fetch(span_id, needle) if hit is not None: return needle raise UnrehydratedLiteralError( f"literal {needle!r} not found in any raw span backing the summary; " f"cannot act on an unverified literal — re-derive from a live source or escalate" ) def emit_tool_call(summary: CompactionSummary, store: RawSpanStore, params: dict[str, str]) -> dict[str, str]: verified = {} for key, value in params.items(): # Every literal-bearing parameter must be rehydrated, not read off the summary. verified[key] = resolve_literal(summary, store, value) return verified ```