routing.json askTier (best | false), /route ask-tier on|off, one question per span with origin, phase, about, model and effort: Fable, Opus instead (big tier), stop for the session. The choice is a tier name stamped on the turn and run slots, inherited by same-tier helper routes only; spawns remember one answer per agent type per session; never headless or inside an agent. 28 TIER tests.
Picking the session's current model in the native picker fires no PreModelSwitch, so the scope question never came and the project pin stayed. The bare /model now asks model (fable/opus/sonnet or the native picker), Standard or [1m], then the scope.
The no-effort rule was keyed on every claude-haiku id, so Haiku 5.5 ran at the engine default instead of its phase effort (mechanical: low). The guard now names Haiku 4.x; status-reporter pins effort: low.
A pick in the picker is held (PreModelSwitch deny), then the same project / conversation / everywhere question runs; only Everywhere reaches the native write to user settings.json. A model chosen in that dialog bypasses the cold-read caps but waits while held down.
The native haiku alias moved to claude-haiku-5-5, so haiku sessions were unknown to the table and never routed. The 200K window entry was Haiku 4.5's; 5.5 is 1M like the rest.
This project writes model into .claude/settings.local.json and sets a sticky route; This conversation sets the sticky route only; Everywhere runs the native write. Links refused in the project tree, native never runs after an answer.
Prompt rules and the derived orchestrate route write effort-only routes, so
they never lift main above the session model; a held run keeps its model.
Fable on main comes from skill rows, the route tool or /route (BDR-123).
New best-tier phase audit (xhigh) carries both merge gates; their opus frontmatter stays the outage floor, since inTier never writes below a tier head. The census floors best-tier rows on the second alias, and the citers now name the audit row.
A session on Fable without credits kept Fable unprobed and lost its first turn, and each hold lapse, to the 429. The probe now covers the model the decision lands on, moved or kept.
The breaker learned availability only from a failed request: with
Fable out of usage credits, every new session and every hold lapse
routed main to Fable and lost the turn to a 429
(model_requires_usage_credits, typed rate_limit).
decideFor now probes the model a decision moves main to, once per
session, with a 1-call $.model.complete raced against 8 s: a timeout
or rejection marks it down (reason "probe") and re-decides once. The
current model and held ids are never probed; `probe: false` in
~/.claude/model-router.json turns it off. When a model ranked below
its tier head stands in where the head would have run, the phase's
own effort goes one notch up (reflect xhigh, plan max on Opus).
A built-in general-purpose agent with no explicit model, spawned by main
while main sits below the session model, is sent the session model
instead of inheriting the demoted one (narrow: built-in source, no fork,
no workflow, main's own child; other types carry their own frontmatter
model the hook cannot see). The cold-read cap now counts the prompt the
engine's usage may not include yet: code points / 3 of the submitted
text, its context entries and main's typed skill body, summed, added at
the turn's first main step unless usage already grew by half of it;
a document attachment makes the size unknown (blocks). Texts and the
step read the same adjusted size; the served record stays raw. The
cache TTL follows the engine's cache_ttl ('5m' | '1h') from main's
PostModelSwitch events, survives /clear, and /route show prints it.
The main loop may now move down to a cheaper model by default
(mainModelSwitch true, fail-closed picker). Both caps measure the COLD
READ a switch costs: the context minus what the target model's prompt
cache already holds, from a per-model served record written on every
main step (1 h TTL, cleared by /clear and /route reload; a smaller
context than the record counts as cold). downgradeMaxTokens defaults to
120000, upgradeMaxTokens keeps 200000; no return bypass is needed since
a warm return is cheap by construction.
The prompt classifier writes the full phase route: coding and
bookkeeping guesses move main down under the switch and the cap; a guess
never ranks above the session model; a mid-turn ultrathink floor keeps
its model; a user /effort typed between turns drops the guess for that
turn only (engine baseline is now per turn). A model-loaded helper skill
inside a best-tier run moves effort only. Main routed onto a model whose
window the context outgrew returns to the session model. The skip line
is said once per cap crossing; the toast names a cap hold; the status
line shows the switch only when off.
Kill switch fails closed: a present-but-unreadable override at first load
or a non-boolean enabled turns the router off (logged); /route reload says
when the previous config was kept. Prompt rules with nested quantifiers
are dropped; a config path that is not a regular file reads as failed;
caught errors log kind + code only (errWord); rejected keys are masked in
logs (keyWord), alias keys match KEY_NAME, prototype names are never keys;
offers capped at 256; a models alias without a fallback list is ranked at
the end of the default chain; canonical matches a table id at a '-'
boundary only; logCall/noteMain cannot unroute a step; route-tool failure
text no longer claims nothing was routed.
Repo side: mods suite probes the 'claude plugin test' usage line, doctor
bounds plugin list to 60 s, update-all skips @skills-dir mods.
Kit 431/431, full make test green.
Plain composer prompts with no route in force get a turn-scoped effort
from $.model.classify (design/analysis/coding/bookkeeping/chat → phase
effort, effort only, never the model). Bounded by a 3 s clock race, a
user interrupt neither counts nor writes, three failures in a row pause
it for cooldownMinutes (one toast, status marker, cleared by /route
reload). No dialog, no routing.json write on a classified route. New
Config key `classify` (default on, pickSwitch), `/route classify on|off`
session toggle, `/route show` line and argumentHint. An explicit user
/effort beats the guess (engineBase check).
Docs: README classifier paragraph, USAGE row + sentence, CHANGELOG,
effort-shift.md. Kit suite 428 tests.
verbose now logs one line per real change, built from the decision
itself: main 'fable/high → fable/xhigh (plan: skill /ship-feature)' once
per turn per transition, a hand-off line per agent dispatch deduped per
(type, target) 'main fable/high → agent verifier sonnet/xhigh (row verify,
row)', a later agent effort move, and an answered-by anomaly for agents.
The four stream lines (step, answered by, spawn, route JSON, skill path)
are gone; the host prefixes the plugin name, so the new lines carry none.
Lines are built inside safely before next (a log failure never unroutes a
step); names are cleaned (≤ 40 code points). Residuals: failure texts go to
the log with a generic answer (forget, ask), file fragments cleaned at
render, floorFile name allowlisted, __proto__ refused in restoreOf, the
changed scan limited to rows, dialog Change offers only shipped phases,
a post-answer write failure keeps the key asked. Kit suite 284 → 358.
Contract .claude/tasks/contracts/2026-10-11-model-router-w4a-logs-residuals-1637.md,
plan r3: 3 lenses (BLOCKER: agent model moves are decided at spawn) + 1
confirmation, feater + 4 rounds, GATE 0 MET, verifier at the cap on
coverage (user-accepted), security PASS + 2 MEDIUM fixed.
Clears first-use decisions from the tracked routing.json through the
existing writer: a name is forgotten in every table (confirmed, changed
with the row restored to its recorded shipped phase under guards, project
exceptions pruned) and asked again; all and projects ask a confirmation in
the engine dialog (Cancel first) and hold the single-dialog slot; nothing
is written when there is nothing to forget; the answer names what was
restored and the frontmatter floor to realign when one was aligned; the
route tool has no forget path. Docs name the new writer. Kit suite 232 → 284.
Contract .claude/tasks/contracts/2026-10-11-model-router-w3c-forget-1457.md,
plan r3: 3 lenses + 1 confirmation, feater + 3 rounds (one real defect),
GATE 0 MET, verifier at the cap on coverage (user-accepted), security PASS.
The dialog now explains what it asks about: the skill's description (from
its SKILL.md frontmatter, five YAML forms, first sentence, cleaned), the
agent's description (from agent.offer), the phase's new 'about' line in
routing.json, and the real model id and effort the next step runs on.
Options Later / Keep / Change; Change asks the model (fable, opus, sonnet,
haiku with their tier role), then the effort among those the phases of
that model offer, then the scope; the pair maps to an existing phase (rows
stay phase names; the row's current phase wins a tie; same phase = Keep).
A main-loop phase (T3) is Later / Keep only. A main-row change toasts the
real decision and the /route switch hint when the pick is a downgrade.
Descriptions pass a hardened read (name allowlist, stat kind, size cap)
and clean(). Kit suite 190 → 232; W3-A dialog tests migrated.
Contract .claude/tasks/contracts/2026-10-11-model-router-w3b-dialog-1240.md,
plan r3: 3 lenses (2 BLOCKERs: inline rows, phase edits) + 1 confirmation,
feater + 2 rounds, GATE 0 MET, verifier CONFORME (3rd pass), security PASS.
routing.json (tracked, reached through the plugin directory) is now the
single source of the phase table and of every skill/agent row, plus the
decisions: confirmed rows/phases, changed rows (from/to) and projects
exceptions keyed by a normalized git remote (credentials never stored, no
machine paths). First use of a rowed typed skill, a rowed agent spawn or a
main-loop phase opens the engine's dialog (Later / Keep / two alternative
phases; Other = a phase name); a change asks Everywhere or This project
only. One dialog at a time, never in headless, never inside an agent,
never written by the model: only a dialog answer or /route ask writes,
serialized, size-capped, never creating the file. Layers: routing.json <
~/.claude/model-router.json; the project tree is never read. /route
pending, /route ask on|off. Census reads rows and phases from the file and
tolerates a user-changed row (WARN). Kit suite 86 → 190 tests.
Contract .claude/tasks/contracts/2026-10-10-model-router-w3a-confirm-1201.md,
plan r4: 3 lenses + 1 confirmation, feater + 4 rounds, GATE 0 MET,
verifier CONFORME then re-verify after security, security BLOCK(1) fixed
then PASS. Live: T2 dialogs answered by the user from the hot-loaded mod.
The 15 Skill(effort-*) citers now call mcp__model-router__route per phase
(orchestrate at a dispatch span, reflect/plan for the skill's own level,
apply at the bookkeeping tail, escalate at the verify-secure caps); built-in
judgment dispatches carry an explicit effort= param. lib/effort-shift.md is
the route doctrine, lib/model-gate.md the mod rule (route answer = witness,
/route on as remedy). Deleted: skills/effort-*, lib/effort-pins.txt/.sh,
lib/model-check.sh, their tests, the installers' re-apply blocks. The mod
drops its Skill(effort-*) bridge. The tracked model:/effort: frontmatter
stays as the off-state floor, census-locked equal to the rows
(lib/tests/effort-routing.test.sh rewritten, 140 checks; analyzer → xhigh).
Contract .claude/tasks/contracts/2026-10-10-model-router-w2b-1045.md, plan
r4 § W2-B: GATE 0 MET, verifier ECARTS(7) then CONFORME 10/10, security
PASS, full make test green (design-tool-gate env red only).
Rows by role replace the pins as the live source (frontmatter stays as the
off-state floor): phases write=work/high and apply=work/low, 56 skill rows,
21 agent rows + Explore/Plan. Agents get the row's model at spawn (within
the tier, upward only, explicit params win, project-defined agents skipped
via agent.offer) and its effort per step. A typed slash of a rowed skill
routes main through a name-bound marker (composer|sdk|bridge, pending slot
mid-turn) or the idle fallback; a best-tier row lives in a runMain slot
that survives turn end and route calls. An unrowed skill leaves the route.
Typed /effort-* floor code removed (bridge kept until W2-B). The route
answer always names the id. Override rows accept null. Kit suite 58 → 88.
Contract .claude/tasks/contracts/2026-10-09-model-router-w2a-1546.md, plan
r4 .claude/tasks/plans/2026-10-09-model-router-w2-1546.md: 3 lenses + 2
confirmations, feater + 4 rounds, GATE 0 MET, verifier 3x ECARTS on test
coverage only (user-accepted at the cap), security PASS.
Phases name absolute tiers (best fable>opus>sonnet, big opus>fable>sonnet,
work sonnet>opus, cheap haiku>sonnet) resolved to the first available full
id; per-model circuit breaker fed by StopFailure kinds (rate_limit,
overloaded, billing_error, model_not_found) and PostModelSwitch auto, with
episode backoff 15→300 min, cleared by a user /model or /route reload and
kept across /clear; fallback chain fable→opus→sonnet→haiku with the effort
unchanged; main loop upgrades to a phase's tier by itself under a context
cap (fails closed on unknown usage), downgrades only with the switch on,
sticky within a turn; derived orchestrate on background dispatches;
prompt default rules (plan/reflect, Unicode guards, skipped on slash
commands, floor matches and mid-turn). 58 plugin tests.
One decision helper (mainEffort) feeds the plan and every answer text;
per-axis precedence (sticky > turn route > floor > engine); a mid-turn
prompt floors the running turn and the next; per-machine kill switch
"enabled": false in ~/.claude/model-router.json, kept across /clear and
across a failed reload; typed /effort-<l> attested at prompt.submit so a
sub-agent preload cannot floor the main loop. 30 plugin tests.
Security-gate round on the wave 1-A mod: /route answers only a composer
origin; an in-agent route call can no longer change the agent's model
(effort only, model fixed at spawn); config patterns capped (200 chars,
4096-char scan), phase keys restricted, override file refused above 64 KB,
additionalProperties false on the tool schema; every .catch logs once per
session; post-next bookkeeping isolated. 14 plugin tests, verifier 11/11.
Function-hooks plugin under mods/model-router: routes effort (and, behind a
flag, the model) of every main-loop request, sets built-in sub-agents' model
at spawn with full ids, answers Skill(effort-*) itself (single writer, no
pairing rule), exposes the route tool and /route, validates the optional
~/.claude/model-router.json. 11 plugin tests, validate + tsc clean.
Contract .claude/tasks/contracts/2026-10-08-model-router-w1a-1533.md.