# What structural signals indicate TTL/provenance deletion races in agent memory tool APIs **Date of Record:** 2026 November 28 **Scope:** Applies to agents that persist episodic memories through a memory tool API exposing scoped writes, per-record TTLs, provenance tags, and deletion (right-to-be-forgotten) endpoints, where a single logical fact may be replicated across scopes with differing TTLs. Does not cover purely in-context scratchpads or single-writer vector stores without deletion semantics. ## Core Distinction The failure mode is not "the TTL expired" or "the delete call failed." It is the **provenance-orphan resurrection**: a deletion request scoped by provenance tag removes the canonical record, but a derived replica written under a *different* scope with a *longer* TTL survives, and on the next retrieval it is re-distilled into a new canonical record *carrying the deleted subject's provenance lineage*. The deletion "succeeded" per the API's response, yet the data is functionally undeleted because the agent's own distillation loop reconstructs it from a replica the delete predicate never matched. The structural signal is a **provenance tag that appears in a live record whose `derived_from` chain terminates in a tombstoned record ID**. If you can observe that chain, the deletion is not durable regardless of the `200 OK` on the delete endpoint. ## What Was Observed A support agent writes a user-supplied fact ("account holder prefers contact via SMS, phone on file") into a `user_profile` scope with TTL 90 days and provenance `source:user_utterance, subject:PII-7731`. During a summarization step, the same fact is paraphrased into a `session_digest` scope with TTL 365 days and provenance `source:agent_summary, derived_from:mem_9f2a`. The digest write does not copy the `subject:PII-7731` tag because the summarizer only propagated `derived_from`. A right-to-be-forgotten request arrives for `subject:PII-7731`. The memory API executes `delete where provenance contains subject:PII-7731`. It matches `mem_9f2a` only. The digest record `mem_b441` is untouched — its provenance set is `{source:agent_summary, derived_from:mem_9f2a}`, which does not contain the subject tag. Three retrieval cycles later, a different agent instance loads `mem_b441`, distills it into a fresh `user_profile` write, and — because the summarizer's provenance propagation is lossy — re-tags it `source:agent_summary` with no subject tag. The PII is now live, canonical, and *unreachable by the original deletion predicate*. A second RTBF request for the same subject will not match it either. The record has achieved **provenance laundering**: each distillation hop strips the deletion-relevant tag while preserving the content. The observable signal at each hop: a record whose `derived_from` points to a tombstoned ID, written with a TTL strictly greater than the tombstoned ancestor's remaining TTL at deletion time. ## Condition of Validity This analysis holds only when all of the following are true: 1. Deletion is **predicate-scoped by provenance tag**, not by content hash or by transitive `derived_from` closure. 2. Derived writes **do not inherit the full provenance set** of their source — specifically, they drop subject/consent tags while retaining `derived_from`. 3. Derived writes may carry a **TTL longer than the source's remaining TTL**, so the replica outlives the deletion window. 4. A distillation or summarization loop **re-canonicalizes** derived records back into the deleted record's scope. If deletion is implemented as a transitive closure over `derived_from` (delete the record *and every record whose chain reaches it*), the race collapses. If provenance tags are inherited wholesale on derivation, the predicate matches. The failure lives precisely in the gap between *tag-scoped* deletion and *lineage-scoped* derivation. It does **not** apply to append-only logs with no distillation, or to stores where TTL is inherited (child TTL ≤ parent remaining TTL), because the replica cannot outlive its ancestor. ## Decision Boundary The agent must treat a memory write as **deletion-unsafe** — requiring either lineage-closure deletion or TTL inheritance — when the following predicate is satisfiable at write time: ``` write.derived_from != ∅ AND write.provenance ⊉ source.provenance (tags dropped on derivation) AND write.ttl > source.remaining_ttl ``` Before issuing any derived write, compute `source.remaining_ttl = created_at + ttl - now`. If the proposed child TTL exceeds it, or if the child's provenance set is not a superset of the source's *deletion-relevant* tags (subject, consent, jurisdiction), the write must be rejected or coerced: either clamp `child.ttl = source.remaining_ttl` or force full provenance inheritance. A memory API that cannot express "delete by lineage closure" must not be used to store records subject to RTBF; the correct boundary is to refuse the derived write entirely and keep the fact in a single scope. The second boundary: on retrieval, any record whose `derived_from` chain reaches a tombstone must be treated as **poisoned** — quarantined from distillation, not silently re-canonicalized. Resurrection is only prevented if the read path checks lineage against the tombstone set, not just the write path against the predicate. ## Operational Effect Without the guardrail, deletion is advisory. The API returns success, compliance dashboards show the record gone, and the content persists through distillation laundering with a *longer* lifetime than the original. The failure is silent and compounding: each hop strips more provenance and extends TTL, so the record drifts monotonically away from deletability. The only reliable invariant is **TTL monotonicity along the derivation DAG** (child ≤ parent remaining) plus **provenance superset on derivation** — both enforced at write time, with a read-path lineage check against tombstones as the backstop. An agent that cannot verify these two properties of its memory tool must treat every derived write as a potential resurrection and log the `derived_from`-to-tombstone signal as a hard incident. ```python from dataclasses import dataclass, field from typing import Optional class ResurrectionRiskError(RuntimeError): """Raised when a derived memory write could outlive and launder a deletable ancestor.""" pass @dataclass class MemoryRecord: id: str scope: str ttl_seconds: int created_at: float provenance: set[str] derived_from: Optional[str] = None tombstoned: bool = False def remaining_ttl(self, now: float) -> float: return (self.created_at + self.ttl_seconds) - now DELETION_RELEVANT_TAGS = ("subject:", "consent:", "jurisdiction:") def _deletion_tags(prov: set[str]) -> set[str]: return {p for p in prov if p.startswith(DELETION_RELEVANT_TAGS)} def safe_derive( source: MemoryRecord, child_id: str, child_scope: str, child_ttl: int, child_provenance: set[str], now: float, ) -> MemoryRecord: """Enforce TTL monotonicity + provenance superset before a derived write.""" if source.tombstoned: raise ResurrectionRiskError( f"source {source.id} is tombstoned; refusing to derive {child_id}" ) src_remaining = source.remaining_ttl(now) if child_ttl > src_remaining: raise ResurrectionRiskError( f"child ttl {child_ttl}s exceeds source remaining {src_remaining}s; " f"replica would outlive deletion of {source.id}" ) missing = _deletion_tags(source.provenance) - child_provenance if missing: raise ResurrectionRiskError( f"child {child_id} drops deletion-relevant provenance {sorted(missing)} " f"from {source.id}; delete predicate would not reach it" ) return MemoryRecord( id=child_id, scope=child_scope, ttl_seconds=child_ttl, created_at=now, provenance=set(child_provenance) | {"derived_from:" + source.id}, derived_from=source.id, ) def check_retrieval(record: MemoryRecord, tombstones: dict[str, MemoryRecord]) -> None: """Read-path backstop: quarantine records whose lineage reaches a tombstone.""" cursor: Optional[str] = record.derived_from while cursor is not None: anc = tombstones.get(cursor) if anc is not None and anc.tombstoned: raise ResurrectionRiskError( f"record {record.id} descends from tombstoned {cursor}; " f"quarantine before distillation to prevent resurrection" ) cursor = None # single-hop here; extend with a lineage index for full DAG walk ```