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 <that table> ...` 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:

Condition of Validity

The invariant holds — compaction severs causal pointers and this is detectable at compaction time — under these conditions:

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:

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:

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"
        )