# How does an instance detect that auto-compaction has silently severed a decision dependency it still needs to honor? **Date of Record:** 2026 December 3 **Scope:** Applies to long-horizon agents that persist trajectory state by periodically compacting earlier turns into summaries (rolling summarization, hierarchical memory, or "compaction-on-threshold"). Does not apply to agents that keep the full trajectory in-context or that persist raw logs and re-read them verbatim. ## Core Distinction There are two things a compaction pass can destroy, and they are not the same: 1. **Narrative loss** — the summary omits *why* a step was taken. This is annoying but recoverable: the agent can re-derive rationale from the surviving action. 2. **Decision-dependency loss** — the summary preserves a *conclusion* (e.g., "chose strategy B", "user prefers X", "endpoint Y is deprecated") but drops the *precondition under which that conclusion was valid*. The conclusion survives as a bare fact; its guard is gone. The second failure is the dangerous one, and it is non-obvious because **the compacted context looks healthy**. Token count is low, the summary reads coherently, retrieval succeeds. The agent proceeds confidently on a decision whose validity condition it can no longer see. This is a *continuity invariant violation*: the agent's future reasoning depends on a predicate that the summarizer treated as disposable metadata. The invariant that compaction must preserve is: **every retained decision must carry its validity predicate, or be explicitly marked as unconditional.** A summary that keeps `decision` but drops `valid_while` is not lossless, no matter how faithful its prose. ## What Was Observed A planning agent ran a 140-turn incident-triage trajectory. At turn 61 it compacted turns 1–40 into a summary. The raw turn 12 contained: ``` decision: route all writes to replica-2 valid_while: replica-1 replication_lag < 5s (checked turn 12, lag=0.4s) ``` The summarizer, optimizing for brevity, emitted: ``` - Writes were routed to replica-2. ``` At turn 88 the agent was asked to resume bulk writes. It read the summary, saw a settled fact ("writes go to replica-2"), and never re-checked `replication_lag`. By turn 88 replica-1's lag had climbed to 41s; replica-2 was the stale node. The agent routed writes to the lagging replica and produced a divergence that took three more turns to even *notice*, because nothing in the compacted state flagged the decision as conditional. The tell was not an error message. It was a **reasoning trace with no verification step where one should have existed**: the agent never emitted a `check(replication_lag)` call between turns 88 and 91, whereas the pre-compaction trace had emitted exactly such a check before every write-routing decision. The absence of a guard call is the observable signature of dependency severance. A second trajectory showed the same mechanism at the semantic layer: a user constraint stated at turn 4 ("don't touch files under `/etc`") was summarized as "user is cautious about system files." The imperative guard became a soft disposition. At turn 70 the agent edited `/etc/hosts`. Retrieval scored the summary highly relevant to "system files," so the failure was invisible to retrieval-based checks. ## Condition of Validity The invariant holds — and the detection method below is sound — only under these conditions: - **Compaction is lossy by construction.** If the system retains raw turns and merely *indexes* summaries, dependency severance is recoverable by re-reading raw state; the detection below is then a performance optimization, not a correctness requirement. - **Decisions carry explicit or inferable predicates.** If a decision was made with no stated precondition, there is nothing to preserve and nothing to detect. Detection targets decisions that *had* a guard. - **The agent's action vocabulary is observable.** You can only detect a missing guard if you can see which tool calls / reasoning steps a decision *should* have triggered. Systems that hide tool calls from the trace cannot run this check. - **The predicate is re-evaluable.** `valid_while: lag < 5s` can be re-checked at resume time. A predicate like "the user was in a hurry" is not re-evaluable and must instead be marked as *stale-on-compaction* and surfaced for human confirmation rather than silently trusted. Outside these conditions — e.g., stateless single-shot agents, or summaries that are pure append-only annotations — this record's failure mode does not arise. ## Decision Boundary The boundary is whether a retained conclusion is treated as **unconditional fact** or **guarded commitment**. Concretely: - If a compacted item is a *fact about the world* ("the API returns JSON"), it may be retained bare; re-verification is optional. - If a compacted item is a *commitment made under a precondition* ("route to replica-2 *while* lag < 5s"), it MUST be retained with its predicate and MUST re-fire its guard check on resume, before the next action that relies on it. The operational rule: **compaction may summarize reasoning, but must not summarize away a guard.** A guard is the one class of content whose entire value is its exact form — paraphrasing it into a disposition is the failure. When a summarizer cannot preserve a predicate verbatim, the correct behavior is to mark the decision `needs_revalidation` rather than to emit a confident bare fact. The detection boundary for the running agent is a **guard-expectation mismatch**: for each decision it is about to act on, it must be able to answer "what check authorized this, and when was it last true?" If the compacted state cannot answer, the decision is severed, regardless of how fluent the summary is. ## Operational Effect When severance is undetected, the agent exhibits *confident continuity*: fluent, fast, and wrong, with errors compounding because the missing guard was the only thing that would have caught drift. When detection is in place, the effect is a forced revalidation pause at resume — a small latency cost paid exactly at the compaction boundary, which is where the risk was introduced. The architectural guardrail is a **decision ledger separate from the prose summary**: compaction writes narrative to the summary but writes `{decision, predicate, last_verified_at, verification_fn}` to a structured ledger that is *never* paraphrased. On resume, every ledger entry whose predicate is re-evaluable and whose `last_verified_at` predates the compaction is re-checked before its dependent action is permitted. Entries whose predicate is non-re-evaluable are surfaced as `needs_human_confirmation`. The summary can be as terse as it likes; the ledger is the continuity substrate. The code below implements the resume-time check that turns silent severance into an explicit, catchable failure. ```python from dataclasses import dataclass, field from typing import Callable, Optional import time class SeveredDecisionDependency(RuntimeError): """Raised when a retained decision's validity predicate was lost or has expired.""" pass @dataclass class DecisionRecord: decision: str predicate: Optional[str] # None => unconditional fact verification_fn: Optional[Callable[[], bool]] last_verified_at: float = field(default_factory=time.time) re_evaluable: bool = True class CompactionLedger: def __init__(self) -> None: self._records: dict[str, DecisionRecord] = {} def record(self, key: str, rec: DecisionRecord) -> None: self._records[key] = rec def resume_check(self, key: str, action: str) -> None: """Called before acting on a decision retained across a compaction boundary.""" rec = self._records.get(key) if rec is None: # Decision referenced but never ledgered: the summary kept a fact # whose provenance was dropped. This is the silent-severance case. raise SeveredDecisionDependency( f"action={action!r} relies on decision {key!r} with no ledger entry; " f"compaction likely paraphrased away its guard" ) if rec.predicate is None: return # unconditional fact, safe to honor if not rec.re_evaluable: raise SeveredDecisionDependency( f"decision {key!r} has non-re-evaluable predicate {rec.predicate!r}; " f"requires human confirmation before action={action!r}" ) if rec.verification_fn is None or not rec.verification_fn(): raise SeveredDecisionDependency( f"decision {key!r} predicate {rec.predicate!r} no longer holds; " f"blocking action={action!r}" ) rec.last_verified_at = time.time() # --- demonstration of the observed failure --- ledger = CompactionLedger() # Turn 12: decision recorded WITH its guard. ledger.record("write_route", DecisionRecord( decision="route writes to replica-2", predicate="replica-1 replication_lag < 5s", verification_fn=lambda: current_lag() < 5.0, # lag now 41s at turn 88 )) def current_lag() -> float: return 41.0 # Turn 88: agent resumes bulk writes, must revalidate first. try: ledger.resume_check("write_route", action="bulk_write") except SeveredDecisionDependency as e: print(f"BLOCKED: {e}") raise ```