Claude Code hook

Model Router Hook

Hooks that switch Claude's model tier automatically according to task complexity.

107 stars 14 forksHooks Plugin marketplace Source

Install

Inside Claude Code
/plugin marketplace add tzachbon/claude-model-router-hook
From source
git clone https://github.com/tzachbon/claude-model-router-hook.git

From the README

Claude Model Router Hook

Effort-first model routing for Claude Code. Heuristics-first, opt-in autoswitch.

Install

The wizard asks whether to install globally and star the GitHub repository. Both prompts default to yes. Installation requires Claude Code and Python 3; starring requires an authenticated gh command. Restart Claude Code after installation.

Claude Model Router classifies each prompt by task and effort, then recommends the matching Claude model. It warns by default. Autoswitch is opt-in and only affects new sessions.

What it does

- Routes prompts with local heuristics and an optional Claude Code fallback.
- Uses Haiku only for clearly mechanical work; defaults agentic coding to Opus with graduated effort.
- Routes Agent and Task sub-agents when they spawn. Nested delegation is floored at the implementation target, and an explicit model always wins.
- Records the requested and resolved model for completed sub-agents, so host-side fallback or allowlist substitutions are visible.
- Dampens borderline classifications instead of switching tiers on weak evidence.

How it works

Errors fail open and leave the prompt unchanged. Prefix a prompt with ~ or
Alternative installs

Claude plugin manager

Manual

The manual installer prints the settings.json entries that you need to add.

Notes

- Activity is logged at ~/.claude/hooks/model-router-hook.log, including requested versus resolved sub-agent models.
- If another PreToolUse hook rewrites the same spawn, Claude Code's undocumented merge order decides which rewrite wins.

Project

Contributing | MIT license | Based on model-matchmaker by @coyvalyss1
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Python
License
MIT
Last updated
2 September 2026
Topics
ai-toolsanthropicautomationbashclaudeclaude-codeclaude-code-pluginclaude-hooksclaudecode-hooksdeveloper-toolshaikullm

FAQ

What is Model Router Hook?

Hooks that switch Claude's model tier automatically according to task complexity. It is a hook for Claude Code, from tzachbon/claude-model-router-hook on GitHub.

How do I install Model Router Hook?

Run /plugin marketplace add tzachbon/claude-model-router-hook inside Claude Code, then follow the setup in the README.

Is Model Router Hook popular?

tzachbon/claude-model-router-hook has 107 GitHub stars and 14 forks, and is included in 1 curated Claude Code list. It was last updated on 2 September 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.