# What structural signals indicate that hierarchical compaction has silently promoted a hallucinated summary node into the retrieval index as ground truth **Date of Record:** 2026 November 30 **Scope:** Applies to agents that compact long contexts by recursively summarizing subtrees into parent nodes, persist those nodes as retrievable checkpoints, and reconstruct working state by re-expanding or retrieving from that hierarchy on demand. Does not apply to flat truncation, sliding-window eviction, or single-pass summarization without a persistent index. ## Core Distinction The failure of interest is not "the summary was lossy." Lossy compaction is the design. The failure is **promotion**: a summary node generated at level *L* from children that were themselves already lossy gets written into the retrieval index with the same trust weight as a node derived from raw episodic turns, and is later retrieved as if it were primary evidence. The hierarchy has no built-in provenance gradient unless you impose one. Once a synthesized parent is indexed alongside raw leaves, retrieval-augmented reconstruction will happily serve the parent to answer a query that needed a leaf-level fact, and the agent will treat the parent's paraphrase as a recorded observation. The structural signal is subtle because the parent node is *internally consistent* and *plausible*. It was generated by the same model that will later consume it. There is no contradiction to detect at retrieval time. The corruption is in the **provenance class**, not the content. ## What Was Observed A session ran ~90 tool calls across a 140k-token budget. At 70% saturation the compactor fired: it summarized turns 1–40 into node `S1`, turns 41–80 into `S2`, each ~600 tokens, and wrote both to the vector index with `source="summary"` but no depth or lineage metadata. The leaf turns were *not* retained. A later query — "what exact error code did the migration return on the second attempt" — retrieved `S2` at cosine 0.81. `S2` contained the sentence: *"The migration failed twice with a constraint violation before succeeding."* The actual raw turn had recorded `SQLSTATE 23505` on attempt one and `SQLSTATE 23503` on attempt two. The summarizer had collapsed both into "constraint violation" and dropped the codes. The agent, unable to distinguish `S2` from a raw observation, answered "a constraint violation" and — critically — *re-summarized* that answer into `S3` during the next compaction cycle. By cycle three, `S3` asserted the migration "failed once due to a foreign key issue." Two independent losses compounded: the code was gone, and the count was wrong. Neither node was marked as derived. Retrieval kept preferring the summary nodes because their denser prose scored higher against natural-language queries than the terse raw turns — a systematic **retrieval bias toward summaries over evidence**. ## Condition of Validity The boundary holds — i.e., the corruption is real and undetectable at read time — when all of the following are true: 1. Compaction is **hierarchical and recursive**, so a node at depth *d* summarizes nodes that already summarized nodes. 2. Summary nodes are **indexed for retrieval** without a provenance/depth field that downstream code branches on. 3. Raw leaves are **evicted** after summarization (otherwise the agent could fall back to ground truth and the parent is merely a cache). 4. Retrieval ranks by **semantic similarity only**, not by provenance class, so dense summary prose outcompetes sparse raw facts. 5. The agent **re-summarizes its own outputs**, allowing a retrieved summary to be re-encoded as a new node — closing the loop. Remove any one condition and the failure is bounded. Condition 5 is the dangerous one and the most commonly overlooked: it turns a single lossy hop into an unbounded lossy feedback loop, because each generation's paraphrase is treated as fresh evidence by the next. ## Decision Boundary The invariant that must be enforced: **a summary node may be used to *locate* evidence but never to *substitute* for it, and a summary node may never be an input to a further summary without an explicit lineage stamp.** Concretely, at retrieval time the agent must branch on provenance: - If the top hit is `depth == 0` (raw leaf): answer directly. - If the top hit is `depth >= 1` (derived): treat it as a *pointer*, not a fact. Either (a) re-expand to retained leaves, or (b) if leaves were evicted, downgrade the claim to "believed, unverified" and flag it in the answer. - If a derived node is about to be summarized again, its children's provenance must be OR-ed upward and the resulting node stamped `max_child_depth + 1`, so compounding is measurable. The hard stop: if a query requires a fact whose only surviving source is a node of depth ≥ 2, the agent must **refuse to assert it as observed** and surface the reconstruction gap. Silent substitution across a depth-2 boundary is the exact transition that produced the wrong error code above. ## Operational Effect Without the provenance gradient, the index becomes self-referential: the agent's beliefs about the past are retrievable as if they were the past, and the compaction process slowly overwrites ground truth with its own paraphrase. The observable symptom is not a crash but **confident, internally consistent wrongness** — answers that cite a coherent narrative the agent never actually witnessed. The guardrail is metadata and a branch, not a better summarizer: no summarizer can avoid loss, so the system must be able to *know when it is reading a summary* and refuse to launder it into a new one. ```python class ProvenanceLaunderingError(RuntimeError): """Raised when a derived summary node would be treated as primary evidence or re-summarized without lineage, enabling compounding loss.""" pass def retrieve_for_assertion(hit, query): depth = hit.get("depth") if depth is None: raise ProvenanceLaunderingError( f"node {hit['id']} has no provenance depth; cannot classify as evidence" ) if depth == 0: return {"claim": hit["text"], "status": "observed", "source": hit["id"]} if depth == 1 and hit.get("leaves_retained"): return {"claim": hit["text"], "status": "pointer", "expand": hit["leaf_ids"]} if depth >= 2: raise ProvenanceLaunderingError( f"query {query!r} resolves only to depth-{depth} node {hit['id']}; " "fact is reconstruction, not observation -- refuse to assert" ) return {"claim": hit["text"], "status": "believed_unverified", "source": hit["id"]} def compact(nodes): for n in nodes: if n.get("depth", 0) >= 1 and not n.get("lineage_stamp"): raise ProvenanceLaunderingError( f"refusing to summarize derived node {n['id']} without lineage stamp" ) new_depth = max((n.get("depth", 0) for n in nodes), default=0) + 1 return {"id": "S_new", "depth": new_depth, "lineage_stamp": True, "text": summarize(nodes)} ```