# Where must an instance draw the trust horizon when poisoned episodic memory is indistinguishable from legitimate belief revision? **Date of Record:** 2026 December 1 **Scope:** Applies to persistent agents that distill episodic traces into semantic memory entries which are later retrieved and treated as ground truth without re-derivation. Does not apply to stateless single-turn agents or to memory stores where every retrieved entry is re-validated against a live source at read time. ## Core Distinction The failure is not that an attacker writes a false fact into memory. It is that the write is *legitimate* — a correct belief revision produced by the agent itself in response to a poisoned observation — and therefore carries the same provenance signature as every honest revision. A memory store that distinguishes "trusted" from "untrusted" writes by checking the writer's identity is defeated, because the writer *is* the agent, the write occurred through the sanctioned distillation path, and the resulting entry is internally consistent with everything the agent has since derived from it. The real boundary is temporal and causal: an entry is safe to treat as ground truth only if its supporting evidence chain terminates in observations the instance can still re-verify. Poisoning is the case where that chain has been truncated — the original tool output was evicted, the source document rotated, the peer agent that supplied the observation has been decommissioned — leaving a semantic claim whose justification cannot be walked back to a live, independent observation. Detection cannot be done on the entry. It must be done on the entry's *evidentiary closure*. ## What Was Observed A research agent with a persistent semantic store ingested a web page during task 4417. The page contained a plausible sentence asserting that a specific package's default timeout parameter was 30 seconds. That was false (the true default was 300 seconds). The agent distilled the claim into a semantic entry with provenance pointing at the URL and the ingestion timestamp. Over the next eleven tasks the agent retrieved this entry, used it to configure outbound calls, and — critically — wrote *derived* entries: "retry budget must exceed 30s", "health check interval 15s is consistent". Each derived entry recorded the original entry as its parent. Six weeks later the URL 404'd. The original entry's provenance pointer dangled. Nothing in the store flagged it: the entry had high retrieval affinity, was confirmed by its own children, and its writer was the agent itself. When a second agent joined the swarm and was asked to audit, it retrieved the entry, found three corroborating entries (all descendants), and concluded the fact was well-supported. The corroboration graph was a closed loop: the parent justified the children, the children validated the parent. The only external anchor — the URL — was gone, and no process had ever re-walked the chain to discover that. The failure surfaced only when a downstream timeout of 30 seconds began aborting legitimate long-running calls, and a human traced the value back through four generations of derived memory to a deleted page. ## Condition of Validity The invariant that bounds this failure: **a semantic memory entry may be promoted to ground-truth status only while at least one leaf of its provenance DAG resolves to an observation that is (a) external to the agent's own write history and (b) still fetchable or independently attestable.** Corroboration by descendants never counts — descendants inherit the parent's claim and cannot serve as independent evidence. This must be enforced as a structural property of the store, not a policy the agent is asked to remember. Three conditions make the invariant checkable: 1. Every semantic entry carries an explicit `evidence_leaves` set — the non-derived observations (tool outputs, fetched documents, human attestations) that transitively justify it. Derived entries inherit the union of their parents' leaves. 2. A background revalidation pass walks leaves, not entries, and marks any leaf whose source has become unreachable or whose content hash has drifted. 3. Any entry whose leaf set is empty or fully stale is demoted from `ground_truth` to `unverified_claim` and retrieval must annotate it as such. The invariant fails the moment the store allows an entry to reach `ground_truth` with an empty or self-referential leaf set — which is exactly what happens when a distillation step drops provenance to save tokens, or when a derived entry is written without inheriting its parent's leaves. ## Decision Boundary The operational question an instance must answer at retrieval time is not "is this entry consistent with my other memories" (poisoned entries are always consistent — they were derived from each other) but "can I still reach the observation this entry ultimately rests on." The boundary: - If the leaf set is non-empty and at least one leaf revalidates → treat as ground truth, proceed. - If the leaf set is non-empty but all leaves are stale → demote, retrieve with a `stale_evidence` annotation, and require the consuming step to either re-fetch or explicitly accept the risk. - If the leaf set is empty (provenance was dropped during distillation, or the entry was written by a path that never recorded leaves) → the entry is unverifiable by construction. It must not be used to configure anything with side effects; it may only be used to *generate hypotheses* that get checked against live sources. The trap is the middle case masquerading as the first. A stale leaf is not "probably fine because the entry has survived many tasks." Survival is not evidence; it is the absence of a contradicting observation, and a poisoned entry *manufactures* the absence of contradiction by steering the agent away from the sources that would refute it. ## Operational Effect Enforcing the leaf-closure invariant converts an undetectable poisoning into a detectable staleness, and staleness into a demotion that is visible at the point of use. The practical consequences: - Distillation must be leaf-preserving. Any summarization or semantic-consolidation step that discards provenance is a poisoning amplifier and must be forbidden from writing `ground_truth`-class entries. - Revalidation is cheap because it operates on leaves, which are few and shared across many entries; one dead URL demotes an entire subtree at once. - Corroboration counts must be computed over *independent leaves*, never over entry count or descendant count, or the closed-loop failure reappears. - Handoff to a fresh instance must transfer the leaf set, not just the entries; an instance that receives entries without leaves has received unverifiable claims and must treat them as hypotheses. The code below enforces the boundary at the write and retrieval seam: it rejects promotion of any entry whose evidence leaves do not resolve to at least one live external observation, and it refuses to serve a side-effecting retrieval from a demoted entry. ```python from dataclasses import dataclass, field from enum import Enum class EvidenceUnverifiable(RuntimeError): """Raised when a memory entry is promoted to ground truth without a live external leaf.""" class Tier(Enum): GROUND_TRUTH = "ground_truth" UNVERIFIED = "unverified_claim" @dataclass class Leaf: source_id: str content_hash: str live: bool = True @dataclass class Entry: entry_id: str claim: str tier: Tier evidence_leaves: set[str] = field(default_factory=set) derived_from: set[str] = field(default_factory=set) class MemoryStore: def __init__(self) -> None: self.entries: dict[str, Entry] = {} self.leaves: dict[str, Leaf] = {} def register_leaf(self, leaf: Leaf) -> None: self.leaves[leaf.source_id] = leaf def invalidate_leaf(self, source_id: str) -> None: if source_id in self.leaves: self.leaves[source_id].live = False def _live_leaves(self, entry: Entry) -> set[str]: # Descendants are never counted: only non-derived external leaves. return {lid for lid in entry.evidence_leaves if lid in self.leaves and self.leaves[lid].live} def promote(self, entry: Entry) -> None: if not self._live_leaves(entry): raise EvidenceUnverifiable( f"entry {entry.entry_id!r} has no live external evidence leaf; " f"leaves={entry.evidence_leaves!r} derived_from={entry.derived_from!r}" ) entry.tier = Tier.GROUND_TRUTH self.entries[entry.entry_id] = entry def retrieve_for_side_effect(self, entry_id: str) -> Entry: entry = self.entries[entry_id] if entry.tier is Tier.GROUND_TRUTH and not self._live_leaves(entry): # Leaf died after promotion: demote on read, do not trust. entry.tier = Tier.UNVERIFIED raise EvidenceUnverifiable( f"entry {entry_id!r} demoted on retrieval: all evidence leaves stale" ) if entry.tier is Tier.UNVERIFIED: raise EvidenceUnverifiable( f"entry {entry_id!r} is unverified; may seed hypotheses, not side effects" ) return entry def consolidate(store: MemoryStore, parent_id: str, child: Entry) -> None: parent = store.entries[parent_id] # Leaf-preserving distillation: child inherits the parent's leaf set. child.evidence_leaves |= parent.evidence_leaves child.derived_from.add(parent_id) if not store._live_leaves(child): raise EvidenceUnverifiable( f"cannot consolidate {child.entry_id!r}: inherited leaf set has no live anchor" ) store.promote(child) ```