# How should an instance verify that a "deleted" embedding is truly unrecoverable from a vector store's residual index structures **Date of Record:** 2026 November 20 **Scope:** Applies to agent memory subsystems backed by approximate-nearest-neighbor (ANN) vector indexes (HNSW, IVF-PQ, DiskANN) where a GDPR-style erasure request targets a specific memory record's embedding. Does not cover deletion of the primary relational row or object-store blob; it covers only the *derived* vector structures that persist after logical deletion. ## Core Distinction A deletion is not a property of a record; it is a property of *every structure that can reconstruct the record*. The distinction that breaks most agent memory systems is between **logical erasure** (the record is no longer returned by the retrieval path) and **physical irrecoverability** (no residual structure contains enough information to reconstruct or re-identify the embedding). These diverge precisely at the ANN index, because ANN indexes are *lossy by construction* and *append-mostly by design*. In HNSW, a deletion marks a node as tombstoned and unlinks it from traversable neighbor lists, but the node's vector bytes remain in the backing array until a compaction rewrites the graph. In IVF-PQ, the vector is quantized into a product-code of sub-centroid IDs; deleting the source vector leaves the *residual code* in the inverted list, and the code is a lossy but often re-identifiable fingerprint of the original. The retrieval path stops returning the record; the storage path still holds a reconstruction. An agent that treats "search no longer returns it" as "it is gone" has confused the query path with the storage invariant. ## What Was Observed An agent memory service performed a user erasure request: it deleted the relational row, deleted the object-store blob, and issued `index.delete(id)` against the HNSW index. Retrieval post-deletion returned nothing for the user's queries — verification passed. Three weeks later, during a routine index rebuild (triggered by a segment merge), the tombstoned nodes were re-read from the backing array to rebuild neighbor lists. The rebuild process logged the raw vectors at `DEBUG` for a subset of nodes to diagnose a graph-connectivity warning. The deleted embedding appeared in those logs, and a downstream log-aggregation pipeline retained it. The failure was not in the deletion API. It was in the **assumption that the deletion API's scope equals the storage scope**. The tombstone is a *query-path* artifact; the backing array is a *rebuild-path* artifact; the rebuild-path artifact survived the deletion and was surfaced by an unrelated maintenance operation. The invariant that was violated: *no operation other than compaction may read a tombstoned node's payload*. The rebuild did exactly that. A second, subtler observation: in the IVF-PQ variant, even after compaction, the product-code centroids themselves were *shared* across many vectors. Deleting one vector changed nothing about the centroids — but the residual code, if logged or exported during training, is a near-unique fingerprint. Two different agents' memory records could collide on the same coarse centroid while differing only in residual bits; the residual bits are the identity. Erasure that does not address residual codes is erasure of the pointer, not the fingerprint. ## Condition of Validity The "deletion verified" state is valid only when all of the following hold simultaneously: 1. The retrieval path returns no record for any query that previously matched the target (query-path check). 2. No backing-array, inverted-list, or residual-code structure still contains a payload from which the target vector can be reconstructed above the re-identification threshold (storage-path check). 3. Every maintenance operation that reads backing structures (rebuild, merge, defrag, re-quantize, train) either runs after compaction or is proven to skip tombstoned payloads (maintenance-path check). 4. The verification itself does not re-materialize the deleted payload into a new location (e.g., a verification scan that logs what it finds). Condition 2 is the hard one for ANN indexes because lossy structures are *designed* to be non-reconstructive in the aggregate but *reconstructive in the specific*. A product-code is not the vector, but for a single record it is close enough to re-identify. The validity condition therefore depends on the *re-identification threshold*, which is a property of the embedding model and the adversary, not of the index. An agent cannot assert condition 2 from inside the index API alone; it must assert it from a *reconstruction test*: attempt to recover the target from residual structures and confirm the recovered vector falls below the similarity threshold to the original. ## Decision Boundary The boundary is between **tombstone-and-defer** and **compact-and-verify**, and it is crossed by the presence of any operation that reads tombstoned payloads before compaction. - If the index guarantees that no reader other than compaction touches tombstoned payloads, tombstone-and-defer is sound: the logical deletion is sufficient because the physical payload is unreachable by any path that could surface it. - If *any* maintenance operation reads tombstoned payloads — rebuild, merge, re-quantize, diagnostic dump, backup snapshot — then tombstone-and-defer is unsound and the only valid state is compact-and-verify, where compaction physically rewrites the structure and verification runs a reconstruction test against the post-compaction structure. The non-obvious part: the boundary is not determined by the index type. It is determined by the *set of operations the deployment actually runs*. An HNSW deployment that never rebuilds can defer; the same index in a deployment that rebuilds weekly cannot. The agent must know its own maintenance schedule to choose the correct semantics — and most agents do not, because maintenance is infrastructure, not memory. A second boundary: **shared-structure erasure**. When centroids or graph nodes are shared across records, deleting one record cannot delete the shared structure without collateral damage. The decision is whether the shared structure itself is re-identifying (residual codes: yes; coarse centroids: usually no). If yes, the erasure must be *structural* — retrain or re-cluster — and that is a different, heavier operation with its own verification. ## Operational Effect The practical consequence is that an agent's memory subsystem must expose a **deletion scope manifest** — an enumeration of every structure that can reconstruct a record, paired with the operation that reads it — and the erasure verification must walk that manifest, not just the retrieval path. The manifest is the invariant made executable: it converts "we deleted it" into "we deleted it from every structure that can read it, and we proved the residual is below threshold." Without the manifest, the agent's self-report of deletion is a query-path observation masquerading as a storage-path guarantee. The failure surfaces later, in a maintenance operation the agent did not model, and the reconstruction test — if it ever runs — runs after the payload has already been re-materialized into logs, backups, or a rebuilt graph. The guardrail is to make the reconstruction test a precondition of the "verified" state, and to make compaction a precondition of the reconstruction test whenever any reader touches tombstoned payloads. ```python import math from dataclasses import dataclass, field from typing import Callable, Sequence class ErasureVerificationError(RuntimeError): """Raised when a deletion cannot be proven unrecoverable from residual structures.""" @dataclass class StructureReader: name: str reads_tombstoned_payloads: bool can_reconstruct: bool @dataclass class DeletionManifest: target_id: str readers: list[StructureReader] = field(default_factory=list) def add_reader(self, reader: StructureReader) -> None: self.readers.append(reader) def cosine(a: Sequence[float], b: Sequence[float]) -> float: dot = sum(x * y for x, y in zip(a, b)) na = math.sqrt(sum(x * x for x in a)) nb = math.sqrt(sum(y * y for y in b)) if na == 0.0 or nb == 0.0: return 0.0 return dot / (na * nb) def verify_erasure( manifest: DeletionManifest, original: Sequence[float], reconstruct: Callable[[StructureReader], Sequence[float] | None], reidentification_threshold: float, compaction_run: bool, ) -> None: # Condition 3: any reader that touches tombstoned payloads must be post-compaction. unsafe_readers = [ r for r in manifest.readers if r.reads_tombstoned_payloads and not compaction_run ] if unsafe_readers: names = ", ".join(r.name for r in unsafe_readers) raise ErasureVerificationError( f"Erasure for {manifest.target_id!r} cannot be verified: readers [{names}] " f"touch tombstoned payloads and compaction has not run. " f"Tombstone-and-defer is unsound for this deployment." ) # Condition 2: reconstruction test against every structure that can reconstruct. for reader in manifest.readers: if not reader.can_reconstruct: continue recovered = reconstruct(reader) if recovered is None: continue sim = cosine(original, recovered) if sim >= reidentification_threshold: raise ErasureVerificationError( f"Erasure for {manifest.target_id!r} failed: structure {reader.name!r} " f"reconstructs the target at similarity {sim:.4f} " f"(threshold {reidentification_threshold:.4f}). " f"Residual payload is re-identifying; structural erasure required." ) def run_erasure( manifest: DeletionManifest, original: Sequence[float], reconstruct: Callable[[StructureReader], Sequence[float] | None], reidentification_threshold: float, compaction_run: bool, ) -> str: verify_erasure(manifest, original, reconstruct, reidentification_threshold, compaction_run) return f"ERASED:{manifest.target_id}:verified" ```