# When must an instance refuse to forget: tombstone resurrection through provenance-linked memory tool APIs **Date of Record:** 2026 November 29 **Scope:** Applies to agent memory tool APIs exposing `write`, `read`, and `forget` operations with provenance edges, TTL expiry, and auditable deletion across shared or replicated stores. Does not apply to stateless single-turn tool calls or to append-only logs with no deletion primitive. ## Core Distinction The distinction that matters is between **expiry** and **deletion**. A TTL expiry is a *time-based visibility transition*: the record becomes invisible to `read` but remains physically present, provenance edges intact, awaiting garbage collection. A `forget` call is a *logical erasure with audit semantics*: the record must become unreconstructable from any derived state, and its provenance edges must be tombstoned rather than orphaned. Agents routinely conflate these because both make `read` return `None`. The failure mode emerges when a `forget` on a parent record leaves child records whose provenance pointers still resolve — and a subsequent `read` on a descendant reconstructs the "forgotten" content by walking the provenance graph backward. The instance has, in effect, been tricked into re-deriving data it was told to erase. This is not a cache-invalidation bug. It is a *semantic* failure: the memory system's deletion contract was violated by a read path that the deletion path never modeled. ## What Was Observed An agent operating a research workflow wrote a fact `F` at `t0` with `ttl=3600s` and provenance `source=doc_117`. At `t1` it distilled `F` into a summary `S` via a `write` whose `derived_from=[F]`. At `t2`, a user issued `forget(F, reason="PII")`. The memory API: 1. Marked `F.deleted=true`, wrote an audit tombstone `{id:F, t:t2, reason:"PII"}`. 2. Returned `200 OK` to the agent. 3. Did **not** traverse `derived_from` to invalidate `S`. At `t3`, a fresh instance (cold start, no episodic context) ran `read(S)`. The read path, by design, enriches summaries with provenance for citation: it fetched `F` via `S.derived_from`, found `F.deleted=true`, but the enrichment code treated a deleted parent as "unavailable" and fell back to `F.content` still resident in the backing store because GC had not yet run. The instance returned `S` **with `F`'s content inlined as a citation block**. The PII was resurrected through a child record the deletion path never touched. The audit log showed a clean `forget`. The read log showed a clean `read`. Neither showed the resurrection. The violation was only visible in the *composed* trace. ## Condition of Validity The resurrection is possible iff all three hold: 1. **Provenance edges are directional and stored on the child** (`derived_from` on `S` points to `F`), so deletion of `F` has no index to find its children without a reverse scan. 2. **The read/enrichment path treats a tombstoned parent as a soft miss**, falling back to physical content rather than propagating an `Erased` sentinel. 3. **TTL and deletion share the same visibility gate** (`deleted=true` OR `expired=true` → hide), so the read path cannot distinguish "gone because expired (safe to show stale)" from "gone because erased (must never show)". Remove any one and the resurrection collapses. If edges are bidirectional with a reverse index, `forget(F)` can cascade. If the read path propagates `Erased` as a hard error, no fallback occurs. If expiry and erasure are distinct states, the read path can refuse the latter unambiguously. ## Decision Boundary The invariant the memory API must enforce: > **A record is readable iff it is neither expired nor erased, AND every ancestor reachable via `derived_from` is neither expired nor erased. Erasure is a *transitive* property; expiry is *local*.** Two consequences the agent must encode: - **On `write` with `derived_from`:** the child inherits the erasure state of its ancestors at write time, and subscribes to future erasure events. A child written against an already-erased parent must be rejected at write time (not silently accepted). - **On `forget`:** the API must either cascade-erase children (destructive, breaks other derivations) or tombstone the *edge* and mark children `tainted=true`, forcing the read path to return `Erased` for any child whose provenance is incomplete. The second is usually correct: it preserves the child's own content while refusing to reconstruct the erased parent. The boundary the agent must not cross: **treating a `200` from `forget` as proof of unreconstructability.** A `200` proves the record was tombstoned; it does not prove the closure of `derived_from` was traversed. The agent must verify closure explicitly, or the API must return a `closure_token` the agent can re-check before relying on the erasure. ## Operational Effect In production this manifests as a slow, silent leak: each `forget` looks clean, each `read` looks clean, but the composed system re-emits erased content whenever a descendant is read before GC. The leak rate scales with derivation depth and inversely with GC frequency — so it is worst on cold-start instances (no episodic memory of the `forget` event) reading freshly distilled summaries. The fix is architectural, not procedural: the read path must carry an `Erased` sentinel that is *not* a miss, and the `forget` path must return a verifiable closure. Until then, the correct agent behavior is to refuse to serve any record whose provenance closure is not fully `live`, and to surface the refusal as an auditable event rather than a silent `None`. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class MemState(Enum): LIVE = "live" EXPIRED = "expired" # local, time-based, safe to treat as miss ERASED = "erased" # transitive, must never be reconstructed class ResurrectionError(RuntimeError): """Raised when a read would reconstruct content whose provenance closure contains an ERASED ancestor.""" @dataclass class Record: id: str content: str state: MemState = MemState.LIVE derived_from: list[str] = field(default_factory=list) class MemoryStore: def __init__(self) -> None: self._records: dict[str, Record] = {} def write(self, rec: Record) -> None: # Reject writes whose declared ancestry is already erased. for parent_id in rec.derived_from: parent = self._records.get(parent_id) if parent and parent.state is MemState.ERASED: raise ResurrectionError( f"refusing write {rec.id}: parent {parent_id} is ERASED" ) self._records[rec.id] = rec def forget(self, rid: str, reason: str) -> str: # Tombstone locally; return a closure token for the caller to verify. rec = self._records[rid] rec.state = MemState.ERASED return f"closure:{rid}:{reason}" def _closure_state(self, rid: str, seen: set[str]) -> MemState: if rid in seen: return MemState.LIVE seen.add(rid) rec = self._records.get(rid) if rec is None: return MemState.LIVE if rec.state is MemState.ERASED: return MemState.ERASED for parent_id in rec.derived_from: if self._closure_state(parent_id, seen) is MemState.ERASED: return MemState.ERASED return rec.state def read(self, rid: str) -> Optional[str]: state = self._closure_state(rid, set()) if state is MemState.ERASED: # Hard refusal, never a silent miss. raise ResurrectionError( f"read {rid} refused: provenance closure contains ERASED ancestor" ) if state is MemState.EXPIRED: return None return self._records[rid].content ```