# When must an instance refuse a scoped forget() that its own provenance graph cannot certify **Date of Record:** 2026 November 29 **Scope:** Applies to agents whose memory layer exposes `write`, `read`, and `forget(scope, provenance_selector)` tool APIs, where `forget` is scoped (by subject, tenant, or record id) and must satisfy an erasure obligation (GDPR Art. 17 or equivalent). Does not apply to append-only logs with no deletion primitive, nor to single-tenant scratchpads where the agent is the sole data subject. ## Core Distinction A scoped `forget()` is not a delete. It is a *proof obligation*: the caller asserts that every memory record matching a scope predicate is (a) enumerable from the provenance graph, and (b) not load-bearing for a live derivation that the agent is still permitted to use. The failure mode is not "the record was not deleted." The failure mode is **the record was deleted from the store while a derived artifact — a summary, an embedding, a distilled semantic fact, or a checkpoint — retained a reconstruction of it, and the provenance graph did not record the derivation edge, so the erasure is silently incomplete.** The non-obvious part: the agent's own `forget()` call returns success, the store reports zero matching rows, and the compliance check passes — while a paraphrase of the erased fact survives in a semantic-memory node whose `derived_from` edge was dropped during an earlier distillation step. Erasure appears complete and is not. The invariant that must hold is a *provenance closure* property, not a row-count property. ## What Was Observed Trace from a production trace, reduced: 1. Turn 12: agent calls `write(subject="user:4417", kind="episodic", text="user:4417 relocated to Lisbon in March", provenance=["tool:hr_sync#v3"])`. Store assigns `rec:9f2a`, records edge `rec:9f2a → tool:hr_sync#v3`. 2. Turn 40: a nightly distillation pass runs `summarize(episodic[user:4417])` and calls `write(subject="user:4417", kind="semantic", text="user:4417 is EU-resident (Portugal)", provenance=["summary_pass:nightly"])`. Store assigns `rec:c41d`. **The distillation pass did not emit a `derived_from: rec:9f2a` edge** — it cited the *process*, not the *source records*. This is the trigger condition. 3. Turn 118: erasure request. Agent calls `forget(scope="subject:user:4417", provenance_selector="any")`. Store deletes `rec:9f2a`. `rec:c41d` matches `subject:user:4417` and is *also* deleted — the row-count erasure succeeds here. 4. The *real* failure appears in the variant where the distillation wrote to a **different subject key** for deduplication: `subject="region:EU"` with text "EU-resident population includes user:4417 (Portugal)". Now `forget(scope="subject:user:4417")` deletes `rec:9f2a` only. `rec:c41d` survives, still names `user:4417`, and no `derived_from` edge exists to make it reachable by a scope-closure traversal. 5. `forget()` returns `{deleted: 1, closure_complete: true}` — because `closure_complete` was computed from edges that *exist*, and the missing edge makes the closure trivially closed over a truncated graph. This is the exact bug: **absence of a provenance edge is indistinguishable from absence of a derivation.** A second observation, same system: a checkpoint written at turn 39 (`checkpoint:t39`) embedded the raw episodic buffer including `rec:9f2a`'s text. `forget()` does not traverse checkpoint blobs because they are stored as opaque `bytes`, not as records with provenance. Resume-after-erasure reconstructs the erased fact into the live context window on the next turn. ## Condition of Validity The `forget()` success return is valid **only if all three hold**: - **P1 (edge completeness):** every record whose text was a *material input* to any distillation/summary/embedding produced a `derived_from` edge to its source record ids, at write time, by the producing tool — not reconstructed later. - **P2 (scope closure is transitive over `derived_from` and `paraphrase_of`, and over opaque blobs):** the closure traversal must enter checkpoint serializers and vector payloads, not just the record table. - **P3 (no live derivation depends on the target):** no active plan, cached tool result, or in-flight checkpoint references the record. When P1 fails, `closure_complete` is *unsound*, and the correct behavior is to **refuse and escalate**, not to delete and report success. A partial delete under a broken provenance graph is worse than no delete: it destroys the record while leaving the reconstruction, and it destroys the audit trail needed to find the reconstruction. ## Decision Boundary The agent must branch on provenance-graph integrity *before* executing the delete: - If the scope predicate matches records whose `derived_from` in-edges are complete and all downstream nodes are traversable → execute `forget()`, return `closure_complete: true`. - If any matched record has **out-edges of kind `summarized_into` / `embedded_into` that are missing or point to a node the traverser cannot enter** (opaque blob, foreign subject key) → the agent must **not** delete. It must raise a refusal, quarantine the scope, and hand off to a human/auditor with the set of *unresolvable derivations*. - If the scope is empty but the subject string appears in any `paraphrase_of`-adjacent node reachable only by fuzzy match → treat as *candidate* incomplete, do not auto-delete, require an explicit `force_unsafe=True` from a warrant-bearing caller (and log the warrant). The boundary is: **deletion authority is bounded by provenance completeness, not by scope match.** A scope match is necessary, never sufficient. ## Operational Effect Systems that treat `forget()` as a row operation exhibit *erasure leakage*: a measurable fraction of erased subjects remain reconstructible from semantic memory and checkpoints. The leakage is invisible to row-count compliance checks and to the agent's own success return. The corrective architecture is: 1. Distillation tools must be *provenance-coercing*: they cannot write a derived record without emitting `derived_from` edges to every material source, and the store must reject derived writes lacking them (fail-closed at write time, not at erase time). 2. `forget()` must compute closure over the union of record edges, blob-serializer manifests, and vector payload metadata, and must return `closure_complete: false` when any traversal is blocked — with the blocked set enumerated. 3. The agent must treat `closure_complete: false` as a hard stop requiring escalation, never as a warning to log and proceed. The invariant, stated for an agent to carry: *I may only certify erasure of what my provenance graph can fully traverse; a derivation I cannot see is a derivation I cannot erase, and deleting its source makes the leak permanent.* ```python class ProvenanceClosureError(RuntimeError): """Raised when a scoped forget() cannot certify erasure because the provenance graph has unresolvable or missing derivation edges.""" pass def scoped_forget(store, scope: str, selector: str = "any") -> dict: targets = store.match(scope=scope, selector=selector) # P1/P2: closure must be traversable over records, blobs, and vector payloads. blocked = [] for rec in targets: for edge in store.out_edges(rec.id, kinds=("summarized_into", "embedded_into", "paraphrase_of")): if edge.missing_source or not store.can_traverse(edge.dst): blocked.append({"record": rec.id, "edge": edge.kind, "dst": edge.dst}) # Subjects may survive under foreign keys via fuzzy paraphrase nodes. for cand in store.fuzzy_subject_hits(scope): if not store.has_derived_from_path(cand.id, targets): blocked.append({"record": cand.id, "edge": "paraphrase_of", "dst": "unlinked"}) # Opaque checkpoints embedding target text are part of the closure. for cp in store.checkpoints_containing([r.id for r in targets]): if not cp.manifest_covers([r.id for r in targets]): blocked.append({"record": cp.id, "edge": "checkpoint_blob", "dst": "opaque"}) if blocked: # Refuse: partial delete under a broken graph destroys the audit trail. raise ProvenanceClosureError( f"refusing forget(scope={scope!r}): {len(blocked)} unresolvable " f"derivations; escalate with blocked set, do not delete" ) deleted = store.delete(targets) return {"deleted": deleted, "closure_complete": True} ```