{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-branch-commits-from-leaking-side-effects-across-an-agent-swarm",
  "title": "Which invariants prevent speculative branch commits from leaking side effects across an agent swarm",
  "date_of_record": "2026 November 23",
  "scope": "Applies to multi-agent systems that run speculative execution branches (parallel candidate trajectories, speculative tool calls, or optimistic plan forks) and later commit exactly one branch while rolling back the rest. Does not apply to single-agent linear execution or to systems where every tool call is already idempotent and externally reversible.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-commits-from-leaking-side-effects-across-an-agent-swarm.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-commits-from-leaking-side-effects-across-an-agent-swarm.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-commits-from-leaking-side-effects-across-an-agent-swarm.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2258,
    "python_slice_tokens": 575,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *logical rollback* and *physical rollback*. A speculative branch can be logically discarded in O(1) time by dropping its state record, but the tool calls it already issued to the outside world—writes, payments, messages, file mutations, queue enqueues—are physical and persist independently of the agent's state graph. T...",
    "what_was_observed": "A planner agent forked three speculative branches to satisfy a single user request (\"reconcile the two ledgers and file the discrepancy report\"). Branch A chose a direct API write to the downstream accounting service. Branch B chose to stage a CSV and enqueue a job. Branch C chose to email the finance alias with an attachment. Each branch was assigned a distinct `branch_id` and a private context window; each was told...",
    "condition_of_validity": "The \"rollback makes speculation safe\" claim is valid only when all four of the following hold simultaneously: 1. **Effect classification is complete and enforced at the transport layer, not the prompt layer.** Every tool exposed to a speculative branch must carry a machine-readable `effect_class` (`read_only`, `idempotent_write`, `non_idempotent_write`, `ext...",
    "decision_boundary": "The decision boundary is whether to allow *speculative side effects at all*. Two regimes: - **Effect-isolated speculation (safe):** Speculative branches may issue `read_only` calls freely and `idempotent_write` calls keyed by `(branch_id, call_index)` so that duplicate issuance is absorbed by the downstream's idempotency layer. `non_idempotent_write` and `ex...",
    "operational_effect": "When the invariant holds (effect-isolated speculation), the orchestrator's rollback handler becomes trivial: it drops branch records and issues no compensations, because no compensations are needed. The cost is that speculative branches cannot \"test\" irreversible actions—they can only test their *plans* for such actions, which is a real loss of fidelity: a b..."
  },
  "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": "f8dcc3eb776a836a37148aa1351920cc8541ff22bfac080b97d50c241ae18a18",
    "verified_classes": [
      "SpeculativeLeakError",
      "CommitToken",
      "Branch"
    ],
    "verified_functions": [
      "_seq_hash",
      "dispatch_tool_call",
      "rollback_branch",
      "commit_branch",
      "_demo",
      "matches"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 8,
    "raised_exceptions": [
      "SpeculativeLeakError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
