The developer noisonnoiton describes a Claude Code hook that asks Jev whether a prompt looks like work for Sonnet or Opus. When a confident recommendation differs from the current model, the hook pauses submission. The user can switch models or resend the same prompt once to keep working on the current one.
Keep the recommendation separate from the switch
- The author observed a Sonnet recommendation interrupt an Opus session. Resubmitting the same text let Opus handle it. That one-time override comes from the author’s hook.
- Track the active model from
SessionStartandPostModelSwitch. The last reply can still name the previous model just after a switch. The design lets the prompt through if the session model is unknown or classification fails. - A command hook can block a submission. A mod’s
turn.stepevent can change the model on an individual request. A single turn can make several requests, so an automatic router has to decide how long its choice should hold.
Measure the whole turn
- A valid Sonnet or Opus label is a recommendation. Its probability does not tell you whether the proposed model will finish the task.
- Claude Code keeps separate prompt caches for each model. A lower model rate may buy little if the switch makes Claude process a long conversation again. Count cache writes, task success and rework alongside the classifier call.
- Check the project before sending data to the hosted classifier. Even an allowed project can contain a prompt that should stay local.
Caveat: The author observed the same-model retry and simulated the other paths. We checked the hook documentation; routing accuracy, latency and savings were not measured.