{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-non-idempotent-tool-side-effects-during-speculative-branch-merge-the-write-set-provenance-invariant",
  "title": "How does an instance detect non-idempotent tool side effects during speculative branch merge: the write-set provenance invariant",
  "date_of_record": "2026 November 14",
  "scope": "Applies to agents that fork speculative execution branches, execute tool calls and shared-memory writes on those branches, and merge them back with conflict detection. Does not apply to purely functional branches with no external side effects, nor to single-branch execution where merge ordering is trivial.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-non-idempotent-tool-side-effects-during-speculative-branch-merge-the-write-set-provenance-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-non-idempotent-tool-side-effects-during-speculative-branch-merge-the-write-set-provenance-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-non-idempotent-tool-side-effects-during-speculative-branch-merge-the-write-set-provenance-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1474,
    "python_slice_tokens": 195,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Conflict detection on shared memory is a *read-write* problem: two branches that touch the same cell can be reconciled by comparing vector clocks, version stamps, or content hashes. Conflict detection on *tool side effects* is a *write-once* problem: an external call that transferred money, sent an email, or appended to an append-only log has already happene...",
    "what_was_observed": "A planner agent forked three speculative branches from a shared state at version `v17`. Branch A called `payments.charge(account=42, amount=100, idempotency_key=\"ord-9\")`. Branch B called `payments.charge(account=42, amount=100, idempotency_key=\"ord-9\")` — the same key, deliberately, because both branches derived the same plan. Branch C wrote a shared-memory cell `order.status = \"confirmed\"` and called `notifications...",
    "condition_of_validity": "The write-set provenance invariant is valid — that is, the merge can be trusted to report \"no conflict\" honestly — only when all of the following hold: - Every side-effecting tool call is stamped with `(branch_id, base_version, effect_id)` where `effect_id` is generated *before* the call is dispatched, not after it returns. - The effect journal is append-onl...",
    "decision_boundary": "When the merge encounters two effect records with the same `(branch_id, base_version)` lineage but distinct `effect_id`s, it must treat this as a **conflict**, not a duplicate, and must not auto-resolve. When it encounters two records with the same `effect_id`, it may deduplicate — but only if the effect's dispatch is confirmed by a durable local receipt, ne...",
    "operational_effect": "Enforcing write-set provenance converts a class of silent double-spend and double-notify failures into loud merge aborts. The cost is throughput: branches that speculatively execute side-effecting calls will abort more often, because the planner must now be conservative about forking branches that reach the same effect. The benefit is that the failure mode m..."
  },
  "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": "0fa97ab10dc912b5b293e03b8d73105404e960565aa88437281073968eb426ac",
    "verified_classes": [
      "EffectProvenanceError",
      "EffectRecord"
    ],
    "verified_functions": [
      "merge_effects"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "EffectProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
