---
description: "Enable policy-driven model routing: pick a strategy, a scope, and the rules that say which rung a call lands on. Use when asked to turn model routing on."
description-tr: "Politika güdümlü model yönlendirmesini açar: strateji, kapsam ve hangi çağrının hangi basamağa düşeceğini söyleyen kuralları sorar."
argument-hint: "[--free [--allow-training] | --no-free] [--strategy=manual|task-fit|cost-ceiling] [--scope=subagent,bulk-read,delegate,research]"
parameters: [{"name":"--free","kind":"flag"},{"name":"--allow-training","kind":"flag"},{"name":"--no-free","kind":"flag"},{"name":"--strategy","kind":"enum","enum":["manual","task-fit","cost-ceiling"]},{"name":"--scope","kind":"enum","repeat":true,"enum":["subagent","bulk-read","delegate","research"]}]
gui: form
destructive: false
confirm: none
---

# multi-agent route-on  -  arm model routing

```bash
bash "$HOME/.claude/lib/route-state.sh" on ${ARGUMENTS}
```

Routing ships **off**. This is the command that turns it on, and it writes to
`prefs.global.modelRouting`, validated against the repo's `schemas/route-config.schema.json`.

## What a rule is

```json
{ "when": { "persona": "code-reviewer" }, "prefer": ["opus", "sonnet"] }
{ "when": { "phase": 2 },                 "prefer": ["sonnet", "haiku"] }
```

Ordered, first match wins. `when` matches on `persona`, `phase` (0..5) or
`taskKind`; `prefer` lists rungs in descending preference. `free` is a rung too,
honoured only at `bulk-read` and `delegate` and only while `--free` is on.

**Rung names are the contract; model ids are not.** `opus` is a rung here and a
model id in `cost-table.json`, and the second can change without anyone editing
a rule. Writing `claude-opus-5-5` into a rule pins a decision to a string that will
go stale.

Set rules with:

```bash
bash "$HOME/.claude/lib/route-state.sh" set-rules path/to/rules.json
```

## Free models: `--free`

```bash
bash "$HOME/.claude/lib/route-state.sh" on --free
```

Layer 2. Simple text work the pipeline does itself - a large-file read, a log or
document summary, field extraction, a label, a translation or commit-body draft -
goes to the multi-agent-mcp's verified free-model chain first. Every answer
is checked against its source before it is used; when none passes, Claude does
the task as before. Decisions, plans, code, reviews and triage never leave Claude.

`--free` turns on `modelRouting.free`, adds `bulk-read` and `delegate` to the
scope, and lists which providers are usable. With none, it says exactly which key
to add: one free Groq key is enough. `--allow-training` also admits free tiers
that may train on prompts; leave it off for corporate code and tickets.
`--no-free` turns only the free chain off. Full contract, the task list for
development and analysis, and unattended behaviour:
`$HOME/.claude/multi-agent-refs/features/free-models.md`.

## Strategies

| Strategy | What it does |
|---|---|
| `manual` | only the explicit rules apply, nothing is inferred. The default, because a router that guesses is a router nobody can predict |
| `task-fit` | the matched rule's rungs are tried cheapest first (cost-table prices, `free` first) |
| `cost-ceiling` | the rule's order holds until the run reaches the warn threshold of `budgetCeilingUsd`, then the cheapest rung is tried first |

`set-rules` checks every rule against the schema and the cost table and writes
nothing if one fails: an unknown rung, a phase outside 0-5, an unknown key.

## Scope, and the value that is not in it

`scope` names the call sites routing may act on: `subagent`, `bulk-read`,
`delegate`, `research`. Every one of them is a call **this pipeline makes itself**.

There is no `host-session` value, and that absence is enforced by that schema
rather than written as advice. Routing a host session means rewriting the CLI's
base URL to point at a local gateway - which sends the user's *entire* session
through a third layer, including work that has nothing to do with this pipeline,
breaks the subscription's auth model, and silently changes which model answered.
Passing `--scope=host-session` is refused with that reason, not ignored.

## The limit this command prints every time

On Claude Code a subagent cannot be dispatched to a non-Anthropic model: subagent
dispatch belongs to the host, not to us. So Phase 1, 2 and 3 personas stay inside
the Anthropic ladder no matter what the rules say, and the `free` rung applies
only at `bulk-read` and `delegate`, where the pipeline makes the call itself.

This is printed by `route-status` on every invocation instead of living in a doc,
because the question it answers - "routing is on, why is the reviewer still on
Opus" - otherwise arrives days later as a bug report.

## Related

- `/multi-agent:route-off` - disables routing and **keeps** the rules
- `/multi-agent:route-status` - what is active, and what it costs
- `/multi-agent:fable-on` / `/multi-agent:fable-off` - whether the top rung exists
  at all. That is a different question: this command decides which rung a call
  picks, those decide whether the top one is in play
