Model Router · Documentation · Previous: Architecture · Next: Security
# Glossary
The project's own words, and the code behind each.
## The plugin
**Agent rule**: a rules file's `model`, `level` or `route: false` for one agent (`registry.Rule`). A project's rule only raises.
**Allowlist**: the registry models `availableModels` and `deniedModels` leave open, from the settings layers the mod sends (`allowlist.Allowlist`).
**Call**: one request to start an agent: a subagent, a teammate or a workflow stage. Its key hashes the agent type and the prompt (`calls.identify`).
**Cap**: the `max_tier` option. Every model the router keeps or sets is lowered to fit it (`Registry.clamp`), except one an environment variable pins and a fork's. A model ID the registry can't place in a family is left as it is.
**CLI**: `cli.main`, the one command line every hook and skill runs through. Hook commands read the hook's JSON on stdin; `policy`, `models`, `explain` and `usage` serve the skills, and the first three take the plugin's options as flags (`cli.py`).
**Decision**: what `router.decide` returns for a call, keep or rewrite, with model, effort, level, source and reason. The repeat guard can turn a rewrite into a deny.
**Delegation**: the `delegation` option, `strict` (the default), `on` or `off`: whether the session-start note tells Claude that this session coordinates and agents do the work, and whether the mod reminds Claude or, under strict, refuses its work calls once the main conversation has moved a lot of text with no agent started (`settings.Settings.delegation`, `hooks._DELEGATE`). Only while routing is `auto`, and not in a session that runs as an agent (`--agent`, or a teammate in a pane of its own).
**Delegation reminder**: the line the mod adds to a work call's result when the main conversation's own calls have moved 8,000 characters since an agent last started, one call counting for 4,000 at most, and again at each further 8,000 (`hooks._delegate`, `hooks/router.ts`). Each one writes a `gate` ledger row of kind `delegate`.
**Done record**: a task's latest finished run, in `done.json`, which a redo climbs from (`calls.last_run`).
**Exact ID**: a full model ID or `[1m]` variant the call or agent names, kept while its family is (`spawn.exact`).
**Fallback path**: `PreToolUse` on `Agent`, which rewrites `model` and `effort` through `updatedInput` for a call the mod didn't mark (`fallback.route`).
**Floor**: the `min_tier` option, the mirror of the cap. Every model the router keeps or sets is raised to it, at the same level and effort (`Registry.available`), except one an environment variable pins and a fork's. A model ID the registry can't place in a family is left as it is. A cap weaker than the floor wins, and the floor is ignored (`Settings.floor_ignored`).
**Held**: what a project's file asked for that wasn't applied, with why: the decision's `held`, and `/model-router:models`.
**Intake**: telling the person's own prompt from a delivered message or a Claude Code framing (`intake.is_user_prompt`).
**Lagging alias**: a family whose alias runs an older model on this provider (`older_aliases`). The mod sends its newest ID instead (`Registry.newest_id`); where none goes out, the router's own pick moves one family up (`Registry.past_lag`).
**Ladder**: the five levels, each a `needs` strength and an effort (`ladder.py`, `config/models.json`).
**Ledger**: `ledger.jsonl`, one row per spawn, result, model error and subagent turn, and one per Stop-check ask, line that an agent's work is unchecked, line about what an agent's shell changed, delegation reminder, delegation refusal and end of the refusals (`ledger.py`). It holds no brief or description.
**Level**: lookup, standard, complex, hardest or frontier (`config.Level`). A call's level is the one its model stands for (`ladder.rung`), raised by a level floor.
**Level floor**: a rule's `level`, which raises a weaker model to that level's model (`Rule.level`, `Rule.floor`). Not the `min_tier` floor.
**Mark**: the empty file `mod-calls/` that tells the fallback the mod routes this call (`mod.routes`). Not the redo mark.
**Mod path**: `hooks/router.ts`, which sets the model at `agent.spawn` and the effort at `turn.step`, asking the runtime through `mod-*` commands (`mod.py`).
**Model health**: model errors and substitutions seen here (`health.py`, `state.json`). Two of either route a model around for a day, and one refusal routes around a newest ID the mod sent.
**Model swap**: a run whose model changed mid-run (`modelsUsed`). It finishes no call and isn't health evidence. The ledger keeps at most 5 model ids for it, the first and the last among them, so its note names the first model and the last.
**Order of authority**: where the model comes from, strongest first: the force pin, the workflow pin, the call, the user's rule, a project's rule, the agent, `CLAUDE_CODE_SUBAGENT_MODEL`, then the agent's tools (`router.decide`). An agent's `model: inherit` is its own choice of the parent's model.
**Outcome**: a result, failure or stop coming back for a call (`calls.Outcome`), read by one rule set on both paths (`calls.returned`).
**Override file**: a rules file: `~/.claude/model-router.json`, trusted in full, or a project's `.claude/model-router.json`, which only raises, merged over `config/models.json` (`config.build`).
**Pick**: the cheapest usable model for a level and its effort there (`ladder.pick`), as `policy` lists it.
**Pin**: a model an agent's own definition names (the decision's source `pin`), or its effort. The router keeps it within the cap and the floor; a redo climbs past it. The force and workflow pins are the environment variables that set every subagent's or workflow agent's model.
**Read-only agent**: one whose `tools` hold none of Edit, Write, NotebookEdit, Bash, PowerShell and Monitor, or whose `disallowedTools` remove them all, and the built-in Explore and Plan (`agents.read_only`). A call that nothing names a model for runs at lookup on one, unless it is a teammate, and at standard on any other agent.
**Recommended setup**: a model family and the lowest effort the session that plans and delegates should run it at: Opus and Fable at `medium`, Sonnet at `high`, in `config/models.json` under `session` (`Registry.session`). A family left out is never one.
**Redo**: a call whose `description` starts with "Redo:" (`calls.marked_redo`). It climbs from its task's done record, else from what it would run at unmarked, effort first, then the model (`router._redo`).
**Registry**: the models, levels, aliases, rules and newest IDs a hook call reads (`registry.Registry`).
**Repeat guard**: on the fallback path, a rewritten call that comes back unrun passes through unchanged, or is denied with the model to use when it would run above the cap or below the floor (`fallback._guard`).
**Report note**: the line the main conversation gets beside an agent's report, when a project file changed while that agent's shell commands ran and no file tool wrote it (`gates._unnamed`). It names the files and says the report may leave them out. It comes with the prompt that carries the report, a foreground agent's result, or the end of the turn.
**Request**: the person's own prompt, read for a model it names, as in "use opus". The session-start note then says how a call for that model runs; nothing is forced (`request.named_model`).
**Role agent**: one of the plugin's five agents, `model-router:scout`, `verifier`, `implementer`, `architect` and `reviewer`, each with its own model and effort (`agents/`).
**Route**: where one spawn went: model, ID sent, level, effort, source and path, in `routes.json` (`calls.Route`).
**Routing mode**: the `routing_mode` option, `auto` or `off`, set in `/config` and never by a rules file. `off` changes no call and gives no session note, Stop check or session check; the ledger and health still record.
**Session check**: the once-per-session question, at the start of an interactive session below the recommended setups, that offers one, then an effort (`session.check`, the `session_check` option). Only on the mod path, and never in a session that runs as an agent.
**Session floor**: on the session's own model, an effort the router sets for a main-conversation call is at least the session's (`router._session_floor`).
**Session model**: the model the conversation runs on, which a call naming nothing inherits (`session.model`).
**Session note**: the table of which model and effort fit which work that Claude gets at session start, opened by the delegation paragraph when `delegation` is `strict` (the default) or `on` (`hooks._rules`). The mod also adds it to the Agent tool's description, and a form of it to the Workflow tool's (`hooks._workflow_rules`).
**Session switch**: `/model-router on` or `off`, which sets routing for one session in `switches.json`, read by every snapshot of that session (`settings.switch`, `Settings.switched`).
**Set aside**: moving a `state.json` that fails to parse to `state.json.corrupt-`, three kept (`store._set_aside`).
**Skipped write**: a state write dropped because another process held the lock past one second (`store.Busy`), counted in `locks.json`.
**Snapshot**: the registry, options, usable models, health and allowlist one hook call reads once (`settings.Snapshot`).
**Spawn**: a call starting its agent: `agent.spawn` on the mod path, `PreToolUse` on `Agent` on the fallback.
**Status line**: the mod's one line under the prompt: mode, path, cap, floor, this session's calls, and how many the router changed or ran as redos (`report.status`, `$.ui.status`).
**Stop check**: the ask before a turn ends when a project file was edited and no check ran since (`gates.py`, `verify_gate`). For an agent's edits, which include a project file its shell changed, it asks for the work's own check, or for a review of work with no check to run. A file the main conversation wrote through a shell heredoc or a PowerShell here-string is its edit too. When an agent's work comes back unchecked, one line says so beside the result, ahead of the ask (`gates.unchecked_at_return`). Guidance, never a block.
**Strength**: a model's rank in the registry, Haiku 1 to Fable 4 (`Model.strength`). A level's `needs` is the weakest strength it runs on.
**Strict**: the default `delegation` setting, which turns the reminder of `on` into a refusal: once the total is 8,000 characters or more, the next work call is refused until an agent starts, an Agent call fails or 5 rounds of refusals pass. Each refusal writes a `gate` ledger row of kind `delegate-deny`, and the end of the refusals one of kind `delegate-lifted`.
**Task**: a hash of a call's agent type and its description without the redo mark (`calls.task`), by which a redo finds its earlier run.
**Upstream check**: the daily CI job, `tools/upstream_check.py`, that compares Claude Code releases, the docs pages the plugin is built on, model aliases and retirements with `compat/baseline.json`. The plugin reads none of them.
**Usable**: the registry models inside the cap and no weaker than the floor, permitted by the allowlist and not routed around, weakest first (`Registry.available`, `Snapshot.usable`).
## The benchmark
**Baseline**: a way of running Claude Code without the router, in `bench/configs.json`: `defaults` (no plugin, subagents on the session model) and `haiku-high` (every subagent forced onto Haiku at high effort).
**Broken run**: a run whose pass check broke, by exiting 2 or failing to start (`run.grade`). It is left out of the tables and counted in a note.
**Cost per solved task**: a configuration's total spend divided by its solved runs.
**Known answers**: the `right/` and `wrong/` answers beside a task's pass check, which a test makes the check accept and refuse.
**Pass check**: a task's script that grades a run: exit 0 solved, 2 broken, any other exit or a timeout not solved (`run.grade`).
**Saturated**: a class where an exact one-sided test at 5% can't tell `haiku-high` from `defaults`, with 10 or more runs each (`analyze._quality`).
**Task revision**: the `revision` in a task's `task.json`, kept on each row as `task_revision`. Rows on an earlier revision are left out of the tables.
**Verdict**: the router against one baseline in one class, from paired per-task resampling (`analyze._judge`): WIN, LOSE, "no difference shown", or "no verdict" when the runs can't support one (`analyze._refusal`).