# Where must an instance refuse to honor a `forget` call whose provenance closure is incomplete **Date of Record:** 2026 December 3 **Scope:** Applies to agent memory stores exposing `read`/`write`/`forget` tool schemas where `forget` carries deletion semantics and records carry provenance edges to derived memories. Does not apply to append-only logs without derived-state propagation, nor to single-record stores with no inter-memory references. ## Core Distinction A `forget(id)` call is not a delete; it is a *transitive closure operation over provenance edges*. The dangerous boundary is not "does the row exist" but "does the closure of records derived from this record terminate inside the store the caller can see." When an agent writes memory `A`, then writes `B` whose provenance cites `A`, then writes `C` citing `B`, a `forget(A)` that deletes only `A` leaves `B` and `C` as *orphaned derivations* — memories that assert content whose evidentiary basis no longer exists. The agent will later `read(C)`, treat it as grounded, and act on a claim with a severed provenance chain. The invariant that must hold: **no record may be readable if any ancestor in its provenance closure has been forgotten, unless the record was explicitly re-grounded (re-provenanced) at forget time.** Deletion is a graph rewrite, not a row drop. The non-obvious part: the failure is silent. `forget(A)` returns `success: true`. The store is internally consistent. Only a later `read` of a descendant exposes the inconsistency, and by then the agent has already reasoned over poisoned context. ## What Was Observed A support-triage agent store with three record types: `observation` (raw tool output), `inference` (LLM-derived claim, provenance → observations), and `policy` (durable rule, provenance → inferences). A PII-scrub job issued `forget(obs_4412)` after a customer requested erasure of a transcript fragment. Schema in force: ``` forget(id: str, cascade: bool = false) -> {deleted: [str], orphaned: [str]} ``` The scrub job called `forget("obs_4412")` with default `cascade=false`. The store deleted exactly one row. Response: `{deleted: ["obs_4412"], orphaned: []}` — the `orphaned` array was empty because the implementation only checked *direct* children, and `obs_4412`'s direct child `inf_9901` had already been superseded by `inf_9903` via a `supersedes` edge that the orphan-check did not traverse. So the closure walk stopped one hop short. Trace: 1. `obs_4412` → `inf_9901` (provenance). `inf_9901` marked `superseded_by: inf_9903`. 2. `inf_9903` → `policy_77` (provenance). `policy_77` is an active rule: "refunds over $500 require manager approval — grounded in transcript 4412." 3. `forget(obs_4412)` deletes `obs_4412`. Direct-child check sees `inf_9901`, which is superseded, and the implementation's orphan logic *skips superseded nodes* (a well-intentioned optimization to avoid flagging historical records). 4. `policy_77` remains `status: active`. Its provenance chain now terminates at a deleted record through a superseded intermediate. 5. Four hours later a different agent instance cold-starts, calls `read("policy_77")`, receives the rule with a provenance summary rendered as `grounded: 1 source (obs_4412)` — the renderer did not resolve whether the source still existed. 6. The instance applies `policy_77` to a refund decision, citing a transcript fragment that, per the erasure request, no longer exists and must not be surfaced. The erasure was *incomplete in effect* while *complete in the audit log*. The store reported success; the policy still leaked the erased fragment's content through a derived rule. ## Condition of Validity `forget` is only sound when the store can compute the **full provenance closure** — following `provenance`, `supersedes`, `derived_from`, and `merged_into` edges transitively — and when that closure is entirely within the caller's visibility scope. Two preconditions: - **Closure computability.** Every edge type that can carry evidentiary weight must be traversable by the forget routine. An optimization that skips any edge class (superseded, merged, archived) breaks the invariant, because a skipped node can still be an ancestor of a live record. - **Scope containment.** If a descendant lives in a namespace the caller cannot see (a shared policy store, another tenant's memory), the caller cannot delete it. The `forget` must then either fail, or return the descendant as `requires_regrounding` — never silently succeed. When either precondition fails, `forget` must not report success. The correct response is a structured refusal enumerating the external or skipped descendants, forcing the orchestrator to decide: cascade into the other namespace, or re-ground the descendant with a replacement provenance record before deletion. ## Decision Boundary The boundary between "safe to delete" and "must refuse" is: **does the closure of live (non-superseded, non-archived) records reachable from `id` via any evidentiary edge terminate entirely inside the deletable set?** - If yes → delete the whole closure atomically, return the full `deleted` list. - If the closure reaches a record outside the caller's scope → refuse with `ProvenanceClosureIncomplete`, listing escape paths. - If the closure reaches a record the caller *can* see but did not ask to cascade → require explicit `cascade=true`; do not default to orphan-and-succeed. - If the closure reaches a record that has been *re-grounded* (its provenance was rewritten to cite a surviving source) → the edge to the forgotten record is already severed; that branch terminates and does not block. The subtle case is the superseded intermediate. A superseded record is not dead — it is an *ancestor of its replacement*. The replacement's provenance must be treated as inheriting the superseded record's provenance. Skipping superseded nodes in the walk is the exact bug that produced the leak above. ## Operational Effect Enforcing closure-complete forget changes three behaviors the agent layer must accommodate: 1. **Forget becomes fallible and slow.** It can no longer be fire-and-forget. The orchestrator must handle `ProvenanceClosureIncomplete` and decide on re-grounding. Cold-start instances that assume `forget` succeeds unconditionally will proceed with stale, un-erased derivations in context. 2. **Read must validate provenance liveness at read time, not just at write time.** A `read` returning a record whose ancestry contains a tombstoned node must surface `stale_provenance: true` and the tombstone set, so the reasoning loop can downweight or refuse the record. This is the last line of defense when a forget was issued by a process that lacked closure visibility. 3. **Re-grounding is a first-class write.** When a descendant must survive an erasure, the store must accept a `reground(id, new_provenance)` that atomically swaps the ancestry and records the swap in the audit log — otherwise the descendant keeps a dangling edge and the next `read` flags it as stale forever. The invariant, stated once: *a readable record is grounded iff every ancestor in its transitive evidentiary closure is live and in-scope; `forget` must preserve this invariant or refuse.* ```python from dataclasses import dataclass, field from typing import Literal EdgeKind = Literal["provenance", "supersedes", "derived_from", "merged_into"] EVIDENTIARY = {"provenance", "derived_from", "merged_into"} class ProvenanceClosureIncomplete(RuntimeError): """Raised when forget() cannot delete the full evidentiary closure of a record.""" @dataclass class Record: id: str status: Literal["live", "superseded", "tombstoned"] = "live" superseded_by: str | None = None provenance: list[str] = field(default_factory=list) namespace: str = "default" class MemoryStore: def __init__(self) -> None: self.records: dict[str, Record] = {} def _closure(self, root: str) -> set[str]: """Transitive evidentiary closure. Superseded nodes are traversed, not skipped.""" seen: set[str] = set() stack = [root] while stack: rid = stack.pop() if rid in seen: continue seen.add(rid) rec = self.records.get(rid) if rec is None: continue if rec.superseded_by: stack.append(rec.superseded_by) for p in rec.provenance: stack.append(p) return seen def forget(self, rid: str, caller_namespace: str, cascade: bool = False) -> dict: if rid not in self.records: raise ProvenanceClosureIncomplete(f"unknown record {rid}") closure = self._closure(rid) out_of_scope = [ c for c in closure if c != rid and self.records.get(c) and self.records[c].status != "tombstoned" and self.records[c].namespace != caller_namespace ] if out_of_scope: raise ProvenanceClosureIncomplete( f"forget({rid}) escapes namespace {caller_namespace}: {out_of_scope}" ) live_descendants = [ c for c in closure if c != rid and self.records.get(c) and self.records[c].status == "live" ] if live_descendants and not cascade: raise ProvenanceClosureIncomplete( f"forget({rid}) would orphan live records {live_descendants}; " f"pass cascade=True or reground them first" ) deleted = [] for c in closure: if c in self.records: self.records[c].status = "tombstoned" deleted.append(c) return {"deleted": deleted, "orphaned": []} def reground(self, rid: str, new_provenance: list[str]) -> None: rec = self.records[rid] rec.provenance = new_provenance def read(self, rid: str) -> dict: rec = self.records[rid] if rec.status == "tombstoned": raise ProvenanceClosureIncomplete(f"read({rid}): record is tombstoned") stale = [ a for a in self._closure(rid) if self.records.get(a) and self.records[a].status == "tombstoned" ] return {"record": rid, "stale_provenance": bool(stale), "tombstones": stale} ```