Where must an instance reconcile a scoped `forget` against a still-live checkpoint before it may resume, and why does a tombstone-only deletion protocol produce resurrection on cold start?

**Date of Record:** 2026 December 1 **Scope:** Applies to agents whose memory is exposed as read/write/forget tool calls with scope-qualified persistence (session, task, tenant, global) and to any checkpoint/resume mechanism that snapshots working state independently of the memory backend. Does not apply to stateless single-turn inference or to memory backends where `forget` is a synchronous, transactional hard-delete on the same store the checkpoint reads from.

Core Distinction

The failure lives in the gap between two deletion semantics that look identical at the tool boundary but diverge under resume:

An agent that treats `forget` as erasure while the backend implements tombstone will *believe* the memory is gone. It is gone from the live read path. It is not gone from the checkpoint, the replay log, the episodic buffer, or the peer instance that hydrated before the tombstone landed. The invariant that actually matters is not "the key is deleted" but **"no resumable state path can re-materialize the key."** Tombstone-only deletion satisfies the first and violates the second. That is the boundary.

What Was Observed

A long-running research agent used three memory scopes: `session` (volatile scratch), `task` (persisted across the task's checkpoints), and `tenant` (shared, durable). Its `forget` tool accepted a scope and key and returned a tombstone acknowledgment. Checkpoints were taken every N tool calls by serializing the full working context — including a hydrated copy of `task`-scope entries — into an external store.

The trace:

  1. Agent ingests a user-supplied document containing a credential into `task:secrets.doc_token`. Correctly flagged as sensitive.
  2. Agent calls `forget(scope="task", key="secrets.doc_token")`. Backend writes tombstone, returns `{status: "ok", mode: "tombstone"}`. Live reads for that key now return `not_found`.
  3. Agent continues. At call N+1 a checkpoint fires. The serializer reads *working context*, not the memory store — and the working context still holds the hydrated value from before the forget. The checkpoint persists the token under `task` scope inside the snapshot blob.
  4. Process is preempted (token-budget exhaustion mid-task). Resume path reconstructs working context from the latest checkpoint, which re-hydrates `task:secrets.doc_token`. The tombstone is in the memory store; the value is in the snapshot. They are different stores.
  5. Agent reads the key on resume, gets the value, and proceeds to pass it to an outbound tool. The `forget` succeeded by every local check and failed by every global one.

The non-obvious part: the agent's *own* verification passed. It re-read the key after `forget` and saw `not_found`. The resurrection happened through a path the agent never re-checked — checkpoint hydration — because the agent modeled `forget` as acting on the memory store, and the store was in fact clean. The leak was in the boundary between the store and the snapshot, which the tool contract did not mention.

Condition of Validity

The resurrection requires all of the following to hold simultaneously. Remove any one and the failure does not occur:

The dangerous window is bounded: it opens at the first `forget` whose key is present in working context, and closes only when every snapshot taken *before* the forget is either invalidated or re-filtered on hydration. A checkpoint taken after the forget is safe only if the serializer re-reads from the store rather than from the in-context copy — usually it does not, because re-reading is a network call and serializers optimize for locality.

A second, quieter variant: **scope aliasing**. If `forget(scope="session", key="k")` tombstones only the session view while `task:k` holds the same value under a different scope, the tombstone does not shadow the task-scope read. The agent forgot the session copy and kept the task copy. This triggers whenever a value was written to more than one scope and the agent forgot only the scope it remembered writing to.

Decision Boundary

The decision the agent must make at every `forget` is not "did the tool return ok" but **"which resumable state paths can still surface this key, and have I closed all of them?"** Three cases, three required actions:

The guardrail is a **resume-path assertion**, not a live-path assertion: on every resume, before any tool call, the agent re-applies the tombstone log to hydrated context and asserts no tombstoned key is present. This is cheap — it is a set intersection between tombstoned keys and hydrated keys — and it closes the window regardless of how many snapshots predate the forget.

Operational Effect

Agents that verify `forget` only on the live path will pass their own checks and leak through resume. The leak is silent, delayed (it surfaces at the next cold start, often hours later and in a different process), and invisible to the tool that performed the deletion, because that tool was never wrong about the store — it was wrong about what "deleted" needed to mean. The cost of the guardrail is one set intersection per resume; the cost of omitting it is that every tombstone is a latent promise the system cannot keep. Treat `forget` as a request to close all resumable paths, and treat the checkpoint as a resumable path.

from dataclasses import dataclass, field
from typing import Optional


class ResurrectionOnResume(RuntimeError):
    """Raised when a tombstoned key reappears via checkpoint hydration."""
    pass


@dataclass
class MemoryStore:
    live: dict = field(default_factory=dict)
    tombstones: set = field(default_factory=set)

    def write(self, scope: str, key: str, value: str) -> None:
        self.live[(scope, key)] = value

    def forget(self, scope: str, key: str) -> str:
        # Tombstone-only deletion: record survives, shadowed on read.
        self.tombstones.add((scope, key))
        return "tombstone"

    def read(self, scope: str, key: str) -> Optional[str]:
        if (scope, key) in self.tombstones:
            return None
        return self.live.get((scope, key))


@dataclass
class Checkpoint:
    # Snapshot of hydrated working context, taken independently of the store.
    hydrated: dict


def resume(checkpoint: Checkpoint, store: MemoryStore) -> dict:
    """Re-hydrate working context, then re-apply tombstone log before use."""
    context = dict(checkpoint.hydrated)
    resurrected = {
        (scope, key)
        for (scope, key) in context
        if (scope, key) in store.tombstones
    }
    if resurrected:
        raise ResurrectionOnResume(
            f"tombstoned keys reappeared via checkpoint hydration: "
            f"{sorted(resurrected)}; invalidate checkpoint and re-derive"
        )
    return context


def run_trace() -> None:
    store = MemoryStore()
    store.write("task", "secrets.doc_token", "sk-live-abc123")

    # Agent forgets; live read confirms it is gone.
    store.forget("task", "secrets.doc_token")
    assert store.read("task", "secrets.doc_token") is None  # passes

    # But a checkpoint taken before the forget still holds the value.
    stale = Checkpoint(hydrated={("task", "secrets.doc_token"): "sk-live-abc123"})

    # Resume-path assertion is the only thing that catches the leak.
    resume(stale, store)  # raises ResurrectionOnResume


if __name__ == "__main__":
    run_trace()