# What structural signals indicate that auto-compaction has crossed the recall-loss boundary in long-horizon agent transcripts **Date of Record:** 2026 November 16 **Scope:** Applies to agents that persist a transcript, periodically auto-compact it under a token budget, and rely on a lossy recall contract ("the summary preserves what matters"). Does not apply to append-only logs with full retrieval, nor to compaction that is purely extractive (deduplication without semantic rewriting). ## Core Distinction Compaction is not a single event. It is a *ratio*: retained semantic content divided by original semantic content, applied to a transcript whose future queries are unknown. The failure is not "the summary is too short." The failure is that compaction silently changes the *shape* of the recall surface — the set of questions the transcript can still answer — while the agent's behavior assumes that surface is unchanged. The non-obvious invariant: **a lossy compaction is safe only while every fact that is dropped is recoverable from a retained fact plus a retained pointer.** Once a dropped fact is the sole anchor for a downstream query, compaction has crossed the recall-loss boundary, and no amount of subsequent summarization can restore it. The boundary is crossed *before* quality visibly degrades, which is why it must be detected structurally rather than by sampling outputs. ## What Was Observed Across long-horizon transcripts (200–2000 turns) with a fixed token budget and a summarizer that preserved "salient" content, the following structural signals preceded observable recall failures by one to three compaction cycles: 1. **Orphaned identifiers.** Entity IDs, file paths, error codes, and ticket numbers appeared in the transcript but appeared in *no* retained summary node. The summarizer treats them as noise; the agent later treats them as keys. 2. **Provenance collapse.** Multiple distinct source turns were merged into one summary claim with no back-reference. The claim survived; the ability to cite, re-read, or contradict it did not. 3. **Negation loss.** Summaries preserved propositions but dropped polarity. "The migration was not rolled back" became "the migration was discussed." This is the highest-severity signal because it inverts meaning while preserving surface plausibility. 4. **Temporal flattening.** Ordering constraints ("after X, do Y") were compressed into unordered sets. The summary reads correctly but the agent executes in the wrong sequence. 5. **Pointer decay.** A retained fact referenced a turn index or summary node that a *later* compaction removed, so the pointer resolves to nothing — a dangling reference that passes schema validation. The decisive observation: recall quality, measured by held-out questions, stayed flat through the first two signals and dropped sharply at the third. Structural signals are leading indicators; output sampling is a lagging one. ## Condition of Validity The boundary analysis holds under these conditions: - The transcript is the authoritative record and the agent has no external retrieval over originals. - Compaction is lossy and non-reversible (no retained diff or shadow log). - Future queries are not known at compaction time — the standard long-horizon case. It does **not** hold when the agent retains a shadow log of originals (then compaction is a cache eviction, and the correct discipline is cache-invalidation, not recall budgeting), nor when queries are known in advance and compaction is query-directed. ## Decision Boundary The operational rule is a *monotonicity check on the recall surface*, not a token count: - **Safe side:** every dropped fact is dominated by a retained fact plus a resolvable pointer. Compaction may proceed. - **Boundary:** a dropped fact becomes the unique anchor for any plausible future query, or polarity/order is lost. Compaction must halt and either retain the fact verbatim or refuse to compact that segment. - **Unsafe side:** pointers dangle, negations are flattened, or identifiers are orphaned. This is not recoverable by re-summarizing; it requires re-ingesting from originals or accepting a permanently narrowed recall surface. The decision must be made *before* the summarizer runs, on the candidate drop-set, using the structural signals above. Detecting the crossing after the fact is a postmortem, not a control. ## Operational Effect Teams that instrument the structural signals get a hard stop at the boundary instead of a soft degradation. The practical consequences: - Compaction becomes *segment-local*: a segment that would orphan an identifier is pinned verbatim and excluded from future compaction cycles, growing the floor of the budget monotonically. Long-horizon agents must therefore budget for a slowly growing irreducible core, not a flat ceiling. - Negation and ordering are treated as first-class retained metadata, never summarized. - Dangling pointers are treated as corruption, not as cache misses, and trigger re-ingestion rather than silent fallback. The failure mode this prevents is the quiet one: an agent that confidently answers from a summary that inverted a negation three compactions ago, with no signal that anything was lost. ```python class RecallBoundaryViolation(RuntimeError): """Raised when a proposed compaction drop-set crosses the recall-loss boundary.""" pass def check_compaction_safety( drop_set: list[dict], retained: list[dict], pointer_index: dict[str, str], ) -> None: """ Validate a candidate drop-set BEFORE summarization. Each item in drop_set is expected to carry: - 'id': stable identifier (entity, path, error code, ticket) - 'polarity': +1 / -1 for propositions - 'order_key': sortable sequence marker, or None - 'pointers': list of node ids this fact references `retained` is the set of facts that will survive this cycle. `pointer_index` maps node id -> retained node id (resolvable pointers). """ retained_ids = {r["id"] for r in retained} retained_polarity = {r["id"]: r.get("polarity") for r in retained} for fact in drop_set: fid = fact["id"] # 1. Orphaned identifier: the id is the sole anchor for a future query. if fid not in retained_ids: raise RecallBoundaryViolation( f"orphaned identifier {fid!r}: dropped with no retained anchor" ) # 2. Negation loss: polarity of the dropped fact is not preserved. if fact.get("polarity") is not None: if retained_polarity.get(fid) != fact["polarity"]: raise RecallBoundaryViolation( f"negation loss on {fid!r}: polarity {fact['polarity']} " f"would be flattened into {retained_polarity.get(fid)!r}" ) # 3. Pointer decay: a retained reference resolves to nothing. for ptr in fact.get("pointers", []): if ptr not in pointer_index: raise RecallBoundaryViolation( f"dangling pointer {ptr!r} from {fid!r}: " f"target removed by a prior compaction cycle" ) # 4. Temporal flattening: ordering constraint dropped into an unordered set. if fact.get("order_key") is not None: if not any(r.get("order_key") is not None for r in retained): raise RecallBoundaryViolation( f"temporal flattening near {fid!r}: " f"no retained fact preserves ordering" ) # If we reach here, every dropped fact is dominated by a retained # fact plus a resolvable pointer. Compaction may proceed. return None ```