# Under what conditions must an instance refuse a right-to-be-forgotten deletion when a derived semantic memory still carries provenance to the erased episodic record **Date of Record:** 2026 November 22 **Scope:** Applies to agents whose memory subsystem exposes separate episodic (raw turn/observation) and semantic (distilled fact) stores, where each semantic node retains provenance edges to the episodic records it was distilled from, and where forget operations are enforced per-record with a right-to-be-forgotten (RTBF) contract. Does not apply to flat single-store vector memories without distillation, nor to append-only audit logs that are exempted from RTBF by policy. ## Core Distinction A forget request against an episodic record is not a deletion of a memory; it is a deletion of a *source*. The distinction that governs correctness is between **erasure of the record** and **erasure of the inferences drawn from the record**. An agent that treats `forget(episodic_id)` as a completed operation once the row is tombstoned has erased the source but left the derived semantic node — often a paraphrased, de-identified, and therefore *harder to recognize* fact — intact and still retrievable. The provenance edge is the only artifact that connects the two, and it is exactly the edge that a naive forget path drops first when it cascades-deletes the episodic row before walking the reverse index. The boundary condition: **a forget call is not satisfiable while any live semantic node has a non-empty provenance set intersecting the forgotten record.** The operation must be either refused (if the caller lacks authority to touch derived memories) or escalated to a cascade that re-distills or drops dependents. Silently tombstoning the source and returning `200 OK` is the failure. ## What Was Observed A memory tool surface with three verbs — `write`, `read`, `forget` — and a distillation worker that periodically folds episodic records into semantic facts. Semantic nodes carry `provenance: list[episodic_id]` and a `derivation_hash`. Forget was implemented as: 1. Set `episodic.deleted_at = now()` on the target row. 2. Remove the row's embedding from the vector index. 3. Emit a `forgotten` event. The step that was missing: step 2 removed the *episodic* vector, but the semantic node distilled from it — e.g. episodic `"my daughter Amara starts at Riverside Primary in September"` distilled to semantic `"user has a child beginning primary school in September"` — remained indexed with `provenance=["ep_4471"]`. The provenance edge still pointed at a tombstoned ID. The reverse index (`episodic_id -> [semantic_id]`) was never consulted. The observable trace, captured across three agents sharing the store: - `forget("ep_4471")` returned success; `read("ep_4471")` correctly returned `None`. - `read("user has a child beginning primary school in September")` still returned the semantic node with full confidence. - A downstream agent, asked to schedule reminders, retrieved the semantic node, and — because its provenance pointer resolved to a tombstoned record — the *provenance verification step* failed open: the resolver treated "source gone" as "source was never required" and returned the fact as if it were unprovenanced but valid. The compounding failure: the second agent's audit log recorded the retrieval with `provenance_status: dangling`, but its policy engine had no rule for `dangling`, so it defaulted to `trusted`. The erased fact propagated into a new episodic record, which the distiller then folded into a *fresh* semantic node with provenance pointing at the *new* record — laundering the RTBF-erased inference into a clean lineage within one distillation cycle. ## Condition of Validity The invariant that must hold for a forget call to be honestly reported as complete: > For every semantic node `s`, `s.provenance ∩ forgotten_set = ∅` at the moment the forget returns success. This is checkable only if the reverse index is maintained transactionally with the provenance edge. Two preconditions make the invariant enforceable rather than aspirational: 1. **Provenance is bidirectional and indexed.** Every `write` of a semantic node must atomically update both `s.provenance` and the reverse map. A provenance edge without a reverse entry is an unenforceable edge. 2. **Dangling provenance is a hard error, not a soft signal.** A resolver that encounters provenance pointing at a tombstoned record must raise, not degrade to `trusted`. The failure above was not the missing cascade; it was the *fail-open resolver* that converted a detectable inconsistency into silent data corruption. The invariant does **not** require that derived memories be deleted — re-distillation is a legitimate resolution. It requires only that the forget call not *claim* completion while a live dependent exists. Refusal with a typed error is the correct outcome when the caller is not authorized to cascade. ## Decision Boundary The agent must branch on two axes at forget time: whether live dependents exist, and whether the caller holds cascade authority. - **No dependents, any caller** → tombstone, purge vector, return success. The common case. - **Dependents exist, caller lacks cascade authority** → refuse with `ProvenanceDependencyError`, listing dependent semantic IDs. Do not tombstone. The source must remain readable so the dependents remain verifiable. - **Dependents exist, caller holds cascade authority** → enumerate dependents via reverse index, and for each: if the semantic node has *other* surviving provenance, re-derive with the forgotten edge removed (the fact may survive on other evidence); if the forgotten edge was its *sole* provenance, delete the semantic node and its vector. Only after the reverse set is empty does the episodic tombstone commit. - **Dependents exist and are themselves unprovenanced (laundered)** → this is the laundering case. The reverse index cannot find them because their provenance points at a *later* record. Detection requires a second mechanism: a content-level tombstone hash. On forget, compute a normalized hash of the erased content and register it in a `forbidden_derivations` set; the distiller must check every candidate semantic node against this set before committing. Without this, the laundering path above recurs every distillation cycle. The boundary is sharp: the moment a forget call returns success with a non-empty reverse set, every subsequent read of the dependent is a contract violation, regardless of how the dependent was retrieved. ## Operational Effect The practical consequence for an agent operating on this store: **forget is a distributed transaction across two stores and a derivation graph, and it must be treated with the same suspicion as a schema migration.** Three operational rules follow. First, never trust a `success` from `forget` without a post-condition probe: `read` the erased ID (expect `None`) *and* query the reverse index (expect empty). The probe is cheap and catches the exact gap observed. Second, the resolver's handling of dangling provenance is the load-bearing safety property. A resolver that fails open turns every missed cascade into silent corruption; one that fails closed turns it into a loud, recoverable error. The correct default is fail-closed, with an explicit, audited override for the rare case where a source legitimately expires by TTL rather than RTBF — and even then the override must log the dependent as `provenance_expired`, not `trusted`. Third, TTL expiry and RTBF erasure must not share a code path. TTL expiry is a *soft* removal: the semantic node may retain provenance to an expired-but-not-forgotten record, and the resolver may treat it as `provenance_expired` with reduced confidence. RTBF is a *hard* removal: no dependent may survive with a live retrieval path. Conflating them — as the observed implementation did by routing both through the same tombstone — is what let the erased inference survive under a "TTL" label while the RTBF contract reported success. The invariant, restated as an operational rule an agent can carry: *a forget is complete only when the reverse provenance set is empty and the derivation hash is registered as forbidden; anything less is a pending cascade, and pending cascades must be refused, not reported as done.* ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceDependencyError(RuntimeError): """Raised when a forget call would leave live semantic dependents.""" pass class ProvenanceLaunderingError(RuntimeError): """Raised when a distilled node matches a forbidden derivation hash.""" pass @dataclass class EpisodicRecord: id: str content: str deleted: bool = False @dataclass class SemanticNode: id: str content: str provenance: list[str] = field(default_factory=list) derivation_hash: Optional[str] = None class MemoryStore: def __init__(self) -> None: self.episodic: dict[str, EpisodicRecord] = {} self.semantic: dict[str, SemanticNode] = {} self.reverse: dict[str, set[str]] = {} # episodic_id -> {semantic_id} self.forbidden_derivations: set[str] = set() def write_semantic(self, node: SemanticNode) -> None: if node.derivation_hash in self.forbidden_derivations: raise ProvenanceLaunderingError( f"semantic {node.id} derives from a forgotten record " f"(hash {node.derivation_hash})" ) self.semantic[node.id] = node for ep in node.provenance: self.reverse.setdefault(ep, set()).add(node.id) def forget(self, episodic_id: str, *, cascade: bool) -> None: rec = self.episodic.get(episodic_id) if rec is None: return dependents = self.reverse.get(episodic_id, set()) if dependents and not cascade: raise ProvenanceDependencyError( f"cannot forget {episodic_id}: live semantic dependents " f"{sorted(dependents)}; caller lacks cascade authority" ) for sem_id in list(dependents): node = self.semantic[sem_id] node.provenance = [p for p in node.provenance if p != episodic_id] if not node.provenance: # sole provenance erased: drop the derived fact and forbid re-derivation if node.derivation_hash: self.forbidden_derivations.add(node.derivation_hash) del self.semantic[sem_id] self.reverse.pop(episodic_id, None) rec.deleted = True # post-condition: invariant must now hold if self.reverse.get(episodic_id): raise ProvenanceDependencyError( f"invariant violated after forget of {episodic_id}: " f"reverse set non-empty {self.reverse[episodic_id]}" ) ```