@alexeiled/claude-router 1.22.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "router",
3
3
  "displayName": "Router",
4
- "version": "1.22.0",
4
+ "version": "1.23.0",
5
5
  "description": "Native model and effort routing within your provider. Anthropic, DeepSeek, z.ai, MiniMax, MiMo and Kimi defaults, custom provider profiles, classifier advice and one model per subagent.",
6
6
  "author": {
7
7
  "name": "Alexei Ledenev",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.23.0 (2026-11-15)
4
+
5
+ ### Changed
6
+
7
+ - Route adaptive ops by phase without changing the durable goal: accepted `reason` uses the same-tier `debug` preference; `produce` uses `code`. Accepted bounded `verify`/`execute` keeps the ops preference. Active modes, explicit user cells and existing switching gates still apply. An inherited weaker generic cell does not replace a stronger ops preference.
8
+ - Do not introduce a new ops discount for reporting or weak/missing/unknown phase. Keep an eligible continuation; consider the existing generic baseline on fresh uncertainty.
9
+ - Prefer Haiku 5.5 High in automatic quality selection, with one exception: medium bounded ops may use Xhigh. Deliberate higher settings, pins and other providers' supported efforts remain unchanged. The Xhigh empty-answer risk is provider-documented, not reproduced by the High-only pilot.
10
+ - Use declared `strength` ranks for capability and subagent direction, never tariffs. Unknown ranks stay unordered; prices remain economics inputs.
11
+ - Preserve accepted intent across equal pairs, upgrades, window restoration and refits. Refusals retain incumbent intent; phase-derived switches require actual support with unchanged labels.
12
+ - Label every cost readout as a configured-rate API estimate, including plan, credits and mixed profiles. `≈` marks estimates, not invoices or measured quota savings.
13
+
14
+ ### Added
15
+
16
+ - `/router` distinguishes selected settings, the last recorded completed engine request and response-reported model. API-transmitted/served effort stays unknown. Existing event/coverage counters do not claim task acceptance.
17
+
18
+ ### Upgrade
19
+
20
+ Restart Claude Code after updating. In custom mixed profiles, declare intended model `strength` ranks before relying on strength-based cross-model continuation or observed upgrades; unranked models are no longer ordered by price. No account, permission or provider configuration is changed automatically.
21
+
22
+ ## 1.22.1 (2026-11-13)
23
+
24
+ ### Changed
25
+
26
+ - Separate the task goal from the current phase. Implementation stays `code` through verification, commit and reporting; a supported command-only phase can still use `ops` after the normal routing gates. Mixed tests and fixes are not execution-only.
27
+ - Keep a bounded goal in session memory only on explicit new-task/continuation evidence. History-prefix and request-generation fences reject replaced context and stale reviews. Unassociated notifications cannot justify downgrades.
28
+ - Show goal, phase and effective activity separately. Start a separate goal-contract counter series; older turn-label counters remain stored until **Delete history**. Tool compatibility is explicitly not accuracy.
29
+ - Use Jev `jev-1.14.0` by default. Explicit model overrides remain unchanged; Ollama remains goal-only without phase or continuity.
30
+
31
+ No configuration migration is required. Restart the plugin session after updating. Synthetic checks do not establish better real-task quality, calibration or savings.
32
+
3
33
  ## 1.22.0 (2026-11-11)
4
34
 
5
35
  ### Added
package/README.md CHANGED
@@ -35,18 +35,18 @@ Execution provider selection is separate from classifier selection. Observed usa
35
35
 
36
36
  ## Supported classifiers
37
37
 
38
- The active classifier is asked at the start of each logical turn, for the tier and for the turn's activity, and again in the background every 4 requests while the turn runs (`policy.reviewEveryRequests`). Pick one on the pane's **Classifier** tab or in the selected router file; only the active one receives prompt text. With subagent routing `on` (the default), it is also asked once per routed subagent, with the task's description and prompt; set `"subagentRouting": "off"` to keep that text local.
38
+ The active classifier is asked at the start of each logical turn, for the tier, task goal and current phase, and again in the background every 4 requests while the turn runs (`policy.reviewEveryRequests`). Pick one on the pane's **Classifier** tab or in the selected router file; only the active one receives prompt text. With subagent routing `on` (the default), it is also asked once per routed subagent, with the task's description and prompt; set `"subagentRouting": "off"` to keep that text local.
39
39
 
40
40
  | Classifier | Service | Credential | Prompt text goes to | How it is asked for the activity |
41
41
  | ---------- | ------------------------------------------ | ----------------------------------- | ------------------------- | --------------------------------------------------------------------- |
42
- | Jev | [typesafe.ai](https://typesafe.ai) | Jev API key | typesafe.ai | A third `choice` question in the same request |
42
+ | Jev | [typesafe.ai](https://typesafe.ai) | Jev API key | typesafe.ai | Goal and phase `choice` questions in the same request |
43
43
  | Clef | Cloudflare Workers AI, 27B | Cloudflare API token and account ID | Cloudflare | The same |
44
44
  | Clef Flash | Cloudflare Workers AI, 9B | Cloudflare API token and account ID | Cloudflare | The same |
45
45
  | Clef Omni | Cloudflare Workers AI, 30B MoE | Cloudflare API token and account ID | Cloudflare | The same |
46
- | OpenAI | OpenAI, `gpt-6-luna` (public beta) | OpenAI API key | OpenAI (`api.openai.com`) | A second `choice` in `questions`, in the same request |
47
- | Ollama | A local [Ollama](https://ollama.com) model | None | Stays on this machine | A second request: letters A to H, one token, if 300 ms or more remain |
46
+ | OpenAI | OpenAI, `gpt-6-luna` | OpenAI API key | OpenAI (`api.openai.com`) | Goal and phase choices in `questions`, in the same request |
47
+ | Ollama | A local [Ollama](https://ollama.com) model | None | Stays on this machine | Goal only in a second request; no phase or continuation answer |
48
48
 
49
- Jev is the default. [Configuration](docs/configuration.md#classifiers) gives the endpoints, timeouts, and how to add another service that speaks one of the supported protocols.
49
+ Jev 1.14 is the default; a configured model override stays in force. [Configuration](docs/configuration.md#classifiers) gives the endpoints, timeouts, and how to add another service that speaks one of the supported protocols.
50
50
 
51
51
  ![The Router band above the Claude Code prompt in eight states](docs/router-band.svg)
52
52
 
@@ -81,7 +81,7 @@ sequenceDiagram
81
81
  Mod-->>Dev: Status band and router pane
82
82
  ```
83
83
 
84
- The active classifier labels each new logical turn, and the router checks the route again while the task runs: a turn labelled `ops` that edits code moves up to the `code` route at once, and a background classifier review every 4 requests can move the tier or the activity either way. A cheaper route on the same task waits for a dwell and a checkpoint its work can show: a passed test, build or lint run, or for commands, docs and read-only work the success the router can see. A task notification is routed as progress on your last request. `/router decisions` lists why each turn ran where it did. See [Changes during a task](docs/user-guide.md#changes-during-a-task). A local policy applies vote, context, failure, and cache-cost rules before the Mod changes the next step. Claude Code owns request construction, model credentials, tools, streaming, and the API cost ledger.
84
+ The active classifier labels each new logical turn, and the router checks the route again while the task runs: a turn labelled `ops` that edits code moves up to the `code` route at once, and a background classifier review every 4 requests can move the tier or the activity either way. A cheaper route on the same task waits for a dwell and a checkpoint its work can show: a passed test, build or lint run, or for commands, docs and read-only work the success the router can see. A notification is treated as progress, but cannot justify a downgrade because it may belong to an older task. `/router decisions` lists why each turn ran where it did. See [Changes during a task](docs/user-guide.md#changes-during-a-task). A local policy applies vote, context, failure, and cache-cost rules before the Mod changes the next step. Claude Code owns request construction, model credentials, tools, streaming, and the API cost ledger.
85
85
 
86
86
  With the Anthropic profile, the base routes are:
87
87
 
@@ -94,7 +94,7 @@ With the Anthropic profile, the base routes are:
94
94
 
95
95
  These are routing defaults. They do not claim equal model quality. [Configuration](docs/configuration.md#built-in-defaults) gives the published results behind them and the `router.json` lines that restore the 1.3 Sonnet ladder.
96
96
 
97
- Activity routing adds a second label: what the turn produces (`code`, `debug`, `explore`, `plan`, `review`, `ops`, or `docs`). A route is then picked by tier and activity. It is on by default since 1.7. A `·` cell uses the tier's own route, the base route:
97
+ Activity routing classifies the task's goal (`code`, `debug`, `explore`, `plan`, `review`, `ops`, or `docs`) separately from the current phase. Bounded verification or execution can use the `ops` route without relabeling the goal. A route is then picked by tier and effective activity. It is on by default since 1.7. A `·` cell uses the tier's own route, the base route:
98
98
 
99
99
  The Anthropic profile uses these activity defaults. Other profiles have [their own defaults](docs/providers.md#activity-overrides).
100
100
 
@@ -1,8 +1,9 @@
1
1
  # Activity routing
2
2
 
3
- The router picks a model for each turn from two labels. The **tier** says how hard the work is. The **activity** says
4
- what the turn produces: changed code, a found cause, an answer, a plan, review findings, executed commands, or prose.
5
- Since 1.7 activity routing is `on` by default. This page shows the default choices, why each one is there, and how to
3
+ The router uses **tier** for difficulty, **goal** for the task's final deliverable, and **phase** for the current step.
4
+ The route uses the goal's activity and the current work preference: bounded commands can use `ops`, while adaptive
5
+ operations use the profile's same-tier reasoning or code preference. The durable goal does not change.
6
+ Activity routing is `on` by default. This page shows the default choices, why each one is there, and how to
6
7
  change them.
7
8
 
8
9
  The numbers below come from Anthropic's system cards and from a replay of one developer's sessions at list prices.
@@ -10,19 +11,59 @@ They do not measure this router's answer quality or your bill.
10
11
 
11
12
  ## What it does
12
13
 
13
- For each new turn the classifier answers two questions, the tier and the activity, in the same request (Ollama makes
14
- a second call). The router looks up the route for that pair. A route is a model and an effort.
14
+ For each new turn, Jev, Clef and OpenAI answer tier, continuation, goal and phase questions together. The existing
15
+ `activity` field and route matrix name the goal; the phase can select the `ops` cell for bounded command-only work.
16
+ Ollama asks tier and goal in two calls and does not provide a phase, so it cannot introduce a bounded-ops discount. A route is a model and an effort.
15
17
 
16
- | Activity | The turn produces |
18
+ | Goal | The task produces |
17
19
  | --------- | --------------------------------------------------------------- |
18
- | `code` | Changed code or config, including tests |
20
+ | `code` | Changed code or config, including tests and their verification |
19
21
  | `debug` | A found cause: failing tests, stack traces, "why does X..." |
20
22
  | `explore` | An answer: explain code, find where something happens, research |
21
23
  | `plan` | A decision or plan: design, task breakdown, trade-offs |
22
24
  | `review` | Findings about existing code: a PR, a diff, an audit |
23
- | `ops` | Executed commands: git, builds, test runs, CI, deploys |
25
+ | `ops` | Specified operations as the task's final deliverable |
24
26
  | `docs` | Prose for people: README, docs, comments, commit messages |
25
27
 
28
+ The phases are `produce`, `reason`, `verify`, `execute`, `report` and `uncertain`. A request to implement
29
+ an endpoint and run tests has goal `code`; “run the tests” can have phase `verify` while the goal stays `code`.
30
+ Tests **and fixes** are not verification-only. A terminal command by itself does not make the task an `ops` goal.
31
+
32
+ When both the goal and a `verify` or `execute` phase meet `policy.activityMass`, the router considers the
33
+ `ops` cell. It uses the lower of their supports for the existing activity-switch gates; it does not multiply them
34
+ or claim they are independently calibrated. For goal `ops`, accepted `reason` uses the same-tier `debug` cell and
35
+ accepted `produce` uses `code`, including the active routing mode and explicit user cells. It never substitutes a
36
+ possibly weaker generic route for adaptive work: a mixed cost profile can keep DeepSeek at medium while its generic
37
+ medium is GLM Flash. These are work preferences, not new activities or universal model-quality scores. Explicit debug/code cells,
38
+ including an explicit use-tier cell, remain authoritative. If a missing cell merely inherits a generic route that
39
+ is declared weaker than ops, the stronger ops preference is retained; unknown suitability is not inferred from price.
40
+ An explicit debug/code floor may be nominated on a continuation even when model order is unknown, but confidence,
41
+ cache, escalation-hold, cash and eligibility gates still decide. An inherited unknown generic cell gets no exception.
42
+
43
+ When the bounded ops pair and its accepted reasoning/code preference are identical, the semantic preference still
44
+ applies before tier policy: a later high-tier upgrade must use the work floor, not bounded ops. A protected physical
45
+ ops cell keeps accepted work intent separately for later tool-context or modality refits. A nomination is not
46
+ acceptance: confidence, hold, cash and eligibility refusals keep the incumbent's accepted intent (or none), including
47
+ when its activity label matches the proposal. Refits use that accepted outcome, never a rejected role. If a
48
+ smaller-window proposal is rejected because context/history is unmeasured, restored and fallback cells each resolve
49
+ their own accepted floor; native/base alternatives retain their existing eligibility.
50
+ A physical change derived from the current phase uses the lower of goal and phase support, even if the label is
51
+ unchanged. Genuine mode/configuration changes to an already accepted preference retain their usual support rules. That transient intent
52
+ clears with a history reset, superseding advice or observed upward move, pin/off mode, or native-unavailable fallback;
53
+ it never creates a new goal or bypasses eligibility gates.
54
+
55
+ For goal `ops`, `report` or a missing, malformed, uncertain or weak phase introduces no new ops discount: a continuation
56
+ keeps its eligible incumbent, and a fresh task considers the existing generic tier route through the usual gates.
57
+ Other goals keep their normal activity preference when phase is unclear.
58
+ The usual cache, dwell, escalation, model availability, context and credits checks still apply. A background phase answer expires when newer messages have arrived since its snapshot; stale bounded-command evidence cannot justify a cheaper step. A successful
59
+ classifier decision displays goal, phase and the route activity separately. Pins ignore activity routing.
60
+
61
+ The router keeps a bounded goal in memory for this session. It sends it as untrusted classifier context; a positively
62
+ identified continuation keeps it, a new task replaces it, and an ambiguous continuation drops it. A progress
63
+ notification uses the active goal but does not replace it or authorize a downgrade, because its originating task is not reliably known. The goal clears on session end, compaction or a detected
64
+ history rewind. A late notification may concern an older task; it is not proof of the current goal.
65
+ Goal memory is created only on positive new-task evidence; an unanchored continuation does not become a new goal. Ollama has no continuity answer and does not retain the anchor. No goal text is written to the activity or decision records. Classifier providers receive the goal and recent text.
66
+
26
67
  Most cells use the tier's own route, the **base route**. A few cells have an **override**. When the activity is
27
68
  unclear, or the classifier gives it less than 60% probability, the router moves back to the base route if the move
28
69
  passes the cache check below. When the classifier gives no activity answer at all, the running activity stays. A pinned
@@ -32,7 +73,7 @@ The router compares routes, not labels. If the new activity resolves to the rout
32
73
  A move to a cheaper route must pay back its cache write first. A move to a stronger route needs the classifier's
33
74
  support. The [user guide](user-guide.md#route-by-activity) has the full rules.
34
75
 
35
- The label comes from the prompt, so it can be wrong. A prompt such as "run the worker brief" reads as `ops` and the
76
+ The goal and phase come from the prompt, so they can be wrong. A prompt such as "run the worker brief" reads as `ops` and the
36
77
  turn may then spend 80 requests writing code. The router therefore also watches the turn's own tool calls. Once the
37
78
  turn edits a file, it moves to the `code` route of its tier (or `docs` for doc files) if that route is stronger. This
38
79
  move only goes up. The cache cost does not hold it back; only the cash cap on a credits-billed model can. A later
@@ -73,9 +114,10 @@ show about that shared cache, and its limits.
73
114
 
74
115
  - It is weakest at code. Terminal-Bench 4.0: Haiku 39.2%, Sonnet 70.6%, Opus 66.4%. SWE-bench Pro: 64.8%, 81.3%,
75
116
  89.9%.
76
- - Its quality depends on effort more than the larger models do. The defaults use `medium` and `high`.
77
- - Avoid `xhigh` in multi-turn chats. Anthropic reports that Haiku then sometimes puts the whole answer in its thinking
78
- and shows no reply.
117
+ - Its quality depends on effort more than the larger models do. Automatic `quality` selection prefers `high`,
118
+ with one exception: bounded `ops` at `medium` may use `xhigh`. Explicit higher settings and pins remain supported.
119
+ - Anthropic documents an `xhigh` risk in multi-turn chats: Haiku sometimes puts the whole answer in its thinking
120
+ and shows no reply. This was not reproduced by the High-only pilot; the preference is not a provider-wide effort cap.
79
121
  - Above 100,000 tokens of context, Anthropic charges 5 times Haiku's list price. Even then it costs at most a quarter
80
122
  of what Opus costs per token, and against Sonnet a quarter for input and output and half for cache reads.
81
123
 
@@ -199,7 +241,7 @@ Two other directions, with what they trade:
199
241
 
200
242
  **Activity threshold.** An activity applies only when the classifier gives it at least this probability. Below it, a
201
243
  new task goes back to the base route if that move passes the usual checks; the running task follows
202
- [Changes during a task](user-guide.md#changes-during-a-task). The default is 60% (`policy.activityMass: 0.6`). Change it on the Policy tab under **Activities**,
244
+ [Changes during a task](user-guide.md#changes-during-a-task). The default is 60% (`policy.activityMass: 0.6`); the same threshold applies independently to the phase. Change it on the Policy tab under **Activities**,
203
245
  or in `router.json`. There is no data to tune it on yet: the probe results record whether the
204
246
  label was right, not the classifier's probabilities.
205
247
 
@@ -248,7 +290,7 @@ Limits:
248
290
 
249
291
  - The answer quality of routed sessions.
250
292
  - How well the classifier labels real turns. On 70 synthetic prompts, Jev and OpenAI labelled all 70 right; see
251
- [Evaluation](evaluation.md#activity-probe-set). The **Agreement** lines, on the
293
+ [Evaluation](evaluation.md#activity-probe-set). The **Tool compatibility** lines, on the
252
294
  Classifier tab for this session and across sessions, check your own turns against the tools they used.
253
295
  - Whether an effort change on the same model always keeps the cache. Claude Code's prompt-caching docs say it does on
254
296
  the 5.5 models and Fable 5.1 with an API key or a subscription, and the router prices it so. On 2026-11-11 we counted
@@ -30,19 +30,19 @@ sequenceDiagram
30
30
 
31
31
  The Mod does not construct an Anthropic request or proxy its response. Claude Code owns authentication, request fields, streaming, tools, model fallback, and its native usage ledger. No local gateway process or port is part of the runtime. The Ollama classifier calls an Ollama server that you run; the Mod starts none.
32
32
 
33
- The active classifier receives only the current prompt and up to six recent user or assistant text messages. Each text is capped at 1,200 characters. System messages, tool inputs, and tool results are not included. Only the active classifier is asked: Jev sends that text to typesafe.ai, Clef, Clef Flash and Clef Omni to Cloudflare Workers AI, OpenAI to api.openai.com. Ollama runs on this machine, so the text stays here. The Jev, Cloudflare, and OpenAI keys are sensitive plugin options; the Cloudflare account ID is a plain one that fills the endpoint. Ollama takes no key. The Mod does not receive Claude's Anthropic credentials.
33
+ The active classifier receives the current prompt, up to six recent user/assistant text messages, and optional bounded active-goal and current-step text. Each text is capped at 1,200 characters. System messages, tool inputs, and tool results are not included. Only the active classifier is asked: Jev sends that text to typesafe.ai, Clef, Clef Flash and Clef Omni to Cloudflare Workers AI, OpenAI to api.openai.com. Ollama runs on this machine, so the text stays here. The Jev, Cloudflare, and OpenAI keys are sensitive plugin options; the Cloudflare account ID is a plain one that fills the endpoint. Ollama takes no key. The Mod does not receive Claude's Anthropic credentials.
34
34
 
35
- Each classifier names its wire protocol, `api`, and `classifier-apis.mjs` holds one adapter per protocol. `system-one` (Jev, Clef, Clef Flash, Clef Omni) sends the typed `state` and `questions` request and reads `answers.route`; Cloudflare's REST API wraps that answer in `{ result, success, errors }`, which the parser unwraps. `openai-decisions` (OpenAI) sends the state as `input` text and reads a `choice` answer plus a `predicate` for the continuation. `ollama` asks for one letter with thinking off and reads the log-probability of each letter from the top 20 candidates. A letter's probability is its share of the letters found there; a letter missing from the list counts as zero. The Ollama adapter asks no continuation question, so `continuation` is null there. Every adapter returns the same advice shape, so the routing policy is unchanged.
35
+ Each classifier names its wire protocol, `api`, and `classifier-apis.mjs` holds one adapter per protocol. `system-one` (Jev, Clef, Clef Flash, Clef Omni) sends the typed `state` and `questions` request and reads `answers.route`; Cloudflare's REST API wraps that answer in `{ result, success, errors }`, which the parser unwraps. `openai-decisions` (OpenAI) sends the state as `input` text and reads a `choice` answer plus a `predicate` for the continuation. `ollama` asks for one letter with thinking off and reads the log-probability of each letter from the top 20 candidates. A letter's probability is its share of the letters found there; a letter missing from the list counts as zero. The Ollama adapter asks no continuation question, so `continuation` is null there. Every adapter returns the common advice shape. Ollama has neither phase nor continuity; it uses the goal's route and does not retain a cross-turn goal anchor.
36
36
 
37
- The advice also carries `activity`: `{ choice, probabilities }` over the seven activities and `uncertain`, or null. Each protocol asks for it differently:
37
+ Advice carries `activity` (the task goal) and optional `phase`, each with a choice and probabilities. The effective routing activity can differ from the goal for bounded command phases. Protocols ask them independently:
38
38
 
39
39
  | Protocol | How the activity is asked |
40
40
  | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
41
- | `system-one` | A third question, `activity`, of type `choice` in the same request. |
42
- | `openai-decisions` | A second `choice` in `questions`, named `activity`. |
41
+ | `system-one` | Independent `activity` (goal) and `phase` choice questions in the same request. |
42
+ | `openai-decisions` | Independent goal and phase choices in `questions`. |
43
43
  | `ollama` | A second request after the route answer, with the same system message and state prefix so Ollama can reuse its cache. Letters A to H, one token. |
44
44
 
45
- The activity is optional at every layer. An adapter reads a missing, malformed, or unknown activity answer as `activity: null` and keeps the strict parsing of the route answer. With `activityRouting: off` no adapter builds the activity question, so the request bodies are the ones 1.5 sent; a fixture test checks this. The criteria and instructions live in `classifier-contract.mjs` beside the tier ones, and name each activity by what the turn produces. The classifier criteria keep showing the base route of each tier, not the activity overrides: the tier question is about difficulty.
45
+ The activity is optional at every layer. An adapter reads a missing, malformed, or unknown activity answer as `activity: null` and keeps the strict parsing of the route answer. With `activityRouting: off` no adapter builds the activity question, so the request bodies are the ones 1.5 sent; a fixture test checks this. The criteria and instructions live in `classifier-contract.mjs` beside the tier ones, and describe the final task deliverable separately from the current step. Unknown phase answers never invent a command-only route. The classifier criteria keep showing the base route of each tier, not the activity overrides: the tier question is about difficulty.
46
46
 
47
47
  Claude Code builds each request for the model the Mod selects, so no request rewriting is needed: Haiku 4.5 got its own thinking mode and a 32K output cap. On Claude Code 2.1.289, a billed chain of pinned turns (Opus, Haiku 4.5, Sonnet at `xhigh`, Sonnet, Haiku 4.5) used a tool on every turn over the previous models' history, and no request was rejected. Sonnet and Opus accepted histories above 589K input tokens. These checks cover tested requests. They do not prove every Claude Code feature combination.
48
48
 
@@ -91,11 +91,22 @@ The router decides on a _cell_: a tier and an activity. The route is `{ ...route
91
91
  `chooseRoute` decides at a turn's first step, and again on each review answered inside the turn:
92
92
 
93
93
  1. **Pin.** A pinned tier wins, with no activity: the pin's tier route.
94
- 2. **Activity.** Only in `on`; `off` uses none, and ignores the activity a turn in `on` ran with before the mode changed. With no advice, or advice without an activity answer, the incumbent's activity stays. On the same task (`sameTaskOf`; Ollama gives no continuation answer, so only reviews count for it) a label whose route at the incumbent tier is stronger applies at once, and a weaker one only with at least `downgradeMass` probability once `facts.downAllowed` holds; an unclear label keeps the running activity. Otherwise the activity with probability at least `activityMass` applies; below that, or for `uncertain`, there is none and the tier's base route is used.
94
+ 2. **Activity.** Only in `on`; derive the route activity from the goal and a supported phase, with bounded verify/execute using `ops`. For goal `ops`, accepted reason/produce uses same-tier debug/code; report or unclear phase keeps an eligible continuation or considers the fresh generic baseline, without a new ops discount. Other goals keep goal routing when phase is unclear. Progress origins cannot justify downgrades. `off` uses none, and ignores the activity a turn in `on` ran with before the mode changed. With no advice, or advice without an activity answer, the incumbent's activity stays. On the same task (`sameTaskOf`; reviews and progress origins count as same-task even without a continuation answer, including Ollama) a label whose route at the incumbent tier is stronger applies at once, and a weaker one only with at least `downgradeMass` probability once `facts.downAllowed` holds; an unclear label keeps the running activity. Otherwise the activity with probability at least `activityMass` applies; below that, or for `uncertain`, there is none and the tier's base route is used.
95
95
  3. **Tier.** The tier policy runs as before, with every candidate tier priced at its route for the activity and the incumbent at the route it runs. Repeated tool errors move to the lowest tier above whose route is stronger than the running one, or sends a request that cannot be ordered against it. With no activity that is one tier up, as in 1.5. If no tier above helps, nothing escalates and the failure signature is kept.
96
- 4. **Lateral move.** If the tier stays and the route would change, `lateralMove` decides. Routes order by explicit model strength when both models declare it, otherwise by output price, then effort; a session effort counts as the effort Claude Code sends. Two routes that send the same request do not switch. A pair that cannot be ordered (an unpriced model, a numeric effort, two models at one price) counts as a move up, so the base route is always reachable. A stronger route needs the activity's probability to clear the upgrade bar for its switching tax (a base route with no activity counts as probability 1). A cheaper route needs its downgrade tax to be paid back within `downgradeHorizonTurns`, except before the first measured reply of a history, when there is no cache to protect. The cash gate applies to both. The result is `activity-up`, `activity-down`, `activity-pending` (stay on the running route and its activity), `cash-gate`, or `hold`. While an escalation hold lasts, only a stronger route may be taken. One vote is enough: an activity is a fact about the turn, not a noisy estimate. If the tier changes, the tier gates have already priced the new route, and no lateral rule applies.
96
+ 4. **Lateral move.** If the tier stays and the route would change, `lateralMove` decides. Routes order by declared model strength, then effort. Unknown ranks stay unordered regardless of tariffs; prices remain economics inputs. A session effort counts as the effort handed to Claude Code, not verified API-transmitted effort. Two routes that send the same request do not switch. A pair that cannot be ordered (unknown model strength or an unresolved/numeric effort) counts as a move up, so the base route is always reachable. A stronger route needs the activity's probability to clear the upgrade bar for its switching tax (a base route with no activity counts as probability 1). A cheaper route needs its downgrade tax to be paid back within `downgradeHorizonTurns`, except before the first measured reply of a history, when there is no cache to protect. The cash gate applies to both. The result is `activity-up`, `activity-down`, `activity-pending` (stay on the running route and its activity), `cash-gate`, or `hold`. While an escalation hold lasts, only a stronger route may be taken. One vote is enough for a proposed activity cell, but the labels remain model estimates, not observed facts. If the tier changes, the tier gates have already priced the new route, and no lateral rule applies.
97
97
  5. **Fit.** Context fit and model availability resolve through `route(tier, activity)`. A fallback tries the last cell, the native model's cell, then each tier with the activity. The last and the native cell count only when they carry no activity or the turn's; otherwise, or when nothing fits, the native model runs at the session effort.
98
98
 
99
+ `decision.floorActivity` retains accepted ops reasoning/code intent separately from a protected physical ops cell.
100
+ Equal physical pairs can adopt the semantic preference without a switch before tier policy. Nomination carries
101
+ provenance through `chooseCell`/`decideCell`; lateral refusal restores the incumbent's accepted floor, not the proposed
102
+ role. Same-label physical changes introduced by a new phase projection use min(goal, phase) support, not the support
103
+ of 1 reserved for operator mode/config changes. Context/availability refits consume the post-gate accepted projection.
104
+ Every configured alternative resolves its own floor provenance, including after an unmeasured-window restore or a
105
+ last/native fallback. The existing rule for keeping the actual incumbent request remains separate and unchanged.
106
+ `continueRoute` projects that accepted preference per tier when context/modality requires a new eligible route. The field belongs to the accepted
107
+ turn decision: new advice recomputes it; history reset, observed upward supersession, pin/off and native-unavailable
108
+ fallback clear it. Existing host session/generation/review fences still own when a decision can apply.
109
+
99
110
  **Observed move.** On each later step of the turn, `observedMove` reads the turn's tool calls since its prompt, or since the transcript snapshot of the last review applied inside the turn (`loop.observedFrom`), since the review already judged the earlier ones, (`observedActivity`: `code` after an edit to a non-doc file, `docs` after edits to doc files only, else `ops`, `read` or `talk`). When that activity's route at the decision's tier is stronger than the running one, the remaining steps take it, with reason `activity-up` and `lastActivity` set, so the next turn starts there. The tier is fitted to the context first, so the gates price the route that will run. It goes through `lateralMove` with probability 1: the tools are the evidence, so the switching tax never holds it back (the upgrade bar tops out near 0.9), and only the cash gate can. The turn's reply label (`turnActivities.label`) follows the move; the classifier's answer stays as recorded. It never moves down, and skips pinned turns and `off`. `canMoveUp` skips the transcript read when no activity's route at the tier is stronger, so a step on the strongest route costs nothing. A move to a smaller window waits for a measured context, as in `routeTurn`. Context fit and model availability then apply as for any continuation.
100
111
 
101
112
  **Review inside a turn.** Every `reviewEveryRequests` requests after the last classifier answer (`loop.reviewedAt`, counted in `loop.requests`), `reviewMidTurn` reads the transcript and asks the active classifier in the background, with the turn's prompt and recent dialogue and `facts.midTurn` set. The classifier reads text only: the dialogue holds user and assistant text, not tool calls, results or edits. The policy reads those itself (`observedMove`, repeated failures, `completedSince`). The step does not wait. The first step after the answer arrives runs `chooseRoute` on it, before the observed move, with only the advice taken from the review: the checkpoint, context and cache facts are read at that step. Tier and activity move by the same rules as a continuation prompt: up on votes, down only past `downAllowed`. A pinned turn, a failed read or ask, an answer without advice, and an answer about a replaced history (another `generation`) change nothing; turn completion and session end abort a review in flight. `observeResponse` counts each request and records the request and message count at which the requested (model, effort) last changed (`switchedAt`), which the dwell and the verification window start from. A failed transcript read keeps the running route. A verification is a Bash command whose status is the check's: a checker (`pytest`, `tsc`, `eslint`, …) or a launcher whose subcommand names a check (`npm test`, `npm run lint`, `go test`, `make lint`, `uv run pytest`), alone or in an `&&` list. A pipeline, `;`, `||` or background job does not count, since its status can hide a failed check; neither do a `--version` or `--help` run, an option before the subcommand (`npm --prefix test install`), package names, paths and file names, nor a command Claude Code sent to the background, by request or after a timeout. The first response a loop serves also sets `switchedAt`, so checks from before the router chose a route do not count. When compaction or a rewind shortens the history, `prepareLoop` moves `switchedAt.messageCount` and `observedFrom` back to its end and keeps the request-based dwell.
@@ -124,14 +135,26 @@ Clear, branch, rewind, and committed compaction clear cache evidence and votes.
124
135
 
125
136
  ### Observed activity and stats
126
137
 
127
- When a turn completes, the Mod labels it from the tool calls the assistant made after the prompt: `code` for an edit to a non-doc path, `docs` for edits only to doc paths, `ops` for a Bash command that is not read-only, `read` for other tool use, and `talk` for none. `facts.mjs` reads tool names and file paths; it keeps no text. [Evaluation](evaluation.md#tool-agreement) explains how this is compared with the classifier's answer.
128
-
129
- Two stores hold counts:
130
-
131
- - **Session**: `activityStats` in the view, reset when the session ends. It has turns, requests, tokens, the list price of priced replies with their count, and routed replies by `model@effort` per activity, switches by tier and by activity, lateral moves taken and refused, and tool agreement. The label counted per activity is the applied activity in `on`. Tool agreement compares the answer that cleared `activityMass`, so it measures the classifier in both modes. The view also keeps `strip`, every reply since Claude Code started the session by tier in at most 48 cells that merge in pairs, with when its first reply arrived, and `lastSwitch`, the last route change with its tiers, routes and activity.
132
- - **Across sessions**: two `$.store` records per session. Each session's `activity:stats:v1:<session id>` holds a confusion matrix of the classifier's raw answer (including `uncertain` and `none`) against the observed bucket, run lengths per activity in five buckets, lateral switches taken and refused (from the decision's `lateral` field, so a hold or the cash gate counts), and `since`, its first count. A value with an unknown key or shape reads as empty; the `shadow` key that versions before 1.10.1 wrote is dropped on read and the rest is kept. Before 1.10.3 every session shared one `activity:stats:v1` key, read-modified-written each turn, so two sessions finishing turns together could lose a count and a stale write could undo a reset; that key now counts as one more record in the sum until **Delete history** deletes it, and 1.10.2 and earlier read only it. Each session's `activity:metrics:v1:<session id>` holds a classifier latency histogram per classifier id (22 buckets, at most 8 ids), the cheaper activity moves taken in `on` with the escalations that followed one, the routed replies excluded from usage comparisons by cause (`unpriced`: `usage`, `model`, `ttl`, `error`, `comparison`, from `unpricedCause` in `lib/savings.mjs`; 1.16), and `since`, its first reading; each part reads as empty on its own when its shape is wrong, as after a change of buckets. Both follow the usage records below: one writer per key, so sessions that finish turns at the same moment do not overwrite each other; this session's record held in memory and written after each turn that adds a count; the readout the sum of all records, latency kept to the first 8 classifier ids; and the same reset marker. Each record is bounded, and the records grow by one per session that recorded a count until **Delete history**. The view keeps the last sums read or written as `activityStore` and `activityMetrics`: read at session start and when the pane opens, replaced after each turn's write and after a reset. The open run is written when the session ends. **Delete history** clears the session counts, every stats and metrics record, and the usage records below.
133
-
134
- Nothing is recorded with `activityRouting: off`. Stats run inside a guard: a failed transcript read or store access loses that turn's counts and never fails the turn. Readings already in the session's metrics record stay in memory after a failed write and go out with the next turn that adds a reading. A turn from a session that has since changed is dropped.
138
+ Completed turns have tool buckets (`code`, `docs`, `shell`, `ops`, `check`, `read`, `talk`).
139
+ They describe tools, not the semantic goal. Shell-written code, delegated work and unknown tools limit this oracle.
140
+ [Evaluation](evaluation.md#tool-agreement) describes the many-to-many compatibility check.
141
+
142
+ - **Session**: `activityStats` in the view counts turns, requests, tokens, priced replies/routes, switches and
143
+ tool compatibility. Its activity breakdown is the effective route activity, not necessarily the task goal.
144
+ The `activityContract` marker starts a fresh session counter series when the label contract changes.
145
+ - **Across sessions**: `activity:goals:v1:<session id>` stores the raw goal-vs-tool confusion counts,
146
+ bounded run-length buckets, lateral moves and `since`. Records under the old
147
+ `activity:stats:v1` namespace remain stored but are not merged into this new series. They are removed only
148
+ by **Delete history**. Goal and old turn-label percentages are not one accuracy series.
149
+ - **Metrics**: `activity:metrics:v1:<session id>` retains the existing latency histograms, cheaper moves and
150
+ following escalations, and unpriced replies by cause. These are operational readings, not semantic accuracy.
151
+
152
+ Each key has one session writer. The view's `activityStore` and `activityMetrics` are read at session start
153
+ and when the pane opens, then updated after a turn writes its record. The shared reset marker prevents an
154
+ older held record from undoing another session's reset, subject to the existing millisecond/clock limits.
155
+ **Delete history** clears old and new counters, metrics, usage and subagent records. No prompt text is stored.
156
+ A failed transcript/store read loses that turn's counts and never fails generation. Activity routing off records
157
+ no activity counters.
135
158
 
136
159
  ### Routing vs no routing
137
160
 
@@ -156,7 +179,7 @@ A subagent's model is chosen once, in the `agent.spawn` hook, before its cache e
156
179
 
157
180
  `spawnAgent` in `hooks/native-router.mjs` passes the spawn through unchanged for a fork, a workflow agent (before the explicit check, since a workflow `agent({ model })` has `e.model` set), an explicit `e.model`, or a teammate (`passReason` in `lib/subagents.mjs`). Then `typeRoute` decides. A `subagents.types` entry wins; a key without a colon matches only the engine's built-in of that name. An unlisted built-in passes (`unlisted`), since its definition is not on disk. Any other agent is routed by its definition. `agentDefinition` finds the file once per provider and type in a session; a read that fails is tried again at the next spawn of the type. A plugin agent's `provider.plugin` is `plugin@marketplace`, the key of `<profile>/plugins/installed_plugins.json`, whose `installPath` entries hold `agents/*.md`. Other agents are looked up under the session's `.claude/agents`, then `<profile>/agents`. `agentFrontmatter` reads `name`, `model` and `modelRouting` from YAML or a one-line JSON object. No model, `inherit`, or `modelRouting: auto` is routed; any other model passes (`pinned`); a file not found, unreadable, or matches that disagree pass (`unknown`). A routed agent's type uses its models key, or for `classify` the active classifier is asked with the description and prompt alone, clipped to `context.maxTextChars`, with no history and no tool results. The answer maps to `subagents.heavy` when `P(high) ≥ heavyMass`, to `light` for an `explore` activity above `activityMass` or tier `micro`, else to `standard`. The spawn path has its own classifier client per classifier: its own failure count and pause, and no in-flight slot, so parallel spawns each get an answer and spawn failures never pause main-turn routing. Its deadline is the classifier's, capped at 3 seconds. That bounds how long a subagent waits to start. No advice, a missing key, a model `availableModels` blocks, or settings that cannot be read keep core's model. The router sends the configured full id, never an alias, because a family alias resolves to the parent's exact model when the families match. A `.catch` runs `next(e)`, so a failing hook spawns the agent as Claude Code would. Routing off (`/router off`, `/model`) or unavailable passes every spawn through and records nothing.
158
181
 
159
- Every spawn in `on` gets a record keyed by `agentId`, from `next(e)`'s answer. Its replies are priced in `turn.step` (`addAgentReply`), on the model they ran on and on core's model as `coreModelOf` estimates it (the definition's own model, else `CLAUDE_CODE_SUBAGENT_MODEL` except for Explore and Plan without `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`, else `parentModel`). Cache writes are priced at the subagent lifetime (`subagentCacheTtl`). The spawn record also keeps `move` (`moveOf`): `up` or `down` when the routed model's output price is above or below core's, `moved` when either has no price, null for the same model. The record's counts go to this session's `$.store` key `subagents:v1:<session id>` at each of the agent's `turn.complete`s, and at session end for agents still running. Since 1.14.0 the value is version 2, by local calendar day like the usage records, and days past 400 leave it when it is written: per day, per type and per pass-through reason, the agents, requests, priced requests, respawns (a spawn of the type its parent loop finished one of in the last 10 minutes) and classifier failures, and per model id the agents ran on, the agents, the agents moved, up and down, the routed cost and core's. An agent counts on the day of its first flush; its later requests and cost on the day of each flush. A version 1 value has no days or models: it reads as `undated` agents and cost, which only the Session and All periods add. The records follow the usage records: one writer per key, the view's `subagentStore` is every session's sum and `subagentSession` this session's, and the same reset marker applies. **Delete history** clears them too. The view's `subagentsRunning` counts the agents with a record between a spawn or a step and their turn's end; it is in memory, so a reload starts it over. The band in a subagent's transcript reads the agent's record from memory too.
182
+ Every spawn in `on` gets a record keyed by `agentId`, from `next(e)`'s answer. Its replies are priced in `turn.step` (`addAgentReply`), on the model they ran on and on core's model as `coreModelOf` estimates it (the definition's own model, else `CLAUDE_CODE_SUBAGENT_MODEL` except for Explore and Plan without `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`, else `parentModel`). Cache writes are priced at the subagent lifetime (`subagentCacheTtl`). The spawn record also keeps `move` (`moveOf`): `up` or `down` when the routed model's declared strength rank is above or below core's, `moved` when either rank is unknown or both are equal, null for the same model. The record's counts go to this session's `$.store` key `subagents:v1:<session id>` at each of the agent's `turn.complete`s, and at session end for agents still running. Since 1.14.0 the value is version 2, by local calendar day like the usage records, and days past 400 leave it when it is written: per day, per type and per pass-through reason, the agents, requests, priced requests, respawns (a spawn of the type its parent loop finished one of in the last 10 minutes) and classifier failures, and per model id the agents ran on, the agents, the agents moved, up and down, the routed cost and core's. An agent counts on the day of its first flush; its later requests and cost on the day of each flush. A version 1 value has no days or models: it reads as `undated` agents and cost, which only the Session and All periods add. The records follow the usage records: one writer per key, the view's `subagentStore` is every session's sum and `subagentSession` this session's, and the same reset marker applies. **Delete history** clears them too. The view's `subagentsRunning` counts the agents with a record between a spawn or a step and their turn's end; it is in memory, so a reload starts it over. The band in a subagent's transcript reads the agent's record from memory too.
160
183
 
161
184
  ## Classifier deadline and failure handling
162
185
 
@@ -59,7 +59,7 @@ These are estimate inputs, not an invoice; z.ai plan quota uses its own multipli
59
59
  A weekly GitHub Actions job (`.github/workflows/prices.yml`) runs `npm run prices:check`. It reads the Anthropic, DeepSeek, Kimi, MiniMax and z.ai price pages, compares them with `lib/prices.mjs`, and opens a pull request when a price, a long-context tier or DeepSeek's peak hours change. A page it cannot read opens a "Price check failed" issue. The MiMo page needs a browser, so the job lists it for a person to check. The pull request needs the repository setting **Allow GitHub Actions to create and approve pull requests**, and CI starts on it once a maintainer closes and reopens it. Run the check yourself with `npm run prices:check`; add `-- --write` to rewrite `lib/prices.mjs`. Prices in `router.json` always override the built-in ones.
60
60
  All non-Anthropic built-in presets use `billing: "credits"`.
61
61
  For an included-plan model, set `billing: "plan"` to disable the cold-input cash cap.
62
- `billing` does not change a price: the pane prices plan and credits models alike, at list prices, and labels the plan part `≈ API value` and the credits part billed; see [how dollars are paid](user-guide.md#how-dollars-are-paid).
62
+ `billing` does not change a price: the pane prices plan and credits models at configured API rates (list/custom), labels every total `API estimate` with `≈`, and identifies the mixed credits subtotal as an estimate, not an invoice; see [how dollars are paid](user-guide.md#how-dollars-are-paid).
63
63
  A provider name or URL does not establish its billing product.
64
64
 
65
65
  ### Provider cache behavior
@@ -151,9 +151,17 @@ Default model settings:
151
151
 
152
152
  Prices are configured list-price inputs for estimates. They are not a subscription bill or a claim of savings. Haiku 5.5 lists these prices for prompts up to 100,000 tokens and five times each of them, cache reads and writes included, above that. Its default `longContext` is `{ "above": 100000, "multiplier": 5 }`: a request whose prompt, counting input, cache reads and cache writes, is over `above` tokens is priced at `multiplier` times every rate. Every estimate prices through it. Set `"longContext": null` to remove it, for example when you point the `haiku` alias at another model with `id`. A model with `"efforts": []` receives no effort field. A route in `router.json` without an `effort` takes the effort of that tier's default route. To keep the session effort, clamped to what the model supports, set `"effort": null`, for example `"routes": { "high": { "model": "opus", "effort": null } }`. A 1.3 file whose `low` route had no `effort` kept the session effort; in 1.4 it runs at `high` until you add `"effort": null`.
153
153
 
154
+ `models.<alias>.strength` declares an ordinal policy rank, not a measured quality score. Built-in Claude ranks are
155
+ Haiku 1, Sonnet 2, Opus 3 and Fable 4. Cross-model capability comparisons require both ranks; equal ranks compare
156
+ supported effort. Prices affect economics only, never establish strength. A custom model without a rank stays
157
+ unordered, even when priced. Set explicit ranks in mixed profiles when strength-based continuation/observed upgrades
158
+ should recognize their intended order. An accepted ops work phase may still nominate its explicit debug/code cell
159
+ at unknown order, subject to the existing lateral gates; inherited generic cells get no such exception. Changing a preset alias to another model ID drops its inherited rank unless
160
+ you explicitly provide `strength`; changing its tariff does not. Known `[1m]` context hints retain identity.
161
+
154
162
  ## Activity routing
155
163
 
156
- The classifier also names the activity of a turn: what the turn produces. `activityRouting` decides what the router does with it. [Activity routing](activity-routing.md) explains the defaults for end users.
164
+ The classifier names the task goal separately from its current phase. The existing `activities` matrix still selects routes; a supported command-only phase can select `ops` without changing the goal. For goal `ops`, accepted `reason` selects the same-tier `debug` preference, and `produce` selects `code`, after mode transformation. Unclear/report phase retains an eligible continuation or uses the fresh generic baseline, not a new ops discount. `activityRouting` decides what the router does with it. [Activity routing](activity-routing.md) explains the defaults for end users.
157
165
 
158
166
  | `activityRouting` | Behavior |
159
167
  | ----------------- | ------------------------------------------------------------------------------------------ |
@@ -221,7 +229,7 @@ Switch the mode with `/router activities off|on`, or with the **Activity routing
221
229
 
222
230
  | `classifier` | Endpoint | Request `model` | Key option | `timeoutMs` |
223
231
  | ------------ | -------------------------------------------------------------------------------------------------------- | --------------- | ---------------------- | ----------: |
224
- | `jev` | `https://api.typesafe.ai/v1/systemone` | `jev-1.13.0` | `typesafe_api_key` | `1500` |
232
+ | `jev` | `https://api.typesafe.ai/v1/systemone` | `jev-1.14.0` | `typesafe_api_key` | `1500` |
225
233
  | `clef` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef` | `clef` | `cloudflare_api_token` | `3000` |
226
234
  | `clef-flash` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef-flash` | `clef-flash` | `cloudflare_api_token` | `3000` |
227
235
  | `clef-omni` | `https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/cloudflare/clef-omni` | `clef-omni` | `cloudflare_api_token` | `3000` |
@@ -245,7 +253,7 @@ You can add an entry for another service that speaks one of the three protocols.
245
253
  "jev-proxy": {
246
254
  "label": "Jev",
247
255
  "endpoint": "https://jev-proxy.example.internal/v1/systemone",
248
- "model": "jev-1.13.0",
256
+ "model": "jev-1.14.0",
249
257
  "keyOption": "typesafe_api_key",
250
258
  "timeoutMs": 1500
251
259
  }
@@ -92,9 +92,9 @@ The script writes aggregate counts, reason histograms, route transitions, and sh
92
92
 
93
93
  ## Activity routing
94
94
 
95
- Activity routing has no measured result. The replay above predates it and covers tiers only. It is `on` by default since 1.7, with defaults chosen from Anthropic's published benchmarks and a list-price replay of one developer's sessions; [Activity routing](activity-routing.md#what-the-estimates-mean) gives that replay and its limits. The pane counts turns, requests, switches, and the turns `on` would route differently, with a configured list-price estimate of those turns' next requests, not a measured saving. Two checks look at the classifier's activity label.
95
+ Goal/phase routing has no measured answer-quality or savings result. The activity contract changed from a turn's result to a task goal, so older goal/phase and tool-compatibility counts cannot be compared as one accuracy series. The results below are historical turn-label evidence, not evaluation of the new contract. The replay above predates it and covers tiers only. It is `on` by default since 1.7, with defaults chosen from Anthropic's published benchmarks and a list-price replay of one developer's sessions; [Activity routing](activity-routing.md#what-the-estimates-mean) gives that replay and its limits. The pane counts turns, requests, switches, and the turns `on` would route differently, with a configured list-price estimate of those turns' next requests, not a measured saving. Two checks look at the classifier's activity label.
96
96
 
97
- The figures plan §11 tracks (tool agreement of at least 80% on `code` against `ops` and `explore`, Jev p95 latency of at most 450 ms, at most 1 tool-error escalation in 10 cheaper activity moves, the number of activity switches) are read from the Classifier tab's **ACROSS SESSIONS** block, which shows the counts kept since the last reset: **Code/ops/explore** for the tool agreement on turns the classifier answered `code`, `ops` or `explore`, **Agreement** and **Mismatch** for all of them, **Activity moves** for moves inside a tier taken and refused (a refusal by a hold or the credits cap included), **Escalations** for the tool-error escalations that followed a cheaper activity move in `on` while the turns stayed on its route in `on` (turning routing off, a turn with routing off, or a turn in `off` ends the watch, a pin in between does not, and an escalation the credits cap held counts), **Unpriced** for the routed replies the usage record left out, by cause: no usage in the reply, a model without a configured price, an unknown cache lifetime, or a failed comparison. Before 1.16 those replies were dropped without a count, so usage covered only the priced part of the routed traffic, and a session whose replies were all unpriced left no usage record at all. The active classifier's p95 wait is on its **Deadline** line on the same tab, above that block. Latency is kept in fixed buckets, so the p95 reads as a bound (`≤ 350 ms`); it is the wait for the classifier's answer, transient retries included, without the routing after it, so it compares with the probe's p95 below, and is not recorded with activity routing `off`. `/router` without a UI surface prints both agreements. The underlying counts are the per-session `activity:stats:v1:<session id>` and `activity:metrics:v1:<session id>` records described in [Architecture](architecture.md).
97
+ The figures plan §11 tracks (tool agreement of at least 80% on `code` against `ops` and `explore`, Jev p95 latency of at most 450 ms, at most 1 tool-error escalation in 10 cheaper activity moves, the number of activity switches) are read from the Classifier tab's **ACROSS SESSIONS** block, which shows the counts kept since the last reset: **Code/ops/explore** for the tool agreement on turns the classifier answered `code`, `ops` or `explore`, **Tool compatibility** and **Mismatch** for all of them, **Activity moves** for moves inside a tier taken and refused (a refusal by a hold or the credits cap included), **Escalations** for the tool-error escalations that followed a cheaper activity move in `on` while the turns stayed on its route in `on` (turning routing off, a turn with routing off, or a turn in `off` ends the watch, a pin in between does not, and an escalation the credits cap held counts), **Unpriced** for the routed replies the usage record left out, by cause: no usage in the reply, a model without a configured price, an unknown cache lifetime, or a failed comparison. Before 1.16 those replies were dropped without a count, so usage covered only the priced part of the routed traffic, and a session whose replies were all unpriced left no usage record at all. The active classifier's p95 wait is on its **Deadline** line on the same tab, above that block. Latency is kept in fixed buckets, so the p95 reads as a bound (`≤ 350 ms`); it is the wait for the classifier's answer, transient retries included, without the routing after it, so it compares with the probe's p95 below, and is not recorded with activity routing `off`. `/router` without a UI surface prints both agreements. The underlying counts are the per-session `activity:goals:v1:<session id>` and `activity:metrics:v1:<session id>` records described in [Architecture](architecture.md).
98
98
 
99
99
  ### Tool agreement
100
100
 
@@ -126,7 +126,22 @@ The classifier's activity agrees with the turn when the bucket is one it allows:
126
126
 
127
127
  Before 1.16 a shell write, a check run and any other command were all `ops`. A `code` turn that edited through the shell therefore read as a miss, and so did a review that ran the tests. The finer buckets keep that apart. Because a shell write cannot be told from routine work, it agrees with every activity that may produce it, so it cannot catch a cheap route on shell-written code. Agreement from before 1.16 and after it is not comparable, and a store holding the new buckets reads as empty in an older version. Routing reads `shell` and `check` as `ops`, as before.
128
128
 
129
- Agreement is a weak check. It tells `code` from `ops` and `explore` well, but not `ops` from `explore` when the commands only read. It cannot tell `plan` from `review`, and it says nothing about whether the route was good enough. It does catch the costly mistake, a cheap route on a coding turn. The Classifier tab shows the session's count as `Agreement` under **THIS SESSION**, over the turns where the classifier gave an activity at or above `activityMass`, in `on` too when the route kept another activity. The counts kept across sessions hold the classifier's raw answer, `uncertain` and no answer included, against the bucket. The pane's **ACROSS SESSIONS** block counts agreement over the answers that name an activity; `uncertain` and no answer appear only in **Labelled**.
129
+ Tool compatibility is a weak check, not classification accuracy or a quality score. A task goal can remain `code` while a step only runs tests, and the tool bucket cannot establish the goal. Shell edits, delegated work and unknown tools create additional blind spots. It cannot reliably identify every cheap route on a coding task. The Classifier tab shows the session's count as `Tool compatibility` under **THIS SESSION**, over the turns where the classifier gave an activity at or above `activityMass`, in `on` too when the route kept another activity. The counts kept across sessions hold the classifier's raw answer, `uncertain` and no answer included, against the bucket. The pane's **ACROSS SESSIONS** block counts agreement over the answers that name an activity; `uncertain` and no answer appear only in **Labelled**.
130
+
131
+ ### Goal/phase development checks
132
+
133
+ An earlier 24-case synthetic development pilot separated schema changes from goal-anchor context and compared Jev
134
+ 1.13 with 1.14. A work-account Sonnet label check agreed with the 24 supplied goal/phase references, without seeing
135
+ those labels. This is model agreement under a contract, not human ground truth.
136
+
137
+ A later eight-case check through the production Jev 1.14 adapter returned eight usable goal/phase answers and matched
138
+ seven author reference pairs. The missing-brief case returned goal `uncertain`, phase `reason`, where the reference
139
+ phase was `uncertain`. This development result is retained, not relabeled as a success. Subsequent parser, rubric and
140
+ lifecycle changes mean it is not a benchmark of the final release commit.
141
+
142
+ Run `node --env-file=/path/to/private.env test/goal-phase-live.mjs --live` for a billed synthetic check.
143
+ It is not run in CI and sends no private conversation text. Offline regression tests cover the actual request,
144
+ parser, effective route and hook lifecycle. No paired real-task completion, calibration or savings study was run.
130
145
 
131
146
  ### Activity probe set
132
147
 
@@ -138,7 +153,7 @@ node scripts/probe-activity.mjs [classifier]
138
153
 
139
154
  The script sends each prompt to one classifier as the router would ask it, with activity routing forced to `on`. It reads credentials as `probe-classifier.mjs` does and needs a classifier you can reach. The run is billed on a paid classifier, and it is run by hand, not in CI. It writes accuracy, an expected-by-answered confusion matrix, p50 and p95 latency against the classifier's deadline, and error counts to `experiments/mod-router/results/activity-probe-<classifier>.json`. For Ollama the latency covers both requests. It never prints a key.
140
155
 
141
- Five probe results are checked in, run on 2026-10-09 and 2026-10-10 (UTC) with the synthetic set above: Jev against the live typesafe.ai API, OpenAI against the live Decisions API, Clef and Clef Flash against the live Cloudflare API, Ollama with `qwen3.5:9b` on an Apple M2 Pro laptop:
156
+ Five historical turn-activity probe results are checked in, run on 2026-10-09 and 2026-10-10 (UTC) with the synthetic set above: Jev against the live typesafe.ai API, OpenAI against the live Decisions API, Clef and Clef Flash against the live Cloudflare API, Ollama with `qwen3.5:9b` on an Apple M2 Pro laptop:
142
157
 
143
158
  | Classifier | Correct | p50 latency | p95 latency | Result file |
144
159
  | ---------- | -------: | ----------: | ----------: | ---------------------------------------------------------------------------------------------------- |
@@ -148,7 +163,7 @@ Five probe results are checked in, run on 2026-10-09 and 2026-10-10 (UTC) with t
148
163
  | Clef Flash | 69 of 70 | 470 ms | 874 ms | [`activity-probe-clef-flash.json`](../experiments/mod-router/results/activity-probe-clef-flash.json) |
149
164
  | Ollama | 66 of 70 | 2986 ms | 3483 ms | [`activity-probe-ollama.json`](../experiments/mod-router/results/activity-probe-ollama.json) |
150
165
 
151
- Ollama's latency covers both requests and stays inside its 5000 ms deadline; on slower hardware the activity step is skipped when less than 300 ms remain. They measure the label on synthetic prompts, not routing quality or savings. The activity question costs little time: 30 alternating pairs of the same prompts, with and without it, gave Jev p50 259 ms both ways and p95 300 ms without, 306 ms with; OpenAI p50 163 ms and 162 ms, p95 296 ms and 349 ms. OpenAI's first request of a run took about 2.3 s of its 3000 ms deadline. The Classifier tab shows each result under its classifier, such as `activity probe 70/70 · p95 299 ms · Oct 10` (UTC date), when the classifier runs the probed model. The script regenerates `lib/probe-results.mjs` from the result files after each run; `npm run probe:results` does it alone, and a test fails when the two disagree. A run without a single activity answer (an activity or `uncertain`) or without a p95 latency, such as one with a revoked key or a model whose answers all lack the activity, exits with an error and writes neither file. `policy.activityMass` was not tuned on any classifier; run the probe before you trust it with a new one. Clef Omni has no probe result yet, so its Classifier tab row shows none.
166
+ Ollama's latency covers both requests and stays inside its 5000 ms deadline; on slower hardware the activity step is skipped when less than 300 ms remain. They measured the old turn-activity contract on synthetic prompts, not the new goal/phase contract, routing quality or savings. The activity question costs little time: 30 alternating pairs of the same prompts, with and without it, gave Jev p50 259 ms both ways and p95 300 ms without, 306 ms with; OpenAI p50 163 ms and 162 ms, p95 296 ms and 349 ms. OpenAI's first request of a run took about 2.3 s of its 3000 ms deadline. The Classifier tab shows each result under its classifier, such as `activity probe 70/70 · p95 299 ms · Oct 10` (UTC date), when the classifier runs the probed model. The script regenerates `lib/probe-results.mjs` from the result files after each run; `npm run probe:results` does it alone, and a test fails when the two disagree. A run without a single activity answer (an activity or `uncertain`) or without a p95 latency, such as one with a revoked key or a model whose answers all lack the activity, exits with an error and writes neither file. `policy.activityMass` was not tuned on any classifier; run the probe before you trust it with a new one. Clef Omni has no probe result yet, so its Classifier tab row shows none.
152
167
 
153
168
  ## Routing vs no routing
154
169
 
@@ -34,12 +34,12 @@ Mode belongs to a Claude Code session. Clear starts a new session with routing o
34
34
  The status band is one line above the prompt: a tier meter, the model, the activity, a short reason, classifier support and the switch cost, and context and cache use. Segments drop by priority when the band is narrow: classifier support and the switch cost first, then context and cache, then the activity, then the reason. Hovering reveals a pin per tier, **Turn off**, and a two-row view whose second row shows the plan windows on a Claude plan and the session's cost against no routing; while routing is off, **Turn on** sits on the band itself, so the band carries one routing control at a time. A fresh session that starts with routing off because of its model shows `not a routing tier` on the band until the mode changes. The band yields to surveys. In a subagent's transcript it names the agent's model and who picked it, such as `agent ■ Haiku 5.5 ↓ from Opus 5.5 (Claude Code’s pick)`; without a record of the agent it reads `agent · model chosen at spawn`, or `agent · keeps its own model (subagent routing off)`. A model change between turns raises a toast. A pin, or a step that changes only the effort, such as `medium` to `high` on the defaults, raises none. While the classifier runs, the turn's spinner says `Choosing model`. In Manual mode or when routing is unavailable, the prompt footer carries `routing off` or `routing unavailable`. The **Router** button opens the pane. The pane has five numbered tabs, Now, Routes, Policy, Classifier, and Usage, under one `ROUTER` line with the routing on/off pair and the classifier state. The [user guide](user-guide.md#open-the-router-pane) describes each tab.
35
35
 
36
36
  | Reading | Meaning and limits |
37
- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
37
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
38
38
  | Next turn | The tier meter, the requested model and effort, and, under an activity override, the tier's own route. `! served by … · native fallback` appears only when the engine answered with another model. Actual effort is not reported. |
39
39
  | Classifier support | Per-tier probabilities from the last classification, on each pin; beside **why**, the support for the switch against the bar the policy required, and the switch cost. Pins and skipped calls leave it empty. |
40
40
  | Activity | The classifier's activity choice with its share and the next-best answer, on the Next turn line; `uncertain` shown dim. Empty with routing off, a pin, or no answer. |
41
41
  | Plan (Now) | Claude Code's 5-hour and 7-day plan windows with their reset times, on a Claude plan only. A reset time that has passed is not shown. |
42
- | Session (Now) | This session's total, main thread and subagents, labelled by how it is paid (`≈ API value` on a plan, `billed` otherwise), its difference against no routing and what no routing would cost, the main thread and the subagents as bars, and every main-conversation reply as a strip colored by tier, pairs of cells merging past 48 cells or on a narrow pane. The two-row band and `/router` show the same numbers. |
42
+ | Session (Now) | This session's total, main thread and subagents, labelled `API estimate` with `≈` for every billing product (configured rates, not an invoice or measured quota use), its difference against no routing and what no routing would cost, the main thread and the subagents as bars, and every main-conversation reply as a strip colored by tier, pairs of cells merging past 48 cells or on a narrow pane. The two-row band and `/router` show the same numbers. |
43
43
  | Routing vs no routing (Usage) | For a period (this session, today, 7 or 30 days, this month, or all), one table that adds up: the main thread against the same tokens on your model, the model `/model` selected at the session effort when each reply ran, with its cheaper-model saving, stronger-model cost and cache rebuilds; the subagents against Claude Code's picks; the total against no routing. The running turn's replies are included. `early sample` below 10 replies. Output length is held the same; answer quality is not measured. |
44
44
  | Breakdown (Usage) | The period's replies, cost and difference against no routing by activity, model or tier, each row opening to its routes or activities; the cost per hour, day or week, or **What if**, the same tokens on each model alone; from 20 replies, the cells worth a look, linked to Routes or Policy. |
45
45
  | Across sessions (Classifier) | The counts kept since the last reset: labelled turns, tool agreement on the classifier's raw answer, overall and for `code`, `ops` and `explore`, the two largest mismatches, activity moves inside a tier taken and refused, and escalations after a cheaper activity move. The active classifier's p95 latency shows on its **Deadline** line. `/router` text shows the agreement. |
package/docs/providers.md CHANGED
@@ -317,7 +317,7 @@ Launch on the model you would otherwise use:
317
317
  A launch model must be a model that some route runs. On any other model, a fresh session starts with routing off.
318
318
  To start on another Claude model, such as Sonnet, add it to `models`, put it on a route, and map it in the proxy configuration.
319
319
 
320
- Opus is billed by the plan and DeepSeek in credits, but the pane prices both at list prices, so one sum compares them: `session ≈$24.10 API value billed $4.10 −$45.90 (−66%) vs Opus 5.5`, where `billed $4.10` is the DeepSeek part.
320
+ Opus uses the plan and DeepSeek uses credits, but the pane estimates both at configured API rates (list/custom): `session ≈$24.10 API estimate credits ≈$4.10 −$45.90 (−66%) vs Opus 5.5`. The credits subtotal is a configured-rate estimate, not an invoice or attested gateway charge.
321
321
  See [how dollars are paid](user-guide.md#how-dollars-are-paid).
322
322
 
323
323
  Open `/router` and check the selected file, classifier health and routing state before use.
@@ -25,7 +25,7 @@
25
25
  <text x="765.0" y="56" fill="#87d787" xml:space="preserve">100%</text>
26
26
  <text x="796.2" y="56" fill="#7c7c7c" xml:space="preserve"> last</text>
27
27
  <text x="850.8" y="56" fill="#d0d0d0" xml:space="preserve">Router</text>
28
- <text class="cap" x="20" y="95">Two rows on a Claude plan, with the hover row shown: plan windows, the session as API value against your model, pins</text>
28
+ <text class="cap" x="20" y="95">Two rows on a Claude plan, with the hover row shown: plan windows, the session as a configured-rate API estimate against your model, pins</text>
29
29
  <rect x="12" y="103" width="897.6" height="67" rx="5" fill="#232323"/>
30
30
  <text x="24.0" y="121" fill="#e0708a" xml:space="preserve">▂</text>
31
31
  <text x="31.8" y="121" fill="#e0708a" xml:space="preserve">▄</text>
@@ -52,10 +52,10 @@
52
52
  <text x="281.4" y="140" fill="#87d787" xml:space="preserve">43%</text>
53
53
  <text x="328.2" y="140" fill="#7c7c7c" xml:space="preserve">session </text>
54
54
  <text x="390.6" y="140" fill="#d0d0d0" font-weight="700" xml:space="preserve">≈$6.40</text>
55
- <text x="437.4" y="140" fill="#7c7c7c" xml:space="preserve"> API value</text>
56
- <text x="538.8" y="140" fill="#6fcf97" font-weight="700" xml:space="preserve">−$1.84 (−22%)</text>
57
- <text x="640.2" y="140" fill="#7c7c7c" xml:space="preserve"> vs Opus 5.5</text>
58
- <text x="757.2" y="140" fill="#7c7c7c" xml:space="preserve">64 replies</text>
55
+ <text x="437.4" y="140" fill="#7c7c7c" xml:space="preserve"> API estimate</text>
56
+ <text x="562.2" y="140" fill="#6fcf97" font-weight="700" xml:space="preserve">−$1.84 (−22%)</text>
57
+ <text x="663.6" y="140" fill="#7c7c7c" xml:space="preserve"> vs Opus 5.5</text>
58
+ <text x="780.6" y="140" fill="#7c7c7c" xml:space="preserve">64 replies</text>
59
59
  <text x="24.0" y="159" fill="#7c7c7c" xml:space="preserve">pin </text>
60
60
  <rect x="55.2" y="145" width="140.4" height="18" rx="4" fill="#2e3340"/>
61
61
  <text x="55.2" y="159" fill="#d0d0d0" xml:space="preserve">[ ▂ Haiku·medium ]</text>
@@ -69,7 +69,7 @@
69
69
  <text x="663.6" y="159" fill="#d0d0d0" xml:space="preserve">[ Turn off ]</text>
70
70
  <rect x="772.8" y="145" width="70.2" height="18" rx="4" fill="#2e3340"/>
71
71
  <text x="772.8" y="159" fill="#d0d0d0" xml:space="preserve">[ 1 row ]</text>
72
- <text class="cap" x="20" y="198">Two rows on an API key: the session as billed against your model</text>
72
+ <text class="cap" x="20" y="198">Two rows on an API key: the session as a configured-rate API estimate, not an invoice, against your model</text>
73
73
  <rect x="12" y="206" width="897.6" height="48" rx="5" fill="#232323"/>
74
74
  <text x="24.0" y="224" fill="#e0708a" xml:space="preserve">▂</text>
75
75
  <text x="31.8" y="224" fill="#e0708a" xml:space="preserve">▄</text>
@@ -88,11 +88,11 @@
88
88
  <text x="796.2" y="224" fill="#7c7c7c" xml:space="preserve"> last</text>
89
89
  <text x="850.8" y="224" fill="#d0d0d0" xml:space="preserve">Router</text>
90
90
  <text x="24.0" y="243" fill="#7c7c7c" xml:space="preserve">session </text>
91
- <text x="86.4" y="243" fill="#d0d0d0" font-weight="700" xml:space="preserve">$6.40</text>
92
- <text x="125.4" y="243" fill="#7c7c7c" xml:space="preserve"> billed</text>
93
- <text x="203.4" y="243" fill="#6fcf97" font-weight="700" xml:space="preserve">−$1.84 (−22%)</text>
94
- <text x="304.8" y="243" fill="#7c7c7c" xml:space="preserve"> vs Opus 5.5</text>
95
- <text x="421.8" y="243" fill="#7c7c7c" xml:space="preserve">64 replies</text>
91
+ <text x="86.4" y="243" fill="#d0d0d0" font-weight="700" xml:space="preserve">≈$6.40</text>
92
+ <text x="133.2" y="243" fill="#7c7c7c" xml:space="preserve"> API estimate</text>
93
+ <text x="258.0" y="243" fill="#6fcf97" font-weight="700" xml:space="preserve">−$1.84 (−22%)</text>
94
+ <text x="359.4" y="243" fill="#7c7c7c" xml:space="preserve"> vs Opus 5.5</text>
95
+ <text x="476.4" y="243" fill="#7c7c7c" xml:space="preserve">64 replies</text>
96
96
  <text class="cap" x="20" y="282">A pin waits for the next turn; ✕ cancels it</text>
97
97
  <rect x="12" y="290" width="897.6" height="29" rx="5" fill="#232323"/>
98
98
  <text x="24.0" y="308" fill="#5f9fe0" xml:space="preserve">▂</text>