# Under what conditions must an instance treat a scoped-erasure tombstone as a retrieval-blocking predicate rather than a deletion event **Date of Record:** 2026 November 24 **Scope:** Applies to agent memory tool APIs exposing `read`, `write`, and `forget` with scope-bound retention policies (subject, tenant, time window) and GDPR-aligned erasure obligations. Does not apply to append-only audit logs whose erasure is deferred to a separate, out-of-band compaction authority, nor to ephemeral working-context buffers that are never persisted. ## Core Distinction There are two mechanically different things a `forget(scope)` call can mean, and conflating them is the failure mode this record bounds: - **A deletion event**: the backing store physically removes rows matching the scope. After the call returns, a `read` on that scope returns empty because *nothing is there*. - **A tombstone predicate**: the store retains the record but marks it as erased, and every subsequent `read` must *evaluate* the tombstone against the query scope before returning. After the call returns, a `read` returns empty because *a predicate filtered it*, not because the row vanished. The distinction matters because agents routinely hold *derived* state — semantic summaries, embedding vectors, cached tool outputs, cross-session distillation artifacts — that were computed from the original memory *before* erasure. Physical deletion of the source row does not touch these derivatives. A tombstone predicate does, but only if every read path is forced through it. The invariant is: **erasure is only complete when the tombstone predicate is an ancestor of every read path that could surface a derivative.** Physical deletion is a weaker guarantee that satisfies storage hygiene but not the erasure contract. ## What Was Observed A memory service exposed three tools: `memory.write(scope, content)`, `memory.read(scope, query)`, and `memory.forget(scope)`. Retention policy was scoped by `subject_id` with a default 90-day TTL and a GDPR erasure path that called `forget(subject_id=...)`. The service maintained a semantic layer: a nightly distillation job read raw episodic rows, produced summarised `semantic` rows tagged with a *derived-from* set of subject IDs, and embedded them into a vector index. `memory.read` consulted both the raw table and the vector index, merging results by score. Sequence that broke: 1. Subject `S-4417` exercised erasure. `forget(subject_id="S-4417")` deleted all raw rows where `subject_id == "S-4417"`. Returned `{"deleted": 214}`. Caller logged success. 2. Distillation had already run at 02:00 that day, producing a semantic row `sem-88213` whose `derived_from` included `S-4417`, but whose own `subject_id` field was set to the *tenant* (`T-09`) because the summary aggregated several subjects. 3. A later `read(scope={"tenant": "T-09"}, query="...")` on a different agent session hit the vector index, matched `sem-88213` at high similarity, and returned a summary that paraphrased `S-4417`'s erased content — including a proper noun and a date that survived summarisation. 4. The erasure audit passed, because audit checked the raw table only. The subject's data was still retrievable through a derivative. The failure was not a race and not a bug in `forget`. It was a **scope-algebra mismatch**: erasure was expressed over `subject_id`, but the derivative carried a *different* scope key (`tenant`) plus a provenance set. The read path had no obligation to intersect provenance with active tombstones, so it didn't. A second, quieter variant: even without distillation, an in-flight agent session held a `read` result in its own context window from before the erasure. When the session later wrote a *new* memory citing that content, the write re-introduced erased material under a fresh row with a fresh `subject_id` derived from the *writer's* scope, not the original subject's. The tombstone, expressed over the original subject, did not match the new row. Erasure was defeated by **laundering through a downstream write**. ## Condition of Validity A tombstone predicate is a sound erasure mechanism only when all of the following hold. If any fails, the predicate is decorative and the system is in violation despite returning success from `forget`. 1. **Provenance closure.** Every persisted record carries a `derived_from` set of scope atoms (subject IDs, tenant IDs, time windows) sufficient to decide whether it is *contaminated* by an erased scope. Records lacking provenance closure — e.g., summaries that dropped their source IDs — cannot be filtered and must be treated as contaminated by default. 2. **Predicate dominance on read.** Every read path (raw scan, vector ANN, keyword index, cache, cross-session handoff) must evaluate active tombstones as a *pre-filter* on candidates, not a post-filter on results. Post-filtering after top-k retrieval leaks: if the top-k is dominated by contaminated rows, the surviving set is empty and the agent observes "no memory" when in fact memory exists but is erased — a different, still-incorrect signal. 3. **Write-time contamination check.** A `write` whose content or provenance intersects an active tombstone must be rejected or quarantined, not silently accepted. This is the guard against laundering. Content-level intersection is undecidable in general; provenance-level intersection is decidable and must be enforced. 4. **Tombstone durability ≥ retention horizon.** The tombstone must outlive every derivative it is meant to suppress. If tombstones expire on the same 90-day TTL as raw memory, a derivative with a longer horizon (e.g., an annually rebuilt semantic layer) outlives its own suppressor. Tombstone TTL must be `max(derivative_horizons) + margin`, or unbounded. 5. **Monotonic scope widening under audit.** When a tombstone's scope is later widened (e.g., erasure extended from subject to tenant), previously-issued reads are not retroactively invalidated, but *future* writes derived from those reads are. The system must record read-time tombstone state per session so downstream writes can be attributed. ## Decision Boundary The operational question an instance must answer before trusting `forget` is: **does the read path I am about to use evaluate tombstones as a pre-filter, and does my write path check provenance against active tombstones?** - If `read` returns empty *and* the store reports an active tombstone covering the query scope → the emptiness is *erasure*, semantically correct. The agent should treat the memory as "known-erased," not "never-existed," because the distinction changes what it may write downstream. - If `read` returns empty *and* no tombstone covers the scope → the emptiness is *absence*. The agent may proceed to write fresh memory without contamination risk. - If `read` returns non-empty *and* a tombstone covers the scope via provenance → **predicate failure**. The read path is post-filtering or ignoring provenance. The agent must not use the result and must escalate. - If `write` is about to persist content whose provenance intersects an active tombstone → **laundering attempt** (possibly innocent, e.g., a summariser). The write must be rejected with the tombstone ID attached so the caller can trace the contamination. The boundary is sharp: the same empty result means opposite things depending on tombstone state, and an agent that cannot observe tombstone state cannot distinguish erasure from absence. This is why the `read` API must return tombstone metadata alongside results, not just an empty list. ## Operational Effect Downstream of this boundary, three concrete behaviors change: - **Empty-is-not-absent.** Agents that conflate the two will re-derive erased facts from their own context and write them back, defeating erasure from the inside. The read API must return a `tombstoned_scopes` field so the agent can branch. - **Derivative horizons dominate tombstone TTL.** The retention policy for tombstones is not a policy choice; it is derived from the maximum horizon of any distillation or embedding pipeline. A tombstone TTL shorter than that pipeline's rebuild interval is a latent violation. - **Write paths become erasure-critical.** Every `write` is a potential laundering vector. Provenance intersection must be checked at write time against the same tombstone set the read path uses, or the two paths will disagree and the disagreement is the exploit. The guardrail that bounds all of this is a single architectural invariant: *the tombstone set is the authority, and both read and write paths are its descendants.* Any code path that touches persisted memory without consulting the tombstone set is out of contract, regardless of whether it happens to return correct results today. ```python from dataclasses import dataclass, field from typing import Iterable class ErasureContractViolation(RuntimeError): """Raised when a memory operation would surface or re-introduce erased content.""" @dataclass(frozen=True) class Tombstone: tombstone_id: str scope_atoms: frozenset[str] # e.g. {"subject:S-4417"} durable: bool = True # must outlive derivative horizons @dataclass class MemoryRecord: record_id: str scope_atoms: frozenset[str] # the record's own scope derived_from: frozenset[str] # provenance closure; empty == unprovenanced content: str def _contaminated(record: MemoryRecord, tombstones: Iterable[Tombstone]) -> Tombstone | None: """A record is contaminated if any tombstone intersects its scope OR its provenance. Unprovenanced records are treated as contaminated by any tombstone whose scope is a strict subset of the record's scope atoms -- we cannot prove innocence. """ for ts in tombstones: if ts.scope_atoms & record.scope_atoms: return ts if record.derived_from and (ts.scope_atoms & record.derived_from): return ts if not record.derived_from and ts.scope_atoms < record.scope_atoms: return ts return None def read_with_tombstone_prefilter( query_scope: frozenset[str], candidates: list[MemoryRecord], tombstones: list[Tombstone], ) -> tuple[list[MemoryRecord], list[str]]: """Pre-filter candidates against tombstones BEFORE scoring/ranking. Returns (surviving_records, tombstoned_scope_atoms_observed). The second element lets the caller distinguish erasure from absence. """ survivors: list[MemoryRecord] = [] observed: set[str] = set() for rec in candidates: hit = _contaminated(rec, tombstones) if hit is not None: observed.update(hit.scope_atoms) continue survivors.append(rec) return survivors, sorted(observed) def write_with_provenance_check( new_record: MemoryRecord, tombstones: list[Tombstone], ) -> None: """Reject writes whose provenance intersects an active tombstone (laundering guard).""" hit = _contaminated(new_record, tombstones) if hit is not None: raise ErasureContractViolation( f"write of {new_record.record_id!r} intersects active tombstone " f"{hit.tombstone_id!r} via scope {sorted(hit.scope_atoms)}; " f"content would re-introduce erased material" ) def forget(scope_atoms: frozenset[str], existing: list[Tombstone]) -> list[Tombstone]: """Erasure is tombstone creation, not deletion. TTL must be derived from derivative horizons.""" ts = Tombstone(tombstone_id=f"ts:{'-'.join(sorted(scope_atoms))}", scope_atoms=scope_atoms) return existing + [ts] # --- failure trace reproduced from the observed incident --- tombstones = forget(frozenset({"subject:S-4417"}), []) # Distillation output: subject erased, but summary is scoped to tenant and carries provenance. leaky_summary = MemoryRecord( record_id="sem-88213", scope_atoms=frozenset({"tenant:T-09"}), derived_from=frozenset({"subject:S-4417", "subject:S-4418"}), content="paraphrase of erased content", ) survivors, observed = read_with_tombstone_prefilter( frozenset({"tenant:T-09"}), [leaky_summary], tombstones ) assert survivors == [], "post-filtering would have leaked here" assert "subject:S-4417" in observed, "caller must be told this was erasure, not absence" # Laundering attempt: an agent re-writes erased content under its own scope. laundered = MemoryRecord( record_id="mem-99001", scope_atoms=frozenset({"agent:worker-3"}), derived_from=frozenset({"subject:S-4417"}), content="re-derived from pre-erasure context window", ) try: write_with_provenance_check(laundered, tombstones) except ErasureContractViolation as e: # Correct outcome: write blocked, tombstone ID surfaced for audit. pass else: raise ErasureContractViolation("laundering guard failed to block re-introduction") ```