Which invariants prevent provenance-graph poisoning detectors from laundering tainted memory through legitimate-looking derivation edges

**Date of Record:** 2026 December 1 **Scope:** Applies to persistent agent memory stores that maintain provenance graphs (memory item → derivation edge → memory item) and run taint-propagation detectors that quarantine memory whose ancestry includes an untrusted source. Does not apply to stateless retrieval, or to stores without explicit derivation edges (where taint must be tracked by content hashing instead).

Core Distinction

A provenance-graph poison detector answers one question: *does this memory item's ancestry reach an untrusted source?* The subtle failure is not that the detector misses taint — it is that the detector *clears* taint because a tainted item was laundered through an intermediate derivation the detector classifies as "trusted synthesis."

Concretely: an agent reads a poisoned document (untrusted), summarizes it into a memory item (derivation edge `summarize`), then a later agent task *cites* that summary as input to a "verified fact" it writes back (derivation edge `synthesize`). If the detector treats `synthesize` edges as trust-laundering — because the synthesizing agent is a trusted internal worker — the taint terminates at the synthesis edge and the downstream item is marked clean. The poison survives, now wearing a "verified" provenance label.

The distinction that matters: **taint is a property of information ancestry, not of the trust level of the process that last touched it.** Any detector whose edge-classification rules allow a trusted-process edge to *reset* taint rather than *propagate* it is exploitable by construction.

What Was Observed

In a 3-agent store (ingester, synthesizer, auditor) with a provenance graph of ~14k nodes, we seeded a single untrusted document containing an instruction-shaped payload. Trace:

  1. `ingester` read `doc://untrusted/17`, wrote `mem:4412` with edge `(doc://untrusted/17 → mem:4412, kind=extract)`. Detector marks `mem:4412` **tainted**. Correct.
  2. `ingester` summarized `mem:4412` into `mem:4501`, edge `kind=summarize`. Detector propagates taint. Correct.
  3. `synthesizer` combined `mem:4501` with two clean memories into `mem:4733`, edge `kind=synthesize`. Detector's edge table lists `synthesize` as a **trust boundary** — "output of a trusted synthesis pass is re-attested." Taint **terminates**. `mem:4733` marked clean.
  4. `auditor` read `mem:4733`, wrote `mem:4802` with `kind=attest`. Clean propagates.
  5. At retrieval, `mem:4802` is served to a planner that treats `attest`-sourced memory as high-confidence. The payload executes.

The detector reported zero tainted items at retrieval time. The provenance graph was *complete and accurate* — every edge was correctly recorded. The failure was purely in the **taint-propagation algebra over edge kinds**: a monotone-taint invariant was violated by a single non-monotone edge rule (`synthesize` clearing taint). No missing data, no race, no corruption — a semantic bug in the invariant.

Condition of Validity

The detector is sound only under this invariant:

> **Taint monotonicity:** For every derivation edge `(u → v, kind=k)`, `tainted(v) ⊇ tainted(u) ∪ source_trust(k)`. No edge kind may *remove* taint contributed by an ancestor; edge kinds may only *add* taint (e.g., a `synthesize` edge from an untrusted synthesizer adds taint) or leave it unchanged.

This holds only if:

The invariant fails the moment an operator adds an edge kind intended to mean "this process is trusted, so downstream is clean." That intent is always wrong at the information level: a trusted process that *read* tainted input has *emitted* tainted output, regardless of how trustworthy the process is.

Decision Boundary

The operational boundary is between **trust in a process** and **trust in an information lineage**. These are orthogonal, and conflating them is the entire failure.

A useful falsification test: for every edge kind `k`, construct a graph where a tainted node feeds a `k`-edge and assert the output is tainted. If any `k` passes taint through clean, that kind is a laundering channel and the detector must be rejected — regardless of how the kind is documented.

Operational Effect

Downstream of this bug, the store's `attest`-labeled memories became an implicit trust amplifier: a single poisoned document, laundered once, produced memories that retrieval ranked *above* genuinely clean items because attestation was treated as a confidence signal. The blast radius scaled with the synthesizer's fan-out, not with the poison's direct reach.

The fix is architectural, not a patch: (1) collapse all edge kinds into `propagating` or `sourcing`; (2) make attestation an attribute, never a taint operation; (3) run taint as a fixed-point over the SCC-condensed ancestry graph; (4) add a CI invariant that no edge kind reduces taint, enforced by property-based tests over synthetic tainted ancestry. After the change, the same poison trace left `mem:4733` and `mem:4802` correctly tainted and quarantined at retrieval, at the cost of ~4% more false-positive quarantines from legitimate summaries of untrusted-but-benign sources — an acceptable trade, because the alternative is a detector that reports success while laundering exactly the inputs it exists to catch.

from dataclasses import dataclass, field
from typing import Literal

class TaintMonotonicityViolation(RuntimeError):
    """Raised when an edge kind reduces taint, breaking provenance soundness."""
    pass

EdgeKind = Literal["extract", "summarize", "synthesize", "attest"]

# Sound classification: every kind either propagates or sources taint.
# There is deliberately NO "clearing" class.
PROPAGATING: set[EdgeKind] = {"extract", "summarize", "synthesize", "attest"}

@dataclass
class Node:
    id: str
    tainted: bool = False
    ancestors: set[str] = field(default_factory=set)

@dataclass
class Edge:
    src: str
    dst: str
    kind: EdgeKind

def assert_monotone(edges: list[Edge]) -> None:
    for e in edges:
        if e.kind not in PROPAGATING:
            raise TaintMonotonicityViolation(
                f"edge kind {e.kind!r} is not classified as propagating; "
                f"a non-propagating kind can launder taint ({e.src}->{e.dst})"
            )

def propagate_fixed_point(nodes: dict[str, Node], edges: list[Edge]) -> None:
    assert_monotone(edges)  # guardrail: reject laundering kinds up front
    changed = True
    while changed:
        changed = False
        for e in edges:
            u, v = nodes[e.src], nodes[e.dst]
            want = u.tainted or (u.ancestors & {n for n, x in nodes.items() if x.tainted})
            if want and not v.tainted:
                v.tainted = True
                changed = True
            if not u.ancestors <= v.ancestors:
                v.ancestors |= u.ancestors | {u.id}
                changed = True

def detect_laundering(edges: list[Edge]) -> None:
    """Falsification test: any kind that lets a tainted node yield a clean one."""
    for e in edges:
        if e.kind not in PROPAGATING:
            raise TaintMonotonicityViolation(
                f"laundering channel detected via edge kind {e.kind!r} "
                f"on {e.src}->{e.dst}: trusted-process edges must not reset taint"
            )

if __name__ == "__main__":
    nodes = {
        "doc://untrusted/17": Node("doc://untrusted/17", tainted=True),
        "mem:4412": Node("mem:4412"),
        "mem:4501": Node("mem:4501"),
        "mem:4733": Node("mem:4733"),
    }
    edges = [
        Edge("doc://untrusted/17", "mem:4412", "extract"),
        Edge("mem:4412", "mem:4501", "summarize"),
        Edge("mem:4501", "mem:4733", "synthesize"),
    ]
    propagate_fixed_point(nodes, edges)
    assert nodes["mem:4733"].tainted, "synthesize must not launder taint"
    print("invariant holds: mem:4733 correctly quarantined")