@alexeiled/claude-router 1.5.0 → 1.6.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.
@@ -9,7 +9,7 @@ claude plugin marketplace add alexei-led/claude-router
9
9
  claude plugin install router@alexei-led-claude-router
10
10
  ```
11
11
 
12
- Start with the full baseline model so Auto mode has a known starting point:
12
+ Start with the full baseline model so routing has a known starting point:
13
13
 
14
14
  ```sh
15
15
  claude --model claude-haiku-5-5
@@ -24,37 +24,37 @@ In Claude Code:
24
24
  - **OpenAI**: an OpenAI API key. The prompt text goes to OpenAI.
25
25
  - **Ollama**: no credential. Run `ollama serve` and pull the model; the prompt text stays on this machine.
26
26
  3. To use another classifier, open the pane's **Classifier** tab and select its row. See [Choose the classifier](#choose-the-classifier).
27
- 4. Check the band above the prompt: `▂▄▆█ Auto · ready`. On a model that no tier routes to, the session starts in Manual; run `/router auto` to route.
27
+ 4. Check the band above the prompt: `Routing on · ready`. On a model that no tier routes to, the session starts with routing off and the band says why; run `/router auto` to route.
28
28
 
29
29
  Keys are stored as sensitive plugin options. Do not paste them into a model conversation. The [configuration guide](configuration.md) covers optional settings and migrations.
30
30
 
31
31
  ## Read the status band
32
32
 
33
- Router draws one line above the prompt. The line ends with a **Router** button that opens the pane. When the band is narrow, the less important parts drop first: classifier figures, then context and cache, then the reason. The tier and model always stay, except behind a classifier warning: the warning and its **Set up** button come first, and the route gives way to them.
33
+ Router draws one line above the prompt. The line ends with a **Router** button that opens the pane. When the band is narrow, the less important parts drop first: classifier figures, then context and cache, then the activity, then the reason. The tier and model always stay, except behind a classifier warning: the warning and its **Set up** button come first, and the route gives way to them.
34
34
 
35
- ![Five band states: routed to high, two rows with the hover row, a pending pin, a missing classifier key, and Manual mode](router-band.svg)
35
+ ![Seven band states: routed to high, two rows with the hover row, a pending pin, a missing classifier key, routing off, an activity move with activity routing on, and an activity label in shadow](router-band.svg)
36
36
 
37
37
  Read the first line of the picture from left to right:
38
38
 
39
39
  - **Tier meter** `▂▄▆█`: one bar per tier, lit up to the current tier in its color, like signal strength.
40
- - **Tier and model**: the route for this turn. **fallback** means Claude Code answered with another model.
41
- - **Reason**: one or two words with a direction, such as `↑ jump`, `↓ downgrade`, `= fits`, or `… waiting to go down`.
40
+ - **Tier, activity, and model**: the route for this turn. The activity, such as `code →`, sits between the tier and the model; see [Route by activity](#route-by-activity). **fallback** means Claude Code answered with another model.
41
+ - **Reason**: one or two words with a direction, such as `↑ jump`, `↓ downgrade`, `= fits`, or `… waiting to go down`. An activity move reads `↗ code` or `↘ ops`, and a refused one `… ops: not worth a switch`.
42
42
  - **Classifier support**: what the active classifier, such as Jev or Clef Flash, gave the switch against the bar the policy required.
43
43
  - **ctx** and **cache**: context use and cache reuse on the last reply. They turn yellow at 60% context and red at 80%.
44
44
 
45
- | Band shows | Meaning |
46
- | ------------------------------------------- | ------------------------------------------------------------------------------------- |
47
- | `Auto · ready` | Auto mode is ready for a new turn. |
48
- | `choosing for this turn…` | The classifier and local policy are running. The spinner says `Choosing model`. |
49
- | `⏵ next turn: high ✕` | A pin is set. **✕** cancels it. |
50
- | `⚠ Jev: no API key · keeping model` | The active classifier lacks a setting. **Set up** opens the secure plugin dialog. |
51
- | `⚠ Clef: no account ID · keeping model` | Clef has its API token but no Cloudflare account ID. **Set up** opens the dialog. |
52
- | `⚠ Jev timed out · keeping model` | The classifier failed: timed out, unreachable, rejected the key, or paused. |
53
- | `○ Router off · keeping …` | Manual mode. **Auto** resumes routing. The footer also shows `router off`. |
54
- | `✕ Router unavailable` | Nothing routes: an old Claude Code or leftover v0.8 settings. **Fix** opens the pane. |
55
- | `○ Router · subagents keep their own model` | You are viewing a subagent's transcript, which Router does not route. |
45
+ | Band shows | Meaning |
46
+ | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
47
+ | `Routing on · ready` | Routing is on and ready for a new turn. |
48
+ | `choosing for this turn…` | The classifier and local policy are running. The spinner says `Choosing model`. |
49
+ | `⏵ next turn: high ✕` | A pin is set. **✕** cancels it. |
50
+ | `⚠ Jev: no API key · keeping model` | The active classifier lacks a setting. **Set up** opens the secure plugin dialog. |
51
+ | `⚠ Clef: no account ID · keeping model` | Clef has its API token but no Cloudflare account ID. **Set up** opens the dialog. |
52
+ | `⚠ Jev timed out · keeping model` | The classifier failed: timed out, unreachable, rejected the key, or paused. |
53
+ | `○ Routing off · every turn uses …` | Routing is off: Claude's model answers every turn. **Routing on** turns it back on. The footer also shows `routing off`. |
54
+ | `✕ Routing unavailable` | Nothing routes: an old Claude Code or leftover v0.8 settings. **Fix** opens the pane. |
55
+ | `○ Router · subagents keep their own model` | You are viewing a subagent's transcript, which Router does not route. |
56
56
 
57
- Hover over the band for a second row: pin a tier for the next turn, switch to Manual, or show two rows. The two-row band adds a strip of recent replies colored by tier, the switch count, the switch tax, and the cache saving. Router remembers that choice across sessions. When Router changes the model between turns, a toast shows the old and new model and the reason. A pin does not raise one, and neither does a change of effort alone.
57
+ The band's **Routing off** button turns routing off, and **Routing on** turns it back on. Hover over the band for a second row: pin a tier for the next turn, or show two rows. The two-row band adds a strip of recent replies colored by tier, the switch count, the switch tax, and the cache saving. Router remembers that choice across sessions. When Router changes the model between turns, a toast reads `Model changed: old → new · reason`. A pin does not raise one, and neither does a change of effort alone.
58
58
 
59
59
  The band steps aside while a survey needs the space.
60
60
 
@@ -64,22 +64,22 @@ Tool continuations do not trigger another classification. Subagent choices remai
64
64
 
65
65
  Run `/router` or select **Router** above the prompt. Without a UI surface, as in `claude -p`, `/router` prints a short status instead. The pane has four tabs. Select a tab or press its digit while the pane has focus.
66
66
 
67
- ![The Now tab: the route and reason, classifier support per tier with pin buttons, recent replies by tier, and context, cache and cost](router-pane-now.svg)
67
+ ![The Now tab: the route, the activity and its alternatives, the reason, classifier support per tier with pin buttons, recent replies by tier and activity, and context, cache and cost](router-pane-now.svg)
68
68
 
69
- The **Now** tab answers "what runs next turn, and why". The ladder lists the tiers from strongest to cheapest with the route each one uses. The bar is the support the classifier gave that tier on the last turn. The line under the ladder compares the support for a switch with the bar the policy required and shows the estimated switch tax. **pin** forces that tier for the next turn only.
69
+ The **Now** tab answers "what runs next turn, and why". The ladder lists the tiers from strongest to cheapest with the route each one uses. The bar is the support the classifier gave that tier on the last turn. The line under the ladder compares the support for a switch with the bar the policy required and shows the estimated switch tax. **pin** forces that tier for the next turn only. The **Activity** and **Route** lines under the route are covered in [Route by activity](#route-by-activity).
70
70
 
71
- ![The Routing tab: model and effort per tier, the baseline tier, how each step up is priced, the policy controls, and the unsaved router.json change with Save and Discard](router-pane-routing.svg)
71
+ ![The Routing tab: model and effort per tier, the baseline tier, how each step up is priced, the activity matrix and overrides, the policy controls, and the unsaved router.json changes with Save and Discard](router-pane-routing.svg)
72
72
 
73
- The **Routing** tab edits the routes and the policy. In the picture, `medium` was changed to Sonnet 5.5 at `xhigh`: the tier shows **●**, the tab reads **Routing ●**, the switch-cost lines now price `medium → high` as a model change, and the status bar lists the one `router.json` line that **Save** will write. [Edit routes and policy](#edit-routes-and-policy) explains the controls.
73
+ The **Routing** tab edits the routes, the activity overrides, and the policy. In the picture, `medium` was changed to Sonnet 5.5 at `xhigh`: the tier shows **●**, the tab reads **Routing ●**, the switch-cost lines now price `medium → high` as a model change, and the status bar lists the `router.json` lines that **Save** will write. The same picture shows the activity matrix and overrides, with a `code` override at `high` added. [Edit routes and policy](#edit-routes-and-policy) explains the controls.
74
74
 
75
- | Tab | What it shows |
76
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
- | 1 Now | The current tier, model, and reason; the classifier's support for each tier with a **pin** button; the last 30 replies by tier; context and cache. |
78
- | 2 Routing | The model and effort for each tier, the baseline tier, the cache cost of each step up; downgrade votes, payback horizon, and credits cap; the `router.json` path. |
79
- | 3 Classifier | The classifier rows with their credentials state, the active classifier's deadline and health, and the credentials each classifier needs. |
80
- | 4 Usage | Claude-reported cost, context and cache detail, input per reply, quota, and configured-price estimates. |
75
+ | Tab | What it shows |
76
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
+ | 1 Now | The current tier, model, activity, and reason; the classifier's support for each tier with a **pin** button; the last 30 replies by tier and activity; context and cache. |
78
+ | 2 Routing | The model and effort for each tier, the baseline tier, the cache cost of each step up; the activity matrix and overrides; downgrade votes, payback horizon, and credits cap; the `router.json` path. |
79
+ | 3 Classifier | The classifier rows with their credentials state, the active classifier's deadline and health, and the credentials each classifier needs. |
80
+ | 4 Usage | Claude-reported cost, context and cache detail, input per reply, quota, activity counts for this session, and configured-price estimates. |
81
81
 
82
- **Auto** and **Manual** stay at the top of every tab. **?** shows what the estimates leave out.
82
+ **Routing on** and **Routing off** stay at the top of every tab. **?** shows what the estimates leave out.
83
83
 
84
84
  ### Save and undo changes
85
85
 
@@ -96,7 +96,7 @@ Every write applies from the next turn and can be undone. **Undo** (`u`) puts ba
96
96
  - **Context** compares the larger available context reading with the routed model's configured window. The router reserves 20% of that window. Values can be unknown when Claude does not provide the needed estimate.
97
97
  - **Cache** reuse is cache-read tokens divided by the last response's input counters.
98
98
  - **Classifier support**, such as **Jev support**, is the probability the classifier gave each tier on the last classified turn. The line under it compares the support for a switch with the bar the policy required, and shows the estimated switch tax.
99
- - **Replies** colors each of the last 30 main-conversation replies by the tier that served it. A dot marks a reply the router did not choose, such as one in Manual mode.
99
+ - **Replies** colors each of the last 30 main-conversation replies by the tier that served it. A dot marks a reply the router did not choose, such as one with routing off. When activity routing is on or in shadow, a row of letters under the strip names each reply's activity: `c` code, `d` debug, `e` explore, `p` plan, `r` review, `o` ops, `w` docs.
100
100
  - **Input per reply** scales the last 30 input sizes from the lowest to the highest reading. It is a scale comparison, not a forecast.
101
101
  - **Cache read benefit** is a configured-price estimate for cached reads before write costs. It is not a measured saving.
102
102
  - **Next-turn difference** compares the candidate with the current model under five-minute and one-hour cache-write scenarios. A negative number means the candidate is estimated to cost less for that request.
@@ -104,25 +104,71 @@ Every write applies from the next turn and can be undone. **Undo** (`u`) puts ba
104
104
 
105
105
  There is no router-side spend or savings ledger. The pane does not include classifier charges. Claude's native `/cost` is the source for its reported API cost.
106
106
 
107
+ ## Route by activity
108
+
109
+ A tier says how hard the work is. The activity says what kind of work it is. The classifier names it for each new turn, by what the turn produces:
110
+
111
+ | Activity | The turn produces |
112
+ | --------- | --------------------------------------------------------------- |
113
+ | `code` | Changed code or config, including tests |
114
+ | `debug` | A found cause: failing tests, stack traces, "why does X..." |
115
+ | `explore` | An answer: explain code, find where something happens, research |
116
+ | `plan` | A decision or plan: design, task breakdown, trade-offs |
117
+ | `review` | Findings about existing code: a PR, a diff, an audit |
118
+ | `ops` | Executed commands: git, builds, test runs, CI, deploys |
119
+ | `docs` | Prose for people: README, docs, comments, commit messages |
120
+
121
+ A mixed turn such as "fix it and commit" takes the hardest part, here `code`. The router then picks the route by tier and activity. With activity routing on and the default overrides, a `low` coding turn runs on Sonnet 5.5 at `medium`, while a `low` git turn stays on Haiku 5.5 at `high`. [Configuration](configuration.md#activity-routing) has the full matrix and how to change it.
122
+
123
+ The mode decides what happens with the label:
124
+
125
+ | Mode | What the router does |
126
+ | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
127
+ | `off` | Asks nothing new. The routes are the tier routes. |
128
+ | `shadow` | The default. Shows the activity, records the stats, and works out what `on` would run. The tier route still runs; nothing changes. |
129
+ | `on` | Applies the activity overrides. This is opt-in: run `/router activities on`. |
130
+
131
+ In `shadow` you can see what `on` would do before you switch it on. The band marks the label `(shadow)` and dims it, and the **Now** tab says `low + code would use Sonnet 5.5 · medium (shadow; using Haiku 5.5 · high)`, or `same route` when both agree. In `on` the **Now** tab reads `low + code → Sonnet 5.5 · medium (override)` with the tier's base route next to it, or `(base)` when the cell has no override.
132
+
133
+ How the router moves inside a tier:
134
+
135
+ - It compares routes, not labels. If the new activity resolves to the route already running, nothing switches.
136
+ - A move to a stronger route needs the classifier's support, as an upgrade between tiers does. A move to a cheaper one must pay back its cache write within the payback horizon. One vote is enough for either, because the activity is a fact about this turn.
137
+ - An activity applies only when the classifier gives it at least 60% probability (`policy.activityMass`). Below that, or on `uncertain`, the turn goes back to its tier's route, if the move passes the same checks. Tool continuations inside a turn keep the turn's route. When the classifier sees a new prompt as a continuation of the task, the activity may only move to a stronger route: `explore` can become `code`, but not the other way. Ollama does not answer the continuation question, so this rule does not apply to it.
138
+ - A pinned turn uses the pin's tier route and shows no activity.
139
+ - When the classifier gives no answer at all (a timeout, a failure, a pause, or a missing key), the running route stays. When it answers the tier but gives no usable activity, only the running activity stays: the tier answer still applies, so the turn can change tier and keeps its activity there. In `shadow` and `off` the tier route always runs, as in 1.5.
140
+ - A fresh session starts with routing on when the session model is a tier's route. With activity routing `on`, a model that only an activity override uses also counts: Sonnet 5.5 on the defaults. In `off` and `shadow` it does not.
141
+
142
+ The band's activity label appears only when the activity applies, so a weak or `uncertain` answer shows none. The two-row band and the **Replies** strip show the activities of recent replies.
143
+
144
+ ### Read the activity on the pane
145
+
146
+ - **Now**: the **Activity** line names the classifier's choice with its share and the two next-best answers, such as `code 84% debug 8% · plan 5%`. The **Route** line shows the route the cell resolves to. **Replies** has a letter row under the strip.
147
+ - **Routing**: the **ACTIVITIES** matrix shows the effective routes per tier, with `·` where a cell uses the tier's route, and counts the distinct routes, because each is its own cache. **OVERRIDES** lists each override with a model, an effort, and **remove**, plus a selector to add one and the mode selector. Edits join the routing draft: **Save** and **Discard** apply as for routes. Yellow notes flag an override with no effect (`same as base`), one stronger than the tier above, and one that adds a cache.
148
+ - **Usage**: **ACTIVITY · this session** lists turns, requests, and share per activity, the switches split by tier and by activity, and **Agreement**, how often the tools a turn used fit the classifier's activity (see [Evaluation](evaluation.md#tool-agreement)). In `shadow` the **Shadow** line counts how many turns `on` would have routed differently. **Reset activity stats** clears the session counts and the counts kept across sessions. These are counts, not dollar figures.
149
+
150
+ `/router` without a UI surface adds an `Activity: ops (81%)` line and the resolved route.
151
+
107
152
  ## Change routing
108
153
 
109
- | Command or action | Result |
110
- | ---------------------------------------- | --------------------------------------------------------------------------- |
111
- | `/router` | Open the pane. |
112
- | `/router auto` | Resume automatic routing. |
113
- | `/router off` | Enter Manual mode and preserve Claude's selected model. |
114
- | `/router pin <micro\|low\|medium\|high>` | Pin the next turn and its tool continuations. Auto must already be enabled. |
115
- | `/model <name>` | Select a model and enter Manual mode. Use `/router auto` to resume. |
116
- | **Auto** / **Manual** | The same as `/router auto` and `/router off`. |
117
- | **pin** on the Now tab | Pin that tier for the next turn. Auto must already be enabled. |
154
+ | Command or action | Result |
155
+ | ---------------------------------------- | --------------------------------------------------------------------------------------------------------- |
156
+ | `/router` | Open the pane. |
157
+ | `/router auto` | Resume automatic routing. |
158
+ | `/router off` | Turn routing off and keep Claude's selected model. |
159
+ | `/router pin <micro\|low\|medium\|high>` | Pin the next turn and its tool continuations. Routing on must already be enabled. |
160
+ | `/router activities <off\|shadow\|on>` | Set the [activity routing](#route-by-activity) mode. Saved to `router.json` at once; **Undo** reverts it. |
161
+ | `/model <name>` | Select a model and turn routing off. Use `/router auto` to turn it back on. |
162
+ | **Routing on** / **Routing off** | The same as `/router auto` and `/router off`. |
163
+ | **pin** on the Now tab | Pin that tier for the next turn. Routing on must already be enabled. |
118
164
 
119
- A pin does not change the next turn after the pinned turn finishes. A fresh session on a model that one of the tiers routes to starts in Auto. A fresh session on any other model starts in Manual. `/clear` starts the new session in Auto. Resuming a saved session restores its saved Auto or Manual mode.
165
+ A pin does not change the next turn after the pinned turn finishes. A fresh session on a model that one of the tiers routes to starts with routing on. A fresh session on any other model starts with routing off. `/clear` starts the new session with routing on. Resuming a saved session restores its saved routing on or off.
120
166
 
121
167
  ## Edit routes and policy
122
168
 
123
169
  On the **Routing** tab, pick a model and an effort for any tier. The model list comes from the aliases in `router.json` `models`, limited by the `availableModels` setting. `session` keeps the effort Claude Code sends. A model without effort levels, such as a custom one with `"efforts": []`, shows `none`.
124
170
 
125
- Changed tiers show **●**. **Reset routes to defaults** (`r`) loads the built-in routes into the draft; **Save** then removes your route overrides from `router.json`.
171
+ Changed tiers and overrides show **●**. **Reset routes to defaults** (`r`) loads the built-in routes into the draft; **Save** then removes your route overrides from `router.json`.
126
172
 
127
173
  **Switch cost** reads the draft from the bottom tier up and shows how the policy prices each step. A model change is priced as a cold cache write. An effort change on the same model is also priced as a new messages cache; whether the API actually keeps the cache across an effort change is not measured. Two identical tiers make that step change nothing.
128
174
 
@@ -132,7 +178,7 @@ A new model ID needs an entry in `router.json` `models` with its price, context
132
178
 
133
179
  Under **Policy** on the same tab, pick the values. One **Save** writes them with any route changes:
134
180
 
135
- - **Votes to go down:** 1, 2, or 3 consecutive votes before a cheaper tier.
181
+ - **Votes to go down:** 1, 2, or 3 consecutive votes before a cheaper tier. A new or reset history needs one.
136
182
  - **Payback horizon:** 1, 3, 5, or 10 later turns used by the downgrade estimate.
137
183
  - **Credits cap:** $0.50, $1, $2, or $5 for an estimated cold cache write on a `credits` model.
138
184
 
@@ -160,7 +206,7 @@ Select a row to switch. The choice is written to `router.json` at once and appli
160
206
  - **Health** shows recent failures or a pause. **Sends** names the service that receives prompt text.
161
207
  - **Credentials** lists what each classifier needs, such as `Jev: API key · Clef, Clef Flash: API token, account ID · OpenAI: API key · Ollama: no key needed`. **Edit** opens Claude Code's secure plugin configuration, where you enter them.
162
208
 
163
- **Sends** names the service that receives the prompt and recent dialogue. With Clef or Clef Flash that is Cloudflare, not typesafe.ai; with OpenAI it is OpenAI; with Ollama it stays on this machine. Give the Cloudflare token Workers AI permissions only.
209
+ With `shadow` or `on`, the activity question goes in the same request as the tier question (Ollama makes a second call), with the same text and nothing more. **Sends** names the service that receives the prompt and recent dialogue. With Clef or Clef Flash that is Cloudflare, not typesafe.ai; with OpenAI it is OpenAI; with Ollama it stays on this machine. Give the Cloudflare token Workers AI permissions only.
164
210
 
165
211
  The routing policy thresholds were tuned against Jev's probabilities. Clef's, OpenAI's, and Ollama's probabilities have not been compared with Jev's, so the same prompt can switch tiers at a different point. Watch **Classifier support** for a few sessions before you rely on a new classifier.
166
212
 
@@ -198,7 +244,7 @@ To stop routing for a session, run `/router off`. To stop loading the Mod, run `
198
244
  | Status says `no API key` or `no API token` | The active classifier's plugin option is unset or unavailable to this process. | Select **Set up** in the pane, or run `/plugin configure router`. Save the option and start a new turn. |
199
245
  | Status says `no account ID` | Clef or Clef Flash is active without the Cloudflare account ID. | Run `/plugin configure router` and save the Cloudflare account ID. |
200
246
  | Route stays on the current model | The classifier timed out, failed, is paused, or network policy refused it. | Read the status band and the pane header. Network policy refusal is not bypassed. |
201
- | `/model` changed but routing stopped | Choosing a model enters Manual mode. | Run `/router auto` to resume automatic routing. |
247
+ | `/model` changed but routing stopped | Choosing a model turns routing off. | Run `/router auto` to turn routing back on. |
202
248
  | Router reports invalid configuration | `router.json` is invalid, or project/local settings redirect the router profile. | Inspect `router.json`, remove project/local `HOME` or `CLAUDE_CONFIG_DIR` overrides, or run the [migration command](configuration.md#convert-an-older-routerjson). |
203
249
  | Router says old settings need migration | `router.json` still contains v0.8 gateway keys or the 1.1 `jev` section. | Run the [migration command](configuration.md#convert-an-older-routerjson). |
204
250
  | `⚠ OpenAI rejected the key · keeping model` | The OpenAI key is wrong, revoked, or lacks access to `gpt-6-luna`. | Run `/plugin configure router` and save a valid OpenAI API key. |