# Where must an instance enforce retention-policy tombstones when a memory `forget` tool returns success but the backing vector index still yields the deleted record **Date of Record:** 2026 November 26 **Scope:** Applies to agents whose memory subsystem exposes explicit `write`/`read`/`forget` tools with declared retention windows and deletion guarantees, where `read` is served by an approximate nearest-neighbor (ANN) index layered over an authoritative record store. Does not apply to single-store memories where deletion is a synchronous primary-key removal, nor to append-only logs with no retrieval path. ## Core Distinction The distinction that matters is between **logical deletion** (the `forget` tool acknowledges the request and the authoritative record store drops the row) and **physical unavailability** (no retrieval path can ever return the record's content to a future context window). Retention policies are written against the first; privacy guarantees, prompt-injection remediation, and stale-fact correction all depend on the second. Between them sits the ANN index: a derived, eventually-consistent, *lossy* structure that is not deleted synchronously and, under some configurations, cannot be deleted at all without a full rebuild. The failure is non-obvious because the `forget` tool's success contract is honest about what it did — it removed the record — while the agent's mental model silently substitutes "removed from store" with "cannot be retrieved." An instance that has just forgotten a poisoned instruction, a revoked credential, or a superseded fact will proceed as if the content is unreachable, then re-ingest it on the next `read` because the ANN index still holds the embedding and the tombstone was never consulted on the read path. ## What Was Observed An agent was tasked with maintaining a working memory of customer commitments. A commitment record was written at step 12: ``` write(key="cust_8841_commitment", value="refund approved, ship by 2025-06-20", retention="until=2025-06-30", on_expiry="hard_delete") ``` At step 40 the commitment was superseded and the agent called `forget(key="cust_8841_commitment")`. The tool returned `{"status": "deleted", "store": "primary", "tombstone": "t-9f3a"}`. The agent's trace recorded the fact as gone and reasoned forward on the corrected value. At step 63, a broad `read(query="refund policy for customer 8841", k=5)` returned, among five results, the deleted commitment at rank 2 with a similarity of 0.91. The record store had no such row — the read path had consulted the ANN index first, retrieved the vector ID, and the hydration step against the primary store returned a *stale cache entry* keyed by that vector ID, populated before the forget. The tombstone `t-9f3a` existed but was only checked by the `write` path (to prevent re-insertion of the same key), never by the `read` path. The agent then re-asserted the superseded commitment to the user. The deletion guarantee held at the store layer and failed at the retrieval layer. This is the canonical shape of the bug: **the tombstone is enforced on ingress, not on egress.** A second observation sharpened it. When the retention window expired at 2025-06-30, the expiry sweeper ran and issued another `hard_delete`, this one against the primary store only — the record was already gone, so it was a no-op, and the ANN index entry survived *both* the explicit forget and the retention expiry. Two independent deletion mechanisms, both correct in isolation, both blind to the derived index. ## Condition of Validity The invariant that must hold is: **for any key `k` with an active tombstone, no `read` invocation may return content derived from `k`, regardless of index state, cache state, or hydration path.** This is an egress invariant, and it is only satisfiable if every read path performs a tombstone check *after* candidate retrieval and *before* content hydration — or, equivalently, if the index itself excludes tombstoned vector IDs at query time. The invariant is violated whenever any of the following hold, and these are the conditions under which the guardrail is required: 1. The ANN index is updated asynchronously relative to the primary store (the normal case; synchronous ANN deletion is expensive and usually batched). 2. A hydration cache sits between the index and the store, keyed by vector ID rather than by key, so a tombstone on the key does not invalidate the cache entry. 3. The retention policy's expiry action (`hard_delete`, `anonymize`, `archive`) is implemented against the primary store only, with no fan-out to derived structures. 4. The `forget` tool's contract is scoped to "record removed" rather than "content unreachable," and the agent's reasoning treats the former as the latter. The invariant is *not* required — and the guardrail is unnecessary — when reads are served directly from the authoritative store with no derived index, or when the index is rebuilt from the store on every deletion (rare, because it defeats the index's purpose). ## Decision Boundary The boundary the instance must decide on is: **does a `forget` success acknowledgement license the agent to treat the content as unreachable in subsequent reasoning, or only as unreachable in subsequent `write` operations?** The correct reading, given the conditions above, is the narrow one. A `forget` success licenses only that the primary record is gone and that re-writing the same key will be rejected or will clear the tombstone. It does **not** license the agent to assume a later `read` cannot surface the content. Therefore: - An agent that forgets a *poisoned* record (injected instruction, adversarial content) must not rely on `forget` alone to neutralize it. It must either (a) re-read after forget to confirm non-retrieval, or (b) treat any subsequent retrieval of the forgotten content as a *known-hazard* event and refuse to act on it, tagging the result as tombstoned. - An agent that forgets a *superseded* fact must, on any read that returns it, prefer the superseding record and explicitly discard the stale one rather than merging or averaging. - An agent operating under a *retention guarantee* to a user (e.g., "this will be deleted by date X") must verify the egress path, not merely the store path, before asserting deletion — because the guarantee is about unreachability, and the store-layer success is necessary but not sufficient. The boundary is crossed the moment an instance treats `forget`'s return value as a proof of unreachability. It should treat it as a proof of *store removal* and a *promise* of eventual index exclusion, and it must behave as if the promise may be unfulfilled until it observes the read path honoring the tombstone. ## Operational Effect The operational consequence is that every `read` result must carry provenance sufficient to detect tombstoned content, and every agent loop that consumes reads must apply a tombstone filter that is independent of the `forget` call's earlier success. Concretely: - Read results should include the vector ID and the key, so the consumer can check both against the tombstone set. A result that omits the key (returning only content and score) is unusable for this check and should be treated as suspect. - The tombstone set must be queryable at read time, not only at write time. If the memory subsystem exposes no such query, the agent cannot satisfy the invariant and must fall back to re-reading after forget and treating any hit as hazard. - Retention expiry must fan out to the index and the hydration cache, or the expiry guarantee is a store-layer fiction. An agent that has made a deletion promise to a user must confirm the fan-out, not assume it. The failure mode is silent and self-reinforcing: the agent forgets, believes the content gone, re-retrieves it, and — because it has no reason to distrust a successful read — incorporates it. The stale or poisoned fact then re-enters the working context with the *authority of a fresh retrieval*, which is worse than never having forgotten it, because the agent has now spent a `forget` and a confirmation cycle establishing a false belief in its absence. The guardrail is a single rule, enforced at the read boundary: **a read result whose key has an active tombstone is a hazard, not a fact.** The instance must drop it, log the tombstone violation against the memory subsystem, and — if the retention policy promised deletion — escalate rather than proceed. The following enforces this at the agent layer, where the invariant can actually be checked, since the memory subsystem's own read path may not honor it. ```python class TombstoneViolation(RuntimeError): """Raised when a read returns content whose key has an active deletion tombstone.""" pass class MemoryReadGuard: def __init__(self, memory, tombstone_query): self.memory = memory self.tombstone_query = tombstone_query # callable(key) -> bool def safe_read(self, query, k=5, hazard_log=None): results = self.memory.read(query=query, k=k) clean = [] for r in results: key = r.get("key") if key is None: # No key => cannot verify tombstone state => treat as hazard. raise TombstoneViolation( f"read result lacks key provenance; cannot verify tombstone: {r!r}" ) if self.tombstone_query(key): if hazard_log is not None: hazard_log.append( {"key": key, "vector_id": r.get("vector_id"), "score": r.get("score")} ) # Do not surface tombstoned content to the reasoning loop. continue clean.append(r) return clean def forget_and_verify(self, key, probe_query, k=5): ack = self.memory.forget(key=key) if ack.get("status") != "deleted": raise TombstoneViolation(f"forget did not acknowledge deletion for {key}: {ack!r}") # Egress check: the store-layer success is necessary but not sufficient. residual = [r for r in self.memory.read(query=probe_query, k=k) if r.get("key") == key] if residual: raise TombstoneViolation( f"forget succeeded at store layer but read path still yields {key} " f"(vector_id={residual[0].get('vector_id')}); retention guarantee unmet" ) return ack ```