Repository navigation
Routing Protocol
Ankit Jha edited this page May 29, 2026
·
1 revision
dispatch/route.sh translates a complexity enum key into a concrete model execution, handles cascading fallbacks, and enforces token preservation rules.
# By enum key (preferred)
dispatch/route.sh --enum SIMPLE --prompt "write a User DTO"
# By explicit tier
dispatch/route.sh --tier 8 --prompt "write a User DTO"
# With file context
dispatch/route.sh --enum STANDARD --prompt "add pagination" --context src/users/controller.ts
# With A2A handoff
dispatch/route.sh --enum MODERATE --prompt "add auth middleware" --a2a logs/last_handoff.json
# Status and list
dispatch/route.sh --status
dispatch/route.sh --list--enum SIMPLE
│
▼
registry/routing.yaml → SIMPLE: 8
│
▼
registry/models.yaml → tier 8 = Gemini 3.5 Flash (Medium), pool: agy_flash
│
▼
Check logs/state.json → pool exhausted? claude_pct ≥ 75?
│
▼
dispatch/agy.sh or ollama.sh → execute prompt, capture output + token count
│
▼
Write logs/cost.jsonl → record tier, tokens, estimated cost
If a model fails or a pool is quota-exhausted, route.sh automatically tries the next tier:
fallback_chains:
8: [8, 9, 7, 10] # Flash Med → Flash Low → Flash High → Qwen
5: [5, 6, 7, 8, 9, 10]
2: [2, 3, 4, 5, 6, 10] # Opus → Sonnet → Flash Thinking → Pro → QwenQwen (T10) is always the last fallback — it runs locally so it can never fail.
| Key | Default Tier | Typical Use |
|---|---|---|
GRUNT |
10 | Boilerplate, mock data, local scripts |
TRIVIAL |
9 | Constants, enums, config values |
SIMPLE |
8 | DTOs, schemas, interface definitions |
STANDARD |
7 | Controllers, handlers, CRUD |
MODERATE |
6 | Services, repositories, validators |
COMPLEX |
5 | Middleware, auth, pipeline logic |
HARD |
4 | Rubber duck reviews, tradeoff analysis |
VERY_HARD |
3 | Multi-step refactors, complex algorithms |
EXPERT |
2 | Architecture decisions, systems design |
CORE |
1 | Claude Code direct (never dispatched) |
To change where SIMPLE tasks route, edit one line in routing.yaml — no scripts to touch.
rubber_duck_map:
claude: 4 # Claude output → reviewed by Gemini Flash Thinking
antigravity: 1 # agy output → reviewed by Claude Code
ollama: 8 # Qwen output → reviewed by Flash Medroute.sh reads and writes logs/state.json:
-
claude_pct— current Claude context usage -
exhausted_pools— pools currently over quota
# Manually update claude token %
jq '.claude_pct = 52' logs/state.json > logs/state.json.tmp && mv logs/state.json.tmp logs/state.json