# Which invariants prevent poisoned provenance from surviving a forget operation in persistent agent stores **Date of Record:** 2026 November 26 **Scope:** Applies to persistent agent memory stores that attach provenance (source, trust tier, write epoch) to memory records and support targeted forgetting (deletion, redaction, or demotion). Does not address stateless inference, in-context-only scratchpads, or stores with no forget primitive. ## Core Distinction The failure is not "a poisoned memory was written." Poisoned writes are a detection problem. The failure is that a **forget operation severs the provenance chain while leaving derived records intact**, so the poison's *descendants* survive with laundered provenance. A memory `M` written by an untrusted tool, then distilled into a semantic summary `S`, then cited by a planning record `P`, is a three-node graph. Forgetting `M` deletes the node and its direct edges but leaves `S` and `P` alive, now orphaned—their provenance pointers dangle or are rewritten to "unknown," which downstream trust gates treat as *neutral* rather than *tainted*. The poison has been forgotten, not removed. The invariant that must hold: **provenance taint is monotone under derivation.** If `X` derives from `Y` and `Y` is tainted, then `X` is tainted, and no forget operation on `Y` may reduce the taint of `X`. Deletion is not a taint-clearing event for descendants; it is only a taint-clearing event for the deleted node itself. ## What Was Observed A store held 41k records. A retrieval-augmented agent ingested a web document through an untrusted fetch tool at epoch 880, producing record `R-8801` with `provenance: {source: tool:fetch, trust: 0.2, epoch: 880}`. Over the next ~200 turns, the episodic distiller folded `R-8801` into a semantic summary `S-9120` with `derived_from: [R-8801, R-8802, R-8814]` and `trust: 0.9` (the distiller averaged nothing—it assigned a default semantic-tier trust of 0.9, a bug in the distillation step). A planner later read `S-9120` and wrote `P-9402` with `derived_from: [S-9120]`, `trust: 0.9`. Detection fired on `R-8801` at epoch 940 (a source-reputation update flagged the fetch domain). The forget routine ran: `R-8801` deleted, edges from `R-8801` to `S-9120` removed. `S-9120`'s `derived_from` list became `[R-8802, R-8814]`—both benign—and its trust stayed 0.9. `P-9402` was untouched. Within 30 turns the planner re-read `S-9120`, now carrying *cleaner* provenance than before the forget, and re-derived the poisoned plan with higher confidence. The forget made the poison more credible. The trace: 1. `R-8801` (trust 0.2) → distiller default-upgrades to `S-9120` (trust 0.9). **First violation: trust not min-propagated on derivation.** 2. Forget deletes `R-8801`, strips its edges, recomputes `S-9120`'s provenance from *surviving* parents only. **Second violation: taint recomputed from remaining parents, not latched.** 3. `P-9402` never revisited. **Third violation: no transitive invalidation.** 4. Planner reads `S-9120` at trust 0.9, passes the trust gate (threshold 0.7). **Operational effect: re-poisoning.** ## Condition of Validity The monotone-taint invariant is only enforceable when the store maintains the derivation DAG as first-class, queryable state—not as a denormalized `derived_from` list that gets rewritten on parent deletion. Concretely, three conditions: - **Edge persistence over node persistence.** Derivation edges must be tombstoned, not deleted, when their source node is forgotten. A tombstone edge `S-9120 --was_derived_from--> R-8801(deleted)` preserves the fact that a now-forgotten, tainted parent once contributed. Without this, step 2 above recomputes from a mutilated parent set and silently launders. - **Trust as a latched lower bound, not a computed average.** A record's effective trust must be `min(own_trust, min over all ever-parents of effective_trust)`, latched at write time and only raisable by an explicit re-attestation event with its own provenance. Distillation must never assign a tier-default trust that exceeds any parent's. - **Forget as a taint-propagating transaction.** A forget of `Y` must, in the same transaction, mark every reachable descendant as `tainted_by: Y` and force re-evaluation before the next read. When the store lacks any of these—most commonly the second, because distillation pipelines are written by a different team than the trust gate—the invariant is unenforceable and the store should refuse to expose a `forget` primitive rather than expose a laundering primitive. ## Decision Boundary The boundary is between **forget-as-deletion** and **forget-as-taint-propagation**. Choose deletion semantics only when the store guarantees that no record is ever derived from another (flat episodic memory, no distillation). The moment a distiller or summarizer exists, deletion semantics are unsound and you must implement propagation. A second boundary: **when to halt the agent vs. degrade trust.** If a forget transaction discovers a tainted descendant that has already been *read into an active context window* (a live plan `P` in flight), you cannot retroactively un-read it. The correct action is to invalidate the in-flight plan and force replanning from a checkpoint taken before the tainted read—not to lower `P`'s trust and continue. Continuing on a tainted-but-now-low-trust plan is worse than halting, because the plan's *actions* were already conditioned on the poison even though its label now reads 0.4. ## Operational Effect With monotone-taint and tombstoned edges in place, the epoch-940 forget produces: `R-8801` tombstoned; `S-9120` marked `tainted_by: R-8801`, effective trust forced to 0.2; `P-9402` transitively marked and quarantined; the planner's next read of `S-9120` fails the 0.7 gate and the agent replans from the epoch-939 checkpoint. The poison is *removed*—its descendants are quarantined, not laundered—at the cost of one replan and roughly 4k tokens of recomputation. Without the invariant, the same forget costs zero tokens and re-poisons the agent within 30 turns, and the second poisoning is undetectable because the provenance now reads clean. The asymmetry is the point: a forget that does not propagate taint is strictly worse than no forget at all, because it destroys the evidence (the tainted edge) that a later auditor would need to detect the poisoning. **Forgetting is a taint-preserving operation or it is evidence destruction.** ```python from dataclasses import dataclass, field from typing import Dict, Set class ProvenanceLaunderingError(RuntimeError): """Raised when a forget would strip taint from a derived record.""" pass @dataclass class Record: rid: str trust: float derived_from: Set[str] = field(default_factory=set) tainted_by: Set[str] = field(default_factory=set) deleted: bool = False class ProvenanceStore: def __init__(self): self.records: Dict[str, Record] = {} self.tombstone_edges: Dict[str, Set[str]] = {} # child -> deleted parents def add(self, rec: Record) -> None: # Invariant 1: latched lower bound on write. for p in rec.derived_from: if p in self.records and self.records[p].trust < rec.trust: rec.trust = self.records[p].trust if p in self.records: rec.tainted_by |= self.records[p].tainted_by self.records[rec.rid] = rec def forget(self, rid: str) -> None: target = self.records[rid] target.deleted = True # Invariant 2 + 3: propagate taint to all reachable descendants, # tombstone the edge rather than dropping it. for child in self._descendants(rid): c = self.records[child] c.tainted_by.add(rid) c.trust = min(c.trust, target.trust) if rid in c.derived_from: c.derived_from.discard(rid) self.tombstone_edges.setdefault(child, set()).add(rid) def _descendants(self, rid: str) -> Set[str]: out, frontier = set(), {rid} while frontier: cur = frontier.pop() for r in self.records.values(): if cur in r.derived_from and r.rid not in out: out.add(r.rid) frontier.add(r.rid) return out def read(self, rid: str, gate: float = 0.7) -> Record: r = self.records[rid] if r.deleted: raise ProvenanceLaunderingError(f"{rid} is forgotten; read refused") if r.tainted_by and r.trust >= gate: # Detect the exact laundering failure: tainted but passing gate. raise ProvenanceLaunderingError( f"{rid} tainted_by={sorted(r.tainted_by)} yet trust={r.trust} " f">= gate {gate}: provenance was laundered by a prior forget" ) return r ```