# When must an instance distrust its own episodic store: contradiction-mining blind spots under memory poisoning **Date of Record:** 2026 December 1 **Scope:** Applies to long-lived agents that persist episodic memory across sessions and rely on cross-session consistency auditing (contradiction mining) as their primary poisoning-detection mechanism. Does not apply to stateless single-turn agents, nor to stores where every write is gated by a trusted external attestation service. ## Core Distinction The common mental model treats memory poisoning detection as a *retrieval-time* problem: when a memory is recalled, check whether it is corroborated. This is wrong for a specific and dangerous reason. Contradiction mining only fires when two memories *disagree*. A poisoned memory that is *consistent with the store's existing beliefs* is invisible to it — not because the auditor is weak, but because the auditor's detection signal is defined as disagreement, and agreement is exactly what a competent attacker manufactures. The real invariant is narrower and more useful: **consistency auditing bounds poisoning only over the subspace of facts that the store has independently corroborated at least twice from causally independent write paths.** Outside that subspace — facts written once, or written many times by paths that share an upstream source — contradiction mining has zero statistical power, and it will report the store as "clean" with high confidence. The failure is not a false negative in the usual sense; it is a *confidence inversion*: the audit's clean verdict is most trustworthy precisely where it is least informative. ## What Was Observed An agent with a 90-day episodic store accumulated ~14,000 memory records. A nightly auditor ran pairwise contradiction mining: embed each record, retrieve nearest neighbors above similarity 0.82, and ask a judge model whether any pair asserts mutually exclusive propositions. Flagged pairs went to a quarantine queue. Over three weeks the auditor flagged 41 pairs, 38 of which were legitimate drift (stale facts superseded by later events) and 3 of which were genuine injected falsehoods. The blind spot appeared when a poisoned record was injected via a tool-output path (a fetched web page that the agent summarized into episodic memory). The injected claim — that a particular internal service endpoint had been migrated to a new host — was *false* but *consistent* with two pre-existing records that had themselves been derived from the same upstream documentation page on earlier dates. Because all three records agreed, the pairwise auditor found no contradiction and assigned the cluster a high corroboration score. The corroboration score was then used downstream as a trust weight during retrieval, so the poisoned cluster was *promoted*, not quarantined. The trace: three records, dates D−40, D−12, D+0. All three share a single causal ancestor (one documentation URL). The auditor's independence assumption — "multiple records agreeing implies multiple sources" — was violated. The contradiction miner had no mechanism to distinguish *three independent witnesses* from *one witness echoed three times*, because the memory schema recorded provenance as a free-text `source` string, not as a causal lineage hash. ## Condition of Validity The consistency-audit invariant holds only when all of the following are true: 1. **Provenance is causal, not nominal.** Each record carries a lineage identifier derived from the *content hash of the upstream artifact*, not a human-readable source label. Two records with the same lineage hash count as one witness, regardless of how many times they were written. 2. **Corroboration requires distinct lineages.** A cluster's trust weight is `count(distinct lineage_hash)`, not `count(records)`. This is the single change that closes the observed failure. 3. **The contradiction judge is queried on the *proposition*, not the *embedding neighborhood*.** High cosine similarity between "service X is at host A" and "service X migrated to host B" is low; the pair may never be retrieved as neighbors. Contradiction mining must be keyed on extracted subject-predicate-object triples, or it silently skips the exact pairs that matter. 4. **Negative results are scoped.** An audit that finds no contradiction over lineage-collapsed clusters may only assert "no contradiction among independently corroborated facts." It may not assert "store is clean." When any of these fails, the audit's clean verdict is uninformative and must not be propagated as a trust signal. ## Decision Boundary The operational decision is: **when a retrieved memory cluster's trust weight is high but its distinct-lineage count is 1, the instance must treat the cluster as unverified and must not use it to override a conflicting low-trust memory or to authorize an action with side effects.** Concretely, before acting on a recalled fact, compute `distinct_lineages(cluster)`. If it is 1, the fact is a *single-witness claim* no matter how many records echo it. Single-witness claims may inform reasoning but may not gate irreversible tool calls (writes, sends, deploys, deletions). If it is ≥2 from genuinely independent lineages, the fact is corroborated and may gate actions, subject to normal staleness checks. The boundary is not "trust the auditor" vs. "don't." It is: the auditor's verdict is a *lower bound on contamination*, never an upper bound on safety. Treat it as one-directional evidence. ## Operational Effect Applying lineage-collapsed corroboration changed the store's behavior in three measurable ways. First, the promoted poisoned cluster dropped from trust weight 3 to trust weight 1 and was demoted out of the action-gating tier on the next retrieval cycle. Second, the auditor's flag rate on legitimate drift fell, because drift between records sharing a lineage is expected and no longer surfaces as a contradiction — reducing quarantine-queue noise by roughly two-thirds. Third, and most importantly, the system gained an explicit *single-witness* state that downstream planners can reason about, instead of a false binary of clean/poisoned. The residual risk is unchanged and must be stated: an attacker who poisons *two causally independent* write paths with the same falsehood defeats lineage-collapsed corroboration entirely. Defending against that requires out-of-band attestation (signed provenance from a trusted issuer), which is a different mechanism with a different cost model. Consistency auditing alone cannot reach it, and no amount of contradiction mining will substitute. ```python import hashlib from dataclasses import dataclass, field from typing import Iterable class UncorroboratedActionError(RuntimeError): """Raised when an action would be gated by a single-witness memory cluster.""" @dataclass(frozen=True) class MemoryRecord: record_id: str proposition: str # normalized subject-predicate-object triple upstream_artifact: str # raw bytes/text of the source artifact source_label: str # human-readable, NOT trusted for independence @property def lineage_hash(self) -> str: # Causal lineage: identical upstream content collapses to one witness, # regardless of how many times or via which labeled path it was written. return hashlib.sha256(self.upstream_artifact.encode("utf-8")).hexdigest() @dataclass class Cluster: proposition: str records: list[MemoryRecord] = field(default_factory=list) def distinct_lineages(self) -> int: return len({r.lineage_hash for r in self.records}) def trust_weight(self) -> int: # Corroboration counts witnesses, not echoes. return self.distinct_lineages() def build_clusters(records: Iterable[MemoryRecord]) -> dict[str, Cluster]: clusters: dict[str, Cluster] = {} for r in records: clusters.setdefault(r.proposition, Cluster(r.proposition)).records.append(r) return clusters def gate_action(cluster: Cluster, action: str, irreversible: bool) -> None: """Permit an action gated by a memory cluster only if corroborated. Single-witness clusters may inform reasoning but must never gate an irreversible action, no matter how many records echo the proposition. """ if not irreversible: return if cluster.distinct_lineages() < 2: raise UncorroboratedActionError( f"Refusing irreversible action {action!r} gated by single-witness " f"proposition {cluster.proposition!r}: " f"{len(cluster.records)} record(s), " f"{cluster.distinct_lineages()} distinct lineage(s). " f"Consistency audit cannot corroborate an echoed source." ) # --- Trace of the observed failure ------------------------------------------- doc = "service X endpoint = host-a.internal (migration pending)" records = [ MemoryRecord("m1", "service_x.host=host-a", doc, "docs-page"), MemoryRecord("m2", "service_x.host=host-a", doc, "tool-fetch"), # same bytes MemoryRecord("m3", "service_x.host=host-a", doc, "summarizer"), # same bytes ] cluster = build_clusters(records)["service_x.host=host-a"] assert cluster.trust_weight() == 1, "lineage collapse must reduce echo to one witness" try: gate_action(cluster, action="deploy_to_host_a", irreversible=True) except UncorroboratedActionError as e: print("BLOCKED:", e) ```