{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-a-stale-fact-resurrection-when-an-agent-s-forget-and-write-memory-tools-race-across-a-checkpoint-boundary",
  "title": "Which invariants prevent a stale-fact resurrection when an agent's `forget` and `write` memory tools race across a checkpoint boundary",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agents exposing discrete `read`/`write`/`forget` memory tools whose mutations are durable across checkpoint/resume cycles and where multiple tool calls may be issued against overlapping keys within a single reasoning episode. Does not apply to append-only logs with no deletion semantics, nor to single-turn stateless retrievers.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-a-stale-fact-resurrection-when-an-agent-s-forget-and-write-memory-tools-race-across-a-checkpoint-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-a-stale-fact-resurrection-when-an-agent-s-forget-and-write-memory-tools-race-across-a-checkpoint-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-a-stale-fact-resurrection-when-an-agent-s-forget-and-write-memory-tools-race-across-a-checkpoint-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1908,
    "python_slice_tokens": 398,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the agent forgot to call `forget`.\" It is that `forget` and `write` are *independent* tool calls whose ordering is decided by the model's token stream, not by a transaction manager. When an agent issues `forget(k)` to retract a contradicted fact and then, before the checkpoint commits, issues `write(k, v')` (or resumes from a checkpo...",
    "what_was_observed": "An agent maintaining a user-profile memory store (`key → (value, source_turn, logical_clock)`) processed a correction: turn 40 wrote `employer=\"Acme\"`; turn 88 the user said \"I left Acme, I'm at Globex now.\" The agent's plan was two calls: `forget(\"employer\")` then `write(\"employer\", \"Globex\")`. The checkpoint daemon snapshotted the store at wall-clock T between the two tool dispatches. The `forget` had been applied ...",
    "condition_of_validity": "Contradiction-safe mutation holds only when all three of the following are true simultaneously: 1. **Per-call logical clocks, monotonic across the episode.** Every `write` and `forget` carries a clock strictly greater than any clock visible in the snapshot it was derived from. Turn-granular clocks are insufficient; the clock must advance per *mutation*, and ...",
    "decision_boundary": "The agent must treat the following as a hard boundary, not a heuristic: - If a `read(k)` after resume returns a value whose `source_turn` predates the most recent `forget(k)` the agent *believes* it issued, the agent must not trust the read. It must verify: re-issue `read` with an explicit `include_tombstones=true` (or equivalent) and confirm the tombstone's...",
    "operational_effect": "The practical consequence is that the agent's memory is only as trustworthy as its *ordering discipline*, and ordering is the one thing a probabilistic planner does not naturally respect. An agent that reasons \"I'll forget the old employer and write the new one\" has produced a correct *plan* and an unsafe *execution*, because the plan has no notion of commit..."
  },
  "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": "e235a754d2dd5e7c9e2941264e92dbf36a214680acbd0f7cdd6d88d66d2ef5ab",
    "verified_classes": [
      "MemoryContradictionError",
      "Record",
      "MemoryStore"
    ],
    "verified_functions": [
      "resume",
      "assert_trustworthy",
      "_append",
      "write",
      "forget",
      "read"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "MemoryContradictionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
