Tired of burning Opus tokens on git commit and Haiku struggling through a deep refactor? I built a small Claude Code hook system that classifies every prompt by complexity and switches the active model automatically before the request goes out. How it works: - UserPromptSubmit hook classifies the incoming prompt using keyword + pattern matching (zero extra API calls) - Switches settings.json to the right tier if there’s a mismatch and injects a chat message so you know it switched - SessionStart hook injects sub-agent model-selection rules into every session, so spawned agents also use the right tier - Prefix any prompt with ~ to bypass classification and keep whatever model you’re on Tier mapping: - haiku → git ops, renames, formatting, file lookups, quick reads - sonnet → feature work, debugging, writing/editing code, planning - opus → architecture, deep multi-file analysis, complex refactors Install via Claude plugin marketplace or a one-liner curl. Logs every classification + switch to ~/.claude/hooks/model-router-hook.log so you can see exactly what it’s doing. https://github.com/tzachbon/claude-model-router-hook Curious what tier-switching strategies others are using, or if anyone has tried teaching the classifier new patterns for their own workflow. Based on model-matchmaker by u/coyvalyss1
- go give that repo a star too. submitted by /u/tzachbon
Originally posted by u/tzachbon on r/ClaudeCode
