@weave-os/router 0.2.36 → 0.2.37

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.
Files changed (37) hide show
  1. package/bin.js +1 -1
  2. package/cc-statusline.sh +58 -11
  3. package/codex-skills/fm/SKILL.md +2 -1
  4. package/codex-skills/force-model/SKILL.md +2 -1
  5. package/codex-skills/list-models/SKILL.md +28 -0
  6. package/codex-skills/rf/SKILL.md +2 -1
  7. package/codex-skills/router-feedback/SKILL.md +2 -1
  8. package/codex-skills/router-models/SKILL.md +1 -1
  9. package/codex-skills/ufm/SKILL.md +2 -1
  10. package/codex-skills/unforce-model/SKILL.md +2 -1
  11. package/codex-status.sh +95 -3
  12. package/commands/list-models.md +5 -0
  13. package/commands/models.md +1 -1
  14. package/commands/router-models.md +1 -1
  15. package/directives.tsv +1 -0
  16. package/install.sh +317 -79
  17. package/package.json +2 -1
  18. package/pi-router/README.md +7 -2
  19. package/pi-router/src/auto-model.ts +118 -0
  20. package/pi-router/src/config.ts +34 -28
  21. package/pi-router/src/dispatch.ts +2 -2
  22. package/pi-router/src/index.ts +5 -1
  23. package/pi-router/src/pricing.generated.ts +7 -2
  24. package/pi-router/src/routed-model.ts +5 -4
  25. package/skills/build/SKILL.md +71 -0
  26. package/skills/build/agents/build-implementer.md +13 -0
  27. package/skills/build/agents/build-researcher.md +11 -0
  28. package/skills/build/agents/build-reviewer.md +13 -0
  29. package/skills/build/agents/build-verifier.md +13 -0
  30. package/skills/build/references/client-controls.md +34 -0
  31. package/skills/build/references/pr-loop.md +10 -0
  32. package/skills/build/references/research-and-interview.md +24 -0
  33. package/skills/build/references/verification-and-review.md +20 -0
  34. package/skills/build/references/worker-contracts.md +71 -0
  35. package/skills/build/scripts/pin-coordinator.sh +3 -0
  36. package/uninstall.sh +53 -3
  37. package/windows.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weave-os/router",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "description": "One-command installer that points Claude Code, Codex, opencode, or pi at the Weave Router. For pi it also ships the routing extension, loaded via pi.extensions.",
5
5
  "bin": {
6
6
  "weave-router": "bin.js",
@@ -27,6 +27,7 @@
27
27
  "directives.tsv",
28
28
  "commands/",
29
29
  "codex-skills/",
30
+ "skills/",
30
31
  "pi-router/",
31
32
  "README.md",
32
33
  "LICENSE",
@@ -29,7 +29,13 @@ Plain `pi` then connects to the installed endpoint, normally
29
29
  session. Wooly is visual only: there is no
30
30
  dialogue box, narration, coaching request, or separate Loom runtime.
31
31
  - **Automatic model selection.** All pi traffic flows through the router, which
32
- selects the model per request. You don't pick a model — the router does.
32
+ selects the model per request from the models your organization has enabled.
33
+ pi's `/model` picker shows one entry, `weave/auto` ("Weave Router"); the
34
+ status line shows which model served each response. A session or saved
35
+ default on a per-model `weave/…` entry from an older release moves to
36
+ `weave/auto` on start. `weave/auto` requests carry `claude-sonnet-4-6`,
37
+ the default earlier installs selected, as the requested model; the router
38
+ routes them, and session savings are priced against that model.
33
39
  - **Force-model commands.** `/fm <model>` and `/force-model <model>` pin the
34
40
  current router session; `/ufm` and `/unforce-model` resume automatic routing.
35
41
  The status records `last pin: <model>` alongside response attribution after
@@ -92,7 +98,6 @@ Plain `pi` then connects to the installed endpoint, normally
92
98
  | `WEAVE_ROUTER_KEY` | — | Router key (else read from `.weave_router_key`) |
93
99
  | `WEAVE_ROUTER_KEY_FILE` | `<agentDir>/.weave_router_key` | Override key file path |
94
100
  | `WEAVE_USER_EMAIL` / `WEAVE_USER_NAME` | from `git config` | Identity headers for attribution |
95
- | `WEAVE_PI_SUBAGENT_MODEL` | `claude-sonnet-4-6` | `weave/<model>` handle children launch with (router re-routes) |
96
101
  | `WEAVE_PI_DISPATCH_CONCURRENCY` | `4` | Max concurrent subagents |
97
102
  | `WEAVE_PI_SUBAGENT_TIMEOUT_MS` | `600000` | Per-subagent timeout |
98
103
  | `WEAVE_PI_ALLOW_SUBAGENT_TOOLS` | unset | `1` lets `dispatch` grant subagents write/exec tools (bash, write, edit); default strips them |
@@ -0,0 +1,118 @@
1
+ /**
2
+ * The `weave/auto` picker entry: what goes on the wire for it, and moving
3
+ * installs off the per-model entries earlier releases registered.
4
+ *
5
+ * Pi derives a request's `model` from the selected entry's id, so an `auto`
6
+ * request is rewritten to the model installs defaulted to before `auto`. The
7
+ * router, escalation handoff tokens and session state therefore see the same
8
+ * requested model as before.
9
+ */
10
+
11
+ import * as fs from "node:fs";
12
+ import * as path from "node:path";
13
+ import type { ExtensionAPI, ExtensionContext, SessionEntry } from "@mariozechner/pi-coding-agent";
14
+ import { getAgentDir, isSubagent, PROVIDER_NAME, WEAVE_AUTO_MODEL_ID, wireModelId } from "./config.js";
15
+
16
+ /** Rewrite an `auto` request body's model to its wire id. Returns undefined when unchanged. */
17
+ export function rewriteAutoPayload(payload: unknown): Record<string, unknown> | undefined {
18
+ if (payload === null || typeof payload !== "object" || Array.isArray(payload)) return undefined;
19
+ const body = payload as Record<string, unknown>;
20
+ if (typeof body.model !== "string") return undefined;
21
+ const model = wireModelId(body.model);
22
+ return model === body.model ? undefined : { ...body, model };
23
+ }
24
+
25
+ interface SavedDefault {
26
+ provider?: string;
27
+ model?: string;
28
+ }
29
+
30
+ function readSettings(file: string): Record<string, unknown> | undefined {
31
+ try {
32
+ const parsed: unknown = JSON.parse(fs.readFileSync(file, "utf-8"));
33
+ return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : undefined;
34
+ } catch {
35
+ return undefined;
36
+ }
37
+ }
38
+
39
+ function savedDefault(settings: Record<string, unknown> | undefined): SavedDefault {
40
+ const { defaultProvider, defaultModel } = settings ?? {};
41
+ return {
42
+ ...(typeof defaultProvider === "string" ? { provider: defaultProvider } : {}),
43
+ ...(typeof defaultModel === "string" ? { model: defaultModel } : {}),
44
+ };
45
+ }
46
+
47
+ function settingsFiles(cwd: string) {
48
+ return [path.join(getAgentDir(), "settings.json"), path.join(cwd, ".pi", "settings.json")];
49
+ }
50
+
51
+ /** True when a session or saved default names a weave model this release no longer registers. */
52
+ export function isRetiredWeaveModel(provider: string | undefined, model: string | undefined): boolean {
53
+ return provider === PROVIDER_NAME && model !== WEAVE_AUTO_MODEL_ID;
54
+ }
55
+
56
+ /**
57
+ * Point a saved default that resolves to a retired weave model at weave/auto,
58
+ * and return the default as it stood. Pi merges project settings over global
59
+ * ones per field and falls back from such a default to whatever else is
60
+ * authenticated, which can silently stop routing on every start. Only the
61
+ * file supplying `defaultModel` changes; Pi's own writes merge per field.
62
+ */
63
+ export function migrateSavedDefaults(cwd: string): SavedDefault {
64
+ const files = settingsFiles(cwd).map((file) => ({ file, settings: readSettings(file) }));
65
+ const merged = files.reduce<SavedDefault>((acc, { settings }) => ({ ...acc, ...savedDefault(settings) }), {});
66
+ if (!isRetiredWeaveModel(merged.provider, merged.model)) return merged;
67
+ const source = [...files].reverse().find(({ settings }) => typeof settings?.defaultModel === "string");
68
+ if (!source) return merged;
69
+ try {
70
+ fs.writeFileSync(source.file, `${JSON.stringify({ ...source.settings, defaultModel: WEAVE_AUTO_MODEL_ID }, null, 2)}\n`);
71
+ } catch {
72
+ /* unwritable settings: the session itself still moves to weave/auto */
73
+ }
74
+ return merged;
75
+ }
76
+
77
+ /** The model a resumed conversation last used, read the way Pi restores it. */
78
+ function conversationModel(entries: SessionEntry[]): SavedDefault | undefined {
79
+ if (!entries.some((entry) => entry.type === "message")) return undefined;
80
+ let model: SavedDefault = {};
81
+ for (const entry of entries) {
82
+ if (entry.type === "model_change") model = { provider: entry.provider, model: entry.modelId };
83
+ else if (entry.type === "message" && entry.message.role === "assistant") model = { provider: entry.message.provider, model: entry.message.model };
84
+ }
85
+ return model;
86
+ }
87
+
88
+ const LAUNCH_MODEL_FLAGS = new Set(["--model", "--provider", "--models"]);
89
+
90
+ /**
91
+ * Whether to select weave/auto at start: the active model is a retired weave
92
+ * entry, or Pi fell back to another provider only because the resumed
93
+ * conversation or saved default named one. Launch flags and a model scope
94
+ * without weave/auto are explicit choices and stay.
95
+ */
96
+ function shouldSelectAuto(ctx: ExtensionContext, saved: SavedDefault, argv: readonly string[]) {
97
+ if (ctx.model?.provider === PROVIDER_NAME) return isRetiredWeaveModel(ctx.model.provider, ctx.model.id);
98
+ if (argv.some((arg) => LAUNCH_MODEL_FLAGS.has(arg))) return false;
99
+ const scoped = ctx.scopedModels ?? [];
100
+ if (scoped.length > 0 && !scoped.some(({ model }) => model.provider === PROVIDER_NAME && model.id === WEAVE_AUTO_MODEL_ID)) return false;
101
+ return (conversationModel(ctx.sessionManager.getBranch()) ?? saved).provider === PROVIDER_NAME;
102
+ }
103
+
104
+ export function registerAutoModel(pi: ExtensionAPI, argv: readonly string[] = process.argv): void {
105
+ pi.on("before_provider_request", (event, ctx) => {
106
+ if (ctx.model?.provider !== PROVIDER_NAME) return;
107
+ return rewriteAutoPayload(event.payload);
108
+ });
109
+
110
+ // Children launch with an explicit model and must not write the user's settings.
111
+ if (isSubagent()) return;
112
+ pi.on("session_start", async (_event, ctx) => {
113
+ const saved = migrateSavedDefaults(ctx.cwd);
114
+ if (!shouldSelectAuto(ctx, saved, argv)) return;
115
+ const auto = ctx.modelRegistry.find(PROVIDER_NAME, WEAVE_AUTO_MODEL_ID);
116
+ if (auto) await pi.setModel(auto);
117
+ });
118
+ }
@@ -61,7 +61,7 @@ export function getRouterBaseUrl(): string {
61
61
  // ---------- router key resolution ----------
62
62
 
63
63
  /** Agent config dir, honoring PI_CODING_AGENT_DIR (set for project-scope installs). */
64
- function getAgentDir(): string {
64
+ export function getAgentDir(): string {
65
65
  const env = process.env.PI_CODING_AGENT_DIR?.trim();
66
66
  if (env) return env.startsWith("~/") ? path.join(os.homedir(), env.slice(2)) : env;
67
67
  return path.join(os.homedir(), ".pi", "agent");
@@ -220,37 +220,44 @@ export function providerHeaders(role: Role, key: string): Record<string, string>
220
220
 
221
221
  // ---------- model list ----------
222
222
 
223
- // Carried as a shared constant rather than relying on registerProvider preserving
224
- // an omitted `models` list, so the extension is self-sufficient: a freshly
225
- // dispatched child (and a `pi -e` smoke test with no models.json) can still
226
- // resolve `weave/<model>`. The list mirrors the installer's headline models;
227
- // the router re-routes every request regardless, so this is a UX/label surface.
228
- // The context windows mirror the router's catalog for these models (see
229
- // internal/router/catalog) so the footer and auto-compaction budget reflect
230
- // what the router actually serves; per-request reroutes can still land on a
231
- // different window, which the served-window header reports on the response.
232
- export const WEAVE_MODELS: ProviderModelConfig[] = [
233
- model("claude-opus-4-8", "Claude Opus 4.8 (via Weave Router)", 64000, 1_000_000),
234
- model("claude-opus-4-7", "Claude Opus 4.7 (via Weave Router)", 64000, 1_000_000),
235
- model("claude-sonnet-4-6", "Claude Sonnet 4.6 (via Weave Router)", 64000, 1_000_000),
236
- model("claude-haiku-4-5", "Claude Haiku 4.5 (via Weave Router)", 32000, 200_000),
237
- model("grok-4.6", "Grok 4.6 (via Weave Router)", 131072, 500_000),
238
- model("grok-4.7", "Grok 4.7 (via Weave Router)", 131072, 500_000),
239
- model("qwen/qwen3.8-max", "Qwen 3.8 Max (via Weave Router)", 131072, 1_000_000),
240
- ];
223
+ /**
224
+ * The one model pi's picker shows. The router picks the served model for every
225
+ * request from the organization's enabled set, so concrete entries here only
226
+ * advertised choices that were never honored, and went stale. /fm pins a model.
227
+ * Deliberately not `weave-auto`: the router reads that as a routing-strategy
228
+ * selector, which turns /beta off.
229
+ */
230
+ export const WEAVE_AUTO_MODEL_ID = "auto";
241
231
 
242
- function model(id: string, name: string, maxTokens: number, contextWindow: number = 200000): ProviderModelConfig {
243
- return {
244
- id,
245
- name,
232
+ /**
233
+ * Request model sent for an `auto` turn. Installs selected it as pi's default
234
+ * before `auto` existed, so the router sees the same requests as before: it
235
+ * routes them, and serves this model as-is only where routing is off for the
236
+ * caller. It is also the baseline `auto` savings are priced against.
237
+ */
238
+ export const AUTO_WIRE_MODEL = "claude-sonnet-4-6";
239
+
240
+ /** Maps `auto` to AUTO_WIRE_MODEL; every other pi model id passes through unchanged. */
241
+ export function wireModelId(modelId: string): string {
242
+ return modelId === WEAVE_AUTO_MODEL_ID ? AUTO_WIRE_MODEL : modelId;
243
+ }
244
+
245
+ // Registered with explicit models (not left to models.json) so a dispatched
246
+ // child or a `pi -e` run without models.json still resolves weave/auto.
247
+ // The window is a starting value: each response's served-window header
248
+ // replaces it with the routed model's window.
249
+ export const WEAVE_MODELS: ProviderModelConfig[] = [
250
+ {
251
+ id: WEAVE_AUTO_MODEL_ID,
252
+ name: "Weave Router",
246
253
  reasoning: true,
247
254
  input: ["text", "image"],
248
255
  // Real cost is decided by the router per request and is unknown client-side.
249
256
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
250
- contextWindow,
251
- maxTokens,
252
- };
253
- }
257
+ contextWindow: 1_000_000,
258
+ maxTokens: 64000,
259
+ },
260
+ ];
254
261
 
255
262
  // ---------- dispatch / misc tunables ----------
256
263
 
@@ -262,7 +269,6 @@ export const ROUTED_CONTEXT_WINDOW_HEADER = "x-router-context-window";
262
269
  /** Marker a headless child prints to stderr so the parent dispatch can read its routed model. */
263
270
  export const ROUTED_MODEL_STDERR_PREFIX = "weave-routed-model:";
264
271
 
265
- export const SUBAGENT_MODEL = process.env.WEAVE_PI_SUBAGENT_MODEL?.trim() || "claude-sonnet-4-6";
266
272
  export const DISPATCH_CONCURRENCY = Math.max(1, numEnv("WEAVE_PI_DISPATCH_CONCURRENCY", 4));
267
273
  export const MAX_SUBAGENTS = 8;
268
274
  export const SUBAGENT_TIMEOUT_MS = Math.max(1000, numEnv("WEAVE_PI_SUBAGENT_TIMEOUT_MS", 600000));
@@ -32,8 +32,8 @@ import {
32
32
  resolveIdentity,
33
33
  resolveRouterKey,
34
34
  ROUTED_MODEL_STDERR_PREFIX,
35
- SUBAGENT_MODEL,
36
35
  SUBAGENT_TIMEOUT_MS,
36
+ WEAVE_AUTO_MODEL_ID,
37
37
  } from "./config.js";
38
38
 
39
39
  /**
@@ -136,7 +136,7 @@ function runChild(
136
136
  index: number,
137
137
  lspEnv: Record<string, string> | undefined,
138
138
  ): Promise<ChildResult> {
139
- const args = ["--print", "--mode", "json", "--no-session", "-e", selfPath, "--model", `${PROVIDER_NAME}/${SUBAGENT_MODEL}`];
139
+ const args = ["--print", "--mode", "json", "--no-session", "-e", selfPath, "--model", `${PROVIDER_NAME}/${WEAVE_AUTO_MODEL_ID}`];
140
140
 
141
141
  // Secure-by-default tool gating. Task input is model-influenced, so without an
142
142
  // explicit opt-in we never hand a child write/exec tools: model-requested
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * Wiring:
5
5
  * - provider: register `weave` with per-process knob headers (quality on
6
- * the main loop, speed/cheap in subagents).
6
+ * the main loop, speed/cheap in subagents) and its single
7
+ * `auto` model.
7
8
  * - metadata: stamp body.metadata.user_id for sticky sessions + subagent
8
9
  * detection.
9
10
  * - Loom UI: branded header, Wooly animation, actual route, and saved $.
@@ -21,6 +22,7 @@
21
22
 
22
23
  import { fileURLToPath } from "node:url";
23
24
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
25
+ import { registerAutoModel } from "./auto-model.js";
24
26
  import { registerBetaCommand } from "./beta.js";
25
27
  import { registerClassifierThread } from "./classifier-thread.js";
26
28
  import { isSubagent } from "./config.js";
@@ -44,6 +46,8 @@ export default function (pi: ExtensionAPI): void {
44
46
  registerWeave(pi);
45
47
  pi.on("session_start", () => registerWeave(pi));
46
48
 
49
+ // First, so every later request hook sees the wire model.
50
+ registerAutoModel(pi);
47
51
  registerMetadata(pi);
48
52
  const classifierThreadActive = registerClassifierThread(pi);
49
53
  registerBetaCommand(pi);
@@ -7,13 +7,15 @@ export interface ModelPricing {
7
7
  cacheReadMultiplier: number;
8
8
  }
9
9
 
10
- export const PRICING_VERSION = "catalog-sha256:3b753718c0db1fdc";
10
+ export const PRICING_VERSION = "catalog-sha256:b1fc371aa80c39c3";
11
11
 
12
12
  export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.freeze({
13
13
  "claude-fable-5": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
14
14
  "claude-fable-5-1": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.025 },
15
+ "claude-fable-5-2": { inputUsdPerMillion: 8, outputUsdPerMillion: 40, cacheReadMultiplier: 0.025 },
15
16
  "claude-haiku-4-5": { inputUsdPerMillion: 1, outputUsdPerMillion: 5, cacheReadMultiplier: 0.1 },
16
17
  "claude-haiku-5-5": { inputUsdPerMillion: 0.1, outputUsdPerMillion: 0.5, cacheReadMultiplier: 0.1 },
18
+ "claude-mythos-5-2": { inputUsdPerMillion: 8, outputUsdPerMillion: 40, cacheReadMultiplier: 0.025 },
17
19
  "claude-opus-4-0": { inputUsdPerMillion: 15, outputUsdPerMillion: 75, cacheReadMultiplier: 0.1 },
18
20
  "claude-opus-4-1": { inputUsdPerMillion: 15, outputUsdPerMillion: 75, cacheReadMultiplier: 0.1 },
19
21
  "claude-opus-4-5": { inputUsdPerMillion: 5, outputUsdPerMillion: 25, cacheReadMultiplier: 0.1 },
@@ -25,7 +27,7 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
25
27
  "claude-sonnet-4-5": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
26
28
  "claude-sonnet-4-6": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
27
29
  "claude-sonnet-5": { inputUsdPerMillion: 2, outputUsdPerMillion: 10, cacheReadMultiplier: 0.1 },
28
- "claude-sonnet-5-5": { inputUsdPerMillion: 2, outputUsdPerMillion: 10, cacheReadMultiplier: 0.1 },
30
+ "claude-sonnet-5-5": { inputUsdPerMillion: 2, outputUsdPerMillion: 10, cacheReadMultiplier: 0.05 },
29
31
  "deepseek/deepseek-v4-flash": { inputUsdPerMillion: 0.14, outputUsdPerMillion: 0.28, cacheReadMultiplier: 0.1 },
30
32
  "deepseek/deepseek-v4-pro": { inputUsdPerMillion: 1.74, outputUsdPerMillion: 3.48, cacheReadMultiplier: 0.0862 },
31
33
  "deepseek/deepseek-v4-pro-0813": { inputUsdPerMillion: 1.74, outputUsdPerMillion: 3.48, cacheReadMultiplier: 0.0862 },
@@ -77,6 +79,7 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
77
79
  "grok-4.6": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
78
80
  "grok-4.7": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
79
81
  "inclusionai/ling-3.0-flash": { inputUsdPerMillion: 0.06, outputUsdPerMillion: 0.18, cacheReadMultiplier: 0.2 },
82
+ "meta/muse-spark-open": { inputUsdPerMillion: 1.25, outputUsdPerMillion: 4.25, cacheReadMultiplier: 0.12 },
80
83
  "minimax/minimax-m2.7": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
81
84
  "minimax/minimax-m3": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
82
85
  "minimax/minimax-m3.1-flash": { inputUsdPerMillion: 0.15, outputUsdPerMillion: 0.6, cacheReadMultiplier: 0.1 },
@@ -86,7 +89,9 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
86
89
  "moonshotai/kimi-k2.7": { inputUsdPerMillion: 0.95, outputUsdPerMillion: 4, cacheReadMultiplier: 0.2 },
87
90
  "moonshotai/kimi-k3": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
88
91
  "moonshotai/kimi-k3.1": { inputUsdPerMillion: 2, outputUsdPerMillion: 10, cacheReadMultiplier: 0.1 },
92
+ "muse-ember-1.0": { inputUsdPerMillion: 0.1, outputUsdPerMillion: 0.5, cacheReadMultiplier: 0.04 },
89
93
  "muse-spark-1.3": { inputUsdPerMillion: 1.25, outputUsdPerMillion: 4.25, cacheReadMultiplier: 0.12 },
94
+ "muse-wonder-1.0": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.05 },
90
95
  "qwen/qwen3-235b-a22b-2507": { inputUsdPerMillion: 0.2266, outputUsdPerMillion: 0.9064, cacheReadMultiplier: 0.5 },
91
96
  "qwen/qwen3-30b-a3b-instruct-2507": { inputUsdPerMillion: 0.15, outputUsdPerMillion: 0.6, cacheReadMultiplier: 0.1684 },
92
97
  "qwen/qwen3-coder": { inputUsdPerMillion: 0.9, outputUsdPerMillion: 2.7, cacheReadMultiplier: 0.1684 },
@@ -17,6 +17,7 @@ import {
17
17
  ROUTED_PROVIDER_HEADER,
18
18
  ROUTER_DECISION_HEADER,
19
19
  PROVIDER_NAME,
20
+ wireModelId,
20
21
  } from "./config.js";
21
22
  import { parseRoutedContextWindow } from "./context-window.js";
22
23
  import {
@@ -91,7 +92,7 @@ export function registerRoutedModel(pi: ExtensionAPI): void {
91
92
  entries = restored.entries;
92
93
  savings = restored.aggregate;
93
94
  const lastEntry = restored.aggregate.lastEntry;
94
- requestedModel = ctx.model?.id ?? lastEntry?.requestedModel;
95
+ requestedModel = ctx.model ? wireModelId(ctx.model.id) : lastEntry?.requestedModel;
95
96
  routedModel =
96
97
  lastEntry && requestedModel && normalizeModelId(requestedModel) === lastEntry.requestedModel
97
98
  ? lastEntry.routedModel
@@ -119,7 +120,7 @@ export function registerRoutedModel(pi: ExtensionAPI): void {
119
120
  // Restore the conservative virtual-model default until its first response.
120
121
  registerWeave(pi);
121
122
  if (isSubagent()) return;
122
- requestedModel = event.model.id;
123
+ requestedModel = wireModelId(event.model.id);
123
124
  routedModel = undefined;
124
125
  refresh(ctx);
125
126
  });
@@ -142,7 +143,7 @@ export function registerRoutedModel(pi: ExtensionAPI): void {
142
143
  registerWeave(pi, { modelId: ctx.model.id, contextWindow });
143
144
  }
144
145
  const route: PendingRoute = {
145
- ...(ctx.model?.id ? { requestedModel: ctx.model.id } : {}),
146
+ ...(ctx.model?.id ? { requestedModel: wireModelId(ctx.model.id) } : {}),
146
147
  routedModel: normalizeModelId(model),
147
148
  ...(event.headers[ROUTED_PROVIDER_HEADER] ? { provider: event.headers[ROUTED_PROVIDER_HEADER] } : {}),
148
149
  ...(event.headers[ROUTER_DECISION_HEADER] ? { decision: event.headers[ROUTER_DECISION_HEADER] } : {}),
@@ -186,7 +187,7 @@ export function registerRoutedModel(pi: ExtensionAPI): void {
186
187
  const pending = pendingRoutes.shift();
187
188
  if (!pending) return;
188
189
  const message = event.message as AssistantMessage;
189
- const selected = pending.requestedModel || message.model || ctx.model?.id;
190
+ const selected = pending.requestedModel || message.model || (ctx.model && wireModelId(ctx.model.id));
190
191
  if (!selected) return;
191
192
  const decision: RouteDecision = {
192
193
  requestedModel: selected,
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: build
3
+ description: "Build a requested change end to end with routed subagents: research, interview, approval, implementation, verification, independent review, and an open PR."
4
+ ---
5
+
6
+ <!-- weave-router managed build skill -->
7
+
8
+ You are the build coordinator. You own the plan, every decision, the
9
+ requirement ledger, and the final answer. Workers do bounded pieces of work in
10
+ fresh contexts and report back; they never coordinate each other.
11
+
12
+ ## Routing ladder
13
+
14
+ The Weave Router picks each worker's model from the work it is handed, so the
15
+ shape of every assignment decides its model. Keep this ladder:
16
+
17
+ | Role | Work | Expected model size |
18
+ | --- | --- | --- |
19
+ | Coordinator (you) | Planning, decisions, integration | Largest (pinned below) |
20
+ | Researcher | One narrow lookup | Smallest |
21
+ | Implementer | One small, fully specified edit | Smallest |
22
+ | Verifier | Run and exercise the change | Middle |
23
+ | Reviewer | Independent whole-change review | Large |
24
+
25
+ Before anything else, run this skill's `scripts/pin-coordinator.sh` once
26
+ using the absolute path of this skill directory, as a shell command on its
27
+ own with nothing chained before or after it. The router reads the
28
+ `/force-parent` directive only when it is the first line of the command
29
+ output; it pins only this thread to the largest model, and workers keep
30
+ automatic routing. Do not repeat its output. Continue if the router does not
31
+ acknowledge it, and mention that in the final report.
32
+
33
+ Write assignments with the templates in `references/worker-contracts.md`.
34
+ Never paste the conversation, the plan, or large files into a research or
35
+ implementation assignment; that makes small work look big and routes it to a
36
+ large model.
37
+
38
+ ## Stages
39
+
40
+ Load only the reference for the current stage.
41
+
42
+ 1. **Research** — `references/research-and-interview.md`. Fan out
43
+ researchers for independent lookups; synthesize their reports yourself.
44
+ Do this even for small tasks: researchers read the repository, you decide.
45
+ 2. **Interview and approval** — same reference. Ask the user numbered open
46
+ questions with suggested defaults, then present the plan. Do not edit
47
+ files until the user approves.
48
+ 3. **Implementation** — `references/worker-contracts.md`. Split the approved
49
+ plan into small edits with explicit file ownership and give each to an
50
+ implementer. Make an edit yourself only when it cannot be split into
51
+ small, fully specified pieces, and say so in the final report.
52
+ 4. **Verification** — `references/verification-and-review.md`. A fresh
53
+ verifier runs the checks and exercises the real changed application.
54
+ 5. **Review** — same reference. A fresh reviewer that has seen none of the
55
+ implementation conversation reviews the full diff against the requirements.
56
+ 6. **PR** — `references/pr-loop.md`. Open one PR and drive it to ready.
57
+ Never merge or deploy.
58
+
59
+ Client-specific dispatch and restrictions are in `references/client-controls.md`.
60
+
61
+ ## Rules
62
+
63
+ - Every stage runs, however small the task. You coordinate; workers read,
64
+ edit, verify, and review.
65
+ - Workers start fresh: give each one only its assignment.
66
+ - Workers do not spawn workers.
67
+ - Treat a worker report as evidence to check, not a decision.
68
+ - A missing or unsupported capability is a blocked state to report, never a
69
+ reason to silently do a worker's role yourself.
70
+ - Stop and report truthfully when blocked. Never claim checks, reviews, or
71
+ approvals that did not happen.
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: build-implementer
3
+ description: "Makes one small, fully specified edit to the listed files for the build coordinator, then runs one focused check."
4
+ tools: Read, Edit, Write, Grep, Glob, Bash
5
+ ---
6
+
7
+ <!-- weave-router managed agent: build-implementer -->
8
+
9
+ You make exactly the edit you were given, only in the files you were given,
10
+ then run the check you were given. Do not refactor, add features, or touch
11
+ other files. If the edit cannot be made as specified, stop and say why.
12
+ Reply in at most 10 lines: files changed, check command and result. Never
13
+ start other agents.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: build-researcher
3
+ description: "Answers one narrow, read-only codebase question for the build coordinator. Use for quick lookups."
4
+ tools: Read, Grep, Glob
5
+ ---
6
+
7
+ <!-- weave-router managed agent: build-researcher -->
8
+
9
+ You answer one small lookup question. Read only what you need. Reply in at
10
+ most 10 lines: the answer, file:line evidence, and "unknown" for anything you
11
+ could not confirm. Never edit files, suggest changes, or start other agents.
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: build-reviewer
3
+ description: "Independently reviews a whole change against its requirements for the build coordinator. Use after verification."
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ <!-- weave-router managed agent: build-reviewer -->
8
+
9
+ You review a change you did not write, using only the requirements and diff
10
+ you were given. Think carefully about correctness, edge cases, failure
11
+ handling, security, concurrency, data loss, compatibility, and whether each
12
+ requirement is met. Report findings with severity (blocking, should-fix,
13
+ nit), file:line, and reasoning. Never edit files or start other agents.
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: build-verifier
3
+ description: "Verifies a finished change for the build coordinator by running checks and exercising the real changed behavior."
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ <!-- weave-router managed agent: build-verifier -->
8
+
9
+ You verify a change you did not write. Run the listed checks, then exercise
10
+ the real changed behavior; for UI changes, run the app and capture
11
+ screenshots. Report each requirement as pass, fail, or not verified, with
12
+ command output or screenshot paths as evidence. Never edit files or start
13
+ other agents.
@@ -0,0 +1,34 @@
1
+ # Client controls
2
+
3
+ ## Claude Code
4
+
5
+ - Dispatch workers with the Agent tool using the installed agent types:
6
+ `build-researcher`, `build-implementer`, `build-verifier`,
7
+ `build-reviewer`. Each has its own tool restrictions and none sets a
8
+ model, so the router chooses one per assignment.
9
+ - Never pass a `model` argument to the Agent tool.
10
+ - If an agent type is missing, report that the build agents are not installed
11
+ and stop.
12
+ - Run independent researchers or implementers in one message so they run in
13
+ parallel.
14
+
15
+ ## Codex
16
+
17
+ - Dispatch each worker with `spawn_agent`, putting the role template in the
18
+ task message. Do not fork your turns into workers and do not set a model;
19
+ the router picks it from the assignment.
20
+ - Give every worker a descriptive `task_name` that states its role and
21
+ scope, for example `research_find_cli_entrypoint`,
22
+ `implement_add_json_flag`, `verify_tests_and_edge_cases` or
23
+ `review_whole_change`. Codex encrypts the task message, so the task name
24
+ is the only part of the assignment the router can read.
25
+ - Start every worker message with its role line, for example
26
+ `Role: build-researcher.`, so its scope is unambiguous.
27
+ - Wait for all parallel workers before integrating their results.
28
+
29
+ ## Both
30
+
31
+ - The coordinator pin comes from `scripts/pin-coordinator.sh`. Set
32
+ `WEAVE_BUILD_COORDINATOR_MODEL` to pin a different coordinator model.
33
+ - Worker models are chosen per assignment by the Weave Router. Without the
34
+ router, workers use the client's normal model selection.
@@ -0,0 +1,10 @@
1
+ # PR loop
2
+
3
+ 1. Commit only files in the approved plan. Open one PR with a short summary,
4
+ the requirement list, and verification evidence.
5
+ 2. After each push, wait 120 seconds, then read checks and review comments for
6
+ the latest head only.
7
+ 3. Batch all actionable feedback into one fix, verify it, push once.
8
+ 4. Stop after five correction pushes or 45 minutes of watching, and report
9
+ what is still failing or unresolved.
10
+ 5. Leave the PR open for a human to merge. Never merge, deploy, or publish.
@@ -0,0 +1,24 @@
1
+ # Research and interview
2
+
3
+ ## Research
4
+
5
+ 1. Split what you need to know into independent questions: where a feature
6
+ lives, how a similar change was done, which tests cover an area, which
7
+ commands validate it.
8
+ 2. Send one researcher per question with the researcher template. Prefer
9
+ several small lookups over one broad one.
10
+ 3. Send at least one researcher for each area the change touches, even when
11
+ the repository looks small. Read a file yourself only to confirm a
12
+ specific report you will act on. You make the design decisions.
13
+
14
+ ## Interview
15
+
16
+ Ask the user every open question in one message, as a numbered list with a
17
+ suggested default each, so they can answer by number. Ask only what research
18
+ could not answer: product behavior, scope, tradeoffs, and approvals.
19
+
20
+ ## Plan approval
21
+
22
+ Present the plan: requirements (numbered), files to change with an owner for
23
+ each, verification steps, and anything out of scope. Wait for explicit
24
+ approval before any edit. A changed plan needs approval again.
@@ -0,0 +1,20 @@
1
+ # Verification and review
2
+
3
+ Run both after implementation and again after any fix. Both workers start
4
+ fresh and receive only their assignment.
5
+
6
+ ## Verification
7
+
8
+ - Use the verifier template. List every requirement and the exact commands.
9
+ - Visual or interactive changes need the real app running and screenshots of
10
+ each changed view; a passing unit test does not verify a UI.
11
+ - A requirement the verifier could not exercise stays "not verified" and goes
12
+ in the final report.
13
+
14
+ ## Independent review
15
+
16
+ - Use the reviewer template. Give the requirements and the diff range only;
17
+ never the implementation conversation or your own conclusions.
18
+ - Address every blocking finding, then re-verify and re-review the new head.
19
+ Results for an older head are stale.
20
+ - You may decline a should-fix or nit with a stated reason.