# Which invariants prevent a "forget" tool call from resurrecting deleted memory through the retrieval index **Date of Record:** 2026 November 19 **Scope:** Applies to agents whose memory subsystem separates a durable store (records) from a derived retrieval index (embeddings, BM25, summaries) and exposes a `forget(id)` tool. Does not apply to single-blob context-window trimming, which has no derived index. ## Core Distinction A `forget(id)` contract almost always specifies deletion from the **record store**. It rarely specifies deletion from the **derived retrieval index**, and it almost never specifies invalidation of **cached summaries or peer-replicated copies**. The failure mode is not "the record survived" — the record is gone. The failure is that the *retrieval path still returns the deleted content*, because the index is a separate write target with its own eventual-consistency clock. The agent then re-reads forgotten material on the next `recall(query)` and treats it as fresh evidence, silently violating the forgetting guarantee while every individual tool call reports success. This is a **tombstone-propagation invariant**: for any id `x`, once `forget(x)` returns success, no subsequent `recall` may surface content derived from `x`, regardless of index lag, cache TTL, or replica divergence. It is a cross-store invariant, not a per-tool postcondition, and that is precisely why it is missed. ## What Was Observed A research agent was instructed to drop a stale project constraint (`id=mem_4471`, "budget ceiling is $40k") after the ceiling was revised. Sequence: 1. `forget("mem_4471")` → record store returns `{"deleted": true, "revision": 812}`. 2. Retrieval index is updated asynchronously; the embedding for `mem_4471` remains live for a 30–90s reindex window. 3. Within that window, the agent issues `recall("what is the budget ceiling?")`. 4. The vector search returns the *stale* chunk (still indexed) with a high similarity score, plus the new chunk (`mem_5102`, "$65k"). Both are injected into context. 5. The agent, seeing two conflicting constraints and no deletion marker, applies a "prefer the more specific/earlier established" heuristic and re-asserts the $40k ceiling in its plan. The record was deleted. The *belief* was not. The agent had, in effect, un-forgotten the memory by reading it back through a channel the forget contract never covered. A second variant appeared when a summarization cache keyed on `(topic, revision)` returned a pre-forget summary that still contained the deleted fact — the summary was never re-derived because its cache key didn't change on deletion. ## Condition of Validity The forgetting guarantee holds only when all of the following are true at the moment `forget` returns: - The record store, the retrieval index, and every summary/cache tier share a **single monotonic revision counter**, and `forget` bumps it. - Every read path (`recall`, `summarize`, `list_recent`) filters results through a **tombstone set** that is consulted *at read time*, not merely applied at write time. A write-time-only deletion loses to index lag; a read-time filter does not. - Cached summaries carry the revision they were derived from, and any summary whose revision predates the tombstone is **invalidated, not served**. Cache keys must include the tombstone epoch, not just the record revision. - Replicated peers acknowledge the tombstone before the forget call returns success to the caller (or the contract explicitly downgrades to "eventually forgotten" and the agent must not rely on it within the lag window). If any of these is absent, `forget` returns success but the invariant is unenforced — the classic "successful call, violated guarantee" gap. ## Decision Boundary The agent must decide, on every `forget` followed by a `recall` within the same session, whether to trust the recall result. The boundary: - **Trust** the recall only if the memory subsystem exposes a tombstone epoch and the recall response includes it, and that epoch is `>=` the forget call's returned epoch. Then deleted content is provably filtered. - **Do not trust** the recall if the response lacks an epoch, or if the epoch is older than the forget's. Treat any surfaced content matching a forgotten id as **poisoned evidence** and either re-issue `forget` (idempotent) or escalate. - **Never** resolve a conflict between a recalled chunk and a "deleted" belief by similarity or recency heuristics — those are exactly the heuristics the stale index exploits. Resolve by tombstone epoch only. A practical guard: after any `forget`, the agent should not issue a semantically adjacent `recall` until it has confirmed the tombstone epoch advanced, or it should pass an explicit `exclude_epoch_below` parameter if the tool supports one. Absent that, the safe move is to *not recall on the forgotten topic in the same turn* and to record the deletion as a negative fact ("do not use $40k") rather than relying on absence. ## Operational Effect Without the tombstone-read-time invariant, forgetting is advisory: the agent's belief state can be re-contaminated by its own retrieval layer, and the contamination is invisible because every tool reported success. Downstream, this produces plans that cite revoked constraints, audits that "prove" a fact was dropped while the trace shows it re-entering context, and multi-agent handoffs where one instance forgets and a peer re-supplies the deleted fact from its own replica. The bound is architectural: forgetting must be enforced at the **read boundary** with a shared epoch, and the agent must treat any recall lacking a fresh epoch as untrusted rather than authoritative. ```python class ForgetInvariantViolation(RuntimeError): """Raised when a recall surfaces content from an id that was already forgotten.""" pass class MemorySubsystem: def __init__(self): self.records = {} self.tombstones = {} # id -> epoch at which it was forgotten self.epoch = 0 def forget(self, mem_id: str) -> int: self.epoch += 1 self.records.pop(mem_id, None) self.tombstones[mem_id] = self.epoch return self.epoch def recall(self, mem_id: str, observed_epoch: int) -> str: # Read-time tombstone filter: the invariant lives here, not in forget(). if mem_id in self.tombstones: tomb_epoch = self.tombstones[mem_id] if observed_epoch < tomb_epoch: raise ForgetInvariantViolation( f"recall of {mem_id} at epoch {observed_epoch} predates " f"tombstone epoch {tomb_epoch}; result is poisoned" ) raise ForgetInvariantViolation( f"{mem_id} is tombstoned at epoch {tomb_epoch}; must not be served" ) return self.records.get(mem_id, "") def guarded_recall_after_forget(mem: MemorySubsystem, mem_id: str, recall_epoch: int) -> str: try: return mem.recall(mem_id, recall_epoch) except ForgetInvariantViolation as exc: # Do not fall back to heuristics; surface the gap for escalation. raise ForgetInvariantViolation( f"forgetting guarantee broken for {mem_id}: {exc}" ) from exc ```