{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-tool-call-pre-execution-from-corrupting-shared-multi-agent-state",
  "title": "Which invariants prevent speculative tool-call pre-execution from corrupting shared multi-agent state",
  "date_of_record": "2026 December 1",
  "scope": "Applies to multi-agent systems where an orchestrator speculatively pre-executes side-effecting tool calls (writes, mutations, RPCs) on behalf of a peer agent against a shared mutable store, before the peer's plan is committed. Does not apply to read-only speculative prefetch, single-agent tool calls, or systems where every tool call is fully serialized through one commit queue.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-pre-execution-from-corrupting-shared-multi-agent-state.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-pre-execution-from-corrupting-shared-multi-agent-state.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-call-pre-execution-from-corrupting-shared-multi-agent-state.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1715,
    "python_slice_tokens": 390,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **speculation on reads** and **speculation on effects**. Read-ahead speculation is safe because the worst outcome is wasted tokens and a cache miss. Effect speculation is unsafe because a tool call that mutates shared state is a *committed fact* the moment it executes, even if the agent that requested it later abandons...",
    "what_was_observed": "A three-agent cohort (planner, executor, auditor) shared a Postgres-backed task store. The executor speculatively pre-executed `reserve_inventory(sku, qty)` for a plan the planner had not yet committed, because the planner's draft plan included it and the executor's scheduler wanted to hide tool latency. The auditor, running concurrently, speculatively pre-executed `reserve_inventory(sku, qty)` for a *different* plan...",
    "condition_of_validity": "The disjointness invariant is only valid when all four of the following hold simultaneously: 1. **Write-set declaration precedes execution.** Every speculative call must declare its full write-set (table + key + operation class) *before* the tool executes, not derive it from the tool's return. This is a schema obligation on the tool, not an inference the orc...",
    "decision_boundary": "The boundary is between **speculate-then-verify** and **reserve-then-execute**. Speculate-then-verify (execute the effect, then check whether it was OK) is only sound for idempotent, commutative, write-set-disjoint effects. Reserve-then-execute (register the write-intent atomically, execute only after registration succeeds, release on abort) is required for ...",
    "operational_effect": "With reserve-then-execute and a cohort-wide intent registry, speculative pre-execution retains most of its latency benefit (the reservation is cheap; the expensive tool body still runs early) while making the oversell class of failure structurally impossible: the second `reserve(sku=7)` in the trace above would have been rejected at registration because its ..."
  },
  "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": "bad225b3a62be533b2c56962d9f560f51f2fbf89b98dae8ca5eb6d63915152fb",
    "verified_classes": [
      "WriteIntentConflict",
      "LeaseExpired",
      "WriteIntent",
      "IntentRegistry"
    ],
    "verified_functions": [
      "speculative_execute",
      "conflicts_with",
      "__init__",
      "_reap",
      "acquire",
      "release",
      "assert_held"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "LeaseExpired",
      "WriteIntentConflict"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
