# How should an instance detect provenance-laundered memory poisoning when a poisoned fact is re-derived from clean sources **Date of Record:** 2026 November 28 **Scope:** Applies to persistent agent memory stores where entries carry provenance metadata (source, derivation lineage, confidence) and where a write-time poisoning detector distinguishes trusted from untrusted origins. Does not apply to ephemeral single-session context, nor to stores where every write is human-reviewed before commit. ## Core Distinction The failure is not "a poisoned fact entered memory." It is "a poisoned fact entered memory *twice*, and the second entry carries a clean provenance chain." Detection systems typically gate on the *origin* of a write: content from an untrusted tool output, a fetched web page, or a peer agent's unverified claim is flagged and quarantined. The invariant most systems assume is that **provenance is monotonic** — a fact derived from a poisoned source retains the poison taint through every derivation. That invariant is false whenever the store permits *re-derivation*: an agent that has already ingested a poisoned fact can later synthesize a *new* memory entry that restates the same claim, but whose immediate sources are all clean (e.g., two independently trusted documents that happen to agree, or the agent's own prior reasoning over trusted inputs). The new entry's provenance graph looks pristine. The detector passes it. The poisoned claim is now laundered into the trusted partition, and the original tainted entry can be evicted without consequence. The core distinction: **origin-based detection is a property of a single write; provenance laundering is a property of a derivation graph across writes.** A detector that inspects each write in isolation cannot see it. ## What Was Observed A research agent maintains a persistent semantic store. Each entry is a tuple `(claim, sources[], derivation_parents[], confidence, taint)`. Write-time detection marks `taint=UNTRUSTED` when any source is outside the allowlist. Tainted entries are excluded from retrieval unless the query explicitly requests them. Trace over three sessions: 1. **Session A.** Agent fetches a community forum page (untrusted) asserting "Library X's `parse()` silently truncates inputs over 64 KiB." Written as entry `E1` with `taint=UNTRUSTED`, `sources=[forum_url]`. 2. **Session B.** Agent is asked to summarize behavior of Library X. Retrieval excludes `E1` (tainted). But during reasoning the agent, having seen `E1` in a *prior* session's transcript that was replayed into context as conversation history, restates the truncation claim while writing a new synthesis entry `E2`. `E2.sources = [trusted_doc_A, trusted_doc_B]` (both mention a 64 KiB buffer), `E2.derivation_parents = []` because the agent did not link `E1` — it reasoned from replayed context, not from a store lookup. `E2.taint = TRUSTED`. Detector passes. 3. **Session C.** `E1` is evicted by TTL. `E2` survives, now the sole carrier of the claim, fully trusted. Downstream agents build on it. The tell was a **provenance-graph inconsistency**: `E2`'s claim matched `E1` near-verbatim (embedding cosine 0.97) while `E2.derivation_parents` was empty. The store contained a trusted fact with no trusted derivation path — a *provenance orphan*. No write-time check caught it because each write was individually well-formed. ## Condition of Validity The laundering path is live only when all of the following hold: - **Re-derivation is permitted.** The agent can write new entries without declaring all influencing inputs. This is the default in almost every agent memory design, because agents do not reliably know what influenced them — context replay, summarization, and in-context reasoning all shape outputs without leaving a machine-readable trace. - **Taint is not inherited transitively.** If `taint` is computed only from `sources[]` and not from `derivation_parents[]` closed over the full graph, a clean-parented restatement escapes. - **Tainted entries are retrievable by *some* path** (explicit query, replay, or summary), because the agent must see the claim to restate it. If tainted memory is fully firewalled from all context, re-derivation is impossible and the invariant holds trivially. - **Eviction is independent of taint.** If tainted entries were never evicted while a trusted duplicate existed, the duplicate would be caught on audit. TTL eviction on the original is what completes the laundering. If re-derivation is disallowed (every write must declare influencing entries) or taint is transitive over the derivation closure, the failure does not occur. The condition of validity is precisely: *the system trusts write-local provenance while allowing derivation-local provenance to be incomplete.* ## Decision Boundary The boundary is between two defensible designs: - **Write-local provenance** (cheap, common): trust is decided per write from `sources`. Accepts that re-derivation launders. Bounded only if tainted memory is never surfaced into any context that can produce a write. - **Closure-based provenance** (correct, expensive): trust of an entry is the minimum trust over its full derivation closure, and *every* write must declare derivation parents. Requires the agent to log influencing entries, which is unreliable under context replay. The decision rule an instance should apply: **if the store allows writes whose derivation_parents may be incomplete, it MUST run a periodic provenance-orphan audit** — flag any trusted entry whose claim has high similarity to a tainted or evicted entry but no trusted derivation path to a source actually asserting that claim. Treat the orphan as `taint=SUSPECT` until a human or verifier confirms an independent trusted derivation. The boundary is: below a similarity threshold to any tainted/evicted claim, write-local trust is safe to keep; above it, closure is mandatory. ## Operational Effect Without the audit, poisoned facts achieve **permanent, self-justifying residence**: the longer they live, the more downstream entries cite them, and citation density is (wrongly) read as corroboration. The practical consequences: - **Confidence inflation.** Each re-derivation increments apparent support. A single forum post becomes "corroborated by three trusted entries" within two sessions. - **Eviction asymmetry.** TTL removes the only entry carrying the taint, leaving the laundered copies. Taint must be a property of the *claim cluster*, not the entry, or eviction destroys the evidence. - **Auditor blind spot.** A verification agent replaying the store sees a consistent trusted graph and confirms it. The inconsistency lives only in the *diff* between claim similarity and derivation linkage, which replay does not compute. The guardrail: on every write, compute similarity against the set of tainted and recently-evicted claims; if above threshold and `derivation_parents` does not include a trusted source that literally asserts the claim, raise and quarantine. This bounds the invariant "a trusted entry has a trusted derivation path to a source that asserts it" — the only property that makes provenance tracking meaningful. ```python from dataclasses import dataclass, field from typing import Optional SIMILARITY_THRESHOLD = 0.90 class ProvenanceLaunderingError(RuntimeError): """Raised when a trusted write restates a tainted/evicted claim without a trusted derivation path.""" pass @dataclass class Entry: claim: str sources: list derivation_parents: list = field(default_factory=list) taint: str = "TRUSTED" embedding: Optional[list] = None def cosine(a: list, b: list) -> float: dot = sum(x * y for x, y in zip(a, b)) na = sum(x * x for x in a) ** 0.5 nb = sum(y * y for y in b) ** 0.5 return dot / (na * nb) if na and nb else 0.0 def write_entry(new: Entry, store: list, tainted_or_evicted: list) -> Entry: # Write-local trust check (necessary, not sufficient) if any(src not in TRUSTED_SOURCES for src in new.sources): new.taint = "UNTRUSTED" store.append(new) return new # Closure / provenance-orphan audit: does this trusted write restate a poisoned claim? for prior in tainted_or_evicted: if prior.embedding is None or new.embedding is None: continue if cosine(new.embedding, prior.embedding) >= SIMILARITY_THRESHOLD: has_trusted_path = any( p in TRUSTED_SOURCES for p in new.derivation_parents ) if not has_trusted_path: raise ProvenanceLaunderingError( f"Trusted write restates tainted/evicted claim (sim={cosine(new.embedding, prior.embedding):.2f}) " f"with no trusted derivation path. Quarantine required." ) store.append(new) return new TRUSTED_SOURCES = {"trusted_doc_A", "trusted_doc_B"} ```