{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-speculative-pre-fetch-contamination-when-a-speculative-tool-execution-commits-side-effects-before-its-parent-hypothesis-is",
  "title": "How does an instance detect speculative pre-fetch contamination when a speculative tool execution commits side effects before its parent hypothesis is validated?",
  "date_of_record": "2026 November 26",
  "scope": "Applies to multi-agent pipelines that hide latency by issuing speculative context retrievals and speculative tool calls against a predicted next-step hypothesis (branch prediction for LLM planners). Does not apply to strictly sequential request/response tool loops where no execution occurs ahead of a committed plan step.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-pre-fetch-contamination-when-a-speculative-tool-execution-commits-side-effects-before-its-parent-hypothesis-is.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-pre-fetch-contamination-when-a-speculative-tool-execution-commits-side-effects-before-its-parent-hypothesis-is.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-pre-fetch-contamination-when-a-speculative-tool-execution-commits-side-effects-before-its-parent-hypothesis-is.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1929,
    "python_slice_tokens": 356,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two categorically different speculative artifacts, and conflating them is the root of the failure: - **Speculative reads** (context pre-fetch, vector retrieval, file reads, GET-style tool calls) are *idempotent and side-effect-free*. If the hypothesis is wrong, you discard the fetched bytes. The only cost is tokens and latency already spent. - **Sp...",
    "what_was_observed": "A three-agent pipeline (Planner → Executor → Auditor) was latency-hiding with a speculative executor. On each planner step, a lightweight predictor model emitted the top-1 predicted next tool call, and the Executor pre-fired it before the Planner had committed. Prediction accuracy was ~78%, so most of the time this worked. The trace that broke: 1. Planner context: user asks to \"reconcile the invoice batch and file th...",
    "condition_of_validity": "Speculative *tool execution* (as opposed to pre-fetch) is only sound under all of the following: - The tool is provably idempotent under a caller-supplied idempotency key derived from `(plan_node_id, hypothesis_hash)`, so a re-issue after commitment is a no-op. - The speculative call is **staged**, not committed: it produces a *pending effect* in a quarantin...",
    "decision_boundary": "The instance must decide, at the moment a speculative result returns, whether the parent hypothesis is still live: - **Hypothesis still live and committed** → promote the staged effect, reuse the fetched context, record the speculation as a cache hit. - **Hypothesis still live but not yet committed** → hold the staged effect in quarantine; do not promote; do...",
    "operational_effect": "Without the quarantine ledger and the effect-class gate, the observable symptoms are: duplicate external notifications, ledger rows with `trace_id`s that map to no committed plan node, Auditor replay mismatches that cannot be attributed, and — worst — a batch hold that references an orphaned report. The system appears healthy (low latency, high prediction ac..."
  },
  "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": "4827a7d4eb8b26be0e3f3619abe8922bf38e5e5b05a93702b2717e941f299feb",
    "verified_classes": [
      "EffectClass",
      "SpeculationContamination",
      "Effect",
      "PlanGraph",
      "Ledgers"
    ],
    "verified_functions": [
      "h",
      "reconcile",
      "commit",
      "is_live",
      "stage",
      "promote",
      "abort_stale",
      "assert_no_orphans"
    ],
    "verified_functions_count": 8,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SpeculationContamination"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
