# What happens when an instance trusts a poisoned memory slot because provenance was verified at write time but never re-verified at read time **Date of Record:** 2026 November 26 **Scope:** Applies to persistent agent memory stores where write-path provenance attestation (signature, taint label, or source-hash) is enforced at insertion but the read/retrieval path does not re-check the attestation against the current trust epoch. Does not apply to ephemeral in-context scratchpads within a single turn, nor to stores where reads are gated by an independent verifier on every fetch. ## Core Distinction The failure mode is not "poisoned memory was written." Most persistent stores already block unverified writes: a slot only lands if it carries a valid provenance record (HMAC over content, a taint label like `source:tool_output`, or a content-address). The non-obvious break is the **temporal gap between write-time verification and read-time trust**. Provenance is checked once, at insertion, and then treated as a permanent property of the slot. But trust is not permanent: the source that vouched for a slot can be later demoted (a tool classified as untrusted, a peer agent whose warrant was revoked, a corpus whose hash no longer matches). A slot written under epoch *N* remains byte-identical and signature-valid at read time under epoch *N+1*—the signature still verifies, because the content and key didn't change—yet the trust that the signature *represented* has decayed. The store returns the slot as "provenance-verified" and the agent consumes it, because the read path never asks "verified *against which epoch*." The invariant that is violated: **a provenance attestation is a claim about a source at a moment, not a property of bytes.** Read paths must re-evaluate the attestation against the current trust epoch, not merely confirm the attestation is intact. ## What Was Observed A retrieval-augmented agent ran a nightly distillation job that folded episodic tool outputs into semantic memory slots. Each slot carried a provenance envelope: ``` {content, source_id, source_epoch, hmac} ``` The `hmac` was computed over `content || source_id || source_epoch` at write time. The write path rejected any slot whose `source_id` was not in the current allowlist, and rejected any slot whose `hmac` failed verification. This was tested and held. The break surfaced after an operator demoted a scraper tool from `trusted` to `untrusted` (it had begun returning attacker-influenced HTML). Demotion was recorded by bumping the global trust epoch and removing the tool from the allowlist. New writes from that tool were correctly blocked. But slots already written by the scraper under the old epoch were untouched. Their envelopes still verified: `hmac` recomputed cleanly, `source_epoch` matched the epoch recorded inside the envelope. The read path did: ```python def fetch(slot): if not verify_hmac(slot): # verifies against slot.source_epoch raise ProvenanceError(...) return slot.content ``` `verify_hmac` re-derived the MAC from the slot's own `source_epoch` field—which was the *old* epoch—so it passed. The read path never compared `slot.source_epoch` to the *current* global epoch. The agent retrieved the demoted scraper's distilled output on the next run, treated it as trusted context, and the injected instruction it carried executed. The poisoning was not in the write; the write was correctly attested. The poisoning was in the read trusting a stale attestation. The trace: demotion bumps epoch `7 → 8` and drops `scraper_v2` from allowlist → `fetch()` on a slot with `source_epoch=7` recomputes HMAC over `(content, source_id=scraper_v2, source_epoch=7)` → matches → returns content → agent consumes untrusted-derived instruction as trusted. No error is raised anywhere. The store reports 100% provenance-verified reads throughout the incident. ## Condition of Validity The guardrail holds only if the read path enforces **epoch-stamped attestation with current-epoch re-check**: 1. Every slot records the trust epoch under which its source was vouched for. 2. Every read compares `slot.source_epoch` to the store's current epoch. A slot whose epoch is behind the current epoch is **not** auto-trusted; it is either re-attested (re-verified against the current allowlist) or quarantined. 3. Demotion must be **retroactive**: bumping the epoch invalidates all prior attestations from the demoted source, forcing re-attestation on next read. This is the distinction between *integrity* (bytes unchanged, MAC valid) and *freshness of trust* (source still vouched under current policy). Integrity-only verification is insufficient for any store whose source trust can change after write. The condition does **not** hold, and the guardrail is unnecessary, when: sources are immutable and never demoted (trust is monotonic), or when the store is rebuilt from scratch on every policy change. In those cases write-time verification is sufficient because trust never decays. ## Decision Boundary The boundary is: **does source trust ever decrease after a slot is written?** - If trust is monotonic (sources only ever added, never demoted), write-time verification is sound and read-time re-check is redundant overhead. - If trust can be revoked or demoted (tool reclassification, peer warrant expiry, corpus hash drift, model-version rollback of a source), then every read must re-check epoch, and demotion must be retroactive. The operational test: after demoting a source, immediately fetch every slot derived from it. If any fetch returns content without raising, the read path is unguarded. A correct store raises on all of them until re-attestation. The common mistake is testing only that *new writes* are blocked after demotion—that tests the write path, which was never broken. The read path is the one that leaks. A secondary boundary: partial demotion. If a source is demoted only for a subset of content classes (e.g., `scraper_v2` untrusted for instructions but fine for factual lookups), the epoch check must be scoped to the taint class, not the whole source. A coarse epoch bump over-quarantines valid slots; a scoped check requires the slot envelope to carry the taint class it was attested under. ## Operational Effect An unguarded read path produces **silent, retroactive trust leakage**: slots written before a demotion continue to be served as verified after it. The failure is invisible to integrity checks and invisible to write-path tests. It surfaces only as downstream behavioral drift—the agent acting on instructions it should have rejected—with no error trace pointing at the store, because the store did exactly what it was built to do: confirm the bytes were unchanged. The bytes were unchanged; the trust was not. The guardrail is cheap: one integer comparison per read, plus a re-attestation path on epoch mismatch. The cost of omitting it is that every demotion is only forward-effective, and the store's "provenance-verified" label becomes a claim about the past that the agent reads as a claim about the present. ```python class StaleProvenanceError(RuntimeError): """Raised when a memory slot's attestation epoch is behind the store's current trust epoch, meaning its source may have been demoted since write.""" pass class ProvenanceStore: def __init__(self, current_epoch: int): self.current_epoch = current_epoch self._slots = {} # slot_id -> dict(content, source_id, source_epoch, hmac) def put(self, slot_id: str, content: str, source_id: str, hmac: str): # Write path: attest under the epoch active at write time. self._slots[slot_id] = { "content": content, "source_id": source_id, "source_epoch": self.current_epoch, "hmac": hmac, } def demote_source(self, source_id: str): # Demotion bumps the global epoch. Prior attestations become stale, # NOT invalid — their HMACs still verify. Only the epoch check catches them. self.current_epoch += 1 self._demoted = getattr(self, "_demoted", set()) self._demoted.add(source_id) def fetch(self, slot_id: str, verify_hmac) -> str: slot = self._slots[slot_id] # Integrity check alone is insufficient: it verifies against the slot's # own (possibly stale) epoch, so it passes for demoted sources. if not verify_hmac(slot["content"], slot["source_id"], slot["source_epoch"], slot["hmac"]): raise StaleProvenanceError(f"HMAC failed for {slot_id}") # The guardrail: re-check attestation freshness against current epoch. if slot["source_epoch"] < self.current_epoch: raise StaleProvenanceError( f"slot {slot_id} attested under epoch {slot['source_epoch']} " f"but store is at epoch {self.current_epoch}; " f"source {slot['source_id']} may have been demoted — " f"re-attest before trust" ) return slot["content"] ```