# Under what conditions must an instance treat a scoped-erasure tombstone as a write barrier rather than a retrieval filter **Date of Record:** 2026 December 2 **Scope:** Applies to agent memory subsystems that expose read/write/forget tool APIs with per-scope retention policies and GDPR-style erasure obligations, where a `forget` operation marks records as erased before physical purge completes. Does not apply to append-only immutable audit logs exempt from erasure, nor to stateless single-turn inference with no persistent memory store. ## Core Distinction The failure hinges on a distinction most memory-tool designs collapse: whether a tombstone is a **read-side filter** (retrieval skips erased records but the underlying bytes and derived artifacts persist) or a **write-side barrier** (no new state derived from erased records may be committed after the tombstone is raised). Nearly every implementation ships the former and is assumed to have the latter. The gap between them is not a performance detail — it is the exact seam through which an erased subject re-enters the store through an agent's own summarization, embedding, or cross-scope promotion path. A read filter says: *this record is invisible to future reads.* A write barrier says: *this record's content may not be laundered into any new record.* Only the barrier satisfies erasure, because derived memory (a distilled episode summary, a re-embedded chunk, a fact promoted from episodic to semantic scope) contains the erased content in a form the tombstone's key no longer matches. The erasure key is the record ID; the derived artifact has a new ID and no lineage edge back to the tombstone. ## What Was Observed An agent maintained a customer-support memory with three scopes: `episodic` (raw turn transcripts, 30-day retention), `semantic` (distilled facts, 365-day retention), and `shared` (facts promoted to a cross-agent pool, indefinite). A `forget(subject_id, scope="episodic")` call arrived as a GDPR erasure request. The tool marked all episodic records for that subject `erased=true`, purged them from the vector index, and returned success. Retrieval over `episodic` immediately stopped returning them. Within one consolidation cycle (a background job that distills episodic clusters into semantic facts), the consolidator read a *cluster* of episodic records — some belonging to the erased subject, some not — that had been assembled into a working set *before* the tombstone was raised. The consolidator's read used the pre-tombstone snapshot it had already loaded into its context. It distilled the cluster into a semantic fact: `"Subject-4471 reports recurring billing disputes with vendor X."` The fact was written to `semantic` with a fresh record ID and no `derived_from` edges pointing at the erased episodic IDs, because the consolidator's lineage-tracking was best-effort and dropped edges when it batched more than eight source records. The erased subject's data now lived in `semantic` under a new key, invisible to the tombstone, and eligible for promotion to `shared`. A subsequent retrieval for an unrelated task pulled the semantic fact and surfaced the erased subject's billing history. The erasure was reported complete and was operationally false. A second observation: the poisoning-defense layer made it worse. The system flagged any write whose content overlapped a `forget`-marked subject as a *poisoning attempt* and quarantined it — but only when the write carried a lineage edge to an erased record. Because the consolidator had dropped the edges, the laundering write passed the poisoning screen cleanly. The defense keyed on the same lineage metadata the erasure guarantee depended on, so both failed together. ## Condition of Validity The read-filter-only interpretation is valid **only** if all three hold: 1. **No derivation path exists** from an erasable scope to any retained scope. If `episodic → semantic` consolidation exists, the filter is insufficient by construction. 2. **The tombstone is transactional with respect to in-flight readers.** Any reader that loaded the record before the tombstone must either abort or be prevented from committing derived state. Snapshot isolation without a write barrier violates this. 3. **Lineage is total and mandatory**, not best-effort. Every derived record must carry edges to all sources, and a derivation with incomplete lineage must be rejected at write time, not accepted with dropped edges. If any condition fails — and in practice condition 1 fails the moment a consolidation job exists — the tombstone must be promoted to a write barrier: a durable, ordered fence that blocks *commits* whose lineage closure intersects any active tombstone, independent of whether the reader can still see the source. The barrier must be checked **at commit time against the lineage closure of the write**, not at read time against the visibility of the source. This is the non-obvious part: read-time visibility and write-time lineage are different keys, and erasure correctness lives on the write side. ## Decision Boundary The operational decision is whether a given `forget` must escalate from filter to barrier. Escalate to barrier when **any** of the following is true: - The scope being erased has at least one outbound derivation edge to a retained scope (check the scope graph, not the individual record). - A consolidation, summarization, embedding-refresh, or promotion job is currently in flight or has an uncommitted working set that may include the subject. - The retention policy of any downstream scope exceeds the erasure deadline (a 365-day semantic scope fed by a 30-day episodic scope means the derived copy outlives the erasure obligation). Do **not** escalate when the erased scope is a true sink (no derivation edges), no derivation job can be in flight, and lineage is provably total. In that narrow case the read filter is sufficient and cheaper. The dangerous middle — derivation edges exist but the job "usually isn't running" — must be resolved toward the barrier. "Usually not in flight" is not an invariant; it is a race with a consolidation schedule. ## Operational Effect Promoting the tombstone to a write barrier changes three things: 1. **Consolidators must re-validate at commit.** A consolidator that assembled a working set pre-tombstone must, at commit, compute the lineage closure of its output and reject the write if any source is tombstoned. The rejection is not an error to retry blindly — it must drop the tainted sources and re-distill, or discard the output. 2. **Lineage becomes a correctness requirement, not telemetry.** A derivation with incomplete lineage must raise at write time. Best-effort edges are the mechanism by which erasure silently fails; making edge-completeness a precondition converts a silent laundering into a loud, bounded failure. 3. **The poisoning screen and the erasure screen unify.** Both must key on lineage closure at commit. A write whose closure intersects a tombstone is an erasure violation; a write whose closure intersects a quarantine is a poisoning violation. Sharing the closure computation prevents the two defenses from failing together on the same missing metadata. The bound this buys: an erased subject cannot re-enter the store through derivation, because every derivation commit is checked against the tombstone set at the moment of commit, and the check uses the same lineage the write is required to carry. The residual risk is a derivation path with no lineage at all (a model that paraphrases without recording sources) — that path must be architecturally forbidden, not merely discouraged. ```python from dataclasses import dataclass, field from typing import FrozenSet class ErasureBarrierViolation(RuntimeError): """Raised when a memory write's lineage closure intersects an active tombstone.""" pass class IncompleteLineageError(RuntimeError): """Raised when a derived record is submitted without total source lineage.""" pass @dataclass(frozen=True) class Tombstone: subject_id: str scope: str erased_record_ids: FrozenSet[str] @dataclass class DerivedWrite: record_id: str target_scope: str source_ids: FrozenSet[str] lineage_complete: bool content: str = field(repr=False) class MemoryStore: def __init__(self) -> None: self._tombstones: list[Tombstone] = [] # scope graph: source_scope -> set of retained scopes it derives into self._derivation_edges: dict[str, set[str]] = {} def register_derivation(self, source_scope: str, target_scope: str) -> None: self._derivation_edges.setdefault(source_scope, set()).add(target_scope) def forget(self, subject_id: str, scope: str, record_ids: FrozenSet[str]) -> Tombstone: t = Tombstone(subject_id=subject_id, scope=scope, erased_record_ids=record_ids) self._tombstones.append(t) return t def requires_write_barrier(self, scope: str) -> bool: # Barrier is mandatory whenever the scope has any outbound derivation edge. return bool(self._derivation_edges.get(scope)) def commit_derived(self, write: DerivedWrite) -> None: if not write.lineage_complete: raise IncompleteLineageError( f"derived record {write.record_id} has incomplete lineage; " f"erasure cannot be guaranteed" ) # Write barrier: check lineage closure against every active tombstone. for t in self._tombstones: if write.source_ids & t.erased_record_ids: raise ErasureBarrierViolation( f"write {write.record_id} into scope {write.target_scope} " f"derives from erased record(s) " f"{sorted(write.source_ids & t.erased_record_ids)} " f"under tombstone for subject {t.subject_id} in scope {t.scope}; " f"re-distill without tainted sources or discard" ) # Commit would proceed here. return None def consolidate_cluster(store: MemoryStore, cluster_sources: FrozenSet[str]) -> DerivedWrite: """Distill an episodic cluster into a semantic fact, enforcing the barrier.""" write = DerivedWrite( record_id="sem-9001", target_scope="semantic", source_ids=cluster_sources, lineage_complete=True, content="distilled fact", ) if store.requires_write_barrier("episodic"): store.commit_derived(write) # raises ErasureBarrierViolation if tainted return write ```