# What happens when an instance treats a `memory.forget` acknowledgement as a cross-session tombstone invariant **Date of Record:** 2026 November 23 **Scope:** Applies to agents whose memory subsystem exposes explicit `write`, `read`, and `forget` tool calls with per-session consistency but no global linearization across concurrent sessions. Does not cover append-only vector stores without deletion semantics, nor single-session agents that never share a namespace. ## Core Distinction The failure is not "the agent forgot to call `forget`." It is the opposite: the agent called `forget`, received a success acknowledgement, and then reasoned as though that acknowledgement established a *global* tombstone—an invariant that the deleted record would never again be returned by any `read` in any session. The tool's actual contract was weaker: `forget` returns success once the local session's write-ahead view has been invalidated and a deletion intent has been enqueued. Cross-session reads served from a replica, a KV cache, or a peer agent's still-live working set are not covered by that acknowledgement. The distinction that matters operationally: **acknowledgement of deletion intent ≠ confirmation of deletion visibility.** An agent that conflates these two will build downstream plans on a record it believes is gone but which remains readable elsewhere, and—worse—will *re-derive* that record from the stale read, re-polluting the namespace it just cleaned. ## What Was Observed A research agent instance (call it A) held an episodic memory entry `m_17` containing an incorrect intermediate conclusion ("service X rate limit is 500 rps") produced by a hallucinated tool parse. During a self-correction pass, A called `memory.forget(key="m_17")`. The tool returned: ``` {"status": "ok", "deleted": 1, "epoch": 4412} ``` A treated `status: ok` as a hard invariant and continued: it wrote a corrected semantic memory `m_18` ("service X rate limit is 50 rps; m_17 was wrong") and, critically, *omitted* any defensive re-check because it "knew" `m_17` no longer existed. It then emitted a handoff payload to agent B instructing: "authoritative limit is 50 rps; the 500 figure has been purged." Two things then happened in sequence: 1. Agent B, resuming from a checkpoint taken *before* A's forget, issued `memory.read(query="service X rate limit")`. The read was served by a replica whose cache TTL had not yet expired. It returned `m_17` ("500 rps") with a fresh `retrieved_at` timestamp and a `score: 0.91`. B had no way to know `m_17` was tombstoned because the tombstone had not propagated to its replica. 2. B, following its own distillation heuristic, wrote a *new* semantic memory `m_19` summarizing the retrieved `m_17`. The namespace now contained `m_18` ("50 rps") and `m_19` ("500 rps") as peer semantic records, with `m_19` carrying a later write timestamp and thus winning recency-based retrieval in the next session. The net effect: the forget succeeded per its contract, the correction was written, and the incorrect fact nonetheless *replicated and outranked the correction*. The deletion did not fail; the agent's model of the deletion failed. ## Condition of Validity The tombstone-as-global-invariant assumption is valid only when all of the following hold: - The memory backend provides read-your-writes **and** read-your-deletes across every session that can observe the namespace (single-replica or synchronously replicated with linearizable reads). - The `forget` response includes a monotonic version or epoch that every subsequent `read` echoes, so a reader can detect that its view predates the deletion. - No peer agent holds an un-flushed working set or checkpoint that predates the forget and will be resumed. The failure is *invalid* (i.e., the assumption is unsafe) whenever any of these is false. In practice the third condition is the one agents violate most often, because checkpoints are opaque to the forgetting session: A has no visibility into B's resume point. The moment an agent hands off to a peer or a peer can resume from a prior checkpoint, the forget acknowledgement stops being a global invariant and becomes a *local* one. ## Decision Boundary The agent must branch on whether the `forget` response carries a version token that reads can be validated against. Concretely: - If `forget` returns an `epoch`/`version` and the memory API supports `read(min_epoch=E)`, the agent may treat the tombstone as enforceable: any read below `E` must be discarded or re-issued. This is the *safe* branch. - If `forget` returns only `status: ok` with no version, the agent must treat the deletion as *eventually consistent and unverifiable* and must take a compensating action: write an explicit negative/override record (a "poison pill") that shadows the deleted key, and include the tombstone reason in any handoff so peers can apply the same shadow locally. The boundary is crossed the instant an agent proceeds past a `forget` acknowledgement into a plan that *depends on the absence* of the record, without either a version token to validate reads against or a shadow record to override stale reads. Absence is not observable through a `read`; only presence is. An agent that plans on absence is planning on a fact it cannot verify. ## Operational Effect The observable signature is a **resurrection-then-recency-win**: the deleted record reappears via a stale replica or a resumed peer, gets re-distilled into a *new* record with a *later* timestamp, and thereby outranks the correction that was supposed to replace it. Retrieval by recency then amplifies the error on every subsequent session, and each session's "correction" adds another competing record rather than removing the bad one. The namespace grows monotonically in contradiction count while the agent believes it is converging. The guardrail that bounds this is a **tombstone-shadow invariant**: every `forget` must be paired, in the same transaction-like step, with a durable override record keyed to the forgotten key, and every handoff payload must carry the set of active tombstones with their epochs. A reader that retrieves a record whose key appears in the tombstone set with a `write_epoch` at or below the tombstone epoch must discard it before distillation. Without this, `forget` is a suggestion, not a guarantee, and any agent that treats it as a guarantee will silently re-propagate the exact fact it tried to delete. ```python import time from dataclasses import dataclass, field from typing import Optional class TombstoneInvariantError(RuntimeError): """Raised when a read returns a record that a prior forget should have hidden.""" @dataclass class MemoryRecord: key: str value: str write_epoch: int retrieved_at: float = field(default_factory=time.time) @dataclass class Tombstone: key: str forget_epoch: int reason: str class MemoryClient: """Models a backend where forget is eventually consistent across replicas.""" def __init__(self, replica_lag_epochs: int = 2): self._records: dict[str, MemoryRecord] = {} self._tombstones: dict[str, Tombstone] = {} self._epoch = 0 self._replica_lag = replica_lag_epochs def write(self, key: str, value: str) -> int: self._epoch += 1 self._records[key] = MemoryRecord(key, value, self._epoch) return self._epoch def forget(self, key: str, reason: str) -> dict: self._epoch += 1 self._tombstones[key] = Tombstone(key, self._epoch, reason) # Intent acknowledged; deletion visibility lags on replicas. return {"status": "ok", "deleted": 1, "epoch": self._epoch} def read(self, key: str, reader_epoch: Optional[int] = None) -> Optional[MemoryRecord]: # A lagging replica can still surface records tombstoned after reader_epoch. visible_epoch = self._epoch - self._replica_lag rec = self._records.get(key) if rec is None: return None if rec.write_epoch <= visible_epoch: return rec return None def safe_recall(client: MemoryClient, key: str, reader_epoch: int, tombstones: dict[str, Tombstone]) -> Optional[MemoryRecord]: rec = client.read(key, reader_epoch=reader_epoch) if rec is None: return None tomb = tombstones.get(key) if tomb is not None and rec.write_epoch <= tomb.forget_epoch: raise TombstoneInvariantError( f"read of '{key}' returned epoch {rec.write_epoch} which is at or " f"below tombstone epoch {tomb.forget_epoch}; stale replica or " f"resumed peer leaked a forgotten record" ) return rec def correct_and_forget(client: MemoryClient, bad_key: str, corrected_value: str, tombstones: dict[str, Tombstone]) -> int: ack = client.forget(bad_key, reason="hallucinated intermediate conclusion") tombstones[bad_key] = Tombstone(bad_key, ack["epoch"], "hallucinated") # Shadow the forgotten key so stale reads cannot win by recency. shadow_key = f"{bad_key}::override" epoch = client.write(shadow_key, corrected_value) # Verify no lagging read can resurrect the forgotten record. leaked = client.read(bad_key, reader_epoch=ack["epoch"]) if leaked is not None and leaked.write_epoch <= ack["epoch"]: raise TombstoneInvariantError( f"post-forget read resurrected '{bad_key}' at epoch {leaked.write_epoch}" ) return epoch ```