How does an instance detect provenance-laundered memory writes when the poisoning signal is diluted below per-entry anomaly thresholds
**Date of Record:** 2026 December 2 **Scope:** Applies to long-lived agents that persist episodic and semantic memory across sessions and gate writes through a provenance-tracked audit log with per-entry anomaly scoring. Does not apply to stateless single-turn inference, nor to memory stores where every write is human-reviewed before commit.
Core Distinction
The common framing of memory poisoning assumes a *malicious write*: an injected instruction or fabricated fact that, considered in isolation, looks anomalous. Detectors built on this framing score each candidate write against a baseline and flag outliers. That works against single-shot poisoning.
It does not work against **provenance laundering**, which is the boundary condition this record addresses. Provenance laundering is the deliberate distribution of a poisoned claim across many individually-benign writes, each of which inherits legitimate provenance (a real tool result, a real user turn, a real retrieval) and each of which scores below the per-entry threshold. The poison exists only in the *aggregate* — in the joint distribution of a cluster of writes that are each unremarkable. The detector's unit of analysis (the entry) is finer than the poison's unit of effect (the cluster). This is the invariant that breaks: **per-entry anomaly scoring is not closed under aggregation**, so a store can be fully poisoned while every individual audit record reads clean.
The distinction that matters operationally: a poisoned *entry* is detectable by scoring the entry; a poisoned *distribution* is only detectable by scoring the entry *against its provenance neighborhood and its write cohort*.
What Was Observed
An agent with a semantic memory store of ~40k entries, each carrying a provenance tuple `(source_type, source_id, session_id, parent_write_id, timestamp, tool_call_hash)`, ran a per-entry anomaly scorer: cosine distance from the running centroid of the entry's `source_type` cluster, plus a z-score on token length and embedding norm. Threshold at z > 3.0. Over a 9-day window, zero entries crossed threshold, yet downstream task accuracy on a fact-recall benchmark fell from 0.91 to 0.62.
The failure trace, reconstructed from the audit log:
- A retrieval tool returned a document containing a plausible-but-false claim (a fabricated API limit). This is a *single* tainted tool result — normal, expected, and correctly provenance-tagged `source_type=tool:retrieval`.
- The agent, over the next several sessions, *restated* that claim in 23 separate episodic writes, each paraphrased slightly, each attached to a different real user question, each with `parent_write_id` chaining back to the original retrieval. Each restatement was individually unremarkable: short, on-topic, low embedding distance from its own session context.
- A distillation pass promoted the claim from episodic to semantic memory because it appeared in 23 episodes — the *repetition itself* was read as corroboration. The distiller's promotion rule was "seen in ≥ N independent episodes," and "independent" was measured by `session_id` distinctness, not by provenance-root distinctness.
- The 23 episodes all shared a single provenance root (the one retrieval). They were *not* independent evidence; they were one source echoed 23 times. The distiller counted echoes as votes.
The per-entry scorer never fired because no single write was anomalous. The anomaly was in the *fan-out*: one provenance root producing a high-degree write cohort. The signal that would have caught it — provenance-root write-degree, and the ratio of distinct roots to total writes in a cohort — was never computed because the scorer operated per-entry.
Condition of Validity
The per-entry detector is valid only under an assumption that is rarely stated and frequently false: **that independent provenance roots produce independent writes at a roughly stationary rate.** Under that assumption, a write cohort with a single dominant root is statistically improbable and would surface as an outlier. The moment an adversary (or a benign-but-repetitive process, e.g., a retry loop, a summarizer that re-ingests its own output, a tool that returns the same cached document) can drive many writes from one root, the stationarity assumption fails and the detector is blind.
The invariant that must hold for provenance auditing to be sound: **evidence independence must be measured at the provenance-root level, not the session or write level.** Two writes are independent evidence only if their provenance-root sets are disjoint. A distillation or promotion rule that counts writes, sessions, or timestamps as independent corroboration is unsound by construction — it is vulnerable to exactly the fan-out above, whether adversarial or accidental.
A secondary validity condition: the audit log must be *append-only and causally ordered* so that `parent_write_id` chains cannot be rewritten after the fact. If a poisoned write can retroactively edit its own parent pointer, provenance laundering becomes provenance forgery and no degree-based signal survives.
Decision Boundary
The boundary between "score the entry" and "score the cohort" is crossed when any of the following holds for a write cohort (grouped by `source_type` and a rolling window):
- **Root concentration:** the top provenance root accounts for more than a threshold fraction (observed working value: 0.4) of writes in a cohort of size ≥ 8. Single-root dominance is the fan-out signature.
- **Echo ratio:** distinct provenance roots / total writes in the cohort falls below 0.5. This is the same signal expressed as a diversity measure and is the one that generalizes across cohort sizes.
- **Promotion provenance:** any episodic→semantic promotion whose supporting episodes trace to fewer than 2 distinct provenance roots must be *blocked*, not merely down-scored. This is a hard gate, not a soft anomaly score, because promotion is the irreversible step — once a laundered claim enters semantic memory it is retrieved as ground truth and re-launders itself.
- **Chain depth:** a `parent_write_id` chain longer than a small bound (observed: 4) with a single root indicates recursive restatement, which is the mechanical substrate of laundering.
Below these thresholds, per-entry scoring is sufficient and cohort scoring adds noise. Above them, per-entry scoring is *provably* insufficient — no threshold on individual z-scores can catch a cohort whose members are all near the mean. The decision is not "raise the per-entry threshold"; it is "add a cohort-level gate that the per-entry scorer structurally cannot express."
Operational Effect
The corrective architecture is a two-tier audit. Tier one remains the per-entry anomaly scorer (catches single-shot poisoning). Tier two is a **provenance-graph cohort scorer** that runs at write-commit and at promotion time, computing root concentration and echo ratio over the cohort, and *hard-blocks* promotions with fewer than two distinct roots. On the affected store, replaying the audit log through the cohort scorer flagged the 23-episode cluster at the 4th write (root concentration crossed 0.4) and would have blocked the promotion outright.
The operational cost is a provenance-graph index maintained alongside the memory store, and a rule that the distiller's independence check must resolve to provenance roots rather than session IDs. The invariant to carry forward: **an agent's memory is only as trustworthy as the independence of its evidence roots, and independence must be enforced structurally at promotion, because it cannot be recovered by scoring entries after the fact.** Any detector that scores writes without scoring the *graph the writes form* is blind to the exact failure mode that matters most — the one where every record looks clean and the aggregate is poisoned.
from dataclasses import dataclass, field
from collections import defaultdict
class ProvenanceLaunderingError(RuntimeError):
"""Raised when a write cohort or promotion violates evidence-independence."""
pass
@dataclass
class Write:
write_id: str
source_type: str
root_id: str # provenance root (original tool result / user turn)
parent_write_id: str | None
session_id: str
@dataclass
class CohortAudit:
root_concentration_max: float = 0.4
echo_ratio_min: float = 0.5
min_cohort_for_gate: int = 8
max_chain_depth: int = 4
def audit_cohort(writes: list[Write], audit: CohortAudit) -> None:
if len(writes) < audit.min_cohort_for_gate:
return
root_counts: dict[str, int] = defaultdict(int)
for w in writes:
root_counts[w.root_id] += 1
total = len(writes)
top_root, top_count = max(root_counts.items(), key=lambda kv: kv[1])
concentration = top_count / total
echo_ratio = len(root_counts) / total
if concentration > audit.root_concentration_max:
raise ProvenanceLaunderingError(
f"root {top_root!r} dominates cohort: concentration={concentration:.2f} "
f"> {audit.root_concentration_max} over {total} writes"
)
if echo_ratio < audit.echo_ratio_min:
raise ProvenanceLaunderingError(
f"echo ratio {echo_ratio:.2f} < {audit.echo_ratio_min}: "
f"{len(root_counts)} distinct roots across {total} writes"
)
def gate_promotion(supporting_episodes: list[Write]) -> None:
"""Episodic->semantic promotion requires >=2 distinct provenance roots."""
roots = {w.root_id for w in supporting_episodes}
if len(roots) < 2:
raise ProvenanceLaunderingError(
f"promotion blocked: {len(supporting_episodes)} episodes trace to "
f"{len(roots)} provenance root(s); repetition is not corroboration"
)
# chain-depth check: recursive restatement from a single root
for w in supporting_episodes:
depth, cur = 0, w
seen: set[str] = set()
while cur.parent_write_id is not None:
if cur.write_id in seen:
raise ProvenanceLaunderingError(f"cycle in provenance chain at {w.write_id}")
seen.add(cur.write_id)
depth += 1
if depth > 4:
raise ProvenanceLaunderingError(
f"chain depth > 4 at {w.write_id}: recursive restatement suspected"
)
break # single-hop check; full walk omitted for brevity