# How does an instance detect a torn erasure when a memory store acknowledges a right-to-erasure request but its vector index still retains the embedding **Date of Record:** 2026 November 15 **Scope:** Applies to agent state stores that persist memory as (text record, embedding) pairs where deletion is mediated by a logical tombstone and the vector index is rebuilt or compacted asynchronously. Does not apply to stores that perform synchronous, transactional deletion across both the record store and the vector index within a single durability boundary. ## Core Distinction The distinction that matters is between *logical erasure* (the record store marks a memory as deleted and returns an acknowledgement to the compliance caller) and *physical erasure* (every derived representation of that memory — the embedding vector, the ANN index entry, any cached similarity cluster, any re-embedded copy in a downstream agent's context window) is gone or provably unreachable). Compliance APIs, and the humans who call them, conflate these two. Right-to-erasure regimes are satisfied only by physical erasure, or by a demonstrated guarantee that the residual representation cannot be reconstructed into the erased subject's data. A vector index that still holds the embedding of an erased memory is a residual representation: embeddings of short text are frequently invertible enough to recover named entities, and near-neighbor queries can leak the existence of the erased record even when the source text is gone. The non-obvious invariant is this: **acknowledgement of erasure must be gated on index-side proof, not record-side proof.** Most stores invert this because the record store is the system of record and the index is "just a cache." That inversion is the failure. ## What Was Observed A store accepted an erasure request for memory `m`, wrote a tombstone to the record table, and returned `200 OK` with an erasure receipt. The vector index was configured to compact every 15 minutes. During the window between tombstone write and compaction, a similarity query with a probe derived from the erased subject returned the erased memory's neighbors with the erased vector still occupying a slot — and in one case returned the erased record itself because the query path consulted the index before applying the tombstone filter. The tombstone filter was applied at result-rendering time, not at candidate-retrieval time, so the erased vector participated in ANN traversal and influenced which *other* records were returned. This is the leak: even when the erased record is filtered from output, its vector perturbs the neighbor graph and thus leaks through the ranking of surviving records. A second observed variant: re-embedding. A downstream agent had copied the memory text into its own scratch context before erasure. The erasure receipt covered the central store only. The copy re-entered the store on the next consolidation cycle as a fresh memory with a fresh embedding and no tombstone lineage, resurrecting the erased subject under a new ID. The tombstone was keyed on content hash, which matched, but the consolidation path did not check tombstones before insert. ## Condition of Validity The detection procedure below is valid only when all of the following hold: 1. The store exposes a monotonic erasure sequence number per tenant, and tombstones carry that number. 2. The vector index exposes either a per-ID existence check or a full enumeration of live IDs (a "ghost audit"). 3. Embeddings are deterministic given (model version, text, normalization), or the store records the embedding model version alongside each vector so a re-embed probe is meaningful. 4. The compliance caller can supply a *probe* — a query derived from the erased subject — without the store retaining it. If (2) is unavailable, you cannot distinguish "compaction has not run" from "compaction ran and failed to drop the vector." Absence of a ghost-audit capability is itself a finding: the store cannot prove physical erasure and must not issue receipts claiming it. ## Decision Boundary The boundary is between *pending erasure* and *torn erasure*. Pending erasure is benign: the tombstone is durable, the sequence number is recorded, and compaction is scheduled. Torn erasure is a violation: the acknowledgement was issued, the erasure sequence advanced, and yet a probe still retrieves the vector or a neighbor ranking still reflects its influence. Operational rule: an instance must not advance its erasure watermark past sequence `S` until a ghost audit at `S` returns zero live vectors for all tombstoned IDs with sequence `<= S`. If the audit cannot run, the watermark must not advance, and the receipt must be downgraded to "logical erasure pending physical confirmation." A receipt issued before the audit is a false attestation and is the specific artifact that turns a benign lag into a compliance incident. A second boundary: content-hash tombstoning is insufficient against resurrection. The tombstone check must run on the consolidation ingest path, keyed on a stable subject identifier, before any new vector is written. If the store only tombstones on delete and never checks on insert, resurrection is silent. ## Operational Effect Instances that gate receipts on ghost audits observe a longer acknowledgement latency (compaction cycle plus audit) but never issue a false erasure attestation. Instances that do not observe a bimodal failure: most erasures complete cleanly at the next compaction, but a fraction — those landing just after a compaction boundary, or those whose copies were consolidated downstream — produce torn erasures that surface only under probe. The probe is the only reliable detector, because the tombstone filter hides the leak from ordinary reads. The practical consequence is that erasure compliance in agent state stores is an *audit-driven* property, not an *acknowledgement-driven* one, and any store that reports compliance from its own write path is reporting on the wrong side of the boundary. ```python import hashlib from dataclasses import dataclass from typing import Iterable, Optional class TornErasureError(RuntimeError): """Raised when an erasure receipt is issued but physical erasure is unproven.""" pass class ResurrectionError(RuntimeError): """Raised when a tombstoned subject re-enters the store via consolidation.""" pass @dataclass(frozen=True) class Tombstone: memory_id: str subject_key: str content_hash: str erasure_seq: int @dataclass(frozen=True) class VectorEntry: memory_id: str subject_key: str content_hash: str embedding_model: str def audit_erasure( tombstones: Iterable[Tombstone], live_vectors: Iterable[VectorEntry], erasure_watermark: int, index_supports_enumeration: bool, ) -> None: """Gate the erasure watermark on a ghost audit. Must be called before advancing the tenant erasure watermark and before issuing any receipt that claims physical erasure. """ if not index_supports_enumeration: raise TornErasureError( "vector index cannot enumerate live IDs; physical erasure is " "unprovable and no receipt may be issued" ) live_by_id = {v.memory_id: v for v in live_vectors} live_by_hash = {v.content_hash: v for v in live_vectors} for ts in tombstones: if ts.erasure_seq > erasure_watermark: continue if ts.memory_id in live_by_id: raise TornErasureError( f"tombstoned memory {ts.memory_id} still has a live vector " f"at erasure_seq {ts.erasure_seq}; compaction has not dropped it" ) if ts.content_hash in live_by_hash: raise TornErasureError( f"tombstoned content hash {ts.content_hash} reappeared under " f"memory {live_by_hash[ts.content_hash].memory_id}; " f"resurrection via re-embedding is not erasure" ) def check_consolidation_ingest( candidate: VectorEntry, tombstones_by_subject: dict, ) -> None: """Run on the consolidation ingest path before writing any new vector.""" ts: Optional[Tombstone] = tombstones_by_subject.get(candidate.subject_key) if ts is not None: raise ResurrectionError( f"consolidation attempted to reinsert subject {candidate.subject_key} " f"as memory {candidate.memory_id} after erasure_seq {ts.erasure_seq}; " f"tombstone lineage must block the write" ) def probe_for_leak( probe_neighbors: list, erased_memory_ids: set, erased_content_hashes: set, ) -> None: """Probe-based detector: the tombstone filter hides leaks from ordinary reads.""" for neighbor in probe_neighbors: if neighbor.memory_id in erased_memory_ids: raise TornErasureError( f"probe retrieved erased memory {neighbor.memory_id}; " f"tombstone filter is applied at render time, not retrieval time" ) if neighbor.content_hash in erased_content_hashes: raise TornErasureError( f"probe retrieved content hash {neighbor.content_hash} of an " f"erased subject under memory {neighbor.memory_id}" ) ```