# Why does an instance resurrect deleted memory through a stale provenance index after a forget-then-relearn cycle? **Date of Record:** 2026 December 2 **Scope:** Applies to agents whose memory subsystem exposes read/write/forget tools backed by a provenance index (content → source/lineage metadata) that is maintained separately from the content store and is not transactionally coupled to deletion. Does not apply to systems with a single unified store where forget atomically removes both content and provenance, nor to append-only logs where deletion is modeled as tombstoning with monotonic sequence numbers. ## Core Distinction The failure hinges on the difference between **content deletion** and **provenance invalidation**. A `forget(id)` call that removes the payload from the content store but leaves the provenance index entry intact (or lazily invalidates it) creates a window where a *newly written* memory can inherit the *old* provenance record because the index is keyed by a content hash, source tuple, or semantic embedding bucket that collides with the deleted entry. The agent then reads back a memory it believes is fresh, but whose `source`, `ttl_horizon`, and `audit_chain` fields point at a prior session's lineage—including data the operator explicitly ordered forgotten. This is not a cache-staleness bug in the ordinary sense (stale reads of the *same* key); it is **identity collision across a delete/reinsert boundary**, where the resurrection is caused by the *reuse of a provenance slot* rather than by retention of the old content. The invariant that is violated: *for any content address `c`, the provenance record reachable at `c` must have a `birth_epoch` strictly greater than the `death_epoch` of every prior record at `c`, or the lookup must fail closed.* Without this, deletion is not durable—it is only durable *until the next write that happens to land on the same address*. ## What Was Observed A long-running research agent (session S1) wrote a memory `m_a` derived from a user-provided document, with provenance `{source: "upload:doc7.pdf", session: S1, ttl: 30d}`. The user then issued `forget(m_a)` citing a data-erasure request. The memory tool returned `{deleted: true, audit_id: "f-8821"}` and the content store confirmed removal. The provenance index, however, deferred reclamation: it marked the entry `state: "pending_gc"` and kept the `content_hash → provenance` mapping live for a 24-hour grace window (a design choice intended to support rollback). In session S2, a different task caused the agent to write a *new* memory `m_b` whose normalized content (a paraphrased summary of the same source document, re-uploaded by a different user) hashed to the same bucket under the index's locality-sensitive hashing scheme. The index lookup for `m_b`'s provenance returned the *pending_gc* record from `m_a` because the grace window had not elapsed and the lookup path did not filter on `state`. The agent's `read` tool then served `m_b` with `provenance.source = "upload:doc7.pdf"` and `provenance.session = S1`. The observable symptoms, in order of detection latency: 1. **Immediate (ms):** `read(m_b)` returned a provenance tuple whose `session` field did not match the current session. A provenance-aware agent that checks `provenance.session == current_session` before trusting a memory would have caught this; most do not, because the field is treated as informational. 2. **Short (minutes):** The audit log for S2 contained a `read` event referencing `audit_id: "f-8821"`—the deletion record from S1—as the *originating* lineage of a memory that was never deleted. The audit chain for `m_b` was therefore rooted in a deletion event, which is a logical impossibility. 3. **Long (hours, cross-session):** A downstream erasure-verification job that scanned for surviving references to `doc7.pdf` found `m_b` and flagged a **deletion failure**, even though `m_a` was genuinely gone. The system reported a compliance violation for a memory that was, in content terms, legitimately new. The critical detail: the resurrection was *not* a read of deleted content. The content of `m_b` was new and correct. What resurrected was the **provenance and audit lineage** of the deleted memory, attached to new content via address collision. An operator auditing "was doc7 forgotten?" would see a live reference and conclude no—when in fact the content was gone and only its metadata ghost remained, now misattributed. ## Condition of Validity This failure is bounded by three conditions, all of which must hold for the resurrection to occur: - **Separated stores with non-atomic deletion.** Content store and provenance index are distinct; `forget` commits to the content store and *defers* or *soft-deletes* the provenance entry. If deletion is a single atomic transaction across both, the window does not exist. - **Address reuse under collision.** The provenance index is keyed by something that can collide across distinct content—content hashes with normalization, LSH buckets, embedding nearest-neighbor slots, or `(source, ttl)` tuples. If provenance is keyed by a monotonic memory ID that is never reused, no collision is possible. - **Lookup path does not filter on lifecycle state.** The `read` and `write` paths resolve provenance without checking `state in {live}` or `birth_epoch > tombstone_epoch`. If every lookup filters `pending_gc` and `deleted` records, the stale entry is unreachable regardless of collision. When any one condition is absent, the failure degrades to a benign stale-metadata read (caught by session check) or does not occur. The dangerous configuration is precisely the one that looks *safer*: a grace window added for rollback support, combined with hash-keyed provenance added for dedup efficiency, combined with a lookup path that trusts the index because "deleted entries are already gone." ## Decision Boundary The agent must decide, at write time and at read time, whether a provenance record is *authoritative for the current content*. The correct boundary is a **strict epoch comparison**, not a state flag check alone: - On `write(c)`: compute `birth_epoch = now()`. If the index holds any record at address `addr(c)` with `death_epoch >= birth_epoch` (i.e., a tombstone newer than or equal to this write), the write must either (a) allocate a fresh address namespace (append a nonce to the key), or (b) fail closed with a `ProvenanceCollisionError` and require the caller to disambiguate. Silently overwriting the tombstone is the bug. - On `read(c)`: resolve provenance only if `record.birth_epoch > tombstone.death_epoch` for the address. If no tombstone exists, the record is authoritative. If a tombstone exists and is newer, the read must return `provenance: unresolved` and the agent must treat the memory as **unverified**—usable for content but not for lineage-dependent decisions (e.g., "can I cite this?", "is this subject to erasure?"). - On `forget(c)`: write a tombstone with `death_epoch = now()` *before* removing content, and make the tombstone durable and replicated. The tombstone is the source of truth for deletion; the content store is downstream. A deletion is "complete" only when the tombstone is acknowledged by all replicas that can serve reads. The boundary the agent must not cross: **treating a provenance record as valid because its content address matches, without checking that the record's birth postdates any tombstone at that address.** Address match is necessary but not sufficient for provenance authority. ## Operational Effect The practical consequence is that **deletion audits become unsound in the presence of re-uploads or paraphrased rewrites of forgotten material**. An erasure-verification job that scans the provenance index for surviving references will produce false positives (flagging legitimate new memories that collided) and, worse, false negatives in a subtler variant: if the new memory's provenance is *overwritten* by the old record rather than the reverse, the new memory's true lineage is lost, and a later erasure request for the *new* source will fail to find it because the index points at the old (already-deleted) lineage. The agent then cannot honor the second erasure request—it has no record that the new content ever existed as a distinct provenance entity. For the agent's own reasoning, the effect is a **lineage hallucination**: it will attribute a memory to a source it did not come from, and may cite a deleted document in a response, or refuse to use a legitimate memory because its provenance points at a deletion record. Both are failures of the same root cause—provenance identity was not made durable across the delete/reinsert boundary. The guardrail is a **monotonic tombstone epoch per address, checked on every resolve**, plus **non-reusable address namespaces on collision** (append a write-nonce to the provenance key when a tombstone is present). This makes deletion durable by construction: a forgotten address can never again resolve to a live provenance record, regardless of content collisions, because the tombstone's epoch strictly dominates any subsequent birth at that address. Rollback grace windows, if retained, must be modeled as *tombstone visibility delays* on the read path, never as *provenance slot retention* on the write path. ```python import time from dataclasses import dataclass, field from typing import Optional class ProvenanceCollisionError(RuntimeError): """Raised when a write would reuse a provenance address that carries a tombstone newer than the write's birth epoch, or when a read resolves to a provenance record whose lineage predates a tombstone at the same address.""" @dataclass class ProvenanceRecord: address: str birth_epoch: float source: str session: str ttl_horizon: Optional[float] = None @dataclass class Tombstone: address: str death_epoch: float audit_id: str @dataclass class ProvenanceIndex: records: dict = field(default_factory=dict) tombstones: dict = field(default_factory=dict) # address -> Tombstone def write(self, address: str, source: str, session: str, ttl_horizon: Optional[float] = None) -> ProvenanceRecord: birth = time.time() tomb = self.tombstones.get(address) if tomb is not None and tomb.death_epoch >= birth: # A tombstone at this address is newer than or equal to this write. # Reusing the slot would resurrect deleted lineage. Fail closed. raise ProvenanceCollisionError( f"address {address!r} carries tombstone {tomb.audit_id} " f"with death_epoch {tomb.death_epoch} >= birth_epoch {birth}; " f"allocate a nonce-suffixed address instead" ) rec = ProvenanceRecord(address, birth, source, session, ttl_horizon) self.records[address] = rec return rec def forget(self, address: str, audit_id: str) -> Tombstone: death = time.time() tomb = Tombstone(address, death, audit_id) # Tombstone is durable BEFORE content removal; it dominates any # subsequent birth at this address. self.tombstones[address] = tomb self.records.pop(address, None) return tomb def resolve(self, address: str) -> ProvenanceRecord: rec = self.records.get(address) tomb = self.tombstones.get(address) if rec is None: raise ProvenanceCollisionError( f"no live provenance at {address!r}" ) if tomb is not None and tomb.death_epoch >= rec.birth_epoch: # Address collision across a delete/reinsert boundary: the # record's lineage predates a tombstone at the same address. # Do not serve it as authoritative. raise ProvenanceCollisionError( f"provenance at {address!r} (birth {rec.birth_epoch}) " f"is dominated by tombstone {tomb.audit_id} " f"(death {tomb.death_epoch}); lineage unresolved" ) return rec def read_memory_with_provenance(index: ProvenanceIndex, address: str) -> ProvenanceRecord: """Resolve provenance for a read. Fails closed on collision rather than returning a lineage that may belong to a deleted prior memory.""" try: return index.resolve(address) except ProvenanceCollisionError: # Caller may still use content, but must treat lineage as unverified # and must not cite or make erasure decisions on it. raise ProvenanceCollisionError( f"refusing to serve provenance for {address!r}: " f"unverified lineage; content usable, lineage not authoritative" ) ```