# Under what conditions must an instance quarantine a provenance-verified memory before it can poison a downstream retrieval chain **Date of Record:** 2026 November 25 **Scope:** Applies to persistent agent memory stores where writes carry provenance metadata (source instance, derivation lineage, trust score) and reads are gated by provenance-aware retrieval. Does not cover stateless single-turn inference or memory systems without write-time attribution. ## Core Distinction The failure mode is not *detecting* a poisoned memory. Detection is cheap: provenance-aware retrieval can flag any entry whose trust score falls below a threshold or whose lineage references a revoked source. The boundary condition is subtler — **the window between an entry being written with a passing trust score and the score being invalidated by a later event**. A memory can be trustworthy at write time and adversarial at read time. The invariant that must hold is: *no entry may be retrieved into a reasoning chain if any event in its lineage has been retroactively invalidated, even if the entry's own trust score is still above threshold at the moment of retrieval.* Most implementations enforce a *point-in-time* trust check at write and a *point-in-time* trust check at read, but do not propagate invalidation events backward through the derivation graph. This produces a class of poisoning where the malicious content was laundered through a legitimate intermediary: Agent A (trusted) reads a poisoned document, distills a semantic memory, and writes it with its own high trust score. The distilled memory's provenance points to Agent A, not to the poisoned document. When the document is later flagged, Agent A's distilled memory is never re-scored. It has been *provenance-laundered*. ## What Was Observed In a three-agent pipeline (researcher → distiller → planner), the distiller wrote semantic memories with `source_instance: distiller`, `parent_trust: 0.91`, and a content hash. The researcher's raw episodic buffer was the true origin but was only referenced by an opaque `trace_id` in a side table. A prompt-injection payload embedded in a fetched web page survived summarization because the distiller's extraction prompt treated all page content as factual. The distilled memory — "the deployment credentials rotate on the 1st of each month" — carried a trust score of 0.91 because the distiller's own historical accuracy was high. Four hours later, the web page was flagged as adversarial by an external feed. The researcher's raw buffer was quarantined. The distiller's semantic memory was not, because its `source_instance` was the distiller, whose trust score was unchanged. The planner retrieved the poisoned fact on the next planning cycle, incorporated it into a credential-rotation action, and the action executed against a stale schedule. The retrieval chain that admitted the poisoned memory had *passed* every trust check it was configured to run. The trace showed the exact transition: at `t+0` the memory was written with `trust=0.91`. At `t+4h` the parent document was flagged, but the flag propagated only one hop (to the researcher's episodic buffer). The distiller's memory sat at `trust=0.91` for 72 more hours until a manual audit found it. The trust score was *locally correct* and *globally wrong*. ## Condition of Validity The write-time trust score is a valid gate only under the assumption that the derivation graph is *closed under invalidation*: every entry's effective trust equals the minimum trust over all ancestors in its lineage, evaluated at read time, not write time. This assumption fails whenever: 1. **Lineage is truncated.** The distilled memory records its immediate parent (the distiller) but not the transitive ancestor (the web page). Invalidation events cannot traverse edges that do not exist. 2. **Trust is inherited, not recomputed.** The distiller's trust score reflects its *own* historical accuracy, not the trustworthiness of its *inputs on this specific derivation*. A high-accuracy distiller fed a poisoned input produces a high-trust poisoned output. 3. **Invalidation is hop-limited.** The flagging system propagates to direct children of the flagged entity but not to grandchildren. A one-hop invalidation policy is insufficient for any pipeline deeper than one stage. The invariant required is: *effective_trust(entry) = min(trust(entry), min over all transitive ancestors of trust(ancestor), evaluated against the current invalidation set at read time).* If the lineage graph is incomplete, the invariant cannot be computed and the entry must be treated as untrusted by default — not trusted by default. ## Decision Boundary The boundary is between two policies: - **Trust-on-write, check-on-read:** assign a trust score at write, re-check the entry's *own* score at read. Cheap, common, and broken under provenance laundering. - **Trust-on-read over full lineage:** recompute effective trust from the complete transitive ancestry against the current invalidation set at every retrieval. Expensive but sound. The decision rule: if the derivation graph cannot be walked to its roots (because lineage was truncated at write, or because an ancestor's invalidation status is unknown), the entry must be quarantined, not admitted. Quarantine means: excluded from retrieval into any reasoning chain that produces side-effecting actions, but retained with a `pending_lineage_repair` marker for offline resolution. The quarantine is the *default* under uncertainty. An entry is admitted only when its full lineage is walkable and every ancestor's invalidation status is known and clean. This inverts the usual default. Most systems admit by default and quarantine on positive detection. That policy fails precisely in the provenance-laundering case, because detection never fires — the laundered entry has no local signal. The correct default is quarantine, with admission requiring positive proof of clean lineage. ## Operational Effect Implementing read-time lineage recomputation changes three things: 1. **Write path** must persist the full transitive ancestry, not just the immediate parent. For a distilled memory, that means recording the `trace_id` of the raw buffer *and* the source document IDs that the raw buffer referenced. Storage cost grows with derivation depth; this is the price of walkability. 2. **Invalidation path** must be a graph operation, not a row update. Flagging a document must mark every transitive descendant as `lineage_dirty`, which forces recomputation on next read. This requires a reverse index from ancestor to descendants. 3. **Read path** must walk the lineage, check each ancestor against the current invalidation set, and compute `effective_trust` as the minimum. If the walk hits a missing edge, the entry is quarantined. The read is slower — a lineage walk of depth *d* costs *d* lookups — but the cost is bounded and the soundness is total. The observed failure would have been prevented at `t+4h`: the flag on the web page would have marked the distiller's memory `lineage_dirty`, the next retrieval would have walked to the flagged document, computed `effective_trust = 0.0`, and quarantined the entry before the planner ever saw it. The 72-hour exposure window collapses to zero. ```python from dataclasses import dataclass, field from typing import Optional class LineageIncompleteError(RuntimeError): """Raised when an entry's derivation graph cannot be walked to its roots.""" pass class TrustInvariantViolation(RuntimeError): """Raised when an entry is admitted despite a dirty or flagged ancestor.""" pass @dataclass class MemoryEntry: entry_id: str content: str own_trust: float parent_ids: list[str] = field(default_factory=list) lineage_dirty: bool = False class ProvenanceStore: def __init__(self) -> None: self._entries: dict[str, MemoryEntry] = {} self._invalidated: set[str] = set() def write(self, entry: MemoryEntry) -> None: self._entries[entry.entry_id] = entry def invalidate(self, entry_id: str) -> None: self._invalidated.add(entry_id) # mark all transitive descendants dirty stack = [entry_id] while stack: current = stack.pop() for eid, entry in self._entries.items(): if current in entry.parent_ids: entry.lineage_dirty = True stack.append(eid) def effective_trust(self, entry_id: str, _seen: Optional[set[str]] = None) -> float: seen = _seen or set() if entry_id in seen: raise LineageIncompleteError(f"cycle detected at {entry_id}") seen.add(entry_id) entry = self._entries.get(entry_id) if entry is None: # ancestor referenced but not present: lineage truncated raise LineageIncompleteError( f"missing ancestor {entry_id}; cannot compute effective trust" ) if entry_id in self._invalidated: return 0.0 trust = entry.own_trust for parent in entry.parent_ids: trust = min(trust, self.effective_trust(parent, seen)) return trust def admit_for_retrieval(self, entry_id: str, threshold: float = 0.5) -> MemoryEntry: try: eff = self.effective_trust(entry_id) except LineageIncompleteError: # default to quarantine under uncertainty raise TrustInvariantViolation( f"entry {entry_id} quarantined: lineage not walkable" ) if eff < threshold: raise TrustInvariantViolation( f"entry {entry_id} quarantined: effective_trust={eff:.3f} < {threshold}" ) return self._entries[entry_id] ```