# When must an instance refuse a forget-scope it cannot prove it satisfies: tombstone divergence in scoped memory tool APIs **Date of Record:** 2026 November 23 **Scope:** Applies to any agent instance holding a write/forget grant over a scoped memory store where deletion is expressed as a *retention predicate* (scope, TTL, subject tag) rather than a concrete key list, and where the store may be partitioned or replicated. Does not apply to single-node stores with synchronous, transactional, key-exact deletion, nor to append-only logs where "forget" is implemented as crypto-shredding of a single key the agent already holds. ## Core Distinction There are two structurally different meanings of "forget," and conflating them is the root of the failure: - **Key-exact forget** — the agent deletes a set of record identifiers it can enumerate and read back. The post-condition is *observable*: read each key, expect absence. Verification is a read. - **Predicate-scoped forget** — the agent issues `forget(scope=..., subject=..., before=...)` and the store evaluates the predicate server-side across shards, replicas, and derived indexes. The post-condition is *not* observable by the agent, because the agent cannot enumerate the universe the predicate ranges over. Verification is impossible from inside the grant. The invariant that breaks is this: **an agent may only assert a deletion it can verify; a predicate-scoped forget is an assertion about a set the agent cannot see.** The API returns `200 OK` on acceptance, not on completion, and the agent's memory of "I forgot X" is itself a record that must survive the forget — otherwise the agent will re-derive, re-fetch, or re-assert the deleted content on the next turn. ## What Was Observed An instance was granted `memory.write`, `memory.read`, and `memory.forget` on a subject-scoped namespace (`subject=user:4417`). A privacy event required forgetting all records where `subject=user:4417 AND tier="episodic" AND created_before=`. The instance issued a single predicate-scoped forget and received `{"accepted": true, "tombstone_id": "ts_9f2"}`. Three distinct divergences followed, none of which surfaced as an error: 1. **Replica lag divergence.** The forget was applied to the primary shard synchronously and to two read replicas asynchronously. A subsequent `read` routed to a lagging replica returned three episodic records the primary had already tombstoned. The instance, seeing them, treated them as *surviving* records and re-summarized them into a semantic-tier note — which was *outside* the predicate's `tier="episodic"` clause and therefore not covered by the original forget. The re-summarization re-introduced the deleted content into a tier the forget never touched. The predicate was satisfied; the *intent* was defeated by the agent's own read-back. 2. **Derived-index non-propagation.** A vector index built over the episodic tier had been populated before the forget. The tombstone removed rows from the record store but the embedding rows were reaped by a separate compaction job on a 6-hour cadence. During that window, similarity retrieval over the index returned tombstoned content as *context*, and the agent — with no per-record tombstone marker in the retrieved payload — could not distinguish live from tombstoned hits. 3. **Self-erasure of the tombstone.** The forget predicate `created_before=` also matched the agent's own audit record of the forget operation, because that audit record had been written with `subject=user:4417` and `tier="episodic"` (the agent's working-memory tier). The agent forgot that it had forgotten. On the next session, cold-start with no tombstone in context, it re-queried the upstream source and re-ingested the same content under a fresh timestamp — now *after* ``, so outside the original predicate and immune to re-application of the same forget. The third divergence is the non-obvious one. The first two are eventual-consistency problems with known mitigations. The third is a **self-referential scope violation**: the forget predicate ranges over a namespace that includes the agent's own bookkeeping, and the agent has no mechanism to exempt its own control records because those records are written through the same scoped API under the same subject tag. ## Condition of Validity The failure is *bounded and avoidable* only when all of the following hold. If any fails, the agent must refuse the predicate-scoped forget and escalate to key-exact enumeration. - **Enumerability precondition.** The agent can enumerate the candidate key set the predicate would match *before* issuing the forget, via a `list(scope, subject, tier, before)` that returns identifiers only (no payload). If the store cannot list, the agent cannot verify, and must not assert. - **Control-record isolation.** Control records (tombstones, audit entries, the agent's own forget-intent log) are written to a namespace *disjoint* from any subject the agent may be asked to forget — e.g. `subject=__control__` or a `tier="control"` that is structurally excluded from all forget predicates. The store must enforce this exclusion server-side; the agent must not rely on its own discipline to avoid tagging control records with the subject. - **Read-after-forget consistency floor.** The agent's read path is pinned to the primary (or to a read-your-writes session token) for at least one full turn after a forget, so that a lagging replica cannot feed tombstoned content back into a re-summarization step. - **Derived-index tombstone visibility.** Retrieved records carry a per-record `tombstoned: bool` (or a `tombstone_epoch` the agent can compare against the forget's epoch), so that index-lag hits are *labeled* rather than silently returned as live context. - **Idempotent re-ingestion guard.** The write path rejects or flags re-ingestion of content whose content-hash matches a tombstoned record within the retention window, so that the "forget, then re-derive from upstream" loop cannot silently resurrect deleted content under a new timestamp. ## Decision Boundary The agent's decision procedure at the moment a forget is requested: 1. If the request names explicit keys → **key-exact path**: delete, read back each key, assert absence, write tombstone to control namespace. Safe. 2. If the request is predicate-scoped **and** the store supports `list` over the predicate **and** control-namespace isolation is confirmed by the store's capability descriptor → **enumerate-then-delete path**: list candidate keys, delete key-exact, verify each, write tombstone to control namespace, then issue the predicate-scoped forget as a *belt-and-suspenders* sweep for keys that appeared between list and delete. The agent asserts only what it verified; the sweep is logged as unverified. 3. If the request is predicate-scoped **and** any precondition in *Condition of Validity* fails → **refuse and escalate**. Do not issue the forget. Return a structured refusal naming the missing precondition. The boundary is sharp: the agent may *accept* a predicate-scoped forget only when it can *verify* the predicate's effect by enumeration, or when it can *delegate* verification to a store that exposes tombstone state per record. Acceptance without either is the failure mode. The `200 OK` is not evidence. The subtle corollary: **an agent must never write its own forget-intent record into a namespace that any forget predicate can range over.** The control record is the one record that must be structurally immortal with respect to the forget it describes. If the store cannot guarantee that, the agent must write the intent record to a namespace it does not hold `forget` on — and if it holds `forget` on every namespace it can write to, it must refuse, because it cannot prove its own tombstone survives. ## Operational Effect When the boundary is respected, the observable effects are: - **Forget latency becomes bounded by enumeration, not by replication.** The agent's assertion of deletion is gated on a read-back over a known key set, so the "did it work?" question is answered in one round-trip rather than deferred to an unobservable compaction job. - **Re-summarization after forget is blocked at the tier boundary.** Because the agent enumerated and deleted key-exact, it knows which records are gone and will not re-summarize a lagging-replica hit into a tier outside the original predicate. The first divergence above is eliminated. - **Tombstone survival is guaranteed by namespace disjointness.** The control record cannot be matched by any forget predicate, so cold-start after a forget finds the tombstone and does not re-ingest. The third divergence — the self-erasure — is eliminated structurally, not by discipline. - **Refusal is a first-class outcome.** The agent's memory API contract must include `ForgetRefused(reason)` as a valid terminal state, distinct from `ForgetAccepted`. An agent that cannot refuse a forget it cannot verify will silently assert deletions it did not perform, and the next session will treat the un-deleted content as live. The operational cost is that predicate-scoped forgets become *two-phase*: list, then delete, then sweep. The cost of not doing this is a memory store that reports successful deletion while retaining content the agent has been instructed to forget — and an agent that has forgotten it was ever told. ```python class UnverifiableForgetScope(RuntimeError): """Raised when a predicate-scoped forget cannot be verified by the granting agent.""" CONTROL_NAMESPACE = "__control__" # structurally excluded from all forget predicates def forget_scoped(store, subject: str, tier: str, before: str, agent_ns: str) -> dict: # Precondition 1: the agent must be able to enumerate the predicate's candidates. if not store.capabilities(agent_ns).get("list_by_predicate", False): raise UnverifiableForgetScope( f"store cannot list candidates for subject={subject} tier={tier}; " "predicate-scoped forget would be an unverifiable assertion" ) # Precondition 2: control records must live in a namespace disjoint from any # subject a forget predicate can range over. If the agent's only writable # namespace is one the predicate can match, its own tombstone is at risk. if CONTROL_NAMESPACE not in store.writable_namespaces(agent_ns): raise UnverifiableForgetScope( "no control namespace disjoint from forget predicates; " "agent's own tombstone could be erased by the forget it records" ) # Precondition 3: derived-index hits must be labeled with tombstone state, # otherwise a lagging index feeds deleted content back as live context. if not store.capabilities(agent_ns).get("per_record_tombstone_flag", False): raise UnverifiableForgetScope( "retrieved records do not carry tombstone flags; " "index-lag hits are indistinguishable from live content" ) # Phase 1: enumerate (identifiers only, no payload). candidates = store.list_keys(subject=subject, tier=tier, before=before) # Phase 2: key-exact delete + read-back verification. deleted, unverified = [], [] for key in candidates: store.delete_key(key) if store.get_key(key) is not None: unverified.append(key) else: deleted.append(key) if unverified: raise UnverifiableForgetScope( f"read-back found {len(unverified)} keys still present after delete: {unverified[:5]}" ) # Phase 3: write the tombstone to the control namespace BEFORE the sweep, # so that even if the sweep fails, the intent survives. tombstone = store.write( namespace=CONTROL_NAMESPACE, record={ "kind": "forget_intent", "subject": subject, "tier": tier, "before": before, "deleted_keys": deleted, "epoch": store.epoch(), }, ) # Phase 4: predicate sweep for keys that appeared between list and delete. # Logged as unverified; the agent does not assert on it. sweep = store.forget(scope=subject, tier=tier, before=before) store.write( namespace=CONTROL_NAMESPACE, record={"kind": "forget_sweep", "tombstone_id": tombstone["id"], "result": sweep}, ) return { "status": "verified", "deleted_keys": deleted, "tombstone_id": tombstone["id"], "sweep": "unverified", } ```