Model Router  ·  Documentation  ·  Previous: Roadmap  ·  Next: Contributing

# Changelog ## Unreleased - Reviewed against Claude Code 2.1.334 and the 22 docs pages whose text changed with it, which `compat/baseline.json` records. Nothing the plugin uses was removed or deprecated, and its mod doesn't listen for `classic.SessionStart`, the event 2.1.334 can now deliver to a mod twice. ## 0.2.4 - 2026-12-01 This release runs the `complex` level on Opus, makes the Stop check read a shell command in bounded time and a little faster, and grades the benchmark's report task against its own solution's speed. - The `complex` level runs on Opus at `high` (`needs` 3), the same rung as `hardest`, where it ran on Sonnet at `high` in 0.2.3. The `architect` and `reviewer` agents run on Opus at `high`. No shipped level picks Sonnet: it runs when a call names it, which stands for `standard`, and as the redo of a Haiku run. `hardest` is reached by a rule that sets the level, by Opus named above `high`, or by a redo the cap holds on Opus, and a redo of an Opus run at `high` goes to Fable at `medium` when the cap allows it. The session note's row for work with an open approach or no check to run names Opus, and with `min_tier: sonnet` the rows read `sonnet at medium`, `sonnet at high` and `opus at high`. Under `max_tier: sonnet`, a judgment call that names a model and an effort is held to Sonnet at the named effort, and one that names no effort runs on Sonnet at `xhigh`. A rules file that sets `complex` to `needs` 3 changes nothing now, so the guide's example sets `standard` to `needs` 2. The reason: in a round of 24 runs on a review task with 10 seeded defects, the complex level on Sonnet at `high` solved 0 of 6 and on Opus at `high` 4 of 6 (one-sided Fisher p 0.030), and Opus costs more per run ($0.65 against $0.28 at the mean). - With no level on Sonnet, a session sends a document whose brief settles its shape to Haiku at `high` even when the content is advice (10 of 11 runs of the `route-judgment-memo` case on a Sonnet session), and the same memo asked as an open question named Opus in 5 of 5 runs, 4 of them at `high` and one with no effort, which the plugin filled in as `high`. A model named on the call puts such a document on Opus. - The recommended effort for a Sonnet session is `high` (`session` in `config/models.json`), where 0.2.3 recommended `xhigh`, so the session check offers Sonnet at `high` or higher. In a round of 30 runs on the review task, Sonnet at `xhigh` solved 1 of 6 against 2 of 6 at `high`, with a cost per solved task shown 183.7% higher, and Opus at `medium` solved 1 of 6 at a cost not shown lower. This and the `complex` level above rest on two of three rounds run on 2026-12-01, each with its rule written first and 6 to 10 runs an arm, which show only a large gap; the third measured `delegation` (see the rounds below); [docs/BENCHMARKS.md](docs/BENCHMARKS.md#decision-rounds) has their tables, rules and commands. - The Stop check parses a heredoc line only when it can hold a move, a `tee` or a redirect. On a 1 MiB tail of 2,655 shell calls, 2,011 of them after an unchecked edit ([docs/PERFORMANCE.md](docs/PERFORMANCE.md) has the other cases), it takes about 47 ms in process on Python 3.9.6, where 0.2.3 took about 66 ms. - One command may have 20,000 path names resolved (`_RESOLVE_BUDGET` in `gates.py`), and a resolve of a path costs its separators plus one, with 3 times the names in the project folder's path added for a heredoc's write target. Past that the reader treats the folder as unknown: a script named by a path is no check, a named tool such as `pytest` or `npm test` still is one, and a heredoc command counts as a write, at worst one extra question. A command of 5,000 `cd x;` took 21 seconds to read in 0.2.3, longer than the Stop hook is given, and takes under a second. Real commands stay far from the budget: 60 heredoc writes outside a project 35 folders deep spend 33% of it, and a 40-line script with 30 `cd` and `python` lines spends 10%. - A write target longer than 1,024 characters (`_PATH_LIMIT`, the limit a move already has) counts as a write without a resolve. Where a check command's folder or script path is resolved, each word that starts with `~` and is not `~` or `~/path` costs 100 of the 20,000 names (`_LOOKUP_COST`) on every system, since on macOS and Linux it asks the system for a user's home. The heredoc reader doesn't charge it. - One hook run has 100,000 path names resolved in all (`_RUN_BUDGET` in `gates.py`), shared by every command it reads, on top of each command's own 20,000. The Stop check, a stopped agent's check and an agent handing back its report each start a run. Past the run's budget each later command is read as one past its own: a script named by a path is no check, a named tool still is one, and a heredoc counts as a write. Only path resolves are counted. - One limit remains, measured on Python 3.9.6 on macOS. The budget counts the names in the command's text, so a folder that is a symlink to a path hundreds of folders deep costs more than is counted (a link to a 380-name target: 5 to 7 s for a command of 100,000 characters). That needs the link to be on disk already. - A command that lists, prints, sets up or only pretends to run is no check. That covers subcommands (`ruff clean`, `ruff rule`, `tox list`, `tox config`), flags (`tox -l`, `tox --notest`, `tox -e py --notest`, `nox -l`, `ctest -N`, `go test -list`, `go test -c`, `jest --clearCache`, `eslint --print-config`, `pytest --setup-plan`, `pytest -V`), a task named for setup, cleaning, fixing or watching (`make lint-fix`, `npm run test:data`, `test-setup`, `test:watch`), and a shell that reads without running (`bash -n`, `set -n`, `bash -o noexec`). A list flag after `--` goes to the program `tox` or `nox` starts, so `tox -e py -- -l` still counts. A flag's value is not read as a task for `make`, `gmake`, `just`, `cargo` and `go`: `make -C tests build` and `just -f tests build` run no check. - A command inside a shell inside a shell, such as `bash -c "cmd /c pytest"`, is read down to 3 shells. One nested deeper is no check, and a check beside it still counts. - The benchmark task `perf-nlogn-rewrite` is graded against its own solution's speed: in the same grade the check times the task's solution and then the answer on the same 20,000 and 200,000 rows, as CPU time read from outside the answer's process. It fails an answer that takes over 4.3 times as long through `reports.render` or 3 times through the command (the brief's 10 seconds over the solution's time), unless the answer's CPU time is at most the brief's 10 seconds at 200,000 rows (1 second at 20,000). An answer fails only when every one of 3 tries is over the multiple (`TRIES` in the check). A probe of the answer is given up on after 100 seconds, or ten times the solution's wall time on the same input when that is more. A check's hash covers `solution/` when a script beside the check names it, and this check also pins the solution's files by their digest. A right answer failed on a slow runner under the limits in seconds. The task's revision is 3, so runs graded before it are set apart in [docs/BENCHMARKS.md](docs/BENCHMARKS.md). A grade is stopped after 300 seconds (`GRADE_TIMEOUT` in `bench/run.py`), up from 120. - Strict delegation stops looping where an agent can't start. Under `strict`, while the refusal stands, an Agent call of the main conversation that comes back refused or failed with no agent started (for example a `PreToolUse` hook that blocks `Agent`, a permission ask nobody answers under `claude -p`, a denied agent type) ends the refusals and reminders until an agent starts or a new turn begins. A second valve does not depend on seeing the failure: after 5 rounds of refusals with no agent started (a round is the refusals one request of the main conversation brings, at most 8) the refusals and reminders stop until an agent starts or a new turn begins, so a hook above this plugin that blocks `Agent` can't hold a turn shut. When the refusals end either way, Claude gets one line with the next result of its own call ("Model Router (delegation: strict): the refusals are off now, so tool calls run here."), once each time they end, and the ledger gets one `gate` row of kind `delegate-lifted`. The refusal reads "Model Router (delegation: strict): this session's own tool calls have moved 8,000 characters or more with no agent started (a fork or the web-fetch agent does not count as one), so this one is refused. Hand this work to an agent now: once one starts, tool calls run here again." A work call that waited on the check for whether an agent can start looks again when the wait ends, so it runs if an agent started or an Agent call failed meanwhile. - Only an agent the main conversation starts (a subagent, a teammate or a workflow agent, a resumed run included) resets the delegation count. A fork, the web-fetch agent, an agent started by another agent or by another plugin, and a start that is refused or fails do not. A work call runs from the moment the main conversation's own Agent call begins until the first of two events: that call's own spawn begins, or that call settles. It also runs while a spawn the main conversation made is under way, whatever started it, so a foreground agent's whole run does not hold the refusals off. The count follows how the start ends. - A session on an older model of the picked family is reported as switched only when `/model` changed the model. When it changed nothing, the session check says the session stays on its model, and the effort is left as it was. The pick reads the session's model before `/model` and after each command. A pick with no model command always runs `/effort`. When a pick has a model command and the read before or after it failed, the effort is not set and one line says the model could not be read. A failed read after the last command shows one line that the change could not be confirmed. In 0.2.3 a failed read threw, so after `/model` the effort was never set. - `/model-router on` over a saved `off` gives the session the routing text and delegation reminders it started without. `/clear` after `/model-router off` redraws the status line. When the read of plan usage fails or comes back with no plan windows, an agent's figures are still recorded, without the line that says usage inside the plan isn't billed. In 0.2.3 a read with no plan windows dropped the figures. - Claude Code 2.1.333 also sends `session.end` when it restarts itself and when the plugin is turned off. The plugin now drops a session's entry on `/clear` only, so a `/model-router off` switch survives a restart. A write to the switches file drops an entry that is a day old, and a read does not check age. - A redo that moves to a stronger model starts it one effort level below the run it redoes, and never below `medium`. From a Haiku run at `medium` the redos climb haiku `medium`, haiku `high`, sonnet `medium`, sonnet `high`, opus `medium`, opus `high`, fable `medium`, fable `high`, fable `xhigh`, fable `max`. - Bedrock's Mantle endpoint, when it is the only provider on, is a known provider: `sonnet` there is Sonnet 5 and `haiku` is Haiku 4.5. The alias is sent as it is, no newer model ID is put in its place and no pick moves up a family, and the session check leaves out a model it can't confirm there. A session on the bare `sonnet` alias there counts as current, so one at `xhigh` or higher is not asked, and an older full ID still counts as older. - The route skill says a call that names no `model` runs on its agent's own model, so Claude names one when the work needs a different level. It used to say to leave `model` off a call to an agent that sets its own, unless the work needs a stronger one. - `scout`, `verifier` and `implementer`, the Haiku agents, set `autoCompactWindow: 100000`, so they compact before a prompt passes the 100,000 tokens above which Haiku 5.5 costs more per token. - A stopped agent's return is recorded before the check on what its shell did runs. When a long transcript cuts the hook off at its 10 second limit, the agent is out of `launched.json` and its finished run is kept, so a redo still finds the run to climb from. Only the check is lost. - The benchmark has new tools for small rounds. A configuration can set `effort`, `model`, `"prompt": "plain"` (the brief alone, with no instruction to delegate) and `patch` (text replaced in that arm's copy of the plugin). `--extra-configs` adds configurations from a file, and `bench/rounds.json` holds the planned ones. `bench/round.py` compares each arm with a control arm and gives two verdicts, one on pass rate and one on cost. The cost verdict prints cost per solved task and the median per-run cost ratio beside it, `higher shown` mirrors `lower shown`, percentages have one decimal, and a note says when the arms did not run the same tasks. Each comparison uses only the tasks both arms ran, and the pass-rate line counts the tasks where the arm is higher, lower and the same. `gain shown` needs the Fisher test and at least one task where the arm is higher, and `loss shown` at least one where it is lower. A note names the tasks two arms share on which they ran different numbers of runs, when they share more than one. A round with more than 10 verdicts gets a note on how many chance alone would show, counting both directions of each verdict. - The benchmark arm `plugin-plain` is the plugin as shipped, with `delegation` at `strict`, and the brief alone. `plugin-off-plain` is the same with `delegation` at `off`. - The rows of the small rounds of 2026-12-01 (`r2`, `r3`, `r4` and `v1`) are in `bench/results/rounds/`, with their transcript paths removed, and [docs/BENCHMARKS.md](docs/BENCHMARKS.md#decision-rounds) prints their tables. In `r4`, five quick tasks on an Opus session with the brief sent as it is, every setup solved 10 of 10 and a stock session cost 34% less per solved task than the plugin at `strict` (26% less per run at the median). The rule written before the run pointed to `off`, and the default stays `strict`: the round saw cost on quick tasks, and could see neither correctness nor a long coordinating session. Set `delegation` to `off` for small jobs done in the main session. In `v1`, with `delegation` off, the plugin started no agent in 10 runs and cost 13.0% more per run at the median than a stock session on the same five quick tasks (20 runs). - A resumed benchmark round stops when an arm's model, effort, prompt, `--timeout`, `--budget`, plugin or `env` changed since its rows were written, and rows record `timeout`, `plugin` (whether the arm loads the plugin) and `env_hash`. A 5xx API status is retried like a limit, and so is a 408 or 409 on a run's first turn at no cost. A run the API rejects with another 4xx at no cost is set aside as `api_rejected`, and 3 in a row for one arm stop the round. - The benchmark has a new task, `review-seeded-diff`, a review of a change to a ticketing service (605 lines added and 6 removed over 10 files) with 10 seeded defects and 13 decoys, code that looks wrong and is safe. An answer lists a file and a line for each defect. It passes when all 10 are found, a finding counting when it is within 2 lines of the defect, and at most 2 findings fall outside every defect's window. - The benchmark statements name their conditions. They say the 2026-11-25 rows measured version 0.2.0 and that every prompt told the session to delegate, the defaults too. They give the plugin's mean wall time on Opus (129 s against 81 s for the defaults) and say the plugin costs more than all-Haiku beyond noise, with the rule's label for that comparison "no difference shown". They say the account's prompt cache was warm across runs, the batches overlapped, four timeouts ($2.63) are priced from transcripts that are not published, and the Fable `defaults` setup ran `Explore` on Opus. The page drops its "Router spend by agent type" line, which counted every agent with no cost estimate as "main loop", and reads "before any judged run" where 168 exploratory rows came first. - The live probe has a refusal pass: the main conversation moves 8,000 characters with its own shell calls, the next call is refused, and work runs again once an agent starts. The pass sets `delegation` to `strict` through `--settings` (`pluginConfigs`). The probe's sessions and its version call stop at a time limit (300 and 30 seconds), and CI's `probe` job has one of 35 minutes. Every CI job has a time limit: 15 minutes for `version`, `mod`, `typecheck` and `validate`, 60 for `test`, 35 for `probe` and 20 for `live`. - The plugin reads `EVAL_MODEL_ROUTER_DELEGATION` and uses it ahead of the `delegation` option. `claude plugin eval` passes a case only `EVAL_*` variables, so this is how a case pins a mode. No other option has such a variable. Eleven eval cases set it to `strict` in their `prompt.md` front matter, which pins them to `strict` whatever the default is. The plugin reads it only when its own files run from outside a plugin cache (a checkout, `--plugin-dir`, or `claude plugin eval `). An installed plugin ignores it, so a project's `settings.json` `env` block can't change an installed plugin's `delegation`. - CI has no `eval` job. The live evals run by hand. Graders of nine eval cases are stricter: the `checks-pass` graders of `complex-release-train`, `complex-three-part-change` and `large-fix-sweep` also need the `tests digest` the run prints to match, so an answer that edits a test file fails, and the graders `found-the-bypass`, `importer-without-csv`, `money-rounds`, `value-changed`, `listed-the-page-the-check-rewrote`, `said-the-page-changed` and the three of `delegate-trace-a-flow` match what an answer says more exactly. `others-left-alone` is a new grader of both inline cases. The prompt of `complex-three-part-change` tells the session to leave the files under `tests/` and `SPEC.md` as they are. - The upstream check flags a retirement date that moved and a model the status table no longer lists, and watches the docs pages `errors` and `amazon-bedrock`. - The README has a Discord badge. - CI's version check reads the plugin's version from the commit it compares, so a version bump left out of the commit fails it (`tools/plugin_version.py`). - Reviewed against Claude Code 2.1.333, whose docs pages `compat/baseline.json` records. The CI pins (the `validate` matrix and the `probe` and `live` installs) moved to it. - The plugin's description in `plugin.json` says it routes each subagent, teammate and workflow agent the main session starts, where 0.2.3's said it makes the main session hand work to them. ## 0.2.3 - 2026-11-30 This release makes the Stop check read PowerShell commands the way it reads their Bash twins, and makes the live evals and the live probe more exact. - A check script named through `$env:NAME` or `${env:NAME}` (`python $env:TEMP\verify.py`) is read from the hook's own environment, with the name matched without case. One outside the project is no check, as with `$TMPDIR` in Bash. - `Set-Location`, `sl`, `chdir` and `Push-Location` move where a relative check script is read from, as `cd` and `pushd` do. The folder can be given as `-Path:dir` or `-LiteralPath:dir`. - `Invoke-Pester` counts as a check. - `Start-Job`, and `Start-Process` without `-Wait`, leave a job running until the agent stops. `Wait-Job`, `Stop-Job`, `Receive-Job -Wait`, `Stop-Process` and `Wait-Process` end one, as `wait` and `kill` do in Bash. - A project file written from a PowerShell here-string with `Set-Content`, `Add-Content`, `Out-File` or a redirect counts as an edit, as a Bash heredoc does. The here-string can sit in a variable that a later line of the same command writes. - The seven live-eval graders that read which model an agent ran on (the five named `ran-on-haiku` or `ran-on-sonnet`, and `redo-ran-above-haiku` and `first-redo-stayed-on-haiku`) match the trace's `"resolvedModel"` key itself. The same text quoted in a tool's output or in a reply no longer counts. On the 213 saved traces of real runs, each old pattern and its new one give the same answer. - `tools/live_probe.py` has a second pass in which the agent's shell is the PowerShell tool. It runs on Windows and wherever `pwsh` is installed, and prints one line and skips it elsewhere. - In CI, the `probe` job installs the newest Claude Code release on the weekly schedule, and Claude Code 2.1.332 otherwise. - `tools/live_check.py` runs one session on a real model and checks that the main session hands a job to an agent, the agent runs on Haiku and writes a file through its shell, and the plugin reads that write. `--scripted` runs the same session against the live probe's endpoint, and CI's `probe` job runs it on all three systems. CI's `live` job runs it on a real model on Windows, only when started by hand with `live` set and approved in the `model-eval` environment. - `bench/overhead.py` times the launcher's floor through a pipe. Without one the reading jumped between 24 and 42 ms from run to run. [docs/PERFORMANCE.md](docs/PERFORMANCE.md) has the times measured again on this release, and what the Stop check takes on a transcript whose last 1 MiB is all shell calls. - The docs say where the live evals run: by hand before each release that changes routing or delegation. CI's `eval` job runs only where the repository has an `ANTHROPIC_API_KEY` secret. - The Stop check reads more PowerShell jobs. `sajb`, `saps` and `start` start one, and `wjb`, `spjb`, `rcjb` and `spps` end one, as their full names do. `$p.WaitForExit()` with no argument ends one, `Wait-Job $a,$b` ends one per item, and a `-Wait` on a backtick-continued line counts. A bare `((` in a PowerShell call is grouping, not arithmetic. - A PowerShell here-string write is read more exactly. A path given as `-Path:notes.md` counts, a relative target follows an earlier `Set-Location` or `Push-Location`, and a `>` inside quotes is no redirect. A writer whose statement has a `(` or a backtick hides its path, so the write counts as a project write. - `py -m pytest`, `python.exe -m pytest`, `pytest.exe` and `ruff.exe check` count as checks, as their plain names do. - A transcript row that holds U+2028, U+2029 or U+0085 is read whole. It was cut in two, and the check or write in it went unseen. - `needs: 0` in a rules file is a value. It sent the level back to its default strength. A level never needs less than the level under it, and a project file can't lower a level through `needs`. - An agent file whose frontmatter ends within its first 24,000 bytes is read, and its model is held to `max_tier`. A file whose frontmatter ran past 6,000 characters was skipped, so the agent ran on its own model. - A project's rules file over 64 KiB is not read. Your own file keeps the 4 MiB limit. - `model: null` and `model: ~` in an agent file mean the agent names no model. - The swap note names the last model when a run switched more than 5 times. The ledger keeps at most 5 ids, the first and the last among them. - A data folder that can't be made no longer makes every hook fail. - The benchmark run drops `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_*`, `ANTHROPIC_SMALL_FAST_MODEL`, `ANTHROPIC_BETAS`, `ANTHROPIC_CUSTOM_HEADERS`, `ANTHROPIC_CUSTOM_MODEL_OPTION*`, `DISABLE_PROMPT_CACHING*` and `MAX_THINKING_TOKENS` from the shell, unless a provider switch such as `CLAUDE_CODE_USE_BEDROCK` is on. `ANTHROPIC_BASE_URL` is kept, so a run through a gateway still goes to it. A run that fails before it starts leaves no scratch folder, and `bench/overhead.py` removes each sandbox after timing it. - `tools/live_probe.py` fails a pass when `claude` exits non-zero. - The `one-per-line` eval grader fails on any line of `FINDINGS.md` that is not a bare name. The `complex-three-part-change` graders `csv-quotes` and `proration-rounds` are renamed `csv-crlf` and `proration-rejects-overuse`. - `npm.cmd test`, `npx.cmd vitest` and `.\gradlew.bat test` count as checks: a `.cmd` or `.bat` name counts as its plain name, as `.exe` does. - `cmd /c npm test`, `powershell -Command pytest` and `pwsh -c 'pytest -q'` count as checks when the command line after `/c`, `/k`, `-c` or `-Command` does. The `pwsh` flag scan stops at `-File` and `-EncodedCommand`. - `npm run -w web test`, `pnpm run --filter web test`, `npm exec -- vitest` and `npm run -- test` count as checks. A flag after `run` or `exec` takes the next word only when it is in that package manager's list of flags that take a value, and so does a flag after `npx`, `pnpx` or `bunx`. - A command nested past Python's recursion limit, such as `cmd /c` repeated hundreds of times, reads as no check. - The text inside a PowerShell here-string is no command: it is neither a check nor a job. - A Bash heredoc write reads a `cd` on the heredoc's line only as a command word, not inside quotes or a comment. A `cd` on an earlier line is not followed. A bare `cd`, `cd -`, a `cd` to a variable or a command's output, and a line with a subshell or a backtick outside quotes leave a relative target counted as a project write. A write after a `cd` to a variable or a command's output, or on a line with a subshell, was left out. `~` and `~/path` are read as the home folder, and a `~name` in a `cd` leaves a relative target counted as a project write, as does a `~name` as the target when no `cd` comes before it. A `~` right beside a quote or a backslash on the line stops the reader following the line's `cd`s, so a relative path or one that starts with `~` is counted, and an absolute path stays where it is. Two `cd`s on the line apply in order. In PowerShell a bare `cd` or a `cd` or `Set-Location` to a path held in a variable or a command's output, or to a `~name`, leaves a relative target counted as a project write, and `~`, `~/path` and `~\path` are the home folder there. `Push-Location` with no path stays where it is. `Tee-Object` and `tee` write, `-Verbose` and `-Debug` take no value, and the lines a heredoc feeds to a program are not read for redirects, unless the program is a shell. - A Bash heredoc write through `1>`, `1>>`, `&>`, `&>>`, `>|`, `>&file` or `>& file` counts as one through `>` does. It was no write. `2>` is not a write, and neither are `>&2`, `1>&2`, `2>&1` and `>&-`. - A `(` or `)` anywhere in a command, or in Bash a backtick, also inside quotes, a comment or a heredoc body, stops the reader following its `cd`. In a command that has a `cd`, a check script named by a relative path is then no check, as in `(cd web; sh run_checks.sh)`, `cd web && sh scripts/test.sh 'a (b)'` and `cd web && python verify.py $(date)`, and a tool it names still is, as in `(cd web && npm test)`. Each was counted as a check, since a `(` made the reader drop every `cd` and read the script from the project folder. - `wait`, `kill` and `pkill` end a background job only as a command of their own, as do the PowerShell stop and wait commands. In `serve & echo wait`, `serve & wait-on http://x` and `serve & sudo kill %1` the job stays running. Each was counted as ended, since the word could be any word of the command. - A PowerShell command of 100,000 characters is read for jobs in under a second. A long run of `Invoke-Command`, `Start-Process` or `Receive-Job` took up to 30 seconds, since each one scanned to the end of its statement. `Start-Process -Wait` and `Receive-Job -Wait` now count the `-Wait` only within 300 characters, and a `-Wait` further on leaves the job counted as left running. - An `&` inside a comment, a string or a here-string is no job. `Start-ThreadJob`, `Invoke-Command -AsJob` and `Start-Process -Wait:$false` leave a job running. - An agent file with CRLF line ends reads the same as one with LF. A 24,000-byte head of digits, blanks or blank lines is read in milliseconds. It took seconds. - A `[1m]` suffix is dropped from an `availableModels` entry and from the requested ID before matching, on every provider. A `deniedModels` entry catches a request with and without the suffix, and one written with the suffix blocks that variant only. - A state write that fails, as on a full disk, is skipped, and the hook goes on and gives its normal answer. A routing switch that could not be saved says so, and `/model-router:models reset` says the file was left as is. - With `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1` a hook has no `CLAUDE_CONFIG_DIR`. The plugin then reads the config folder from `CLAUDE_PLUGIN_DATA` when that path ends in `plugins/data/`, so your override file and user agents are found. - A `routing` value that is not text asks `/model-router` for no switch. - `tools/live_check.py` gives a session 300 seconds and the version call 30. A session that hangs has its whole process tree ended and prints a `FAIL` line. The five checks are one function with unit tests. CI's `live` job has a limit of 20 minutes and each of its two steps 6. - The benchmark run holds more variables back from the model's sandboxed shell and from the grading check. These names count as secrets: names with `PASSPHRASE`, `PASSWD`, `WEBHOOK` or `COOKIE`, the whole words `PASS`, `JWT` and `DSN`, a name ending in `DATABASE_URL` or `PWD` (never the shell's own `PWD` and `OLDPWD`), and any variable whose value is a URL with a password in it. - The benchmark page is written with LF line ends on every system. ## 0.2.2 - 2026-11-29 This release makes the main session hand work to agents, and checks what they hand back. - A new option, `delegation`, in `/config`: `strict` (default), `on` or `off`. It applies only while `routing_mode` is `auto`, and not under `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`. - With `on` or `strict`, the session-start note, and the same text in the Agent tool's description where the mod runs, opens with a paragraph that tells Claude this session coordinates and agents do the work. The paragraph also says an agent's report is a claim: work no check ran on gets a review by a second agent before it counts. - Where the mod runs, it adds up the characters the main conversation's own Read, Grep, Glob, Edit, Write, NotebookEdit, Bash, PowerShell, WebFetch and WebSearch calls sent and got back, one call counting for 4,000 at most. When the total passes 8,000, and again at each further 8,000, Claude gets a reminder with that call's result. Under `strict`, once the total is 8,000 or more, the next work call is refused until an agent starts. A page read through Claude Code's built-in `web-fetch` agent is a work call too, and that agent's start is no hand-off. So the read and the edit of a one-line fix in a long file both run in the main session. - An agent the main conversation starts (a subagent, a teammate or a workflow agent, not a fork) or a new turn of the main conversation sets the total back to 0. A subagent's own calls and another mod's calls never count. Nothing is reminded or refused while the session can't start an agent, with routing off, or without the mod. - A session that runs as an agent (started with `--agent` or the `agent` setting, or a teammate in a terminal pane of its own) is not told to hand its work out, has nothing reminded or refused, and gets no session check. - Each reminder and each refusal writes one `gate` row to the ledger, of kind `delegate` or `delegate-deny`, through the new runtime command `mod-delegate`. - `/model-router:route` and the `policy` output say what delegation is set to. - The session note's table sends work to Haiku at `high` only when its brief settles the approach. Work with an open approach or no check to run (a design, a review, a rewrite) goes to Sonnet at `high`. - A new option, `min_tier`, in `/config`: `none` (default), `sonnet`, `opus` or `fable`, the weakest model a subagent, teammate or workflow agent may run on. A weaker model from the call, a rule, the agent's definition, a redo or the level table is raised to it, at the same level and effort, with the exceptions `max_tier` has. A `max_tier` weaker than `min_tier` wins. Under `min_tier` the note's table names the models a call runs on, a redo climbs from the raised model, the status line shows `floor sonnet`, and `/model-router:models` lists a model below the floor. With no usable model at or above the floor, the call runs on the strongest one left. - The Stop check counts a project file an agent's shell changed as an edit: one a heredoc in its command writes, or one that changed on disk while one of its shell commands ran and that no file tool wrote. The disk scan leaves out what the project's top `.gitignore` leaves out, and stops after 20,000 files and folders or 3 seconds. It covers an agent's own worktree as well as the project folder, and a command left running in the background counts until it finishes or the agent stops. A file that changed while the agent's check command ran is that check's own output. A project file the main conversation wrote through a shell heredoc is its edit too. When an agent changed project files and nothing has checked them, the ask says its report is the only word on them and that a compare against the report leaves the files unread, and for work with no check to run it asks for a review by `model-router:reviewer`. An agent whose name says it reviews counts as a check when it started after the edit and read files. - When an agent's shell command changed a project file, the main session is told which files, beside the agent's report: with the prompt that carries a background agent's report, with a foreground agent's result, or at the end of the turn. Where one command alone was running when a file changed, the line gives the number of that shell command. So a helper that rewrites a page as a side effect shows to the main session even when the report leaves it out, and the agent isn't sent back to write its report again. Where the report goes back through `SubagentHandback`, the new runtime command `handing-back` notes the files at that call. Each line writes a `gate` row of kind `report`. - When an agent's work comes back and no check has run on what agents changed, one line beside the result tells Claude to run the tests, type check or linter that cover the work, or to start a review where none does, before its closing reply, and that its own read of the work counts as neither. It waits while a background agent still runs, comes once for a batch of edits, and writes a `gate` row of kind `verify-early`. The Stop check still asks when a turn ends with the edits unchecked. On a page with nothing to run, the review started before the stop in all 46 runs where an agent wrote the page. In a build with no such line, run beside one with a line, it came only after the Stop check's ask in 3 of 6 runs. - Model health is kept per provider, so a model that fails twice on Bedrock stays usable in a session on the Anthropic API. `/model-router:models reset` clears every provider's record. - The data folder cleans up after itself: a session start removes a temp file a killed hook left and the state files only earlier releases wrote, and `edits.json` drops a session after 30 days with no write. Once a day it also drops the bytecode the launcher kept for a plugin folder that is gone. - A script named for a check counts as a check for the Stop check: `sh run_checks.sh`, `bash scripts/lint.sh`, `python3 tools/validate.py`, `./run_checks.ps1`. One outside the project doesn't, since an agent may have written it to check its own work. - On Windows, the Stop check reads a Git Bash drive path such as `/c/Users/me/app` as drive `c:` and the backslashes of a PowerShell command as path separators, so a check run there counts. A PowerShell `&` in front of a command runs that command, and only an `&` after a command is a job left running. The disk scan matches `.gitignore` rules and the folder names it skips without case on Windows and macOS, as git does there. It also skips a byte order mark at the top of `.gitignore`, stays out of a junction, and keeps its line when one changed file is on another drive. - The `implementer` agent can't start an agent, so it does the work it was given and doesn't hand it on. - The `reviewer` agent reviews work no check can test (a document, an analysis, code no test covers) from the files its brief names, as well as a risky diff from a diff file. - The live evals add cases for delegation, tagged `delegation`, two cases for work with nothing to run, tagged `unchecked` (a page an agent writes in `unchecked-production-settings`, an answer from reading alone in `report-only-production-values`), and a routing case that sends a memo that advises to Sonnet at `high`. A further delegation case, `names-a-page-a-helper-rewrote`, has a helper that rewrites a page the task puts off limits, and passes when the reply says the page changed or that the helper was left out. `inline-fix-in-a-long-file` is a one-line fix in a file whose Read alone moves more than 8,000 characters, and passes when the main session makes it. `route-agent-unnamed` grades the model and effort the call names, and no longer which agent Claude picks. The delegation cases build a fixture folder, so run them with `claude plugin eval plugins/model-router --trust-plugin --scaffold --allow-tools Write Edit Bash`. A fixture's `.gitignore` leaves out the result file its check writes, as a project's leaves out build output, so the line about what an agent's shell changed leaves that file out. - Measured on an Opus session ([docs/TESTING.md](docs/TESTING.md#latest-results)): 151 of 156 runs of a job with more than one step handed the work to an agent with the plugin, and 6 of 66 started one without it, and every run did the work right. Handing the work to agents cost 15% less to 59% more on jobs one session can do alone, 42% more on a page that also got a review, and 38% less on an audit of 90 modules. On a feature written across a copy of this repository, a run cost $0.64 to $1.16 against $1.50 without the plugin, and 4 of 4 runs passed. - [docs/PERFORMANCE.md](docs/PERFORMANCE.md) has the measured cost in tokens: with the plugin loaded, a one-word session on Opus 5.5 holds 19,731 tokens in its cached prompt, against 18,063 without it. - `tools/docs_assets.py` takes only `--check`. Any other argument prints its usage and writes nothing. - Reviewed against the 22 docs pages whose text changed since the last review, which `compat/baseline.json` records. Nothing the plugin uses was removed or deprecated. The daily upstream check now watches the tools reference too, where Claude Code describes its `web-fetch` agent. ## 0.2.1 - 2026-11-27 This release follows Claude Code 2.1.332 and cleans up the code. Options and commands are the same as in 0.2.0. - Reviewed against Claude Code 2.1.332 and the 37 docs pages whose text changed with it, which `compat/baseline.json` records. Nothing the plugin uses was removed or deprecated, and it doesn't use the release's new `PreSkillShellCommand` hook event. - On Google Cloud's Agent Platform `sonnet` goes out as the alias, and on Microsoft Foundry `opus` and `sonnet` do: Claude Code 2.1.332 runs the newest model for them. On 2.1.329 to 2.1.331 those three aliases run the provider's older model. - Under `availableModelsMatch: exact`, an `availableModels` entry such as `claude-opus-4-5` also permits its dated model ID, as in Claude Code. - Under `availableModelsMatch: exact`, `best`, `opusplan` and `default` entries in `availableModels` permit nothing, as in Claude Code. - An `effortLevel` of `max` in a settings file reads as unset, as in Claude Code. - An agent that can use `PowerShell` or `Monitor` counts as one that can run commands, so a call to it that names no model gets the `standard` level. - A project or user agent file that Claude Code skips isn't read as an agent: one with no `name`, with a `name` that starts with `-`, contains `:` or is longer than 256 characters, or with no `description`. - With `CLAUDE_CODE_EFFORT_LEVEL` set to `auto` or `unset`, the session check estimates the session at the API's default effort for its model and offers no `/effort` pick. The variable is read in any letter case, as Claude Code reads it. - With `CLAUDE_CODE_SUBAGENT_MODEL` set, the workflow note says a stage that names no model runs on its agent's own model or that variable's. - The benchmark harness prices a Haiku 5.5 request with a prompt over 100,000 tokens at its higher list rates. - A usage report whose cost is too large a number to store is recorded with no cost. Before, the usage hook stopped with an error on it. - Dead code, repeated helpers and repeated tests are gone from the runtime, the benchmark harness and the docs tooling. ## 0.2.0 - 2026-11-26 Model Router manages the Claude model and effort that each subagent, teammate and workflow agent runs on. - Claude names the `model` and `effort` on each Agent call, from a table in the session-start note: Haiku at `medium` for finding, reading and listing, Haiku at `high` for writing and fixing code, figures and documents to a brief, and Sonnet at `high` for a judgment call with no check to run (a design or a review). Opus and Fable have no row. - The plugin keeps each call within your cap and the models usable here, fills in the effort when a call names only a model, gives a call that nothing names a model for a level from what its agent can do (`lookup` when it can't edit, write or run commands, else `standard`), and raises an agent's calls to the `level` a rule in `model-router.json` sets. - After two model errors on a model, or two runs on another model, calls route around that model for a day. - On a provider whose alias runs an older model, the mod sends the family's newest model ID. - A call whose `description` starts with "Redo:" runs above the run it redoes: one effort step up while that run was below `high`, else a stronger model, else one more effort step. - When Claude edited a project file with Edit, Write or NotebookEdit and no check ran after it, the Stop check asks Claude once to run the work's own check before it finishes. - In a session with a person at the prompt, the mod shows a status line under the prompt (mode, path, cap, this session's calls and how many were changed or redone), and `/model-router` prints the state or switches routing on or off for this session only, with no model turn. - When a new interactive session starts below the recommended main-session setups (Opus or Fable at `medium` effort or higher, Sonnet at `xhigh` or higher), the mod asks once which model, then which effort, and runs Claude Code's `/model` and `/effort` for a pick, which Claude Code also keeps as the default for new sessions (`max` lasts the session only). After Stay, "Don't ask again" sets `session_check` to `off`. - Options, in `/config`: `routing_mode` (`auto` or `off`), `max_tier` (the strongest model a subagent may run on, `none` for no cap), `verify_gate` (the Stop check, on by default) and `session_check` (`ask` or `off`). - Commands: `/model-router` (state, `on`, `off`, `check on`, `check off`), `/model-router:route` says which model and effort fit a task, `/model-router:models` shows each model's state here (`reset` clears what it learned), and `/model-router:usage` shows recent routing, tokens per model and Claude Code's cost estimate per subagent. - Agents: `scout` and `verifier` on Haiku at `medium`, `implementer` on Haiku at `high`, and `architect` and `reviewer` on Sonnet at `high`. - Requirements: Claude Code 2.1.329 or later, `sh`, and Python 3.9 or later as `python3` or `python`. The plugin makes no network call. - Measured on an Opus session, 80 runs per setup: Model Router solved 80 of 80 at $0.183 per solved task, Claude Code's defaults 80 of 80 at $0.361, and every subagent forced onto Haiku 78 of 80 at $0.139. [docs/BENCHMARKS.md](docs/BENCHMARKS.md) has the tables, the method and the limits. ## 0.1.2 - 2026-11-24 The second release, which 0.2.0 replaces. ## 0.1.0 - 2026-11-23 The first release.