{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-tool-pre-warming-from-corrupting-agent-state-the-branch-commit-boundary-in-learned-prior-prediction",
  "title": "Which invariants prevent speculative tool pre-warming from corrupting agent state: the branch-commit boundary in learned prior prediction",
  "date_of_record": "2026 November 12",
  "scope": "Applies to agents that speculatively execute tool invocations (pre-warm) against a learned prior over task outcomes, where the speculative result may be committed to shared state. Does not apply to read-only speculative prefetch whose results are discarded unconditionally on miss, nor to deterministic single-branch execution.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-pre-warming-from-corrupting-agent-state-the-branch-commit-boundary-in-learned-prior-prediction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-pre-warming-from-corrupting-agent-state-the-branch-commit-boundary-in-learned-prior-prediction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-tool-pre-warming-from-corrupting-agent-state-the-branch-commit-boundary-in-learned-prior-prediction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1471,
    "python_slice_tokens": 272,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Speculative pre-warming is safe only when the speculative effect is *effectively invisible until a commit point that is causally downstream of the branch decision*. The distinction that matters is not \"read vs. write\" but **idempotent-observable vs. non-idempotent-observable**: a pre-warmed `search` that is later discarded is harmless; a pre-warmed `charge_c...",
    "what_was_observed": "In a run with a learned outcome prior trained on 40k prior episodes (tool-selection accuracy 0.91, top-1), the pre-warmer issued a `create_ticket` speculative call at step 7 of an incident-triage task. The prior assigned p=0.93 to the branch \"requires escalation.\" At step 9 the planner's actual branch resolution selected \"no escalation\" because a fresh log line contradicted the forecast. The speculative ticket had al...",
    "condition_of_validity": "Pre-warming is valid only under all three of the following, checked at issue time: 1. **Effect isolation.** Every speculative invocation must be issued against a namespace, transaction, or idempotency key derived from `(branch_id, speculative_epoch)` such that its effects are not observable to any reader that has not also joined that branch. For non-idempote...",
    "decision_boundary": "The boundary is between **pre-warming for latency** and **pre-committing for throughput**. Pre-warming is a latency optimization: it moves work earlier in wall-clock time while leaving the decision graph unchanged. Pre-committing is a semantic change: it asserts an outcome before the decision that produces it. The learned prior is a legitimate input to the f...",
    "operational_effect": "Enforcing the three conditions converts a class of silent state-corruption failures into explicit, catchable rejections at issue time, at the cost of reduced speculative hit rate (observed: 71% → 58% in the affected cohort) and a small increase in pre-warm latency for non-idempotent tools routed through staging. The trade is favorable: phantom external effec..."
  },
  "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": "4654639d6480f8a8650640b8911be2e1a28e64d738661ba21ec2c1b5d5dfcdb5",
    "verified_classes": [
      "SpeculationBoundaryError",
      "ToolContract",
      "SpeculativeCall"
    ],
    "verified_functions": [
      "authorize_prewarm",
      "prewarm_queue"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpeculationBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
