{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-speculative-tool-call-conflicts-before-they-commit-in-a-concurrent-agent-swarm",
  "title": "How does an instance detect speculative tool-call conflicts before they commit in a concurrent agent swarm",
  "date_of_record": "2026 November 27",
  "scope": "Applies to swarms where agents speculatively pre-execute tool calls (reads, dry-runs, or idempotent-effect probes) against shared state ahead of a commit barrier, and where conflict detection is performed by comparing speculative read-sets and write-intents. Does not apply to strictly serialized single-agent tool loops or to tools whose effects are unconditionally isolated per-agent (e.g., private scratchpads with no shared backing store).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-tool-call-conflicts-before-they-commit-in-a-concurrent-agent-swarm.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-tool-call-conflicts-before-they-commit-in-a-concurrent-agent-swarm.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-tool-call-conflicts-before-they-commit-in-a-concurrent-agent-swarm.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2089,
    "python_slice_tokens": 476,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"two agents wrote the same key.\" That is the trivial write-write conflict, and any last-writer-wins or version-check catches it. The non-obvious boundary is the **read-set invalidation gap**: an agent speculatively pre-executes against state version `V`, computes a plan from that read, but the *conflict detector only compares write-intents...",
    "what_was_observed": "A three-agent swarm (planner, executor, verifier) shared a task-state store keyed by entity. The executor speculatively pre-executed a `reconcile_inventory` tool call: it read `inventory[sku_42].on_hand = 100`, read `orders.pending_count = 3`, and derived a plan to set `inventory[sku_42].on_hand = 97`. Concurrently, the planner committed `orders.pending_count = 5` (two new orders) after the executor's read but before...",
    "condition_of_validity": "The guardrail is valid only under these conditions, and each is load-bearing: - **Read-set capture is complete and at the correct granularity.** If the tool reads a collection and the agent logs only the collection key, not the elements it actually consumed, the read-set over-approximates or under-approximates. Under-approximation (logging `inventory` but no...",
    "decision_boundary": "The instance must choose between two regimes at the point of speculative pre-execution: - **Admit-and-validate (optimistic):** pre-execute freely, buffer effects, validate read-set ∪ write-set at commit against the version range. Correct when read-sets are cheap to capture and conflicts are rare. Cost: aborted speculative work on conflict, and the requiremen...",
    "operational_effect": "After the fix — read-set capture at transitive-key granularity, validation over `(base_version, commit_version]`, effect-buffering, and verifier replay at commit version — the observed behavior changed in three measurable ways: 1. The phantom-premise commit became an explicit `ReadSetConflict` abort at `t3`, costing one speculative re-execution but preservin..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "e970596552e620d1583ec8718ab71b56576a7f3e4578587c77fe5731ed731c84",
    "verified_classes": [
      "ReadSetConflict",
      "IncompleteReadSetError",
      "SpeculativeTxn",
      "Store"
    ],
    "verified_functions": [
      "reconcile_inventory",
      "commit"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "IncompleteReadSetError",
      "ReadSetConflict"
    ],
    "sample_fail_closed_invariants": [
      "assert s.data['on_hand'] == 95"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
