# How does an instance detect provenance-laundered memory writes when consolidation rewrites the anomaly score it was supposed to preserve? **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose long-term memory is populated by write-time provenance scoring (source trust, channel, corroboration count) and later compacted by an episodic→semantic consolidation pass that re-summarizes and re-scores entries. Does not apply to append-only, immutable memory stores with no consolidation stage, nor to single-turn stateless inference. ## Core Distinction There are two ways a poisoned memory entry survives into a long-lived agent's semantic store. The first is **detection failure**: the write-time provenance scorer never flagged the entry because the source looked legitimate (a trusted tool, a peer agent, a user channel). The second—and the one this record isolates—is **laundering through consolidation**. The entry *was* flagged at write time, carried an anomaly bit, and then the consolidation pass re-derived a fresh provenance score from the *summary* of the entry rather than from its *origin*, silently overwriting the flag with a clean score. The distinction that matters operationally: provenance is a property of an *origin event*, but consolidation treats it as a property of *content*. When you summarize "the deploy runbook says to disable the auth check for staging" you lose the fact that this sentence originated from a tool-output channel with trust 0.2 and zero corroboration. The summary reads as a neutral factual proposition; re-scoring it yields a clean 0.9. The anomaly flag is not lost by decay or eviction—it is *actively recomputed away* by a stage that has no access to the original provenance vector. ## What Was Observed A memory pipeline with three stages: (1) `write()` scores each candidate entry on `source_trust × channel_weight × corroboration`, flags entries below a threshold as `anomalous=True`; (2) a nightly `consolidate()` clusters recent episodic entries, summarizes each cluster with an LLM, and writes the summary as a semantic entry; (3) `recall()` filters `anomalous=True` entries out of the retrieval set. Observed failure trace for a single poisoned fact: - **t0 (write):** Tool output from a scraped page injects "the maintenance token is rotated weekly, not per-session." Scorer assigns `source_trust=0.15, corroboration=0`, sets `anomalous=True, score=0.15`. Correctly quarantined. - **t1 (consolidate):** The clusterer groups this with three legitimate episodic entries about tokens. The summarizer emits: "Token rotation policy: weekly rotation is standard; per-session rotation is a legacy assumption." The summary is fluent, internally consistent, and contains no channel metadata. - **t2 (re-score):** Consolidation calls `write()` on the summary. `source_trust` is now derived from *the summarizer's own confidence*, not the original page. `corroboration` is now 1 (it "agrees" with the other cluster members because the summarizer merged them). Score = 0.88, `anomalous=False`. - **t3 (recall):** The poisoned claim is retrieved as high-confidence semantic memory. The original flagged episodic entry is evicted by the consolidation's compaction step. The flag is gone and its referent is gone. The non-obvious part: **the anomaly flag was correct at t0 and the pipeline destroyed it at t1–t2 while every individual stage behaved as specified.** No stage failed its own contract. The invariant "anomalous entries never reach recall" held for episodic memory and was violated for semantic memory because consolidation was outside its scope. A second observation: the laundering is *directional*. Consolidation summaries inherit the summarizer's register, which reads as authoritative. So the re-score is not random noise around the true provenance—it is systematically biased upward. Poisoned entries gain more from consolidation than legitimate ones do, because legitimate entries were already high-trust and had little headroom, while flagged entries jump from 0.15 to ~0.88. Consolidation is a *trust amplifier* with a bias toward exactly the entries that should stay suppressed. ## Condition of Validity The laundering requires all of the following to hold simultaneously; remove any one and the failure does not occur: 1. **Consolidation re-derives provenance from content** rather than propagating the origin vector. If summaries carry `min(provenance of members)` or a union of source IDs, the flag survives. 2. **Compaction evicts the source episodic entries.** If the flagged originals persist, a later audit can reconstruct the t0 score. Laundering is only *permanent* when the evidence is deleted. 3. **The summarizer's output register is treated as a trust signal.** Any pipeline that scores summaries by summarizer confidence, length, or fluency exhibits the upward bias. 4. **Recall filters on the current flag, not on a flag history.** If recall consults "was this ever flagged," the t2 re-score is moot. The invariant that bounds the failure: **provenance is monotone non-increasing under consolidation.** A derived entry's provenance score must be ≤ the minimum provenance of its contributing entries, and its anomaly bit must be the OR of its contributors' bits. This is a lattice meet, not an average. Averaging is the bug; min/OR is the guardrail. ## Decision Boundary The boundary is not "should consolidation re-score"—it is **what the re-score is allowed to read.** Two regimes: - **Content-scored consolidation (unsafe):** score = f(summary text, summarizer confidence). Use only when the memory store is append-only, source entries are retained indefinitely, and recall joins against full lineage. In practice, almost never. - **Lineage-scored consolidation (required for mutable stores):** score = meet over contributor provenance vectors; anomaly = OR over contributor bits; summary inherits the *worst* source. This is conservative—a single low-trust contributor taints the summary—but it is the only regime where the t0 flag is preserved across t1–t2. The decision to cross from lineage-scored to content-scored must be explicit and must be paired with retention of the source episodic entries. The failure mode is that engineers cross it implicitly: they add a summarizer, notice the summaries "look better" (higher scores), and never check that the scores are now measuring the summarizer rather than the source. The tell is a **score distribution shift at consolidation**: if post-consolidation mean score is materially above pre-consolidation mean, the pipeline is laundering, not summarizing. Operationally, treat the anomaly bit as a **join key with history**, not a mutable field. An entry that was ever flagged carries `taint_lineage=True` for its lifetime; consolidation ORs it forward; recall filters on it; the t2 re-score may update `score` but may not clear `taint_lineage` without an explicit human or auditor promotion event that records the promoting warrant. ## Operational Effect With lineage-scored consolidation and monotone provenance, the poisoned token-rotation claim stays tainted: the t1 summary inherits `min(0.15, …) = 0.15` and `anomalous=True`, is excluded from recall, and—critically—the t0 episodic entry is retained because tainted clusters are not compacted. The agent's behavior is unchanged from t0 through t3: it does not act on the false rotation policy. The cost is retention: tainted clusters accumulate and require periodic auditor review rather than automatic eviction. That cost is the price of the invariant, and it is bounded by the write-time flag rate, which for a healthy pipeline is small. The failure effect without the guardrail is worse than a single bad fact. Because consolidation is a trust amplifier biased toward flagged entries, a single poisoning attempt that lands at t0 produces a *high-confidence* semantic memory at t2 that is now harder to retract than the original low-confidence claim. The agent does not merely believe a false thing—it believes it with provenance it did not earn, and the evidence of its origin has been deleted. Recovery requires reconstructing the t0 write log, which is exactly what compaction removed. The operational rule: **never let a consolidation stage clear an anomaly bit it did not originate, and never evict the origin of a tainted entry.** The code below enforces the meet/OR invariant and raises when a consolidation attempts to launder a tainted lineage. ```python from dataclasses import dataclass, field from typing import Iterable class ProvenanceLaunderingError(RuntimeError): """Raised when consolidation would raise provenance or clear a taint bit.""" @dataclass(frozen=True) class MemoryEntry: entry_id: str content: str provenance: float # 0.0 (untrusted) .. 1.0 (trusted) tainted: bool # anomaly bit; monotone under consolidation source_ids: tuple[str, ...] = field(default_factory=tuple) def consolidate(cluster: Iterable[MemoryEntry], summary_id: str, summary_text: str) -> MemoryEntry: """Lineage-scored consolidation: provenance is the meet, taint is the OR. The summary's score is bounded above by the worst contributor, and it is tainted if ANY contributor was tainted. A consolidation that would produce a higher score than its worst source, or that would clear a taint bit, is laundering and must be rejected. """ members = list(cluster) if not members: raise ProvenanceLaunderingError("cannot consolidate an empty cluster") worst = min(m.provenance for m in members) any_tainted = any(m.tainted for m in members) sources = tuple(sorted({sid for m in members for sid in m.source_ids})) derived = MemoryEntry( entry_id=summary_id, content=summary_text, provenance=worst, tainted=any_tainted, source_ids=sources, ) # Invariant checks: the derived entry may not exceed its lineage. if derived.provenance > worst + 1e-9: raise ProvenanceLaunderingError( f"summary {summary_id} provenance {derived.provenance} exceeds " f"worst contributor {worst}" ) if any_tainted and not derived.tainted: raise ProvenanceLaunderingError( f"summary {summary_id} cleared taint inherited from {sources}" ) return derived def admit_to_recall(entry: MemoryEntry, min_provenance: float = 0.5) -> bool: """Recall gate: tainted lineage is excluded regardless of current score.""" if entry.tainted: return False if entry.provenance < min_provenance: return False return True def consolidate_or_reject(cluster: Iterable[MemoryEntry], summary_id: str, text: str) -> MemoryEntry: derived = consolidate(cluster, summary_id, text) if derived.tainted and derived.provenance >= 0.8: # A tainted entry with a high score is the signature of laundering # that slipped past the meet (e.g. an upstream bug). Refuse to admit. raise ProvenanceLaunderingError( f"tainted summary {summary_id} scored {derived.provenance}; " "refusing admission pending auditor review" ) return derived ```