Content
# ss-triage-router
**Stupid Simple:** Auto-triage prompts to the right Claude model via MCP server.
Save ~75% on API costs by automatically using Haiku for simple tasks, Sonnet for medium ones, and Opus for hard problems.
## How It Works
1. You send a prompt to `triage_prompt`
2. Haiku classifies it as `simple` | `medium` | `hard` (costs ~$0.00003)
3. Haiku responds if simple, Sonnet if medium, Opus if hard
4. You get the response + metadata showing which model was used
**Cost ratio:** Haiku is 5x cheaper than Opus. If 80% of prompts are simple, you save ~75%.
## Installation
Clone and install dependencies:
```bash
git clone https://github.com/clawdbotatg/ss-triage-router
cd ss-triage-router
npm install
```
Set your API key:
```bash
cp .env.example .env
# Edit .env with your ANTHROPIC_API_KEY
```
## Running
### Development mode (live TypeScript):
```bash
npm run dev
```
### Build and run:
```bash
npm run build
node dist/index.js
```
### Tests:
```bash
npm test
```
## Claude Code Integration (MCP)
Once the server is running, register it in `~/.claude/settings.json`:
```json
{
"mcpServers": {
"ss-triage-router": {
"command": "tsx",
"args": ["/path/to/ss-triage-router/src/index.ts"],
"env": {
"ANTHROPIC_API_KEY": "your-api-key"
}
}
}
}
```
Restart Claude Code. You'll see a `triage_prompt` tool available in the sidebar. Use it like:
```
Use the triage_prompt tool with: "Explain quantum entanglement"
```
Claude Code will classify the complexity, route to the right model, and return the response with metadata.
## API
The MCP server exposes one tool:
### `triage_prompt`
**Input:**
- `prompt` (string, required): The prompt to classify and respond to
- `system` (string, optional): System prompt to guide the routed model
**Output:**
```
Response (via HAIKU/SONNET/OPUS):
[actual response text]
---
Metadata:
- Complexity: simple|medium|hard
- Model used: haiku|sonnet|opus
- Input tokens: N
- Output tokens: N
```
## Architecture
- **classifier.ts** — Haiku-based complexity classifier
- **router.ts** — Core routing logic, calls the right model
- **models.ts** — Model IDs and constants
- **index.ts** — MCP server that exposes the `triage_prompt` tool
## Complexity Mapping
| Complexity | Model | Use Case |
| --- | --- | --- |
| simple | Haiku | Math, simple QA, facts |
| medium | Sonnet | Most tasks, code, analysis |
| hard | Opus | Complex reasoning, design, hard problems |
## Cost Savings Example
Assuming 100 prompts with typical distribution (40% simple, 40% medium, 20% hard):
**Without triage (all Opus):**
- 100 prompts × $5 input = $500
**With triage:**
- 40 simple × $1 = $40
- 40 medium × $3 = $120
- 20 hard × $5 = $100
- **Total = $260 (48% savings)**
## License
MIT