Claude Code hook
Model Router Hook
Hooks that switch Claude's model tier automatically according to task complexity.
Install
/plugin marketplace add tzachbon/claude-model-router-hookgit clone https://github.com/tzachbon/claude-model-router-hook.gitFrom 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
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.
Details
- Repository
- tzachbon/claude-model-router-hook
- Type
- Hooks
- Language
- Python
- License
- MIT
- Last updated
- 2 September 2026
- Topics
- ai-toolsanthropicautomationbashclaudeclaude-codeclaude-code-pluginclaude-hooksclaudecode-hooksdeveloper-toolshaikullm
- Listed in
- awesome-claude-code-hooks
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
Claude Code Spinner
320i1kazantsev/claude-code-spinner
Замена фраз спиннера клод-кода для уважаемых вайбкодеров.
Model Matchmaker
168coyvalyss1/model-matchmaker
Local hook that routes each prompt to a suitable model tier to save cost.
Nimrod
258mixelpixx/Nimrod
Web research for Claude over MCP: quality-scored Google search, clean extraction, deep research. Hosted connector for claude.ai/Desktop/Code + Nimrod Desktop toolkit (skills, agent, hooks).
agentlint
215mauhpr/agentlint
Local guardrail hooks that check proposed file edits and shell commands and block risky patterns.
AI Agent Camp
347minicoohei/ai-agent-camp
AI Agent Camp — non-engineer-friendly AI agent training curriculum. Lessons, skills, commands, and hooks for Claude Code, Cursor, and Codex.
Claude Code Boost
165yifanzz/claude-code-boost
Claude Code Boost - Hook utilities for Claude Code with intelligent auto-approval
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.