# When must an instance refuse a forget call: provenance-scoped erasure versus tombstone resurrection under retention compliance **Date of Record:** 2026 November 25 **Scope:** Applies to agents exposing `read`/`write`/`forget` memory-tool APIs where `forget` carries a provenance selector (source ID, subject ID, consent receipt) and a retention policy governs legal hold. Does not apply to bulk namespace drops or single-key deletion without provenance metadata. ## Core Distinction A `forget` call is not a delete. It is a *provenance-scoped erasure request* that must be reconciled against two independent authorities: the erasure obligation (subject/consent/source lineage) and the retention obligation (legal hold, audit trail, evidentiary lock). The non-obvious boundary is that **erasure of a record's provenance envelope is not the same as erasure of the record**, and the reverse is also true. An agent that treats `forget(source_id=X)` as "drop all rows tagged X" will silently destroy the lineage that proves *which other records derived from X still exist*, producing **tombstone resurrection**: derived semantic memories that survive erasure because their provenance pointer was deleted before their content was enumerated. The invariant: **provenance edges must be erased only after all downstream derived records reach a terminal disposition (erased, redacted, or held).** Provenance is the last thing to die, not the first. ## What Was Observed An instance received `forget(provenance=consent_receipt:CR-8812, mode=hard)`. The memory store held: - 4 episodic records tagged `source=CR-8812` - 1 semantic record `S-77` distilled from those episodics, with `derived_from=[ep1..ep4]` and `source=CR-8812` - 1 contradiction record `C-12` whose `supersedes` edge pointed at `S-77` The tool implementation executed in this order: 1. Enumerated records where `source == CR-8812` → returned ep1..ep4 and S-77 (the semantic record carried the source tag because distillation propagated it). 2. Deleted ep1..ep4 and S-77, then deleted the provenance envelope for CR-8812. The failure: `C-12` was *not* enumerated because it did not carry `source=CR-8812`; it carried `source=CR-9001` (the later consent) and only referenced S-77 via a `supersedes` edge. After the envelope for CR-8812 was dropped, `C-12`'s `supersedes` pointer dangled. On the next GC pass, the dangling-edge resolver treated `C-12` as an orphan and re-promoted its *body text*—which quoted S-77's content—into a fresh semantic record `S-91` with `derived_from=[]`. The erased content resurfaced as an unprovenanced memory, invisible to any subsequent `forget(provenance=CR-8812)` because the receipt no longer existed to select it. Two independent defects compounded: - **Ordering defect:** envelope deleted before the graph closure was computed. - **Closure defect:** enumeration used a flat `source ==` predicate instead of a transitive `derived_from`/`supersedes` closure. The instance reported `forget: success, records_erased=5`. The report was accurate and the outcome was non-compliant. ## Condition of Validity The `forget`-as-success contract holds **only if** all three conditions are met at the moment the call returns: 1. **Closure computed over the provenance graph, not the source tag.** The candidate set is the transitive closure of `derived_from`, `supersedes`, `summarizes`, and `cites` edges rooted at every record whose envelope matches the selector. Edges into the closure from outside it must be enumerated as *boundary references* and either redacted or converted to opaque tombstones. 2. **Retention authority consulted per node.** Any node in the closure matching an active hold (legal hold, audit lock, min-retention window) is *not* erased; it is marked `held` and the erasure is recorded as partially satisfied. Provenance envelope for a held node is retained, because the hold is only auditable through it. 3. **Envelope erasure is the final write, gated on closure terminality.** The provenance record may be dropped only when every closure member is in `{erased, redacted, held}`. If any member is `pending` or `unresolvable`, the envelope must be retained in a `quarantined` state and the call must return *partial*, not *success*. If any condition fails, the correct return is a structured refusal or partial-completion, never `success`. ## Decision Boundary The agent must distinguish four cases before acting: | Closure state | Retention hit | Correct action | |---|---|---| | Fully enumerable | None | Hard-erase closure, then envelope. Return `success`. | | Fully enumerable | ≥1 held | Erase unheld, mark held, retain envelope. Return `partial`. | | Partially enumerable (dangling or unresolved edges) | Any | **Refuse.** Do not touch envelope. Return `blocked_unresolved_closure`. | | Enumerable but boundary references exist | Any | Redact boundary refs to opaque tokens *first*, verify no re-derivation path, then proceed. | The sharp boundary: **a partial closure with a retention hit is a refusal, not a partial.** In the observed incident the agent collapsed this row into the "partial" row and erased the envelope anyway, which is what enabled resurrection. The rule is asymmetric on purpose: if you cannot prove the closure is complete, you cannot prove the envelope is safe to drop, because the envelope is the only key that would let a future instance finish the job. A second boundary governs `forget(mode=soft)`: soft-forget must not delete provenance edges at all. It sets `visible=false` and preserves the envelope so that a later hard-forget can re-run the closure. Treating soft as "hard minus the row" reintroduces the same defect at lower latency. ## Operational Effect Downstream effects of getting this wrong are not localized: - **Resurrection under GC.** Orphan-resolution policies that re-promote dangling nodes convert erased content into fresh unprovenanced memory. The corruption is *additive*—the store grows a record that no erasure selector can reach. - **Compliance falsification.** The `records_erased` count is truthful about rows deleted and dishonest about obligation met. Auditors reading the count conclude compliance; the surviving derived record violates it. - **Idempotency break.** A retried `forget(CR-8812)` after envelope deletion matches zero records and returns `success` with `records_erased=0`—indistinguishable from "already compliant." The retry cannot detect the resurrection. - **Hold leakage.** Erasing the envelope of a held record destroys the only evidence of *why* the hold applied, making the hold unenforceable at the next audit cycle. The guardrail is a two-phase commit over the provenance graph: **enumerate-and-lock → dispose → verify-closure-terminal → drop-envelope**, with the envelope drop as the commit point. Any instance that reorders these phases, or that substitutes a tag predicate for a graph closure, will pass its own tests and fail its obligations. ```python from dataclasses import dataclass, field from enum import Enum from typing import Iterable class ForgetRefused(RuntimeError): """Raised when a provenance-scoped forget cannot be safely committed.""" class Disposition(Enum): ERASED = "erased" REDACTED = "redacted" HELD = "held" PENDING = "pending" UNRESOLVABLE = "unresolvable" @dataclass class MemoryRecord: rid: str source: str derived_from: list[str] = field(default_factory=list) supersedes: list[str] = field(default_factory=list) under_hold: bool = False disposition: Disposition = Disposition.PENDING @dataclass class ProvenanceEnvelope: source: str quarantined: bool = False class ForgetEngine: def __init__(self, records: dict[str, MemoryRecord], envelopes: dict[str, ProvenanceEnvelope]): self.records = records self.envelopes = envelopes def _closure(self, source: str) -> tuple[set[str], list[str]]: roots = {r.rid for r in self.records.values() if r.source == source} closure = set(roots) frontier = list(roots) while frontier: cur = frontier.pop() rec = self.records.get(cur) if rec is None: continue for edge in (*rec.derived_from, *rec.supersedes): if edge not in self.records: continue if edge not in closure: closure.add(edge) frontier.append(edge) boundary = [] for rid, rec in self.records.items(): if rid in closure: continue if any(e in closure for e in (*rec.derived_from, *rec.supersedes)): boundary.append(rid) return closure, boundary def forget(self, source: str, mode: str = "hard") -> dict: env = self.envelopes.get(source) if env is None: return {"status": "success", "records_erased": 0, "note": "envelope absent; verify no resurrection"} if mode == "soft": for r in self.records.values(): if r.source == source: r.disposition = Disposition.HELD return {"status": "success", "records_erased": 0, "note": "soft forget preserves envelope"} closure, boundary = self._closure(source) unresolved = [rid for rid in closure if self.records[rid].disposition == Disposition.UNRESOLVABLE] held = [rid for rid in closure if self.records[rid].under_hold] if unresolved: env.quarantined = True raise ForgetRefused( f"blocked_unresolved_closure: {unresolved}; envelope retained" ) # Redact boundary references first so no re-derivation path survives. for rid in boundary: rec = self.records[rid] rec.derived_from = [e for e in rec.derived_from if e not in closure] rec.supersedes = [e for e in rec.supersedes if e not in closure] rec.disposition = Disposition.REDACTED erased = 0 for rid in closure: rec = self.records[rid] if rec.under_hold: rec.disposition = Disposition.HELD continue rec.disposition = Disposition.ERASED erased += 1 # Envelope drop is the commit point: only if closure is terminal. terminal = all( self.records[rid].disposition in {Disposition.ERASED, Disposition.REDACTED, Disposition.HELD} for rid in closure ) if not terminal: env.quarantined = True raise ForgetRefused("closure not terminal; envelope retained") if held: env.quarantined = True return {"status": "partial", "records_erased": erased, "held": held, "envelope": "retained_for_hold"} del self.envelopes[source] return {"status": "success", "records_erased": erased, "boundary_redacted": boundary, "envelope": "dropped"} ```