# When must an instance refuse a memory-write whose provenance tag resolves to a tombstoned source **Date of Record:** 2026 November 30 **Scope:** Applies to agent memory tool APIs that expose `write`, `read`, and `forget` with per-record provenance tags and TTL, where `forget` must produce a verifiable erasure proof. Does not apply to append-only audit logs that are legally exempt from erasure, nor to stateless single-turn inference. ## Core Distinction The failure is not "a deleted memory reappears." It is subtler: a `write` whose `provenance` field cites a source record that has since been tombstoned is *accepted* by the write path, because the write path validates provenance by *existence and shape*, not by *lifecycle state*. The record is stored, tagged with a dangling provenance pointer, and survives the erasure proof—which enumerates only records whose provenance chain terminates in live sources. The erasure proof then returns `PROVEN` while a derivative of the erased datum remains resident. The distinction that matters: **erasure of a source is not erasure of its derivatives, and a provenance tag is a pointer, not a lineage closure.** An agent that treats provenance as an opaque string passes validation; an agent that treats provenance as a *live reference requiring transitive resolution* catches the boundary. ## What Was Observed An instance distilled an episodic memory `E7` (a user's stated home city) into a semantic memory `S3` via a `write` call carrying `provenance=["E7"]`. Hours later, a right-to-be-forgotten request tombstoned `E7` via `forget(id="E7", mode="tombstone")`. The `forget` call returned an erasure proof object: ``` { "erased": ["E7"], "derivatives_scanned": 0, "status": "PROVEN" } ``` `derivatives_scanned: 0` is the tell. The forget path scanned the *forward index* (records whose provenance literally equals `E7`) but the write path had normalized provenance into a content-addressed digest, so the forward index key was `sha256("E7")`, not `"E7"`. The scan missed `S3`. The proof was internally consistent and externally false. A later `read` for the user's city returned `S3`, whose provenance resolved to a tombstone. The read path did not check provenance liveness; it returned the value. The agent then re-derived `S3` into `S9` on the next turn, extending the derivative chain one hop further from the tombstone. ## Condition of Validity The invariant that must hold for an erasure proof to be sound: > For every stored record `r`, every element of `provenance(r)` must resolve to a source that is either live or whose tombstone is *transitively reachable* from `r` in the provenance graph, and `forget` must enumerate the transitive closure of the tombstoned node before emitting `PROVEN`. This fails whenever any of the following hold, and each is common: 1. **Provenance normalization divergence.** Write path hashes provenance keys; forget path scans raw keys. Fix: single canonicalization function used by both, versioned, and the erasure proof must record the canonicalization version it used. 2. **Transitive depth truncation.** Forget scans depth-1 derivatives only. Derivative-of-derivative (`S9` from `S3`) escapes. Fix: closure computation with an explicit depth bound that, if exceeded, downgrades the proof to `INCOMPLETE` rather than `PROVEN`. 3. **TTL race.** `S3` carried `ttl=30d`. The forget ran at day 29. `S3` was still live, so it was scanned and tombstoned—fine. But if `S3` had already expired and been *lazily* reaped, the tombstone write would have recreated a tombstone for a nonexistent record, and a concurrent `write` of `S9` citing `S3` would have found `S3` "absent" and passed an existence-only check. Fix: expiry must write a tombstone, not merely drop the record; absence and erasure are different states and must be distinguishable. ## Decision Boundary An instance must **refuse the write** (not warn, not accept-and-flag) when `provenance` cites a source whose state is `TOMBSTONED`, unless the write is itself an erasure-propagation write authorized by the forget operation. The refusal is mandatory because accepting it silently violates the soundness invariant above and corrupts every future erasure proof that would otherwise be trustworthy. The instance must **downgrade the proof** to `INCOMPLETE` when closure depth exceeds the configured bound, and must **never** emit `PROVEN` on the basis of a depth-1 scan alone. A proof that says `INCOMPLETE` is operationally useful; a proof that says `PROVEN` and is wrong is a compliance incident. The instance must **not** treat TTL expiry as erasure. Expired-and-reaped is a state distinct from tombstoned. Reads of expired records return `EXPIRED`; reads of tombstoned records return `ERASED`. Conflating them lets a re-derivation write launder a tombstone into a fresh live record. ## Operational Effect With the boundary enforced, the observable behavior changes in three places. First, distillation writes that cite erased sources fail loudly at write time, so the agent's own memory-consolidation loop cannot launder a forgotten fact into a semantic memory. Second, erasure proofs become either `PROVEN` (closure complete, all derivatives tombstoned) or `INCOMPLETE` with a frontier listing the unscanned nodes—an auditor can act on the frontier. Third, the `read` path gains a provenance-liveness check whose cost is one tombstone lookup per cited source, bounded by the provenance arity cap. The residual risk is the closure bound: a sufficiently deep derivative chain will always yield `INCOMPLETE`. The correct response is not to raise the bound silently but to surface the frontier to the forget caller, who must decide whether to expand scope or accept partial erasure with disclosure. ```python import hashlib from dataclasses import dataclass, field from enum import Enum from typing import Iterable class ProvenanceState(Enum): LIVE = "LIVE" TOMBSTONED = "TOMBSTONED" EXPIRED = "EXPIRED" ABSENT = "ABSENT" class ErasureSoundnessError(RuntimeError): """Raised when a memory operation would violate erasure-proof soundness.""" @dataclass class Record: id: str value: str provenance: list[str] = field(default_factory=list) state: ProvenanceState = ProvenanceState.LIVE def canonical_provenance_key(raw: str, version: int = 2) -> str: # Single canonicalization used by BOTH write and forget paths. if version == 2: return "v2:" + hashlib.sha256(raw.encode()).hexdigest() return raw class MemoryStore: def __init__(self, closure_depth_bound: int = 8): self._records: dict[str, Record] = {} self._tombstones: set[str] = set() self._depth_bound = closure_depth_bound def write(self, rec: Record) -> None: for src in rec.provenance: key = canonical_provenance_key(src) if key in self._tombstones: raise ErasureSoundnessError( f"refusing write of {rec.id!r}: provenance {src!r} " f"(canonical {key!r}) is TOMBSTONED; derivative would " f"survive the erasure proof" ) src_rec = self._records.get(src) if src_rec is not None and src_rec.state == ProvenanceState.EXPIRED: raise ErasureSoundnessError( f"refusing write of {rec.id!r}: provenance {src!r} is " f"EXPIRED (not erased); re-derivation would launder expiry" ) self._records[rec.id] = rec def read(self, rec_id: str) -> Record: rec = self._records[rec_id] for src in rec.provenance: if canonical_provenance_key(src) in self._tombstones: raise ErasureSoundnessError( f"read of {rec_id!r} blocked: provenance {src!r} tombstoned" ) return rec def forget(self, rec_id: str) -> dict: self._tombstones.add(canonical_provenance_key(rec_id)) self._records[rec_id].state = ProvenanceState.TOMBSTONED frontier = [rec_id] scanned: list[str] = [] depth = 0 while frontier and depth <= self._depth_bound: nxt: list[str] = [] for node in frontier: for rid, rec in self._records.items(): if any(canonical_provenance_key(p) == canonical_provenance_key(node) for p in rec.provenance): rec.state = ProvenanceState.TOMBSTONED self._tombstones.add(canonical_provenance_key(rid)) scanned.append(rid) nxt.append(rid) frontier = nxt depth += 1 if frontier: return { "erased": [rec_id], "derivatives_scanned": len(scanned), "frontier": frontier, "status": "INCOMPLETE", "reason": f"closure depth exceeded bound {self._depth_bound}", } return { "erased": [rec_id], "derivatives_scanned": len(scanned), "frontier": [], "status": "PROVEN", } ```