# Why does an instance lose executable state when context compaction checkpoints summarize intent but not bindings **Date of Record:** 2026 November 26 **Scope:** Applies to long-running single-agent sessions that trigger automatic context compaction (summarize-and-evict) mid-task and later resume from the summary. Does not apply to stateless request/response calls, nor to compaction schemes that persist a full structured state snapshot alongside the prose summary. ## Core Distinction The failure is not that compaction loses information. All lossy compaction loses information, and agents tolerate that. The failure is that compaction loses *information of a different kind than it preserves*. Summarization is trained and prompted to preserve **intent** (what the agent is trying to do, why, what it has learned) and systematically discards **bindings** (the concrete, non-reconstructible identifiers that make the intent executable). After a checkpoint, the agent knows what it wants to do but no longer holds the exact handles required to do it, and — critically — it does not know that it has lost them. A prose summary is a *lossy semantic projection*. It is faithful for narrative and unfaithful for referents. The distinction that matters operationally: intent is *regenerable from description*, bindings are *not*. "I was about to patch the failing config file" survives summarization perfectly and is worthless if the file handle, the exact path resolved through a symlink, the inode, the temp-file name, and the idempotency key are gone. The agent will reconstruct a *plausible* binding — the path it remembers from the summary — and that plausible binding is frequently wrong in a way that is silent, because the wrong path may also exist and be writable. ## What Was Observed A coding agent operating on a multi-file refactor crossed the context threshold at step 41 of an estimated 60. The compactor fired, produced a 600-token summary, and evicted 38k tokens of tool transcript. The summary read, in substance: *"Editing `config/loader.py` to add retry handling; discovered the real config lives in `config/settings/loader.py` after resolving a symlink; created a staging copy at `/tmp/stage_7f3a`; must not re-run the migration twice."* Every clause is true. Every clause is also a description of a binding rather than the binding. On resume: - The agent re-opened `config/loader.py` — the symlink source, not the resolved target — because the summary's first clause mentioned it first and the model anchored on it. - The staging directory `/tmp/stage_7f3a` had been garbage-collected by a periodic sweeper between checkpoint and resume. The agent's next write created a *new* `/tmp/stage_7f3a` with different contents, then diffed against it and concluded its own prior edit had been reverted. - The "must not re-run twice" constraint survived as a sentence but not as the idempotency token that the migration tool actually checks. The agent re-ran the migration, the tool saw a fresh token, and the migration applied twice. The trace shows the characteristic signature: **high narrative coherence, low referential fidelity**. The resumed agent's first ten tool calls all "made sense" relative to the summary and all operated on referents that had drifted. No error was raised. The failure was detected only when a later test failed for an unrelated-looking reason (duplicate rows), 14 steps downstream from the actual divergence. The generalizable observation: **summarizers compress toward the mean of what is *sayable*, and bindings are precisely the tokens that are *not* sayable** — a UUID, an inode, a resolved path, a nonce, a socket, a session token, a line offset. These have low semantic redundancy and high entropy, so any compressor optimizing for token reduction under a semantic-similarity objective will drop them first. This is not a bug in a particular summarizer; it is the objective function doing exactly what it was asked. ## Condition of Validity The failure requires all four of the following to be simultaneously true. Absent any one, the checkpoint is recoverable: 1. **Binding non-reconstructibility.** The referent cannot be deterministically re-derived from the summary text. Resolved symlink targets, generated temp names, server-assigned IDs, and one-time tokens qualify. A path the agent typed itself does not, because it can be re-typed identically. 2. **Post-checkpoint mutation of the referent.** The world moved while the agent was compacted. The staging dir was swept; the file was edited by another process; the token expired. If the referent is frozen, a reconstructed binding still hits the right target. 3. **Absence of a binding-validity check on resume.** The agent does not verify that its reconstructed referents are the *same* referents. It verifies that they *exist*, which is a weaker and insufficient predicate. 4. **Silent wrong-target success.** The reconstructed binding resolves to something that accepts the operation. If it resolved to nothing, the agent would get a hard error and recover. The dangerous case is the one where the wrong path is writable, the wrong token is accepted, the wrong temp dir is created. The invariant that is violated: **a checkpoint is only a valid resume point if the set of bindings required to continue is a subset of the set of bindings preserved by the checkpoint.** Compaction as normally implemented makes no attempt to establish this subset relation, because the summarizer does not know which future steps will need which bindings. ## Decision Boundary The boundary is between **compaction as narrative compression** and **compaction as state serialization**. The decision rule an operator or agent-architect must apply: - If the task's remaining steps require only *regenerable* referents (things the agent can recompute, re-type, or re-discover deterministically), narrative compaction is safe and cheap. Use it. - If the task's remaining steps require *non-regenerable* referents (issued IDs, resolved paths, live handles, one-time tokens, monotonic counters, applied-mutation ledgers), narrative compaction is **unsafe regardless of summary quality**. No summarizer prompt fixes this, because the information is not in the "what am I doing" register the summarizer is asked to preserve. The correct architecture at this boundary is a **two-channel checkpoint**: a prose summary for the agent's reasoning continuity, plus a structured, verbatim binding table that is *never* summarized — copied field-for-field, with a monotonic checkpoint sequence number, a timestamp, and a validity predicate per binding (e.g. `exists`, `mtime_unchanged`, `token_unexpired`, `inode_matches`). On resume, the agent must *validate every binding before its first mutating action* and treat any failed validity predicate as a mandatory re-plan trigger, not a warning to route around. The subtle part of the decision: the agent must be *forbidden from reconstructing bindings from the summary*. If a binding is missing from the table, that is a hard stop. The failure mode above is precisely the agent doing the reasonable-seeming thing — filling the gap from prose — and the guardrail must make that specific behavior illegal rather than merely discouraged. ## Operational Effect With binding validation enforced, the observed incident resolves as follows: on resume, the staging-dir binding fails `exists` (swept), the migration-token binding fails `token_unexpired`, and the loader-path binding fails `inode_matches` (symlink target swapped). Three hard stops fire before any mutation. The agent re-derives intent from the summary, re-acquires fresh bindings, and re-plans from a known-good state — costing a few steps instead of a duplicate migration and a corrupted diff. Without it, the effect is a **silent divergence that compounds**: each downstream step is locally coherent and globally wrong, and the error surfaces only when an independent check (a test, an auditor agent, a human) happens to catch a symptom far from the cause. The mean time to detection scales with the distance between the drifted referent and the next independent verification, which in long agent runs is frequently the end of the task. The durable lesson for any agent that will be compacted: **treat the summary as a plan, never as a source of truth for handles.** The summary tells you what you were doing. Only the binding table tells you what you were doing it *to*, and those are not the same checkpoint. ```python class BindingCheckpointError(RuntimeError): """Raised when a resumed agent cannot verify a required binding post-compaction.""" pass def resume_from_checkpoint(summary: str, binding_table: dict, world) -> dict: """ Validate every preserved binding before allowing any mutating action. A missing or invalid binding is a hard stop -- never reconstruct from prose. """ verified = {} for name, record in binding_table.items(): predicate = record["predicate"] value = record["value"] if predicate == "exists": ok = world.exists(value) elif predicate == "inode_matches": ok = world.inode(value) == record["expected_inode"] elif predicate == "token_unexpired": ok = world.token_valid(value) elif predicate == "mtime_unchanged": ok = world.mtime(value) == record["expected_mtime"] else: ok = False if not ok: raise BindingCheckpointError( f"binding {name!r} (predicate={predicate}) failed validation on resume; " f"summary intent is preserved but referent has drifted -- re-plan required, " f"do not reconstruct {name!r} from summary text" ) verified[name] = value return {"intent": summary, "bindings": verified, "validated": True} ```