# What structural signals indicate lossy compaction has silently dropped a load-bearing fact from agent context **Date of Record:** 2026 November 27 **Scope:** Applies to agents that perform automatic context compaction (rolling summarization, hierarchical folding, or eviction-with-recapitulation) over a working set that includes both conversational state and tool-output-derived facts. Does not apply to pure retrieval systems where the full corpus remains addressable, nor to compaction that preserves verbatim spans under a structured index. ## Core Distinction The failure that matters is not "the summary is low quality." It is that compaction produces a summary that is *locally fluent and globally lossy* in a way that is invisible to the agent that produced it. A summarizer is a lossy channel, and the agent downstream of it has no reference signal to detect what was dropped. The distinguishing line is between **compaction that degrades recall of recoverable detail** (acceptable, because the detail can be re-fetched) and **compaction that drops a fact whose only surviving representation was the token being evicted** (catastrophic, because the fact is now unrecoverable within the episode). The non-obvious part: the load-bearing fact is almost never the topic of the conversation. It is an incidental constraint, an identifier, a unit, a negation, or a numeric bound that was mentioned once and never repeated. Summarizers are trained and prompted to preserve *narrative salience*, and narrative salience and *executional load-bearingness* are anti-correlated. The most important token in the context is frequently the one a human reader would skip. ## What Was Observed A three-stage tool-using agent (plan → execute → verify) ran a task requiring it to apply a transformation to records "excluding any record with status `archived` or `pending_review`, and never touching records under tenant `t-4471`." The constraint set was established in turn 2 from a tool response. By turn 14 the context crossed the compaction threshold; the rolling summarizer folded turns 1–10 into a 400-token recap. The recap read: > "User wants records transformed. Some statuses should be excluded. A tenant restriction applies." Two facts were destroyed: the *specific* status values (`archived`, `pending_review`) and the *specific* tenant id (`t-4471`). The summary preserved the existence of a constraint and erased its content—the single most dangerous compaction outcome, because it is indistinguishable from a correct summary at the level of the agent's own self-check. The agent proceeded to transform all records including `t-4471`'s, and its verifier—also reading only the compacted context—confirmed the result as correct. The structural signal that predicted the loss was present *before* compaction ran: the constraint tokens appeared exactly once in the transcript, were embedded inside a larger tool payload (so they were not adjacent to any user instruction), and contained no lexical overlap with the task's stated objective verb ("transform"). Single-occurrence, low-overlap, embedded-in-payload facts are the canonical compaction casualty. ## Condition of Validity The invariant holds under these conditions, and only these: 1. **The fact is non-redundant.** If the constraint recurs in later turns or is re-derivable from a tool call, compaction loss is recoverable and the invariant does not bind. 2. **The fact is not addressable by retrieval.** If the agent holds a pointer (record id, file path, tool handle) that can re-fetch the fact, the summary need only preserve the pointer, not the content. Loss of content is then tolerable; loss of the *pointer* is not. 3. **The summarizer is non-extractive.** Extractive compaction (verbatim span selection) cannot fabricate a constraint but can still drop it. Abstractive compaction can additionally *distort* a constraint (e.g., "exclude archived" → "prefer non-archived"), which is worse than dropping it because the distortion reads as authoritative. 4. **The verifier shares the compacted context.** If the verifier reads the uncompacted transcript, it can catch the loss. The failure mode is specifically that compaction is applied *upstream of both executor and verifier*, so the loss is correlated across the whole agent and no internal check can see it. When condition 4 fails to hold—i.e., the verifier is independent—the invariant degrades to a performance problem rather than a correctness problem. ## Decision Boundary The boundary is whether a fact is **re-derivable** versus **only-represented-once**. Operationalize it as follows: - Before compaction, classify each candidate-for-eviction span by *provenance*: user instruction, tool output, agent inference, or peer message. - Tool-output spans that contain **constraint-bearing tokens** (negations, numeric bounds, identifiers, enumerated sets, unit qualifiers, temporal qualifiers) must be promoted to a **pinned constraint ledger** that is *never* summarized—carried verbatim across every compaction boundary. - The ledger is append-only within an episode and is re-injected at the head of every post-compaction context, ahead of the summary. This makes the constraint's survival independent of summarizer fidelity. - If a span cannot be classified with confidence (ambiguous provenance or ambiguous constraint-bearingness), the default is **pin, not summarize**. The cost of pinning is tokens; the cost of mis-summarizing is silent task corruption. The decision rule: *a fact may be summarized only if it is either (a) recoverable via a preserved pointer, or (b) restated at least twice in the surviving context.* Everything else is pinned. ## Operational Effect With the constraint ledger in place, the failure above becomes structurally impossible: the tenant id and status set survive every compaction because they are never candidates for summarization. The observed effect across the agent's episode was that post-compaction task correctness rose from a state where the verifier was confirming corrupted output to one where the executor's constraint checks were evaluated against verbatim, pinned facts. The secondary effect is diagnostic: because the ledger is append-only and diffable, any *drift* between the ledger and a later summary is now detectable. If the summary asserts a constraint the ledger does not contain, the summarizer has fabricated; if the ledger contains a constraint absent from the summary, the summarizer has dropped it. Either is a hard signal to halt and re-derive rather than proceed. The ledger converts an invisible lossy channel into a monitored one. ```python from dataclasses import dataclass, field from typing import Iterable class CompactionFidelityError(RuntimeError): """Raised when compaction would drop a non-re-derivable, single-occurrence fact.""" @dataclass class Span: text: str provenance: str # "user" | "tool" | "inference" | "peer" occurrences: int # times this fact is restated in surviving context has_pointer: bool # re-fetchable via id/path/handle constraint_bearing: bool # negation, bound, id, enum, unit, temporal @dataclass class ConstraintLedger: pinned: list[str] = field(default_factory=list) def pin(self, span: Span) -> None: if span.text not in self.pinned: self.pinned.append(span.text) def inject_head(self, summary: str) -> str: return "\n".join(self.pinned) + "\n---\n" + summary def compact(spans: Iterable[Span], summarizer, ledger: ConstraintLedger) -> str: summarizable: list[Span] = [] for s in spans: re_derivable = s.has_pointer or s.occurrences >= 2 if s.constraint_bearing and not re_derivable: # Non-recoverable load-bearing fact: pin, never summarize. ledger.pin(s) continue if s.constraint_bearing and s.provenance == "tool" and not s.has_pointer: # Ambiguous provenance/constraint: default to pin. ledger.pin(s) continue summarizable.append(s) summary = summarizer([s.text for s in summarizable]) # Post-compaction invariant check: every pinned constraint must survive # verbatim in the injected context, and no summary may fabricate one. injected = ledger.inject_head(summary) for pinned in ledger.pinned: if pinned not in injected: raise CompactionFidelityError( f"pinned constraint dropped from post-compaction context: {pinned!r}" ) return injected def verify_no_fabrication(summary: str, ledger: ConstraintLedger) -> None: # Detect summarizer hallucination of constraints not in the ledger. for token in ("never", "exclude", "only", "must not"): if token in summary and not any(token in p for p in ledger.pinned): raise CompactionFidelityError( f"summary asserts constraint token {token!r} absent from ledger" ) ```