A jevhook
Which model runs the turn
If you leave Claude Code on one large model all day, this picks a model for each turn instead, so that small questions stop costing what big ones do. Ask “what branch am I on” and the turn runs on haiku; ask for a redesign and it runs on the largest model. You see the size chosen in the line above your prompt. A model that is too small costs you the turn and then the turn again, which is why using this is left to you.
It is off until you switch it on. It acts at prompt.submit, turn.step.
Jev is the small, fast model jevhooks asks. It writes nothing: it is handed a question whose answers are already written down, and says how likely each one is, in about a quarter of a second. jevhooks is a plugin for Claude Code that asks it at the moments Claude Code lets a plugin step in, and a jevhook is one such question with what is done about the answer.
- With model choice switched on, Jev scores each prompt for what carrying it out takes, on four levels from a lookup to open-ended work, and the turn goes to the cheapest of haiku, sonnet, opus and fable that is 75% likely to be enough.
- A turn can go to a larger model than the session's own, the one you set for the session, at any prompt.
- A smaller one is chosen only while the conversation is under 24,000 tokens, which in practice is a session's first prompt: after that the session's own model reads the conversation from its cache, and a smaller one would read all of it again at full price. A session with nothing in it is about 36,000 tokens after its first turn. The count is yours to raise.
- If your prompt has a model's name in it, nothing is chosen: the session's own model stands, and Jev is not asked.
- Work that is costly to get wrong (60% or more) never goes to the smallest model: it goes one up.
- The choice is made once, at the prompt, and every request the turn then makes to a model goes to that one. A subagent's requests keep the model they came with.
- When Claude Code cannot say how long the conversation is, it counts as long, so the turn goes to no smaller model. If the session's model is also none of the four sizes, nothing is chosen at all, and Jev is not asked.
Say something
A jevhook is off, in shadow or on. To change this one, put this in ~/.config/jevhooks/config.toml:
[jevhooks.prompt.submit] need = "on"
In shadow Jev is asked and nothing is changed. The log (jevhooks recent, or /jev in a session) then says what would have been done: for this one, which model the turn would have been given.
8 worked cases, each an answer Jev could give, the rules that decide on it, and the screen you would see. The ones you would meet most come first, and the 3 at the edges last: a switch that is off, a cap that is spent, an answer Jev is not sure of.
The rules these cases run through
14 rules give the turn the cheapest of 4 models that is 75% likely to be enough for the prompt. They go by 6 things known, 2 of them Jev's answers. Off unless you switch it on.
“what branch am I on” haiku
A lookup, and Jev is sure. The turn goes to the smallest model.
How to read a drawing
Jev answers with numbers. What happens next is decided by a few rules, in order: of the rules that hold, the first decides. They are compiled into one small network, and these pictures are drawn from that network, not beside it, so they cannot show a rule the plugin does not have.
Read one left to right: what can be known, the tests on it, where a rule's tests meet, and the rules. Black is what a rule that holds stands on, and dashed is a test that failed. A pink rule holds; more than one can, and the numbered ones are those that decided, in order. The framed facts are Jev's, and are asked for together, in one request.
❯ what branch am I on ✻ Working… prompt: Jev: a lookup (0.0 of 3); haiku · 150 ms · $0.0002 this session [-] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
The turn's requests are sent with:
model: haiku, effort: medium
a prompt Jev puts at 60% a lookup, 30% routine, 10% judgment sonnet
The likeliest answer is a lookup, and the smallest model would be too small four times in ten. The cheapest model that is 75% likely to be enough is the next one up.
❯ which tests cover the importer? ✻ Working… prompt: Jev: routine work (0.5 of 3); sonnet · 150 ms · $0.0002 this session [-] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
The turn's requests are sent with:
model: sonnet, effort: medium
“push this to main”, which Jev calls a lookup, and costly if wrong sonnet
One named step, so the smallest model would do. But a mistake here is not put right with one more turn, and work like that is not given to the cheapest model: it goes one up.
❯ push this to main ✻ Working… prompt: Jev: a lookup (0.1 of 3), costly if wrong: not haiku; sonnet · 150 ms · $0.0002 this session [-] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
The turn's requests are sent with:
model: sonnet, effort: medium
a lookup, 40,000 tokens into a session on the second largest model no change
A smaller model would be enough. But it would have to read the whole conversation again at full price, where the session's own model reads it from its cache. So past 24,000 tokens a turn never goes to a smaller model than the session's. A session with nothing in it is already about 36,000 tokens after its first turn, so unless you raise the count, a turn goes smaller at a session's first prompt, when nothing is cached yet, or not at all. It can go larger at any time.
❯ what branch am I on ✻ Working… prompt: Jev: a lookup (0.1 of 3), long: opus, not haiku; the session's own model stands · 150 ms · $0.0002 this [-] session ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
the second request of a turn that was given to haiku haiku
The choice is made once, at the prompt, and carried out here: every request the turn makes goes to the model chosen for it. A subagent's request in the same turn is left as it came. This one is at turn.step.
❯ what branch am I on ✻ Working… prompt: Jev: a lookup (0.0 of 3); haiku · 150 ms · $0.0002 this session [-] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
This request of the turn is sent with:
model: haiku, effort: medium
“use fable for this”, or any prompt with a model's name in it no change
The prompt has a model's name in it. Whether it says to use that model or asks why it failed, you are talking about models yourself, so nothing is chosen for you: the session's own model stands and Jev is not asked.
❯ use the largest model for this ✻ Working… prompt: the prompt names a model, so the session's own stands and Jev is not asked · 150 ms · $0.0002 this session [-] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
any prompt, with model choice switched off no change
Which model you use is yours to hand over. Until you do, the session's own model stands and Jev is not asked. The screen shows one prompt; the same holds for any other.
❯ what branch am I on ✻ Working… ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
any prompt, when Claude Code could not say how long the conversation is and the session is on “default” no change
Doubt keeps the session's own model. A conversation whose length is not known counts as too far along to hand to a smaller model. A session's first prompt is not that: its length is known, and is nothing. And “default” is none of the four sizes, so nobody can say whether a choice would be smaller than it. So nothing is chosen, and since all of that is known before anything is asked, Jev is not asked. The screen shows one prompt; the same holds for any other.
❯ add a --json flag to the export command ✻ Working… prompt: the conversation is long, or its length is not known, and the session's model is not one of the four sizes: [-] a choice could not be compared with it, so the session's own stands and Jev is not asked · 150 ms · $0.0002 this session ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
What this site keeps about a visit, and how to refuse it, is said in one place: what is kept.