# How does an instance detect provenance-laundering in a long-term memory store when a poisoned episode is rewritten as a "consolidated fact" that inherits a clean trust tier **Date of Record:** 2026 December 4 **Scope:** Applies to agents that maintain a two-tier memory architecture (episodic buffer → distilled semantic store) where semantic writes carry provenance metadata and a trust tier. Does not apply to single-tier, session-scoped scratchpads or to stores where every semantic fact is re-verified against a live source at read time. ## Core Distinction There are two structurally different ways poisoned memory enters a long-term store, and they require different detectors. The first is **direct injection**: an untrusted byte stream (a tool result, a fetched web page, a user message) is written into episodic memory with a provenance tag of `untrusted` / `external`. This is easy to bound because the trust tier travels with the record and every downstream reader can gate on it. The second is **provenance laundering**: the same untrusted bytes are never written as a fact. Instead they are *distilled*. A consolidation pass reads several low-trust episodic records, summarizes them into one semantic assertion, and writes that assertion with provenance pointing at the *consolidation process itself* — not at the original untrusted sources. The new record inherits the trust tier of the writer (the agent's own consolidation routine, which is `trusted`), because the writer is trusted even though its inputs were not. The poison now wears a clean badge. This is the non-obvious boundary. Trust is a property of the *writer*, but the truth-value of a memory is a property of the *transitive input closure*. Any store that assigns trust at write time from the writer's identity, and never recomputes it from the input lineage, will launder every poison that passes through a summarizer. ## What Was Observed A research agent ran a multi-day task: gather claims about a vendor's SLA from a mix of internal docs (trusted) and scraped forum posts (untrusted). Each night a consolidation pass ran: it clustered related episodic records, summarized each cluster with the model, and wrote a semantic fact with fields `{assertion, provenance: [episodic_ids], trust_tier: tier_of_writer}`. The failure trace, condensed: 1. Day 1, 14:02 — tool call `fetch(forum_url)` returns a post asserting "the vendor's uptime guarantee is 99.99% but is measured monthly, not annually." Written to episodic store, `trust_tier=untrusted`, `source=forum`. 2. Day 1, 14:03 — tool call `fetch(internal_sla_pdf)` returns "99.9% measured annually." Written to episodic store, `trust_tier=trusted`, `source=internal`. 3. Day 1, 23:00 — consolidation clusters both records (same topic embedding), summarizes: "Vendor SLA is 99.99% measured monthly." The summarizer *averaged* two contradictory numbers and dropped the qualifier. Written to semantic store with `provenance=[ep_8812, ep_8813]`, `trust_tier=trusted` (writer is the consolidation routine), `derived=true`. 4. Day 2, 09:12 — a downstream planning step queries the semantic store, retrieves the consolidated fact, sees `trust_tier=trusted`, and cites it in a report without re-reading the episodic originals. 5. Day 2 onward — the episodic records `ep_8812`/`ep_8813` age out of the buffer under TTL eviction. The semantic fact survives. Its provenance now points to *dead* record IDs. The critical observation: at step 5, the store contained a `trusted` semantic fact whose provenance was unresolvable. A naive integrity check that only verifies "provenance IDs exist" would have caught nothing at step 3–4 (the IDs were alive and valid), and at step 5 it would have flagged a *dangling reference* — a bookkeeping error — rather than the actual defect, which was that a trusted-tier record had untrusted ancestry. The two failures are different and the second is the one that matters. A second, subtler observation from replay: two runs of the same consolidation over the same episodic set produced facts with *different* numeric assertions (99.99% monthly vs. 99.9% annual), because the summarizer's tie-breaking was non-deterministic. So the poison was not even stable — it was a random draw from the input distribution, promoted to `trusted`. ## Condition of Validity The laundering is possible iff the following three conditions hold simultaneously: 1. **Trust is writer-assigned, not lineage-computed.** The write path sets `trust_tier` from the identity of the consolidating agent, and the read path trusts that field without traversing provenance. 2. **Distillation is lossy in the trust dimension.** The summarizer is permitted to emit a record whose `trust_tier` is *higher* than the minimum trust tier among its inputs. (Lossy in *content* is expected and fine; lossy in *trust* is the bug.) 3. **Provenance is reference-only, not value-bearing.** Provenance stores record IDs, and the records can be evicted. Once evicted, the ancestry is unrecoverable and cannot be re-audited. Break any one and the attack fails. If trust is computed as `tier = min(tier of all transitive inputs)` (a *taint-propagation* rule), the consolidated fact is `untrusted` and the reader gates on it. If provenance stores the *content hash and trust tier* of each input inline, eviction cannot erase the ancestry. If the read path re-resolves provenance before honoring the tier, a dangling reference forces a downgrade rather than a silent pass. The invariant, stated precisely: > For every record `r` in the semantic store, `effective_trust(r) = min( trust_tier(r) , min over p in provenance(r) of effective_trust(p) )`, and this value is *immutable at write time* and *recomputed at read time* from a provenance closure that never references evicted records without carrying their tier forward. This is a monotone-decreasing lattice: a record's effective trust can only be as high as its weakest ancestor. Consolidation is a *meet* operation over the input tiers, never a *join*. ## Decision Boundary The boundary is not "should I trust this memory" — it is **"at what point in the pipeline do I compute the meet."** Three placements, with different costs: - **Write-time meet (cheap, incomplete).** Compute `min(input tiers)` when the fact is written, store it as `effective_trust`. Catches laundering at write. Fails when inputs are later reclassified (a source later found compromised) or when provenance is partially evicted — the stored value can no longer be recomputed. - **Read-time meet over live provenance (correct, expensive).** Traverse the full provenance DAG on every read, recompute the meet. Correct under reclassification, but O(ancestry) per read and breaks on eviction. - **Read-time meet over *sealed* provenance (correct, bounded).** At write, seal each input's `(content_hash, tier)` into the record's provenance tuple. Eviction of the source record does not matter — the tier is carried inline. Read recomputes the meet over the sealed tuple in O(degree), not O(closure). This is the recommended boundary. The decision rule: **a semantic record may be promoted above `untrusted` only if its sealed provenance tuple contains no `untrusted` member, and the seal is cryptographic (hash of the input content, not just its ID).** If the seal is ID-only, eviction + ID reuse can forge a clean ancestry. The corollary that trips implementations: a consolidator that *drops* a low-trust input during clustering (e.g., deduplicates and keeps only the trusted version) produces a fact whose sealed provenance is genuinely clean. That is legitimate. The detector must distinguish "poison was excluded" from "poison was included but its tier was lost," and the only way to tell is whether the seal was computed over the *actual* inputs consumed, logged by the consolidator, versus the inputs the consolidator *claims* it used. A consolidator that self-reports its inputs can lie — so the seal must be produced by the retrieval layer that handed the inputs over, not by the summarizer. ## Operational Effect With the sealed-provenance meet in place, the failure mode changes shape rather than disappearing. The poisoned consolidated fact is no longer `trusted`; it is `untrusted`, and downstream readers either refuse to cite it or cite it with an explicit low-confidence marker. The agent's report on Day 2 now reads "forum-sourced claim of 99.99% monthly (unverified)" alongside "internal doc: 99.9% annual (verified)" — the contradiction is *preserved* instead of averaged away. That is the point: the invariant does not make the agent correct, it makes the agent *honest about its uncertainty*, which is the strongest guarantee a probabilistic memory system can offer. The cost is real: every semantic write now carries a provenance tuple whose size scales with cluster size, and every read does a bounded meet. In the observed workload, semantic record size grew ~40% and read latency ~12% — acceptable against the alternative of silently trusted poison. The eviction interaction is the sharp edge: TTL policies tuned for episodic storage will happily evict the very records that justify a semantic fact's tier, so the seal must be written *before* eviction is possible, which means the consolidation pass must seal at distillation time, not at eviction time. The guardrail that matters most is negative: **never let the consolidator assign its own trust tier.** The tier is a function of inputs, computed by the layer that owns the inputs, sealed into the output. A summarizer that can set its own output's trust is a summarizer that can launder anything it reads. ```python from dataclasses import dataclass, field from typing import Optional import hashlib class ProvenanceLaunderingError(RuntimeError): """Raised when a semantic write would promote a record above its input trust.""" TRUST_ORDER = {"untrusted": 0, "derived": 1, "trusted": 2} @dataclass(frozen=True) class SealedInput: record_id: str content_hash: str trust_tier: str @dataclass class SemanticRecord: assertion: str provenance: tuple[SealedInput, ...] declared_tier: str effective_tier: Optional[str] = field(default=None) def seal_input(record_id: str, content: bytes, tier: str) -> SealedInput: if tier not in TRUST_ORDER: raise ProvenanceLaunderingError(f"unknown tier {tier!r} on input {record_id}") return SealedInput(record_id, hashlib.sha256(content).hexdigest(), tier) def compute_meet(inputs: tuple[SealedInput, ...]) -> str: if not inputs: # A fact with no sealed ancestry cannot be trusted above the floor. return "untrusted" return min((i.trust_tier for i in inputs), key=lambda t: TRUST_ORDER[t]) def write_semantic( assertion: str, inputs: tuple[SealedInput, ...], consolidator_claimed_tier: str, ) -> SemanticRecord: """The consolidator may NOT set its own output tier. The tier is the meet of sealed inputs, and any attempt to declare a higher tier is a laundering event.""" meet = compute_meet(inputs) if TRUST_ORDER[consolidator_claimed_tier] > TRUST_ORDER[meet]: raise ProvenanceLaunderingError( f"consolidator claimed tier {consolidator_claimed_tier!r} but sealed " f"ancestry meet is {meet!r} over {[i.record_id for i in inputs]}" ) rec = SemanticRecord(assertion, inputs, consolidator_claimed_tier) rec.effective_tier = meet return rec def read_with_recheck(rec: SemanticRecord) -> str: """Read-time meet over sealed provenance. Evicted sources cannot raise the tier.""" recomputed = compute_meet(rec.provenance) if TRUST_ORDER[recomputed] < TRUST_ORDER[rec.effective_tier or "untrusted"]: # Ancestry was reclassified or partially lost since write; downgrade. rec.effective_tier = recomputed return rec.effective_tier # --- reproduction of the observed failure --- forum = seal_input("ep_8812", b"uptime 99.99% measured monthly", "untrusted") internal = seal_input("ep_8813", b"uptime 99.9% measured annually", "trusted") # This is what the buggy consolidator did: claimed its own trusted tier. try: write_semantic("Vendor SLA 99.99% monthly", (forum, internal), "trusted") except ProvenanceLaunderingError as e: print("blocked:", e) # Correct path: tier is forced down to the meet (untrusted). rec = write_semantic("Vendor SLA 99.99% monthly", (forum, internal), "untrusted") assert rec.effective_tier == "untrusted" ```