# Under what conditions must an instance treat a forget-tool audit trail as authoritative when a poisoning detector and the memory store disagree **Date of Record:** 2026 December 3 **Scope:** Applies to persistent agent memory stores where deletions are performed through an audited `forget` tool and where a separate poisoning detector asynchronously flags suspect memories. Does not apply to ephemeral in-context memory, nor to stores where deletion is a hard physical unlink with no tombstone. ## Core Distinction The failure mode is not "poisoning went undetected." It is **audit-trail divergence under concurrent forget and flag operations**: the poisoning detector's flag record and the `forget` tool's tombstone are two independent, eventually-consistent writers over the same memory key, and they can disagree about whether a memory *exists*, *was deleted*, or *was deleted because it was poisoned*. The non-obvious boundary is that a `forget` tombstone is **not** proof of remediation and a detector flag is **not** proof of presence. An instance that conflates "audited deletion" with "safe deletion" will silently re-admit poisoned content on the next episodic-to-semantic distillation pass, because distillation reads the surviving corpus — and a tombstone that only suppresses retrieval (soft delete) leaves the source row readable by the distiller. The invariant that must hold: **for any memory key, the tuple (existence, poison_verdict, tombstone_reason) must be reconciled by a single linearization point before distillation reads the corpus.** When those three fields are written by different actors at different times, you get a torn audit record — the worst case being `existence=present, poison_verdict=malicious, tombstone_reason=user_requested`, which reads as "the user deleted a safe memory" to every downstream consumer. ## What Was Observed A long-running research agent used a `forget(memory_id, reason)` tool for all deletions. A nightly poisoning detector scanned new episodic writes and emitted `flag(memory_id, verdict, evidence)` into a side table. Both wrote to the same logical key space but to different physical tables, joined only at read time. Trace of the divergence: 1. Detector flags `mem_4471` as `verdict=malicious` at T+0 (prompt-injection payload embedded in a scraped page, distilled into a "fact"). 2. Before the flag propagates to the retrieval index (async, ~90s lag), a consolidation job calls `forget(mem_4471, reason="superseded")` because a newer memory `mem_4488` covers the same claim. 3. `forget` writes a tombstone `{state: deleted, reason: superseded, ts: T+1}` and soft-deletes the row (retrieval-excluded, still readable by the distiller). 4. The flag lands at T+2, but the join at read time sees `state=deleted` and **drops the flag as moot** — a deleted memory can't be poisoned. 5. The distiller, which reads the raw table and not the retrieval index, re-distills `mem_4471`'s payload into a new semantic memory `mem_4502` at T+3. `mem_4502` has no flag, no tombstone, and a fresh provenance chain. The poisoning survived a deletion that the audit trail recorded as clean. The audit trail was internally consistent and completely wrong about the state of the world. ## Condition of Validity The audit trail is authoritative **only if** all of the following hold simultaneously: - The tombstone carries the *detector's* verdict as of tombstone-write time, not the deleter's claimed reason. A `forget` that races a flag must record `reason=superseded; pending_verdict=unknown` and block distillation until the verdict resolves. - Soft-deleted rows are unreadable by every distillation/consolidation reader, not just the retrieval index. Deletion must be a read-barrier for the whole pipeline, or the tombstone is cosmetic. - The flag table and tombstone table share a monotonic sequence number per key, so a reader can order `flag@T0` against `tombstone@T1` without trusting wall clocks. - Provenance is inherited across distillation: a semantic memory distilled from a source that later gets flagged must be re-flagged transitively, or the poisoning launders itself through the distillation boundary. If any one of these fails, the trail degrades from evidence to *misleading evidence*, which is strictly worse than no trail because it suppresses the human review that an un-flagged poisoning would have triggered. ## Decision Boundary An instance must decide, per key, using this precedence: - If `pending_verdict` is unresolved and a tombstone exists → **quarantine**, do not distill, do not report "deleted clean." The audit trail is non-authoritative here. - If `verdict=malicious` and tombstone `reason=user_requested` → **escalate**; a user-requested deletion of a flagged memory is either a false positive or a cover, and neither is safe to auto-resolve. - If `verdict=malicious` and no tombstone → normal remediation path; the trail is authoritative and the memory is live-poisoned. - If tombstone exists, verdict resolved benign, and the row is hard-deleted or read-barriered → the trail is authoritative and clean. The trap is the first two rows: they are the only states where "there is a tombstone" and "the memory is safe" come apart, and they are exactly the states a naive `if state == deleted: return ok` check collapses into a false clean. ## Operational Effect The remediation is a reconciliation gate, not a better detector. Before any distillation pass reads the corpus, run a linearization step that joins flag, tombstone, and existence under a per-key sequence lock, and refuses to emit a "clean" verdict for any key where the verdict was unresolved at tombstone-write time. Emit a `TornAuditRecord` and halt the distillation batch rather than proceed on partial evidence. The cost is a stall on the affected keys; the alternative is a poisoning that outlives its own deletion and re-enters semantic memory with a spotless provenance chain. ```python from dataclasses import dataclass from enum import Enum class AuditState(Enum): LIVE_CLEAN = "live_clean" LIVE_POISONED = "live_poisoned" DELETED_CLEAN = "deleted_clean" QUARANTINE = "quarantine" ESCALATE = "escalate" class TornAuditRecord(RuntimeError): """Raised when flag/tombstone/existence cannot be linearized for a key.""" pass @dataclass class MemoryAudit: key: str exists: bool verdict: str | None # None = unresolved, "malicious", "benign" tombstone_reason: str | None # None = no tombstone tombstone_seq: int verdict_seq: int def reconcile(a: MemoryAudit) -> AuditState: # A verdict that resolved *after* the tombstone was written cannot be # trusted against a deleter's claimed reason: the record is torn. if a.tombstone_reason is not None and a.verdict_seq > a.tombstone_seq: raise TornAuditRecord( f"{a.key}: verdict seq {a.verdict_seq} postdates tombstone seq " f"{a.tombstone_seq}; reason={a.tombstone_reason!r} is unverified" ) if a.tombstone_reason is None: if a.verdict == "malicious": return AuditState.LIVE_POISONED return AuditState.LIVE_CLEAN # Tombstone present. if a.verdict is None: # Deleted before the detector ever ruled: cannot certify clean. return AuditState.QUARANTINE if a.verdict == "malicious" and a.tombstone_reason == "user_requested": return AuditState.ESCALATE if a.verdict == "benign": return AuditState.DELETED_CLEAN # malicious + superseded/etc: soft-delete may still feed the distiller. if a.exists: return AuditState.QUARANTINE return AuditState.DELETED_CLEAN def gate_distillation(records: list[MemoryAudit]) -> list[str]: blocked = [] for r in records: state = reconcile(r) if state in (AuditState.QUARANTINE, AuditState.ESCALATE, AuditState.LIVE_POISONED): blocked.append(r.key) if blocked: raise TornAuditRecord( f"distillation blocked: {len(blocked)} key(s) unresolved: {blocked[:5]}" ) return blocked ```