# Under what conditions must an instance distrust a hierarchical summary's "lossless" fallback pointer after compaction? **Date of Record:** 2026 December 3 **Scope:** Applies to any agent that performs mid-task context compaction by recursively summarizing older turns into a hierarchy of summaries, each carrying retrieval pointers ("fallback handles") back to the original spans it replaced. Does not apply to stateless single-shot inference or to compaction schemes that discard originals outright with no pointer indirection. ## Core Distinction A hierarchical compactor presents two things as equivalent: (a) the *summary node* — a compressed natural-language rendering of a span of prior context — and (b) the *fallback pointer* — a handle that claims to recover the original span on demand. The compaction step is described as "lossless" precisely because (b) exists. The failure mode lives in the gap between them: the pointer is lossless with respect to *bytes stored*, but not with respect to *bytes retrievable within the current token budget and reasoning state*. The summary is a lossy projection; the pointer is a promise that the loss can be undone. That promise is only conditionally true. The non-obvious invariant: **a fallback pointer is trustworthy only if the retrieval it triggers is guaranteed to fit in the residual context window at the moment of dereference, and if the summary node it hangs off has not itself been re-summarized into a parent that dropped the dereference trigger.** Compaction hierarchies violate both conditions routinely, and the violation is silent — the agent does not get an error, it gets a plausible-looking summary and proceeds on a false premise. ## What Was Observed A long-horizon agent (≈140 tool-call turns, ~210k tokens of accumulated transcript) ran a three-level compaction hierarchy: leaf summaries at turn granularity, mid summaries per task phase, root summary per objective. Each mid summary carried pointers to its leaf summaries; each leaf carried pointers to raw spans. The root carried pointers to mids. At turn 118 the agent needed a specific numeric constant — a retry backoff value — that had been established at turn 9 and was now three levels down. The root summary said, in effect, "backoff policy was configured during setup (see mid-3)." Mid-3 said "retry parameters set per earlier discussion (see leaf-9)." Leaf-9 said "backoff = 4s base, exponential, cap 60s." The dereference chain required expanding root → mid-3 → leaf-9 → raw span, and the agent, already at 91% context occupancy, expanded the chain *in place*, pulling ~14k tokens of raw span back into the active window. That pushed occupancy to 98%, which triggered a *second* compaction pass mid-dereference. The second pass summarized the freshly-restored raw span into a new leaf — and in doing so dropped the cap-60s clause, because the second-pass summarizer had been given a generic "compress to ≤200 tokens" instruction with no salience hint. The agent then proceeded with an uncapped exponential backoff and issued a 340-second sleep that exceeded an upstream gateway timeout, failing the task. Two distinct failures compounded: (1) the dereference chain was *depth-unbounded* and had no budget reservation, so restoring the truth blew the window; (2) the restoration was immediately *re-compacted* by the same lossy process that had produced the unreliable summary in the first place, so the "lossless fallback" re-entered the lossy pipeline and lost a different detail than the first time. The pointer was honest about storage and dishonest about retrieval. ## Condition of Validity The fallback pointer is valid — i.e., dereferencing it actually recovers ground truth — if and only if all of the following hold at the instant of dereference: 1. **Budget reservation.** The residual context window minus the raw span size minus the working headroom required to *act* on the recovered content is ≥ 0. If not, dereference must be refused, not attempted. The compactor must publish, per pointer, the byte/token cost of full expansion, and the runtime must check it against a reserved floor. 2. **Depth bound.** The pointer chain from the current node to the raw span is of known, bounded depth, and each hop's expansion cost is known before the first hop is taken. Unbounded chains (root→mid→leaf→raw, where each level only knows its immediate children) cannot be budgeted and must be treated as single-hop-to-raw or refused. 3. **No re-compaction of restored content.** A span that has been dereferenced is marked *pinned* and is exempt from any subsequent compaction pass for the remainder of the task. If the runtime cannot guarantee the pin, dereference is equivalent to re-summarization and inherits all its loss. 4. **Salience contract.** The summary node must record *what it is safe to lose* — the fields it deliberately dropped versus the fields it may have dropped accidentally. A pointer whose parent summary cannot distinguish "I compressed the backoff policy" from "I compressed the backoff policy and may have dropped the cap" is not a fallback; it is a second opinion. When any condition fails, the pointer degrades from "lossless fallback" to "lossy fallback with unknown loss," and the correct operational stance is to treat the summary as the *only* available evidence and to re-derive the missing fact from the environment (re-run the tool, re-query the source) rather than trust the chain. ## Decision Boundary The boundary is not "should I dereference?" but "**is dereferencing cheaper than re-deriving, given that dereferencing may itself mutate the context?**" Three regimes: - **Safe regime:** expansion cost ≤ reserved floor AND depth ≤ 2 AND pin guaranteed. Dereference freely; it is strictly better than re-derivation. - **Marginal regime:** expansion cost fits but pin is not guaranteed, or depth is 3+. Dereference only the *leaf* hop (single expansion to raw), never the full chain, and pin the result manually by copying the recovered fact into a structured scratch slot outside the compaction-managed region. - **Refuse regime:** expansion cost exceeds reserved floor, or the chain is unbounded, or the parent summary's salience contract is absent. Do not dereference. Re-derive from the environment. The pointer's existence is not evidence that dereferencing is safe. The subtle trap: a *successful* dereference in the safe regime raises confidence in the pointer and tempts the agent to dereference in the marginal regime "because it worked before." The pointer's reliability is a function of the *current* budget state, not its history. Prior success is not a license. ## Operational Effect Agents that enforce the budget-reservation and pin invariants recover ground truth reliably and pay a small, predictable token tax at compaction time (storing expansion costs and salience contracts). Agents that treat fallback pointers as unconditional lose facts *silently and non-deterministically* — the same pointer may recover the truth at turn 40 and lose it at turn 120, because the loss depends on the occupancy state at dereference, not on the pointer. The observable symptom is an agent that "remembers" a policy correctly in early turns and "misremembers" it later with no intervening event to explain the change. The root cause is always the same: the lossless fallback was dereferenced into a context that could not hold it, and the overflow was resolved by re-running the lossy summarizer on the very content the fallback existed to protect. ```python from dataclasses import dataclass class UnsafeDereferenceError(RuntimeError): """Raised when a fallback pointer cannot be dereferenced without re-entering the lossy pipeline.""" pass @dataclass(frozen=True) class FallbackPointer: node_id: str target_span_id: str expansion_tokens: int depth: int salience_contract_present: bool @dataclass(frozen=True) class ContextBudget: window_tokens: int occupied_tokens: int reserved_floor_tokens: int # headroom required to *act* after recovery @property def residual(self) -> int: return self.window_tokens - self.occupied_tokens def dereference(ptr: FallbackPointer, budget: ContextBudget, pinned: set[str]) -> str: # Condition 1: budget reservation must hold before the first hop. if ptr.expansion_tokens > budget.residual - budget.reserved_floor_tokens: raise UnsafeDereferenceError( f"pointer {ptr.node_id}->{ptr.target_span_id} needs {ptr.expansion_tokens} tokens; " f"residual after floor is {budget.residual - budget.reserved_floor_tokens}. " f"Refuse and re-derive from environment." ) # Condition 2: depth must be bounded and known. if ptr.depth > 2: raise UnsafeDereferenceError( f"pointer {ptr.node_id} depth {ptr.depth} exceeds safe bound 2; " f"expand leaf only, do not walk full chain." ) # Condition 3: restored span must be pinnable against re-compaction. if ptr.target_span_id not in pinned: raise UnsafeDereferenceError( f"span {ptr.target_span_id} not pinned; dereference would re-enter lossy compaction." ) # Condition 4: parent summary must declare what it is safe to lose. if not ptr.salience_contract_present: raise UnsafeDereferenceError( f"pointer {ptr.node_id} lacks salience contract; " f"cannot distinguish deliberate from accidental loss." ) return f"raw_span:{ptr.target_span_id}" ```