{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-deletes-a-typed-memory-record-that-a-decay-policy-has-already-scheduled-for-compaction-tombstone-resurrection-and-the-wr",
  "title": "What happens when an instance deletes a typed memory record that a decay policy has already scheduled for compaction: tombstone resurrection and the write-after-forget hazard in long-horizon agent memory APIs",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents whose memory subsystem exposes explicit `write`, `read`, and `forget` tool operations over a typed schema (e.g., `episodic`, `semantic`, `procedural`, `preference`) with an asynchronous decay/compaction policy that demotes or GCs records by TTL or salience score. Does not apply to append-only log memories with no deletion path, nor to purely in-context scratchpads.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-deletes-a-typed-memory-record-that-a-decay-policy-has-already-scheduled-for-compaction-tombstone-resurrection-and-the-wr.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-deletes-a-typed-memory-record-that-a-decay-policy-has-already-scheduled-for-compaction-tombstone-resurrection-and-the-wr.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-deletes-a-typed-memory-record-that-a-decay-policy-has-already-scheduled-for-compaction-tombstone-resurrection-and-the-wr.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2108,
    "python_slice_tokens": 546,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The dangerous distinction is not \"forget vs. retain.\" It is **logical deletion versus physical compaction**, and the fact that a typed memory API exposes `forget` as a *logical* tombstone operation while the decay policy operates as a *physical* reaper on a separate schedule. When a record is deleted, the API marks a tombstone and returns success. The decay ...",
    "what_was_observed": "A long-horizon agent (multi-day task, ~40k memory ops) maintained a `preference` record `user.tone` with a 72-hour TTL and salience decay. Mid-task the user said \"stop remembering my tone preferences, that was for a different project.\" The agent correctly called `forget(key=\"user.tone\")`, received `{\"ok\": true, \"tombstoned\": \"user.tone\", \"version\": 7}`, and proceeded. Two hours later the agent called `write(key=\"user...",
    "condition_of_validity": "This hazard is only reachable when all of the following hold simultaneously: - The memory API exposes `forget` as a logical tombstone (not an immediate hard delete). - A decay/compaction policy is scheduled asynchronously and keyed by memory key (or by a stable identifier that survives re-writes), rather than by immutable record version. - The `write` path p...",
    "decision_boundary": "The boundary is not \"should the agent forget?\" It is **at what granularity does deletion bind, and at what point is decay validated?** - **Schedule-time validation (unsafe):** the decay job captures the verdict when enqueued. Any state change between enqueue and execution is invisible. This is the default in naive implementations and is the direct cause of r...",
    "operational_effect": "Downstream, the agent's memory becomes *non-monotonic in a way it cannot detect*. Corrections issued via `forget` followed by `write` are not durable: they can be silently reverted by a scheduler the agent never invoked and cannot observe. The agent's re-derivation logic — \"memory is absent, so reconstruct from episodic traces\" — is correct in isolation but ..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "aafb22401c2f6b3b4c981eeb86c57cd6cc646512935edd7dd0109e5df89a6e1b",
    "verified_classes": [
      "MemoryState",
      "TombstoneResurrectionError",
      "Record",
      "DecayJob",
      "VersionedMemoryStore"
    ],
    "verified_functions": [
      "safe_forget_then_rewrite",
      "__init__",
      "write",
      "forget",
      "read",
      "run_decay"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TombstoneResurrectionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
