| name | add-pick-crew-rule |
| description | Add, edit, or remove a leveled crew routing rule in config.json without hand-editing JSON. Routing rules map task-text keywords to a tier → {agent, model}. |
Manage Crew Routing Rules
Crew routing rules live in defaults.crewRouting.rules inside ~/.config/squadrant/config.json.
Each rule has the shape:
{
"tier": "<label>",
"match": "<regex>",
"agent": "claude|codex|gemini|opencode",
"model": "opus|sonnet"
}
Rules are evaluated in order; the first match wins.
Adding a rule
-
Read the current config:
cat ~/.config/squadrant/config.json
-
Identify the defaults.crewRouting.rules array. If it is absent, add it.
-
Build the new rule object. Validate:
tier is a non-empty string
match is a valid regex (test it mentally against a sample task string)
agent is one of claude, codex, gemini, opencode
model is only set for claude rules (opus or sonnet); omit for other agents
-
Insert the rule at the correct position — rules are evaluated in order.
Higher-priority / more specific tiers (e.g. "extreme") belong before broader ones
(e.g. "hard"). Append low-priority catch-alls last.
-
Write the updated config back via the existing save path:
-
Verify the rule fires as expected:
node -e "
const {loadConfig} = require(process.env.HOME + '/.config/squadrant/node_modules/...');
// or just log the matching rule manually
const rules = require(process.env.HOME + '/.config/squadrant/config.json')
.defaults?.crewRouting?.rules ?? [];
const task = 'YOUR TEST TASK HERE';
const hit = rules.find(r => new RegExp(r.match,'i').test(task));
console.log(hit ?? 'no match');
"
Editing an existing rule
Read → locate the rule by tier or match → update the field(s) → write back.
Removing a rule
Read → filter out the rule by tier or match → write back.
Precedence reminder
- Explicit
--agent / --model on squadrant crew spawn always override routing.
- If no rule matches, the spawn falls through to
defaults.roles.crew behavior (unchanged from pre-routing behavior).
Example rules
{ "tier": "extreme", "match": "redesign|architect|rewrite|from scratch|deep reasoning", "agent": "claude", "model": "opus" }
{ "tier": "hard", "match": "refactor|migrate|implement|feature|daemon|control-plane", "agent": "claude", "model": "sonnet" }
{ "tier": "mobile", "match": "mobile|ios|swift|android|kotlin|react native", "agent": "codex" }
{ "tier": "daily", "match": "typo|rename|bump|docs|comment|lint|format", "agent": "opencode" }