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.
The agents ask
- ft-developerAsks for the Stage 1 grade, and for each unit of its plan.It asks
gradefirst at Stage 1. It askstier,effortandsplitwhen the unit table is written, andslicefor a large part of the plan. It asks--askto move the test adversary offopus. - 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-agentorrefactor-agentgetsrunwitheffort. A judgment-lens re-check getsrecheck.
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.pyturns the probabilities into a confidence from 0 to 1. Under the floor, the answer isUNSURE. The floor is 0.8, and 0.7 foreffort.
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
- openrouter.keyThe key file.
OPENROUTER_API_KEYcomes first, and the file second. - decisions.jsonlOne JSON line for each call of
decide.py. - tier-ab.jsonlOne line for each model that the hook chose or swapped.
Blue: who asks. Purple: the ask and its fallback. Choose a scenario, or select an element to read about it.
Jev is confident
ft-developerhas its unit table. It makes one call for all units:--kind tier,effort,split.- The guard checks the payload. Nothing secret-like and nothing over 4000 characters leaves the machine.
decide.pyfinds the key.- It sends the state to Jev. The state holds facts about the choice and nothing else.
- Jev returns a probability for each option. The confidence is over the floor.
decide.pylogs the state, the probabilities and the result.- It prints
tier: DECIDED sonnet (0.93). The agent takes the answer and does not argue it. - The agent writes
Pick: sonnet/medium - jev/jevin the brief. - The dispatch carries the line. The gate checks that it is valid and equals the call.
- The gate allows the dispatch. The agent runs on
sonnet.
Jev is not sure
ft-developerasks about one unit.- The state goes to Jev.
- The confidence is under the floor. Jev could not separate the options.
- It prints
tier: UNSURE not-confidentand exits with 0. This is a normal outcome. - The agent decides by the tables. It never retries.
- It writes
Pick: sonnet/medium - self/self (unsure: model). - The transcript holds the
decide.pycall, so the gate acceptsself. - The agent runs. A
selfpick ofopusruns onsonnet.
No key, or the endpoint is down
ft-developerasks as usual.- No key is found. The script prints
UNSURE no-keyand sends nothing. - With a key and a dead endpoint, the call stops after 8 seconds. The line is
UNSURE unreachable. - The log line is still written.
- The exit code is 0. The run does not stop.
- The agent decides by the tables, with source
self. It never retries. - It writes the
Pick:line. - The gate accepts the line, as for any
selfpick. - The agent runs.
The state is refused
- The state holds an IP address.
- The guard refuses it:
UNSURE secret-like. Nothing leaves the machine. - The log stores
<withheld: secret-like>and not the text. - The agent gets the line. A refused state got no answer.
- The agent restates the state as facts. This is not a second ask.
- The restated state goes to Jev.
The gate asks by itself
- The main loop launches a
bugfix-agentwith no MAJOR and no CRITICAL in the brief. - The hook asks
runandeffortover a descriptor of flags and counts. The brief stays on the machine. - The call has 3 seconds here. The hook itself has 5.
- Jev answers. The answer holds for the whole run.
decide.pylogs the call with the tagprice-gate.- The hook logs the model and the effort of the run.
- The agent runs on Jev's model.
UNSUREgivessonnetand the dispatch's own effort.
A pick with no question
- The agent writes
Pick:with nodecide.pycall in its transcript. - The dispatch reaches the gate.
- Denied. The text says that the agent never called
decide.py, and it lists every other missing item. - The agent asks, and writes the line from the answer.
How the parts connect
- An agent or a session calls
decide.pyand reads the line that it prints. - The hook loads
decide.pyand 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.
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-developerStage 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.pyasks these two. - The model of the test adversary, and any other named choice, with
--ask.
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
Stage 1: grade
Agent asksft-developerasksgradefirst. - 2
Launch after approval
You approved the plan at Stage 5, and the main loop launches the run. The hook asks
Hook asksrunandeffort, one answer for each run journal. - 3
Unit table
One call for all units:
Agent askstier,effort,split, andslicefor a large part. - 4
Test adversary
Before the diff review, its dispatcher may use
Agent asks--askto move it offopus. - 5
Each re-check
A judgment lens re-checks its objections. The hook asks
Hook asksrecheck. Not for Security or CRITICAL.
The other lanes
Abugfix-agentlaunch with no MAJOR and no CRITICAL, and arefactor-agentlaunch, get step 2 for the whole run.bugfix-agentalso makes step 3, and it never slices.Any session
A main-loop session or a dispatcher uses the skillft-decideon 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 beself,overrideor a claimedjev.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. 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. Write the Pick line
The line names the model, the effort and who chose them.- Jev
Pick: sonnet/medium - jev/jev - You
Pick: sonnet/medium - self/self (unsure: model) - You raise
Pick: opus/medium - override: <signal>
unsure:write the literal wordtier,modeloreffort.- Jev
3. Pass the gate
price-gate.pyreads the line in the brief of a coding agent,ft-ui-ux-designor 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
How often Jev decides
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
noin 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
selfpick ofopus. A unit that fails there climbs toopus. - opussonnetThe hook: the same dispatch with a Jev
opusunder 0.9, or with no number on record. This second bar applies only toopus. - opussonnetThe hook, after it asks Jev: a main-loop launch, on
DECIDED sonnetor onUNSURE. - 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 sonnetcited with the sourcejev. 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.
Facts about the choice
- Sizes and counts.
- Which signals are present and which are absent.
- Absence in words:
auth surface: no. A bareauth nreads as present.
The content of the work
- Code and file contents.
- Credentials, hostnames and IP addresses.
- Customer data and ticket text.
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
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/decisionswith the modeltypesafe/jev-1.13, or with the model inFT_DECIDE_MODEL. Step 5 shows whether it can. - 2
Store the key
On macOS or Linux, run these lines. Type the key, then press Enter. The key does not appear on screen.
mkdir -p ~/.config/ft-ai-toolkitread -rs OPENROUTER_KEY && printf '%s\n' "$OPENROUTER_KEY" > ~/.config/ft-ai-toolkit/openrouter.key; unset OPENROUTER_KEYchmod 600 ~/.config/ft-ai-toolkit/openrouter.keyOn Windows
decide.pyresolves~to your user profile folder, so the file is%USERPROFILE%\.config\ft-ai-toolkit\openrouter.key. Windows has no mode600. Keep the file in your own profile folder.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.pyreads the variable first and the file second.FT_DECIDE_KEY_FILEmoves the file. - 3
Connect Claude Code
If the toolkit is not installed, run
deploy/scripts/install.shfrom this repository, or.\deploy\scripts\install.ps1on Windows. It addsdecide.py, theprice-gate.pyhook and the skillft-decideto~/.claude. Then open a new Claude Code session, because a session loads hooks and skills when it starts.You do not edit
settings.jsonor set a variable. The agents and the hook calldecide.pythemselves, 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.pycall asks first. To skip that prompt, addBash(python3 ~/.claude/hooks/decide.py:*)topermissions.allowin~/.claude/settings.json. - 4
Check the installed script without the network
python3 ~/.claude/hooks/decide.py --selftestselftest okReal outputCaptured by running the script. The exit code is 0. - 5
Ask one real question
The state is a harmless example without secrets.
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,sonnetoropus. 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.pyfound 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
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 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.pyprintsUNSURE 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.pyprintsUNSURE unreachable, writes the log line and exits with 0.- The orchestrator decides by the tables, with source
self.
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
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.
timeoutmacOS 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.