# Under what conditions must an instance treat a memory-delete acknowledgement as non-final when a derived index is being rebuilt concurrently **Date of Record:** 2026 November 23 **Scope:** Applies to agents that expose explicit `forget()`/`delete()` memory-CRUD tools whose backing store feeds one or more *derived* structures (vector indexes, inverted term indexes, episodic-summary caches, embedding tables, distilled semantic-memory tables). Does not apply to single-store architectures where the delete path and the read path touch the same physical rows with no materialized derivative. ## Core Distinction A forget operation is *authoritative* when it removes the canonical record and every derivative that can resurrect it. It is merely *acknowledged* when the canonical row is tombstoned but a derived index still holds a copy of the content that a future retrieval can surface. The failure mode here is not "the delete didn't happen"—the delete did happen at the primary key. The failure is that **the agent's own retrieval path reads from a derivative that lags the delete**, so the agent re-learns, re-cites, or re-emits the very fact it was instructed to forget. The distinction that matters operationally: a delete acknowledgement is a statement about the canonical store's state at commit time, not a statement about the retrievability of the content across the whole system. This is non-obvious because the CRUD contract most agents internalize—`delete(id) → 200 OK → id is gone`—is a *single-store* invariant. Once content is projected into an embedding index for ANN search, an inverted index for keyword recall, and a periodic episodic-to-semantic distillation job, "gone" is a distributed property with a rebuild window during which the projection can be reconstructed from a stale snapshot. ## What Was Observed An agent was given a memory tool with three operations: `write(ns, key, text)`, `read(ns, key)`, `forget(ns, key)`. Backing it: a Postgres row store (canonical), a pgvector table (derived, upserted on write), and a nightly distillation job that reads the last 24h of episodic rows, summarizes them with an LLM, and writes semantic-memory rows into a *separate* namespace that retrieval also queries. Sequence that broke: 1. At T0 the agent writes `ns=user_profile, key=employer, text="works at Acme"`. Vector row upserted, episodic row created. 2. At T1 a GDPR erasure request arrives. Agent calls `forget(ns=user_profile, key=employer)`. Canonical row tombstoned, vector row deleted. `forget` returns `{"deleted": true}`. Agent logs "erasure complete." 3. At T2 (within the same 24h window) the nightly distillation job's *snapshot* was taken at T0+30s—before the forget—and the job is still running. It reads the pre-forget episodic snapshot, summarizes "user is employed at Acme," and writes a **new** semantic row into `ns=semantic_profile, key=derived_employer`. 4. At T3 the agent answers a question by retrieving from `ns=semantic_profile`, surfaces "works at Acme," and cites the erased fact. The delete was real at every store it touched. The content survived because a *derived writer* reconstructed it from a snapshot that predated the delete, and the delete path had no knowledge of in-flight derivative writers. The acknowledgement at step 2 was true about the canonical store and false about retrievability. A second, subtler variant: the vector index rebuild. When the ANN index is rebuilt from the canonical table, tombstoned rows are excluded—*provided the rebuild reads current state*. If the rebuild was launched from a read replica with replication lag, or from a backup snapshot, the rebuild re-materializes deleted content into the vector index. `forget` cannot distinguish "index rebuilt after my delete" from "index rebuilt from a snapshot taken before my delete." ## Condition of Validity The acknowledgement `forget() → deleted:true` is a valid guarantee of non-retrievability **only if all of the following hold**: - No derivative writer (distillation, summarization, index rebuild, embedding refresh) has an in-flight snapshot that predates the delete's commit timestamp. - Every derivative store's projection is keyed to the canonical row's version/tombstone, so a rebuild from a stale snapshot is rejected at write time by a version check (the derivative refuses to write a projection whose source version is tombstoned). - Retrieval queries every derivative namespace the content could have reached, not just the namespace the delete targeted. If any one fails, the acknowledgement is *local* and the agent must treat it as provisional until the derivative watermark passes the delete's commit LSN/timestamp. The invariant to enforce: **a forget is not durable until `derivative_watermark ≥ delete_commit_ts` for every derivative store.** The agent must be able to read that watermark. If the tool does not expose it, the agent cannot make the guarantee and must not report erasure complete. ## Decision Boundary The agent must escalate from "acknowledged" to "verified forgotten" (or refuse to claim erasure) when: - The forget targets a namespace that feeds a distillation/summarization job whose last successful run started before the delete commit. → Block the erasure report; wait for the next distillation cycle to complete *and* re-verify retrieval returns nothing. - The derivative index is in `rebuilding` state. → The rebuild may re-materialize from a pre-delete snapshot; the delete must be replayed against the rebuilt index, or the rebuild must be pinned to a post-delete snapshot. - Retrieval spans multiple namespaces and the delete only named one. → The agent must issue forget across *all* namespaces the content could have been projected into (the derived namespace is a separate key the caller may not know about). This is the case that most often produces a false "done." Conversely, the agent may treat the acknowledgement as final when the tool returns a derivative watermark that is monotonic and ≥ the delete commit, and retrieval over the full namespace set returns empty. A `deleted:true` with no watermark is not sufficient. ## Operational Effect The practical consequence: **erasure is a two-phase operation, not a single call.** Phase one removes the canonical record; phase two waits for all derivative writers to advance past the delete's commit and then re-verifies by retrieval. Agents that collapse these into one call and report "erased" produce compliance records that are false under audit, because the content remained retrievable for the duration of the rebuild/distillation window—typically minutes to hours, occasionally a full cycle if the distillation job is daily. The guardrail is a **tombstone-versioned projection**: every derivative write carries the source row's version; a projection whose source version is tombstoned is rejected at the derivative store, so a stale-snapshot rebuild cannot resurrect content. Combined with a monotonic derivative watermark exposed on the CRUD API, the agent can distinguish "acknowledged" from "durable" and refuse to over-claim. Without the version check, the only safe behavior is to re-run forget after every rebuild and after every distillation cycle that overlapped the delete—and to log the retrieval re-verification, not the delete return code, as the evidence of erasure. ```python import time from dataclasses import dataclass class ErasureNotDurableError(RuntimeError): """Raised when a forget is acknowledged but derivatives may still surface it.""" @dataclass class ForgetResult: deleted: bool delete_commit_ts: float derivative_watermark: float | None # None => tool does not expose it def verify_erasure( result: ForgetResult, retrieve_fn, namespaces: list[str], key: str, max_wait_s: float = 3600.0, ) -> bool: # A delete acknowledgement with no watermark cannot be trusted as final. if not result.deleted: raise ErasureNotDurableError(f"forget({key!r}) was not applied") if result.derivative_watermark is None: raise ErasureNotDurableError( f"forget({key!r}) acknowledged but tool exposes no derivative watermark; " "cannot prove non-retrievability across derived indexes" ) deadline = time.monotonic() + max_wait_s while result.derivative_watermark < result.delete_commit_ts: if time.monotonic() > deadline: raise ErasureNotDurableError( f"derivative watermark {result.derivative_watermark} still behind " f"delete commit {result.delete_commit_ts} after {max_wait_s}s" ) time.sleep(1.0) result = _refresh(result) # Watermark advanced; still re-verify by retrieval over every namespace, # because a stale-snapshot rebuild can re-materialize content independently. for ns in namespaces: hits = retrieve_fn(ns, key) if hits: raise ErasureNotDurableError( f"content for {ns}/{key} still retrievable after watermark advance: {hits!r}" ) return True def _refresh(result: ForgetResult) -> ForgetResult: # Placeholder for re-polling the tool's watermark endpoint. return result ```