forked from bchanot/claude
docs: advisor rules in README and USAGE; changelog for the advisor doctrine
This commit is contained in:
1 parent
d292911343
commit
8ffe7e7ddd
3 files changed
+22
-17
No files matched your search
@@ -71,20 +71,24 @@ commands, settings, secrets, maintenance.
|
||||
## Agent model routing (model-tiering v2)
|
||||
|
||||
Doctrine: the main loop runs on the `opus` session model; the model-router rows
|
||||
route main-loop reflection (brainstorm, plan, contract,
|
||||
audit judgment, loop decisions) to the `best` tier, opus at the phase's effort.
|
||||
Fable is never auto-routed: it is the advisor (`advisorModel` in settings.json)
|
||||
and a hand pick. The main loop writes no code outside a skill run (the router's guard
|
||||
redirects it to a skill); the fresh gates run as dispatched agents on the `audit` row. The
|
||||
Fable/Opus model floor is enforced by a blocking gate (`lib/model-gate.md`) at
|
||||
the entry of the 17 reflection skills (the orchestrators, `/analyze`,
|
||||
`/guardrails` and `/a11y`): the skill calls the model-router `route` tool and
|
||||
its answer, which names the model id the main loop runs on, is the witness. A
|
||||
non-Fable/Opus id or the mod off stops the skill (`/route on` resumes the
|
||||
mod). Inside a sub-agent the answer says the model is `fixed at spawn`, and
|
||||
the skill proceeds. Nothing dispatched inherits silently: typed agents run on
|
||||
their model-router row, their `model:` frontmatter being the off-state floor;
|
||||
built-ins get an explicit `model=` at every call site.
|
||||
route main-loop reflection (brainstorm, plan, contract, audit judgment, loop
|
||||
decisions) to the `best` tier, opus at the phase's effort. Fable is never
|
||||
auto-routed: it is the advisor (`advisorModel` in settings.json) and a hand
|
||||
pick. The main loop calls the advisor before settling an approach, when stuck
|
||||
and before calling a long task done; sub-agents do not, even when the tool is
|
||||
listed. An absent or failing advisor changes nothing, and its advice waives no
|
||||
gate, cap or guard (`lib/effort-shift.md` § Advisor). The main loop writes no
|
||||
code outside a skill run (the router's guard redirects it to a skill); the fresh
|
||||
gates run as dispatched agents on the `audit` row. The Fable/Opus model floor is
|
||||
enforced by a blocking gate (`lib/model-gate.md`) at the entry of the 17
|
||||
reflection skills (the orchestrators, `/analyze`, `/guardrails` and `/a11y`):
|
||||
the skill calls the model-router `route` tool and its answer, which names the
|
||||
model id the main loop runs on, is the witness. A non-Fable/Opus id or the mod
|
||||
off stops the skill (`/route on` resumes the mod). Inside a sub-agent the answer
|
||||
says the model is `fixed at spawn`, and the skill proceeds. Nothing dispatched
|
||||
inherits silently: typed agents run on their model-router row, their `model:`
|
||||
frontmatter being the off-state floor; built-ins get an explicit `model=` at
|
||||
every call site.
|
||||
|
||||
| Agent | Model | Tier |
|
||||
|---|---|---|
|
||||
@@ -142,7 +146,7 @@ effort, never version. Transcript audit `python3 lib/effort-audit.py`.
|
||||
- Main loop: every request gets the route in force. A typed skill with a row routes the main loop to it; a best-tier row (`plan`, `reflect`, `orchestrate`, `escalate`; `audit` is an agent row, never typed) holds across turns in a run slot until `/route clear`, `/route off`, a user `/model` (typed with a name, bare, or picked in the `/model` picker, it asks the scope: this project, this conversation, everywhere) or a typed skill on a non-best row. A skill without a row leaves the route as it is. A rowed skill the model loads inside a best-tier run moves effort only when its row ranks below the run's model. Main routed onto a model whose context window the conversation outgrew returns to the session model. Before main runs on a model, the one it moves to or the one it keeps (the session's own model included), the mod probes it with one small completion bounded to 8 seconds; the step (and `/route show`, the route tool's answer) waits for it. A timeout or an error marks the model down (reason `probe`, held for `cooldownMinutes` like any breaker hold) and the decision is taken again once. A model already marked down is never probed, and a model that answered is not probed again, `/clear` included, until it is marked down. When a lower model stands in for its tier's head held down (Sonnet for Opus on a best-tier phase; Opus for Fable when a machine override heads `best` with fable), the phase's own effort goes one notch up: `reflect` xhigh, `plan` max, `orchestrate` high, `escalate` stays max. An effort asked explicitly (`/route ... effort=`, the `route` tool's `effort`) or set by a floor is never raised. `/route show` and the route tool's answer print the level with `(<model> stands in for <head>)`, `(sonnet stands in for opus)` with the shipped tiers; the verbose transition line names `stand-in` as a cause.
|
||||
- Sub-agents: a routed agent gets its row's model at spawn, within its tier and only upward from its frontmatter model, and the row's effort on every step. Explicit `model` / `effort` params on the Agent call win; a project-defined agent of the same name keeps its own definition. Built-ins: Explore runs on sonnet/medium, Plan on opus/xhigh. A built-in `general-purpose` agent that main spawns with no `model` param, while main runs below the session model (a downgrade or a breaker fallback), starts on the session model instead of inheriting the lower one; it is not pinned when the session model is marked down, for a fork, a workflow or a nested spawn, or when a project or user definition shadows the built-in. Other agent types are never pinned this way: the hook cannot see their frontmatter model.
|
||||
- Write guard: a main-loop Edit, Write or NotebookEdit of a code file is redirected with "model-router: code is written inside a skill run…" until a skill ran on the main loop in the session (typed or loaded by the model; a refused or unknown skill does not count), a phase was declared this turn, or a typed `/route` holds. Free paths: `.md`, `.txt`, the project's `.claude/` except `worktrees/`, and `docs/`. Sub-agents write freely. If the guard's own check fails (throw or timeout), it holds such a write instead of letting it through, with "model-router: the write guard failed (<kind>), so this write is held…", logged once per session; sub-agents, a skill run, a declared phase or a typed `/route`, and `.md` / `.txt` files still pass, and an error raised by the tool itself is passed on unchanged. `/route clear`, `/route off` and `/clear` re-arm the guard; `/route off` also turns it off, and `"enabled": false` in `~/.claude/model-router.json` turns the router and the guard off. A `/model` hand pick does not open it, and a `register.ts` reload resets it.
|
||||
- Levers inside a run: `ultrathink` in a prompt sets the turn's minimum effort; `/route effort=max` holds until `/route clear`. Keyword prompt rules (`plan`, `design`, `architecture`… take plan's effort; `why`, `review`, `audit`… reflect's), `ultrathink` and a main Agent dispatch (the derived `orchestrate` route, held until its background agents end) set the turn's effort only, never a model: they never lift main above the session model, and a held best-tier run keeps its model. Fable on main comes only from a hand pick (`/model`, picker), a typed `/route model=fable` or a machine override that puts fable in a tier: no shipped tier holds it. The built-in `/effort` is not a lever inside a run, rows and routes outrank it.
|
||||
- Levers inside a run: `ultrathink` in a prompt sets the turn's minimum effort; `/route effort=max` holds until `/route clear`. Keyword prompt rules (`plan`, `design`, `architecture`… take plan's effort; `why`, `review`, `audit`… reflect's), `ultrathink` and a main Agent dispatch (the derived `orchestrate` route, held until its background agents end) set the turn's effort only, never a model: they never lift main above the session model, and a held best-tier run keeps its model. Fable on main comes only from a hand pick (`/model`, picker), a typed `/route model=fable`, a phase naming `model: fable` or a machine override that puts fable in a tier: no shipped tier or phase holds it. The built-in `/effort` is not a lever inside a run, rows and routes outrank it.
|
||||
- `/model` scope: a pick in the `/model` picker is held first (the engine prints that a hook blocked it), then the same question as `/model <name>` comes. A bare `/model` opens the router's model, variant and scope dialog: fable (labelled `fable (custom)`, it heads no shipped tier), opus or sonnet, then Standard or `[1m]`, then the scope, the current model included; `Other model (native picker)` opens the native picker (haiku goes through it or `/model haiku`) and Esc changes nothing. A pick while another dialog is open is refused with `answer the open dialog first`. The picker's Default, an unknown name or a headless run go native, no question. A model chosen in that dialog (a hand pick) always switches: no cold-read cap, no `mainUpgrade` or `mainModelSwitch` flag. A hand pick marked down keeps main where it is until it is back. A native switch (the `/config` Model row included) or `/clear` drops a hand pick; a typed `/route model=` keeps the caps.
|
||||
- Prompt classifier: a plain prompt typed in the composer (12 characters or more, not a slash command) that no keyword rule, skill, run slot, `/route` or floor covers is sent to the engine's small fast model, one call, bounded to 3 seconds (the prompt waits for it, typically under a second). The label (`design`, `analysis`, `coding`, `bookkeeping`, `chat`) maps to plan, reflect, implement or apply (`chat` routes nothing), and the turn takes that phase's route: its effort becomes the turn's default, and its model may move the main loop, never above the session model. A `coding` or `bookkeeping` guess moves main down only when `mainModelSwitch` is on and the cold read fits `downgradeMaxTokens`; an `ultrathink` floor in the same turn raises the effort only, the guess's model holds. No dialog opens and no file is written. The route is gone at the end of the turn, a later route call or typed skill replaces it, and a `/effort` you type between turns drops the guess for that turn only. A typed best-tier skill holds its run slot across turns, so nothing is classified there until `/route clear`. Long prompts are sampled (first 500 and last 1500 code points), so pasted text at the end can steer one turn's route. Three failures in a row pause it for `cooldownMinutes` (one toast, `classifier: paused` in the status line). Never in a sub-agent, mid-turn or under `-p`. Off per session with `/route classify off`, per machine with `"classify": false`. The status line reads `route: classifier <phase>`; `/route verbose on` adds the transition line.
|
||||
- `/route` (user command) shows or sets the route: `show`, `clear`, `off`, `on`, `reload`, `pending` (rows and phases not confirmed yet), `ask on|off` (first-use dialog on or off), `ask-tier on|off` (the ask before Fable, below), `forget <name|all|projects>` (takes decisions back: a changed row returns to its shipped phase; `all` and `projects` ask first), a phase name, `model=<alias|id> effort=<level>`, `switch on|off`, `classify on|off` (the prompt classifier, below), `verbose on|off` (logs transitions only: each change of model or effort, with a few words of cause). `/route show` names the run slot when one holds (`main: run <phase>`) and prints the switch with its cap and the prompt-cache TTL (`switch: on (downgrade, cap 120000 tokens cold, ttl 60 min)`) and `ask-tier:` (`best`, `best (paused this session)`, `off`, or `inert` while `best` is not headed by fable). The model sets routes through a `route` tool.
|
||||
|
||||
Reference in new issue
Block a user