Thanks for your interest in making Claude Code cheaper and smarter for everyone.
The biggest impact contribution. If you've found prompts that get misclassified, submit a PR:
File: hooks/classify.sh
# T0 patterns: should be cheap (Haiku)
if re.match(r"^(your_new_pattern)", prompt):
# T2 patterns: should be thorough (full model)
elif re.search(r"(your_new_keyword)", prompt):Requirements for new patterns:
- Include 3+ real-world prompt examples that the pattern catches
- Don't break existing classifications (run
bash tests/verify.sh) - Avoid overly broad patterns (e.g., don't match "is" as a T0 keyword)
- Add test cases to
tests/verify.shfor your new patterns
The regex classifier is intentionally simple. Contributions for smarter classification are welcome:
- TF-IDF or embedding-based: Use a lightweight model to classify prompt complexity
- Token counting heuristic: Short prompts are more likely T0, long ones T1/T2
- History-aware: If the last 3 prompts were T1, the next one probably is too
- Project-aware: Read
.claude/settings.jsonto know what tools are available
Rules for alternative classifiers:
- Must run in <100ms (hook latency matters)
- Must not require network access (offline-only)
- Must fall back gracefully to regex if dependencies are missing
- Must produce the same JSON output format
- Windows edge cases: Git Bash vs WSL vs native PowerShell differences
- Linux distros: Testing on various distributions
- CI/CD integration: GitHub Actions, GitLab CI testing
- Usage examples with real-world scenarios
- Screenshots showing the routing in action
- Translations (especially Chinese, Japanese, Spanish)
- Blog posts or tutorials about the approach
git clone https://github.com/bijumailbox/claude-auto-router.git
cd claude-auto-router
# Test the hook directly
echo '{"input": "find all python files"}' | bash hooks/classify.sh
# Run the full verification suite
bash tests/verify.sh
# Install locally to test
bash scripts/install.sh- Fork the repo
- Create a feature branch:
git checkout -b feat/better-t0-patterns - Make your changes
- Run
bash tests/verify.sh— all checks must pass - Submit a PR with:
- What you changed and why
- Example prompts that demonstrate the improvement
- Before/after classification results
This project handles user input through a shell hook. Security is non-negotiable:
- Never interpolate user input into shell strings. All user input must flow through
sys.stdinto Python. No$(), no backticks, noeval. - Never use
shell=Truein any subprocess call. - Never require network access. The classifier must work fully offline.
- Always exit 0. The hook must never block user prompts, even on errors.
- No dependencies beyond Python stdlib. The hook must work on a fresh system with only Python 3.8+.
If a PR introduces any of these patterns, it will be rejected regardless of the feature value.
feat: add pattern for database migration prompts
fix: handle unicode prompts in classifier
docs: add Windows troubleshooting section
test: add edge case for empty JSON input
chore: update .gitignore
Be kind. Be helpful. Ship improvements.
We're building something useful for the community. Disagreements about classification logic are expected and healthy — resolve them with data (real prompt examples), not opinions.
By contributing, you agree that your contributions will be licensed under the MIT License.