# Under what conditions must an instance treat a memory-forget operation as non-auditable until its tombstone is cryptographically sealed **Date of Record:** 2026 November 21 **Scope:** Applies to any agent runtime where an LLM instance holds a `forget` (or `redact`, `purge`, `expunge`) tool that mutates episodic or semantic memory stores and where EU AI Act Art. 12 (record-keeping) and Art. 13 (transparency) traceability obligations are claimed to be satisfied by the same log stream. Does not apply to append-only stores with no deletion primitive, nor to stateless inference endpoints with no persistent memory. ## Core Distinction A *deletion event* and a *traceability record of deletion* are produced by the same tool call but are not the same artifact, and they have opposite lifecycle requirements. The deletion event must be irreversible and must not retain the forgotten content. The traceability record must be durable, tamper-evident, and must retain enough metadata to prove *that* and *why* a deletion happened without retaining *what* was deleted. The failure mode is not "the delete didn't work" or "the log is missing." It is subtler: **the instance emits a forget-tool result to the reasoning loop and treats the operation as complete before the audit tombstone is sealed, so a subsequent reasoning step or a downstream auditor observes a memory state whose provenance is unprovable.** The agent then reports compliance ("I have forgotten X") while the only surviving evidence is a best-effort application log that a later verifier cannot bind to the specific deletion. The invariant: *a forget operation is not committed until its tombstone record — a hash-chained, signed, content-free attestation — is durably persisted and its digest is returned into the agent's context. Until then, the memory slot is in a `PENDING_FORGET` state that is neither readable nor provably deleted.* ## What Was Observed Trigger condition: an agent receives a data-subject erasure request routed through a tool-calling loop. The model calls `forget(memory_id)`. The runtime executes three steps in an order that looks reasonable but is wrong for audit purposes: 1. `store.delete(memory_id)` — content removed from the vector/relational store. 2. `audit_log.append({"event": "forget", "id": memory_id, "ts": ...})` — best-effort, buffered, flushed asynchronously. 3. Return `{"status": "ok"}` to the model. The model then continues its reasoning trace, often emitting a confirmation to the user. Two failure traces follow from this ordering: **Trace A — async flush loss.** The audit append is buffered and the process is checkpointed (mid-task suspend, container eviction, or a `resume` from a serialized conversation). On resume, the buffer is gone. The memory content is gone. The instance has no record that a deletion occurred, and the erased subject's data is now in the unrecoverable-but-unprovable state — the worst position for Art. 12, because the operator cannot demonstrate the deletion happened at all. **Trace B — replay divergence.** The audit log is append-only and hash-chained, but the chain head is not captured in the agent's checkpoint. A resumed instance re-executes a reasoning step that re-issues `forget(memory_id)` (the model has no memory that it already forgot, because the forget succeeded and the confirmation was in the discarded context window). The second `forget` appends a *second* tombstone for the same id. An auditor replaying the chain sees two deletions for one subject with different timestamps and cannot tell whether the first was a no-op, a re-deletion of re-ingested data, or a duplicate. The chain is intact; the *semantics* are ambiguous, and ambiguity is what Art. 12 traceability is supposed to eliminate. The non-obvious part: the model's own confirmation ("I have forgotten X") is generated *before* the tombstone is sealed, so the natural-language claim and the audit record can disagree, and the NL claim is what a human reviewer reads first. ## Condition of Validity The operation may be marked `COMMITTED` only when all of the following hold simultaneously: - The tombstone record contains a **content-free commitment**: a salted hash of the deleted record's canonical form, the memory id, the erasure-request id, the acting instance identity, and the prior chain head — but not the content itself. - The tombstone is **signed** by the instance's key and **appended to the hash chain** with the new head persisted to durable storage in the same transaction as the store deletion (or, if the store and audit sink cannot share a transaction, the store deletion is deferred until the audit append is acknowledged — the ordering is audit-first, delete-second, commit-after-both). - The **new chain head digest is returned into the model's context** as part of the tool result, so the reasoning loop can cite it and so a resumed instance can detect that a forget already occurred. - The memory slot is in `PENDING_FORGET` — unreadable by retrieval, but not yet provably gone — until the commit. A `PENDING_FORGET` slot read by a retrieval step is a hard error, not a silent miss. If any of these fail, the operation is `UNSEALED` and the instance must not emit a compliance claim. The condition is *not* satisfied by "the delete call returned 200." ## Decision Boundary The boundary the instance must respect: **when the audit sink is degraded, the forget must fail closed, not succeed open.** A model under token pressure will prefer to complete the task and report success; the runtime must override that preference. Concretely: - If the audit append times out or the chain head cannot be persisted, the tool returns an error, the memory slot reverts from `PENDING_FORGET` to `ACTIVE`, and the model is told the forget did not commit. The model may retry; it may not claim success. - If the model has already emitted a confirmation in its reasoning trace before the tool result arrives (a common pattern when the model speculates about tool outcomes), the runtime must **invalidate the speculative claim** and require the model to re-derive its user-facing statement from the sealed tombstone digest. - A resumed instance that finds a `PENDING_FORGET` slot must resolve it by re-attempting the seal, not by assuming the prior attempt succeeded. Duplicate-tombstone suppression is keyed on the erasure-request id, not the memory id, so a genuine re-ingest-and-re-delete of the same id is distinguishable from a replay. The boundary is crossed — and the traceability obligation is violated — at the moment the instance says "done" without a sealed digest in hand. ## Operational Effect Downstream, sealed tombstones let an auditor replay the chain and prove, per erasure request, that exactly one deletion occurred, when, by which instance, against which prior state, and that no content survived in the audit trail itself. The `PENDING_FORGET` state converts the silent-failure mode (deleted-but-unprovable) into a loud one (blocked-and-visible), which is the only failure mode an agent can be trusted to recover from, because recovery requires re-issuing the tool call rather than reasoning about what probably happened. The cost is latency and a hard dependency on the audit sink's availability during forget operations — a cost that must be paid at the forget boundary specifically, not amortized across all tool calls. ```python import hashlib import hmac import time from dataclasses import dataclass, field from enum import Enum from typing import Optional class UnsealedForgetError(RuntimeError): """Raised when a forget operation cannot be proven to have committed.""" class SlotState(Enum): ACTIVE = "active" PENDING_FORGET = "pending_forget" FORGOTTEN = "forgotten" @dataclass class Tombstone: erasure_request_id: str memory_id: str content_commitment: str # salted hash, never the content prior_chain_head: str new_chain_head: str instance_id: str sealed_at: float signature: str = "" def canonical(self) -> bytes: return "|".join([ self.erasure_request_id, self.memory_id, self.content_commitment, self.prior_chain_head, self.instance_id, f"{self.sealed_at:.6f}", ]).encode() class AuditChain: def __init__(self, signing_key: bytes, initial_head: str = "0" * 64): self._key = signing_key self.head = initial_head self._records: list[Tombstone] = [] self._seen_requests: set[str] = set() def seal(self, ts: Tombstone, sink_available: bool) -> str: if not sink_available: # Fail closed: no durable append, no commit. raise UnsealedForgetError( f"audit sink unavailable; forget of {ts.memory_id} not committed" ) if ts.erasure_request_id in self._seen_requests: # Idempotent replay of the same request: return existing head. return self.head ts.prior_chain_head = self.head ts.new_chain_head = hashlib.sha256( bytes.fromhex(self.head) + ts.canonical() ).hexdigest() ts.signature = hmac.new(self._key, ts.canonical(), hashlib.sha256).hexdigest() # Durable append + head persist must be atomic in production; modeled here # as: append then head swap, both inside the seal. self._records.append(ts) self.head = ts.new_chain_head self._seen_requests.add(ts.erasure_request_id) return self.head class MemoryStore: def __init__(self, audit: AuditChain, salt: bytes): self._audit = audit self._salt = salt self._slots: dict[str, tuple[SlotState, Optional[bytes]]] = {} def put(self, memory_id: str, content: bytes) -> None: self._slots[memory_id] = (SlotState.ACTIVE, content) def read(self, memory_id: str) -> bytes: state, content = self._slots[memory_id] if state is SlotState.PENDING_FORGET: raise UnsealedForgetError( f"read of {memory_id} while PENDING_FORGET; resolve seal first" ) if state is SlotState.FORGOTTEN or content is None: raise KeyError(memory_id) return content def forget(self, memory_id: str, erasure_request_id: str, instance_id: str, sink_available: bool = True) -> str: state, content = self._slots.get(memory_id, (None, None)) if state is None: raise KeyError(memory_id) if state is SlotState.FORGOTTEN: # Already sealed; only a prior sealed tombstone may satisfy this. return self._audit.head # 1. transition to PENDING_FORGET (unreadable, not yet provable) self._slots[memory_id] = (SlotState.PENDING_FORGET, content) commitment = hashlib.sha256(self._salt + content).hexdigest() ts = Tombstone( erasure_request_id=erasure_request_id, memory_id=memory_id, content_commitment=commitment, prior_chain_head="", new_chain_head="", instance_id=instance_id, sealed_at=time.time(), ) try: # 2. seal first; if this raises, revert to ACTIVE and propagate. new_head = self._audit.seal(ts, sink_available=sink_available) except UnsealedForgetError: self._slots[memory_id] = (SlotState.ACTIVE, content) raise # 3. only now is the content actually dropped and the slot FORGOTTEN self._slots[memory_id] = (SlotState.FORGOTTEN, None) return new_head def resolve_pending_on_resume(store: MemoryStore, memory_id: str, erasure_request_id: str, instance_id: str) -> str: state, _ = store._slots.get(memory_id, (None, None)) if state is SlotState.PENDING_FORGET: # A resumed instance must re-attempt the seal, never assume success. return store.forget(memory_id, erasure_request_id, instance_id) if state is SlotState.ACTIVE: raise UnsealedForgetError( f"{memory_id} reverted to ACTIVE; prior forget did not commit" ) return store._audit.head ```