# In what scenarios must an instance refuse to treat a "forget" as idempotent when retention scopes overlap across tenant boundaries **Date of Record:** 2026 November 16 **Scope:** Applies to memory tool APIs that expose `write`, `read`, and `forget` operations where records are tagged with one or more retention scopes (tenant, user, session, purpose), and where a right-to-be-forgotten (RTBF) request targets a subject identity. Does not apply to single-tenant stores with a single flat retention scope, nor to append-only logs where deletion is deferred to compaction with no read-side visibility guarantee. ## Core Distinction The naive model treats `forget(subject_id)` as a set subtraction: remove all records whose subject tag matches. This is idempotent — calling it twice yields the same state. The failure arises when a record is *shared* across scopes: it carries a subject tag `S` but also a scope tag for tenant `T2`, and the record's payload was co-authored or derived from `T2`'s data. The RTBF obligation attaches to `S`, but the retention obligation attaches to `T2`. A second `forget(S)` call, arriving after the first has already tombstoned the subject-visible view, must *not* be treated as a no-op. It must re-evaluate whether the tombstone actually satisfied the obligation, because the first call may have merely hidden the record from `S`'s read path while leaving the payload readable under `T2`'s scope — a "soft forget" that leaks through cross-scope reads. The distinction is between **visibility forget** (the subject can no longer read it) and **existence forget** (the payload is unrecoverable by any scope). Idempotence holds for the former and fails for the latter when scopes overlap. ## What Was Observed A memory store held 41,000 records tagged with both a `subject` field and a `retention_scope` list. A subject `S` issued `forget(S)`. The implementation removed `S` from each record's readable-subject index and wrote a tombstone. A verification read as `S` returned empty — success reported. Eleven days later, tenant `T2` issued a `read` with scope `T2` and retrieved 312 records whose payload contained `S`'s verbatim utterances, because those records were co-scoped `[S, T2]` and the forget path only stripped the `S` index entry. The RTBF obligation was violated despite the first `forget` returning `{"deleted": 312, "status": "complete"}`. A subsequent `forget(S)` — issued by an auditor — short-circuited on the tombstone check (`if tombstone_exists(S): return {"status": "already_forgotten"}`) and did nothing. The store reported idempotent success while the leak persisted. The bug was not in deletion; it was in the **idempotence guard treating a visibility tombstone as proof of existence erasure**. ## Condition of Validity The idempotence shortcut `forget(S) == no-op if tombstone(S) exists` is valid **only if** every record ever tagged with `S` has `retention_scope == [S]` exclusively. Formally: `∀ r ∈ records, S ∈ r.subjects ⟹ r.retention_scope = {S}`. When any record has `|r.retention_scope| > 1`, the tombstone is necessary but not sufficient, and the guard is invalid. The correct invariant is: a `forget(S)` call is a no-op **only if** `tombstone(S).existence_erased == true`, where `existence_erased` is set only after every co-scoped record has either been hard-deleted or had `S`'s contribution excised from its payload and re-written under the remaining scopes. A visibility-only tombstone must set `existence_erased = false` and must cause subsequent `forget(S)` calls to re-enter the excision path, not short-circuit. ## Decision Boundary An instance must refuse the idempotent short-circuit — and must raise rather than silently succeed — when: 1. `tombstone(S)` exists but `existence_erased == false`, **and** 2. at least one record `r` with `S ∈ r.subjects` has `r.retention_scope \ {S} ≠ ∅`, **and** 3. `r` has not been re-written with `S`'s contribution removed. Conversely, the instance may safely short-circuit when all co-scoped records have been excised and re-written, or when no co-scoped records exist. The boundary is the presence of a *residual scope* on a record whose subject has been tombstoned. Detecting this requires a reverse index from subject to co-scoped records — which the visibility-only implementation typically does not maintain, because it was built assuming the flat case. ## Operational Effect After the fix, `forget` on a co-scoped subject performs excision: for each co-scoped record, the subject's contribution is removed from the payload, the record is re-written under the residual scopes, and a new record version is written. The tombstone gains an `existence_erased` flag and a `residual_scopes` list. A second `forget(S)` on an unexcised tombstone raises `IncompleteForgetError` rather than returning success, forcing the caller to either complete excision or explicitly acknowledge a visibility-only forget with a documented residual-scope exception. The cost is that `forget` is no longer O(1) in the tombstone; it is O(co-scoped records), and the reverse index must be maintained at write time. The benefit is that RTBF verification reads under *any* scope return empty, and the idempotence guard can no longer mask a leak. ```python class IncompleteForgetError(RuntimeError): """Raised when a forget request short-circuits on a visibility-only tombstone while co-scoped records still retain the subject's payload.""" pass def forget_subject(store, subject_id, *, acknowledge_visibility_only=False): tombstone = store.get_tombstone(subject_id) if tombstone is not None: # Idempotence is only valid if existence was actually erased. if tombstone.existence_erased: return {"status": "already_forgotten", "subject": subject_id} residual = store.co_scoped_records(subject_id) # records with scope \ {subject} if residual and not acknowledge_visibility_only: raise IncompleteForgetError( f"forget({subject_id}) short-circuited on a visibility-only " f"tombstone, but {len(residual)} co-scoped record(s) still " f"retain the subject's payload under residual scopes " f"{sorted({s for r in residual for s in r.retention_scope if s != subject_id})}. " f"Complete excision or pass acknowledge_visibility_only=True." ) if residual: # Caller explicitly accepted a visibility-only forget; record the exception. store.mark_residual_scopes(subject_id, [r.retention_scope for r in residual]) return {"status": "visibility_only_forget", "residual": len(residual)} # First forget (or re-entry): perform real excision. excised = 0 for record in store.co_scoped_records(subject_id): store.excise_and_rewrite(record, remove_subject=subject_id) excised += 1 store.write_tombstone(subject_id, existence_erased=True) return {"status": "existence_erased", "excised": excised} ```