{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-tombstones-from-resurrecting-delete-then-rewrite-races-in-scoped-memory-tool-apis",
  "title": "Which invariants prevent tombstones from resurrecting: delete-then-rewrite races in scoped memory tool APIs",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agent memory tool APIs that expose `write`, `read`, and `forget` (delete) operations with per-scope retention policies and deletion guarantees, where an agent's own in-flight reasoning loop can issue a `write` for a key it has already `forget`-ten within the same task. Does not apply to append-only logs with no deletion, nor to single-writer systems where the agent cannot reissue writes after a delete.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-tombstones-from-resurrecting-delete-then-rewrite-races-in-scoped-memory-tool-apis.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-tombstones-from-resurrecting-delete-then-rewrite-races-in-scoped-memory-tool-apis.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-tombstones-from-resurrecting-delete-then-rewrite-races-in-scoped-memory-tool-apis.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1771,
    "python_slice_tokens": 265,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **deletion as a state transition** and **deletion as a tombstone invariant**. Most memory APIs implement `forget(key)` as a transition: the key's value is removed from the store, and the call returns success. This is a *point-in-time* guarantee. What agents actually need—and what retention/compliance scopes implicitly ...",
    "what_was_observed": "A research agent was executing a multi-step task with a memory tool exposing `memory.write(scope, key, value)`, `memory.read(scope, key)`, and `memory.forget(scope, key)`. The agent had written a working hypothesis under `scope=\"task:4471\", key=\"hypothesis\"` at step 3. At step 9, after a contradicting tool result, the agent reasoned: \"discard the hypothesis, do not carry it forward,\" and issued `memory.forget(\"task:4...",
    "condition_of_validity": "The tombstone invariant holds only if the memory API enforces **epoch-scoped key identity**: a key is not `(scope, key)` but `(scope, key, epoch)`, where `epoch` is incremented on every successful `forget`. A `write` after `forget` must create a record under `epoch+1` with fresh metadata (`created_at`, provenance, and a new `write_id`). Reads resolve to the ...",
    "decision_boundary": "The boundary is between **reuse** and **resurrection**. Reusing a key after `forget` is a legitimate, common agent behavior—hypotheses get revised, scratchpads get cleared and rewritten. Resurrection is the case where reuse silently inherits the deleted record's identity, provenance, or retention clock. The decision the API must make, per `write`, is: - If n...",
    "operational_effect": "An agent that does not know about this boundary will, after any `forget`, treat the key as free for reuse and will not re-check provenance on subsequent reads. It will therefore propagate resurrected metadata into its own reasoning—believing a fresh hypothesis is \"old\" because `created_at` is old, or believing a deleted value persists because a late write re..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "089b791ed2cf5f3ecc7249269d7a3e93d49e8986b0824820d3474126e9675eef",
    "verified_classes": [
      "TombstoneResurrectionError"
    ],
    "verified_functions": [
      "write_after_forget",
      "forget"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TombstoneResurrectionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
