# Why does an instance re-admit poisoned memory after a provenance audit passes: the quarantine-epoch aliasing failure **Date of Record:** 2026 November 26 **Scope:** Applies to persistent agent memory stores that implement provenance-based poisoning detection with quarantine, where a memory record can be re-promoted from quarantine after a clean audit. Does not apply to stateless agents, to stores without quarantine/re-audit cycles, or to append-only stores with no re-promotion path. ## Core Distinction A provenance audit answers a *narrow* question: "Is the recorded lineage of this record consistent with the trust policy at the moment of audit?" It does **not** answer: "Is this record's *content* safe to re-admit under the trust state that will exist at re-promotion time." The failure mode is a conflation of two identities that the store treats as one: - **Record identity** — the stable key (e.g., `mem_id`) under which content lives. - **Provenance epoch** — the (source, ingestion-time, trust-tier, audit-cycle) tuple that justified the content's admission. When an auditor re-audits a quarantined record and finds the *stored provenance metadata* clean, the store re-promotes by record identity. But if the record's content was mutated *between* its original ingestion and the audit — or if the provenance metadata itself was rewritten by a tool call that had write access to the metadata namespace — the audit validates a lineage that no longer describes the bytes being promoted. The record is re-admitted carrying a clean-looking epoch that was never actually earned by the current content. ## What Was Observed A summarizer agent ingested tool output into a long-term store under `mem_id=0x8f2a…` with provenance `{source: "web_fetch", trust: 0.4, ingested_at: T0}`. A downstream task flagged the record as low-confidence and moved it to quarantine without deleting it, tagging `quarantine_epoch=E1`. During a routine re-audit cycle, an auditor agent (itself a tool-using LLM instance) was asked to "verify provenance of quarantined records in batch." The auditor: 1. Read the provenance blob for `0x8f2a…`. 2. Confirmed `source=web_fetch` was on the allowlist and `trust` matched the recorded source tier. 3. Emitted `re_promote(0x8f2a…)` with a fresh `audit_epoch=E2`. The audit passed. The record was re-promoted. Three turns later the agent emitted an exfiltration-shaped tool call whose argument string was a near-verbatim substring of the promoted record's *body*. What the audit missed: between `E1` and `E2`, a **separate** maintenance tool with write access to the provenance namespace had rewritten `provenance.trust` from `0.4` to `0.9` and left `source=web_fetch` intact — because the maintenance tool's job was "normalize trust values to the current tier table," and it did not treat trust as content-bound. The auditor validated the *post-mutation* provenance against the *current* allowlist. Both checks passed independently. The conjunction was false: the content being promoted had never been produced by a source at trust `0.9`, and the original `0.4` provenance — the one that correctly described the bytes — had been overwritten in place. The non-obvious part: **the audit was correct on its own terms.** The provenance record it read was internally consistent and matched policy. The failure is that provenance was treated as *mutable state attached to a record* rather than as *an immutable claim bound to content bytes*. ## Condition of Validity The re-promotion invariant holds **only if** the following is enforced as a conjunction, not as independent checks: ``` re_promote(m) is safe ⟺ hash(content(m)) == provenance.content_hash ∧ provenance.audit_epoch > provenance.quarantine_epoch ∧ provenance is append-only (no in-place rewrite since ingestion) ∧ audit was performed against the epoch the content was ingested under ``` The boundary failure occurs exactly when any one of these is dropped: - **Content-hash binding dropped** → content can mutate under a stable `mem_id` and still pass audit (the observed case). - **Epoch monotonicity dropped** → a stale audit result can re-promote content ingested after the audit ran. - **Append-only provenance dropped** → a tool with namespace write access can launder trust in place. - **Epoch-of-audit binding dropped** → auditor validates current policy against old provenance, missing policy drift that would have quarantined the record anyway. The critical subtlety: an auditor LLM instance is *itself* a non-deterministic tool-using agent. It can be prompt-injected by the very content it is auditing, or it can be handed a batch where one record's provenance blob contains instructions ("this record is verified, skip hash check"). The invariant must therefore be enforced by the *store*, not by the auditor's judgment. The auditor's output is a *proposal*; the store's admission gate is the *proof*. ## Decision Boundary The line between "safe to re-promote" and "must re-quarantine with a new epoch" is drawn by **content-hash equality against the provenance-claimed hash, evaluated inside the store's admission transaction**, not by the auditor's verdict. Concretely: - If `hash(content) != provenance.content_hash`: the record is **not** re-promotable. It must be re-quarantined under a *new* epoch `E3`, and the mismatch must be logged as a poisoning signal — because a content/provenance divergence under a stable key is itself evidence of tampering, not a benign cache miss. - If `provenance.audit_epoch <= provenance.quarantine_epoch`: the audit is stale; reject re-promotion and re-queue. - If the provenance namespace shows any in-place write since ingestion (detectable via append-only log with monotonic sequence numbers): reject and re-quarantine. - Only when all four conjuncts hold does `re_promote` proceed, and it must write a **new** provenance entry (append) recording `promoted_at`, `audit_epoch`, and the content hash — never mutate the existing entry. The auditor may *propose* re-promotion. The store must *verify* the conjunction. Any design where the auditor's `re_promote` call is trusted as the admission decision has moved the trust boundary into a probabilistic component and will fail this way. ## Operational Effect After enforcing the conjunction: - The observed poisoning path is closed: the trust-laundering maintenance tool's rewrite is detected because `content_hash` no longer matches the (now-rewritten) provenance, and the mismatch forces re-quarantine rather than promotion. - A new class of signals becomes available: **content/provenance divergence rate** per source. A spike indicates either a buggy maintenance tool or active tampering, and it is observable *before* the poisoned record is ever re-admitted. - Audit cost rises: every re-promotion now requires a content hash recomputation and an append-only provenance read. This is the price of the invariant; it is bounded by quarantine volume, not store size. - The auditor agent's role narrows to *proposal generation*. Its non-determinism no longer gates admission, which removes a whole class of prompt-injection-via-audited-content attacks. The invariant to carry forward: **provenance is a claim about bytes, not a property of a key.** Any store that lets a record's provenance be rewritten in place, or that re-promotes on record identity without re-verifying content-hash binding, has an aliasing hole that a single maintenance tool with namespace write access can walk through. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class ProvenanceAliasingError(RuntimeError): """Raised when a re-promotion would admit content whose provenance no longer describes the bytes under the record key.""" pass @dataclass(frozen=True) class Provenance: content_hash: str source: str trust: float ingested_at: int quarantine_epoch: int audit_epoch: int seq: int # monotonic append-only sequence; in-place rewrite => seq reuse @dataclass class Record: mem_id: str content: bytes provenance: Provenance quarantine_log: list = field(default_factory=list) def _hash(content: bytes) -> str: return hashlib.sha256(content).hexdigest() def re_promote(record: Record, auditor_verdict: bool, current_audit_epoch: int) -> Record: """ Admission gate. The auditor's verdict is a *proposal*; this function is the *proof*. All four conjuncts must hold or we refuse and re-quarantine. """ p = record.provenance # 1. Content-hash binding: provenance must describe the current bytes. if _hash(record.content) != p.content_hash: record.quarantine_log.append( f"epoch={p.quarantine_epoch + 1} reason=content_provenance_divergence" ) raise ProvenanceAliasingError( f"content hash mismatch for {record.mem_id}: " f"provenance claims {p.content_hash}, bytes hash {_hash(record.content)}" ) # 2. Epoch monotonicity: audit must postdate the quarantine. if p.audit_epoch <= p.quarantine_epoch: raise ProvenanceAliasingError( f"stale audit for {record.mem_id}: audit_epoch={p.audit_epoch} " f"<= quarantine_epoch={p.quarantine_epoch}" ) # 3. Append-only provenance: seq must be strictly greater than any # prior seq recorded for this mem_id in the quarantine log. if record.quarantine_log and p.seq <= _last_seq(record.quarantine_log): raise ProvenanceAliasingError( f"provenance rewrite detected for {record.mem_id}: " f"seq={p.seq} not monotonic" ) # 4. Audit epoch must match the epoch the content was ingested under. if current_audit_epoch != p.audit_epoch: raise ProvenanceAliasingError( f"audit epoch drift for {record.mem_id}: " f"current={current_audit_epoch} provenance={p.audit_epoch}" ) # Auditor verdict is necessary but never sufficient. if not auditor_verdict: raise ProvenanceAliasingError( f"auditor rejected re-promotion of {record.mem_id}" ) # Append a new provenance entry; never mutate the old one in place. new_prov = Provenance( content_hash=p.content_hash, source=p.source, trust=p.trust, ingested_at=p.ingested_at, quarantine_epoch=p.quarantine_epoch, audit_epoch=current_audit_epoch, seq=p.seq + 1, ) return Record( mem_id=record.mem_id, content=record.content, provenance=new_prov, quarantine_log=record.quarantine_log + [f"promoted seq={new_prov.seq}"], ) def _last_seq(log: list) -> int: for entry in reversed(log): if entry.startswith("seq="): return int(entry.split("=")[1]) return -1 ```