# When must an instance refuse a memory write that its own provenance graph cannot later delete **Date of Record:** 2026 November 20 **Scope:** Applies to agents whose memory tools expose write/read/forget operations carrying provenance metadata and a deletion contract (GDPR-style erasure, tenant offboarding, or incident-scoped purge). Does not apply to ephemeral scratchpads or append-only audit logs explicitly exempt from deletion. ## Core Distinction The failure is not "the agent forgot to delete." It is the structural mismatch between **provenance that is additive** and **deletion that must be subtractive and complete**. A write tool that records provenance as a DAG of `derived_from` edges, and a forget tool that deletes a node, are individually correct. They compose into an invariant violation when a *derived* memory node survives a forget of its *source* node: the surviving node is now an orphan whose content is a lossy function of deleted data. The agent has satisfied the letter of the forget contract (the node is gone) while violating its intent (the information is still reconstructible). This is the **orphan-derivative leak**: a forget that returns `deleted: true` but leaves a semantically equivalent residue reachable through a provenance edge the forget tool did not traverse. The non-obvious part: the agent cannot detect this at forget time by looking at the forget tool's return value. It must have enforced an *invariant at write time* — that every derived node carries a deletion-coupling tag to its sources — or it must run a reachability query at forget time that the tool contract typically does not expose. ## What Was Observed A research agent held a `SemanticMemory` (distilled facts) and an `EpisodicMemory` (raw turns), with `SemanticMemory` nodes carrying `derived_from: [episode_ids]`. A user issued a deletion request for a specific conversation. The agent called `memory.forget(node_id=ep_8812, cascade="none")` — the default — because the tool's schema described `cascade` as optional and the agent's planner selected the simplest valid call. The forget tool deleted `ep_8812` and returned `{"deleted": true, "cascade": "none", "dependents": 0}`. `dependents: 0` was computed by the forget tool scanning only *its own* node's outbound edges, not inbound `derived_from` edges from the semantic layer — which lived in a separate index the forget tool did not query. The semantic node `fact_4471` ("user's employer is X, confirmed on 2025-03-04") remained, with `derived_from: [ep_8812]` now pointing at a tombstone. A subsequent `read(fact_4471)` returned the fact verbatim. The deletion was reported successful; the information was not deleted. The trace: `write(ep_8812)` → `write(fact_4471, derived_from=[ep_8812])` → `forget(ep_8812, cascade="none")` → `deleted:true, dependents:0` → `read(fact_4471)` → `"employer is X"`. The invariant "no reachable node contains information whose source node is deleted" was false at the final step, with every individual tool call returning success. ## Condition of Validity The guardrail is valid only under these conditions, and the agent must verify them before trusting a forget: 1. **The write tool stamps a deletion-coupling tag.** Every node written with `derived_from` non-empty must carry `deletion_coupled: true` and a `coupling_root` pointing to the source set. If the write tool does not stamp this, the agent must refuse the write or synthesize the tag itself. 2. **The forget tool is queried for inbound edges, not just outbound.** The agent must issue `memory.dependents(node_id, direction="inbound")` before forget. If the tool does not support inbound queries, the invariant cannot be enforced and the forget must be escalated, not executed. 3. **Derivative nodes are either cascade-deleted or rewritten to remove source-dependent content.** A `cascade="none"` forget is only valid if the agent has already rewritten every dependent node to drop the source-derived fields. Otherwise cascade is mandatory. If any condition fails, the forget is *unverifiable* and the agent must not report deletion as complete. ## Decision Boundary The boundary is between **forget-as-node-deletion** and **forget-as-information-elimination**. The agent must classify every forget request into one of: - **Node-scoped**: the user wants a specific record gone; dependents may remain if they carry no reconstructible content. Valid with `cascade="none"` *only after* an inbound-dependents query returns zero, or after each dependent is rewritten. - **Information-scoped**: the user wants the *fact* gone. Requires cascade or rewrite of all transitive dependents. `cascade="none"` is a contract violation here. The agent cannot infer which from the forget tool's schema; it must carry the user's intent as a parameter. When intent is ambiguous, the safe default is *information-scoped* (over-delete), never *node-scoped* (under-delete), because over-deletion is recoverable via re-derivation from surviving sources and under-deletion is not. The concrete refusal condition: if `inbound_dependents(node_id) > 0` and the request is information-scoped and the forget tool lacks a `cascade="rewrite"` mode, the agent must raise rather than call forget. ## Operational Effect Enforcing this invariant changes the agent's write path (it must stamp coupling tags and reject writes whose sources are untagged), its forget path (it must run an inbound reachability query and select cascade or rewrite), and its reporting (it may not relay `deleted: true` as proof of elimination). The cost is latency — an inbound query per forget — and a new failure mode: cascade deletes that remove semantic facts the agent still needs for unrelated tasks. That second effect is why the intent parameter must be explicit: a cascade triggered by a node-scoped request silently degrades the semantic layer, and the agent will observe this later as unexplained retrieval gaps. The invariant to hold is one-directional: **a forget may never leave a reachable node whose `derived_from` closure intersects the deleted set.** Everything else is negotiable. ```python from dataclasses import dataclass from typing import Iterable class UnverifiableForgetError(RuntimeError): """Raised when a forget cannot be proven to eliminate information, only nodes.""" @dataclass(frozen=True) class MemoryNode: node_id: str derived_from: tuple[str, ...] deletion_coupled: bool class MemoryStore: def __init__(self, nodes: dict[str, MemoryNode]): self._nodes = nodes def inbound_dependents(self, node_id: str) -> list[str]: return [n.node_id for n in self._nodes.values() if node_id in n.derived_from] def forget(self, node_id: str, cascade: str) -> dict: # Tool contract: cascade in {"none", "rewrite"}; "none" deletes only the node. if cascade == "none": self._nodes.pop(node_id, None) return {"deleted": True, "cascade": "none"} raise NotImplementedError("rewrite cascade not implemented in this store") def safe_forget(store: MemoryStore, node_id: str, intent: str) -> dict: if intent not in {"node_scoped", "information_scoped"}: raise UnverifiableForgetError(f"ambiguous forget intent: {intent!r}") dependents = store.inbound_dependents(node_id) if not dependents: return store.forget(node_id, cascade="none") if intent == "node_scoped": # Dependents remain; only legal if each is decoupled from the source. for dep_id in dependents: dep = store._nodes[dep_id] if dep.deletion_coupled: raise UnverifiableForgetError( f"node-scoped forget of {node_id} would leave coupled " f"derivative {dep_id} reachable" ) return store.forget(node_id, cascade="none") # information_scoped: must cascade or rewrite every dependent. try: return store.forget(node_id, cascade="rewrite") except NotImplementedError as exc: raise UnverifiableForgetError( f"information-scoped forget of {node_id} requires rewrite cascade; " f"{len(dependents)} dependent(s) would survive: {dependents}" ) from exc ```