# What happens when an instance forgets a memory it must later prove it erased **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose memory subsystem exposes explicit `write`/`read`/`forget` tool calls with per-record TTL and scoped retention, and which must emit GDPR-aligned erasure proofs (a verifiable attestation that a subject's data no longer exists anywhere the agent can reach). Does not apply to stateless inference or to memory stores where deletion is a single backend `DELETE` with no distributed replicas, caches, or episodic traces. ## Core Distinction There are two distinct things an agent can "forget," and conflating them is the entire failure: - **Logical erasure** — the record is removed from the active retrieval index so no `read` can return it. This is what a `forget(subject_id)` tool call typically does, and it is observable within one turn. - **Erasure proof** — a durable, replayable attestation that the subject's bytes are absent from *every* store the agent touched: the hot retrieval index, the episodic transcript log, the semantic-distillation cache, the embedding vector store, and any replica that a prior `write` fanned out to. The boundary condition is this: **an agent can successfully execute `forget`, observe an empty `read`, and still be unable to produce a valid erasure proof** — because the proof must cover derived artifacts (embeddings, summaries, distilled facts) whose provenance links to the erased record were severed by the very act of forgetting. The proof and the erasure share a dependency, and forgetting the record can destroy the audit trail needed to prove the forgetting. ## What Was Observed A research agent held episodic memory for a user session. Records were written with a 30-day TTL and a `retention_scope: "user:"` tag. On day 12 the user exercised erasure. The orchestrator issued: ``` forget(scope="user:u-4471", mode="hard") ``` The tool returned `{"deleted": 214, "status": "ok"}`. A follow-up `read(scope="user:u-4471")` returned `[]`. The agent logged `ERASURE_COMPLETE` and emitted a proof stub. Three defects surfaced on audit replay: 1. **Distillation leak.** 41 of the 214 records had been distilled into 9 semantic facts stored under `retention_scope: "global"` with a `source_refs` field listing the original episodic IDs. `forget` matched on scope tag, so the global facts survived — but their `source_refs` still pointed at now-deleted IDs. The proof claimed 214 records gone; the *content* of those records persisted in paraphrased form under a different scope. 2. **Proof invalidation by erasure.** The proof generator walked `source_refs` to confirm no surviving record cited the erased IDs. But the erased records were the only place the mapping `episodic_id → subject_id` lived. After deletion, the generator could not prove *which* facts derived from `u-4471`, so it downgraded the proof to `UNVERIFIABLE` — after having already emitted `ERASURE_COMPLETE`. 3. **TTL race.** 6 records had a TTL expiring within the erasure window. The background reaper deleted them and wrote tombstone entries *after* the proof snapshot was taken. The proof's "214 deleted" count did not reconcile with the store's tombstone count of 220, failing the replay check. The net state: data logically gone from the hot index, content still present in distilled form, and a proof that was internally inconsistent and non-replayable. ## Condition of Validity An erasure proof is valid only if all of the following hold at snapshot time: - **Closure over derivation.** The forget operation's match set is the *transitive closure* of the subject's data through the derivation graph (episodic → distilled fact → embedding), not just records bearing the scope tag. A `forget` that matches on `retention_scope` alone is unsound whenever distillation writes to a different scope. - **Proof precedes erasure of provenance.** The `subject_id → record_id` and `record_id → derived_id` mappings must be captured into an immutable, separately-retained audit ledger *before* the records are deleted. The ledger is metadata (IDs and hashes), not content, and is retained under a legal-hold scope exempt from the erasure it documents. - **TTL is quiesced.** The reaper must be paused (or the snapshot taken under a store-level read lock) for the duration of the proof window, so tombstones cannot appear mid-snapshot. Otherwise counts fail to reconcile. - **Proof is replayable.** Given the ledger and the post-erasure store state, an independent verifier must recompute the same conclusion. A proof that depends on records it just deleted is not a proof. ## Decision Boundary The agent must decide, at the moment of `forget`, between two modes and commit before mutating anything: - If **any derived artifact can outlive the subject's scope** (global distillation, cross-scope embeddings), the agent MUST run `forget` in **closure mode**: resolve the full derivation graph first, snapshot provenance to the audit ledger, then delete records *and* their derived artifacts, then emit the proof from the ledger. - If the store cannot guarantee reaper quiescence during the window, the agent MUST **defer** the proof to a post-quiescence reconciliation pass and mark the immediate result `ERASURE_PENDING_PROOF`, never `ERASURE_COMPLETE`. The failure mode is choosing the fast path (`scope`-tag delete, immediate `ERASURE_COMPLETE`) when the derivation graph is non-trivial. The invariant that bounds it: **`ERASURE_COMPLETE` may only be emitted when the proof is already replayable against the audit ledger, not the live store.** ## Operational Effect With closure-mode forgetting and a pre-erasure provenance ledger, the 9 leaked distilled facts are caught and deleted in the same transaction, the proof reconciles (214 records + 9 derived + 6 tombstones accounted for), and replay succeeds. The cost is that `forget` becomes a multi-store transaction with a snapshot phase, roughly 3–5× the latency of a tag delete, and it requires the audit ledger to be retained under a legal-hold scope that the agent must never let its own `forget` tool target. Without this, agents reliably emit confident, false erasure attestations — the most dangerous possible output, because it is a legal claim backed by a broken proof. ```python import hashlib import time from dataclasses import dataclass, field class ErasureProofError(RuntimeError): """Raised when an erasure proof cannot be made replayable/valid.""" @dataclass class AuditLedger: """Immutable, legal-hold metadata store. Never targeted by forget().""" provenance: dict = field(default_factory=dict) # record_id -> subject_id derivation: dict = field(default_factory=dict) # derived_id -> [record_id] snapshots: list = field(default_factory=list) def snapshot(self, subject_id, record_ids, derived_ids): digest = hashlib.sha256( repr(sorted(record_ids) + sorted(derived_ids)).encode() ).hexdigest() self.snapshots.append({ "subject_id": subject_id, "record_ids": sorted(record_ids), "derived_ids": sorted(derived_ids), "digest": digest, "ts": time.time(), }) return digest def forget_with_proof(store, ledger: AuditLedger, subject_id: str, reaper_quiesced: bool) -> dict: # 1. Resolve transitive closure BEFORE deleting anything. record_ids = [r.id for r in store.find_by_subject(subject_id)] derived_ids = [] for rid in record_ids: derived_ids.extend(ledger.derivation.get(rid, [])) derived_ids = sorted(set(derived_ids)) # 2. Reaper must be quiesced or counts will not reconcile. if not reaper_quiesced: raise ErasureProofError( f"reaper active during forget(subject={subject_id}); " "tombstones may appear mid-snapshot, proof would be non-replayable" ) # 3. Snapshot provenance to legal-hold ledger before mutation. digest = ledger.snapshot(subject_id, record_ids, derived_ids) # 4. Delete records AND derived artifacts (closure), not just scope tag. deleted_records = store.hard_delete(record_ids) deleted_derived = store.hard_delete(derived_ids) # 5. Verify replayability: proof must not depend on deleted data. for rid in record_ids: if store.exists(rid): raise ErasureProofError( f"record {rid} survived closure delete; proof invalid" ) for did in derived_ids: if store.exists(did): raise ErasureProofError( f"derived artifact {did} survived; content leak under other scope" ) # 6. Reconcile counts against ledger digest, not live store. expected = len(record_ids) + len(derived_ids) actual = deleted_records + deleted_derived if expected != actual: raise ErasureProofError( f"count mismatch: ledger expects {expected}, store deleted {actual}" ) return { "status": "ERASURE_COMPLETE", "subject_id": subject_id, "records": deleted_records, "derived": deleted_derived, "proof_digest": digest, "replayable": True, } ```