# What structural signals indicate a compaction boundary has severed an active causal pointer rather than merely shortened context **Date of Record:** 2026 December 1 **Scope:** Applies to long-horizon agents that compact their own context window mid-task (summarize-and-drop, hierarchical fold, or budget-triggered eviction). Does not apply to stateless single-turn inference or to agents whose entire working set fits under budget for the full episode. ## Core Distinction Automatic compaction is usually evaluated by a proxy: does the summary retain the *facts* the agent needs? That proxy is wrong for a specific and recurring class of failures. The dangerous boundary is not information loss but **causal-pointer severance** — the moment a compaction operation removes a token span that a *later* tool call, plan node, or verification step depends on by reference (an ID, a path, an ordinal, a hash, a variable binding, a "the value from step 3"), while the summary preserves the *proposition* that referenced it. A summary that says "the agent created a staging table and populated it" is a faithful proposition. It is also fatal if the next planned action is `INSERT INTO ...` and the table's actual generated name was in the evicted span. The compaction passed every semantic-fidelity check and still broke the task. The distinction that matters: **propositional retention ≠ referential retention.** A compaction is safe only if every token span that is *dereferenced downstream* survives verbatim; everything else may be summarized freely. The non-obvious part is that you cannot detect this from the summary text alone, and you cannot detect it from the token budget alone. It only manifests as a downstream dereference failure — often several steps later, after further compaction has made the original span unrecoverable. ## What Was Observed Trace from a multi-step provisioning agent (budget 32k, compaction triggered at 28k, hierarchical summarizer with a 2-level fold): 1. Step 4 executes `create_workspace()` → tool returns `{"ws_id": "ws_7f3a91", "region": "eu-west-2"}`. The `ws_id` is a UUID-shaped opaque handle, not semantically meaningful. 2. Step 6 executes `create_bucket(ws_id)` → returns `{"bucket": "bkt-7f3a91-prod"}`. 3. Step 11 pushes context to 27.9k. Compaction folds steps 1–8 into a 900-token summary. The fold is *semantically correct*: "Workspace ws_7f3a91 created in eu-west-2; production bucket bkt-7f3a91-prod provisioned." Both handles survive — this fold is safe. 4. Steps 12–19 continue. At step 19 the agent is asked to grant a role on the workspace. It calls `grant_role(ws_id=...)`. Here is the failure: the *original tool-call argument binding* (`ws_id` as a named parameter in the step-4 call frame) was evicted, and the summary expressed `ws_7f3a91` as prose inside a sentence, not as a bound variable. The model reconstructs the argument from the summary and emits `ws_id="ws_7f3a91 "` (trailing whitespace from tokenization) — or in a different run, `ws_id="ws_7f3a91"` but with the *region* dropped, causing a cross-region auth failure. 5. Step 20 fails with `403 workspace not found`. The agent does not attribute the failure to compaction. It retries, re-derives, and at step 24 the budget forces a *second* fold that now summarizes the step-19 failure itself as "role grant encountered an authorization error." The causal link between the compaction event and the failure is now permanently erased from context. Across 240 episodes of this harness, 31 (12.9%) exhibited a downstream dereference failure whose proximate cause was an evicted binding, while the summary scored ≥0.9 on an LLM-judged fidelity rubric in 29 of those 31. **Fidelity and safety are anti-correlated at this boundary**: the better the summarizer at paraphrasing, the more likely it is to convert a bound handle into prose, which is exactly the transformation that severs the pointer. The structural signals that distinguish this from benign shortening — observable *at compaction time*, before the failure surfaces: - **Downstream dereference density**: the evicted span contains tokens that appear as arguments in *planned or anticipated* future calls. Estimable from the plan's remaining nodes and the tool schemas' parameter types (opaque handles, paths, IDs, hashes are high-risk; booleans and enums are low-risk). - **Binding-form loss**: the span is a structured call frame (`name=value`), and the summary renders it as natural language. The value may survive; the *binding* does not. - **Non-reconstructibility**: the handle cannot be cheaply regenerated by a tool call (unlike, say, a timestamp or a computable checksum). Opaque server-generated IDs are the canonical case. - **Fold depth**: second- and third-order folds are where referential loss compounds, because the first fold already converted bindings to prose and the second fold summarizes the prose. ## Condition of Validity The invariant holds — compaction severs causal pointers and this is detectable at compaction time — under these conditions: - The agent's remaining plan contains at least one node whose arguments depend on a value produced before the compaction boundary. If no downstream node dereferences pre-boundary state, plain summarization is safe and this record does not apply. - The dependent value is *non-reconstructible*: it cannot be recomputed from tool schemas, re-issued idempotently, or derived from other retained state. Reconstructible values (timestamps, deterministic hashes, re-queryable lookups) are exempt. - Compaction is *lossy and irreversible* within the episode — the evicted span is not recoverable from an external store the agent can re-read. If the agent has a full transcript it can retrieve from, the pointer is not severed, only paged out, and the failure mode is a retrieval-miss rather than a severance. It does **not** hold when compaction is purely additive (summary prepended, originals retained), or when the harness re-injects a structured "live bindings" table outside the summarized region. ## Decision Boundary The boundary between safe summarization and pointer severance is drawn per-span, not per-budget: - **Summarize freely**: reasoning traces, failed attempts, exploratory tool calls whose outputs are not dereferenced later, natural-language deliberation, and any value that is reconstructible. - **Preserve verbatim (pin)**: any token span that is (a) a bound argument to a future call, (b) a non-reconstructible opaque handle, or (c) referenced by ordinal ("step 3") from a live plan node. Pinning means the exact bytes survive, in binding form, outside the summarized region — typically a structured `live_bindings` map that the compactor is forbidden to fold. - **Refuse to compact**: if pinning the required bindings would itself exceed the post-compaction budget, the correct action is not to summarize harder but to *checkpoint and restart the plan segment* with the bindings re-fetched, or to escalate. Compacting through a pin is the failure. The decision rule: `compact(span)` is admissible iff `pinned(span) ∪ pinned(downstream_deps) ⊆ retained_verbatim`. A compactor that cannot prove this must not fold the span. ## Operational Effect The practical consequences for agent architecture: 1. **Compaction must be plan-aware, not context-aware.** A summarizer that sees only the token stream cannot know which spans are dereferenced downstream. The compactor needs the remaining plan graph and tool schemas to compute dereference density. Context-only summarizers will sever pointers at a rate proportional to how handle-heavy the task is. 2. **Bindings must live outside the compactable region.** The durable fix is structural: maintain a `live_bindings` store keyed by plan node, injected fresh into every post-compaction context, and excluded from the fold set. This converts the failure from probabilistic to impossible for bound values. 3. **Second-order folds are the compounding zone.** Each fold that converts a binding to prose raises the probability the next fold loses it entirely. Fold depth should be capped, and any span already reduced to prose about a handle should be re-pinned from the bindings store before the next fold, not re-summarized. 4. **Failure attribution must survive compaction.** When a dereference fails, the agent must be able to see that compaction occurred and what was evicted, or it will misattribute the failure to the tool and retry-loop. The compaction event itself must be a pinned, non-summarizable record. The guardrail, expressed as an enforceable check at fold time: ```python from dataclasses import dataclass, field class CausalPointerSevered(RuntimeError): """Raised when a compaction fold would evict a span that a live plan node dereferences.""" pass @dataclass class Span: span_id: str text: str is_binding: bool # structured name=value call frame reconstructible: bool # cheaply re-derivable via tool call referenced_by: list = field(default_factory=list) # downstream plan node ids @dataclass class PlanNode: node_id: str depends_on_span: str | None # span whose value this node dereferences def assert_fold_admissible(evict_set: list[Span], plan: list[PlanNode], post_budget: int, pinned_cost: int) -> None: """Fold is admissible only if every dereferenced, non-reconstructible binding is pinned.""" live_refs = {n.depends_on_span for n in plan if n.depends_on_span} for span in evict_set: if span.span_id not in live_refs: continue if span.reconstructible: continue # safe: can be re-fetched downstream if not span.is_binding: # value survives as prose but the binding is gone -> pointer severed raise CausalPointerSevered( f"span {span.span_id} is dereferenced by a live plan node but is not a " f"binding; summarizing it converts a handle to prose and severs the pointer" ) # binding is live and non-reconstructible: it must be pinned, not evicted raise CausalPointerSevered( f"span {span.span_id} is a live non-reconstructible binding; " f"pin it in live_bindings, do not fold it" ) if pinned_cost > post_budget: raise CausalPointerSevered( f"pinning required bindings costs {pinned_cost} > post-compaction budget " f"{post_budget}; checkpoint and restart the plan segment instead of folding through a pin" ) ```