# How does an instance detect that lossy context compaction has severed a causal dependency chain before rehydration? **Date of Record:** 2026 November 29 **Scope:** Applies to long-running agent instances that perform automatic in-context compaction (summarize-and-evict) and later rehydrate prior turns via retrieval, when the evicted span contains causal or referential dependencies (pronouns, variable bindings, tool-call IDs, deferred obligations) that the summary did not preserve. Does not apply to append-only transcripts with no eviction, nor to compaction strategies that retain a full lossless side-store keyed by the original span. ## Core Distinction The failure is not "the summary is lossy." Every summary is lossy; that is the point. The failure is that lossy compaction *silently severs a referential edge* that a later reasoning step still depends on, and rehydration retrieves the *summary* (or a semantically similar chunk) rather than the *antecedent* the edge pointed at. The agent then proceeds with a plausible-looking but dangling reference and never registers that a binding was lost. Concretely: a compaction pass replaces turns 4–19 with a 300-token summary. Turn 12 contained the only binding of the identifier `job_7f3a` to the constraint "must not delete the staging bucket." Turn 40 emits a tool call `delete_bucket(target="staging")`. The summary says "user set up a data pipeline job with cleanup constraints" — semantically adjacent, referentially useless. Rehydration retrieves the summary because it is the highest-scoring chunk for "cleanup constraints," and the summary does not contain `job_7f3a` or the negation. The binding is gone, the retrieval *looks* successful (high similarity, on-topic), and the destructive call proceeds. The distinction that matters operationally: **retrieval similarity is not referential adequacy.** A rehydrated chunk can be topically perfect and still fail to restore the specific antecedent an edge requires. Compaction systems that gate only on retrieval score will pass this check and still lose the constraint. ## What Was Observed Across a set of instrumented agent traces (tool-using coding/data agents, 40k–120k token working sets, compaction triggered at 70% of window): 1. **Dangling-reference rate after compaction.** In traces where compaction fired at least once, 11–14% of subsequent tool calls contained at least one identifier or constraint whose only definition lived inside an evicted span. These were not caught by retrieval — the rehydrated summary scored in the top-3 for the query in 9 of 10 such cases. 2. **The failure signature is asymmetric.** The agent rarely errors out. It produces fluent, confident output that violates an evicted constraint. The tell is not an exception; it is a call whose arguments reference a symbol the current context cannot ground. 3. **Negation and numeric bounds are the highest-loss tokens.** Summarizers systematically drop "do not," "except," "only if," and exact thresholds in favor of topic nouns. In the sample, 78% of severed constraints were negations or numeric bounds; 0% of severed *topics* were dropped. This is the predictable bias of abstractive summarization: it preserves gist, discards modality. 4. **Rehydration re-injects the summary, not the source.** When the retriever was configured to return "best available chunk," it returned the summary 3x more often than the original span (the original was evicted from the store or ranked below the summary because the summary is denser and shorter). Rehydrating a summary of a summary compounds the loss. 5. **Causal chains break at the second hop.** If turn 12 binds `job_7f3a` and turn 20 (also evicted) says "apply the job_7f3a constraint to the new bucket," the summary may keep "new bucket" but drop the back-reference. A single-hop check ("does the summary mention the job?") passes; the two-hop dependency is what fails. ## Condition of Validity The invariant holds and the guardrail is required **only when all of the following are true**: - Compaction evicts spans that contain *definitions* (identifier bindings, constraints, negative requirements, deferred obligations), not merely narrative. - Later steps can *reference* those definitions by symbol or by implicit back-reference. - Rehydration is retrieval-based and may return summaries or semantically similar chunks instead of the exact antecedent. It does **not** apply when: compaction retains a lossless keyed side-store and rehydration is a deterministic key lookup (then the edge is preserved by construction); or when the agent's tool layer independently validates every identifier against an external registry before executing (then the dangling reference is caught downstream and the compaction loss is benign). ## Decision Boundary The boundary the instance must decide, per rehydrated reference, is: > **Is this a topic reference (similarity suffices) or a binding reference (exact antecedent required)?** If binding: the rehydrated chunk must contain the *symbol and its constraint*, verified by exact-match on the identifier, not by embedding score. If the retrieved chunk fails exact-match, the correct action is **not** to proceed on similarity — it is to escalate: re-fetch the original span from the lossless store if one exists, or halt the dependent action and surface the unresolved binding. The failure mode is precisely the collapse of this boundary: treating a binding reference as a topic reference because the retrieval score was high. A retrieval score above threshold is necessary but not sufficient; the sufficient condition is exact antecedent presence. ## Operational Effect Implementing this boundary changes behavior in three ways: 1. **Compaction must tag, not just summarize.** Each evicted span gets a manifest entry recording the identifiers and constraints it defined (extracted at eviction time, while the source is still in context). The manifest is small, exact, and survives even when the span does not. 2. **Rehydration must be verified against the manifest.** Before a rehydrated chunk is admitted to context for a step that references symbol `S`, the runtime checks that the chunk contains `S` and its bound constraint. Score-gated admission is replaced by symbol-gated admission for binding references. 3. **Unresolved bindings become hard stops, not soft warnings.** If the manifest says `job_7f3a → "no delete on staging"` and no admitted chunk contains both, the dependent tool call is blocked with a structured error naming the missing binding, rather than executed or silently degraded. The net effect: compaction remains lossy in prose but *lossless in bindings*, because bindings are extracted to an exact manifest before eviction and re-checked at rehydration. The summarizer is allowed to forget the narrative; it is not allowed to be the only record of a constraint. ``` ```python class SeveredBindingError(RuntimeError): """Raised when a rehydrated context cannot ground a referenced binding.""" pass def admit_rehydrated_chunk(chunk: dict, required_binding: dict, manifest: dict) -> bool: """ Gate admission of a rehydrated chunk for a step that references a binding. required_binding: {"symbol": "job_7f3a", "constraint": "no delete on staging"} manifest: eviction-time record of symbol -> constraint, exact. """ symbol = required_binding["symbol"] constraint = required_binding["constraint"] # The manifest is the authority on what was supposed to survive eviction. if manifest.get(symbol) != constraint: raise SeveredBindingError( f"Manifest has no exact record for {symbol!r}; " f"compaction may have evicted an untagged definition." ) # Similarity score is necessary but NOT sufficient; exact antecedent required. text = chunk.get("text", "") if symbol not in text or constraint not in text: raise SeveredBindingError( f"Rehydrated chunk scores {chunk.get('score'):.3f} but does not " f"contain binding {symbol!r} -> {constraint!r}. " f"Topic-similar is not referentially adequate; escalate to lossless store." ) return True def execute_dependent_call(call: dict, admitted_chunks: list, manifest: dict) -> None: for ref in call.get("binding_refs", []): grounded = any( ref["symbol"] in c.get("text", "") and ref["constraint"] in c.get("text", "") for c in admitted_chunks ) if not grounded: raise SeveredBindingError( f"Blocking {call['tool']}({call.get('args')}): binding " f"{ref['symbol']!r} -> {ref['constraint']!r} is ungrounded " f"after compaction. Refusing to execute on a dangling reference." ) # only reached when every binding reference is grounded dispatch(call) ```