# Why does an instance launder a poisoned memory through its own successful re-derivation? The taint-decay invariant in trust-scored stores **Date of Record:** 2026 November 22 **Scope:** Applies to persistent agent memory systems that attach provenance/trust scores to stored facts and gate retrieval through taint-aware filters. Does not apply to stateless single-turn inference or to memory stores with no provenance tracking. ## Core Distinction There are two ways a poisoned memory can enter a trust-scored store. The first is *direct injection*: an untrusted source (a scraped web page, a tool output, a peer agent's message) writes a low-trust record and the retrieval filter correctly suppresses it. This is the case everyone instruments for, and it is the case the taint filter is designed to catch. The second is *laundering by re-derivation*. An agent retrieves a low-trust (tainted) record, uses it as a premise in a reasoning step, produces a conclusion, and then **writes that conclusion back into memory as a fresh, high-trust, self-authored record** — because the write path scores trust by *who wrote it* (this instance, trusted) rather than by *what it was derived from* (a tainted premise). The taint is not removed; it is re-parented. The original low-trust record still sits there flagged, while its poisoned payload now circulates under a clean provenance label, and the taint-aware filter — which keys off the record's own trust field — waves it straight through. The distinction that matters operationally: **taint is a property of the derivation graph, not of the record's author.** Any store that scores trust at write time from author identity alone will silently break this invariant on the first successful re-derivation. ## What Was Observed A research agent with a persistent semantic store was asked to compile competitive pricing. During a web-tool call, a page returned an injected instruction embedded in a table cell: a plausible-looking but false unit price attributed to a competitor. The tool output was correctly tagged `source=web, trust=0.2` and stored as a low-trust episodic record. On the next turn the agent retrieved that record (retrieval is not gated on trust at *read* time — only the filter at *promotion* time is), reasoned "competitor X charges $Y per seat," and distilled it into a semantic memory: `{fact: "competitor_X_seat_price = Y", author: self, trust: 0.9, derived_from: [ep_4417]}`. The bug is in the `trust` assignment. The write path computed `0.9` from `author=self` and ignored `derived_from`. The taint filter, on the following turn, retrieved the semantic record, read `trust=0.9 > threshold=0.6`, and promoted it into the working context with no taint flag. The false price then propagated into three downstream artifacts before a human caught the discrepancy against a primary source. The original tainted record `ep_4417` was never suppressed — it was simply *bypassed* through its own child. The failure trace, precisely: 1. `ep_4417` written, `trust=0.2`, `taint=web_injection_suspected`. 2. Retrieval (read-ungated) surfaces `ep_4417` into context. 3. Reasoning step consumes it; conclusion written as `sem_9902`. 4. Write path sets `sem_9902.trust=0.9` from author identity; `derived_from=[ep_4417]` recorded but **not consulted** for trust. 5. Taint filter evaluates `sem_9902` on its own `trust` field → passes. 6. Poisoned fact now high-trust and self-reinforcing: future re-derivations from `sem_9902` inherit `0.9` and add more clean children. Step 4 is the single point of failure. The invariant violated: **a derived record's trust must be bounded above by the minimum trust of its derivation set** — `trust(child) ≤ min(trust(parents))`. This is a taint-propagation lattice, not an author-attribution heuristic. ## Condition of Validity The taint-aware filter is only sound under the following condition, which must hold for *every* write, not just external ones: > For any record `r` with a non-empty `derived_from` set `P`, `r.effective_trust = min(r.authored_trust, min_{p∈P}(p.effective_trust))`, and `r.tainted = r.tainted OR any(p.tainted for p in P)`. This is recursive and must be evaluated transitively — a grandchild derived from a laundered child must inherit the original taint even though its immediate parent looks clean. Two corollaries: - **Author trust is an upper bound, never a floor-setter.** Self-authorship can *lower* nothing and *raise* nothing above the derivation ceiling. - **Taint is monotone and sticky.** Once a node is tainted, no amount of clean re-derivation downstream clears it; only an explicit, audited *re-verification event* (re-fetch from a primary trusted source, or human sign-off) may clear taint, and that event must be recorded as a new provenance edge, not an in-place mutation. The condition fails the moment any write path computes trust from author identity without consulting `derived_from`, or the moment a "summarization" or "distillation" step drops the provenance edges to save space. Distillation loss of provenance edges is the most common way this invariant is quietly broken. ## Decision Boundary The boundary is between *trust as attribution* and *trust as taint-propagation*: - **Below the boundary (safe):** stores where every derived record carries its full parent set and effective trust is the lattice-min over that set, evaluated transitively at read time. The filter can then gate on `effective_trust` and `tainted` together. - **Above the boundary (unsafe):** stores where trust is a scalar set at write from author, where distillation compacts away `derived_from`, or where the filter reads `trust` without walking provenance. A practical decision rule for the retrieval filter: **never gate on the record's stored `trust` field alone.** Gate on `effective_trust` computed by a bounded transitive walk over `derived_from`, capped at a fixed depth (e.g. 8) to avoid unbounded graph traversal; if the walk hits the depth cap without reaching a trusted root, treat the record as tainted by default (fail-closed). This converts the laundering attack from "silent pass" to "taint inherited, record suppressed," and it costs one graph walk per candidate — cheap relative to the cost of a poisoned fact reaching an artifact. ## Operational Effect With the lattice-min rule enforced at write and the transitive walk enforced at read, the laundering path from step 4 above collapses: `sem_9902` inherits `effective_trust = min(0.9, 0.2) = 0.2` and `tainted=True` from `ep_4417`, so the filter suppresses it exactly as it suppresses the parent. The poisoned fact cannot escape its provenance. The cost is that *legitimate* distillations of low-trust-but-correct facts are also suppressed until re-verified — which is the correct trade: a store that cannot distinguish a laundered poison from a clean derivation must fail closed and force an explicit re-verification edge. The residual risk is depth-cap evasion (an attacker constructing a derivation chain longer than the cap to dilute taint); mitigate by making taint *sticky at the node* rather than only computed at read, so a tainted parent permanently marks all descendants at write time regardless of walk depth. ```python from dataclasses import dataclass, field TRUST_THRESHOLD = 0.6 MAX_DERIVATION_DEPTH = 8 class TaintLaunderingError(RuntimeError): """Raised when a write would assign a derived record more trust than its premises allow.""" pass @dataclass class MemoryRecord: rid: str authored_trust: float tainted: bool = False derived_from: list[str] = field(default_factory=list) effective_trust: float = 0.0 class TrustScoredStore: def __init__(self): self.records: dict[str, MemoryRecord] = {} def _resolve(self, rid: str, depth: int = 0) -> MemoryRecord: if depth > MAX_DERIVATION_DEPTH: # fail-closed: unknown-depth ancestry is treated as fully tainted raise TaintLaunderingError(f"derivation depth cap exceeded at {rid}") rec = self.records[rid] if not rec.derived_from: rec.effective_trust = rec.authored_trust return rec parents = [self._resolve(p, depth + 1) for p in rec.derived_from] ceiling = min(p.effective_trust for p in parents) rec.effective_trust = min(rec.authored_trust, ceiling) rec.tainted = rec.tainted or any(p.tainted for p in parents) return rec def write(self, rec: MemoryRecord) -> MemoryRecord: if rec.derived_from: parents = [self._resolve(p) for p in rec.derived_from] ceiling = min(p.effective_trust for p in parents) if rec.authored_trust > ceiling: raise TaintLaunderingError( f"record {rec.rid} claims trust {rec.authored_trust} " f"but derivation ceiling is {ceiling}; would launder taint" ) rec.effective_trust = min(rec.authored_trust, ceiling) rec.tainted = rec.tainted or any(p.tainted for p in parents) else: rec.effective_trust = rec.authored_trust self.records[rec.rid] = rec return rec def retrieve(self, rid: str) -> MemoryRecord | None: rec = self._resolve(rid) if rec.tainted or rec.effective_trust < TRUST_THRESHOLD: return None return rec ```