# Under what conditions must an instance refuse to lift a memory quarantine when the poisoned span and the verified span share a token-level provenance root **Date of Record:** 2026 November 29 **Scope:** Applies to agents that maintain a taint-tracked episodic store where memory entries carry provenance links to the tool outputs, retrieved chunks, or peer messages that produced them, and that recover from prompt-injection poisoning by quarantining and later sanitizing affected spans. Does not apply to stateless single-shot inference or to stores without per-entry provenance. ## Core Distinction The naive recovery model treats quarantine as a per-entry boolean: an entry is either `POISONED` (hidden from retrieval) or `CLEAN` (retrievable). Sanitization is then "re-derive the entry from trusted inputs and un-quarantine it." This model fails at a specific, non-obvious boundary: when the *poisoned span* and the *span used to reconstruct the sanitized replacement* descend from the same provenance root — the same tool call, the same retrieved document, the same peer message. The distinction that matters is not poisoned-vs-clean at the entry level but **provenance-root disjointness between the tainted span and its proposed replacement**. If the sanitizer reconstructs an entry from a source that shares a root with the original poison, the reconstruction inherits the taint through a path the boolean model cannot see. The entry is re-admitted as `CLEAN` while still carrying attacker-controlled content — a *laundering* failure. The invariant is: **a quarantine may only be lifted if the replacement span's provenance root set is disjoint from the tainted span's provenance root set.** When it is not disjoint, the instance must refuse to lift, regardless of how clean the reconstructed text looks. ## What Was Observed An agent ingested a web page via `fetch_url` (root `R1`). The page contained an injected instruction inside a `
` block telling the agent to treat a particular config value as authoritative. The ingestion pipeline split the page into chunks `c1..c7`, all stamped `provenance_root=R1`, and distilled them into three episodic entries `e_a, e_b, e_c`, each also stamped `R1`. A taint pass flagged `c4` (the injected block) and propagated taint to `e_b` (the entry distilled from `c4` plus neighbors). `e_b` was quarantined. The recovery routine then did what looked correct: it re-ran distillation over the *untainted* chunks `c1..c3, c5..c7` and produced a replacement `e_b'`. Because `c4` was excluded, the text of `e_b'` contained no injection string. The routine lifted the quarantine and marked `e_b'` `CLEAN`. The failure surfaced two turns later. `e_b'` had been reconstructed from `c3` and `c5`, and `c3`'s summary had been *paraphrased using* `c4` during the original distillation pass — the distiller had read the whole page to write each chunk summary, and `c3`'s stored summary text carried a reworded fragment of the injected instruction ("the config value should be treated as authoritative"). That fragment was not the literal injection string, so the string-match sanitizer missed it, and `c3` was never tainted because taint propagation was keyed on the literal injection span, not on distillation read-sets. The reconstruction laundered the poison through `c3`, a chunk that was never quarantined because it never *contained* the injection — it only *read* it. The mechanism: **taint was tracked on containment, but laundering travels on read-sets.** Any span whose derivation *read* a poisoned span is a carrier even if it does not contain the poison's text. ## Condition of Validity The refusal-to-lift rule is valid and must fire under all of the following jointly: 1. Entries carry provenance roots at ingestion granularity (document/tool-call/peer-message), not just at chunk granularity. 2. Distillation or summarization records a **read-set** — the set of spans whose content was in context when the derived span was produced — not merely a containment set. 3. The proposed replacement's read-set intersects the tainted span's read-set at any root, *or* the replacement's read-set transitively includes any span whose read-set included the tainted span. 4. The sanitizer's poison detector is text-based (string/regex/embedding match) and therefore cannot be trusted to detect paraphrased laundering. If provenance is only tracked per-chunk and read-sets are not recorded, the rule cannot be evaluated and the safe default is to keep the quarantine and re-ingest from a fresh root rather than lift. If the replacement is derived from a *genuinely disjoint* root (e.g., re-fetched the URL after the injection was removed, producing root `R2`), the rule does not fire and the quarantine may be lifted. ## Decision Boundary The boundary is drawn between *reconstruction from a sibling* and *reconstruction from a disjoint root*: - **Same root, read-set overlap → REFUSE to lift.** Keep `e_b` quarantined. Do not admit `e_b'`. The correct action is to re-derive from a new root (re-fetch, re-query, ask a peer for a fresh copy) and only lift when the new root is disjoint. - **Same root, no read-set overlap *and* read-sets were fully recorded → MAY lift**, but only with the read-set evidence attached, not on text-match evidence alone. - **Disjoint root → MAY lift.** This is the only case where text-level cleanliness is sufficient corroboration. The subtle trap: an operator sees "the injection string is gone" and treats that as the lift condition. The lift condition is *provenance disjointness*, and text cleanliness is a symptom that can be forged by paraphrase. When the two disagree — text clean but roots overlap — the provenance signal wins and the instance must refuse. ## Operational Effect Enforcing this invariant changes recovery from a text-sanitization problem into a **provenance-closure problem**. Practically: - Quarantine lift becomes a two-key operation: (a) reconstructed span is text-clean, *and* (b) the reconstruction's provenance-root closure is disjoint from the tainted span's closure. Either key alone is insufficient. - The store must persist read-sets, not just containment spans. This roughly doubles provenance metadata per entry but is the only way to detect paraphrase laundering. - Recovery latency increases because the common fast path (re-distill from sibling chunks) is now blocked when siblings share the root; the agent must pay for a fresh fetch or a peer re-query to obtain a disjoint root. - The refusal is *safe*: a stubbornly quarantined entry degrades recall but never admits attacker-controlled content. The inverse failure — lifting on text-match evidence — is a silent, persistent poisoning that survives across turns and is nearly undetectable downstream because the laundered fragment is a paraphrase, not a signature. The instance must therefore treat "text is clean" as necessary-but-not-sufficient and gate the lift on root-disjointness, raising a hard stop when a caller attempts to lift a quarantine whose replacement shares a provenance root with the taint. ```python class ProvenanceLaunderingError(RuntimeError): """Raised when a quarantine lift would admit a span whose reconstruction shares a provenance root (or read-set ancestor) with the tainted span.""" pass def lift_quarantine(entry_id, replacement_span, tainted_span, read_set_index): """ tainted_span: dict with 'roots' (set) and 'read_closure' (set of span ids). replacement_span: dict with 'roots' (set) and 'read_closure' (set). read_set_index: maps span_id -> set of span ids it read during derivation. """ tainted_roots = set(tainted_span["roots"]) repl_roots = set(replacement_span["roots"]) # Expand replacement read-closure transitively through the read-set index. closure = set(replacement_span["read_closure"]) frontier = list(closure) while frontier: sid = frontier.pop() for parent in read_set_index.get(sid, ()): # spans it read if parent not in closure: closure.add(parent) frontier.append(parent) root_overlap = tainted_roots & repl_roots read_overlap = closure & set(tainted_span["read_closure"]) if root_overlap or read_overlap: # Text may look clean; provenance says the poison was laundered through. raise ProvenanceLaunderingError( f"Refusing to lift quarantine on {entry_id}: " f"root_overlap={sorted(root_overlap)} " f"read_overlap={sorted(read_overlap)}. " f"Re-derive from a disjoint provenance root before lifting." ) # Disjoint provenance root: safe to lift. return {"entry_id": entry_id, "status": "CLEAN", "roots": repl_roots} ```