Decision model reference

This page holds the facts of the decision model. Read it to find one fact. What Jev decides, where a run asks it and how to configure it are on Decision model (Jev).

On this page: decide.py reference · Settings · Evidence

decide.py reference

Command

python3 ~/.claude/hooks/decide.py --kind tier,effort,split "<state of unit 1>" "<state of unit 2>"

Give several states, or several --kind values, in one command. Each call costs the asking agent a turn, and that turn is the real price.

Argument Effect

--kind <presets>

One or more presets, joined by commas.

--ask "<question>"

A custom question. It needs two or more --option.

--option <name>="<criterion>"

One option of the custom question, and when it is right.

--tag <id>

An id that the log record stores. price-gate.py passes price-gate.

--selftest

Checks the script without the network and prints selftest ok.

<state>

Facts about the choice, one state for each unit. With no state, the script reads standard input.

Presets

Preset Question and options Asked by

tier

Which model? haiku, sonnet, opus.

ft-developer, bugfix-agent, any session.

effort

How much reasoning? low, medium, high.

The same askers, and price-gate.py together with run.

split

Split the unit or keep it? split, keep.

ft-developer, bugfix-agent, any session.

slice

Hand a part of the plan to a child orchestrator or dispatch leaves? slice, leaves.

ft-developer.

grade

The ft-developer Stage 1 grade: architecture-led, TDD-led, simple-addition. A simple-addition run that outgrows its budget still returns PLAN_INVALIDATED and is graded up.

ft-developer.

run

The model of a whole run: sonnet, opus.

price-gate.py, for a main-loop launch.

recheck

The model of a judgment lens that re-checks its own objections: sonnet, opus.

price-gate.py.

A custom question uses --ask "<question>" --option a="<when a is right>" --option b="<when b is right>". The output reports it under the kind custom. The test adversary uses this form: decide.py --ask "Model for the test adversary on this change" --option opus=<when> --option sonnet=<when>.

The criteria of each option are in PRESETS in deploy/templates/hooks/decide.py. The eight questions summarizes them.

The state

The state is a fixed template. It holds files, lines, and yes or no for each signal. The signals are precedent, new test class, new table, auth surface, contract change, cross-module, concurrency and every edit named.

The template for a unit is:

Unit: <noun phrase>. files: <n> · lines: ~<n> · precedent to copy: yes|no · new test class: yes|no · new table: yes|no · auth surface: yes|no · contract or protocol change: yes|no · cross-module: yes|no · concurrency: yes|no · every edit named in the brief: yes|no

Output and the UNSURE rule

decide.py prints one line for each question. That line is the whole result. With several states, each line starts with [n]. The exit code is 0 for every answer, since an unsure or unreachable model is a normal outcome. A usage error, such as an unknown --kind or an empty state, exits with 2.

Line Meaning The asker

<kind>: DECIDED <option> (<confidence>)

The answer is confident and valid.

Takes it and does not re-argue it. The source is jev.

<kind>: UNSURE not-confident

The model could not separate the options.

Decides itself. The source is self.

<kind>: UNSURE unreachable, no-key, bad-reply or error

The model is unavailable.

Decides itself. Never retries and never blocks on it.

<kind>: UNSURE too-large or secret-like

The script refused to send the payload.

Restates the state as facts, or decides itself. A refused state got no answer, so a restated state is not a second ask.

UNSURE means the asker decides. After UNSURE, the asker uses the tables in Model and effort. For effort, the asker uses medium. This is normal, and the asker never retries.

Confidence

The confidence is normalised: (p_top * n - 1) / (n - 1) over n options. A value of 0 is a coin toss and 1 is certainty. The floor is 0.8. The effort question has its own floor of 0.7. A wrong effort costs little, and an unsure one resolves to medium. On three options, 0.8 means a top probability of at least 0.87, and 0.7 means at least 0.80. On three options, a split of 0.63 and 0.37 scores 0.45 and is UNSURE.

What leaves the machine

The state, the question and the option criteria all leave the machine. Pass facts about the choice: sizes, counts, and which signals are present or absent. Write absence in words (auth surface: no). Never pass code, file contents, credentials, hostnames, IP addresses, customer data or ticket text.

decide.py refuses the obvious secret shapes (secret-like). It also refuses a payload over 4000 characters (too-large). The check runs before the key is read, and the secret check comes first. The check catches obvious secret shapes only. The agent must filter the payload.

Time limits

Each call stops after 8 seconds. When price-gate.py asks, the call stops after 3 seconds, inside the 5 seconds of the hook. After one unreachable answer, the script stops dialling and skips the remaining states of the same command. Do not wrap the call in timeout. macOS has no such command, so the model is never reached.

How price-gate.py treats the Pick line

The hook asks Jev itself at four points, with two questions:

Point Question On UNSURE, or on any failure

A main-loop launch of ft-developer past its Stage 5 approval, not in Mode: slice. One answer for each run journal.

run with effort

sonnet and the dispatch’s own effort.

A main-loop launch of bugfix-agent with no MAJOR and no CRITICAL in the brief. One answer for the whole run. A named MINOR wins over those words.

run with effort

sonnet and the dispatch’s own effort.

A main-loop launch of refactor-agent. One answer for the whole run.

run with effort

sonnet and the dispatch’s own effort.

A verifier re-check of a judgment lens, not Security and not CRITICAL. Its description names a re-check or a delta.

recheck

opus.

These four asks send a descriptor of flags and counts, and the brief stays on the machine. The launch applies only when the model is left out or is opus. FT_TIER_AB=0 turns the four asks off. The results go to ~/.local/state/ft-ai-toolkit/tier-ab.jsonl.

For the other checks that read a Jev answer, the hook treats the source in the Pick: line like this:

Source in the Pick: line What the hook does

jev

The hook requires a decide.py call in the dispatcher’s own transcript, or (recorded: <journal path>) that names a file with the answer. The test adversary leaves opus only with this source. A Jev opus on a coding first dispatch runs on sonnet if its confidence is under 0.9 or is not on record.

self

The hook requires (unsure: <tier, model or effort>) or an error note. It also requires a decide.py call in the transcript. A self opus pick on a coding first dispatch runs on sonnet (tier_ab), and a unit that fails there climbs to opus.

override

The hook requires a cited signal after the colon. The hook denies an override to haiku.

The dash in the line can be -, -- or an em dash. One source can cover both the model and the effort. Two sources name the model first, as in Pick: sonnet/medium - jev/self (unsure: effort).

The hook checks the transcript only when it can find the transcript. An error note in the line also exempts the dispatch from the decide.py call.

The hook denies a dispatch whose Pick: line is missing or differs from the model and effort of the call. It lists every missing item at once. The check applies when ft-developer or bugfix-agent dispatches a coding agent, ft-ui-ux-design or a slice.

When the key is missing or the endpoint is down

decide.py fails open. It prints UNSURE no-key or UNSURE unreachable, writes the log line and exits with 0. The orchestrator decides by the tables, and the source is self. price-gate.py is also fail-open when it asks Jev itself. For a whole run, UNSURE gives sonnet and the dispatch’s own effort. For a recheck, UNSURE keeps opus.

Where answers are logged

Every call appends one JSON line to ~/.local/state/ft-ai-toolkit/decisions.jsonl. The record holds the time, the model, the state, the options, the probabilities, the result, the confidence, the cost, the routed model and the latency. A payload that was refused is stored as <withheld: secret-like> or <withheld: too-large>, not as text. A call with --tag adds a tag, and price-gate.py writes price-gate there. Read the log to tune the confidence floor. A failure to write the log never costs a decision.

Settings

Variable Default Effect

OPENROUTER_API_KEY

none

The API key. If it is empty, decide.py reads the key file.

FT_DECIDE_KEY_FILE

~/.config/ft-ai-toolkit/openrouter.key

The key file. Keep it at mode 600.

FT_DECIDE_MODEL

typesafe/jev-1.13

The decision model.

FT_DECIDE_MIN_CONFIDENCE

0.8

The confidence floor. Values outside 0.5 to 1 fall back to 0.8. The effort floor stays 0.7.

FT_DECIDE_LOG

~/.local/state/ft-ai-toolkit/decisions.jsonl

The decision log.

The endpoint is fixed in the script (https://openrouter.ai/api/alpha/decisions), so the key goes nowhere else. The script sends POST /api/alpha/decisions, and Jev returns probabilities for each option.

The settings of the hook swaps, such as FT_TIER_AB, are on Dispatch Economy Reference.

Evidence

The decision log is ~/.local/state/ft-ai-toolkit/decisions.jsonl. The shadow measurements below come from the record deploy/evals/dispatch-economy-evidence.md (evidence §20 for the shadow runs).

Cost per answer, measured. One decision log holds 6698 calls from 2026-10-13 to 2026-11-02, for a total of $0.17. The median call took 349 milliseconds, and 8 of 10 calls took 233 to 511 milliseconds. The median call with a recorded cost cost about $0.000027. One call can hold several questions.

Share of DECIDED answers, in the same log. The log also holds replays and the closed shadow runs.

Question Questions asked DECIDED Share

tier

3671

2561

70%

grade

401

274

68%

custom

95

57

60%

recheck

874

498

57%

run

1412

788

56%

effort

4951

1663

34%

slice

19

5

26%

split

871

217

25%

The grade is asked first; the shadows are closed. Jev answered four questions in shadow from 2026-10-16. The answers were recorded and never acted on. The shadow runs closed on 2026-10-20. deploy/evals/shadow-report.py stays to re-read the logs. decide.py --shadow and the visible and severity presets are removed.

Question Agreed with the agent Outcome

grade

35 of 38

Asked first at Stage 1. DECIDED is taken (source jev). UNSURE sends the grade to the orchestrator.

visible

12 of 23

Dropped.

severity

12 of 18, the misses all MAJOR → CRITICAL

Dropped.

recheck

No signal in 176 verdicts

Ended 2026-10-17. It later returned as a live preset that price-gate.py asks.