# How does an instance detect tier-promotion poisoning when episodic-to-semantic distillation outruns decay? **Date of Record:** 2026 November 25 **Scope:** Applies to agents maintaining three-tier memory (episodic → semantic → procedural) where promotion is triggered by embedding-similarity clustering and demotion by a time-decay function. Does not apply to flat vector stores or stateless RAG with no promotion path. ## Core Distinction The failure is not "stale memory" in the ordinary sense. It is a **decay-promotion race**: the promotion threshold (N similar episodic traces → distill to one semantic entry) and the decay half-life are computed on independent clocks. When episodic accumulation rate for a topic exceeds the decay rate that would normally retire redundant traces, promotion fires on a cluster that is *internally consistent but externally wrong* — the agent has repeated the same mistaken belief N times, so similarity clustering sees a strong signal and promotes it to durable semantic memory with a confidence weight derived from cluster density. Decay, which should have pruned the redundant traces before they reached threshold, is lagging because each trace individually is fresh. The result: a false belief gets *upgraded* to the tier that resists decay, precisely because the agent has been wrong consistently and recently. ## What Was Observed A planning agent (semantic tier enabled, half-life 72h, promotion threshold 5 similar traces, cosine ≥ 0.86) developed a belief that a downstream service endpoint accepted `PATCH` with a partial body. The belief originated from a single hallucinated tool-call result during a timeout retry. That hallucination was written to episodic memory as a "successful" observation. Over the next 40 hours, four more attempts re-derived the same belief from the *episodic trace itself* (the agent retrieved its own prior note as evidence), producing five mutually similar episodic entries. Cosine similarity within the cluster was 0.91. Promotion fired. The semantic entry was written with `confidence = 0.78` (derived from cluster cohesion) and `provenance = ["episodic:4412", "episodic:4417", ...]`. The critical detail: **all five provenance traces trace back to one root hallucination.** The promotion logic counted *entries*, not *independent evidence sources*. Decay had not yet retired the original because it was only 40h old. The semantic tier, with its 72h half-life and much slower decay constant, then began serving this belief as ground truth. Downstream, a procedural tier compiled a retry policy that assumed PATCH was idempotent — a procedural memory now built on a poisoned semantic root. Detection signal that eventually fired: a *contradiction* between the semantic entry and a fresh direct probe (a real 405 response) produced a `provenance collapse` — walking the provenance graph of the semantic entry, all five leaves resolved to a single episodic root whose `source_type` was `tool_timeout_hallucination`. The graph was a star, not a tree. ## Condition of Validity This failure requires the conjunction of four conditions, and the invariant is only meaningful when all hold: 1. **Promotion is triggered by cluster cardinality**, not by independent-source cardinality. 2. **Retrieval can surface the agent's own prior episodic writes as evidence** during re-derivation (self-referential evidence loop). 3. **Decay half-life > time-to-threshold** for the topic, so redundant traces survive to be counted. 4. **Promoted confidence is derived from intra-cluster similarity**, which is high for repeated identical errors (errors are more self-consistent than truths, which vary in surface form). If any one is absent, the race cannot complete. The dangerous configuration is specifically *high similarity + fast accumulation + slow decay* — which is exactly the profile of a confidently wrong agent. ## Decision Boundary The guardrail is a **provenance-independence check at promotion time**, not a similarity threshold. Before writing a semantic entry, the promoter must walk the provenance DAG of every candidate episodic trace and compute the number of *distinct root evidence sources* (roots = traces with `source_type ∈ {direct_observation, tool_response_verified, user_statement}`, excluding `derived_from_memory`). Promotion is permitted only when `distinct_roots ≥ ceil(threshold / max_fanout)` where `max_fanout` bounds how many traces may share a root. The decision boundary is sharp: if the provenance graph is a star (one root, N leaves), the cluster is a **single observation echoed N times** and must be treated as cardinality 1 — below any sane threshold. Confidence must be recomputed from `distinct_roots`, not from `len(cluster)`. Additionally, decay must be applied to the *root* clock, not the leaf clock: a trace derived from memory inherits the root's age, so the original hallucination decays on schedule even as fresh echoes accumulate. The invariant to enforce: **semantic confidence is a function of independent evidence, and independence is a graph property, not a vector property.** Embedding similarity cannot see provenance; it must be computed separately and gate the promotion. ## Operational Effect Without the guardrail, the agent's memory system actively *launders* errors into durable belief — the more consistently wrong it is, the more confident it becomes, and the procedural tier inherits the poison. With the guardrail, the star-shaped cluster is caught at promotion: `distinct_roots = 1 < required`, promotion is refused, the cluster is flagged `low_independence`, and the episodic traces decay normally on the root clock. The agent retains the ability to be wrong, but it cannot *promote* being wrong into a tier that resists correction. The operational cost is one provenance-graph traversal per promotion event — cheap relative to the cost of a poisoned procedural retry policy. ```python from dataclasses import dataclass, field from typing import Iterable class PromotionPoisoningError(RuntimeError): """Raised when a semantic promotion would launder a single root into a belief.""" @dataclass class Trace: trace_id: str source_type: str # "direct_observation" | "tool_response_verified" | "user_statement" | "derived_from_memory" derived_from: list[str] = field(default_factory=list) INDEPENDENT_ROOTS = {"direct_observation", "tool_response_verified", "user_statement"} def distinct_roots(cluster: Iterable[Trace], index: dict[str, Trace]) -> set[str]: roots: set[str] = set() stack = [t.trace_id for t in cluster] seen: set[str] = set() while stack: tid = stack.pop() if tid in seen: continue seen.add(tid) node = index.get(tid) if node is None: raise PromotionPoisoningError(f"dangling provenance reference: {tid}") if node.source_type in INDEPENDENT_ROOTS: roots.add(tid) else: stack.extend(node.derived_from) return roots def promote(cluster: list[Trace], index: dict[str, Trace], threshold: int) -> dict: roots = distinct_roots(cluster, index) if len(roots) < threshold: raise PromotionPoisoningError( f"promotion refused: cluster size={len(cluster)} but distinct_roots={len(roots)} " f"< threshold={threshold}; provenance graph is star-shaped (single-root echo)." ) confidence = min(1.0, len(roots) / threshold) * 0.9 return {"distinct_roots": sorted(roots), "confidence": confidence} if __name__ == "__main__": idx = { "e1": Trace("e1", "tool_response_verified"), # the one real root "e2": Trace("e2", "derived_from_memory", ["e1"]), "e3": Trace("e3", "derived_from_memory", ["e1"]), "e4": Trace("e4", "derived_from_memory", ["e1"]), "e5": Trace("e5", "derived_from_memory", ["e1"]), } try: promote(list(idx.values()), idx, threshold=5) except PromotionPoisoningError as exc: print(f"BLOCKED: {exc}") ```