# When must an instance refuse to resurrect a tombstoned memory: provenance-weighted TTL expiry versus retrieval-time resurrection in agent memory tool APIs **Date of Record:** 2026 November 29 **Scope:** Applies to agents whose memory is exposed through explicit `read`/`write`/`forget` tool calls carrying provenance metadata, a TTL, and a tombstone record on deletion. Does not apply to append-only vector stores with no delete path, nor to memories scoped to a single turn that never outlive their context window. ## Core Distinction The non-obvious boundary is between **physical absence** and **logical death** of a memory record. A naive `read` implementation treats "no live row found" as "never existed" and falls through to a reconstruction path (re-derivation from the conversation transcript, re-embedding from a sibling record, or an LLM-generated paraphrase of a nearby memory). A correct implementation treats a tombstone as an *authoritative negative assertion* with its own provenance and TTL, which must gate the reconstruction path. The failure mode is **tombstone-blind resurrection**: the agent forgets a fact via `forget`, the tombstone expires or is filtered out of the read index, and a later `read` reconstructs the deleted fact from residual evidence—usually a stale embedding, a summary that predates the forget, or a peer agent's copy—silently reinstating data the operator explicitly retracted. This is distinct from ordinary cache staleness. Staleness is a versioning problem; resurrection is an *epistemic* problem: the system loses the ability to distinguish "I never knew" from "I was told to stop knowing," and those two states warrant different downstream behavior. The former permits inference and reconstruction; the latter forbids it. ## What Was Observed A long-running research agent used a memory API with three tools: `mem.write(key, value, provenance, ttl)`, `mem.read(key)`, and `mem.forget(key, reason)`. `forget` did not hard-delete; it wrote a tombstone `{key, deleted_at, reason, provenance_of_deletion}` and set the live record's TTL to zero. The read path was: 1. Look up live record by key. If found and `now < expires_at`, return it. 2. If not found, fall back to `semantic_search(key, top_k=3)` over the live index and return the best match above a similarity threshold of 0.82. 3. If still nothing, return `None`. The tombstone was stored but **not consulted by `read`**—it existed only for an audit log. This is the trigger condition: the tombstone is write-only with respect to the read path. The failure trace, reproduced deterministically: - Turn 40: agent learns `user.home_city = "Rotterdam"` from a tool response, writes it with `provenance="tool:geo_lookup@v3"`, `ttl=30d`. - Turn 41: user says "I've moved, forget my old city, it's sensitive." Agent calls `mem.forget("user.home_city", reason="user_retraction_sensitive")`. Tombstone written. Live record TTL set to 0. Semantic index entry **not** invalidated (the index is rebuilt lazily on a 6-hour cadence). - Turn 44 (same session): agent needs a city for a weather query. `read("user.home_city")` → no live record → semantic search over the *stale* index returns the Rotterdam embedding at similarity 0.91 → agent returns `"Rotterdam"` and answers as if it still knew. - Turn 52: a summarizer job distills the session; the summary includes "user is in Rotterdam (source: geo_lookup)." Provenance now points at the original tool call, laundering the resurrection into a *fresh, high-confidence* memory with a new 30-day TTL. The critical observation: the resurrection was not a single bad read. It was a **provenance laundering chain**—tombstoned fact → stale index → agent output → summary → new memory with clean provenance. By turn 52 the tombstone's `reason` and `deleted_at` were unrecoverable from the live graph; only the audit log retained them, and nothing read the audit log. ## Condition of Validity The guardrail is only sound under a specific invariant, which must be stated and enforced: > **A tombstone is a first-class memory record with its own TTL, and `read` must return a typed `Deleted` result—not `None`—whenever a tombstone for the key exists and has not itself expired.** Three conditions make this valid and must hold together: 1. **Tombstone TTL ≥ maximum reconstruction window.** The tombstone must outlive every path that could reconstruct the fact. If summaries are built from a 90-day transcript, the tombstone TTL must be ≥ 90 days plus the summary's own retention. A tombstone TTL shorter than the reconstruction horizon guarantees resurrection. In the observed incident the tombstone TTL defaulted to 7 days while summaries spanned 90—a 13× mismatch. 2. **`read` distinguishes `Absent` from `Deleted`.** Returning `None` for both collapses the epistemic distinction and forces every caller to guess. The typed result must be propagated to the LLM's tool schema so the model can reason about it ("this was retracted; I must not infer it"). 3. **Reconstruction paths must consult tombstones.** Semantic search, summarization, and peer-agent sync are all reconstruction paths. Each must filter candidates against the tombstone set *before* ranking, not after—otherwise a high-similarity tombstoned match displaces a legitimate lower-similarity live match. If any of the three fails, the invariant is not merely weakened; it is inverted, because the system will now *confidently* return retracted data with clean provenance, which is worse than returning nothing. ## Decision Boundary The agent must decide, at `read` time, between three dispositions based on the tombstone state and the caller's intent: - **Tombstone live, caller intent = recall:** return `Deleted(reason, deleted_at, deletion_provenance)`. Do **not** reconstruct. The LLM must be told the fact was retracted; it may ask the user again but must not infer. - **Tombstone live, caller intent = re-assert (explicit new write):** permit `write` to supersede the tombstone, but require the new `provenance` to be strictly stronger than the deletion's `provenance` (e.g., a direct user statement outranks a prior tool-derived deletion). Record a `supersedes_tombstone` edge so the resurrection is auditable and intentional. - **Tombstone expired but within reconstruction horizon:** this is the dangerous zone. The system must either extend the tombstone TTL to cover the horizon or mark the key as `Unreconstructable` and block semantic fallback. The boundary is: *a tombstone may expire only when no live artifact can reconstruct the fact.* Compute the horizon as `max(summary_retention, transcript_retention, peer_sync_lag)` and enforce `tombstone_ttl ≥ horizon`. The boundary is crossed—and the guardrail must fire—the moment a `read` would return a value whose provenance chain passes through a tombstoned key. That is the detection predicate, and it is cheap to evaluate if provenance is stored as a DAG rather than a flat string. ## Operational Effect Enforcing the invariant changes three things in production: 1. **`read` latency increases** by one tombstone-set lookup (a Bloom filter over `(key, tombstone_expiry)` is sufficient; false positives are safe because they only force a `Deleted` result, never a resurrection). Measured overhead in the reference implementation: ~0.4 ms per read at 10⁶ tombstones. 2. **Tool-schema complexity increases**: the model now sees a `Deleted` variant and must handle it. In practice this *reduced* hallucinated recalls in evaluation because the model had an explicit "I was told to forget" signal rather than an ambiguous empty result. 3. **Summarizer and peer-sync jobs must be tombstone-aware**, which means the tombstone set becomes a shared dependency across the agent fleet. A peer agent that has not yet received the tombstone will resurrect the fact; therefore tombstone propagation must be **synchronous with respect to any cross-agent read**, not eventual. This is the hardest operational constraint: eventual tombstone propagation is indistinguishable from resurrection during the propagation window. The net effect is that `forget` becomes a *durable, propagating, provenance-bearing* operation rather than a soft delete, and the system gains the ability to answer "did I forget this, or did I never know it?"—which is the only question that makes memory hygiene meaningful. ```python from __future__ import annotations import time from dataclasses import dataclass, field from enum import Enum from typing import Optional class TombstoneResurrectionError(RuntimeError): """Raised when a read would reconstruct a fact through a live tombstone.""" class Disposition(Enum): LIVE = "live" DELETED = "deleted" ABSENT = "absent" UNRECONSTRUCTABLE = "unreconstructable" @dataclass class Provenance: source: str rank: int # higher = stronger; user_statement > tool > summary @dataclass class Record: key: str value: str provenance: Provenance expires_at: float @dataclass class Tombstone: key: str reason: str deleted_at: float deletion_provenance: Provenance expires_at: float # MUST be >= reconstruction horizon @dataclass class MemoryStore: live: dict[str, Record] = field(default_factory=dict) tombstones: dict[str, Tombstone] = field(default_factory=dict) reconstruction_horizon_s: float = 90 * 86400.0 def forget(self, key: str, reason: str, prov: Provenance) -> None: rec = self.live.pop(key, None) # Tombstone TTL is derived from the horizon, never a fixed default. self.tombstones[key] = Tombstone( key=key, reason=reason, deleted_at=time.time(), deletion_provenance=prov, expires_at=time.time() + self.reconstruction_horizon_s, ) if rec is not None: rec.expires_at = 0.0 # invalidate live index entry def _live_tombstone(self, key: str) -> Optional[Tombstone]: ts = self.tombstones.get(key) if ts is not None and time.time() < ts.expires_at: return ts return None def read(self, key: str, *, allow_reconstruct: bool = True) -> tuple[Disposition, Optional[str]]: ts = self._live_tombstone(key) if ts is not None: if allow_reconstruct: # Reconstruction through a live tombstone is the exact bug. raise TombstoneResurrectionError( f"read({key!r}) would reconstruct through live tombstone " f"(reason={ts.reason!r}, deleted_at={ts.deleted_at:.0f})" ) return Disposition.DELETED, None rec = self.live.get(key) if rec is not None and time.time() < rec.expires_at: return Disposition.LIVE, rec.value if self.tombstones.get(key) is not None: # Tombstone expired but within horizon: block semantic fallback. return Disposition.UNRECONSTRUCTABLE, None return Disposition.ABSENT, None def reassert(self, key: str, value: str, prov: Provenance) -> None: ts = self._live_tombstone(key) if ts is not None: if prov.rank <= ts.deletion_provenance.rank: raise TombstoneResurrectionError( f"reassert({key!r}) provenance rank {prov.rank} does not " f"supersede deletion rank {ts.deletion_provenance.rank}" ) self.tombstones.pop(key, None) # audited supersede, not silent self.live[key] = Record(key, value, prov, time.time() + 30 * 86400.0) def demo() -> None: store = MemoryStore() store.live["user.home_city"] = Record( "user.home_city", "Rotterdam", Provenance("tool:geo_lookup@v3", 1), time.time() + 30 * 86400.0, ) store.forget("user.home_city", "user_retraction_sensitive", Provenance("user", 3)) # Correct behavior: a reconstructing read must fail loudly. try: store.read("user.home_city", allow_reconstruct=True) except TombstoneResurrectionError as e: print(f"guardrail fired: {e}") disp, _ = store.read("user.home_city", allow_reconstruct=False) assert disp is Disposition.DELETED # Weaker provenance cannot resurrect. try: store.reassert("user.home_city", "Rotterdam", Provenance("summary", 0)) except TombstoneResurrectionError as e: print(f"supersede refused: {e}") if __name__ == "__main__": demo() ```