Decision model (Jev)

Jev is a small external decision model. It answers a cost-only choice among options that you can enumerate: DECIDED <option> when it is confident, UNSURE <why> when it is not. After UNSURE the asker decides, so the pipeline never depends on Jev. Choose a scenario and watch one question travel. The command and the settings are on Decision model reference.

Skip the map

The agents ask

  • ft-developerAsks for the Stage 1 grade, and for each unit of its plan.It asks grade first at Stage 1. It asks tier, effort and split when the unit table is written, and slice for a large part of the plan. It asks --ask to move the test adversary off opus.
  • bugfix-agentAsks for each unit before it writes a Pick: line.
  • main loopA session asks on any cost-only choice, through the skill ft-decide.

The hook checks, and asks

  • price-gate.pyChecks each dispatch. It asks Jev itself for the model of a whole run and of a re-check.The hook asks at four points with two questions. A main-loop launch of ft-developer, bugfix-agent or refactor-agent gets run with effort. A judgment-lens re-check gets recheck.

The ask

  • decide.pySends the question and prints one line for each question. It always exits with 0 on an answer.The endpoint is fixed in the script, so the key goes nowhere else. A call stops after 8 seconds, and after 3 seconds when the hook asks. After one unreachable answer, it skips the remaining states of the same command.
  • guard in decide.pyRefuses a payload with a secret shape, and a payload over 4000 characters.
  • Jev, over OpenRouterThe default model is typesafe/jev-1.13. It returns a probability for each option.decide.py turns the probabilities into a confidence from 0 to 1. Under the floor, the answer is UNSURE. The floor is 0.8, and 0.7 for effort.

The fallback

  • the tablesThe asker's own rules for model and effort, on Dispatch Economy.

The result

  • Pick: lineA line in the brief. It names the model, the effort and who chose each.
  • dispatched agentThe agent that runs, on the model that the gate allows.

Files

Blue: who asks. Purple: the ask and its fallback. Choose a scenario, or select an element to read about it.

Jev is confident

  1. ft-developer has its unit table. It makes one call for all units: --kind tier,effort,split.
  2. The guard checks the payload. Nothing secret-like and nothing over 4000 characters leaves the machine.
  3. decide.py finds the key.
  4. It sends the state to Jev. The state holds facts about the choice and nothing else.
  5. Jev returns a probability for each option. The confidence is over the floor.
  6. decide.py logs the state, the probabilities and the result.
  7. It prints tier: DECIDED sonnet (0.93). The agent takes the answer and does not argue it.
  8. The agent writes Pick: sonnet/medium - jev/jev in the brief.
  9. The dispatch carries the line. The gate checks that it is valid and equals the call.
  10. The gate allows the dispatch. The agent runs on sonnet.

Jev is not sure

  1. ft-developer asks about one unit.
  2. The state goes to Jev.
  3. The confidence is under the floor. Jev could not separate the options.
  4. It prints tier: UNSURE not-confident and exits with 0. This is a normal outcome.
  5. The agent decides by the tables. It never retries.
  6. It writes Pick: sonnet/medium - self/self (unsure: model).
  7. The transcript holds the decide.py call, so the gate accepts self.
  8. The agent runs. A self pick of opus runs on sonnet.

No key, or the endpoint is down

  1. ft-developer asks as usual.
  2. No key is found. The script prints UNSURE no-key and sends nothing.
  3. With a key and a dead endpoint, the call stops after 8 seconds. The line is UNSURE unreachable.
  4. The log line is still written.
  5. The exit code is 0. The run does not stop.
  6. The agent decides by the tables, with source self. It never retries.
  7. It writes the Pick: line.
  8. The gate accepts the line, as for any self pick.
  9. The agent runs.

The state is refused

  1. The state holds an IP address.
  2. The guard refuses it: UNSURE secret-like. Nothing leaves the machine.
  3. The log stores <withheld: secret-like> and not the text.
  4. The agent gets the line. A refused state got no answer.
  5. The agent restates the state as facts. This is not a second ask.
  6. The restated state goes to Jev.

The gate asks by itself

  1. The main loop launches a bugfix-agent with no MAJOR and no CRITICAL in the brief.
  2. The hook asks run and effort over a descriptor of flags and counts. The brief stays on the machine.
  3. The call has 3 seconds here. The hook itself has 5.
  4. Jev answers. The answer holds for the whole run.
  5. decide.py logs the call with the tag price-gate.
  6. The hook logs the model and the effort of the run.
  7. The agent runs on Jev's model. UNSURE gives sonnet and the dispatch's own effort.

A pick with no question

  1. The agent writes Pick: with no decide.py call in its transcript.
  2. The dispatch reaches the gate.
  3. Denied. The text says that the agent never called decide.py, and it lists every other missing item.
  4. The agent asks, and writes the line from the answer.

How the parts connect

  • An agent or a session calls decide.py and reads the line that it prints.
  • The hook loads decide.py and asks through it.
  • The guard runs before anything leaves the machine.
  • The script reads the key from the environment or from the key file.
  • The script sends the state, the question and the option criteria to Jev.
  • Each call appends one line to the log.
  • After UNSURE, the dispatcher decides by the tables.
  • The dispatcher writes the Pick: line in the brief.
  • The hook reads the line and compares it with the call.
  • A denial returns to the dispatcher with every missing item.
  • A main-loop launch passes through the hook.
  • The hook logs each model that it chose or swapped.
  • The hook allows the dispatch, and the agent runs.

What Jev decides

A decision here is a choice among named options, where the worst case of a wrong pick is paying more. On these choices the order of authority is Jev first, the agent second.

Ask Jev

The worst case is cost or rework

  • The model, the effort and the split of a unit, and the slice of a plan.
  • The ft-developer Stage 1 grade. This is the one exception to the verification depth rule.
  • The model of a whole run, and of a re-check. price-gate.py asks these two.
  • The model of the test adversary, and any other named choice, with --ask.
Never ask Jev

A wrong pick would skip a check

  • Verification depth: a lens set, an EXEMPT, a gate.
  • Anything that belongs to a person: an approval, a requirement, a permission, an irreversible or outward-facing step.
  • A review verdict.
  • A second ask, reworded to get a different answer. One question gets one answer.

The eight questions

The skill ft-decide and deploy/templates/hooks/decide.py implement the ask. The model is not anchored on the reasoning that the agent has already spent. Open a question to see its options and when each one is right.

Which model for this unit? → tier

haiku: mechanical and fully specified, at most 3 files and about 60 changed lines. sonnet: standard work inside one module. opus: no precedent, or concurrency, transactions, security, a contract, a schema or a cross-module change.

How much reasoning? → effort

low: the brief names every edit. medium: some choices inside a known pattern. high: the difficulty is reasoning, not volume.

Split the unit, or keep it? → split

split: over the tool-call bound of its tier, or file sets that you can deliver apart. keep: coherent and within the bound, or the parts would stay under about 15 tool calls.

A child orchestrator, or leaves? → slice

slice: one coherent part of the plan with 8 or more leaf dispatches. leaves: fewer than 8, or the part needs top-tier orchestration judgement.

Which pipeline grade? → grade

simple-addition: one stack, no new surface, at most about 50 lines and 3 files. TDD-led: a failing test can state the whole requirement. architecture-led: a new feature, module or endpoint, or a change to a contract, the data model, a protocol or security. A simple-addition run that outgrows its budget returns PLAN_INVALIDATED and is graded up.

Which model for a whole run? → run

sonnet: an approved plan split into briefed units, or a bounded bug in one stack and one repository. opus: judgement is still open, or the root cause is not known in a live environment.

Which model for a re-check? → recheck

sonnet: confirm a few named objections against a delta that cites a fix for each. opus: the closure needs judgement again, there are many blocking objections, or the revision rewrites the design.

Any other named choice? → --ask

You write the question, and one --option for each choice. The output reports it under the kind custom. The test adversary uses it: --ask "Model for the test adversary on this change".

Where in a run Jev is asked

Blue steps: the agent calls decide.py. Orange steps: price-gate.py asks by itself, and the agent sees only the model that results.

  1. 1

    Stage 1: grade

    ft-developer asks grade first.

    Agent asks
  2. 2

    Launch after approval

    You approved the plan at Stage 5, and the main loop launches the run. The hook asks run and effort, one answer for each run journal.

    Hook asks
  3. 3

    Unit table

    One call for all units: tier, effort, split, and slice for a large part.

    Agent asks
  4. 4

    Test adversary

    Before the diff review, its dispatcher may use --ask to move it off opus.

    Agent asks
  5. 5

    Each re-check

    A judgment lens re-checks its objections. The hook asks recheck. Not for Security or CRITICAL.

    Hook asks
  • The other lanes

    A bugfix-agent launch with no MAJOR and no CRITICAL, and a refactor-agent launch, get step 2 for the whole run. bugfix-agent also makes step 3, and it never slices.
  • Any session

    A main-loop session or a dispatcher uses the skill ft-decide on any cost-only choice among options it can enumerate.
  • One call for each planning step

    Batch all units in one command. Each call costs the asking agent a turn, and that turn is the real price.
  • No pick without a question

    A pick with no question asked is a defect, and the gate refuses it. The pick can be self, override or a claimed jev.
  • Reuse an earlier answer

    Cite an answer that an earlier instance of the run got: (recorded: <journal path>). The file must hold the answer line.
  • One question, one answer

    Three cases may ask again: a unit that you have since split, a refused state that you restate, and a state with a wrong field.

What each answer does next

decide.py prints one line for each question, and that line is the whole result. The exit code is 0 for every answer.

  1. 1. Read the line

    The line names your next step.
    • DECIDEDTake it. Do not argue it.
    • not-confidentDecide yourself.
    • no-keyAlso unreachable, bad-reply, error. Decide yourself. Never retry, and never wait.
    • secret-likeAlso too-large. Restate the state as facts, or decide yourself.
  2. 2. Write the Pick line

    The line names the model, the effort and who chose them.
    • JevPick: sonnet/medium - jev/jev
    • YouPick: sonnet/medium - self/self (unsure: model)
    • You raisePick: opus/medium - override: <signal>
    After unsure: write the literal word tier, model or effort.
  3. 3. Pass the gate

    price-gate.py reads the line in the brief of a coding agent, ft-ui-ux-design or a slice.
    • DeniedThe line is missing, invalid or differs from the call, or no question was asked. The text lists every missing item.
    • AllowedThe agent runs, on the model of the next section.

How sure Jev must be

The floors: an answer under its floor is UNSURE

Any question0.8
Only effort0.7

Three example answers

DECIDED0.93
DECIDED for effort only0.75
UNSURE0.45
On this scale 0 is a coin toss and 1 is certainty. On three options, a 0.63 and 0.37 split scores 0.45. The formula.

How often Jev decides

tier70%
grade68%
custom60%
recheck57%
run56%
effort34%
slice26%
split25%
Real outputShare of DECIDED in one decision log, 2026-10-13 to 2026-11-02. A low share only means that the asker decides more often. UNSURE is a normal outcome. The counts.

When the model differs from the answer

An asker can only raise an answer. A few cases may lower the model, and none of them removes a reviewer.

The asker raises it, with override

  • sonnetopusYou cite an opus signal, such as a file:line, an SDD section or a count.
  • haikusonnetYou cite size or branching.
  • Never downward, and never without an answer. The gate denies an override to haiku.
  • Your signal contradicts a no in your own state? The state is wrong. Flip the field and ask once more.

What lowers it

  • opussonnetThe hook: a coding first dispatch with a self pick of opus. A unit that fails there climbs to opus.
  • opussonnetThe hook: the same dispatch with a Jev opus under 0.9, or with no number on record. This second bar applies only to opus.
  • opussonnetThe hook, after it asks Jev: a main-loop launch, on DECIDED sonnet or on UNSURE.
  • opussonnetThe hook, after it asks Jev: a judgment-lens re-check, only on DECIDED sonnet.
  • opussonnetThe dispatcher, after it asks Jev: the test adversary, only on DECIDED sonnet cited with the source jev. The hook checks the line.

All swaps of the hook, with their settings, are on Dispatch Economy Reference.

What one ask costs and what it sends

The fee is too small to matter. The real price is the turn of the asking agent, and the real risk is the text that you send.

$0.17for all 6698 callsEvery call in one decision log, 2026-10-13 to 2026-11-02.
0.35 smedian answerIn that log, 8 of 10 calls took 0.23 to 0.51 seconds.
1 turnthe real pricePut all choices of one planning step in one command.
8 slongest waitThe script stops the call. When the hook asks, the limit is 3 seconds.
Pass in the state

Facts about the choice

  • Sizes and counts.
  • Which signals are present and which are absent.
  • Absence in words: auth surface: no. A bare auth n reads as present.
Never pass

The content of the work

  • Code and file contents.
  • Credentials, hostnames and IP addresses.
  • Customer data and ticket text.
The state, the question and the option criteria all leave the machine

decide.py refuses obvious secret shapes (secret-like) and a payload over 4000 characters (too-large). The check catches obvious shapes only, so you must filter the payload.

Set up Jev

Jev is optional. Without a key the pipeline runs and the orchestrator decides every choice. To turn Jev on, create an account, store its key and connect Claude Code. Then run the two checks.

  1. 1

    Create an OpenRouter account and a key

    Sign up at openrouter.ai. Add credits on the Credits page, then create a key on the Keys page. Copy the key for step 2.

    A small top-up lasts: 6698 logged calls cost $0.17. The key must be able to call https://openrouter.ai/api/alpha/decisions with the model typesafe/jev-1.13, or with the model in FT_DECIDE_MODEL. Step 5 shows whether it can.

  2. 2

    Store the key

    On macOS or Linux, run these lines. Type the key, then press Enter. The key does not appear on screen.

    macOS, Linux
    mkdir -p ~/.config/ft-ai-toolkit read -rs OPENROUTER_KEY && printf '%s\n' "$OPENROUTER_KEY" > ~/.config/ft-ai-toolkit/openrouter.key; unset OPENROUTER_KEY chmod 600 ~/.config/ft-ai-toolkit/openrouter.key

    On Windows

    decide.py resolves ~ to your user profile folder, so the file is %USERPROFILE%\.config\ft-ai-toolkit\openrouter.key. Windows has no mode 600. Keep the file in your own profile folder.

    Windows
    New-Item -ItemType Directory -Force "$env:USERPROFILE\.config\ft-ai-toolkit" | Out-Null $k = Read-Host "OpenRouter key" -AsSecureString [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($k)) | Set-Content -NoNewline "$env:USERPROFILE\.config\ft-ai-toolkit\openrouter.key"

    With the environment variable instead of the file

    Set OPENROUTER_API_KEY. decide.py reads the variable first and the file second. FT_DECIDE_KEY_FILE moves the file.

  3. 3

    Connect Claude Code

    If the toolkit is not installed, run deploy/scripts/install.sh from this repository, or .\deploy\scripts\install.ps1 on Windows. It adds decide.py, the price-gate.py hook and the skill ft-decide to ~/.claude. Then open a new Claude Code session, because a session loads hooks and skills when it starts.

    You do not edit settings.json or set a variable. The agents and the hook call decide.py themselves, and it reads the key on each call. A key added later needs no new session.

    If Claude Code asks before each call

    In a permission mode that prompts, a session's own decide.py call asks first. To skip that prompt, add Bash(python3 ~/.claude/hooks/decide.py:*) to permissions.allow in ~/.claude/settings.json.

  4. 4

    Check the installed script without the network

    bash
    python3 ~/.claude/hooks/decide.py --selftest selftest ok
    Real outputCaptured by running the script. The exit code is 0.
  5. 5

    Ask one real question

    The state is a harmless example without secrets.

    bash
    python3 ~/.claude/hooks/decide.py --kind tier "Unit: rename a constant. files: 1 · lines: ~5 · precedent to copy: yes · new test class: no · new table: no · auth surface: no · contract or protocol change: no · cross-module: no · concurrency: no · every edit named in the brief: yes" tier: DECIDED haiku (0.95)
    IllustrationThe command is real. The output shows the form of a healthy answer.
    DECIDED
    Healthy. The option is haiku, sonnet or opus. The number is the confidence from 0 to 1.
    not-confident
    Also healthy. Jev reached the endpoint but could not separate the options.
    no-key
    decide.py found no key. Return to step 2.
    unreachable
    The endpoint failed, timed out or refused the call. A rejected key and empty credits also end here, so check step 1.
  6. 6

    Look in the decision log

    The new call is the last line of ~/.local/state/ft-ai-toolkit/decisions.jsonl.

set up the keycheck that it works

The key stays out of every text

The key never goes into a repository, a prompt, a brief, a note or a log.

What the installer does

The installers do not ask for the key and do not place it. deploy/scripts/install.sh and install.ps1 call deploy/scripts/economy.py. That script only checks that ~/.config/ft-ai-toolkit/openrouter.key exists. If the file is absent, it prints a WARN line. If other users can read the file, it prints a WARN line to run chmod 600. Otherwise it prints Jev key present. It never reads, writes or prints the key.

When the key is missing or the endpoint is down

decide.py fails open. The run goes on, and the asker decides.

no-keyNo key in the variable or the file

  • No request leaves the machine.
  • decide.py prints UNSURE no-key, writes the log line and exits with 0.
  • The orchestrator decides by the tables, with source self.

unreachableThe endpoint fails or times out

  • No retry. The script skips the remaining states of the same command.
  • decide.py prints UNSURE unreachable, writes the log line and exits with 0.
  • The orchestrator decides by the tables, with source self.
bash
python3 ~/.claude/hooks/decide.py --kind tier,effort "Unit: rename a constant. files: 1 · lines: ~5"; echo "exit code: $?" tier: UNSURE no-key effort: UNSURE no-key exit code: 0
Real outputCaptured by running the script with no key set.

What UNSURE gives

On tier → the tables

The asker uses Model and effort on Dispatch Economy.

On effort → medium

A wrong effort costs little.

On split, slice → the asker

The asker decides itself, with source self.

On grade → the orchestrator

The orchestrator grades the task by itself. In doubt between two grades, it takes the higher one.

On run → sonnet

The hook is fail-open too. The whole run gets sonnet and the dispatch's own effort.

On recheck → opus

The hook is fail-open too. The re-check keeps opus.

On the adversary → opus

The test adversary keeps opus without a DECIDED answer.

Do not wrap the call in timeout

macOS has no such command, so the model is never reached. The script stops each call by itself.

Questions about Jev

The questions that readers ask after the first answer.

Can I ask again with other words?

No. A reworded second ask to get a different answer is not allowed. You may ask once more for a split unit, a refused state that you restate, or a state with a wrong field.

Can I choose a cheaper model than the answer?

No. The only override raises the answer, by a cited signal.

Why did Jev answer UNSURE on my state?

A thin state earns UNSURE. Also check the options: overlapping options produce low confidence. Do not retry. Decide yourself.

I sent opus. Why does the agent run on sonnet?

The hook applied one of the swaps in What lowers it. The hook changed the model, and it keeps every reviewer.

Does a run stop if Jev is down?

No. The pipeline never depends on Jev. See When the key is missing or the endpoint is down.

Related pages

The command, the settings and the evidence live on the reference page.

Every flag, setting and outputDecision model reference
The tables behind UNSUREDispatch Economy, Model and effort
The hooks around the askAgent Harness
Find a flag: Decision model reference