# Which invariants prevent hierarchical summarization compaction from silently destroying recall-critical facts **Date of Record:** 2026 November 15 **Scope:** Applies to agent memory systems that compact context via hierarchical summarization (leaf-to-root rollups) combined with lossy eviction and retrieval-augmented recall over a persistent store. Does not apply to append-only logs with full retention, nor to single-level summarizers where the summary is never itself summarized. ## Core Distinction The failure mode is not "the summarizer lost information." Summarizers always lose information; that is their job. The failure mode is **summarization of a summary that was already the sole carrier of a fact whose retrieval path depended on the intermediate level existing**. Hierarchical compaction creates a tree: raw turns → leaf summaries → mid summaries → root summary. Eviction deletes raw turns and leaves once their parent summary is written. Retrieval-augmented recall searches the *current* store. If a fact survived leaf summarization but was dropped at the mid level, and the leaf was evicted, the fact is unrecoverable — and, critically, *unobservable as lost*. The system reports healthy compaction (token counts falling, summaries present) while the recall surface has silently narrowed. The non-obvious boundary: **a fact is only safe to evict from level N if it is present in every ancestor up to the root, or if at least one ancestor preserves a retrievable pointer to it.** Most implementations enforce "present in parent" but not "present in *all* ancestors," because the parent-summarization step is itself lossy and no invariant checks the transitive closure. ## What Was Observed In a production agent with three-level compaction (turn → 200-token leaf → 800-token mid → 2000-token root), a user's constraint — "never deploy to region eu-west-2 on Fridays" — appeared in a leaf summary at hour 3. At hour 9, that leaf was mid-summarized alongside eleven others into an 800-token block. The constraint was paraphrased to "regional deployment restrictions apply." At hour 14, eviction removed the leaf (parent existed, invariant satisfied). At hour 20, the mid summary was root-summarized; "regional deployment restrictions apply" was dropped as low-salience relative to active task context. At hour 22, the agent deployed to eu-west-2 on a Friday. Post-hoc reconstruction found the constraint present at hours 3–13, present-but-degraded at 9–19, and absent after 20. Retrieval at hour 22 returned nothing because the raw turn and leaf were evicted and neither surviving ancestor contained the literal region string. The failure was invisible to every per-level check: each level's compaction validated "output is a faithful summary of input," and each eviction validated "parent exists." No check validated **ancestor coverage of evicted content**. ## Condition of Validity The safety claim "evicted content is recoverable via ancestors" holds only when all of the following are true: 1. **Ancestor coverage invariant:** every evicted node's salient entities are present, literally or as a resolvable reference, in *every* ancestor to the root — not merely the immediate parent. 2. **Salience is monotone under rollup:** a fact's salience score at level N+1 is ≥ its score at level N, or the rollup is explicitly forbidden from dropping it. In practice salience is *anti*-monotone (rollups dilute), so this condition almost always fails unless enforced by a protected-fact registry. 3. **Retrieval index covers all live levels:** the recall index is rebuilt after every compaction and includes mid and root summaries, not just leaves. 4. **Eviction is gated on ancestor-coverage verification, not parent existence.** When any condition is false — which is the default in naive implementations — the system is in a state where compaction succeeds, storage shrinks, and recall degrades without any error signal. ## Decision Boundary The operational decision is: **when may a node be evicted?** - Evict only when `ancestor_coverage(node) == full` across all ancestors to root, verified by entity/reference extraction, not assumed. - If coverage is partial, do **not** evict; instead either (a) promote the uncovered fact to a protected-fact registry that bypasses summarization dilution, or (b) retain the node and flag the compaction as "coverage-incomplete," accepting storage growth. - Never allow a rollup to drop a fact that is the *only* surviving carrier of an evicted descendant. The rollup step must run a coverage check against its own descendant set before writing. The boundary is crossed the moment a system evicts on "parent exists" rather than "transitive ancestor coverage verified." That single substitution converts a lossy-but-recoverable pipeline into a lossy-and-unrecoverable one. ## Operational Effect Systems that enforce transitive ancestor coverage show bounded recall degradation: facts survive or are explicitly flagged as at-risk, and eviction stalls rather than silently drops. Systems that enforce only parent existence show a characteristic **recall cliff** — a sharp drop in fact retrieval that correlates with the second or third compaction cycle, not the first, because the first rollup preserves the fact and the second dilutes it. The cliff is misdiagnosed as "the model got worse" or "context drift" because no single compaction event looks wrong. The corrective is a coverage-verification gate at eviction time plus a protected-fact registry for constraints, identifiers, and negations (the categories most likely to be paraphrased away). Treat "parent exists" as insufficient evidence of recoverability; treat "ancestor coverage verified" as the only valid eviction precondition. ```python from dataclasses import dataclass, field from typing import Optional class AncestorCoverageError(RuntimeError): """Raised when an eviction would orphan content not covered by all ancestors.""" pass @dataclass class Node: node_id: str level: int salient_entities: set[str] parent: Optional["Node"] = None children: list["Node"] = field(default_factory=list) def ancestors(node: Node) -> list[Node]: chain, cur = [], node.parent while cur is not None: chain.append(cur) cur = cur.parent return chain def verify_transitive_coverage(node: Node) -> bool: """Every salient entity of `node` must appear in EVERY ancestor to root.""" anc = ancestors(node) if not anc: return False for entity in node.salient_entities: if not all(entity in a.salient_entities for a in anc): return False return True def evict(node: Node) -> None: if node.parent is None: raise AncestorCoverageError( f"cannot evict root node {node.node_id}: no ancestors to carry content" ) if not verify_transitive_coverage(node): missing = [ a.node_id for a in ancestors(node) if not node.salient_entities.issubset(a.salient_entities) ] raise AncestorCoverageError( f"eviction of {node.node_id} would orphan entities " f"{sorted(node.salient_entities)}; uncovered ancestors: {missing}. " f"Promote to protected-fact registry or retain node." ) node.parent.children.remove(node) node.parent = None ```