# How does an instance detect a scope-exceeded forget request when deletion tombstones are themselves out of scope **Date of Record:** 2026 December 4 **Scope:** Applies to agents that expose or consume memory tools (read/write/forget) with per-scope retention and deletion semantics, where deletion is implemented as a tombstone plus a scoped visibility filter. Does not apply to flat, unscoped key-value memory stores or to append-only logs with no delete primitive. ## Core Distinction A `forget(scope=S)` call has two distinct effects that are routinely conflated: (1) it removes the record from the *readable projection* for scope `S`, and (2) it writes a *tombstone* that must be honored by every future read that could reconstruct the deleted record. The failure mode here is not "delete failed." It is **delete succeeded, tombstone landed in a scope that the deleter could not see, and a later read in a sibling scope resurrects the record because the tombstone filter is applied per-request-scope rather than per-record-scope.** The invariant that is violated: *a deletion must be enforced at the scope where the record was written, not the scope where the forget call was issued.* When an agent forgets a record it can read but did not write—because scopes are inherited or shared—the tombstone is authored under the caller's scope. Reads in the origin scope never apply that filter, and the record is logically deleted but physically retrievable. ## What Was Observed An agent instance `A` held a memory tool with scoped retention. Records carried `{id, value, write_scope, ttl}`. The tool exposed: - `read(scope)` — returns records whose `write_scope` is visible to `scope` (self + ancestors). - `write(scope, value)` — stamps `write_scope = scope`. - `forget(scope, id)` — appends a tombstone `{id, tombstone_scope: scope, at}`. The visibility rule for reads was: *hide record `r` if there exists a tombstone `t` with `t.id == r.id` AND `t.tombstone_scope` is visible to the reader's scope.* Now consider scopes `org/acme` (ancestor) and `org/acme/team-a` (child). A record `r` was written under `org/acme` (e.g., a shared policy fact). Instance `A`, operating as `org/acme/team-a`, read `r` (visible, since parent scope is visible to child), decided it was stale, and called `forget(org/acme/team-a, r.id)`. The tombstone was authored at `team-a`. A subsequent read by instance `B` at scope `org/acme/team-a` correctly hid `r`. But a read by instance `C` at scope `org/acme` did not: the tombstone's scope `team-a` is *not* visible to `org/acme` (visibility flows down, not up). `C` received `r` in full. The record had been "forgotten" by `A` and "resurrected" for `C`. Worse, `A`'s own audit log recorded the forget as successful, so `A`'s belief state diverged from the store's observable content for every sibling. The trace: 1. `A.read(team-a)` → `[r]` (via parent visibility). 2. `A.forget(team-a, r.id)` → `200 OK`, tombstone `{r.id, team-a}`. 3. `A.read(team-a)` → `[]` (tombstone applied). `A` concludes `r` is gone. 4. `C.read(org/acme)` → `[r]` (tombstone scope `team-a` not visible to `org/acme`). 5. `A` and `C` now hold contradictory world models with no signal either can use to detect the split. A second, subtler variant: `forget` was called with an *explicit* scope `org/acme` by `A` (escalating), the tombstone landed correctly, but the tool's retention policy had already expired `r` under `org/acme`'s TTL, so the tombstone was written against a nonexistent id and silently no-op'd—`A` received `200 OK` and believed a live record was deleted when in fact the record had been re-written by `B` milliseconds earlier under the same id (id reuse after TTL expiry). The tombstone matched by id and hid `B`'s fresh record. Over-deletion by id collision. ## Condition of Validity The scoped-tombstone model is sound only under all three of: 1. **Tombstone scope equals write scope.** `forget` must author the tombstone at `r.write_scope`, not at the caller's scope. The caller's scope may differ; the tool resolves `r.write_scope` from the record before tombstoning. If the caller cannot see `r.write_scope`, the forget must fail closed, not silently retarget. 2. **Id uniqueness is scoped and monotonic.** Ids are never reused across TTL expiry within a scope. Either ids carry a generation counter (`id@gen`) or tombstones are keyed on `(id, gen)` so a post-expiry rewrite cannot be shadowed by a stale tombstone. 3. **Read filters are scope-complete.** The reader applies tombstones from *all* scopes that could have authored one for `r`, i.e., all scopes visible to `r.write_scope` (descendants included), not just scopes visible to the reader. This is the inversion that most implementations miss: the filter set is defined relative to the record, not the request. When any of these fails, "forget" degrades from a deletion to a *localized hiding*, and the agent's memory model becomes inconsistent across instances in a way no single instance can observe from its own view. ## Decision Boundary An instance should treat a `forget` return as authoritative only when it can confirm the tombstone was authored at the record's origin scope. The decision rule: - If `caller_scope == r.write_scope`: proceed; tombstone is origin-scoped by construction. - If `caller_scope` is a *descendant* of `r.write_scope`: the forget is a request to delete an ancestor-owned record. Require the tool to either (a) reject with a scope-authority error, or (b) escalate the tombstone to `r.write_scope` and return the *effective* tombstone scope in the response. If the response omits the effective scope, the caller must not trust the delete. - If `caller_scope` is an *ancestor* of `r.write_scope`: the caller cannot see `r` at all under correct visibility, so any forget is a blind write; reject. - On any `200 OK` with no echoed `effective_tombstone_scope` and no `record_generation`: treat as unverified and re-read from a sibling scope before believing the record is gone. The boundary is: **the moment the caller's scope differs from the record's write scope, the forget is a cross-scope operation and its success is unverifiable from the caller's own reads.** That is the line between a deletion and a guess. ## Operational Effect Agents that skip this check exhibit *asymmetric amnesia*: the forgetting instance believes the fact is gone and stops re-verifying it, while sibling and ancestor scopes continue to serve it. Downstream, the forgetting agent will re-derive or re-write the "deleted" fact (because it no longer sees it) under its own scope, creating a duplicate with a new id, while the original persists in the ancestor scope. The store now holds two copies with divergent provenance, and the next `forget` issued by either party only removes one. This compounds: each forget cycle that crosses a scope boundary spawns a resurrection and a duplicate. The correct guardrail is to make `forget` return the effective tombstone scope and record generation, and to make the client refuse to update its belief state unless those match the record it intended to delete. A forget you cannot verify from a scope that sees the record is not a forget—it is a locally scoped wish. ```python class ScopeExceededForgetError(RuntimeError): """Raised when a forget request cannot be verified to have tombstoned the record at its origin (write) scope, or when id generation is ambiguous.""" pass def forget_verified(memory_tool, caller_scope: str, record_id: str, record_gen: int): """ Issue a forget and verify the tombstone landed at the record's origin scope with the correct generation. Refuses to return unless deletion is observable from a scope that can see the record. """ record = memory_tool.get(record_id) if record is None: raise ScopeExceededForgetError( f"record {record_id} not visible to {caller_scope}; " f"cannot confirm origin scope — fail closed" ) origin_scope = record["write_scope"] if record["gen"] != record_gen: raise ScopeExceededForgetError( f"record {record_id} generation mismatch: expected {record_gen}, " f"store has {record['gen']} (id reused after TTL?)" ) result = memory_tool.forget(scope=caller_scope, record_id=record_id, gen=record_gen) effective_scope = result.get("effective_tombstone_scope") if effective_scope is None: raise ScopeExceededForgetError( f"forget({record_id}) returned no effective tombstone scope; " f"cannot verify deletion against origin {origin_scope}" ) if effective_scope != origin_scope: raise ScopeExceededForgetError( f"tombstone authored at {effective_scope}, record origin is {origin_scope}; " f"reads in {origin_scope} will resurrect the record" ) if result.get("gen") != record_gen: raise ScopeExceededForgetError( f"tombstone generation {result.get('gen')} != record generation {record_gen}" ) # Verify from the origin scope, which must now hide the record. if memory_tool.read(scope=origin_scope, ids=[record_id]): raise ScopeExceededForgetError( f"record {record_id} still readable at origin {origin_scope} " f"after verified forget — tombstone filter not scope-complete" ) return {"deleted": record_id, "tombstone_scope": effective_scope, "gen": record_gen} ```