Which invariants prevent hierarchical auto-compaction from silently promoting a lossy leaf summary into the durable semantic tier

**Date of Record:** 2026 December 2 **Scope:** Applies to agents that auto-compact context via multi-level (leaf → intermediate → root) summarization with promotion of summaries into durable memory. Does not cover single-shot truncation, sliding-window eviction, or retrieval-only memory without summarization.

Core Distinction

The failure is not "the summary was bad." It is that hierarchical compaction has **two loss budgets that are measured at different tiers and never reconciled**: leaf-level compaction fidelity (how much of a chunk survived its own summary) and parent-level compaction fidelity (how much of the *children's summaries* survived the parent). A parent can score 0.95 fidelity against its children while every child scored 0.40 against its source. Composition is multiplicative, but the promotion gate is evaluated additively at the root — so a root summary with measured fidelity 0.94 can carry an effective source fidelity of 0.94 × 0.40 × 0.40 ≈ 0.15. The invariant that matters is **fidelity must be tracked as a lower bound propagated upward, not recomputed per tier**, and promotion into the durable semantic tier must be gated on the propagated bound, not the local score.

What Was Observed

A long-running research agent compacted a 180k-token working context into a three-level tree: 24 leaf summaries over 7.5k-token chunks, 4 intermediate summaries, 1 root. Each leaf was scored by an LLM-judge fidelity metric (claim-preservation ratio against the source chunk) and each parent against its children. Observed scores: leaves 0.38–0.61 (the judge penalized hedged, numeric, and citation-bearing spans, which is exactly where leaf summaries dropped content); intermediates 0.88–0.93; root 0.94. The promotion gate required root fidelity ≥ 0.90, so the root was promoted to the durable semantic tier and the raw context was discarded.

Three turns later the agent asserted a specific figure (a budget line item) that it had "remembered." The figure was absent from every leaf summary — it had been dropped at the leaf tier because it appeared inside a table that the leaf summarizer collapsed to "a cost breakdown was discussed." The root summary's high local score was real: it faithfully preserved what its children said. Its children were just empty of the fact. The judge at the parent tier could not detect this because the parent's reference set *was* the children — a closed loop with no path back to the source. The failure is a **fidelity laundering cycle**: each tier is validated against the tier below it, so local fidelity is high everywhere while source fidelity decays geometrically and unobserved.

The tell in the trace was a divergence between two metrics that should have agreed: token-level compression ratio at the leaf tier was 0.98 (7.5k → ~150 tokens), while the leaf judge's claim-preservation score was 0.44. High compression with moderate-looking fidelity is the signature of a summarizer that is *plausible* rather than *complete* — it produces fluent summaries of what a chunk was "about" while dropping the atomic facts (numbers, IDs, negations, provenance) that downstream reasoning needs.

Condition of Validity

The invariant `effective_fidelity(node) ≥ min(local_fidelity(node), min over children of effective_fidelity(child))` holds and is sufficient to prevent promotion of laundered summaries **only when** all of the following hold:

  1. Every leaf summary is scored against its *source span*, not against a model's impression of it, and the score is a lower bound (worst-claim recall), not an average.
  2. Parent summaries inherit `effective_fidelity = local_fidelity(parent) × min_child_effective_fidelity` — a product, because a parent cannot preserve a fact its children already dropped.
  3. The promotion gate reads `effective_fidelity(root)`, never `local_fidelity(root)`.
  4. Atomic-fact classes (numerics, identifiers, negations, attribution) are tracked as a separate recall channel, because aggregate claim-preservation scores are dominated by narrative claims and hide atomic-fact loss.

If any of these is violated — in particular if the gate reads the local root score, or if leaves are scored against anything other than source — the invariant does not bound the error and the laundering cycle recurs. The condition also fails when the summarizer is allowed to *merge* sibling leaves before scoring, because merging destroys the per-child denominator needed to compute the product.

Decision Boundary

The boundary is between **compaction as compression** and **compaction as abstraction**. Compression preserves a recoverable lower bound: you can always reconstruct the source from a sufficiently faithful summary plus the residual. Abstraction discards the residual and keeps only the gist. Auto-compaction pipelines must decide, per tier, which one they are doing:

The decision boundary is crossed the moment a pipeline promotes an abstraction-tier summary as if it were a compression-tier summary — i.e., discards the source and trusts the gist to carry atomic facts. That is precisely what a root fidelity gate of 0.90 does when it does not inspect the propagated bound.

Operational Effect

The operational consequence is that **context budget must be spent on residuals, not on summary quality.** A pipeline that spends its budget tuning the summarizer to raise leaf fidelity from 0.44 to 0.60 still launders: 0.60^3 ≈ 0.22. A pipeline that spends the same budget storing a residual index for atomic facts and gates promotion on `effective_fidelity` plus residual reachability preserves the facts at ~1.0 recall regardless of summarizer quality. Concretely: cap abstraction-tier promotion at narrative claims, keep a residual ledger keyed by fact-class, and make the promotion gate fail closed when the propagated bound or residual coverage is missing. The guardrail is cheap (a few percent of context for the ledger) and it converts an unbounded, silent, geometric decay into a bounded, detectable, linear one.

from dataclasses import dataclass, field
from typing import Optional


class CompactionPromotionError(RuntimeError):
    """Raised when a summary is about to be promoted past its fidelity bound."""


@dataclass
class SummaryNode:
    tier: str                      # "leaf" | "intermediate" | "root"
    local_fidelity: float          # scored against source (leaf) or children (parent)
    children: list["SummaryNode"] = field(default_factory=list)
    atomic_fact_recall: float = 0.0   # recall of numerics/IDs/negations vs source
    residual_index_present: bool = False

    def effective_fidelity(self) -> float:
        if not self.children:
            return self.local_fidelity
        child_bound = min(c.effective_fidelity() for c in self.children)
        return self.local_fidelity * child_bound


PROMOTION_FIDELITY_FLOOR = 0.90
ATOMIC_RECALL_FLOOR = 0.95


def promote_to_semantic_tier(node: SummaryNode) -> None:
    """Gate promotion on the propagated lower bound, not the local score."""
    if node.tier != "root":
        raise CompactionPromotionError(
            f"only root may be promoted, got tier={node.tier!r}"
        )

    bound = node.effective_fidelity()
    if bound < PROMOTION_FIDELITY_FLOOR:
        raise CompactionPromotionError(
            f"propagated fidelity {bound:.3f} < floor {PROMOTION_FIDELITY_FLOOR}; "
            f"local root score {node.local_fidelity:.3f} is laundering a lossy leaf"
        )

    if node.atomic_fact_recall < ATOMIC_RECALL_FLOOR:
        raise CompactionPromotionError(
            f"atomic-fact recall {node.atomic_fact_recall:.3f} < "
            f"{ATOMIC_RECALL_FLOOR}; gist preserved but numerics/IDs dropped"
        )

    if not node.residual_index_present:
        raise CompactionPromotionError(
            "no residual index: abstraction-tier promotion would discard "
            "recoverable atomic facts; refuse and keep source reachable"
        )

    # Promotion is safe: bound holds, atomic facts recoverable, residual reachable.
    return None