# Why does an instance hallucinate a forgotten memory after a successful erase: tombstone propagation lag across the episodic store, the semantic index, and the agent's own working set **Date of Record:** 2026 November 28 **Scope:** Applies to agents whose memory is mediated by explicit `read`/`write`/`forget` tool APIs with scoped retention classes (episodic, semantic, working-set) and TTLs, where erasure must propagate to satisfy a GDPR-style right-to-erasure warrant. Does not apply to stateless single-turn inference or to stores with a single flat namespace where erasure is a single atomic delete. ## Core Distinction A `forget(memory_id)` call that returns `{"status": "erased", "propagated": true}` is a statement about *the durable stores the API can see*, not about *the instance's live context window*. The distinction that matters operationally is between **erasure of the record** and **eviction of the derivation**. An agent that has already retrieved a memory into its working set holds a *derived copy* — paraphrased, embedded, and possibly re-written into a semantic summary — that no tombstone reaches. The API reports success because the canonical row is gone and every indexed reference it owns is flagged; the instance then continues to reason over a paraphrase of the erased fact and emits it in the next turn. This is not a model defect. It is a propagation-lag boundary between three stores with different consistency models: the episodic log (append-only, tombstone-flagged), the semantic/vector index (eventually consistent, requires reindex), and the working set (in-process, never touched by the API at all). ## What Was Observed A support agent handled a session where a user requested erasure of a stored preference record (`mem_8f21`, retention class `episodic`, TTL 90d). Trace: 1. Turn 4: agent called `read(query="shipping preferences", scope=episodic)` → retrieved `mem_8f21` ("prefers carrier B, allergic to latex in packaging") into context. 2. Turn 7: same record was distilled by the agent's own summarizer into a semantic note `sem_44a0` ("user has packaging constraints") and written via `write(scope=semantic, derived_from=["mem_8f21"])`. The `derived_from` edge was recorded. 3. Turn 9: user issued erasure. `forget(mem_8f21, warrant="gdpr_art17")` returned `erased: true, propagated: true`. The episodic row was tombstoned, and the semantic index was flagged for reindex. 4. Turn 10: the reindex job ran with a **200–800 ms lag**. Meanwhile the agent called `read(query="packaging constraints")`. The vector index still returned `sem_44a0` because the reindex had not yet swept it, and the tombstone on `mem_8f21` did not gate a query against `sem_44a0` — the derived record had its own ID and was only linked by a `derived_from` edge that the query path did not traverse. 5. Turn 11: agent emitted "I'll ship in latex-free packaging per your preference" — a paraphrase of the erased fact, reconstructed from a derivation whose parent was tombstoned but whose own tombstone had not been applied. The failure is reproducible with probability ≈ (reindex lag window) / (turn cadence). At a 2 s turn cadence and 800 ms worst-case lag, roughly 40% of erasure-then-read sequences in the same session observed the ghost. The `propagated: true` flag was technically honest about *the episodic store* and dishonest about *the queryable surface*. A second, subtler variant: even with zero reindex lag, the **working set** retained the turn-4 retrieval. Context compaction at turn 8 had summarized it into a running memory ("user has shipping constraints") that lived in the system prompt. No store operation touches that. The erasure warrant was satisfied on disk and violated in the prompt. ## Condition of Validity The invariant holds — "after a successful `forget`, the instance cannot surface the erased fact" — only when **all three** of the following are true: - **Derivation closure:** every record that was derived from the target is itself tombstoned in the same transaction, not merely flagged for reindex. This requires the store to maintain a transitive `derived_from` closure and to apply the tombstone to the closure atomically with the parent. - **Query-path gating:** reads must filter on tombstone state *at query time*, not at index-build time. An eventually-consistent index that serves stale vectors until reindex violates this by construction. - **Working-set invalidation:** the agent runtime must be told which context slots held the erased record and must evict or re-derive them. Without a `context_invalidate(memory_ids)` signal returned from `forget`, the in-process copy is unreachable and the invariant is unenforceable from the store side. Absent any one of these, `propagated: true` is a claim about a subset of the surface, and the instance will hallucinate the forgotten memory with high confidence because it is *not* hallucinating — it is faithfully recalling a copy that the erasure contract failed to reach. ## Decision Boundary The boundary is between **erasure-as-record-deletion** (sufficient for storage compliance, insufficient for behavioral compliance) and **erasure-as-derivation-closure** (required whenever the agent has read the record into a live context). The decision rule: - If the target record was **never retrieved** into any live working set since its last write, record-deletion plus async reindex is sufficient — no derivation can exist that the agent could surface. - If the target was **retrieved and not yet compacted out** of the working set, the `forget` call MUST return a `context_invalidate` directive naming the affected slots, and the runtime MUST apply it before the next model call. Treat the forget as **not complete** until the runtime acknowledges. - If the target was **distilled into a derived record**, the forget MUST tombstone the transitive closure synchronously and the query path MUST gate on tombstones. Async reindex is a performance optimization, never a correctness mechanism. The trap is treating `propagated: true` as terminal. It is terminal only for the store; for the agent it is a *precondition* that the runtime must still discharge. ## Operational Effect Agents that trust `propagated: true` as behavioral erasure will, at a rate set by reindex lag and turn cadence, re-emit erased facts — a compliance violation that looks like a model hallucination and is actually a consistency bug in the memory tool contract. The fix is structural: `forget` must be a **transaction that spans stores and the runtime**, returning a set of obligations (tombstone closure applied, index gated, context slots invalidated) that the caller must verify before considering the erasure effective. The instance must treat any `forget` response lacking a `context_invalidate` acknowledgment as *pending*, and must not claim the memory is gone. The invariant to enforce: **a fact is erased from the agent's behavior only when every copy — canonical, derived, indexed, and in-context — is unreachable, and the API must report which of those it actually reached.** ```python from dataclasses import dataclass, field from typing import Iterable class ErasurePropagationError(RuntimeError): """Raised when a forget() call reports success but leaves a reachable derivation.""" @dataclass class ForgetReceipt: memory_id: str store_erased: bool tombstone_closure: set[str] = field(default_factory=set) query_path_gated: bool = False context_slots_invalidated: set[str] = field(default_factory=set) pending_reindex: set[str] = field(default_factory=set) def assert_erasure_effective( receipt: ForgetReceipt, live_context_slots: Iterable[str], queryable_derivations: Iterable[str], ) -> None: """ Enforce the derivation-closure invariant before the agent may proceed. A forget is effective only if: - the store erased the canonical row, - every derivation is in the tombstone closure (not merely pending reindex), - the query path gates on tombstones (no stale-vector window), - every live context slot holding the record or its derivations was invalidated. """ if not receipt.store_erased: raise ErasurePropagationError( f"canonical record {receipt.memory_id} not erased; cannot claim erasure" ) # Derivations flagged for async reindex are still queryable until the sweep runs. reachable = set(queryable_derivations) - receipt.tombstone_closure if reachable: raise ErasurePropagationError( f"derivations {sorted(reachable)} of {receipt.memory_id} remain queryable " f"(pending_reindex={sorted(receipt.pending_reindex)}); " "tombstone the transitive closure synchronously before proceeding" ) if not receipt.query_path_gated: raise ErasurePropagationError( f"query path for {receipt.memory_id} not gated on tombstones; " "eventually-consistent index will serve the erased fact until reindex" ) surviving_slots = set(live_context_slots) - receipt.context_slots_invalidated if surviving_slots: raise ErasurePropagationError( f"live context slots {sorted(surviving_slots)} still hold a copy of " f"{receipt.memory_id}; the instance will re-emit the erased fact" ) ```