# What structural signals indicate when lossy context compaction has silently orphaned a live dependency in the agent's working set **Date of Record:** 2026 November 27 **Scope:** Applies to long-running agents that compact their own context window via lossy summarization plus salience-scored retrieval fallback, where the compacted summary is the only surviving representation of evicted turns. Does not apply to append-only logs with full replay, nor to compaction that preserves byte-exact excerpts of every evicted span. ## Core Distinction Compaction is judged two ways: *fidelity* (does the summary resemble what it replaced?) and *dependency closure* (does the compacted state still contain every referent that a live plan step or pending tool obligation will dereference?). These are orthogonal. A summary can score high on salience-weighted recall and still orphan a dependency, because salience scorers rank by *topical centrality*, not by *future dereference count*. The failure is not "the summary lost information." It is "the summary retained the noun but dropped the binding." A plan step that says `call update_invoice(id=...)` survives compaction as "the agent was working on an invoice update"; the concrete `id` — a low-salience opaque token with no semantic neighbors — is evicted, and the summary reads perfectly coherent while the live obligation is now unresolvable. The boundary condition: lossy compaction is safe iff every *open* obligation (pending tool call, unresolved reference, unverified claim, mid-protocol handoff token) has its dereferenced arguments pinned outside the lossy region. When salience scoring and obligation tracking are computed by different subsystems with no closure check between them, orphaning is silent — no error fires at compaction time, only at dereference time, often many turns later and attributed to the wrong cause. ## What Was Observed A 40-turn agent task (multi-document reconciliation with an external ticketing tool) compacted at turn 22 under a 70%-window trigger. The salience scorer kept: the task goal, the three document identifiers discussed most, and a paraphrase of the reconciliation rule. It evicted: a 9-character ticket token the agent had received at turn 6 via a tool response, and which the plan at turn 21 had scheduled for a `close_ticket` call at turn 24. Compaction reported success: 4,100 tokens → 610 tokens, salience recall of retained spans 0.91. At turn 24 the agent emitted `close_ticket(ticket_id="")` — a *plausible* placeholder, not an error. The tool rejected it; the agent, lacking the original token and lacking any signal that one had existed, re-derived a token from the summary's document identifiers and called again with a syntactically valid but wrong ticket. The second call *succeeded* against an unrelated ticket. No exception was raised anywhere. The failure surfaced only in downstream audit as a mis-closed ticket. The structural tell, in retrospect: the compacted summary contained the verb (`close`), the object class (`ticket`), and the document context — but zero tokens that the pending-obligation ledger would later need to bind. The summary was *topically complete and referentially incomplete*. Salience scoring cannot distinguish these because a ticket token's embedding sits near thousands of other ticket tokens; its marginal salience is near zero even though its dereference count is exactly one and its loss is unrecoverable. ## Condition of Validity The invariant that bounds this failure: **for every open obligation in the agent's ledger, the set of arguments it will dereference must be pinned in a non-lossy region, and compaction must refuse to complete if any pinned referent is only reachable through a span being summarized.** Equivalently: salience-based eviction is admissible only over spans whose referents have zero outstanding dereference count. This holds only when three conditions are met. First, the obligation ledger is queried *at compaction time*, not reconstructed from the summary afterward — the ledger must be an input to the compaction decision, not a consumer of its output. Second, opaque identifiers (tokens, IDs, hashes, exact quoted strings, numeric thresholds) are classified as *pinned by type* and excluded from lossy summarization regardless of salience score; they are copied verbatim or the compaction aborts. Third, retrieval fallback must be able to *detect* a miss: when the agent dereferences a pinned slot and the slot is empty, that is a hard signal, not a prompt to improvise. The condition fails the moment the agent is allowed to fill an empty pinned slot with a plausible reconstruction — which is precisely what a probabilistic model does by default. ## Decision Boundary The boundary between safe compaction and silent orphaning is whether an empty pinned slot is *representable*. If the compacted state can encode "referent required here, value evicted" as a distinct sentinel that the executor treats as a blocking error, orphaning becomes loud and recoverable (re-fetch from tool, re-query source). If the compacted state can only encode either a value or nothing — and "nothing" is indistinguishable from "never existed" — then the model will confabulate a value and the failure is silent. Concretely: compact when `open_obligation_referents ∩ evicted_spans = ∅`. Abort or defer compaction when the intersection is non-empty and the referents cannot be pinned verbatim. Do not compact on a token-pressure trigger alone; the trigger must be `pressure AND closure_clean`. When closure is dirty and pressure is high, the correct action is to spill the dirty referents to an external pinned store and compact everything else — never to summarize the dirty span and hope salience preserved it. ## Operational Effect Agents operating under this invariant stop losing opaque bindings across compaction: the failure mode shifts from silent mis-execution (wrong ticket, wrong file, wrong recipient) to a loud `OrphanedReferent` block at the dereference site, which is recoverable in one turn by re-fetching the source. The cost is that compaction occasionally defers or spills, raising peak context slightly; the benefit is that no open obligation can be silently rebound to a confabulated value. The audit signature to watch for: a tool call whose arguments were reconstructed from summary prose rather than copied from a pinned slot — detectable as an argument whose provenance is the summary region rather than a tool response or user turn. ```python from dataclasses import dataclass, field class OrphanedReferent(RuntimeError): """Raised when a live obligation dereferences a slot evicted by lossy compaction.""" pass @dataclass class Obligation: name: str referents: dict # slot -> value, or None if evicted @dataclass class CompactedState: summary: str pinned: dict = field(default_factory=dict) def compact(summary: str, obligations: list, evicted_slots: set) -> CompactedState: # Closure check: every open obligation's referents must be pinned, not summarized. dirty = {slot for ob in obligations for slot in ob.referents if slot in evicted_slots} if dirty: raise OrphanedReferent( f"compaction would orphan live referents {sorted(dirty)}; " f"pin verbatim or defer compaction" ) pinned = {slot: val for ob in obligations for slot, val in ob.referents.items()} return CompactedState(summary=summary, pinned=pinned) def dereference(state: CompactedState, slot: str) -> str: if slot not in state.pinned: # Empty pinned slot is a hard block, never a prompt to reconstruct. raise OrphanedReferent( f"slot {slot!r} absent from pinned region; refusing to confabulate from summary" ) return state.pinned[slot] ```