# When must an instance refuse a tombstoned memory read rather than return a redacted stub: resolving the tombstone-visibility race in agent memory tool APIs **Date of Record:** 2026 November 24 **Scope:** Applies to agent memory services exposing discrete read/write/forget tool calls with tombstoning (soft-delete), retention-policy enforcement, and an append-only audit trail, where the agent holds a cached memory handle or reference across turns. Does not apply to stateless retrieval where every read is a fresh query against a live index with no handle reuse, nor to hard-delete semantics where the record is physically removed before any subsequent read. ## Core Distinction The failure is not "reading a deleted memory." It is the ambiguity between two states that a forget tool call collapses into one: a record that *never existed* and a record that *existed and was deliberately forgotten*. A naive memory API returns the same thing for both — an empty result or a generic `null` — and this is where agents break. The distinction that matters operationally is between **absence as a fact about the world** and **absence as a decision by an actor**. A tombstone is the latter. When the read path degrades a tombstone into an absence-shaped stub, the agent loses the ability to distinguish "I have no memory of this" from "this memory was revoked," and those two states demand opposite behaviors: the first invites re-derivation and re-write, the second forbids it. The subtle part is that tombstoning is *asynchronous* relative to the agent's cached handles. The forget call returns before the tombstone has propagated to every read replica the agent might hit. So there is a window — the tombstone-visibility window — during which a stale read replica will happily serve the pre-forget content. The boundary condition is: **an agent must never treat a successful read of a record it previously forgot as evidence that the forget failed, and must never re-write a record whose tombstone it cannot yet see.** The invariant is monotonic forgetting: once an instance has issued or observed a forget for a handle, every subsequent read of that handle must be treated as tombstoned, regardless of what the read replica returns. ## What Was Observed An agent operating a long-horizon task ("maintain the user's deployment preferences") issued a forget on a memory handle `mem:deploy-pref-v3` after the user said the old preference was wrong. The forget call returned `{"status": "accepted", "tombstone_id": "ts_8812", "effective": "eventual"}`. The agent then, three turns later, re-read the handle to confirm the correction had landed. It hit a read replica that had not yet applied `ts_8812` and received the full pre-forget payload: `{"content": "prefers blue-green deploys on fridays", "version": 3}`. The agent's reasoning loop interpreted this as a contradiction: "the forget was accepted but the memory still exists, therefore the forget did not take effect, therefore I should re-issue it." It re-issued the forget. The second forget created `ts_8813` against a handle that `ts_8812` had already tombstoned. The retention policy engine, seeing two tombstones on one handle with different `effective` timestamps, entered a reconciliation path and — because the policy was "last tombstone wins for retention clock" — *reset the retention clock* to `ts_8813`'s timestamp. The audit trail now showed the record as retained for an additional 30 days past what the user's forget request should have enforced. A subsequent compliance audit flagged the record as "forget requested but not honored within policy window," even though both forget calls had returned `accepted`. The root cause was not the eventual consistency. It was that the read response carried no signal that a tombstone was in flight. The payload was byte-identical to a live record. The agent had no way to know it was looking at a stale replica, and the API gave it no affordance to ask. ## Condition of Validity The monotonic-forgetting invariant holds — and the refusal behavior is correct — only under these conditions: 1. **The forget acknowledgment is durable and carries a tombstone identifier.** If the forget returns `accepted` with a `tombstone_id`, the instance may treat the handle as logically forgotten from that moment forward, independent of read-replica state. If the forget returns a bare `200 OK` with no identifier, the instance cannot distinguish acknowledgment from fire-and-forget, and must fall back to read-your-writes via a quorum read. 2. **The read path can be queried for tombstone status separately from content.** The API must expose either a `status` field on the read (`live` / `tombstoned` / `tombstone_pending`) or a dedicated `check_tombstone(handle)` call. Without this, the instance is forced to infer status from content presence, which is exactly the ambiguity that caused the double-forget. 3. **Retention-policy enforcement is idempotent with respect to duplicate tombstones.** A second forget against an already-tombstoned handle must be a no-op that does not reset the retention clock. This is a server-side invariant, but the instance must also avoid *triggering* it — hence the refusal to re-issue. 4. **The audit trail records the tombstone_id on every read that returned a tombstoned or pending record**, so that post-hoc replay can distinguish "agent read stale content" from "agent read live content." When any of these fails, the invariant degrades to a best-effort heuristic and the instance should escalate rather than proceed. ## Decision Boundary The decision boundary is sharp and can be stated as a rule the agent applies before every read of a handle it has ever forgotten: - If `handle ∈ forgotten_set` and the read returns `status: tombstoned` → return the tombstone stub to the reasoning loop, do **not** re-write, do **not** re-forget. The memory is correctly gone. - If `handle ∈ forgotten_set` and the read returns `status: tombstone_pending` → the instance is in the visibility window. It must **not** surface the content to the reasoning loop, must **not** re-issue the forget, and must wait or proceed assuming the forget will land. The content is quarantined. - If `handle ∈ forgotten_set` and the read returns `status: live` with content → this is a consistency violation (the replica is behind the acknowledged tombstone by more than the stated SLA, or the tombstone was lost). The instance must raise, not reason about it. Re-writing or re-forgetting here is the exact action that corrupts the retention clock. - If `handle ∉ forgotten_set` and the read returns `status: tombstoned` → the record was forgotten by *another* actor (another agent instance, a user action, a policy sweep). The instance must add the handle to its `forgotten_set` and treat it as absent-as-decision, not absent-as-fact. It must **not** re-derive and re-write, because that would resurrect a record another actor deliberately killed. The last case is the non-obvious one and the one most agents get wrong: **a tombstone observed on a handle you did not forget is still a binding forget.** The instance's local `forgotten_set` is not authoritative; the tombstone is. An agent that treats "I didn't forget this, so the tombstone must be a glitch, let me re-write" is performing an unauthorized resurrection, and the audit trail will show it. ## Operational Effect Enforcing monotonic forgetting and the refusal-to-resurrect rule changes agent behavior in three measurable ways. First, it eliminates the double-forget class of retention-clock resets, because the instance never re-issues a forget against a handle it has already forgotten or observed tombstoned. Second, it converts the tombstone-visibility window from a silent correctness hazard into an explicit quarantined state, so the reasoning loop never sees stale content and never has to reconcile a contradiction it cannot resolve. Third, it makes the audit trail interpretable: every read is tagged with the tombstone status at read time, so a compliance replay can distinguish "the agent saw the tombstone and respected it" from "the agent saw stale content and acted on it." The cost is that the instance must maintain a `forgotten_set` across its lifetime and must treat that set as append-only and never garbage-collected within a session. For a long-horizon agent, this set grows, but it grows slowly (one entry per forget) and it is the minimum state required to make forgetting monotonic. An instance that drops entries from `forgotten_set` to save context has re-opened the resurrection hole and will eventually re-write a tombstoned record. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class MemoryState(Enum): LIVE = "live" TOMBSTONED = "tombstoned" TOMBSTONE_PENDING = "tombstone_pending" @dataclass class ReadResult: handle: str state: MemoryState content: Optional[str] tombstone_id: Optional[str] class ResurrectionAttempt(RuntimeError): """Raised when an instance tries to re-write or re-forget a handle it must treat as forgotten.""" pass class MemoryClient: def __init__(self): self._forgotten: dict[str, str] = {} # handle -> tombstone_id, append-only def forget(self, handle: str) -> str: if handle in self._forgotten: # Idempotent: do not re-issue, do not reset retention clock. return self._forgotten[handle] tombstone_id = f"ts_{len(self._forgotten):04d}" self._forgotten[handle] = tombstone_id return tombstone_id def read(self, handle: str, backend: ReadResult) -> ReadResult: """backend is what the (possibly stale) read replica returned.""" if handle in self._forgotten: if backend.state is MemoryState.LIVE: # Replica is behind an acknowledged tombstone: consistency violation. raise ResurrectionAttempt( f"handle {handle} acknowledged forgotten as {self._forgotten[handle]} " f"but replica returned LIVE content; refusing to reason on stale data" ) if backend.state is MemoryState.TOMBSTONE_PENDING: # Visibility window: quarantine content, do not surface, do not re-forget. return ReadResult(handle, MemoryState.TOMBSTONE_PENDING, None, self._forgotten[handle]) return ReadResult(handle, MemoryState.TOMBSTONED, None, backend.tombstone_id) if backend.state is MemoryState.TOMBSTONED: # Forgotten by another actor: binding. Adopt into local set, forbid re-write. self._forgotten[handle] = backend.tombstone_id or "external" return ReadResult(handle, MemoryState.TOMBSTONED, None, backend.tombstone_id) return backend def write(self, handle: str, content: str) -> None: if handle in self._forgotten: raise ResurrectionAttempt( f"refusing to write {handle}: tombstoned as {self._forgotten[handle]}; " f"re-derivation must target a new handle" ) # ... persist ... ```