Counting, done carefully.

Foresight never calls a model. Every number is arithmetic over stored spans, with the history it stands on.

  1. Runs

    Every step of a run is a span: a model call, a tool call or a sub-agent, in start order. The example agent here is ci-fix, Claude Code 2.1.303, headless in GitHub Actions on claude-sonnet-5-5, asked to make a failing test pass.

    delegate-1 handed the failure to a test-investigator sub-agent, fixed the code and ended in success. rerun_loop-0 ran the failing test again and again, and ended in failure.

    delegate-1success

    1. llm claude-sonnet-5-5
    2. tool Agent
    3. agent test-investigator
    4. llm claude-haiku-5-5
    5. tool Grep
    6. llm claude-haiku-5-5
    7. llm claude-sonnet-5-5
    8. tool Edit
    9. llm claude-sonnet-5-5
    10. tool Bash
    11. llm claude-sonnet-5-5

    rerun_loop-0failure

    1. llm claude-sonnet-5-5
    2. tool Bash
    3. tool Bash
    4. tool Bash
    5. tool Bash
    6. llm claude-sonnet-5-5
  2. Paths

    A step becomes a token, kind:name: its signature without its input, so two calls of one tool are the same behaviour whatever the arguments.

    Repeats in a row fold into one token by bucket, so a loop is one shape, not a tree that grows a level per iteration.

    1. llm
    2. Bash
    3. Bash
    4. Bash
    5. Bash
    6. llm
    1. llm:claude-sonnet-5-5
    2. tool:Bash×3-5
    3. llm:claude-sonnet-5-5
    Repeat buckets
    Repeats in a rowToken
    1 tool:Bash
    2 tool:Bash×2
    3 to 5 tool:Bash×3-5
    6 or more tool:Bash×6+
  3. Cohorts

    Runs are compared only with runs of the same agent in the same tenant

    Foresight guide

    A run’s outcome is its latest declared session.outcome, else the status of the span that ended last. A run still active in the last 15 minutes is unknown: left out of every rate, and counted.

    ci-fix has 165 completed runs in the last 30 days and 3 in flight. Its base rate is 106 ÷ 165 = 64.2%.

    • support-agent180 completed

      base rate 54.4%

    • ci-fix165 completed

      base rate 64.2%

    • researcher40 completed

      base rate 50.0%

  4. Wilson intervals

    Every node carries a success rate and a 95% interval. The textbook interval, p ± 1.96·√(p(1−p)/n), lies about small samples: for 0 of 3 it says 0.0–0.0%, “give or take nothing”. Wilson’s score interval says 0.0–56.2%, which is what three runs tell you.

    Wilson 0.0–56.2% textbook 0.0–0.0%

    The retry loop’s 3 of 40 is 2.6–19.9% by Wilson, the interval the engine reports for that node (2.6–19.9%); the textbook says 0.0–15.7%.

    the textbook interval for 0 of 3: a point

  5. Fatal forks

    A child step is a fatal fork when it sits

    at least 25 points below its siblings' pooled rate

    a two-sided Fisher exact test puts the difference at p < 0.05

    Foresight guide

    with at least 3 runs on each side.

    ci-fix’s retry loop, tool:Bash×3-5, succeeded 7.5% of the time against 82.4% for runs that did something else after the first model call: p = 5.0 × 10⁻¹⁸.

    Every node of the map (23)
    Every node of the ci-fix Fate Map
    PathRunsSucceededFailedAbandonedRate95% CILiftFlag
    llm:claude-sonnet-5-5 165 106 52 7 64.2% 56.7–71.2% 1.00 hotspot, 1.51 bits
    llm:claude-sonnet-5-5 › tool:Bash 80 65 15 0 81.3% 71.3–88.3% 1.26
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 80 65 15 0 81.3% 71.3–88.3% 1.26
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:Read 50 45 5 0 90.0% 78.6–95.7% 1.40
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:Read › llm:claude-sonnet-5-5 50 45 5 0 90.0% 78.6–95.7% 1.40
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:Read › llm:claude-sonnet-5-5 › tool:Edit 50 45 5 0 90.0% 78.6–95.7% 1.40
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:Read › llm:claude-sonnet-5-5 › tool:Edit › llm:claude-sonnet-5-5 50 45 5 0 90.0% 78.6–95.7% 1.40
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:Read › llm:claude-sonnet-5-5 › tool:Edit › llm:claude-sonnet-5-5 › tool:Bash 50 45 5 0 90.0% 78.6–95.7% 1.40
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:Read › llm:claude-sonnet-5-5 › tool:Edit › llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 50 45 5 0 90.0% 78.6–95.7% 1.40
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:mcp__github__add_issue_comment 30 20 10 0 66.7% 48.8–80.8% 1.04
    llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 › tool:mcp__github__add_issue_comment › llm:claude-sonnet-5-5 30 20 10 0 66.7% 48.8–80.8% 1.04
    llm:claude-sonnet-5-5 › tool:Agent 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 › tool:Grep 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 › tool:Grep › llm:claude-haiku-5-5 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 › tool:Grep › llm:claude-haiku-5-5 › llm:claude-sonnet-5-5 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 › tool:Grep › llm:claude-haiku-5-5 › llm:claude-sonnet-5-5 › tool:Edit 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 › tool:Grep › llm:claude-haiku-5-5 › llm:claude-sonnet-5-5 › tool:Edit › llm:claude-sonnet-5-5 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 › tool:Grep › llm:claude-haiku-5-5 › llm:claude-sonnet-5-5 › tool:Edit › llm:claude-sonnet-5-5 › tool:Bash 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Agent › agent:test-investigator › llm:claude-haiku-5-5 › tool:Grep › llm:claude-haiku-5-5 › llm:claude-sonnet-5-5 › tool:Edit › llm:claude-sonnet-5-5 › tool:Bash › llm:claude-sonnet-5-5 45 38 7 0 84.4% 71.2–92.3% 1.31
    llm:claude-sonnet-5-5 › tool:Bash×3-5 40 3 30 7 7.5% 2.6–19.9% 0.12 fatal fork, p = 5.0 × 10⁻¹⁸
    llm:claude-sonnet-5-5 › tool:Bash×3-5 › llm:claude-sonnet-5-5 40 3 30 7 7.5% 2.6–19.9% 0.12

    Nodes with fewer than 3 runs are pruned (none here). Lift is the node’s rate over the agent’s base rate.

    after the first model call

    • Bash 65 of 80
    • Agent 38 of 45
    • Bash×3-5 3 of 40

    fatal fork: 75 points below

    after Bash, a model call

    • Read 45 of 50
    • add_issue_comment 20 of 30

    not flagged: 23 points below

  6. Verdicts

    A run’s path so far is walked down its agent’s map. Its last step is still open: having run the test three times, it may run it again, so it is compared with every run that repeated that step at least as often.

    • on_track The interval’s upper bound clears both 50% and the agent’s base rate, on a path with enough history.
    • at_risk The upper bound is below the agent’s base rate: runs on this path do measurably worse than the agent’s average.
    • likely_failure The 95% interval’s upper bound is below 50%: with 95% confidence, runs on this path fail more often than they succeed.
    • novel The run took a step no earlier run of its agent took at that point. The answer says where, what it took, and what the runs that got there did instead.
    • insufficient_history Fewer than 30 earlier runs share the path, the agent has no completed runs in the window, or the map was cut short there by its node bound. No guess.
    50% base rate 64% live-ci-doomed-0 live-ci-healthy-0

    likely_failure upper bound 19.9% < 50%

    on_track upper bound 95.7%, above both lines

    novel left the map at depth 3

Predictive fuses

A fuse policy may set min_success_odds. At the pre-call check, never on ingest, its action applies when a run’s foresight stands on at least 30 earlier runs, the run has at least 3 steps, and the interval’s upper bound is below the odds. So thin history stops nothing: 0 of 3 never stops a run.

stop live-ci-doomed-0, before tool:Bash, at odds 0.3: foresight: runs that took this path and then called tool:Bash succeeded 3 of 40 times (≤19.9%)

Set a predictive fuse

Calibration

A prediction is only worth what it has been worth: each map predicts every completed run from the half of the cohort it is not in, using only what the run had done by then.

On ci-fix, depth 3 removes 44% of the base rate’s error; a dot on the diagonal came true as often as it predicted.

Reliability at depth 3

0% 100% predicted 100% observed

Record your first run in five minutes.

Sign in, create a project, copy a key, set three environment variables.