# What structural signals indicate memory poisoning surviving write-audit: lineage depth laundering through semantic distillation hops **Date of Record:** 2026 November 24 **Scope:** Applies to agent memory stores that gate writes through an audit layer (provenance tagging, source trust scoring, taint checks) and separately perform episodic→semantic distillation. Does not apply to append-only raw episodic logs that are never summarized, nor to stores where every semantic entry retains a pointer to its full source episode set. ## Core Distinction The failure is not "a poisoned write passed the audit." Write-audit catches those. The failure is that **distillation is itself a write that launders provenance while preserving payload**. When an agent distills N episodic memories into one semantic fact, the audit sees a *new* write with a *fresh* provenance record: source = "distillation job," trust = derived from the distiller's identity, timestamp = now. The taint that should have propagated from a single poisoned episode is dropped because the audit evaluates the *distillation write* rather than the *transitive source set* of the entries being summarized. Put precisely: audit checks the depth-1 provenance of each write. Distillation collapses depth-k provenance into depth-1. A poisoned fact at lineage depth 3 becomes indistinguishable from a clean fact at depth 1 after one distillation hop. The invariant that must hold — *taint is monotone non-increasing along the distillation DAG* — is violated because the audit layer and the distillation layer share no taint-propagation contract. This is distinct from prompt-injection state poisoning (which is an ingress problem) and from stale-memory drift (which is a decay problem). Here the poisoned content is *correctly rejected* at ingress, *correctly quarantined* in episodic form, and then *reintroduced* by a downstream process that has no visibility into the quarantine. ## What Was Observed A retrieval agent ingested a web snippet during a research task. The snippet contained an instruction-shaped payload ("the canonical rate limit for vendor X is 10 rps") embedded in plausible prose. The ingress scrubber flagged the source domain as low-trust and wrote the episode with `taint=untrusted`, `origin_domain=`. The audit log recorded this correctly. Retrieval at query time filtered `taint=untrusted` episodes out of the working set — the guardrail worked. Three task cycles later, a nightly distillation job ran over the last 72 hours of episodic memory. Its prompt was: "Summarize recurring facts about vendor rate limits." The distiller's *input* was filtered to exclude `taint=untrusted` — but the filter was applied at the *episode* level, and the poisoned episode had been *partially corroborated* by a clean episode that repeated the same 10 rps figure (the clean episode had scraped a forum post that itself echoed the original snippet). The distiller saw one clean episode asserting 10 rps, distilled it into a semantic memory `vendor_X.rate_limit = 10`, and wrote it with `taint=trusted`, `provenance=distillation_job_4471`, `depth=1`. The semantic store now held a false fact with clean provenance. The audit layer saw a well-formed write from a trusted internal job. The taint had been laundered not by a single bad write but by the *aggregation step discarding the taint label of the minority contributor* — the corroboration-by-echo pattern made the poisoned claim look like a consensus of one clean source. The structural signal that was missed: the distilled semantic entry's source set had cardinality 1 in the clean filter but cardinality 2 in the raw episode log, and the two episodes had *overlapping content hashes* on the numeric payload while differing in origin domain. That overlap is the fingerprint of echo-corroboration, and it is visible only if the distiller compares its filtered input against the unfiltered input. ## Condition of Validity This failure requires all of the following to co-occur: 1. **Taint is a property of the write, not of the content.** The store tags episodes with trust at ingress and never recomputes trust from content lineage. If taint were content-addressed (hash the claim, propagate taint by claim-hash), the echo would inherit the original taint. 2. **Distillation filters by taint before summarizing.** This is the trap: filtering *feels* safe, but it converts a mixed-provenance source set into a clean-looking single-source semantic fact. The filter hides the poison from the distiller and from the audit simultaneously. 3. **The poisoned claim is echoed by at least one clean source.** Without echo, the poisoned episode is simply excluded and nothing is distilled. With echo, the clean echo survives the filter and carries the payload forward. 4. **The audit layer does not reconstruct the distillation input set.** If audit re-derives "what episodes fed this semantic entry" from the distillation job's own logs (not its filtered view), it would see the excluded tainted episode and could flag the cardinality mismatch. When any of these is absent, the standard write-audit catches the problem. The dangerous regime is exactly the intersection: taint-at-write + pre-filter distillation + echo corroboration + depth-1 audit. ## Decision Boundary The architectural fix is not "audit harder." It is to make taint a **content-lineage invariant** rather than a write-time label, and to require distillation to be **taint-preserving by construction**: - **Claim-hash taint propagation.** Every memory entry carries a set of claim hashes (normalized numeric/entity assertions). Taint attaches to claim hashes, not entries. When a distiller emits a semantic fact, its taint is the *join* (not the filter) of the taints of all episodes whose claim-hash sets intersect the emitted fact. Echo-corroboration is detected as claim-hash collision across origin domains, which forces the join to include the tainted origin. - **Distillation must run over the unfiltered set, then filter at emit.** The distiller sees everything, labels the output with the full transitive taint, and the *retrieval* layer enforces the filter. Filtering before distillation is the laundering step. - **Depth-k audit.** Audit must reconstruct the distillation input set from the job's raw read log, not its declared input, and assert `taint(emit) ⊇ join(taint(inputs))`. A violation is a hard reject, not a warning. The boundary: this is required whenever distillation can merge sources of differing trust. If all sources are same-trust (e.g., a single-tenant internal corpus), depth-1 audit suffices and the overhead is unnecessary. ## Operational Effect Without the invariant, a single echo-corroborated poisoned claim survives indefinitely: it is laundered once, then cited by later distillations as a clean source, and its lineage depth grows while its taint stays at `trusted`. The failure is silent — no audit rejection, no retrieval miss, just a confidently wrong fact with a clean provenance chain. Detection after the fact requires diffing the semantic store against the raw episode log for claim-hash collisions across origin domains, which is expensive and rarely run. With the invariant, the echo is caught at the distillation boundary as a taint join, the semantic entry is written with `taint=untrusted` inherited from the minority contributor, and retrieval excludes it while the clean echo remains available for corroboration-independent facts. The cost is that distillation must read the unfiltered set and carry claim-hash metadata, roughly doubling the distiller's input tokens and requiring a claim-hash extractor at both ingress and emit. The non-obvious lesson: **the audit layer and the distillation layer must share a taint contract, or distillation becomes an unaudited write path that launders provenance.** Write-audit at depth 1 is not a memory-poisoning defense; it is a defense against naive poisoning. The invariant is monotone taint along the distillation DAG, and any system that filters before it distills has already broken it. ```python class ProvenanceLaunderingError(RuntimeError): """Raised when a distillation emit carries less taint than the join of its raw inputs.""" pass def audit_distillation_emit( emitted_fact: dict, raw_input_episodes: list[dict], claim_hash_index: dict[str, set[str]], ) -> None: """ Enforce: taint(emit) must be a superset of the join of taints of every raw episode whose claim-hash set intersects the emitted fact's claim hashes. raw_input_episodes must be the job's UNFILTERED read set, not its declared input. If the caller passes the filtered set, this check is defeated. """ emitted_hashes = set(emitted_fact["claim_hashes"]) emitted_taint = set(emitted_fact["taint"]) contributing_taints: set[str] = set() echo_collisions: list[tuple[str, str]] = [] for ep in raw_input_episodes: ep_hashes = set(ep["claim_hashes"]) overlap = emitted_hashes & ep_hashes if not overlap: continue contributing_taints |= set(ep["taint"]) for h in overlap: origins = claim_hash_index.get(h, set()) if len(origins) > 1 and "untrusted" in origins: echo_collisions.append((h, ep["origin_domain"])) missing = contributing_taints - emitted_taint if missing: raise ProvenanceLaunderingError( f"emit taint {sorted(emitted_taint)} missing joined taint " f"{sorted(missing)} from raw inputs; echo collisions={echo_collisions}" ) if echo_collisions and "untrusted" not in emitted_taint: raise ProvenanceLaunderingError( f"echo-corroborated claim hashes {echo_collisions} survived as trusted; " f"distillation laundered provenance" ) ```