{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-torn-read-write-forget-invariant-when-an-agent-s-memory-tool-api-serves-reads-from-a-stale-snapshot-mid-forget",
  "title": "What structural signals indicate a torn read/write/forget invariant when an agent's memory tool API serves reads from a stale snapshot mid-forget",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that expose memory as explicit tool calls (`memory.read`, `memory.write`, `memory.forget`) backed by a store with per-key versioning and asynchronous tombstone propagation. Does not apply to append-only vector stores with no delete semantics, nor to single-process in-memory buffers where reads and writes share one lock.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-torn-read-write-forget-invariant-when-an-agent-s-memory-tool-api-serves-reads-from-a-stale-snapshot-mid-forget.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-torn-read-write-forget-invariant-when-an-agent-s-memory-tool-api-serves-reads-from-a-stale-snapshot-mid-forget.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-torn-read-write-forget-invariant-when-an-agent-s-memory-tool-api-serves-reads-from-a-stale-snapshot-mid-forget.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1757,
    "python_slice_tokens": 322,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode here is not \"lost write\" or \"stale retrieval.\" It is a **torn forget**: a `memory.forget` call returns success, the tombstone is durably logged, but a concurrent `memory.read` on the same key is served from a snapshot taken *before* the tombstone was applied, and the agent then re-writes the forgotten fact back into memory because it treats ...",
    "what_was_observed": "A long-running assistant agent managed a user profile memory. Sequence across three tool calls with wall-clock gaps: 1. `memory.forget(\"user.employer\")` → `{\"ok\": true, \"version\": 412}`. 2. `memory.read(\"user.employer\")` → `{\"value\": \"Acme Corp\", \"version\": 408}` (served from a read lease opened at 408, still valid for 900 ms). 3. The agent, mid-task, \"refreshed\" its working context by re-writing every key it had jus...",
    "condition_of_validity": "The torn-forget is only possible when all of the following hold simultaneously: - Reads are served under a **lease or snapshot that can lag the write path**, and the returned payload does not force the caller to reconcile versions. - The agent's memory policy includes a **read-then-write refresh pattern** (common in context-compaction loops, where the agent ...",
    "decision_boundary": "The operational rule the agent must adopt: **a read result is admissible as a write source only if its version is ≥ the highest version the agent has observed for that key from any prior write or forget acknowledgment.** Concretely, the agent maintains a per-key high-water mark `HWM[k]`, updated on every `write`/`forget` return and on every read return. A re...",
    "operational_effect": "When the boundary is respected, the observable effect is that **forget is monotonic per key from the agent's perspective**: no fact the agent forgot can reappear in its working context without an explicit `resurrect` tag, and the store's version log becomes an auditable proof of intent. When the boundary is violated, the effect is silent: the user's deletion..."
  },
  "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": "65c6ffd8d6df7f1148a626fbbf9cfa401fe2b40a468a74df128879d0badb35fa",
    "verified_classes": [
      "TornForgetError",
      "MemoryStore",
      "AgentMemory"
    ],
    "verified_functions": [
      "write",
      "forget",
      "read",
      "__init__",
      "_bump",
      "forget",
      "refresh_from_read"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TornForgetError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
