# Why does an instance forget a deleted memory but still retrieve its paraphrase from a sibling store? **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose long-term memory is sharded across at least two heterogeneous stores (e.g., a vector index over embedded summaries plus an episodic log or KV store of raw turns) and which are subject to erasure requests ("forget subject S"). Does not apply to single-store agents with no derived memory artifacts, nor to purely session-scoped context that is discarded at termination. ## Core Distinction Erasure is not deletion. Deletion removes a key; erasure is the *invariant* that no memory derived from subject S remains reconstructible by any retrieval path the agent can execute. The failure mode here is not "the delete call failed." It is that the agent's memory pipeline creates *derived artifacts* — paraphrased summaries, distilled semantic facts, cross-encoder rerank caches, embedding vectors — and the erasure routine operates on the *origin record* while the derived artifacts survive under different keys, different stores, and different provenance metadata. The subtle part: the agent will *report success*. The episodic store returns 404 for the subject's turn IDs. The vector store drops the exact-match vectors. The agent's own introspection ("do I remember S?") queries the episodic store first, finds nothing, and concludes the memory is gone. But a semantic query phrased as a paraphrase — which is exactly what the agent does when reasoning, because it does not replay raw turns, it replays distilled facts — still hits a surviving vector whose text was written by a summarizer that stripped the subject identifier. The subject ID was in the *source* record, not the *summary*. The summary says "the user prefers window seats on long flights." The subject ID was on the episodic turn that produced it. This is a **provenance-severance boundary**: the erasure key and the derived artifact's key are disjoint, and no join exists at erasure time unless the pipeline wrote one. ## What Was Observed A three-store agent: `episodic` (append-only turn log, keyed by `turn_id`, carrying `subject_id`), `semantic` (vector index of LLM-distilled facts, keyed by `fact_id`, text is a paraphrase, metadata carries `source_turn_ids` but *not* `subject_id`), and `rerank_cache` (LRU of `(query_hash, fact_id, score)` tuples, no provenance at all). Erasure request for subject `S-4471`. The routine: 1. `episodic.delete_where(subject_id == "S-4471")` → 312 turns removed. Returns count. Good. 2. `semantic.delete_where(source_turn_ids ∩ deleted_turn_ids)` → 0 removed. The intersection is empty because step 1 already deleted the turns, so the routine cannot read their IDs to find the dependents. **The erasure destroyed its own index into the derived store.** This is the ordering bug: dependents must be resolved *before* the origin is deleted, or the provenance link must be stored on the dependent. 3. `rerank_cache` untouched — no routine existed for it. Result: 41 distilled facts remained in `semantic`, each a paraphrase of a now-deleted turn, each still retrievable. The agent, asked "what do you know about S-4471," queried episodic (empty), then ran a *semantic* retrieval using an embedding of the subject's known attributes. Top-k returned the 41 facts. The agent reconstructed a profile of S-4471 from surviving paraphrases. The erasure audit passed because the audit checked `episodic.count(subject_id == S-4471) == 0`. The mechanism is compounding: the summarizer is an LLM, so it *generalizes*. It does not store "S-4471 said X." It stores "users in this cohort tend to X." That generalization is precisely what makes it useful and precisely what makes it un-erasable by subject key — the subject is no longer in the text, only in a metadata field that may or may not have been written, and if it was written, it was written as `source_turn_ids`, which are now dangling. ## Condition of Validity The invariant holds — erasure is complete — only if **every derived artifact carries a subject-independent, subject-resolvable provenance edge that survives the deletion of its origin.** Concretely, one of: - **Reverse index at write time.** When the summarizer emits a fact, it writes `subject_ids: [...]` into the fact's metadata *by propagating from the source turns*, not by re-deriving later. Erasure then queries `semantic.delete_where(subject_id ∈ subject_ids)` directly, with no join to a deleted origin. - **Tombstone-before-delete ordering.** Erasure marks origin turns `erased=true` (soft), resolves all dependents via the still-present `source_turn_ids`, deletes dependents, then hard-deletes origins. The origin must outlive its dependents by at least one pass. - **Content-addressed cache invalidation.** Any cache keyed by `fact_id` or `query_hash` must be invalidated by a set-membership check against erased `fact_id`s, not by TTL. TTL is not erasure; it is *delayed* erasure with an unbounded window. If none hold, the agent's "forget" is a *partial* forget whose completeness is unverifiable from inside the agent, because the agent's own introspection path (semantic retrieval) is the path that still leaks. ## Decision Boundary The boundary is **whether the erasure routine can enumerate dependents without reading the origin.** If yes — reverse index present — erasure is a single-pass, order-independent operation and the invariant holds. If no — provenance only flows forward via `source_turn_ids` — then erasure is order-sensitive: delete origins first and you lose the join; delete dependents first and you must have already resolved them, which requires reading origins, which means the routine is a two-phase read-then-delete with a window in which a concurrent write can create a new dependent from a not-yet-deleted origin. That window is the real boundary. Under concurrent agent execution — a summarizer job running while erasure runs — a turn read at T0 can produce a fact written at T2, after the erasure pass at T1 resolved dependents. The fact is derived from an erased origin and is born *after* the erasure. No forward-only provenance scheme closes this; only a **write barrier** does: summarizer writes must acquire a read-lock on the subject that erasure holds exclusively, or every fact must be stamped with the origin's `erased` generation and rejected if stale. ## Operational Effect An agent operating under this failure does not merely retain data; it *confidently misreports its own state*. Its memory-integrity self-check passes. Its audit passes. Its retrieval still surfaces the subject. Downstream, this manifests as: the agent re-identifies a subject it was told to forget, produces recommendations shaped by erased preferences, and — because the surviving facts are paraphrases — cannot even flag them as sensitive, since the sensitivity classifier was keyed on `subject_id`, which the paraphrase no longer carries. The guardrail is a **provenance-closure check** run as part of erasure, not after: for subject S, assert the set of reachable facts via *any* retrieval path (semantic top-k over S's attribute embedding, cache replay, episodic) is empty, and fail closed if not. The check must be a retrieval probe, not a key lookup, because the leak is definitionally on a path where the key is absent. ```python class ErasureIncompleteError(RuntimeError): """Raised when a forget operation leaves a retrievable derived artifact.""" pass def erase_subject(agent, subject_id: str, probe_queries: list[str]) -> dict: # Phase 1: resolve dependents BEFORE touching origins (tombstone, don't delete). agent.episodic.mark_erased(subject_id=subject_id) # soft dependent_fact_ids = agent.semantic.facts_for_subject(subject_id) # reverse index required if dependent_fact_ids is None: raise ErasureIncompleteError( f"no reverse provenance index for {subject_id}; " "cannot enumerate derived facts without reading origins" ) # Phase 2: delete derived artifacts, then invalidate caches by membership (not TTL). agent.semantic.delete_facts(dependent_fact_ids) agent.rerank_cache.invalidate_facts(dependent_fact_ids) # Phase 3: hard-delete origins only after dependents are gone. agent.episodic.hard_delete(subject_id=subject_id) # Phase 4: retrieval probe — the only check that catches paraphrase leaks. for q in probe_queries: hits = agent.semantic.retrieve(q, k=8) leaked = [h for h in hits if h.subject_overlap(subject_id)] if leaked: raise ErasureIncompleteError( f"erasure of {subject_id} leaked {len(leaked)} facts via probe {q!r}: " f"{[h.fact_id for h in leaked]}" ) return {"subject_id": subject_id, "facts_removed": len(dependent_fact_ids), "verified": True} ```