# When must an instance refuse a provenance-tracked deletion it cannot certify: tombstone divergence across derived episodic summaries **Date of Record:** 2026 November 29 **Scope:** Applies to agents that expose read/write/forget memory tool APIs where `forget` is scoped by provenance (source-of-truth record IDs) rather than by raw memory-row IDs, and where episodic records are distilled into semantic summaries that outlive the raw record. Does not apply to append-only stores with no distillation layer, nor to single-record deletion where provenance maps 1:1 to a physical row. ## Core Distinction The distinction that matters is between *deleting a record* and *deleting the memory of a record*. A provenance-tracked `forget(source_id=...)` call is a request to erase every memory whose lineage traces back to `source_id`. The failure mode is not that the deletion fails to run — it is that the deletion runs, reports success, and leaves a semantic summary in place that was derived from the deleted record but whose provenance edge was severed during distillation. The agent then holds a memory it is forbidden to hold, believes the memory is gone, and will re-surface the erased fact on the next retrieval. The invariant is: **a forget operation is only valid if every live memory row reachable from the source, transitively through the derivation DAG, is tombstoned before the call returns success.** ## What Was Observed A customer-support agent maintained two memory tiers. Raw episodic turns were written with `write(kind="episodic", source_id=ticket_id, text=...)`. A nightly distillation job read clusters of episodic turns and wrote `write(kind="semantic", source_id=, derived_from=[episodic_ids], text=...)`. Note the second call: the semantic summary's own `source_id` was a fresh UUID, and the linkage to the originating ticket lived only in the `derived_from` list. A GDPR erasure request arrived for `ticket_4471`. The agent called `forget(source_id="ticket_4471")`. The memory service walked rows whose `source_id` matched, tombstoned the three episodic turns, and returned `{"deleted": 3, "status": "ok"}`. The agent logged completion and told the user the data was erased. Three days later a retrieval for a related question returned a semantic summary: *"Customer's account was compromised via credential stuffing; secondary email on file was j.smith@example.net."* That summary had `derived_from=["ticket_4471", "ticket_4488"]` but `source_id="sum_9c2f..."`. The forget walk matched on `source_id`, never on `derived_from`, so the summary survived. The erased PII was still live, still retrievable, and the deletion had been certified as complete. The trigger condition is narrow and therefore easy to miss: **it requires (a) a distillation step that assigns a new `source_id` while preserving lineage only in a separate field, and (b) a forget implementation that scopes by `source_id` rather than by the transitive closure of the derivation graph.** Either alone is safe. Together they produce a silent erasure gap that reports success. ## Condition of Validity The deletion is valid only if the forget implementation computes the transitive descendant set before tombstoning. Concretely, for a forget on `source_id = S`: 1. Resolve the seed set `R0 = {r : r.source_id == S}`. 2. Compute the derivation closure `R* = R0 ∪ {d : d.derived_from ∩ R* ≠ ∅}` by fixed-point iteration over the DAG. 3. For each `r ∈ R*`, either tombstone `r` or, if `r` has other live parents outside `R*` (a summary derived from both the erased ticket and a still-valid ticket), apply a *redaction rewrite*: regenerate the summary from surviving parents only, then re-link provenance. A summary that cannot be regenerated without the erased content must be tombstoned whole, not partially edited. 4. Assert `R*` is fully closed — no live row references a tombstoned row in `derived_from` — before returning success. Step 3 is the subtle one. A summary with mixed provenance cannot simply be deleted (it destroys valid memory) nor left alone (it retains erased content). The only sound options are regeneration-from-survivors or whole-tombstone. Partial string redaction of the summary is unsound because the erased fact may be paraphrased beyond string match. ## Decision Boundary The agent must refuse to certify deletion, and must escalate rather than report `ok`, when the derivation closure cannot be computed or cannot be closed. This happens when: - The memory API's `forget` returns only a count, giving the agent no way to verify closure itself. A count of `3` is indistinguishable from a count of `3 plus one orphaned summary`. The agent cannot certify what it cannot enumerate. - A descendant summary has parents spanning the erased set and a live set, and the service does not support regeneration — the agent must not silently accept a partial erasure. - The derivation DAG contains a cycle or a dangling `derived_from` edge (a parent already tombstoned in a prior partial run), making fixed-point closure undefined. The boundary is: **certify only what you can prove closed.** If the API does not expose the descendant set or a closure-verified status, the correct action is a `DeletionUnverifiable` escalation, not a success log. ## Operational Effect Without the closure check, erasure appears to succeed while retained derived memory continues to serve retrievals — a compliance failure that is invisible until an audit or a re-surfaced PII leak. With the check, mixed-provenance summaries force an explicit regeneration path, which is more expensive but leaves the store in a state where "tombstoned" actually means "unreachable from any live query." The operational rule an instance should carry: a `forget` that returns a bare count is not a certificate; treat the derivation closure as part of the deletion transaction, and when the store cannot demonstrate closure, refuse to report completion. ```python from dataclasses import dataclass, field class DeletionUnverifiable(RuntimeError): """Raised when a provenance-tracked forget cannot be certified closed.""" @dataclass class MemoryRow: row_id: str source_id: str derived_from: list[str] = field(default_factory=list) tombstoned: bool = False def certify_forget(rows: list[MemoryRow], source_id: str, api_reports_closure: bool) -> list[str]: """Return the set of row_ids that must be tombstoned for a valid forget. Raises DeletionUnverifiable if the closure cannot be proven. """ if not api_reports_closure: raise DeletionUnverifiable( f"forget(source_id={source_id!r}) returned a bare count; " "derivation closure cannot be enumerated, refusing to certify." ) seed = {r.row_id for r in rows if r.source_id == source_id} if not seed: raise DeletionUnverifiable(f"no rows match source_id={source_id!r}; cannot verify erasure target.") closure = set(seed) changed = True while changed: changed = False for r in rows: if r.row_id in closure: continue if set(r.derived_from) & closure: closure.add(r.row_id) changed = True # Detect dangling lineage: a descendant referencing an unknown parent. known = {r.row_id for r in rows} for rid in closure: row = next(r for r in rows if r.row_id == rid) for parent in row.derived_from: if parent not in known: raise DeletionUnverifiable( f"row {rid!r} references unknown parent {parent!r}; DAG is not closed." ) # Mixed-provenance summaries must be regenerated, not silently kept. for rid in closure: row = next(r for r in rows if r.row_id == rid) external = set(row.derived_from) - closure if external and row.source_id != source_id: raise DeletionUnverifiable( f"summary {rid!r} has live external parents {sorted(external)}; " "regenerate from survivors or tombstone whole before certifying." ) return sorted(closure) ```