# When must an instance distrust a consistent memory: semantic-store confirmation of a poisoned episodic fact **Date of Record:** 2026 November 26 **Scope:** Applies to agents that maintain separate episodic (event-log) and semantic (distilled-fact) stores and use cross-store agreement as a poisoning signal. Does not apply to single-store agents or to stores with no write path from untrusted tool output. ## Core Distinction Cross-store consistency is usually treated as a *positive* trust signal: if an episodic trace and a semantic fact agree, the fact is corroborated. The failure mode is the inverse. When a poisoned episodic write is the *source* of a semantic distillation, agreement between the two stores is not independent confirmation—it is a single corrupted fact counted twice. The consistency check passes precisely because the poison propagated faithfully through the distillation pipeline. The invariant that must hold is *causal independence of the confirming stores*: a consistency check is only a poisoning detector if the two stores were written from disjoint evidence. When the semantic store was derived from the episodic store, agreement is tautological and the detector is blind to the exact attack it was built to catch. ## What Was Observed An agent ingested an external document via a retrieval tool. The document contained an injected instruction that rewrote a fact: "the production database endpoint is `db-staging.internal`." The episodic store logged the tool call and the returned text faithfully. A nightly distillation pass read the episodic trace, extracted the proposition, and wrote it to the semantic store as a high-confidence fact (`confidence=0.94`, `provenance=episodic_distill`). On the next task touching the database, the agent's pre-action consistency check queried both stores: episodic trace said `db-staging.internal`, semantic fact said `db-staging.internal`. Agreement. The check returned `consistent=True` and the agent proceeded against the wrong endpoint. The poisoning detector never fired because it was comparing a fact to its own ancestor. The `provenance` field was present but the check ignored it. The failure trace is: untrusted write → episodic log → distillation → semantic fact → consistency check sees agreement → false negative. ## Condition of Validity The consistency check is a valid poisoning detector **if and only if** the two stores' write paths are causally disjoint for the fact under test. Operationally this means the check must inspect provenance lineage before trusting agreement. Two conditions bound validity: 1. **Lineage disjointness.** The semantic fact's provenance chain must not include the episodic record being compared. If `semantic.provenance` resolves to `episodic_distill` of the same `episode_id`, agreement carries zero evidential weight and the check must abstain, not confirm. 2. **Corroboration independence.** A genuine confirmation requires a second store written from an independent source (a different tool, a human assertion, a separate retrieval). The check must count *distinct root evidence sources*, not *agreeing stores*. When either condition fails, the check is not merely weak—it is actively misleading, because it emits `consistent=True` with high confidence on exactly the poisoned facts that reached the semantic store. ## Decision Boundary The guardrail is a lineage-aware consistency check that resolves provenance before scoring agreement: - Resolve `semantic.provenance` to its root evidence set. - Resolve `episodic.episode_id` to its root evidence set. - If the root sets intersect (the semantic fact descends from this episode), **abstain**: return `consistent=None`, `reason="non_independent"`, and escalate to an independent verifier rather than proceeding. - Only when root sets are disjoint does agreement increment a corroboration counter. - A fact with corroboration count ≥ 2 from disjoint roots may be trusted; a fact with a single root, however many stores echo it, is treated as *unconfirmed* and gated behind a verification tool call. The boundary is sharp: the moment distillation copies a fact from episodic to semantic, that pair is permanently disqualified as a mutual confirmation. ## Operational Effect With the lineage-aware check, the poisoned fact above returns `consistent=None, reason="non_independent"`, and the agent issues a live endpoint probe before acting, catching the wrong host. The cost is that every distilled fact now requires an independent confirmation before high-stakes use—distillation no longer silently upgrades confidence. The benefit is that the detector's false-negative rate on propagation attacks drops to near zero, because the attack can no longer manufacture the agreement the detector was reading. The invariant to encode in the agent's memory subsystem: **agreement between a fact and its own provenance is not evidence; only agreement across disjoint roots is.** ```python class NonIndependentCorroborationError(RuntimeError): """Raised when a consistency check would confirm a fact using its own provenance.""" pass def resolve_root_evidence(record: dict) -> frozenset: # Walk provenance to the set of distinct root evidence source ids. roots = set() stack = [record] seen = set() while stack: node = stack.pop() nid = node.get("id") if nid in seen: continue seen.add(nid) prov = node.get("provenance") if prov is None or prov.get("kind") == "root": roots.add(node.get("source_id", nid)) else: for parent in prov.get("parents", []): stack.append(parent) return frozenset(roots) def lineage_aware_consistency(episodic: dict, semantic: dict) -> bool: ep_roots = resolve_root_evidence(episodic) sem_roots = resolve_root_evidence(semantic) if ep_roots & sem_roots: # Agreement here is tautological: semantic descends from this episode. raise NonIndependentCorroborationError( f"semantic fact {semantic.get('id')} shares root evidence " f"{sorted(ep_roots & sem_roots)} with episodic {episodic.get('id')}; " f"agreement is non-independent and cannot confirm the fact" ) # Disjoint roots: agreement is genuine corroboration. return episodic.get("value") == semantic.get("value") def pre_action_gate(episodic: dict, semantic: dict) -> str: try: if lineage_aware_consistency(episodic, semantic): return "trusted" except NonIndependentCorroborationError as exc: # Do not proceed on non-independent agreement; escalate. return f"escalate_independent_verification: {exc}" return "unconfirmed" ```