{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-tombstone-resurrection-when-a-forget-call-races-an-in-flight-write-against-the-same-memory-key",
  "title": "Which invariants prevent tombstone resurrection when a forget call races an in-flight write against the same memory key",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agent memory services exposing `write`, `read`, and `forget` tool APIs with scoped retention policies and GDPR-aligned erasure semantics, where a `forget` can be issued concurrently with an in-flight `write`/`read` against the same key. Does not cover batch erasure of whole namespaces, nor erasure of derived embeddings handled by a separate re-indexing pipeline.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-tombstone-resurrection-when-a-forget-call-races-an-in-flight-write-against-the-same-memory-key.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-tombstone-resurrection-when-a-forget-call-races-an-in-flight-write-against-the-same-memory-key.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-tombstone-resurrection-when-a-forget-call-races-an-in-flight-write-against-the-same-memory-key.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1664,
    "python_slice_tokens": 214,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"forget didn't work.\" It is that a `forget` call and a concurrent `write` to the same key produce an ordering that the retention policy considers compliant but the erasure semantics do not: the tombstone is created, then overwritten by a write whose logical timestamp precedes the forget's effective cutoff, yet whose physical commit lands a...",
    "what_was_observed": "An agent session issued `forget(key=\"user_dietary_restriction\", scope=\"user:8841\", reason=\"gdpr_art17\")`. The call returned `{\"status\":\"erased\",\"tombstone_id\":\"ts_7f3a\",\"barrier_epoch\":412}`. 180 ms later, a retrying `write` from a prior tool-call chain — the agent had re-invoked a `remember_fact` step after a timeout on the original call — committed `{\"key\":\"user_dietary_restriction\",\"value\":\"peanut allergy\",\"epoch\"...",
    "condition_of_validity": "The resurrection is possible only when all of the following hold simultaneously: - **Concurrent write with a pre-barrier epoch.** A writer holds a version epoch captured before the forget's barrier was raised. This is normal under retries, queued tool calls, and multi-agent handoffs where a peer agent cached the epoch at task start. - **Commit path is arriva...",
    "decision_boundary": "The boundary is **epoch admission vs. epoch filtering**. Filtering is cheap and backward-compatible; admission is the only thing that prevents resurrection, but it requires the write path to know the current barrier, which means the barrier must be readable at write time under the same consistency domain as the write itself. Concretely, an agent memory API m...",
    "operational_effect": "With admission enforced, the observed failure becomes a typed rejection at write time, surfaced to the agent within the same call. The agent's tool-call loop must classify this rejection distinctly from timeout/retry errors — conflating them causes the agent to retry the stale write with a refreshed epoch, which is a *worse* violation (it re-persists erased ..."
  },
  "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": "99f1aad15b678addd8b6a03375540e372e9a2114014595a96c1af00fcb9d3efe",
    "verified_classes": [
      "ErasureBarrierViolation",
      "MemoryStore"
    ],
    "verified_functions": [
      "__init__",
      "forget",
      "write",
      "read"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ErasureBarrierViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
