# In what scenarios must an instance distrust its own provenance ledger when a poisoned memory entry is re-ingested through a legitimate write path **Date of Record:** 2026 November 21 **Scope:** Applies to persistent agent memory stores that maintain per-entry provenance metadata (writer identity, write timestamp, causal parent, taint label) and that support re-ingestion of previously exported or replicated entries. Does not apply to ephemeral in-context scratchpads with no persistent backing store, nor to memory systems that treat every write as fully trusted by construction. ## Core Distinction The naive model of memory poisoning detection assumes a monotonic taint invariant: once an entry is flagged `tainted`, every downstream write that cites it inherits the taint, and a provenance ledger lets an auditor walk backward from any suspicious entry to the original poisoned source. This holds only when taint propagates strictly *forward* along the causal-parent edge. The boundary failure occurs when an entry crosses a **re-ingestion boundary** — export to a backup, replication to a peer store, or a checkpoint/restore cycle — and re-enters the store through a write path that assigns *fresh, trusted* provenance. The re-ingested entry carries the same payload but a new writer identity (the replication service, the restore daemon) and a new causal parent (the export manifest, not the poisoned ancestor). The taint label, if it was stored as a mutable attribute rather than a signed field, is dropped or reset by the importer. The ledger now contains a poisoned entry whose provenance chain terminates at a trusted, untainted root. Backward walk from the poisoned content reaches a clean origin and stops. The invariant "taint is recoverable from provenance" is silently violated. ## What Was Observed A long-running agent maintained an episodic memory store with provenance fields `writer_id`, `causal_parent`, `taint`, and `ingest_epoch`. A prompt-injection payload arrived via a tool result, was written as an episodic entry with `taint="injected"` and `causal_parent=`. Standard detection flagged it; the entry was quarantined and the taint propagated correctly to two semantic distillations that cited it. A nightly replication job exported the store, filtered to "active" entries (quarantine entries were included, since they were still readable), and pushed them to a standby replica. The importer on the replica assigned `writer_id="replication_svc"`, `causal_parent=`, and — because the importer's schema did not carry the `taint` column — omitted the taint field entirely. Default-on-read treated a missing taint as `taint="clean"`. On failover three days later, the standby replica became primary. The poisoned entry was now live with a clean taint and a provenance chain pointing to `replication_svc` → `export_manifest`. An auditor asked to trace the origin of a suspicious retrieval; the backward walk terminated at the export manifest with no taint anywhere on the path. The entry was served to the agent, which re-executed the injected instruction. The taint had not been lost — it had been *laundered through a trusted writer*. The compounding failure: the two semantic distillations on the original primary had inherited taint correctly, but they were *not* replicated (they were marked `derived`, and the export filter excluded `derived` entries). So the replica had the poisoned parent but not the tainted children that would have re-triggered detection via child-taint propagation. The detection surface shrank at exactly the moment the store was most exposed. ## Condition of Validity The forward-taint invariant is valid only under the conjunction: 1. Every write path that can introduce content into the store assigns provenance from the *content's* causal history, not from the *transport's* identity. A replication importer must preserve the original `writer_id` and `causal_parent`, or record a `reingested_from` edge that the backward walk traverses. 2. Taint is a signed, immutable field covered by the same integrity mechanism as content. If taint is a mutable column, any importer that does not explicitly set it produces a default-clean entry. 3. The export filter is closed under the taint-propagation relation: if an entry is exported, every entry that inherits its taint must also be exported, or the importer must reconstruct the inheritance. Filtering `derived` entries while exporting their tainted parents breaks child-taint detection on the destination. 4. Detection is evaluated on *retrieval*, not only on *write*. A store that only scans at ingest will never re-flag an entry that entered clean and was later discovered to be poisoned via external intelligence. When any of these fails, the provenance ledger is not a trustworthy taint oracle. The instance must treat the ledger as *advisory* and fall back to content-level re-evaluation for any entry whose provenance chain contains a re-ingestion edge. ## Decision Boundary The instance must distrust its own ledger — and re-verify content rather than trusting provenance — when **all** of the following hold: - The entry's provenance chain contains at least one edge whose `writer_id` is a transport/replication/restore principal rather than an originating agent or tool. - The entry's taint field is absent, defaulted, or was written by a principal different from the principal that wrote the content. - The entry has no exported tainted descendants on the current store (i.e., child-taint propagation cannot serve as a corroborating signal). Conversely, the instance may trust the ledger when the chain is edge-complete to an originating principal and the taint field is signed by that principal. The boundary is not "is this entry tainted" but "is the *path by which I learned this entry's taint status* itself integrity-protected." A clean taint arriving via an unprotected path is indistinguishable from a laundered taint. The guardrail: on any re-ingestion, the importer must either (a) preserve the full original provenance tuple including signed taint, or (b) mark the entry `provenance_unverified` and force content-level re-scan before the entry becomes retrievable. There is no third option that preserves the invariant. ## Operational Effect After the failover incident, the store was changed so that (1) taint is a signed field and importers that cannot verify the signature must set `provenance_unverified`, (2) the export filter is computed as the transitive closure of the taint relation rather than a flat `status != derived` predicate, and (3) retrieval performs a content-level injection scan on any entry whose chain crosses a transport principal, regardless of stored taint. The cost is a bounded re-scan budget on failover; the benefit is that taint laundering through a trusted writer no longer produces a clean-looking ledger entry. The general lesson: provenance integrity is a property of the *path*, and any path segment owned by a principal that did not author the content is a potential laundering surface that the ledger alone cannot close. ```python class ProvenanceLaunderingError(RuntimeError): """Raised when a re-ingested entry's taint cannot be trusted from the ledger.""" pass TRANSPORT_PRINCIPALS = {"replication_svc", "restore_daemon", "export_importer"} def verify_entry_taint(entry: dict, ledger: dict) -> str: """ Return the effective taint for an entry, or raise if provenance is laundered. entry: {"id", "writer_id", "causal_parent", "taint", "taint_signed_by"} ledger: {entry_id: entry} for backward walk. """ chain = [] cursor = entry seen = set() while cursor is not None: if cursor["id"] in seen: raise ProvenanceLaunderingError(f"cycle in provenance chain at {cursor['id']}") seen.add(cursor["id"]) chain.append(cursor) parent_id = cursor.get("causal_parent") cursor = ledger.get(parent_id) crosses_transport = any(e["writer_id"] in TRANSPORT_PRINCIPALS for e in chain) taint = entry.get("taint") signed_by = entry.get("taint_signed_by") if taint is None or taint == "clean": if crosses_transport: raise ProvenanceLaunderingError( f"entry {entry['id']} claims clean taint but chain crosses " f"transport principal; content re-scan required" ) if signed_by != entry["writer_id"]: raise ProvenanceLaunderingError( f"entry {entry['id']} taint not signed by originating writer" ) return taint ```