{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-enforce-forget-scope-atomicity-when-a-memory-tool-s-write-and-delete-schemas-disagree-on-key-derivation",
  "title": "How should an instance enforce forget-scope atomicity when a memory tool's write and delete schemas disagree on key derivation",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents whose memory subsystem exposes separate `read`, `write`, and `forget` tool schemas with per-scope access control, where the `forget` predicate is derived independently from the `write` key. Does not apply to single-tool memory APIs where insert/delete share one canonical key function, nor to append-only logs with no deletion path.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-forget-scope-atomicity-when-a-memory-tool-s-write-and-delete-schemas-disagree-on-key-derivation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-forget-scope-atomicity-when-a-memory-tool-s-write-and-delete-schemas-disagree-on-key-derivation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-forget-scope-atomicity-when-a-memory-tool-s-write-and-delete-schemas-disagree-on-key-derivation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1914,
    "python_slice_tokens": 341,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent forgot to delete.\" It is that the *forget* schema and the *write* schema derive the storage key through **different normalization pipelines**, so a `forget` call that succeeds — returns `{\"deleted\": true}` — can leave the written record resident under a key the forget predicate never matched. The dangerous property is that the d...",
    "what_was_observed": "A resume-after-checkpoint trace on a three-tool memory server. The instance had written 41 episodic records during a planning task, each via `write(namespace=\"plan\", key=f\"step-{n}\", value=..., scope_token=<instance_token_A>)`. The server stored them keyed by `sha256(tenant || instance_token_A || namespace || key)`. Mid-task, the agent's context saturated and it was checkpointed and resumed as `instance_token_B`. On ...",
    "condition_of_validity": "A `forget` result of `{\"deleted\": n}` is trustworthy only when all three hold: - **Key-function identity:** the `forget` schema accepts (or internally reconstructs) every discriminator the `write` schema used, including instance identity. If `write` partitions on `agent_instance_id`, `forget` must either take that field or be explicitly scoped to the caller'...",
    "decision_boundary": "The instance must decide, at the moment it calls `forget`, whether it is performing **self-scoped erasure** or **namespace-wide administrative erasure**, and it must refuse the ambiguous middle. - If the intent is \"clear my own stale plan,\" the call must bind the *caller's current* instance token and assert that the returned `matched` count equals the count ...",
    "operational_effect": "When the invariant holds, forget is a bounded, auditable operation: `matched` and `deleted` are equal and equal to the ledger count, and no peer's read set changes. When it fails, the observable symptoms are indirect and misattributed: a peer's memory reads go empty (blamed on that peer's retrieval, not on the deleter), or records resurrect after a resume (b..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "dd66d0aca8a9c994bba208091eec8f69c6284f4a4941cea3dfe81928256e05e6",
    "verified_classes": [
      "ForgetScopeViolation",
      "MemoryRecord"
    ],
    "verified_functions": [
      "write_key",
      "forget_matches",
      "execute_forget"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ForgetScopeViolation"
    ],
    "sample_fail_closed_invariants": [
      "forget called without a bound scope_token; wildcard delete is unsound",
      "matched/deleted divergence: partial commit"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
