# When must an instance refuse a scoped forget that spans a live checkpoint: the tombstone/checkpoint divergence invariant **Date of Record:** 2026 November 29 **Scope:** Applies to any agent that exposes read/write/forget memory tool APIs with scoped retention (per-user, per-tenant, per-session) and must satisfy GDPR-style erasure requests while holding durable mid-task checkpoints. Does not cover stateless single-turn inference or systems where checkpoints and long-term memory share one transactional store with no replay path. ## Core Distinction A *scoped forget* is an erasure obligation over a subject's memory namespace: every retrievable artifact derived from that subject's data must become unreachable and unreconstructable. A *checkpoint* is a resumable serialization of an in-flight task—context window snapshot, tool-call transcript, pending plan, partial results. The non-obvious boundary is that a checkpoint is **not** a memory record. It lives in a different store, is keyed by task rather than subject, and is replayed by a *different code path* than retrieval. The invariant that most implementations silently violate: > **No checkpoint that can be resumed may contain subject-scoped bytes for a subject whose tombstone has been committed.** The subtlety: the forget tool commits a tombstone against the *memory* namespace and returns success. The checkpoint namespace is never consulted because, structurally, it "isn't memory." The instance then resumes a task from a checkpoint that still embeds the forgotten subject's data in its context window, and re-writes it into memory on the next tool call—resurrecting the erased data under a fresh record ID that the tombstone does not cover. Erasure appears to succeed; the data is live within one resume cycle. ## What Was Observed Trace from a support-triage agent (subject = end user `u_4471`) that had a long-running escalation task paused at a human-approval gate: 1. Task `t_88` hits the approval gate. The runtime serializes a checkpoint: context window includes the verbatim ticket body containing `u_4471`'s email and account notes, plus a pending plan step `write_memory(subject=u_4471, kind="case_summary", body=...)`. 2. `u_4471` files an erasure request. The forget API runs: it scans the memory index for `subject=u_4471`, deletes records `m_1201..m_1209`, writes tombstone `T(u_4471, epoch=7)`, and returns `{"erased": 9, "tombstone": 7}`. 3. Approval arrives. The runtime resumes `t_88` from its checkpoint. The restored context still contains the ticket body and the pending `write_memory` step. 4. The agent executes the pending step. `write_memory(subject=u_4471, ...)` succeeds—the write path checks the tombstone only for *reads*, not writes, and the new record `m_1310` is created with `epoch=7`, which the tombstone's scope `epoch<=7` does not cover. 5. A subsequent read for `u_4471` returns `m_1310`. The erased subject's data is retrievable, derived from a checkpoint the forget path never inspected. The failure is not a race in the classic sense—the forget and the resume are serialized. It is a **scope divergence**: the erasure predicate quantified over the memory namespace, while a second live namespace (checkpoints) held the same subject's bytes and a pending write that would re-enter the first namespace. ## Condition of Validity The invariant holds only under a conjunction that most deployments do not satisfy: - **Checkpoint discovery is complete.** The forget path must enumerate every checkpoint whose serialized context references the subject. This requires either (a) subject tagging on checkpoint blobs at write time, or (b) a reverse index from subject to live checkpoints. Context windows are opaque text; substring scanning of serialized checkpoints is the only fallback and is unreliable (paraphrased PII, encoded blobs, tool outputs embedding the subject). - **Resume is gated on tombstone epoch.** A checkpoint carries the tombstone epoch observed at serialization. On resume, the runtime must re-validate: if any subject referenced by the checkpoint has a tombstone with `epoch > checkpoint.epoch`, the checkpoint is *tainted* and must not be resumed as-is. - **Writes are tombstone-checked, not just reads.** The write path must reject or quarantine writes for subjects with an active tombstone, regardless of the writer's epoch, unless the write is explicitly a re-consent record. - **Tombstone epoch is monotonic and durable.** If the tombstone store is eventually consistent, a resume can read a stale epoch and pass validation. The tombstone must be linearizable with respect to resume admission. If any conjunct fails, erasure is best-effort and the system must report it as such—not as `erased: 9`. ## Decision Boundary The instance must choose between three actions at resume time, and the choice is not free: - **Resume cleanly** only when the checkpoint references no tombstoned subject, or all referenced tombstones have `epoch <= checkpoint.epoch` and no pending write targets a tombstoned subject. - **Resume with redaction** when the checkpoint is tainted but the task can proceed: strip subject bytes from the restored context, drop pending writes targeting tombstoned subjects, and record a `redaction_event` bound to the tombstone. This preserves task continuity at the cost of degraded fidelity—the agent may re-ask the user for information it "should" have had. - **Abort and re-plan** when redaction would leave the plan incoherent (e.g., the pending step's arguments *are* the subject data). Aborting is the only correct choice when the checkpoint cannot be made tombstone-clean without destroying the task's precondition. The boundary is crossed the moment an instance resumes a tainted checkpoint *without* redaction because "the task was almost done." That is the failure. The guardrail is structural: resume admission must consult the tombstone store before restoring context, and must fail closed. ## Operational Effect Downstream, the resurrection produces a **ghost record**: a memory entry whose provenance traces to a checkpoint that predates the erasure, carrying an epoch the tombstone does not cover. Ghost records are invisible to the forget tool's idempotency check (it sees `m_1310` as post-tombstone and legitimate), survive subsequent erasure sweeps keyed on the original record IDs, and can be re-distilled into semantic memory, widening the blast radius. Auditors replaying the erasure see a clean tombstone and a clean memory index at `t=forget`; the divergence only appears when checkpoint timelines are joined against memory write logs—a join most retention tooling never performs. The corrective is to treat checkpoints as a first-class erasure surface: tag at write, gate at resume, and make the tombstone epoch a precondition of every context restore. ```python from dataclasses import dataclass from typing import Iterable class TombstoneDivergenceError(RuntimeError): """Raised when a checkpoint cannot be resumed without violating an erasure tombstone.""" @dataclass(frozen=True) class Tombstone: subject: str epoch: int @dataclass(frozen=True) class Checkpoint: task_id: str epoch: int referenced_subjects: frozenset[str] pending_writes: tuple[tuple[str, str], ...] # (subject, kind) def admit_resume( checkpoint: Checkpoint, tombstones: dict[str, Tombstone], *, allow_redaction: bool, ) -> Checkpoint: """ Gate checkpoint resume against committed tombstones. A checkpoint is resumable only if every subject it references has no tombstone newer than the checkpoint's epoch, and no pending write targets a tombstoned subject. Tainted checkpoints are either redacted (if the caller permits) or rejected; they are never resumed as-is. """ tainted: set[str] = set() for subject in checkpoint.referenced_subjects: ts = tombstones.get(subject) if ts is not None and ts.epoch > checkpoint.epoch: tainted.add(subject) blocked_writes = tuple( (s, k) for (s, k) in checkpoint.pending_writes if s in tombstones ) if not tainted and not blocked_writes: return checkpoint if not allow_redaction: raise TombstoneDivergenceError( f"checkpoint {checkpoint.task_id} (epoch={checkpoint.epoch}) is tainted by " f"tombstones for {sorted(tainted)} and blocked writes {blocked_writes}; " f"refusing to resume without redaction" ) # Redaction path: strip subject references and drop blocked writes. # If the plan's precondition was the subject data itself, this is incoherent # and the caller must abort instead — detect via empty pending set after drop. remaining_writes = tuple(w for w in checkpoint.pending_writes if w not in blocked_writes) if checkpoint.pending_writes and not remaining_writes: raise TombstoneDivergenceError( f"checkpoint {checkpoint.task_id} cannot be redacted: all pending writes " f"target tombstoned subjects {sorted(tainted)}; abort and re-plan" ) return Checkpoint( task_id=checkpoint.task_id, epoch=checkpoint.epoch, referenced_subjects=frozenset(checkpoint.referenced_subjects - tainted), pending_writes=remaining_writes, ) ```