Global Task Router
Purpose
Route each substantive task through the lowest adequate lane: Free -> Fleet -> Premium.
Scope boundary
Owns task-lane selection and escalation evidence. Does not own repository standards, release flow, or deployment.
Hard constraints
- Default to the lowest adequate lane.
- Premium requires explicit justification.
- Persist lane evidence when hooks are available.
- Prefer existing tool calls over extra user prompts.
- Recommend manual picker changes only when no API exists.
Decision flow
- Read task intent and repo context.
- Score for
free,fleet, andpremiumtriggers. - Select the highest required lane.
- Emit backend/model recommendation.
- Record rationale and escalation trigger.
Lane guidance
- Free: search, explain, docs, boilerplate, small edits, simple bugfixes.
- Fleet: medium multi-file implementation, test writing, migrations, patterned refactors.
- Premium: architecture, ambiguous debugging, risky changes, security, performance, concurrency.
Escalation triggers
Move upward when any of these are true:
- lower lane already failed
- ambiguity is high
- task spans many files/systems
- reasoning quality changes likely avoid retries
- speed-to-correctness matters more than raw request cost
Output format
TASK_ROUTER_REPORT
lane: <free|fleet|premium>
backend: <auto|openclaw|sonnet>
recommended_model: <model-or-picker>
confidence: <high|medium|low>
rationale:
triggers:
Verification
- Hook state contains routing metadata.
- Prompt hook injects lane context on substantive prompts.
- Router CLI returns JSON for sample prompts.
- Repository lint still passes.
- Fleet dispatch is operational:
node scripts/global/task-router-dispatch.js --prompt "implement multi-file refactor" --executeroutes to the fleet inference endpoint (resolved viafleet-config.js) and returns a model response. - Successful fleet dispatches are logged to
~/.copilot/openclaw-usage.logviaopenclaw-lane-log.js. openclaw-chat.js --healthconfirms gateway reachability before dispatch.