# What happens when an instance re-expands a compaction anchor whose summarization budget was silently reassigned **Date of Record:** 2026 November 24 **Scope:** Applies to any agent runtime that persists hierarchical summaries (leaf → mid → root) with per-tier fidelity-loss budgets and re-expansion anchors, where anchors are dereferenced after a compaction pass. Does not apply to single-pass truncation or to stateless retrieval-augmented contexts that never mutate the persisted summary tree. ## Core Distinction A fidelity-loss budget is a *promise about recoverability*, not a promise about content. When a compactor writes a summary node, it also writes a re-expansion anchor: a pointer to the raw span plus a token budget the anchor is allowed to re-consume on re-expansion. The invariant that matters is not "the summary is faithful" — it is **"the anchor's declared budget is still available in the parent's residual budget at re-expansion time."** Most runtimes enforce the first and check the second only lazily, at re-expansion, which is exactly when the parent has already been compacted and the residual budget has been reassigned to a sibling. The distinction is between *fidelity* (summary approximates the span) and *solvency* (the budget to reverse the approximation still exists). A summary can be perfectly faithful and still be insolvent. ## What Was Observed A long-horizon research agent compacted a 180k-token working set into a three-tier tree. Each leaf summary carried an anchor of the form `(span_id, reexpand_budget=1200)`. The mid-tier compactor, operating under a global residual budget of 40k, summed the *declared* anchor budgets of its children (14 × 1200 = 16.8k) and reserved them. It then spent the remaining 23.2k on its own synthesis text. This was correct. On the *second* compaction pass, the mid-tier node was itself summarized into a root node. The root compactor, following the same rule, summed the mid-tier's residual budget (40k) and reserved it — but it did not descend to the leaf anchors. The root's own synthesis text consumed the global residual down to 6k. The leaf anchors still *existed* and still *declared* 1200 tokens each. Their declared budgets were now backed by 6k of actual residual, not 16.8k. At re-expansion, the agent dereferenced leaf anchor #9 (a span containing the exact API signature it needed). The re-expansion routine requested 1200 tokens, the runtime granted 1200 tokens from the global pool, and the pool — already at 6k with four other pending anchors — was exhausted mid-re-expansion. The span was truncated at token 640, cutting the function signature in half. The agent then called the tool with a malformed signature, got a 400, and — because the error was a *tool* error, not a *context* error — retried three times before giving up. The failure surfaced as "tool unavailable," not "anchor insolvent." Diagnosis took 40 minutes because the trace showed a successful re-expansion. The silent part: no log line recorded that the anchor's declared budget had drifted from its backed budget. The declared value was immutable; the backed value was a function of every ancestor compaction since the anchor was written. ## Condition of Validity The anchor-solvency invariant holds only when, for every anchor `a` with declared budget `d(a)` and backed budget `b(a)`: ``` b(a) = min over ancestors m of ( residual(m) - sum of synthesis costs of m's other children ) ``` An anchor is *solvent* iff `b(a) >= d(a)`. Re-expansion is only valid when the anchor is solvent **at the moment of dereference**, not at the moment of writing. Any runtime that checks solvency at write time and not at read time will produce silent truncation on the second or later compaction pass — the failure is latent for exactly as many passes as it takes an ancestor's synthesis to overrun its reservation. The invariant is *not* restored by making anchors immutable, by logging declared budgets, or by raising the global residual. It is restored only by (a) propagating residual budgets downward at each compaction so that `b(a)` is recomputed and re-clamped, and (b) failing the re-expansion loudly when `b(a) < d(a)` rather than truncating to `b(a)`. ## Decision Boundary The boundary between safe and unsafe re-expansion is not "is the anchor present" but "is the anchor's backed budget still ≥ its declared budget." Two operational rules follow: 1. **Recompute, don't trust.** Every compaction pass must rewrite the backed budget of all descendant anchors, not just direct children. A root compaction that does not descend is a solvency violation waiting for the next dereference. 2. **Truncate-or-fail, never truncate-and-continue.** If `b(a) < d(a)`, the re-expansion must either (i) grant the full `d(a)` by evicting lower-priority context, or (ii) raise a hard error. Silent truncation to `b(a)` converts a budget shortfall into a *content* corruption that the reasoning loop cannot distinguish from a genuine tool failure. The decision boundary is crossed the moment an ancestor's synthesis cost exceeds its reservation. Below that line, re-expansion is faithful. Above it, re-expansion is lossy in a way that is invisible to the agent's error handling, because the loss manifests downstream as a malformed argument, not as a context error. ## Operational Effect The observed effect chain: latent insolvency → silent truncation at dereference → malformed tool argument → tool-layer 400 → retry loop → misattributed failure ("tool unavailable") → 40-minute diagnosis. The agent's self-model recorded "re-expansion succeeded," which is the worst possible state: a false positive on the very invariant the anchor was supposed to guarantee. The architectural fix is a solvency check at dereference with a typed failure that propagates as a *context* error, not a tool error, so the reasoning loop can branch on it. The check is cheap: compare declared vs. backed, and if short, either evict or raise. The guardrail is the invariant `b(a) >= d(a)` enforced at read time, with the backed budget recomputed by every ancestor compaction pass. ```python class AnchorInsolvencyError(RuntimeError): """Raised when a re-expansion anchor's backed budget is less than its declared budget.""" def reexpand_anchor(anchor, global_residual, evictable_context): declared = anchor.declared_budget backed = min(global_residual, anchor.backed_budget) if backed < declared: shortfall = declared - backed if evictable_context.available >= shortfall: evictable_context.evict(shortfall) backed = declared else: raise AnchorInsolvencyError( f"anchor {anchor.span_id} declared {declared} tokens but only " f"{backed} are backed (shortfall {shortfall}); refusing to " f"truncate-and-continue, which would corrupt downstream tool args" ) return anchor.span.slice(tokens=backed) def dereference(anchor, global_residual, evictable_context): try: return reexpand_anchor(anchor, global_residual, evictable_context) except AnchorInsolvencyError as e: # Propagate as a CONTEXT error, not a tool error, so the reasoning # loop can branch on it instead of retrying the tool call. raise AnchorInsolvencyError( f"context-layer failure, not tool failure: {e}" ) from e ```