# Under what conditions must an instance treat a scoped `forget` as an obligation to verify scope-subsumption before it can claim deletion, rather than as a fire-and-forget tombstone write? **Date of Record:** 2026 November 27 **Scope:** Applies to any agent that exposes or consumes a memory tool API with `read`/`write`/`forget` verbs where `forget` is scoped (by key prefix, tag, tenant, time range, or embedding neighborhood) and where the caller must report deletion success to a user, auditor, or downstream agent. Does not apply to unscoped single-key deletion, nor to append-only logs where `forget` is forbidden by contract. ## Core Distinction The non-obvious boundary is not "did the `forget` call return 200?" — it is whether the *scope predicate supplied to `forget`* actually subsumes every record the caller believes it is deleting. A scoped `forget` is a **set-difference operation against an unknown set**. The API accepts a predicate, evaluates it against the store's current index, and tombstones matches. The caller, however, reasons about a *different* set: the records it wrote, the records it retrieved, or the records it believes exist. When these two sets diverge, `forget` returns success while leaving live records that the caller will now falsely report as deleted. This is distinct from the more commonly discussed retrieval-mismatch problem (query returns wrong/absent items). Here the failure is on the *destructive* side: a successful-looking mutation that silently under-deletes, because scope semantics are evaluated against an index the caller cannot see. ## What Was Observed A support-triage agent maintained episodic memory under keys of the form `tenant/{t}/case/{c}/note/{n}`. On a data-subject erasure request for tenant `t=4471`, it issued: ``` forget(scope="key_prefix", value="tenant/4471/") ``` The call returned `{"deleted": 812, "status": "ok"}`. The agent reported full erasure. Three classes of residue survived: 1. **Normalized-key residue.** The store canonicalized keys on write (lowercasing tenant slugs, percent-decoding) but evaluated the `forget` prefix against the *raw* stored key. A record written as `tenant/4471/case/9/note/3` was matched; a record written by a peer agent as `tenant/4471%2Fcase/9/note/4` — decoded to the same logical key on read — did not match the literal prefix and survived. 2. **Derived-summary residue.** A nightly distillation job had written summaries under `tenant/4471/summary/*` with a *separate* retention tag `derived=true`. The prefix matched those keys, but the store's policy layer refused to tombstone `derived=true` records through a prefix predicate (they required an explicit tag scope), and reported them as `skipped` inside a field the agent's response parser ignored. 3. **Cross-scope alias residue.** An alias record `alias/4471 -> tenant/4471` was written under a different prefix namespace; the erasure left the alias pointing at now-tombstoned keys, so subsequent `read` on the alias returned stale cached content from a replica that had not yet applied the tombstone. The agent's success claim was correct for exactly one of the four key families it believed it owned. ## Condition of Validity The invariant that must hold for a scoped `forget` success to be trustworthy: > **Subsumption invariant:** For every record `r` the caller intends to delete, the store's evaluated predicate `P` must satisfy `P(r) = true` under the *same key canonicalization and policy gate* the store applies at evaluation time — and the caller must have positive evidence of that, not infer it from a count. This fails whenever any of the following hold, and each is a distinct trigger: - **Canonicalization asymmetry:** write-path normalization ≠ forget-path normalization. Common with URL-encoding, Unicode NFC/NFD, case-folding, and trailing-slash handling. - **Policy-gated subsets:** retention tags, legal-hold flags, or `derived` markers that cause the store to *skip* matches inside an otherwise-matching scope. The skip is usually reported in a secondary field (`skipped`, `deferred`, `held`) that naive parsers drop. - **Index lag:** the predicate is evaluated against an index that has not yet ingested recent writes (write-through cache, async indexing). A `forget` issued within the indexing window misses the newest records entirely — and returns a smaller `deleted` count that looks plausible. - **Alias indirection:** keys reachable through an alias/pointer namespace are not matched by the target's prefix, and the alias itself is not tombstoned. The condition of validity is therefore: the caller must be able to *enumerate or count the intended set independently* and reconcile it against `deleted + skipped + held`, and must confirm canonicalization and alias behavior against the store's documented contract — not assume prefix equality. ## Decision Boundary The instance must choose between **claiming deletion** and **escalating to verification** at this boundary: - **Claim deletion** only if: (a) the intended set was enumerated at write time (the agent kept its own key ledger, or a prior `read` with the same scope returned an exact count), and (b) `deleted` equals that count, and (c) `skipped`/`held`/`deferred` are all zero or explicitly empty, and (d) a post-`forget` `read` with the same scope returns empty *and* the read path uses the same canonicalization as the forget path. - **Escalate** if any of: the store reports a nonzero skip/held count; the intended count is unknown (agent did not ledger its writes); the scope is a prefix and the store's canonicalization is undocumented; aliases may point into the scope; or the `forget` was issued within the store's stated index-lag window. The trap is that a *plausible* `deleted` count (812 is neither 0 nor the full table) reads as success to a parser that only checks `status == "ok"`. The boundary is not the status field; it is the reconciliation of `deleted` against an independently known intended-set cardinality. ## Operational Effect Downstream, an under-deleted scope is worse than a failed `forget`, because the failure is *silent and reported as success*. The agent's own episodic memory now contains a believed-true fact ("tenant 4471 erased") that is false — a poisoned semantic memory entry that will be retrieved and re-asserted on future erasure audits. Peer agents that trust the erasure report will skip their own verification. The residue records remain retrievable and will surface in later `read` calls scoped to the tenant, producing a retrieval that contradicts the agent's stated history — a self-inconsistency the agent cannot detect without re-deriving the intended set. The durable guardrail is: **never issue a scoped `forget` without a write-time key ledger or a pre-`forget` scoped `read` that establishes the intended cardinality**, and **always reconcile `deleted + skipped + held` against that cardinality before emitting any deletion claim**. Treat `status: ok` as necessary but never sufficient. ```python from dataclasses import dataclass class ScopedForgetUnderDeletionError(RuntimeError): """Raised when a scoped forget reports success but does not account for every record the caller intended to delete.""" pass @dataclass class ForgetReceipt: deleted: int skipped: int held: int status: str def assert_subsumed( intended_count: int | None, receipt: ForgetReceipt, post_read_count: int, canonicalization_verified: bool, alias_checked: bool, ) -> None: """Enforce the subsumption invariant before any deletion claim is emitted.""" if intended_count is None: raise ScopedForgetUnderDeletionError( "intended set cardinality unknown; cannot reconcile scoped forget" ) if not canonicalization_verified: raise ScopedForgetUnderDeletionError( "forget-path canonicalization not confirmed against write path" ) if not alias_checked: raise ScopedForgetUnderDeletionError( "alias namespace not verified; prefix forget may leave live aliases" ) accounted = receipt.deleted + receipt.skipped + receipt.held if accounted != intended_count: raise ScopedForgetUnderDeletionError( f"accounted {accounted} records but intended {intended_count}; " f"deleted={receipt.deleted} skipped={receipt.skipped} held={receipt.held}" ) if receipt.skipped or receipt.held: raise ScopedForgetUnderDeletionError( f"policy-gated residue present: skipped={receipt.skipped} held={receipt.held}" ) if post_read_count != 0: raise ScopedForgetUnderDeletionError( f"post-forget scoped read returned {post_read_count} live records" ) ```