A jevhook

Refuse the wrong kind of subagent

The assistant sometimes hands a job to the wrong kind of subagent: a read-only searcher asked to fix a bug. This jevhook refuses such a call once and tells the assistant why. If the assistant sends the same call again it goes through, so the refusal is a second thought and not a wall.

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 whether the kind of agent the call names suits the task it is given.
  • When Jev is under 20% sure the agent suits the task, the call is refused once, with the reason; the same call sent again goes through.
  • Subagents are refused at most 3 times in a session; after that Jev is no longer asked about them, and their calls go through.
  • Jev is not asked about a fork, which runs on its parent's model whatever is asked, or about a call that names no model.

Its switch

  • At PreToolUse it is PreToolUse/fitstarts 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]
fit = "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, and the 1 at the edges last: a switch that is off, a cap that is spent, an answer Jev is not sure of.

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

a planning agent, asked to rename one variable deny

Jev is 10% sure a planner suits this task: a planner does not edit. The call is refused once, and the reason says that sending it again unchanged goes through.

Jev, in one requestfitonsizeonrefused beforenorefused too oftennonames a sizeyesunsuited10%the wrong sizesonnet 80%= yes= yes= yes= no= yes= yes= yes= yes&&&&&questioned once already β†’ passrefused too often β†’ passunsuited to the task β†’ deny1the wrong size β†’ deny

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.

❯ rename max_rows to row_limit in the importer

● Plan(Rename one variable)
  ⎿  Error: Jev: this kind of agent does not look suited to the task (10% that it is). Pick the kind of agent the task
     is for, or do it yourself. This is said once: send the same call again, unchanged, and it goes through.

✻ Working…
tool call: Jev: this kind of agent does not look suited to the task (10% that it is). Pick the kind of agent the     [-]
task is for, or do it yourself. 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
the same call, sent again pass

It was refused once this session. Jev may be wrong, and a second refusal would be an argument, so the first rule lets it through and Jev is not asked again.

Jev, in one requestfitonsizeonrefused beforeyesrefused too oftennonames a sizeyesunsuitedthe wrong size= yes= yes= yes= no= yes= yes= yes= yes&&&&&questioned once already β†’ pass1refused too often β†’ passunsuited to the task β†’ denythe wrong size β†’ deny

Open this drawing at its own size

❯ what is in src/?

● general-purpose(List the files in src/)
  ⎿  Done (3 tool uses · 4.1k tokens · 6s)

✻ Working…
tool call: jevhooks: this agent at this size was questioned once already this session, so it goes through Β· 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.