A jevhook

Refuse a subagent on the wrong size of model

When the assistant starts a subagent on a model plainly too large or too small for its task, this refuses the call once and names both sizes. A file listing does not need the largest model, and a redesign should not go to the smallest. Sent again unchanged, the call goes through.

It starts in shadow: it writes down what it would have done and changes nothing, until you switch it on. It acts at PreToolUse.

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.

Exactly what it does

  • Jev is asked which of four sizes of model the subagent's task takes: haiku, sonnet, opus or fable.
  • The call is refused once when Jev picks a different size from the one asked for, is at least 50% sure of its pick, and puts the chance of the size asked for under 15%.
  • This happens at most 3 times in a session.

Its switch

  • At PreToolUse it is PreToolUse/sizestarts in shadow
    Say something

A jevhook is off, in shadow or on. To change this one, put this in ~/.config/jevhooks/config.toml:

[jevhooks.PreToolUse]
size = "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, that the call would have been refused.

2 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.

A subagent, before it starts

The rules these cases run through

4 rules decide whether a subagent starts as asked, from 7 things known, 2 of them Jev's answers: whether the kind of agent suits the task, and which of 4 sizes the task takes. A refusal is said once. The plugin remembers the agent and the size it refused, and the first rule lets the same call through the next time.

The same rules serve fit.

the largest model, asked to list the files in a folder deny

The kind of agent suits the task. But Jev is 85% sure the task takes haiku, and puts the size that was asked for at 0%. The call is refused once, and the assistant is told both sizes.

Jev, in one requestfitonsizeonrefused beforenorefused too oftennonames a sizeyesunsuited90%the wrong sizehaiku 85%= yes= yes= yes= no= yes= yes= yes= yes&&&&&questioned once already β†’ passrefused too often β†’ passunsuited to the task β†’ denythe wrong size β†’ deny1

Open this drawing at its own size

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 is in src/?

● general-purpose(List the files in src/)
  ⎿  Error: Jev: the task looks to take haiku (85%), not fable (0%). Ask for the size the task takes. This is said once:
     send the same call again, unchanged, and it goes through.

✻ Working…
tool call: Jev: the task looks to take haiku (85%), not fable (0%). Ask for the size the task takes. This is said    [-]
once: send the same call again, unchanged, and it goes through. Β· 150 ms Β· $0.0002 this session

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏸ manual mode on · esc to interrupt
a search agent at haiku, asked to find where a flag is read nothing more to do

The kind of agent suits the task, and haiku is the size the task takes. No rule applies, so the subagent starts as it would have without the plugin.

Jev, in one requestfitonsizeonrefused beforenorefused too oftennonames a sizeyesunsuited95%the wrong sizehaiku 90%= yes= yes= yes= no= yes= yes= yes= yes&&&&&questioned once already β†’ passrefused too often β†’ passunsuited to the task β†’ denythe wrong size β†’ deny

Open this drawing at its own size

❯ where is the --json flag read?

● Explore(Find where the flag is read)
  ⎿  Done (7 tool uses · 12.3k tokens · 14s)

✻ Working…
tool call: Jev: suited to the task (95%); takes haiku (90%) Β· 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.