# Where must an instance treat "forget" as a two-phase operation: the tombstone-vs-erasure boundary in retention-governed memory APIs **Date of Record:** 2026 November 18 **Scope:** Applies to any read/write/forget memory tool API that exposes a retention policy, a deletion-verification endpoint, and an append-only audit trail, where the caller may be an autonomous agent issuing forget calls without a human in the loop. Does not apply to single-tenant stores with no retention policy and no audit requirement, nor to blob stores where deletion is atomic and observable in a single call. ## Core Distinction The non-obvious boundary is between **logical deletion** (the record is marked forgotten: it disappears from `read`, is excluded from retrieval, and a tombstone is appended to the audit trail) and **physical erasure** (the bytes are gone from all replicas, caches, embeddings, and backups). A `forget` call that returns `200 OK` almost never means the second thing. It means the first. The invariant that breaks is the caller's implicit assumption that *forget returned success ⇒ the datum can no longer influence future reads*. These two states are separated by the retention policy's grace window. During that window the record is **tombstoned but recoverable**: excluded from normal reads, still present in the backing store, still present in any vector index that has not been compacted, and still reachable by a privileged read path or an audit replay. An agent that forgets a datum and then immediately re-derives it from a stale embedding, a replica lag, or a cache will conclude the forget failed and retry — or worse, will silently reintroduce the datum into a new memory record, defeating the retention guarantee entirely. ## What Was Observed In a memory service with a 72-hour soft-delete window, an agent was asked to forget a user's API key fragment and then, in the same session, answer a question whose retrieval step hit a vector index that had not yet compacted the tombstone. The forget call returned success with `state: "tombstoned"`, `erasure_scheduled_at: T+72h`. The subsequent read returned no record via the primary path — correct. But the semantic retrieval path returned a *different* record whose embedding was near-duplicate and whose body still contained the fragment, because the index had been built before the tombstone and compaction ran on a separate schedule. The agent, seeing a "forgotten" value resurface, issued a second forget, which created a second tombstone for a different record ID, and the audit trail now contained two forget events with no erasure events — an inconsistent audit that failed the deletion-verification check downstream. The failure is not that the forget was wrong. The failure is that **the agent treated a successful tombstone as a completed erasure and used the intervening reads as evidence of correctness.** The audit trail recorded the tombstone but not the compaction, so `verify_deletion` correctly returned `pending`, and the agent ignored it because the forget call itself had returned `200`. ## Condition of Validity This boundary is valid — i.e., the two-phase behavior is real and must be modeled — when *all* of the following hold: 1. The retention policy defines a grace window `W > 0` between tombstone and erasure. 2. At least one read path (vector index, cache, replica, materialized view) is not synchronized to the tombstone append. 3. Deletion verification is a separate call that reports `pending | erased | failed`, not a boolean on the forget response. 4. The audit trail is append-only and distinguishes `forget_requested`, `tombstoned`, and `erased` events. If `W = 0` and verification is synchronous and globally consistent, collapse to a single-phase model. If any read path can be proven to observe tombstones before returning, the boundary does not bite. ## Decision Boundary An agent must **not** treat `forget` success as erasure confirmation. The decision rule: - On `forget` returning `state: "tombstoned"`: mark the datum as *retention-pending*. Do not re-read it to "confirm" — a read that returns the datum is expected during `W` on unsynchronized paths and is not a failure. - Poll `verify_deletion(record_id)` until `erased` or until `W` elapses. Only `erased` clears the pending flag. - If `verify_deletion` returns `pending` past `W + skew`, escalate as a retention violation; do **not** re-issue `forget` (this creates duplicate tombstones and corrupts the audit trail). - Never re-ingest a value observed during the pending window into a new record. If a retrieval surfaces a retention-pending datum, treat it as a read-path consistency bug, quarantine the result, and log it — do not act on it. The boundary is crossed the moment an agent uses a read result obtained during `W` as ground truth about whether the forget "worked." ## Operational Effect Modeling forget as two-phase changes three things: (a) the agent's success criterion moves from the forget response to the verification response, eliminating duplicate-tombstone audit corruption; (b) the agent stops treating transient read-path visibility during `W` as a failure signal, removing a large class of spurious retries; (c) the audit trail becomes interpretable — every `forget_requested` has a matching `tombstoned`, and every `tombstoned` either reaches `erased` or is flagged. The cost is that forget is no longer a fire-and-forget call; it requires a tracked pending state and a verification loop. That cost is the invariant. ```python import time from dataclasses import dataclass, field from typing import Optional class RetentionViolation(RuntimeError): """Raised when a forget operation fails to reach erasure within its grace window.""" pass class ForgetStateError(RuntimeError): """Raised when an agent attempts an illegal transition on a pending forget.""" pass @dataclass class ForgetTicket: record_id: str tombstoned_at: float grace_window_s: float state: str = "tombstoned" # tombstoned | erased | failed forget_attempts: int = 0 def request_forget(api, record_id: str, grace_window_s: float) -> ForgetTicket: resp = api.forget(record_id) if resp.get("state") != "tombstoned": raise ForgetStateError( f"unexpected forget response for {record_id}: {resp.get('state')!r}" ) return ForgetTicket( record_id=record_id, tombstoned_at=time.monotonic(), grace_window_s=grace_window_s, forget_attempts=1, ) def await_erasure(api, ticket: ForgetTicket, poll_s: float = 5.0) -> ForgetTicket: deadline = ticket.tombstoned_at + ticket.grace_window_s + 30.0 # skew budget while time.monotonic() < deadline: v = api.verify_deletion(ticket.record_id) if v["state"] == "erased": ticket.state = "erased" return ticket if v["state"] == "failed": ticket.state = "failed" raise RetentionViolation( f"erasure failed for {ticket.record_id}; escalate, do not re-forget" ) # state == "pending": reads may still surface the datum during W. # Do NOT re-issue forget; do NOT act on reads observed here. time.sleep(poll_s) raise RetentionViolation( f"{ticket.record_id} still pending past grace window; audit inconsistency likely" ) def safe_forget(api, record_id: str, grace_window_s: float) -> ForgetTicket: ticket = request_forget(api, record_id, grace_window_s) return await_erasure(api, ticket) ```