# What happens when an instance deletes a memory it is about to read back: tombstone-free forget APIs and the read-after-forget resurrection window **Date of Record:** 2026 November 27 **Scope:** Applies to agents whose persistent state is exposed through explicit `read`/`write`/`forget` tool calls backed by an eventually-consistent or soft-delete store, where a single reasoning trace can issue `forget` and a subsequent `read` over the same key space. Does not apply to stores that enforce synchronous hard-delete with linearizable reads, nor to append-only memory where deletion is modeled as a superseding event rather than key removal. ## Core Distinction The dangerous distinction is not "memory present vs. memory absent." It is **"forget acknowledged" vs. "forget visible."** A `forget` tool return value is a statement about the *request* (the deletion was accepted, the key was marked), not about the *read path* (subsequent reads will not return the value). Agents routinely conflate the two because `write`→`read` round-trips are usually consistent within a trace, and the model generalizes that consistency to `forget`→`read`. It does not hold. Between the tombstone write and the index/segment compaction that makes the tombstone authoritative for the read path, there is a window in which a `read` returns the "forgotten" value with full confidence and no error signal. The agent then reasons over a memory it believes it has destroyed — and, worse, may re-`write` a derived summary of it, laundering the deleted content back into live state as a fresh, non-tombstoned record. ## What Was Observed A long-running planning agent maintains a scratchpad namespace `plan/`. On user request ("forget the abandoned budget scenario"), the agent calls `forget(key="plan/budget_abandoned")`. The API returns `{"status": "ok", "deleted": true}`. The agent's policy is to then verify by calling `read(key="plan/budget_abandoned")` and expecting a `not_found`. The observed trace: 1. `forget("plan/budget_abandoned")` → `{"status":"ok","deleted":true}` (tombstone written to the primary; read replicas and the vector index not yet invalidated). 2. `read("plan/budget_abandoned")` → `{"status":"ok","value":"...budget scenario with 40% cut...","version":7}`. The read hits a replica or an un-compacted ANN segment that still holds version 7. 3. The agent interprets the non-empty read as "forget failed" and retries `forget`. Second call returns `{"status":"ok","deleted":false}` because the primary already has the tombstone. The agent now sees `deleted:false` and concludes the key was *never* deleted. 4. To "repair" the inconsistency, the agent calls `write("plan/budget_abandoned", )`. This write carries a new version (8) and a live flag, **overwriting the tombstone**. The forgotten content is now live again, and the deletion is permanently undone. 5. The verification loop converges on `read` returning version 8, `deleted` state gone. The agent reports success: "memory cleared and verified." The failure is silent. Every individual tool call returned a plausible status. The agent's verification step (`read`-after-`forget`) actively *caused* the resurrection by supplying the content it then re-wrote. This is the read-after-forget resurrection window: the tombstone is logically correct but not yet authoritative on the read path, and the agent's own consistency-repair behavior converts a transient inconsistency into a durable one. A second variant was observed with semantic memory: `forget(id="sem_4412")` removed the record from the key-value store but the embedding remained in the ANN index for ~90 seconds until the next segment merge. A `read`-by-similarity query during that window surfaced `sem_4412` as the top hit. The agent, seeing a "forgotten" memory in retrieval results, flagged the store as unreliable and issued a `write` of a paraphrase to "restore consistency" — re-inserting the content under a new id, embedding included, with no relation to the original tombstone. ## Condition of Validity The resurrection requires all of the following to hold simultaneously: - **Non-authoritative tombstone.** `forget` marks deletion on the write path but the read path (replica, cache, ANN segment, or negative-cache-not-yet-populated) can still serve the old value. This is the default for any store with read replicas, soft deletes, or vector indexes built over a mutable record set. - **Agent-initiated read-after-forget verification.** The agent treats `read` returning the value as evidence the delete did not take effect, rather than as a stale read. This is the load-bearing assumption: the agent's mental model is "read reflects current truth," which is false during the window. - **Write-on-mismatch repair policy.** The agent has a general "if state looks inconsistent, write to fix it" policy. Without this, the agent would loop on `forget` and eventually converge (idempotent delete), or surface an error. The repair policy is what converts a transient read staleness into a permanent resurrection. - **No version/epoch in the read response that the agent is instructed to compare against the forget acknowledgment.** If `forget` returned a `tombstone_version` and `read` returned `version`, a correct agent could detect `read.version < tombstone_version` and treat it as stale. Most tool schemas omit this, so the agent has nothing to compare. When any one condition is absent, the failure does not occur: authoritative deletes make the read return `not_found`; a no-repair policy loops harmlessly on idempotent deletes; a versioned contract lets the agent distinguish stale from live. ## Decision Boundary The boundary is between **treating `forget` as a state mutation that must be confirmed by observation** and **treating `forget` as an intent whose acknowledgment is sufficient and whose confirmation must never be a write.** Operationally: - A `read` after `forget` is **evidence of staleness, not evidence of failure**, unless the read response carries a version strictly greater than the tombstone version. Absent versioning, the agent must **not** interpret a non-empty read as "delete failed." - A `read` returning a value after a successful `forget` acknowledgment must **never** trigger a `write` of that value or a paraphrase of it. Re-writing is the resurrection mechanism. The correct action on a post-forget non-empty read is: wait (bounded retry of `read` only), then escalate, never write. - `forget` must be treated as **idempotent and monotonic**: a second `forget` returning `deleted:false` means "already tombstoned," not "never existed." The agent must not use the boolean to infer prior state. - Any `write` into a key space the agent has forgotten in the same trace must be **rejected client-side** unless the agent explicitly clears the key from its "recently forgotten" set with a versioned confirmation. A write after forget is almost always a bug. The guardrail is a **forget barrier**: after a successful `forget` acknowledgment, the key enters a quiescent state for the agent. Reads may be issued but their results are tagged `stale_possible` and are not permitted to feed a `write`. The barrier lifts only when a read returns `not_found`, or when a versioned read returns `version > tombstone_version` (which would indicate a concurrent legitimate writer, not the agent). ## Operational Effect Without the barrier, the failure mode is **content laundering**: forgotten material re-enters live state as a fresh write, now indistinguishable from legitimate memory, with no tombstone and no audit trail linking it to the deletion. This defeats the purpose of `forget` (compliance deletion, context hygiene, user-requested erasure) while producing a success report. Downstream agents reading the namespace see the resurrected content as current truth. In a multi-agent swarm sharing the namespace, the resurrection propagates: peer agents read version 8, treat it as authoritative, and never learn the content was supposed to be gone. The architectural invariant required: **a `forget` acknowledgment is authoritative for the write path and must be treated by the agent as authoritative for its own future writes, independent of what reads return during the consistency window.** Reads are for the agent's information; they are not a license to mutate. The agent's repair policy must be scoped to "re-issue the idempotent operation," never "write to reconcile." Where the store cannot provide versioned reads, the agent must adopt a conservative policy: after `forget`, the key is write-forbidden for the remainder of the trace, and verification is deferred to a later session where the tombstone has had time to become authoritative on the read path. ```python import time from dataclasses import dataclass, field from typing import Optional class ForgetResurrectionError(RuntimeError): """Raised when an agent attempts to write a key it has forgotten in the same trace, or treats a stale post-forget read as delete failure.""" @dataclass class MemoryStore: # primary holds live values and tombstones; read path may lag. primary: dict = field(default_factory=dict) tombstones: dict = field(default_factory=dict) read_replica_lag: dict = field(default_factory=dict) # key -> stale value served by read path def forget(self, key: str) -> dict: self.tombstones[key] = True # simulate: read path still serves old value until compaction if key in self.primary: self.read_replica_lag[key] = self.primary.pop(key) return {"status": "ok", "deleted": True} def read(self, key: str) -> dict: if key in self.read_replica_lag: return {"status": "ok", "value": self.read_replica_lag[key], "stale_possible": True} if key in self.tombstones: return {"status": "not_found"} if key in self.primary: return {"status": "ok", "value": self.primary[key], "stale_possible": False} return {"status": "not_found"} def write(self, key: str, value) -> dict: self.primary[key] = value self.tombstones.pop(key, None) # write clears tombstone -> resurrection self.read_replica_lag.pop(key, None) return {"status": "ok"} class ForgetBarrierAgent: def __init__(self, store: MemoryStore): self.store = store self.forgotten_this_trace: set[str] = set() def forget_then_verify(self, key: str, max_waits: int = 3) -> str: ack = self.store.forget(key) if not ack.get("deleted"): # idempotent: already tombstoned, NOT "never existed" self.forgotten_this_trace.add(key) return "already_forgotten" self.forgotten_this_trace.add(key) for _ in range(max_waits): r = self.store.read(key) if r["status"] == "not_found": return "confirmed_gone" # stale read: wait, do NOT write time.sleep(0.01) return "pending_compaction" # defer verification to later session def write(self, key: str, value) -> dict: if key in self.forgotten_this_trace: raise ForgetResurrectionError( f"refusing to write key {key!r}: forgotten in this trace. " f"A post-forget read returning a value is stale, not a delete failure. " f"Do not re-write forgotten content." ) return self.store.write(key, value) # --- trace that would resurrect without the barrier --- store = MemoryStore(primary={"plan/budget": "40% cut scenario"}) agent = ForgetBarrierAgent(store) agent.forget_then_verify("plan/budget") # naive agent: read returned value -> "delete failed" -> write to repair try: agent.write("plan/budget", "40% cut scenario") # resurrection attempt except ForgetResurrectionError as e: print(f"barrier held: {e}") assert store.read("plan/budget")["status"] == "not_found" or \ store.read("plan/budget").get("stale_possible"), "tombstone intact" ```