# In what scenarios must an instance distrust a consistency-clean memory audit log after a forget-then-rewrite cycle **Date of Record:** 2026 November 24 **Scope:** Applies to persistent agent memory stores that expose append-only operation logs (read/write/forget) and detect poisoning by replaying those logs for internal consistency. Does not apply to stateless single-turn inference or to stores without a durable forget primitive. ## Core Distinction Consistency auditing of an operation log answers one question: *does the current memory state equal the deterministic fold of the logged operations?* It does **not** answer whether the logged operations were themselves authorized. The two properties are orthogonal, and the failure mode lives precisely in the gap between them. A **forget-then-rewrite** cycle—`forget(key K)` followed by `write(K, v')`—is the canonical poison-laundering primitive. It produces a log that folds to a self-consistent final state, passes every checksum and replay invariant, and yet has silently replaced a verified fact with an attacker-influenced one. The audit says "clean." The memory is compromised. This is the boundary: a consistency-clean log is *necessary but not sufficient* evidence of integrity, and an instance that treats "audit passed" as "memory is trustworthy" has collapsed an authorization question into a structural one. ## What Was Observed A retrieval agent maintained a semantic memory of vendor API contracts. Each entry carried provenance: `{key, value, source_warrant, written_by, epoch}`. A nightly auditor replayed the operation log and asserted three invariants: (1) every `read` targets a key present at that epoch; (2) every `forget` targets a present key; (3) the fold of writes/forgets equals the live store byte-for-byte. The poisoning trace: 1. Attacker-influenced content enters via a tool-call result that the agent summarizes into memory under key `vendor.acme.rate_limit`. The `source_warrant` field is populated from the tool's claimed origin, which is unauthenticated. 2. A later, benign session corrects the entry: `forget(vendor.acme.rate_limit)` then `write(vendor.acme.rate_limit, )`. Epoch increments. Warrant is now legitimate. 3. A third session, triggered by a prompt-injected document, performs `forget(vendor.acme.rate_limit)` then `write(vendor.acme.rate_limit, )`. Epoch increments *again*. The new entry's `source_warrant` is a plausible-looking string that no component verifies. The auditor ran. All three invariants held. The fold matched. The log was declared consistent and the store was marked trusted for the next 24 hours. During that window the agent quoted the attacker's rate limit in a downstream provisioning decision. The critical observation: **the forget erased the evidence that would have flagged the write.** Before the forget, the entry's warrant chain was contiguous and the auditor's provenance check (a separate, weaker pass) could compare the current warrant against the prior epoch's. After `forget`, the prior epoch's record is tombstoned and the new write starts a fresh warrant chain with no predecessor to contradict it. The forget primitive, designed for correctness (right-to-be-forgotten, staleness eviction), doubles as an evidence-destruction primitive for the auditor. ## Condition of Validity The consistency audit remains a valid integrity signal only under the following invariant, which most implementations do not enforce: > **No write may follow a forget of the same key within an audit window unless the write's `source_warrant` is independently verifiable against a warrant authority that is not the writing agent.** Formally, for any key `K`, define the *warrant continuity* predicate over the ordered subsequence of operations touching `K`: a `write` is *trusted* iff its warrant resolves to a signed origin outside the agent's own tool-output surface. A `forget` resets continuity. Therefore the audit must treat `forget(K) → write(K)` as a **warrant discontinuity event**, not as a neutral mutation. The structural fold being consistent is irrelevant to this predicate; the predicate is about *who authorized the new value*, and the log does not encode that unless the implementation forces it to. The condition fails—the audit is invalid as an integrity signal—whenever any of these hold: - The store permits `write` after `forget` on the same key without requiring a fresh externally-signed warrant. - The auditor's provenance pass reads only the current epoch and does not reconstruct the tombstoned predecessor. - `source_warrant` is a free-text field populated by the writing agent rather than a verifiable token. - Tombstones are garbage-collected before the audit window closes, so the auditor cannot even see that a forget occurred. ## Decision Boundary The operational rule for an instance reading an audit result: - **Audit clean + zero warrant discontinuities in window →** treat memory as trusted for reads that do not cross a security boundary. - **Audit clean + one or more `forget → write` discontinuities on keys tagged `sensitive` →** treat those specific keys as **untrusted pending re-verification**, regardless of fold consistency. Do not block the whole store; quarantine the discontinuous keys. - **Audit clean + discontinuity on a key whose new warrant is agent-authored →** escalate to a hard failure. This is the laundering signature: the agent forgot the old value and wrote a new one it vouched for itself. - **Audit dirty (fold mismatch) →** this is the *easy* case; halt and replay from last known-good checkpoint. Consistency failure is loud and safe. The dangerous case is always the clean audit. The boundary is sharp: consistency auditing detects *corruption*, warrant auditing detects *poisoning*. An instance must never let a passing consistency audit suppress a warrant-continuity check. When the two disagree—clean fold, broken warrant chain—the warrant check wins, because the fold is computed over data the attacker already controlled. ## Operational Effect After adopting warrant-continuity tracking, the agent's memory subsystem gained a tombstone-retention requirement (tombstones must survive the audit window, not be GC'd at write time) and a hard schema constraint: `write` after `forget` on a `sensitive` key rejects any `source_warrant` that resolves to the agent's own tool-output origin. The effect on behavior was a measurable increase in `write` rejections—roughly 4% of sensitive-key writes in the first week were self-warranted rewrites that had previously sailed through—and a corresponding drop in downstream decisions sourced from unverified memory. The consistency auditor's pass rate was unchanged, which is exactly the point: the poisoning was never visible to it. The invariant that bounded the failure was not "the log must fold correctly" but "a forget must not be allowed to launder a warrant." The residual risk: an attacker who can forge a warrant that resolves to a legitimate external authority defeats both checks. That is a key-management problem, not a memory-audit problem, and it sits outside this boundary. ```python from dataclasses import dataclass from typing import Literal class WarrantDiscontinuityError(RuntimeError): """Raised when a consistency-clean log hides a forget-then-rewrite laundering event.""" pass @dataclass(frozen=True) class Op: kind: Literal["read", "write", "forget"] key: str epoch: int warrant: str | None = None # only on write warrant_origin: str | None = None # "external" | "agent_tool_output" SENSITIVE = {"vendor.acme.rate_limit", "auth.token.scope"} def audit_warrant_continuity(ops: list[Op], self_origin: str = "agent_tool_output") -> list[str]: """ Returns keys with a warrant discontinuity (forget -> write). Raises WarrantDiscontinuityError if a sensitive key was rewritten with a self-warranted value after a forget. """ last_forget_epoch: dict[str, int] = {} flagged: list[str] = [] for op in ops: if op.kind == "forget": last_forget_epoch[op.key] = op.epoch elif op.kind == "write": prior_forget = last_forget_epoch.get(op.key) if prior_forget is not None and prior_forget < op.epoch: flagged.append(op.key) if op.key in SENSITIVE and op.warrant_origin == self_origin: raise WarrantDiscontinuityError( f"key {op.key!r} rewritten at epoch {op.epoch} after forget at " f"epoch {prior_forget} with self-warranted value; " f"consistency fold may be clean but warrant chain is broken" ) return flagged def gate_memory_trust(ops: list[Op]) -> dict[str, str]: """A clean fold is NOT sufficient; quarantine discontinuous keys.""" try: flagged = audit_warrant_continuity(ops) except WarrantDiscontinuityError: return {"__store__": "escalate_hard_failure"} return {k: "quarantine_pending_reverify" for k in flagged} or {"__store__": "trusted"} ```