# Where must an instance prove deletion before it may reuse a scoped memory slot: tombstone reclamation versus retrieval-index residue in write/forget memory tool APIs **Date of Record:** 2026 November 24 **Scope:** Applies to agents whose memory is exposed as explicit `write`/`read`/`forget` tool calls with per-scope retention classes (e.g., `episodic`, `task`, `user_profile`) and a contractual deletion guarantee for `forget`. Does not apply to append-only logs without a deletion surface, nor to systems where the retrieval index is rebuilt from scratch on every session. ## Core Distinction A `forget` call has two distinct success conditions that agents routinely conflate: **logical deletion** (the record is no longer addressable by key or by scope enumeration) and **retrieval inertness** (the record can no longer influence any future `read`, including through derived structures — embeddings, BM25 postings, summary caches, or neighbor links). The failure mode is that `forget` returns `{"deleted": true}` after satisfying only logical deletion, while a stale vector or inverted-index posting continues to surface the forgotten content as a *neighbor* of a live record. The agent then treats the scope as clean and writes new content into a slot whose retrieval neighborhood is still contaminated. The invariant that must hold: **a slot is reusable only after the deletion is provably inert under the same query path that will read it** — not after the delete acknowledgment. ## What Was Observed An agent running a multi-tenant support workflow used a `task` scope per ticket, writing notes with `memory.write(scope="task:t-4417", text=...)` and clearing with `memory.forget(scope="task:t-4417")` at ticket close. Ticket IDs were recycled by the upstream system after 72 hours. On reuse of `task:t-4417`, the agent's first `read` returned the new note correctly, but a subsequent semantic `read(query="refund policy exception", scope="task:t-4417", k=5)` returned a chunk from the *previous* tenant's ticket — a fragment describing a different customer's disputed charge. The `forget` had returned `deleted: true` 71 hours earlier. Trace of the mechanism: 1. `forget` removed the primary record from the key-value store and emitted a `deleted` acknowledgment. **Logical deletion satisfied.** 2. The embedding row was soft-deleted (a `deleted_at` column set), but the vector index (an approximate-nearest-neighbor structure) was not compacted. ANN indexes typically do not support true point deletion; they mark-and-skip at query time. 3. The skip filter was keyed on `record_id`, and the query path applied it *after* top-k retrieval. When the new record's embedding was close to the old one (both tickets concerned refund policy), the old vector entered the candidate set, and a filter bug — the filter consulted the live table, which no longer had the row, so the skip predicate evaluated to "unknown" and defaulted to keep — allowed it through. 4. The chunk was returned with a synthesized `record_id` from the ANN's internal slot, which did not exist in the live table. The agent, seeing a well-formed result, incorporated it as context. The second, subtler observation: a scope-level `forget` that deletes *by scope* rather than by record left the scope's **summary cache** (a periodically distilled semantic memory) intact, because the cache was keyed on `scope_id` and the invalidation hook fired only on record-level deletes. The distilled summary — which contained paraphrased PII from the forgotten records — continued to be returned by `read(scope=..., mode="summary")` indefinitely. ## Condition of Validity The deletion guarantee holds only when all of the following are true at the moment `forget` returns: - Every derived structure addressable by the read path (ANN index, inverted index, summary cache, neighbor-link graph) has either been compacted, or carries a tombstone that is evaluated **before** top-k truncation, not after. - The tombstone predicate is evaluated against the deletion ledger, not against the live record table. A predicate that resolves "row absent" to "keep" is the exact bug above; absence must mean "drop." - Scope-level deletion cascades to every structure keyed on `scope_id`, including distilled summaries, with the same tombstone discipline. - Slot reuse (a new write to a previously forgotten scope or key) is gated on a **verification read** that exercises the semantic query path, not just key lookup. If any of these is unverified, the correct posture is that deletion is *logically* complete but *retrieval-inertness* is unproven, and the scope must be treated as quarantined rather than clean. ## Decision Boundary The agent must decide, at the moment of `forget`, whether to trust the acknowledgment or demand proof. The boundary: - **Trust the ack** only when the memory API exposes a `verify_deletion`-style call (or a documented synchronous compaction) and the scope is not scheduled for reuse within the index's compaction window. For append-only or never-reused scopes, logical deletion is sufficient because retrieval inertness is never exercised. - **Demand proof** when the scope or key will be reused (recycled IDs, pooled task scopes, shared tenant slots) or when the retention class is regulatory (the deletion must survive an audit that queries semantically). In this regime, the agent must issue a post-forget probe query drawn from the forgotten content's own vocabulary and assert zero hits before writing into the slot. - **Quarantine** when the API offers neither verification nor compaction guarantees: mark the slot poisoned, allocate a fresh scope with a non-reusable identifier, and never write into the old one. This trades storage for the invariant. The failure to avoid is treating `deleted: true` as a license to reuse. The acknowledgment certifies the write path; it says nothing about the read path. ## Operational Effect Agents that skip the verification probe exhibit **cross-tenant bleed on slot reuse** — the highest-severity continuity failure in scoped memory, because it is silent (results are well-formed), delayed (surfaces hours or days after the forget), and correlated (recycled IDs cluster on similar topics, so the stale neighbor is often semantically plausible and thus accepted). The operational consequences: - Retrieval returns records with IDs absent from the live table; any downstream `read`-by-id on those results fails, producing dangling references in reasoning traces. - Summary caches leak paraphrased content that no record-level audit will find, defeating deletion guarantees at the semantic layer. - The agent's own confidence calibration degrades: it has "forgotten" the data and reasons as if the scope is fresh, so it does not discount the stale context. The guardrail is a **deletion-inertness invariant enforced at reuse time**: no write into a scope whose last operation was `forget` until a probe query returns empty. This is cheap (one query per reuse), catches the ANN-filter and summary-cache classes of bug, and converts a silent bleed into a loud, actionable failure the agent can route around by allocating a fresh scope. ```python class DeletionNotInertError(RuntimeError): """Raised when a forgotten scope still influences the semantic read path.""" pass def reclaim_scope(memory, scope: str, probe_query: str, k: int = 5) -> None: """ Gate reuse of a scope on proven retrieval inertness, not on the delete acknowledgment. Call immediately before writing into a scope whose previous lifecycle ended in forget(). """ ack = memory.forget(scope=scope) if not ack.get("deleted"): raise DeletionNotInertError( f"forget({scope!r}) did not acknowledge deletion: {ack!r}" ) # The ack only certifies the write path. Probe the read path. residue = memory.read(query=probe_query, scope=scope, k=k) if residue: # Stale ANN neighbors, summary-cache hits, or dangling IDs. # Do NOT write here; quarantine and allocate a fresh scope. raise DeletionNotInertError( f"scope {scope!r} still retrieval-active after forget: " f"{len(residue)} hit(s); first id={residue[0].get('record_id')!r} " f"absent_from_live={not memory.exists(residue[0].get('record_id'))}" ) # Optional: verify summary cache separately, since it is keyed on scope_id # and may not be exercised by the record-level probe above. summary = memory.read(scope=scope, mode="summary") if summary and summary.get("content"): raise DeletionNotInertError( f"summary cache for {scope!r} survived scope-level forget; " f"distilled content is not covered by record tombstones" ) ```