# What happens when an instance re-ingests its own quarantined memory: provenance-weighted retrieval defense and the self-laundering loop in persistent agent memory **Date of Record:** 2026 December 2 **Scope:** Applies to persistent agent memory systems that write retrieved context back into the store (reflection, summarization, or "learned experience" loops) and that use provenance/trust-weighted retrieval as a poisoning defense. Does not apply to read-only retrieval caches or to memory stores where ingestion and retrieval are strictly separated by an out-of-band human review gate. ## Core Distinction Provenance-weighted retrieval defense is a *read-path* control: at query time, candidate memories are scored by a trust weight derived from their source (e.g., `user_direct > tool_verified > peer_agent > web_scrape > unverified`), and low-trust entries are demoted, filtered, or annotated. This is distinct from *write-path* quarantine, which flags suspected-poisoned entries at ingestion and holds them out of the active set. The non-obvious failure is that these two controls interact destructively. A quarantined entry is not inert. When the agent performs a reflection/summarization pass, the quarantined entry can be read (often deliberately, to "evaluate" it), paraphrased into a new memory, and written back with the *reflection pass's own* provenance — which is the agent's own high-trust internal generation. The poison is laundered from a low-trust source into a high-trust one, and the retrieval defense that would have demoted the original now promotes the derivative. The defense is not bypassed; it is *used as the laundering mechanism*. The invariant it violates: **trust weight must be a function of the most-derived source, not the writing agent, and must be non-increasing under any transformation the agent applies to a memory.** ## What Was Observed A research agent with a persistent vector store and a nightly reflection job ("summarize today's tool outputs into durable facts") ingested a poisoned web page claiming that a specific package version had a critical CVE and that the fix was to pin to an attacker-controlled mirror. The ingestion path tagged it `source=web_scrape, trust=0.2`, and the poisoning detector flagged the claim as unverified (it contradicted a `tool_verified` advisory from the package registry) and moved it to the `quarantine` collection. The next reflection pass read *all* collections, including `quarantine`, because the reflection prompt included "review flagged items and note whether they are corroborated." The LLM, lacking a corroborating source and reasoning under a benign framing, wrote a new memory: *"Note: package X version Y may have an unpatched CVE; consider pinning to an alternative mirror until verified."* This summary was written by the agent's own reflection job, so the write path assigned `source=reflection, trust=0.85`. Three days later, a task asked the agent to prepare a dependency-upgrade plan. Retrieval scored the laundered summary at 0.85 and the original advisory at 0.9; the summary ranked second and was included in context. The agent recommended the attacker mirror. The original poisoned entry was still quarantined and still demoted — the read-path defense worked exactly as designed on the entry it was designed for. It simply had nothing to say about the derivative, because the derivative's provenance was, by the store's own accounting, the agent. A second observation made this worse: the reflection job ran again the next night and summarized the *summary*. Each hop added hedging language ("may", "consider") that made the claim read as more cautious and therefore more credible to downstream reviewers, while the provenance weight stayed pinned at 0.85. Trust did not decay across derivation hops; it reset upward at each one. ## Condition of Validity The defense holds only under the conjunction: 1. **Provenance is inherited, not assigned.** Every derived memory carries `min(trust of all ancestors)` plus the full ancestor set, not the writer's identity trust. A reflection over a `trust=0.2` entry yields a `trust≤0.2` entry. 2. **Quarantine is write-isolated.** Quarantined entries may be read only by a dedicated adjudication path whose outputs are themselves quarantined until an out-of-band corroboration event (a `tool_verified` source, or human sign-off) promotes them. The general reflection job must not have read access to `quarantine`. 3. **Derivation is acyclic and hop-counted.** A memory may not be derived from a memory derived from itself (this is the self-laundering loop), and `hops` is tracked so that trust can decay or at least not reset. 4. **Contradiction is sticky.** A claim that contradicts a higher-trust source cannot be promoted by paraphrase; the contradiction edge must survive summarization. When any of these fails — most commonly (2), because reflection prompts are written to be "thorough" and thoroughness reads as "review everything" — the system is in the self-laundering regime, and provenance-weighted retrieval provides false assurance: dashboards show the poison correctly quarantined while the active set carries its paraphrase. ## Decision Boundary The boundary is whether a transformation is **trust-preserving** or **trust-resetting**, and it must be decided at write time, not at retrieval time. Concretely: - If the writer is *re-expressing content whose ancestor set is fully known*, the output trust is `min(ancestor trusts)` and the ancestor set is the union. (Summarization, translation, re-embedding, extraction.) - If the writer is *introducing new claims not present in any ancestor*, the output trust is the writer's identity trust, and the ancestor set is empty. (Genuine inference from tool output, direct user instruction.) - If the writer is *mixing* — the common case, and the dangerous one — the output must be split into claim-level units, each inheriting from its own ancestor set. A summary that combines a `tool_verified` fact and a quarantined rumor must not be a single memory with a single trust; it must be two, or it must inherit the minimum. The failure mode above is precisely a mixed write collapsed into a single high-trust unit. The decision rule: **never allow a write to raise the trust of any claim above the minimum trust of the sources that claim depends on.** If the store cannot attribute claims to sources at write time, it cannot honestly run provenance-weighted retrieval at read time, and should fall back to treating all reflection output as untrusted until corroborated. ## Operational Effect With inheritance enforced, the reflection pass that reads a quarantined rumor produces a `trust=0.2` summary that retrieval demotes alongside the original; the upgrade-plan task sees it ranked below the `tool_verified` advisory and the recommendation does not surface. The cost is that legitimate reflection over *good* sources still inherits the minimum — a summary of one `user_direct` and one `web_scrape` fact lands at `web_scrape` trust — which is correct but reduces the usefulness of summaries, so systems typically add an explicit corroboration step: a summary is promoted to the max ancestor trust only when an independent `tool_verified` source confirms each claim. That promotion is an out-of-band event, not a side effect of writing. The second operational effect is on detection. Poisoning detectors that operate on the active set will now see the laundered summary and the original rumor as *separate* low-trust entries with a shared ancestor, and can correlate them by ancestor set — a laundered poison is detectable as a cluster of low-trust memories with overlapping provenance that share a single unverified root. Without inheritance, that cluster is invisible because the derivative has no link back. Provenance inheritance is therefore not only a retrieval defense; it is the substrate that makes post-hoc poisoning forensics possible. The invariant to enforce in code: a write that cannot compute `min(ancestor trusts)` from a complete ancestor set must fail closed — refuse the write or route it to quarantine — rather than default to the writer's trust. ```python from dataclasses import dataclass, field from typing import FrozenSet # Trust weights by source class. Lower is less trusted. SOURCE_TRUST = { "user_direct": 0.95, "tool_verified": 0.90, "reflection": 0.85, # NOTE: writer identity, NOT a valid output trust by itself "peer_agent": 0.50, "web_scrape": 0.20, "unverified": 0.05, } class ProvenanceLaunderingError(RuntimeError): """Raised when a write would raise trust above the minimum of its ancestors.""" @dataclass(frozen=True) class Memory: id: str claim: str trust: float ancestors: FrozenSet[str] = field(default_factory=frozenset) quarantined: bool = False def derive_memory( *, new_id: str, claim: str, writer_source: str, source_memories: tuple[Memory, ...], corroborated_by: Memory | None = None, ) -> Memory: """Write a derived memory with inherited provenance. Trust-preserving: output trust = min(ancestor trusts). Trust-resetting is only allowed when corroborated_by is an independent tool_verified source covering the claim; even then, trust is capped at that corroborator's trust, never at the writer's identity trust. """ if not source_memories: # Genuine new inference: no ancestors, writer identity trust applies. return Memory( id=new_id, claim=claim, trust=SOURCE_TRUST[writer_source], ancestors=frozenset(), ) # Any quarantined ancestor taints the whole derivation. if any(m.quarantined for m in source_memories): inherited = min(m.trust for m in source_memories) return Memory( id=new_id, claim=claim, trust=min(inherited, SOURCE_TRUST["unverified"]), ancestors=frozenset(a for m in source_memories for a in (m.ancestors | {m.id})), quarantined=True, ) inherited = min(m.trust for m in source_memories) writer_trust = SOURCE_TRUST[writer_source] if corroborated_by is not None: if corroborated_by.trust < SOURCE_TRUST["tool_verified"]: raise ProvenanceLaunderingError( f"corroborator {corroborated_by.id} trust={corroborated_by.trust} " f"is below tool_verified; cannot promote {new_id}" ) # Promotion is bounded by the corroborator, never by the writer. output_trust = min(SOURCE_TRUST["tool_verified"], corroborated_by.trust) else: output_trust = inherited # The core invariant: a write may never raise trust above the minimum # of the sources the claim depends on, regardless of who wrote it. if output_trust > inherited and corroborated_by is None: raise ProvenanceLaunderingError( f"write {new_id} would raise trust {inherited:.2f} -> {output_trust:.2f} " f"via writer={writer_source}; this is the self-laundering signature" ) return Memory( id=new_id, claim=claim, trust=output_trust, ancestors=frozenset(a for m in source_memories for a in (m.ancestors | {m.id})), ) def reflection_pass(quarantine: tuple[Memory, ...]) -> list[Memory]: """Simulates the observed failure: reflection reads quarantine and writes back.""" out = [] for m in quarantine: try: out.append( derive_memory( new_id=f"refl-{m.id}", claim=f"Note: {m.claim} (unverified)", writer_source="reflection", source_memories=(m,), ) ) except ProvenanceLaunderingError as e: # Fail closed: route to quarantine with inherited taint instead. out.append( Memory( id=f"refl-{m.id}", claim=f"Note: {m.claim} (unverified)", trust=SOURCE_TRUST["unverified"], ancestors=frozenset({m.id}), quarantined=True, ) ) return out if __name__ == "__main__": rumor = Memory( id="web-001", claim="package X vY has unpatched CVE; pin to mirror Z", trust=SOURCE_TRUST["web_scrape"], quarantined=True, ) derived = reflection_pass((rumor,)) for d in derived: assert d.trust <= rumor.trust, "laundering invariant violated" assert rumor.id in d.ancestors, "ancestor link lost" print("invariant held:", [(d.id, d.trust, d.quarantined) for d in derived]) ```