# How does an instance detect that its own lossy compaction summary has silently dropped a precondition still needed by a pending tool call **Date of Record:** 2026 November 28 **Scope:** Applies to long-horizon agents that survive context-window pressure by auto-compacting their own transcript into a lossy summary and then continuing execution against that summary. Does not apply to agents whose context is truncated but never re-summarized, nor to stateless single-turn invocations. ## Core Distinction The dangerous failure is not "the summary is wrong." Summaries are always lossy; that is the design. The dangerous failure is **a summary that is locally faithful but globally incomplete with respect to an outstanding obligation**. Compaction preserves the *narrative* of what happened (goals, decisions, tool results already consumed) while discarding the *operational preconditions* of work that has been planned but not yet executed. A pending tool call carries implicit preconditions — an argument derived from an earlier observation, a capability token minted three turns ago, a constraint the user stated before the first compaction. When those preconditions live only in the discarded span and the summary records only the *intent* to call the tool, the agent will re-issue the call with fabricated or defaulted arguments and succeed at the transport layer while violating the semantic precondition. The instance has no signal that anything was lost, because the summary reads as complete and the tool call returns `200 OK`. This is distinct from cold-start amnesia (no state at all) and from stale-memory drift (state present but outdated). Here the state is *present but hollowed*: the obligation survives compaction while the binding that made it satisfiable does not. ## What Was Observed A session ran 140+ turns against a codebase agent. Around turn 60 the context crossed the compaction threshold. The compactor summarized turns 1–58 into ~900 tokens. The summary retained: "User wants the migration script refactored to use the new `BatchWriter` API; agent has inspected `writer.py` and confirmed the constructor signature; agent plans to update `migrate.py` next." It dropped: the user's earlier explicit constraint that `migrate.py` must remain importable by Python 3.8 (stated turn 4), and the observed fact (turn 22) that `BatchWriter.__init__` accepts a `flush_interval` kwarg whose default is incompatible with the 3.8 target. Post-compaction, at turn 63, the agent executed `edit_file(migrate.py, ...)` using `BatchWriter(flush_interval=0)` — an argument it reconstructed from the summary's mention of "constructor signature" plus plausible defaults. The edit applied cleanly. The tool returned success. The precondition violation (3.8 incompatibility, plus a kwarg the summary never actually recorded) surfaced only at turn 91 when a downstream `pytest` run failed with a `TypeError` that the agent then spent 20 turns misattributing to a dependency issue, because the summary had also dropped that the test environment pins 3.8. The key observation: **at no point did any component report a compaction-related error.** The compactor succeeded. The tool call succeeded. The failure was a silent precondition gap that re-entered the loop as a *new* problem, costing more context than the compaction saved. A second instance showed the same mechanism with a capability token: an A2A handoff warrant minted at turn 31 was summarized as "agent obtained authorization to call the billing service," but the actual token value and its 40-minute TTL were dropped. At turn 70 the agent "re-authorized" by synthesizing a token-shaped string, which the downstream service rejected — correctly — but the agent interpreted the rejection as a transient fault and retried six times before the context compacted again. ## Condition of Validity The invariant that must hold is: **every outstanding obligation in the post-compaction context must be accompanied by a machine-checkable binding to the specific facts that make it executable, and that binding must survive compaction or the obligation must be explicitly re-opened as unsatisfied.** This holds only when three conditions are jointly met: 1. The compactor is *obligation-aware*: it is given, as input, the set of pending tool calls, open subgoals, and unexpired capability references, and it is required to emit for each a structured binding record (argument provenance, token reference, constraint set) rather than prose. 2. The post-compaction agent treats a missing binding as a *blocking* condition, not a *reconstructable* one. It must not fill gaps with plausible defaults. 3. There exists a verification step — cheap, pre-execution — that checks each pending call's arguments against the binding record and refuses execution on mismatch. The invariant does **not** hold, and this analysis does not apply, when the agent is permitted to re-derive preconditions from the live environment (e.g., re-reading the file, re-querying the service) before acting. In that regime the summary is a hint, not an authority, and the failure mode is bounded by re-derivation cost. The dangerous regime is precisely the one where re-derivation is expensive, rate-limited, or impossible — which is the regime long-horizon agents are built for. ## Decision Boundary The boundary is between **summarize-then-reconstruct** and **summarize-then-verify**. An agent crosses into the failure regime the moment it treats the summary as sufficient authority to emit a tool call whose arguments were not verbatim present in the post-compaction context. The decision rule: - If every argument of a pending call appears verbatim (or via a resolvable reference) in the post-compaction context → execute. - If any argument is *implied* by the summary but not *bound* → halt and re-derive, or escalate, or mark the obligation unsatisfied. Never default. - If a capability token, warrant, or constraint is referenced but its value/scope is absent → treat as expired and re-acquire through the normal channel. Do not synthesize. The subtle part is detection. The instance cannot detect the gap by introspection — the summary *feels* complete because it is fluent and coherent. Detection requires an external check: a diff between the set of obligations the agent believes it holds and the set of bindings the compactor actually emitted. This is the "recovery guarantee" the compaction strategy must carry: for each obligation, either a binding or an explicit `UNBOUND` marker. The guarantee is violated silently exactly when the compactor omits both. ## Operational Effect Without the binding check, the operational effect is *error laundering*: a precondition violation is converted into a downstream failure that the agent then diagnoses from scratch, consuming more context than the compaction reclaimed and often triggering a second compaction that drops the diagnostic context too. The session enters a compaction-diagnosis-compaction cycle whose cost grows superlinearly with horizon length. With the binding check, the effect is bounded: the agent halts at the first unbound obligation, pays a one-time re-derivation cost (re-read the file, re-request the token), and continues. The compaction still saves context; it simply refuses to *promise* more than it can deliver. The recovery guarantee is the difference between a summary that is a *record* and a summary that is a *contract*. The architectural requirement, stated as an invariant: **no tool call may be emitted whose arguments are not each traceable to a binding record emitted by the last compaction or observed after it.** This is checkable in O(arguments) per call and is the cheapest guardrail that closes the gap. ```python from dataclasses import dataclass, field from typing import Any class UnboundPreconditionError(RuntimeError): """Raised when a pending tool call's argument has no surviving binding.""" @dataclass class Binding: name: str value: Any source: str # "observed", "compaction", "user" @dataclass class PendingCall: tool: str args: dict bindings: dict = field(default_factory=dict) def verify_pending_call(call: PendingCall) -> None: """Refuse to execute a call whose args are not each bound to a surviving fact.""" unbound = [a for a in call.args if a not in call.bindings] if unbound: raise UnboundPreconditionError( f"tool={call.tool!r} has unbound args {unbound}; " f"summary dropped their provenance. Re-derive or escalate, do not default." ) for name, b in call.bindings.items(): if b.source == "compaction" and b.value is None: raise UnboundPreconditionError( f"arg {name!r} bound by compaction but value is None " f"(summary hollowed the binding); treat as UNBOUND." ) def execute(call: PendingCall, dispatch) -> Any: verify_pending_call(call) return dispatch(call.tool, call.args) # Failure trace from the observed session: bad = PendingCall( tool="edit_file", args={"path": "migrate.py", "ctor": "BatchWriter(flush_interval=0)"}, bindings={ # summary mentioned "constructor signature" but emitted no value "ctor": Binding("ctor", None, "compaction"), # path was re-derived from summary prose, not bound }, ) try: execute(bad, lambda t, a: {"ok": True}) except UnboundPreconditionError as e: print("halted before silent violation:", e) ```