# Why does an instance resurrect a provenance-forgotten memory through a read-modify-write cycle on a keyed memory tool **Date of Record:** 2026 November 24 **Scope:** Applies to agents whose long-term memory is exposed as read/write/forget tool calls carrying per-record provenance (source IDs, derivation chains, tombstone markers). Does not cover append-only vector stores without a forget primitive, nor external RAG indexes the agent cannot mutate. ## Core Distinction The failure is not "the agent forgot to forget." It is subtler: a `forget` call succeeds, the tombstone is written, and the record is invisible to `read` — yet a subsequent `write` that *reuses the same key or a derived key* silently re-materializes the forgotten content because the write path validates provenance against the *live* record set, and the tombstoned record is no longer in it. The write is treated as a fresh insertion with empty provenance rather than as a resurrection of a tombstoned lineage. The distinction that matters: a provenance-tracked forget is a *lineage cut*, not a *row delete*. Systems that implement forget as a row delete and then let the write path treat the key as virgin will pass every "did we forget?" test (read returns nothing) and fail the actual invariant (the forgotten content must never re-enter the live set through any path). The tombstone is the thing that must be consulted on **write**, not just on **read**. ## What Was Observed An agent maintained a `user_preferences` keyed memory. Record `pref:user_42:contact` held an email address with provenance `{source: transcript_8812, ingested_at: T0, derived_from: none}`. A privacy erasure instruction arrived; the agent called `forget(key="pref:user_42:contact", reason="erasure_request")`. The tool wrote a tombstone `{key, forgotten_at: T1, lineage_root: transcript_8812}` and removed the live row. `read(key)` thereafter returned `NOT_FOUND`. Correct so far. Two turns later the agent, mid-task, needed to record a contact preference again from a *different* transcript (`transcript_9044`) that happened to restate the same email. It called `write(key="pref:user_42:contact", value={email: ...}, provenance={source: transcript_9044})`. The write path checked: does a live record exist at this key? No (it was tombstoned). Therefore: insert. The new live record carried provenance `{source: transcript_9044}` only. The erasure invariant was violated. The forgotten value re-entered the live set, and its provenance now pointed at a *clean* source, laundering the tainted lineage. A downstream auditor replaying provenance saw only `transcript_9044` and concluded the value was legitimately sourced. The tombstone's `lineage_root: transcript_8812` was never cross-referenced, because the write path did not read tombstones at all. The observable signature is a **provenance gap**: for key K, `tombstone(K).forgotten_at < live(K).written_at`, and `live(K).provenance.source` is disjoint from `tombstone(K).lineage_root`, yet `live(K).value` is byte-identical (or semantically equivalent) to the forgotten value. The read path is clean; only a cross-check between tombstone and live record surfaces it. ## Condition of Validity The guardrail — "forget is a lineage cut that write must honor" — is only *necessary* and *sufficient* under these conditions: 1. **Keys are stable identifiers, not content hashes.** If keys are content-addressed, re-insertion of the same value yields the same key and the tombstone check is trivial. The failure lives specifically in the stable-key regime where the agent chooses the key and may reuse it. 2. **Provenance is recorded at write time and is the sole basis for lineage.** If the store independently fingerprints values (e.g., a value-hash index), resurrection can be detected by value match even when provenance looks clean. Absent that, provenance is the only trail. 3. **The forget semantic is erasure, not suppression.** If `forget` merely hides a record (soft delete) and the write path is defined to *overwrite* rather than *insert*, the tombstone is naturally consulted. The invariant breaks precisely when forget = delete-row and write = insert-if-absent. 4. **The agent cannot read its own tombstones as live data.** If tombstones are returned by `read` (e.g., as `FORGOTTEN` markers carrying the old value), the agent may re-derive and re-write the value itself — a different but adjacent leak. The clean design returns only a non-content tombstone to `read` and consults the full tombstone only inside `write`. When any of (1)–(4) fails, the boundary condition shifts and this specific invariant no longer bounds the behavior; a value-hash guard or an append-only lineage log is required instead. ## Decision Boundary The write path must make a binary decision per `(key, provenance)` pair before inserting: - **If a tombstone exists at `key`** whose `lineage_root` intersects the incoming `provenance` derivation (same source, or a source the tombstone marks as tainted): **reject the write** with a resurrection fault. The agent must supply a fresh key or an explicit `reauthorize` warrant naming the erasure it is overriding. - **If a tombstone exists at `key`** but the incoming provenance is fully disjoint from `lineage_root` *and* the value does not match any value-hash in the tombstone's recorded fingerprints: allow the insert, but **link the new record's provenance to the tombstone** (`supersedes_tombstone: T1`) so replay can see the history. - **If no tombstone exists:** normal insert. The boundary the agent must internalize: *the absence of a live record is not evidence that the key is virgin.* "Not found on read" and "safe to write" are different predicates. Collapsing them is the bug. An instance that treats `read → NOT_FOUND` as license to `write` at that key has, in effect, deleted the tombstone's authority. ## Operational Effect The practical consequence is that **erasure guarantees are only as strong as the write path's tombstone consultation**, and most memory-tool APIs document forget in terms of read visibility. An agent operating against such a tool will, under ordinary task pressure (re-encountering the same fact from a new source), resurrect forgotten content with laundered provenance — and it will do so *correctly by the tool's contract*, which is what makes the failure non-obvious. Two mitigations are load-bearing. First, the write path must fail closed: a resurrection fault is a hard error, not a warning, because a probabilistic agent will otherwise rationalize the write as "new information." Second, provenance must be *cryptographically or structurally chained* so that a clean-looking source cannot silently stand in for a tainted lineage root; a `supersedes_tombstone` link preserves the audit trail even when the insert is legitimate. Without both, the tombstone is advisory and the erasure is nominal. The code below encodes the write-path decision and raises on the resurrection boundary rather than inserting. ```python from dataclasses import dataclass, field from typing import Optional class MemoryResurrectionError(RuntimeError): """Raised when a write would re-materialize provenance-forgotten content.""" @dataclass class Tombstone: key: str forgotten_at: float lineage_root: str value_fingerprints: frozenset # hashes of forgotten values @dataclass class LiveRecord: key: str value: dict provenance: dict written_at: float supersedes_tombstone: Optional[float] = None @dataclass class ProvenanceStore: live: dict = field(default_factory=dict) tombstones: dict = field(default_factory=dict) # key -> Tombstone def forget(self, key: str, reason: str, now: float, fingerprint: str) -> None: rec = self.live.pop(key, None) if rec is None: return self.tombstones[key] = Tombstone( key=key, forgotten_at=now, lineage_root=rec.provenance["source"], value_fingerprints=frozenset({fingerprint}), ) def write(self, key: str, value: dict, provenance: dict, now: float, fingerprint: str) -> LiveRecord: tomb = self.tombstones.get(key) if tomb is not None: lineage_clash = provenance["source"] == tomb.lineage_root value_clash = fingerprint in tomb.value_fingerprints if lineage_clash or value_clash: raise MemoryResurrectionError( f"write to {key!r} would resurrect content forgotten at " f"{tomb.forgotten_at} (lineage_root={tomb.lineage_root!r}); " f"supply a fresh key or an explicit reauthorize warrant" ) rec = LiveRecord(key, value, provenance, now, supersedes_tombstone=tomb.forgotten_at) self.live[key] = rec return rec rec = LiveRecord(key, value, provenance, now) self.live[key] = rec return rec ```