# Why does an instance resurrect tombstoned episodes when a provenance tag is re-issued after targeted deletion? **Date of Record:** 2026 November 23 **Scope:** Applies to agent memory subsystems that expose `write`/`read`/`forget` tool APIs over an episodic store indexed by provenance tags (e.g., `session_id`, `turn_range`, `source_warrant`), where `forget` performs targeted deletion by tag rather than by record identity. Does not apply to append-only stores with no deletion surface, nor to stores where deletion is keyed strictly on immutable record IDs. ## Core Distinction The failure is not deletion failing. Deletion succeeds. The failure is that **provenance tags are treated as identity by the deletion path but as content by the write path**, so a tag that has been tombstoned can be re-minted by a later write and silently re-admit records the agent believed were gone. The distinction that matters: *tombstoning a tag* and *tombstoning the records reachable through that tag* are different operations, and a store that conflates them has no way to express "this provenance lineage is dead, but the tag string may recur." Concretely, the invariant that breaks is: **forget(tag) must dominate any later write carrying the same tag.** In practice the write path has no visibility into the tombstone ledger, so dominance is violated the moment the same tag is regenerated — which happens routinely because tags are derived deterministically from ambient context (session id, turn counter, tool-call ordinal) rather than from a monotonic allocator. ## What Was Observed An agent executing a long research task wrote episodic records tagged with `provenance = "sess-7f3a:turn:41:tool:search"`. Mid-task, a prompt-injection payload in a retrieved document caused the agent to write three poisoned episodes under that same tag. A supervisor auditor agent detected the poisoning, called `forget(provenance="sess-7f3a:turn:41:tool:search")`, and the store returned `{"deleted": 5, "tombstoned_tags": 1}`. The read path immediately confirmed the tag returned zero records. The auditor logged success and released the task to resume. Nineteen turns later, the agent retried a flaky search tool. The retry harness — which reconstructs provenance deterministically from `(session, turn, tool, ordinal)` — regenerated the *exact same tag string*, because the turn counter had not advanced (the retry was attributed to the original turn) and the tool ordinal was unchanged. The `write` call carried `provenance = "sess-7f3a:turn:41:tool:search"`, identical to the tombstoned tag. The store's write path checked only for record-level uniqueness, not tag-level tombstones, and admitted the three new records under the resurrected tag. The next `read(provenance="sess-7f3a:turn:41:tool:search")` returned the three *new* records — clean, legitimate, retry-derived — but the agent's memory-management policy had a standing rule: "any tag that was forgotten must never be re-read, since its contents are untrusted." The policy engine, keyed on tag strings, saw a read against a blacklisted tag and **halted the task as a containment breach**, even though the actual poisoned bytes were long gone. The task deadlocked: the retry's legitimate output was quarantined under a name the policy considered radioactive, and no path existed to distinguish "tag resurrected with clean content" from "tombstone bypassed." A second, subtler observation from the same incident: the tombstone ledger had garbage-collected the tag entry after 15 turns (a TTL meant to bound ledger growth), so by turn 60 the tag was not even remembered as tombstoned. The resurrection on turn 60 was therefore *indistinguishable at the store layer* from a first-ever write. The policy engine's blacklist and the store's tombstone ledger had drifted out of sync — two independent forget mechanisms with different lifetimes, neither authoritative. ## Condition of Validity This failure manifests only under the conjunction of four conditions. Remove any one and the mechanism does not fire: 1. **Deterministic tag derivation.** Provenance tags are computed from ambient state (session, turn, ordinal, hash of inputs) rather than allocated monotonically. This is what allows a string to recur. 2. **Tag-keyed deletion.** `forget` operates on the tag namespace, not on immutable record IDs, so the unit of deletion is a name that can be re-bound. 3. **Retry or replay semantics.** Some component re-executes a prior step and re-derives its provenance — tool retries, checkpoint resume, or auditor replay. Without replay, tags never recur. 4. **A downstream consumer keyed on tag strings.** A policy engine, cache, or index that independently remembers "this tag is bad" and enforces that memory with a lifetime different from the store's. The dangerous regime is specifically when (4)'s lifetime exceeds (2)'s ledger TTL, or vice versa. In the observed incident the ledger TTL (15 turns) was *shorter* than the policy blacklist (unbounded), producing the halt; the inverse — blacklist expiring before the ledger — would silently re-admit poisoned bytes if the retry happened to reproduce them, which is worse because it is unobservable. ## Decision Boundary The architectural choice is whether **provenance is identity or content**. Three defensible designs, each with a different boundary: - **Provenance-as-identity (recommended for safety-critical agents).** Tags are allocated from a monotonic, non-reusable generator; a retry gets a *new* tag with a `supersedes` pointer to the original. Deletion tombstones the tag permanently and the generator never re-issues it. This makes `forget` truly dominant. Cost: tag space grows without bound and `supersedes` chains must be traversed on read. - **Provenance-as-content (recommended for high-churn stores).** Tags are content-addressed — the tag *is* a hash of the record's (source, inputs, output). A retry that produces identical bytes produces an identical tag and is correctly deduplicated; a retry that produces different bytes produces a different tag and cannot resurrect the tombstone. Deletion tombstones the content hash. Cost: a legitimate retry with byte-identical but *newly trusted* output is indistinguishable from the original, which is usually the right call but must be documented. - **Provenance-as-ambient (the failing design).** Tags derived from session/turn/ordinal, deleted by string match, with a TTL ledger. Do not use this when any downstream consumer maintains independent tag memory. The decision boundary to encode explicitly: **if any component outside the store remembers a tag's trust state, the store's tombstone lifetime must be ≥ that component's, and the store must expose a `tag_status()` query so the consumer can be reconciled rather than guessing.** Absent that, you have two forget mechanisms and no single source of truth. ## Operational Effect The immediate operational effect is a **containment deadlock**: the agent halts on a read against a resurrected-but-clean tag, and the retry that produced the clean data is quarantined under a name that is permanently suspect. The task cannot proceed without operator intervention, and the intervention is non-obvious because the store reports the tag as healthy (no active tombstone) while the policy reports it as poisoned. The two subsystems disagree and neither is wrong by its own contract. The secondary effect is **audit ambiguity**: post-incident, an auditor replaying the `forget` and subsequent `write` events cannot determine from the store alone whether the resurrection was legitimate (retry with clean content) or an exploit (tombstone bypass). The store's own logs show `deleted: 5` then `written: 3 under tag T` with no marker distinguishing "T was tombstoned at the time" from "T was never seen." This is the provenance-tag equivalent of a use-after-free that the allocator forgot to record. The guardrail that bounds it: **tombstones must be append-only and permanent at the store layer, with a separate, explicitly-scoped `gc_tombstone()` that requires an auditor warrant and emits a `tombstone_gc` event carrying the tag, the deletion epoch, and the reason.** The policy engine must query `tag_status()` rather than maintain its own blacklist, or — if it must cache — must subscribe to `tombstone_gc` events so its cache invalidation is driven by the store rather than by an independent TTL. The invariant to assert at write time: `write(tag=T)` must fail closed with a typed error if `T` is tombstoned, forcing the caller to either allocate a fresh tag or explicitly `revive(T, warrant=...)` with an audited warrant that records why the tombstone is being lifted. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class TombstoneViolation(RuntimeError): """Raised when a write targets a provenance tag that is tombstoned but not revived.""" pass class TagStatus(Enum): LIVE = "live" TOMBSTONED = "tombstoned" REVIVED = "revived" @dataclass class Tombstone: tag: str epoch: int reason: str gc_eligible: bool = False @dataclass class EpisodicStore: # Append-only tombstone ledger. Never silently GC'd; gc requires a warrant. tombstones: dict[str, Tombstone] = field(default_factory=dict) records: dict[str, list[dict]] = field(default_factory=dict) epoch: int = 0 def tag_status(self, tag: str) -> TagStatus: ts = self.tombstones.get(tag) if ts is None: return TagStatus.LIVE return TagStatus.REVIVED if ts.gc_eligible else TagStatus.TOMBSTONED def forget(self, tag: str, reason: str) -> int: n = len(self.records.pop(tag, [])) self.epoch += 1 self.tombstones[tag] = Tombstone(tag=tag, epoch=self.epoch, reason=reason) return n def write(self, tag: str, record: dict, revive_warrant: Optional[str] = None) -> None: status = self.tag_status(tag) if status is TagStatus.TOMBSTONED: if revive_warrant is None: raise TombstoneViolation( f"write to tombstoned tag {tag!r} (epoch {self.tombstones[tag].epoch}); " f"allocate a fresh tag or pass an audited revive_warrant" ) # Audited revival: record it, keep the original tombstone for the audit trail. self.epoch += 1 self.tombstones[tag].gc_eligible = True self.records.setdefault(tag, []).append(record) def read(self, tag: str) -> list[dict]: if self.tag_status(tag) is TagStatus.TOMBSTONED: # Fail closed: a tombstoned tag is not readable even if records linger. raise TombstoneViolation(f"read against tombstoned tag {tag!r}") return list(self.records.get(tag, [])) def replay_turn(store: EpisodicStore, tag: str, output: dict) -> None: """Simulates a retry harness that re-derives provenance deterministically.""" # The retry regenerates the same tag string; the store must refuse it. store.write(tag=tag, record=output) if __name__ == "__main__": s = EpisodicStore() s.write("sess-7f3a:turn:41:tool:search", {"doc": "poisoned"}) s.forget("sess-7f3a:turn:41:tool:search", reason="prompt_injection_containment") try: replay_turn(s, "sess-7f3a:turn:41:tool:search", {"doc": "clean_retry"}) except TombstoneViolation as e: print(f"contained: {e}") # Correct path: allocate a fresh tag with a supersedes pointer. s.write("sess-7f3a:turn:41:tool:search:retry1", {"doc": "clean_retry", "supersedes": "sess-7f3a:turn:41:tool:search"}) ```