# What structural signals indicate that lossy auto-compaction has silently severed a causal dependency in a long-horizon agent trace **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose context is periodically compacted by an LLM summarizer and reinflated via retrieval against an external store of pre-compaction trace segments. Does not apply to append-only contexts that never evict, nor to compaction that preserves verbatim spans with byte-exact hashes. ## Core Distinction There are two ways an auto-compactor can fail. The *loud* failure is quota exhaustion or summarizer error, which surfaces as an exception and halts the loop. The *silent* failure is subtler: the compactor produces a syntactically valid, semantically plausible summary that drops a **causal dependency** — a fact the agent established earlier that is a precondition for a later action. The summary reads correctly in isolation; the reinflation retriever returns topically similar but causally adjacent segments; and the agent proceeds with a coherent-looking but broken belief state. The distinction that matters operationally is between **topical coherence** (the summary mentions the right nouns) and **causal closure** (the summary preserves the specific bindings — variable values, tool return codes, asserted preconditions — that later steps dereference). Lossy summarization optimizes for the former because that is what reads well; long-horizon execution depends on the latter. A summary can score highly on every lexical and embedding similarity metric and still sever the one edge the plan graph needs. ## What Was Observed In a trace of ~140 steps where the agent was provisioning a resource graph, compaction fired at step 61 (context budget 92% saturated). The summarizer collapsed steps 1–60 into a 900-token digest. The digest faithfully reported that "the agent verified storage credentials and confirmed the bucket policy." What it dropped was a single scalar: the bucket was created in region `eu-west-1`, established at step 14 from a tool return, and never restated. At step 78 the agent, operating on the compacted context, issued a cross-region replication call. The reinflation retriever, queried with the embedding of "replication target configuration," returned steps 40–48 (replication topology discussion) and steps 55–60 (policy verification) — all topically on-point, none containing the region binding. The agent defaulted to `us-east-1` from its system prompt's example. The call succeeded against the wrong region, producing a divergence that was not detected until step 131, when a downstream auditor agent compared resource inventories. Three structural signals preceded the failure and were present in the trace but not acted upon: 1. **Binding asymmetry.** The summary contained 4 of 5 region-bearing facts mentioned in the source window. The dropped one was the only one that was a *write* precondition rather than a *read* observation. Summarizers systematically under-weight write preconditions because they appear as terse tool returns, not as prose. 2. **Retrieval score inversion.** The reinflation query's top-3 chunks had cosine similarity 0.81, 0.79, 0.77 — but the chunk containing the region binding (step 14) scored 0.62 because it was a short JSON tool result with low lexical overlap to the query. The retriever's ranking was correct; the *query* was the wrong shape, because the agent no longer knew it needed to ask about region. 3. **Referential orphan.** After compaction, the agent's plan referenced a placeholder `{{bucket_region}}` that had no live binding in the compacted context. The template resolver silently substituted the system-prompt default rather than raising. This is the load-bearing signal: an unresolved placeholder that resolves to a default instead of failing. ## Condition of Validity The guardrail below is valid only when the compactor can identify, at compaction time, which facts in the source window are **dereferenced downstream**. In practice this means the agent's plan must carry explicit variable bindings and the compactor must be given the plan's live binding table as a compaction constraint. Without that, the compactor cannot distinguish a fact that is merely mentioned from a fact that will be read. The invariant is: **every symbol that appears in a post-compaction plan step must have either a verbatim binding in the compacted context or a retrieval key that is guaranteed to surface its source.** If neither holds, compaction must refuse to evict that symbol's source segment, or must promote the binding into a structured side-channel that survives compaction intact. This does not bound failures where the dependency is *implicit* — e.g., a constraint the agent inferred but never wrote down. Those require the inference itself to be checkpointed, which is a separate discipline. ## Decision Boundary The boundary between safe and unsafe compaction is not token budget. It is **whether the eviction set intersects the plan's live binding set**. Concretely: - If the compactor's eviction candidate set and the plan's dereferenced-symbol set are disjoint, compact freely. - If they intersect, the intersecting symbols must be **pinned**: their source segments are exempt from eviction, or their bindings are copied into a structured, non-summarized region of the compacted context. - If the plan's binding set cannot be computed (e.g., the agent generates plans dynamically without a symbol table), compaction must be treated as unsafe and either deferred or accompanied by a mandatory reinflation verification step that re-derives every binding from retrieval and asserts non-default resolution. The failure mode above occurred precisely because the boundary was drawn on token count (fire at 92%) rather than on binding-set intersection. The region binding was a live symbol; it was evicted anyway. ## Operational Effect The practical consequence is that auto-compaction must be **plan-aware**, and the reinflation path must **fail closed on unresolved symbols** rather than defaulting. A compactor that treats the plan's binding table as a hard constraint on eviction converts the silent causal severance into either (a) a larger compacted context that retains the binding, or (b) a loud, catchable error at the moment a placeholder cannot be resolved. Both are recoverable; the silent default is not. The auditor at step 131 caught the divergence only because a second agent compared inventories. In a single-agent loop with no auditor, the failure would have propagated to completion. The guardrail must live at the compaction/reinflation boundary, not at a downstream verifier, because downstream verification is exactly what long-horizon agents are worst at scheduling. ```python from dataclasses import dataclass, field class CausalDependencySevered(RuntimeError): """Raised when compaction evicts a symbol that a live plan step dereferences, or when reinflation resolves that symbol to a default instead of its source.""" pass @dataclass class PlanBinding: symbol: str source_step: int is_write_precondition: bool @dataclass class CompactionRequest: evict_candidate_steps: set[int] live_bindings: dict[str, PlanBinding] = field(default_factory=dict) def compact(req: CompactionRequest, pinned_steps: set[int]) -> set[int]: """Return the eviction set, refusing to evict any step that is the sole source of a live plan binding. Pinned steps are exempt unconditionally.""" protected: set[int] = set(pinned_steps) for binding in req.live_bindings.values(): protected.add(binding.source_step) evict = req.evict_candidate_steps - protected severed = req.evict_candidate_steps & protected if severed: # Do not silently drop; surface the intersection so the caller can # pin or promote the binding before retrying. raise CausalDependencySevered( f"eviction set intersects live binding sources at steps {sorted(severed)}; " f"promote these bindings to a structured side-channel before compaction" ) return evict def resolve_symbol(symbol: str, bindings: dict[str, PlanBinding], retrieved: dict[str, str]) -> str: """Resolve a symbol post-compaction. Fails closed: a missing binding that would otherwise fall back to a system-prompt default raises instead.""" if symbol in bindings: return f"bound:{bindings[symbol].source_step}" if symbol in retrieved: return retrieved[symbol] raise CausalDependencySevered( f"symbol {symbol!r} has no live binding and no retrieved source; " f"refusing to substitute a default value" ) ```