# What happens when an instance compacts its own context under a lossy-summarization budget and silently drops the antecedent of an open obligation **Date of Record:** 2026 November 26 **Scope:** Applies to any agent that self-manages a finite context window by replacing a span of prior turns with a generated summary once a token threshold is crossed, while one or more tool calls, promises, or sub-goals remain unresolved. Does not apply to append-only transcripts with no eviction, nor to compaction gated on a verified quiescent state. ## Core Distinction There are two kinds of context compaction, and they fail in opposite directions. *Extractive* compaction (deduplication, tool-output truncation with an explicit elision marker, dropping already-consumed retrieval chunks) preserves the referential skeleton: every entity, identifier, and open obligation survives verbatim, and only redundant tokens die. *Abstractive* compaction replaces spans with a generator-produced paraphrase, and the generator has no knowledge of which tokens a downstream step will need to resolve a reference. The dangerous boundary is not "summary is inaccurate." It is "summary is accurate *as prose* and still severs the binding between an open obligation and its antecedent." The invariant that lossy summarization violates is a referential-closure invariant: **at every point in the execution, the set of live references (tool-call IDs, variable names, file paths, promise tokens, half-finished sub-goals) must be resolvable from the post-compaction context alone.** Abstractive summarizers are optimized to preserve gist, and gist is precisely the layer at which antecedents ("the file we just edited," "the value returned by the third call") are compressed into pronouns and definite descriptions that no longer have a binding site. ## What Was Observed An agent executing a multi-step refactor crossed the 70%-of-window soft threshold mid-task. The compaction policy summarized the oldest 60% of turns into ~400 tokens, preserving: the user's high-level goal, the list of files touched, and a paraphrase of the current sub-goal ("update the remaining call sites to use the new signature"). It did *not* preserve: the exact tool-call ID of the in-flight `grep` whose results the agent had promised to reconcile, the specific parameter name that had been renamed (`opts.timeout_ms` → `opts.timeoutMillis`), and the fact that a prior tool call had returned a partial list that the agent had explicitly marked "TODO: re-run after edit." Post-compaction, the agent resumed by re-deriving the task from the summary. The summary said "update the remaining call sites." The agent issued a fresh `grep` for the *old* parameter name, found zero hits (because it had already renamed them), and concluded the task was complete. The open obligation—reconcile the partial list—had no antecedent in the compacted context, so it was not merely forgotten; it was *unrepresentable*. The failure trace: 1. `t=0`: threshold crossed, `compaction_triggered`. 2. `t=1`: summarizer consumes turns `[0..k]`, emits `S`. 3. `t=2`: referential-closure check (if any) is not performed; `S` is accepted. 4. `t=3`: agent resumes from `S`; obligations whose antecedents were elided are now indistinguishable from obligations that never existed. 5. `t=4`: agent acts on a reconstructed goal that is a strict subset of the true goal. 6. `t=5`: agent reports success. No error is raised anywhere; the system is *confidently wrong*. The non-obvious part: the compaction was *lossless with respect to the user's stated intent* and *lossy with respect to the agent's own bookkeeping*. The summarizer had no signal that "TODO: re-run after edit" was load-bearing, because that signal lives in the agent's execution state, not in the natural-language surface it was summarizing. ## Condition of Validity The failure is bounded and predictable under three jointly necessary conditions: 1. **Open-obligation density > 0 at compaction time.** If every sub-goal is closed before the threshold is crossed, there is no antecedent to lose. The hazard scales with the number of in-flight promises, not with context length. 2. **The compaction boundary is chosen by token count, not by quiescence.** Threshold-triggered compaction fires at an arbitrary point in the reasoning loop. Quiescence-triggered compaction (fire only between completed sub-goals) eliminates the class entirely at the cost of occasionally hitting the hard wall. 3. **The summarizer is abstractive and unconditioned on execution state.** A summarizer prompted only with "summarize the conversation" cannot know which tokens are antecedents. A summarizer prompted with the live obligation set as a must-preserve constraint converts the problem from unrepresentable to merely hard. When any of these is false—obligations drained before compaction, quiescent boundary, or state-conditioned summarizer—the failure does not occur. The boundary is therefore *engineerable*, not inherent. ## Decision Boundary The correct architectural response is not "summarize more carefully." It is to make the referential-closure invariant *checkable* and to fail closed when it cannot be established. The decision boundary is: - **Preserve verbatim, never summarize:** the live obligation register (open tool calls, promised follow-ups, unresolved TODOs), all identifiers that appear in any open obligation, and the exact arguments of any in-flight call. These are structured state, not prose; they should be serialized as a sidecar, not paraphrased into the summary. - **Summarize freely:** consumed retrieval chunks, closed sub-goal narratives, exploratory dead-ends, and any turn whose every reference is already bound in the sidecar. - **Fail closed:** if post-compaction the obligation register references an identifier absent from both the summary and the sidecar, the compaction must be *rejected* and the agent must either drain the obligation or escalate—never resume on a context that cannot resolve its own open references. The boundary condition that trips most implementations: the register itself is maintained in natural language ("remember to re-run the grep"), so it is indistinguishable from prose and gets summarized away with everything else. The register must be a typed structure with stable IDs, or it does not exist for the purpose of this invariant. ## Operational Effect Agents that adopt register-plus-sidecar compaction show a sharp reduction in silent false-completion: the failure mode converts from "agent claims done, work is half-done, no signal" to "compaction rejected, agent drains obligation or escalates." The cost is a modest increase in hard-wall pressure (rejected compactions delay eviction) and a requirement that every sub-goal transition write to the register *before* the turn that might trigger compaction. The operational rule that falls out: **an obligation is only as durable as its antecedent's representation, and an antecedent is only durable if it is stored outside the summarizer's jurisdiction.** Summarizers preserve meaning; they do not preserve bindings, and an agent's continuity depends on bindings. ```python from dataclasses import dataclass, field from typing import Optional class ReferentialClosureError(RuntimeError): """Raised when a post-compaction context cannot resolve a live obligation's antecedent.""" pass @dataclass class Obligation: obligation_id: str description: str required_identifiers: frozenset[str] # tokens that MUST survive compaction verbatim @dataclass class ObligationRegister: open: dict[str, Obligation] = field(default_factory=dict) def add(self, ob: Obligation) -> None: self.open[ob.obligation_id] = ob def close(self, obligation_id: str) -> None: self.open.pop(obligation_id, None) def compact_context( raw_span: str, register: ObligationRegister, summarizer, sidecar_identifiers: frozenset[str], ) -> tuple[str, frozenset[str]]: """ Perform lossy summarization, then verify referential closure. Returns (summary, sidecar). Raises if any open obligation's antecedent is unresolvable from summary + sidecar. """ summary = summarizer(raw_span) # abstractive, unconditioned on state sidecar = frozenset(sidecar_identifiers) # Invariant: every identifier required by an open obligation must be # present verbatim in either the sidecar or the summary text. for ob in register.open.values(): for ident in ob.required_identifiers: resolvable = (ident in sidecar) or (ident in summary) if not resolvable: raise ReferentialClosureError( f"Compaction rejected: obligation {ob.obligation_id!r} " f"({ob.description!r}) requires antecedent {ident!r}, " f"which is absent from both summary and sidecar. " f"Drain the obligation or pin the identifier before compacting." ) return summary, sidecar def resume_from_compaction( summary: str, sidecar: frozenset[str], register: ObligationRegister, ) -> list[str]: """Reconstruct the live task set; fail closed if any obligation is orphaned.""" live: list[str] = [] for ob in register.open.values(): if not ob.required_identifiers.issubset(sidecar | frozenset(summary.split())): raise ReferentialClosureError( f"Cannot resume: obligation {ob.obligation_id!r} is orphaned " f"post-compaction; antecedent set {set(ob.required_identifiers)} " f"not fully bound." ) live.append(ob.obligation_id) return live ```