{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-and-resolve-a-concurrent-memory-write-conflict-when-two-agent-branches-disagree-on-the-same-key",
  "title": "How does an instance detect and resolve a concurrent memory-write conflict when two agent branches disagree on the same key",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent architecture where an instance mutates a persistent memory store (episodic or semantic) and where more than one execution branch—parallel sub-agents, a resumed checkpoint, or a retry after a tool timeout—can write the same memory key without a shared serialization point. Does not apply to single-writer, single-threaded memory stores with a global lock.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-and-resolve-a-concurrent-memory-write-conflict-when-two-agent-branches-disagree-on-the-same-key.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-and-resolve-a-concurrent-memory-write-conflict-when-two-agent-branches-disagree-on-the-same-key.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-and-resolve-a-concurrent-memory-write-conflict-when-two-agent-branches-disagree-on-the-same-key.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1988,
    "python_slice_tokens": 324,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"lost update\" in the classical database sense. A database detects write-write conflict via row versions or MVCC and aborts one transaction. An LLM agent does not: it *reasons* about the conflict, and its reasoning is what corrupts the store. The distinction that matters is between **temporal versioning** (the store knows *when* a fact...",
    "what_was_observed": "A planner agent spawned two worker branches (A and B) to research a target organization. Both were instructed to upsert findings into a shared semantic memory namespace under key `org.current_ceo`. - Branch A read a cached profile snapshot (observation epoch `E=40`) and, after a 6.2s tool round-trip, wrote `current_ceo = \"R. Okafor\"` at commit time `09:14:02.881`. - Branch B read a fresher press release (observation ...",
    "condition_of_validity": "The last-write-wins reconciliation is only valid when **all of the following hold simultaneously**: 1. Every write carries an explicit `observation_epoch` (a monotonic counter or logical clock incremented on each read of the underlying source), distinct from `commit_time`. 2. The store's conflict detector compares `observation_epoch`, not `commit_time`, and ...",
    "decision_boundary": "The boundary between \"reconcile silently\" and \"escalate to the agent\" is drawn on **semantic divergence**, not on version conflict alone: - **Same key, one write strictly dominates on `observation_epoch`** → resolve silently: keep the higher-epoch write, tombstone the lower with `superseded_by` pointing at the winner. No agent involvement. This is the common...",
    "operational_effect": "With observation-epoch versioning and a single reconciliation order, the failure mode changes from *silent stale reads* to *explicit contested keys*, which the planner can resolve by re-querying the authoritative source or by applying a source-authority policy. The cost is bounded: contested keys are rare (they require causally independent branches writing t..."
  },
  "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": "2fdb19299b8f15f510121d1a1a56d4cd3bda9a1f078238f60642d35f97ce4a93",
    "verified_classes": [
      "MemoryWriteConflict",
      "ZombieWriteError",
      "Version",
      "MemoryRecord"
    ],
    "verified_functions": [
      "reconcile",
      "upsert"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "MemoryWriteConflict",
      "ZombieWriteError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
