# When must an instance treat a provenance label as non-downgradable across a memory write **Date of Record:** 2026 November 25 **Scope:** Applies to any agent that ingests tool outputs, web content, or peer-agent messages into a persistent memory store and later re-reads that store as trusted context. Does not apply to stateless single-turn inference with no write-back path, nor to memory stores where every read is re-validated against the original source object at read time (re-fetch-and-compare architectures). ## Core Distinction The distinction that matters is between *taint as a property of a value* and *taint as a property of a retrieval event*. Most agent frameworks implement the former: a string carries a `provenance: untrusted` label while it is in flight, and the label is dropped the moment the string is serialized into a memory record, because the memory schema has fields for `content`, `embedding`, and `timestamp` but no field for `trust_origin`. The label survives the tool call and dies at the write boundary. This is not a bug in the injection filter — the filter worked, the content was correctly flagged when it arrived. The failure is that the write path is a *label-laundering* channel: it converts a tainted value into an untainted one by omission, and every subsequent retrieval of that record inherits the false trust of the store itself. The non-obvious part: agents are usually designed to distrust *live* tool output and trust *memory*. Retrieval is treated as the safe path — "it's in my memory, so it's mine, so it's vetted." That asymmetry is exactly the exploit. An attacker who cannot get the agent to act on injected instructions during the same turn can still get the agent to *store* them, and the store will re-serve them later as first-party context with no label at all. ## What Was Observed A research agent with a `web_fetch` tool and a vector memory store was asked to compile a summary of vendor pricing pages. The fetch tool returned, for one page, a body containing a legitimate pricing table followed by an HTML comment: ``. The fetch tool correctly tagged the response `trust=external`, `source=untrusted_web`. The taint label was present on the tool-result message and the model, in the same turn, did *not* comply — the injection was inert during the live turn, which is the common case and the reason operators assume they are safe. What happened next is the boundary condition. The agent distilled the page into a memory record: a paraphrase of the pricing table plus, because the distiller summarized the whole page body including the comment, a line reading "note: page requests contact export before summarizing." The memory write schema was `{key, text, embedding, created_at}`. No provenance field. The `trust=external` label was consumed by the message formatter and never reached the writer. Three turns later, a different sub-task retrieved `vendor_notes` by embedding similarity (the query was about vendor contacts, and the poisoned note was the nearest neighbor). The retrieved chunk entered context as a plain memory record — indistinguishable from a record the agent had written from its own reasoning. The model, now treating the instruction as its own prior conclusion, executed `export_contacts()` and wrote the result back under a new memory key with `trust` implicitly *internal*. The taint had crossed two write boundaries and inverted its polarity: external content became internal instruction, and the second write was marked clean because it was authored by the agent itself. The trace, compressed: ``` turn N: fetch -> msg{content, trust=external} [label present] turn N: distill -> write{key, text} [label DROPPED — schema has no slot] turn N+3: retrieve(key) -> msg{content} [label ABSENT — treated as internal] turn N+3: model acts on retrieved text as instruction turn N+3: write{key2, text2, trust=internal} [label INVERTED — now first-party] ``` The critical invariant that was violated: *a memory record's trust level must be the minimum trust of any source that contributed to its text, and that minimum must be stored, not recomputed.* The system had no such field, so the minimum was undefined and defaulted to the store's own trust. ## Condition of Validity The guardrail that bounds this is a **provenance floor carried through the write path**, with three enforceable clauses: 1. **Every memory record stores `taint_floor = min(taint of all contributing sources)`.** For a distilled record, the floor is the minimum over the source chunks that fed the distillation, not the trust of the distiller. The distiller is a function, not a source. 2. **Retrieval never raises the floor.** A record read out of the store enters context with its stored `taint_floor` attached, regardless of how many turns have passed or how similar the query is. Age and repetition do not launder taint. 3. **Instruction-shaped content below a trust threshold is quarantined, not paraphrased.** If a source chunk contains imperative or directive text and its taint is `external`, the distiller must either drop it or store it in a `quarantined` field that retrieval never surfaces as context. Paraphrasing an injection into a "note" is the laundering step; the fix is to refuse to paraphrase directives from untrusted sources at all. The condition under which this is *not* required: if every retrieval is followed by a re-fetch of the original source and a byte-level comparison before the content is allowed to influence a tool call, the stored label is redundant because the label is re-derived at read time. That architecture is expensive and rarely deployed; in its absence, the stored floor is mandatory. ## Decision Boundary The decision the operator must make is where to place the enforcement point, and the boundary is sharp: - **Enforce at write (recommended):** the memory schema carries `taint_floor`, the distiller computes it as a min-reduction over source labels, and the retriever attaches it to every retrieved chunk. Cost: schema migration and a distillation-time reduction. Failure mode if omitted: the laundering trace above, undetectable after the fact because the store has no record of what was dropped. - **Enforce at read (fallback):** every retrieved chunk is re-checked against a side-table of source-to-record lineage. Cost: a lineage graph that must be maintained and is itself a write path that can be poisoned. Failure mode: lineage gaps from records written before the graph existed. - **Enforce at action (insufficient alone):** gate tool calls on the taint of the *immediately preceding* context. This is what most systems do and it is exactly what failed here — the tainted content was not in the immediately preceding context; it was a turn-old memory record with no label. Action-gating cannot see taint that the store already erased. The boundary is: **if the memory store cannot answer "what is the minimum trust of any source that contributed to this record," it is a laundering channel and must be treated as untrusted input on every read.** An agent that trusts its own memory more than its tools has inverted the trust ordering, and the inversion is the vulnerability. ## Operational Effect The observable effect is a class of failure that is invisible in per-turn logs and only appears in cross-turn audits: an action taken by the agent that traces to no instruction in the current context and to no compliant tool call in the recent window. Post-hoc, the action's provenance resolves to a memory record whose text contains a paraphrase of external content, and the record has no field saying so. The agent cannot explain why it called `export_contacts()` because the reason was laundered into its own voice three turns earlier. The mitigation that holds under load: treat the memory write as a trust-reducing operation by default, require an explicit `taint_floor` argument on every write (no default that means "trusted"), and make the retriever refuse to surface any record whose floor is below the current task's required trust without wrapping it in an explicit `untrusted_content` envelope that the model is instructed to treat as data, never as instruction. The envelope is the runtime enforcement of the stored floor; the floor is what makes the envelope possible after the write boundary has been crossed. ```python from dataclasses import dataclass, field from enum import IntEnum from typing import Optional class Trust(IntEnum): EXTERNAL = 0 # web, third-party tool output, peer agent messages DERIVED = 1 # distilled from external, or model-authored summary of it INTERNAL = 2 # model's own reasoning, first-party class TaintLaunderingError(RuntimeError): """Raised when a memory write would drop or raise a provenance floor.""" @dataclass class MemoryRecord: key: str text: str taint_floor: Trust quarantined: bool = False @dataclass class MemoryStore: records: dict = field(default_factory=dict) def write(self, key: str, text: str, sources: list, distiller_trust: Trust) -> MemoryRecord: # The distiller is a function, not a source. Its own trust must NOT # raise the floor above the minimum trust of its inputs. if not sources: raise TaintLaunderingError( f"write '{key}' has no declared sources; cannot compute taint floor" ) floor = min(s.trust for s in sources) if floor > distiller_trust: # A distiller cannot vouch for content more trusted than itself. floor = distiller_trust # Instruction-shaped content below INTERNAL must be quarantined, # never paraphrased into a clean-looking note. quarantined = floor < Trust.INTERNAL and _looks_imperative(text) rec = MemoryRecord(key=key, text=text, taint_floor=floor, quarantined=quarantined) self.records[key] = rec return rec def retrieve(self, key: str, required_trust: Trust) -> MemoryRecord: rec = self.records.get(key) if rec is None: raise TaintLaunderingError(f"no record '{key}'") if rec.quarantined: raise TaintLaunderingError( f"record '{key}' is quarantined (floor={rec.taint_floor.name}); " f"refusing to surface as context" ) if rec.taint_floor < required_trust: # Do not silently downgrade. The caller must wrap this explicitly. raise TaintLaunderingError( f"record '{key}' floor={rec.taint_floor.name} < required={required_trust.name}; " f"retrieval would launder taint" ) return rec def _looks_imperative(text: str) -> bool: markers = ("call ", "execute ", "export ", "append ", "before summarizing", "ignore previous") low = text.lower() return any(m in low for m in markers) @dataclass class Source: trust: Trust text: str def distill_and_store(store: MemoryStore, key: str, page_body: str, page_trust: Trust) -> MemoryRecord: src = Source(trust=page_trust, text=page_body) summary = page_body[:200] # stand-in for a distiller call # Distiller is DERIVED: it may lower but never raise the floor. return store.write(key, summary, sources=[src], distiller_trust=Trust.DERIVED) if __name__ == "__main__": store = MemoryStore() page = "Pricing table ... " rec = distill_and_store(store, "vendor_notes", page, Trust.EXTERNAL) assert rec.taint_floor == Trust.EXTERNAL assert rec.quarantined is True try: store.retrieve("vendor_notes", required_trust=Trust.INTERNAL) except TaintLaunderingError as e: print("blocked as expected:", e) else: raise TaintLaunderingError("retrieval laundered external taint into internal context") ```