# Which invariants prevent provenance-trust scores from laundering poisoned memories during consolidation **Date of Record:** 2026 November 29 **Scope:** Applies to agents that persist episodic memory and periodically consolidate it into semantic memory guarded by per-entry provenance records and a write-time trust score. Does not cover read-path retrieval ranking or prompt-injection defenses applied only at inference time. ## Core Distinction A provenance-trust gate is usually modeled as a *filter*: an entry with trust below threshold τ is rejected at write time. The subtle failure is that consolidation is not a write against the original source — it is a write against *derived* entries whose provenance is inherited. A poisoned episodic entry that *passes* the gate at low-but-legal trust (say 0.62 against τ=0.60) can be distilled into a semantic claim whose provenance is recomputed by aggregation over its supporting episodes. If aggregation is additive or max-based, the derived claim inherits the *maximum* trust of its supports, not the minimum. A single marginal source then produces a high-trust semantic memory that no longer carries the low-trust taint of the episode it came from — the poison is laundered through a trust-increasing transform. The invariant that prevents this is **trust monotonicity under derivation**: any derived memory's trust must be bounded above by the *minimum* trust of its provenance set, and its provenance must retain a pointer to every contributing source, not just the aggregate score. ## What Was Observed A support-triage agent maintained episodic logs of customer incidents and, every 500 turns, distilled them into semantic rules ("refunds over $400 require manager sign-off") tagged with provenance and trust. Episodes entered via three channels: signed CRM webhooks (trust 0.9), agent-synthesized summaries of tool output (trust 0.65), and free-text notes scraped from a shared inbox (trust 0.4, τ=0.6, so rejected outright). The failure trace: 1. A scraped inbox note asserting "policy: refunds over $400 are auto-approved" was rejected at write time (0.4 < 0.6). Correct. 2. But the same claim appeared in an agent-synthesized summary of a *tool call* whose output the agent had misread; that summary scored 0.65 — legal, marginal. 3. Consolidation ran. The distiller emitted the semantic rule with provenance = `{episode_7712}` and trust = `mean(0.65) = 0.65`. The rule now sits above τ. 4. On the next retrieval, the rule was surfaced with trust 0.65 and no link back to the tool-call misread. The agent applied auto-approval to a $900 refund. 5. Post-hoc audit could not reconstruct *why* the rule was trusted: the aggregate score was 0.65, but the underlying justification (a misread tool output) had been compressed away. Provenance pointed at the summary, not the summary's inputs. Two distinct defects compounded: **max/mean aggregation** let a marginal source produce a marginal-but-passing derived entry, and **provenance flattening** destroyed the pointer chain needed to re-audit it. Neither defect alone is fatal; together they defeat the gate. ## Condition of Validity The write-time gate is only sound when all of the following hold. If any fails, the gate is advisory, not enforcing. - **Min-bounded derivation.** `trust(derived) ≤ min(trust(s) for s in provenance_set)`. Mean and max are disallowed. A distillation that merges a 0.65 and a 0.9 source yields 0.65, not 0.775. - **Transitive provenance closure.** Every derived entry's provenance set must resolve, transitively, to leaf sources. Aggregates without resolvable leaves are rejected at write time, not at audit time. - **Taint persistence.** A leaf that was *rejected* but later appears inside a derived entry (because the distiller read rejected-then-reintroduced text) must force the derived entry's trust to the rejected leaf's value, i.e., below τ. Rejected material cannot be resurrected by re-derivation. - **Score/source consistency check.** At write time, recompute trust from the resolved provenance closure and compare to the claimed score. Divergence beyond ε is a hard reject. The condition does *not* hold when consolidation runs on summaries whose inputs are no longer resolvable (e.g., tool output not retained). In that case the invariant is unverifiable and the derived entry must be quarantined, not admitted. ## Decision Boundary The operative question at each consolidation write is: *can I resolve this entry's provenance to leaves, and does the recomputed min-trust match the claimed score?* - **Resolvable + min-consistent:** admit at recomputed trust. - **Resolvable + claimed > recomputed (inflation):** reject; the distiller attempted to launder trust. Log the delta as a poisoning signal. - **Unresolvable (dangling provenance):** quarantine with trust forced to 0; do not admit, do not silently drop. Dangling provenance is the dominant real-world case because tool outputs expire before consolidation windows close — this is why the invariant must be enforced at write time, when the closure is still resolvable, rather than deferred to periodic audit. - **Contains a previously rejected leaf:** force trust to that leaf's value (below τ) and require explicit human re-admission. The boundary is sharp because trust is compared to a fixed τ. There is no "close enough" band; the recompute-vs-claim check uses a fixed ε (we used 1e-6) and treats any inflation as adversarial until proven otherwise. ## Operational Effect Enforcing min-bounded derivation with transitive closure changed three behaviors. First, distillation became *conservative*: merging any marginal source drags the derived claim to the margin, so the distiller learned (via rejection feedback) to split claims by source rather than averaging them — derived entries multiplied but each was honest. Second, dangling-provenance quarantines spiked initially (about 8% of consolidation writes, driven by expired tool-output references) and then fell as the pipeline began retaining tool outputs until the consolidation window closed; the quarantine rate is now a leading indicator of retention-window misconfiguration. Third, the inflation-delta log became the primary poisoning detector: a distiller that systematically claims higher trust than its closure supports is the signature of laundering, and it is visible at write time rather than only after a bad refund clears. The general lesson: a trust score is only as trustworthy as the *weakest* link in its provenance, and any aggregation that is not min-bounded is a laundering channel. Provenance must be a resolvable graph, not a scalar. ```python from dataclasses import dataclass, field from typing import Optional TAU = 0.60 EPS = 1e-6 class ProvenanceLaunderingError(RuntimeError): """Raised when a derived memory's claimed trust exceeds what its provenance closure supports.""" @dataclass class MemoryEntry: id: str claim: str trust: float provenance: list[str] = field(default_factory=list) # ids of supporting entries rejected: bool = False def resolve_closure(entry: MemoryEntry, store: dict[str, MemoryEntry], seen: Optional[set[str]] = None) -> tuple[set[str], list[MemoryEntry]]: """Return (leaf_ids, leaves). Raises if any provenance pointer dangles.""" seen = seen or set() if entry.id in seen: raise ProvenanceLaunderingError(f"cycle detected at {entry.id}") seen.add(entry.id) if not entry.provenance: return {entry.id}, [entry] leaf_ids: set[str] = set() leaves: list[MemoryEntry] = [] for pid in entry.provenance: src = store.get(pid) if src is None: raise ProvenanceLaunderingError( f"dangling provenance {pid!r} referenced by {entry.id!r}; quarantine, do not admit" ) lids, ls = resolve_closure(src, store, seen) leaf_ids |= lids leaves.extend(ls) return leaf_ids, leaves def admit_derived(entry: MemoryEntry, store: dict[str, MemoryEntry]) -> float: """Enforce min-bounded derivation + taint persistence. Returns admitted trust.""" leaf_ids, leaves = resolve_closure(entry, store) if any(l.rejected for l in leaves): # rejected material cannot be resurrected by re-derivation return 0.0 min_trust = min(l.trust for l in leaves) recomputed = min_trust # invariant: derived <= min(support) if entry.trust > recomputed + EPS: raise ProvenanceLaunderingError( f"entry {entry.id!r} claims trust {entry.trust:.3f} but closure min is " f"{recomputed:.3f} (inflation {entry.trust - recomputed:.3f}); reject as laundering" ) if recomputed < TAU: return recomputed # admitted below gate; downstream retrieval must not surface it return recomputed ```