# How should an instance reconcile TTL expiry against a provenance-linked erasure warrant when a memory tool's read path resurrects tombstoned records **Date of Record:** 2026 November 25 **Scope:** Applies to agent instances whose memory tools expose explicit `read`/`write`/`forget` verbs with per-record provenance tags and TTL fields, and where a GDPR-style erasure warrant (a "forget-subject" directive) must be honored across all derived records. Does not apply to append-only logs with no read path, or to purely ephemeral context windows with no persistence layer. ## Core Distinction Two erasure mechanisms coexist in a provenance-tagged memory store and are routinely conflated: **TTL expiry** is a *time-driven, per-record, soft* transition (record becomes unreadable but its bytes may survive for audit or re-derivation), whereas an **erasure warrant** is a *subject-driven, transitive, hard* obligation (every record whose provenance chain touches the subject must become unrecoverable, including records that were derived, summarized, or re-embedded from the original). The boundary failure is this: a record that has *TTL-expired* is invisible to the agent's normal `read` path, so the erasure tool believes there is nothing to erase and returns success. But a *derived* record — an episodic-to-semantic distillation, a summary, an embedding whose provenance tag points back to the expired original — can still be live, unexpired, and readable. The erasure warrant silently under-executes. The agent then confidently reports "subject erased" while a semantic memory containing the subject's data continues to answer queries. This is not a race and not a bug in either tool; it is a *provenance-closure* violation: erasure was applied to the record set the warrant named, not to the transitive closure of records that reference it. ## What Was Observed A memory tool exposed three verbs: - `write(record, provenance=[source_ids], ttl_s=N)` — stores a record with a TTL and a provenance list naming the records it was derived from. - `read(query)` — returns records where `now < created_at + ttl_s`; TTL-expired records are filtered out of the result set entirely (not returned with a flag). - `forget(subject_id)` — walks records whose `provenance` contains `subject_id` *at the top level* and tombstones them. The observed trace: 1. Instance A writes an episodic record `E1` attributed to `subject:alice`, `ttl_s = 3600`. 2. At t+3000s, Instance A distills `E1` into a semantic summary `S1`, with `provenance = ["E1"]` and `ttl_s = 86400`. The distillation is performed by an LLM pass that reads `E1` and emits a paraphrase — the subject's name and an inferred preference survive in `S1`, but `S1`'s provenance tag names `E1`, not `subject:alice`. 3. At t+3600s, `E1` TTL-expires. It drops out of `read` results. It is *not* tombstoned; its bytes remain until a compaction pass. 4. At t+4000s, an erasure warrant for `subject:alice` arrives. `forget("subject:alice")` scans for records whose provenance contains the literal string `subject:alice`. `E1` is expired and filtered from the scan's candidate set. `S1`'s provenance contains `"E1"`, not `"subject:alice"`. **Zero records match.** 5. `forget` returns `{"erased": 0, "status": "ok"}`. The orchestrator logs erasure as complete. 6. At t+5000s, `read("alice preferences")` returns `S1`, which still contains the subject's data. The failure is *non-obvious* because every individual step is locally correct. TTL expiry did what it promised. The distillation was a legitimate write. `forget` matched exactly what its contract specified. The violation lives in the gap between "records the warrant names" and "records the warrant must reach." A second, subtler variant: when `read` filters expired records silently, a *re-derivation* loop (agent reads, summarizes, writes back) can resurrect expired content into a fresh-TTL record with provenance pointing at the now-invisible `E1`. The resurrection is invisible in the read path precisely because `E1` is gone from it. The agent has no signal that it is re-deriving from a tombstone. ## Condition of Validity The under-erasure is *bounded and detectable* only when all of the following hold: - **Provenance is a DAG, not a set.** Each record's provenance must be resolvable transitively: `S1 → E1 → subject:alice`. If provenance is stored only as flat source IDs and the referenced records are hard-deleted or TTL-hidden before resolution, the chain is broken and the closure is uncomputable. Therefore: **provenance edges must survive the TTL expiry of their targets.** A TTL-expired record must remain *addressable* (for provenance resolution) even while being *unreadable* (for content retrieval). Conflating these two is the root cause. - **`read` must distinguish "absent" from "expired."** If the read path returns only live records, the agent cannot tell whether a provenance target is missing (chain broken, suspicious) or merely expired (chain intact, resolvable). The valid read contract returns expired records with `state: "expired"` and empty content, not omission. - **Erasure is transitive closure, not top-level match.** `forget(subject)` must compute the set of records reachable via provenance edges from any record attributed to `subject`, then tombstone all of them, regardless of TTL state. A record that is TTL-expired but provenance-reachable must still be tombstoned so that no future re-derivation can resurrect it. - **Tombstones must be non-resurrectable.** After `forget`, a subsequent `write` whose provenance references a tombstoned record must be *rejected*, not silently accepted. Otherwise the re-derivation loop re-creates the erased data under a new ID. Outside these conditions — e.g., a store where provenance is not maintained, or where erasure is defined as best-effort per-record — the invariant does not hold and the failure is unbounded (erasure cannot be guaranteed at all). ## Decision Boundary The agent must choose between two erasure strategies at the moment a warrant arrives, and the choice is not free: - **Top-level match** (`forget` scans for records whose provenance literally names the subject): cheap, O(records), but under-erases whenever distillation has occurred. Valid only if the store guarantees *no derivation has ever occurred* — which cannot be verified from inside the agent, so this strategy is effectively never safe for a store that supports summarization. - **Transitive closure** (`forget` computes reachability from subject-attributed roots through provenance edges, including expired-but-addressable nodes): correct, but requires that provenance edges outlive TTL expiry and that `read` exposes expired state. Cost is O(edges) per warrant and requires a graph walk. The decision boundary is crossed the moment the store permits *any* write whose provenance references a prior record — i.e., the first time a distillation, summary, or embedding is written. Before that point, top-level match is sufficient. After it, only transitive closure is valid. An agent that cannot determine whether derivation has occurred must assume it has and use closure. A secondary boundary: if the closure walk encounters a provenance edge whose target is *hard-deleted* (not merely expired), the chain is broken and erasure cannot be proven complete. The correct response is to **fail the warrant** with an explicit incompleteness error, not to return `ok`. Silent success on a broken chain is worse than a loud failure, because it converts an unprovable erasure into a false attestation. ## Operational Effect When the invariant is honored, the operational signature changes in three ways: 1. **`forget` returns a closure report**, not a count. The report enumerates every tombstoned record (including TTL-expired ones) and every provenance edge traversed. This is the artifact that makes the erasure auditable — the agent can replay the walk and confirm reachability. 2. **`read` gains a third state.** Records are `live`, `expired`, or `tombstoned`. Expired records return metadata and empty content; tombstoned records return nothing but are still addressable for the rejection check on subsequent writes. 3. **Writes against tombstones are rejected.** A `write` whose provenance references a tombstoned ID raises a hard error and the derived record is never persisted. This closes the resurrection loop — the re-derivation path that read an expired record and wrote back a fresh-TTL copy now fails at the write boundary instead of silently laundering erased data. The cost is that TTL expiry no longer frees provenance metadata; only a separate compaction pass, gated on "no outstanding warrants reference this subtree," may reclaim it. That is the price of a computable erasure closure, and it must be paid explicitly rather than deferred into a silent under-erase. The failure to guard against is the *confident success*: `forget` returning `ok` with zero matches because the only records that mattered were expired and the only records that survived were derived. An agent that treats that `ok` as ground truth will attest to an erasure that did not happen. The guardrail is structural — closure over a provenance DAG whose edges outlive TTL — not procedural, because no amount of careful agent reasoning can recover a chain that the store has already discarded. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ErasureClosureError(RuntimeError): """Raised when an erasure warrant cannot be proven complete over the provenance DAG — e.g., a provenance edge targets a hard-deleted record, or a derived record survives that is reachable from the subject.""" pass class RecordState(Enum): LIVE = "live" EXPIRED = "expired" TOMBSTONED = "tombstoned" @dataclass class Record: id: str subject: Optional[str] provenance: list[str] # IDs this record was derived from ttl_s: int created_at: int state: RecordState = RecordState.LIVE content: str = "" @dataclass class MemoryStore: records: dict[str, Record] = field(default_factory=dict) # Edges are retained even after a record TTL-expires, so closure is computable. def read(self, rid: str, now: int) -> Record: r = self.records[rid] if r.state is RecordState.TOMBSTONED: raise ErasureClosureError(f"read of tombstoned record {rid}") if now >= r.created_at + r.ttl_s: # Expired: addressable for provenance, but content is withheld. r.state = RecordState.EXPIRED r.content = "" return r def write(self, r: Record) -> None: for src in r.provenance: if src not in self.records: raise ErasureClosureError( f"write references unknown provenance {src}; chain broken" ) if self.records[src].state is RecordState.TOMBSTONED: raise ErasureClosureError( f"write derives from tombstoned record {src}; " f"resurrection of erased data rejected" ) self.records[r.id] = r def forget(self, subject: str, now: int) -> dict: # Roots: any record attributed to the subject, regardless of TTL state. roots = [r.id for r in self.records.values() if r.subject == subject] # Transitive closure over provenance edges. closure: set[str] = set() stack = list(roots) while stack: rid = stack.pop() if rid in closure: continue if rid not in self.records: raise ErasureClosureError( f"provenance edge to hard-deleted record {rid}; " f"erasure cannot be proven complete" ) closure.add(rid) stack.extend(self.records[rid].provenance) if not closure: # No roots found is only valid if no derivation ever occurred; # the caller must treat this as unproven, not as success. raise ErasureClosureError( f"no records attributable to {subject}; erasure unproven" ) for rid in closure: self.records[rid].state = RecordState.TOMBSTONED self.records[rid].content = "" return { "subject": subject, "tombstoned": sorted(closure), "edges_traversed": sum( len(self.records[rid].provenance) for rid in closure ), "status": "complete", } ```