llm-orchestrator 1.6.0 → 1.7.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.
@@ -0,0 +1,628 @@
1
+ <!-- llm-orchestrator · created by Bogdan-Gabriel Torcescu · https://www.linkedin.com/in/bogdantorcescu/ · keep this credit when copying or deriving -->
2
+ # llm-orchestrator — reference
3
+
4
+ The [README](../README.md) says what the orchestrator is for and how to install it. This page holds
5
+ everything else: installing with an agent, the mandatory tools and their install routes, per-IDE
6
+ installs, flow adherence, cost-aware routing, the advisor and strategy cards, updating, development
7
+ and troubleshooting.
8
+
9
+ ## Let an agent install it for you
10
+
11
+ Paste the block below into any capable coding agent (Claude Code, Codex, OpenCode, Kilo). It
12
+ installs the orchestrator itself without asking, then **stops and asks you once** before touching
13
+ anything else — installing third-party tools on someone's machine is not a decision an agent gets to
14
+ make silently.
15
+
16
+ ````text
17
+ Install llm-orchestrator in this project, then report back.
18
+
19
+ STEP 1 — install the orchestrator (do this without asking):
20
+ - On Claude Code: run `/plugin marketplace add tbogdan/llm-orchestrator` then
21
+ `/plugin install llm-orchestrator@tbogdan`.
22
+ - On any other harness, or if you also want the project files (commands, agent, AGENTS.md
23
+ bindings): run `npx llm-orchestrator install --project . --harness <harness> --apply`,
24
+ where <harness> is one of codex | claude | opencode | kilo.
25
+
26
+ STEP 2 — find the gaps (read-only, writes nothing):
27
+ Run `npx llm-orchestrator init --project .`
28
+ It prints each of the 8 mandatory core tools as [present] or [missing], with the exact
29
+ install command for each missing one, and whether AGENTS.md has the orchestration
30
+ bindings section.
31
+
32
+ STEP 3 — ASK ME BEFORE INSTALLING ANYTHING ELSE. Do not skip this step.
33
+ Use your harness's native question mechanism (AskUserQuestion on Claude Code,
34
+ request_user_input on Codex, question on OpenCode, ask_followup_question on Kilo).
35
+ Ask once, batched, and include in the question:
36
+ - the list of missing tools,
37
+ - the exact command you would run for each,
38
+ - that `brew install rtk` needs Homebrew and that the `/plugin` lines only work on
39
+ Claude Code,
40
+ - that declining is fine: the core still runs, in declared degraded mode.
41
+ Then install exactly the ones I approve, and nothing I did not approve.
42
+
43
+ STEP 4 — verify and report:
44
+ Run `npx llm-orchestrator doctor --project . --harness <harness>` and show me the output.
45
+ Tell me plainly which tools are still missing and which gates are therefore degraded.
46
+ Do not claim the install succeeded without showing the doctor output.
47
+ ````
48
+
49
+ The same shape works as a standing instruction in `AGENTS.md`/`CLAUDE.md` if you want new sessions
50
+ to self-install. Keep step 3 intact if you do — an agent that installs MCP servers and Homebrew
51
+ formulae unprompted is a worse problem than a missing gate.
52
+
53
+ ## Why
54
+
55
+ Ask an agent to fix a bug and you usually get one long session: it reads a bit, guesses, edits,
56
+ declares victory, and you find out later that nothing was verified. Ask it to parallelize and you
57
+ spend your afternoon writing subagent prompts by hand, then merging the mess when two of them edited
58
+ the same file.
59
+
60
+ The work that makes the difference is the same every time — classify the task, gather evidence
61
+ before theorizing, write a failing test first, split what can run in parallel, keep agents out of
62
+ each other's files, review independently, verify before claiming done, record what was learned. It
63
+ is mechanical, and nobody wants to re-type it into every prompt.
64
+
65
+ `llm-orchestrator` makes that flow the default. It ships as a skill your agent must load before it
66
+ does anything, so the process runs whether or not you remembered to ask for it, and it is written
67
+ once in portable form instead of being copy-pasted and left to drift across every project's
68
+ `AGENTS.md` and every harness's config.
69
+
70
+ ## How it works
71
+
72
+ 1. **Discover** — `lib/project-discovery.mjs` reads the project (languages, frameworks, domains, commands, and any `## Orchestration bindings (project)` section in AGENTS.md) into a `ProjectProfile`.
73
+ 2. **Inventory** — the running session reports which tools/MCPs/skills it actually has, with permission and evidence, into a `ToolInventory`. Nothing is inferred from config files; only live, observed access counts.
74
+ 3. **Resolve** — `lib/capability-resolver.mjs` combines the task, the project profile, the tool inventory, the registries (`registries/*.json`) and any explicit user decisions into a `CapabilityPlan`: which capabilities are mandatory/required/optional, which concrete tool binds each one, what's missing, and whether the plan is running in declared degraded mode.
75
+ 4. **Dispatch** — `lib/dispatch-contract.mjs` narrows that plan into a `DispatchContract` for each bounded subagent shard: only the facts, bindings and acceptance conditions that shard needs.
76
+ 5. **Render** — `adapters/*` turn the plan into native artifacts per harness (Codex prompts/AGENTS.md, Claude Code commands/agents/skills, OpenCode/Kilo commands/agents), installed atomically and idempotently by `lib/installation.mjs`.
77
+
78
+ ### Obligation levels
79
+
80
+ - **Mandatory** — skipping it makes the work invalid, not merely worse. It is a gate. If it cannot run, the orchestrator states the gap *first*, recommends installation once (exact command), and only after an explicit user refusal continues in **declared degraded mode** — every plan, handoff and final report carries a `degraded:` line naming the missing item. Silent fallback is a violation.
81
+ - **Optional** — used when its stated trigger holds. Judgment call, but the trigger is not.
82
+ - **Available** — exists, costs nothing to ignore, reach for it when it fits.
83
+
84
+ ### The 8 mandatory core tools
85
+
86
+ These apply to every task, everywhere, regardless of harness (see `registries/core-profile.json`):
87
+
88
+ | # | Capability | Preferred implementation | Why it's a gate |
89
+ |---|---|---|---|
90
+ | 1 | `orchestration.bootstrap` | using-superpowers | The orchestration entrypoint must load before any planning or execution. |
91
+ | 2 | `memory.recall` | mempalace | Prior session/task memory must be recalled before planning. |
92
+ | 3 | `memory.checkpoint` | mempalace | A memory checkpoint is required at session end and after any non-obvious finding. |
93
+ | 4 | `reasoning.checkpoints` | sequential-thinking | Nontrivial planning/diagnosis needs recorded evidence checkpoints. |
94
+ | 5 | `communication.concise` | caveman | Concise, complete contracts, not padded prose. |
95
+ | 6 | `shell.rtk` | rtk | Shell phases run through the configured output-reduction wrapper without changing command semantics. |
96
+ | 7 | `docs.current` | context7 | Version-sensitive or uncertain library/platform work needs current, versioned documentation — even for familiar libraries. |
97
+ | 8 | `research.retrieve` | exa (exa-search) | External/current facts, vendor behavior not in local docs, research-type tasks, and any claim about versions/prices/APIs need retrieved sources, not recalled ones. |
98
+
99
+ Four more gates are equally mandatory, at their own trigger rather than on every turn: `verification.checks` (verification-before-completion, before any completion claim), `skill.check` (before any action, check whether a skill already covers it), `tool.discovery` (search before declaring a tool absent), and `user.native_question` (every question to the user goes through the harness's native mechanism, batched into one question — `AskUserQuestion` on Claude Code, `request_user_input` / `update_plan` on Codex, `question` on OpenCode, `ask_followup_question` on Kilo; see `policies/questions.md`).
100
+
101
+ One more is mandatory by domain — `D1`, `ui.design_system` → [Impeccable](https://impeccable.style) (`impeccable`, Apache-2.0; `registries/core-profile.json` order 13, `domain_conditional: true`). It applies to every task whose pre-evaluation domain is `FRONTEND`, or that creates, changes, reviews or audits UI or visual design: `/impeccable shape` (or `critique`) before building — `/impeccable init` first when the project has no `PRODUCT.md` — and `/impeccable audit` + `/impeccable polish` before G5; each `workflows/<type>.md` names the command for each phase. `ui-ux-pro-max`, `frontend-design`, `design-system`, `ui-styling` and `web-design-guidelines` stay available as complements — they never substitute for it silently, and the resolver will not bind them in its place. A missing Impeccable follows the same portability rule as the core tools: gap declared first, install recommended once, degraded only after an explicit refusal.
102
+
103
+ A second one is mandatory by domain — `D2`, `code.semantic_edit` → [Serena](https://oraios.github.io/serena) (`serena` MCP; `registries/core-profile.json` order 14, `domain_conditional: true`). It applies to every task that locates or changes code. Serena gives the agent symbol tools over a language server: the outline of a file, a definition, every caller, and renames or replacements that reach every reference. The agent reads far less to find the same thing. Plain reads stay right for small files, configuration and prose; on code they never substitute for it silently.
104
+
105
+ #### Installing the core tools
106
+
107
+ `llm-orchestrator init` reports which of these are missing and prints the matching command. The
108
+ routes below are the ones it prints — each was checked against the published source, because three
109
+ of them are not what the obvious guess would be: `rtk` on crates.io is an unrelated "Rust Type Kit",
110
+ and `mempalace-mcp` and `superpowers` are binaries their plugin ships rather than npm packages you
111
+ can `npx`.
112
+
113
+ | Capability | Tool | Install |
114
+ |---|---|---|
115
+ | `orchestration.bootstrap`, `skill.check`, `verification.checks` | using-superpowers | `/plugin marketplace add anthropics/claude-plugins-official` then `/plugin install superpowers@claude-plugins-official` |
116
+ | `memory.recall`, `memory.checkpoint` | mempalace | `/plugin marketplace add MemPalace/mempalace` then `/plugin install mempalace@mempalace` |
117
+ | `reasoning.checkpoints` | sequential-thinking | `claude mcp add sequential-thinking -- npx -y @modelcontextprotocol/server-sequential-thinking` |
118
+ | `communication.concise` | caveman | `/plugin marketplace add JuliusBrussee/caveman` then `/plugin install caveman@caveman` |
119
+ | `shell.rtk` | rtk | `brew install rtk` (Homebrew core; **not** `cargo install rtk`) |
120
+ | `docs.current` | context7 | `claude mcp add context7 -- npx -y @upstash/context7-mcp` |
121
+ | `research.retrieve` | exa | `claude mcp add exa -- npx -y exa-mcp-server` |
122
+ | `tool.discovery` | harness-native tool search | built in, nothing to install |
123
+ | `content.copywriting` (text written for people; recommended, never blocking) | copywriting + copy-editing | `npx skills add coreyhaines31/marketingskills` (MIT; the whole pack, for the harnesses it detects — also offered as a Claude Code and Codex plugin marketplace). Complement for README and release-note prose: `npx skills add blader/humanizer` (MIT) |
124
+ | `code.semantic_edit` (any task on code) | serena | `uv tool install -p 3.13 serena-agent && serena init`, then `serena setup claude-code` or `serena setup codex`; any other harness: register `serena start-mcp-server` as an MCP server (client list in its docs) (GPL-3.0-or-later; docs at https://oraios.github.io/serena) |
125
+ | `ui.design_system` (frontend/UI tasks) | impeccable | `npx impeccable install` from the project root (detects Claude Code, Codex, Cursor, Gemini CLI, OpenCode, Copilot, … and installs into each; refresh with `npx impeccable update`), or on Claude Code `/plugin marketplace add pbakaus/impeccable` then `/plugin install impeccable@impeccable` (skill id `impeccable:impeccable`). A harness the installer does not detect (Kilo is not in its published list) is a declared gap. Start a new project with `/impeccable init` |
126
+
127
+ The `/plugin ...` lines are Claude Code commands, typed in a session. The `claude mcp add ...` lines
128
+ are shell commands; on Codex, OpenCode or Kilo, register the same MCP server through that harness's
129
+ own config instead — the server package and arguments are identical.
130
+
131
+ Every one of these is optional in the sense that the core still runs without it — but it then runs
132
+ in **declared degraded mode**, and every plan and report says so. That is the design, not a
133
+ workaround.
134
+
135
+ `init` reports a missing `impeccable` on a project whose discovery finds a UI framework (the `frontend` domain: Vue, Nuxt, React, Next, Svelte, Angular, Solid, Preact, Astro, Lit). `doctor` reports it, with the install hint, when the task it is asked about triggers it — `doctor --task feature --domain FRONTEND`, or a UI signal such as `--signals web-ui`.
136
+
137
+ The first eight rows of the core table above are `registries/core-profile.json` orders 1–8, in that order. The same eight, in the same order, appear in `SKILL.md`, `policies/capabilities.md` and the `task` command checklist, and `lib/first-run.mjs` checks exactly these for presence — `tests/coherence.test.mjs` fails if any of those six lists drifts.
138
+
139
+ ### Registries
140
+
141
+ - `registries/capabilities.json` — the full capability vocabulary.
142
+ - `registries/core-profile.json` — the always-on mandatory/required core.
143
+ - `registries/task-mappings.json` — per-task-type (feature, bug, incident, refactor, investigation, review, deployment, config, research...) mandatory/optional/available obligations.
144
+ - `registries/preferred-tools.json` — concrete tool bindings (MCP, skill, CLI, workflow, native fallback, agent role) per capability, with install hints.
145
+ - `registries/agent-roles.json` — the specialist agent roster, their capabilities/skills/MCPs, and the RO/RW/ORCHESTRATOR permission profiles.
146
+ - `registries/learning.json` — the frontier cap and exploration share, when the advisor is consulted, and the shape and lifecycle of strategy cards.
147
+
148
+ Project-specific bindings live in the consuming project's `AGENTS.md`, under `## Orchestration bindings (project)`; they can only **add or tighten** obligations, never loosen a core mandatory one.
149
+
150
+ ## Install for your IDE
151
+
152
+ Dry runs by default — inspect conflicts, then repeat with `--apply`. Existing user-owned files are never silently overwritten.
153
+
154
+ ```sh
155
+ npx llm-orchestrator install --project /path/to/app --harness codex
156
+ npx llm-orchestrator install --project /path/to/app --harness claude-code
157
+ npx llm-orchestrator install --project /path/to/app --harness opencode
158
+ npx llm-orchestrator install --project /path/to/app --harness kilo
159
+ ```
160
+
161
+ `npx llm-orchestrator` (or the bare `llm-orchestrator` after `npm install -g llm-orchestrator`) is
162
+ the entry point. From a clone the same commands are `node bin/llm-orchestrator.mjs ...`; every
163
+ example below spells the clone form, and the npm form is identical minus the `node bin/…` prefix.
164
+ `node bin/install.mjs ...` (same options) still works underneath it.
165
+
166
+ `--skills-root` is optional: it defaults per harness (`codex` → `~/.agents/skills`, `claude` → `~/.claude/skills`, `opencode` → `~/.config/opencode/skills`, `kilo` → `~/.kilo/skills`), so the four commands above are already complete — pass `--skills-root <dir>` only to override that default. `claude`, `claude-code`, and `claude code` resolve to the same harness.
167
+
168
+ `--package-root <dir>` (where the package's own files are read from) and `--state-root <dir>` (where the installation manifest is kept; defaults to `$XDG_STATE_HOME/portable-orchestrator` or `~/.local/state/portable-orchestrator`) exist on `install`, `uninstall` and `init` for testing and for non-standard layouts — you normally leave both alone.
169
+
170
+ Multiple harnesses may share one explicitly enabled skill root using a comma-separated `--harness` value; when you don't pass `--skills-root` in that case it defaults to the shared `~/.agents/skills`, and *you* must ensure every selected harness is actually pointed at that root (see "Several harnesses at once" below). Add `--with-agents` to also render one agent file per role in `registries/agent-roles.json` under the per-harness agent directory (`.claude/agents/`, `.opencode/agent/`, `.kilo/agent/`; no-op for Codex). Add `--link-claude` to have the installer create the `~/.claude/skills/orchestrate-core -> <skills-root>/orchestrate-core` symlink itself when Claude is one of several harnesses sharing a non-default root (idempotent; it never replaces a real directory). Restart/reload a session whose skill catalog is cached.
171
+
172
+ Each rendered agent carries native frontmatter for its harness: Claude Code gets `disallowedTools: Write, Edit, NotebookEdit` on an edit-denied role (read-only roles and the orchestrator); OpenCode and Kilo get `mode: subagent` (`primary` for the orchestrator) and `permission: edit: deny` on the same roles. Edit denial does not sandbox shell writes: it removes the edit tools only, and read-only roles keep Bash for inspection; the rendered Permissions section tells them never to write through the shell, and a hard boundary needs the harness's own shell permissions. On OpenCode and Kilo, the rendered `general.md` and `explore.md` share their names with the built-in `general` and `explore` subagents and replace their prompts project-wide. That is intended: the role ids are what the flow gate classifies dispatches by, and the replacements stay bounded (`general`, RW within its owned files) or read-only (`explore`).
173
+
174
+ **Install once, for every project — `--global`.** A project install steers one project. `--global`
175
+ takes no `--project`: it writes to the harness's own user-scope configuration, so orchestrate-core
176
+ engages in every project you open with that harness, with nothing to add per project.
177
+
178
+ ```sh
179
+ npx llm-orchestrator install --global --harness codex # dry run: prints the plan
180
+ npx llm-orchestrator install --global --harness codex --apply
181
+ npx llm-orchestrator uninstall --global --harness codex --apply # that harness only
182
+ npx llm-orchestrator uninstall --global --apply # everything a global install wrote
183
+ ```
184
+
185
+ | Harness | What `--global` writes (relative to your home directory) |
186
+ | --- | --- |
187
+ | Codex | a managed span in `.codex/AGENTS.md`; marked flow-hook groups merged into `.codex/hooks.json` (trust them once in `/hooks`). `CODEX_HOME` replaces `.codex` when set |
188
+ | Claude Code | a managed span in `.claude/CLAUDE.md`; marked flow-hook groups merged into `.claude/settings.json` — skipped, and listed under `skipped`, when the llm-orchestrator plugin is enabled, because the plugin already ships those hooks and both would fire |
189
+ | OpenCode | a managed span in `.config/opencode/AGENTS.md`; the flow plugin at `.config/opencode/plugins/orchestrate-flow.js`. `XDG_CONFIG_HOME` replaces `.config` when set, for Kilo too |
190
+ | Kilo | a managed span in `.config/kilo/AGENTS.md` (created when absent); no hooks — no user-scope plugin directory is verified for Kilo, so the plan lists it under `skipped` and a project install adds them per project |
191
+
192
+ The runtime is copied to the skills root as usual, since the hooks call it. Everything written is
193
+ delimited and recorded in one manifest per home directory, which also records the skills root: a
194
+ second run changes nothing, a later run with more harnesses extends the same install (and keeps
195
+ that skills root unless you pass `--skills-root`), and `uninstall --global` removes exactly those
196
+ spans, hook groups and files — for the harnesses named, or all of them when `--harness` is omitted
197
+ — leaving the rest of each file byte for byte. The runtime copy under the skills root stays, as on a project uninstall
198
+ (`retained_shared_runtime` lists it), because other installs may share it. A file this package did not write is never replaced — an existing
199
+ `orchestrate-flow.js` of your own, or a hooks file that is not plain JSON, is reported under
200
+ `conflicts`, and `conflict_reasons` says why for each path. A harness in conflict is skipped whole
201
+ and listed under `skipped`; the harnesses without one are applied (`applied_harnesses`), and the
202
+ exit status is non-zero only when nothing could be applied. Move the file away and run the command
203
+ again to add the skipped harness. `--no-flow-hooks` installs the instruction spans alone, but it
204
+ applies to the whole install, not to one harness. A symbolic link of your own (a dotfile manager's
205
+ `~/.claude`, a linked `CLAUDE.md`) is written through, never replaced, as long as it resolves to a
206
+ regular file or directory inside the install root; one that leaves it is a conflict. A global
207
+ install only writes inside the home directory, so a `CODEX_HOME` or `XDG_CONFIG_HOME` outside it
208
+ skips that harness. `--home <dir>` says where user scope is (default: your home directory) and rebases the
209
+ default skills, state and Codex prompts roots under it — for tests and non-standard layouts; with
210
+ it, `CODEX_HOME` and `XDG_CONFIG_HOME` are ignored.
211
+
212
+ A project opts out of a global install — and of the Claude Code plugin — with any one of: a
213
+ `.orchestrator-off` file in its root, a line `orchestrate-core: off` in its `AGENTS.md` or
214
+ `CLAUDE.md`, or `LLM_ORCHESTRATOR_OFF=1` in the environment (see "Flow adherence").
215
+
216
+ ### Step by step
217
+
218
+ Same five steps for every harness; only the skills root and the reload differ.
219
+
220
+ 1. **Get the package** (Node 22+) — either straight from npm:
221
+ ```sh
222
+ npx llm-orchestrator --help # or: npm install -g llm-orchestrator
223
+ ```
224
+ or from a clone, when you want to read or pin the source:
225
+ ```sh
226
+ git clone https://github.com/tbogdan/llm-orchestrator.git
227
+ cd llm-orchestrator && npm test
228
+ ```
229
+ 2. **Dry run** against your application — nothing is written, conflicts are listed:
230
+ ```sh
231
+ node bin/llm-orchestrator.mjs install --project /path/to/app --harness <harness>
232
+ ```
233
+ 3. **Apply** the same command with `--apply`. Re-running is idempotent; a file you edited by hand is reported as a conflict, never overwritten.
234
+ 4. **Add project bindings** to `/path/to/app/AGENTS.md` (template below, or run `init --apply` to append it automatically when the section is missing). `install` reports `bindings.present` and, when false, the exact `init --apply` command. The core reads this section on every task; without it the core still runs with its generic matrix.
235
+ 5. **Verify and reload**: `node bin/llm-orchestrator.mjs doctor --project /path/to/app --harness <harness>` must list every mandatory core tool as `present` (or as a declared gap with an install hint). Then reload the harness session so the skill catalog is refreshed.
236
+
237
+ `node bin/llm-orchestrator.mjs init --project /path/to/app` runs steps 2, 4 (report only) and 5 together, before you commit to a harness — it proposes `--harness` from what it detects, shows the same dry-run plan, and lists exactly which of the 8 mandatory tools are missing with an install command for each.
238
+
239
+ | Harness | `--harness` | `--skills-root` | Where things land | Reload |
240
+ | --- | --- | --- | --- | --- |
241
+ | Codex | `codex` | `~/.agents/skills` (default) | `AGENTS.md` span, `.agents/skills/orchestrate/SKILL.md`, `~/.codex/prompts/*.md` | new Codex session |
242
+ | Claude / Claude Code | `claude` | `~/.claude/skills` (or symlink it to `~/.agents/skills/orchestrate-core`) | `.claude/commands/*.md`, `CLAUDE.md` gets `@AGENTS.md`, `--with-agents` → one agent file per role under `.claude/agents/` | `/reload` or new session |
243
+ | OpenCode | `opencode` | `~/.config/opencode/skills` | `.opencode/commands/*.md`, `--with-agents` → one agent file per role under `.opencode/agent/` | restart `opencode` |
244
+ | Kilo | `kilo` | `~/.kilo/skills` | `.kilo/commands/*.md`, `--with-agents` → one agent file per role under `.kilo/agent/` | restart Kilo / `kilo debug skill --pure` to confirm discovery |
245
+
246
+ Several harnesses at once: `--harness codex,claude,opencode,kilo --skills-root ~/.agents/skills`, then make sure each IDE is pointed at that root (Claude Code accepts a personal skill-folder symlink; OpenCode and Kilo need the root enabled in their config).
247
+
248
+ #### Project bindings template (paste into AGENTS.md)
249
+
250
+ ```markdown
251
+ ## Orchestration bindings (project)
252
+
253
+ Generic rules live in `orchestrate-core`; this section only adds or tightens.
254
+
255
+ **Mandatory on every task (project):**
256
+
257
+ | What | When |
258
+ |---|---|
259
+ | `<your compat / schema / lint check command>` | any API or schema change |
260
+
261
+ **MCP servers confirmed live:** `context7`, `mempalace`, `<your MCPs>`. If a call fails, say the server is unreachable — never silently fall back.
262
+
263
+ **Per task type (Mandatory | Optional (trigger) | Available):**
264
+
265
+ | Task type | Mandatory | Optional | Available |
266
+ |---|---|---|---|
267
+ | FEATURE | failing test first | `context7` (any library API) | … |
268
+ | BUG_FIX | reproduce before fixing | `playwright` (UI-visible) | … |
269
+
270
+ **Risk floors (override upward only):** `<area>` → implementation `<tier>`, independent review `<tier>`.
271
+
272
+ **Agent defaults:** `<role>` → `<tier>` (W T0–T1 / S T2 / S T3 / X T3 …).
273
+ ```
274
+
275
+ ### Per-harness notes
276
+
277
+ - **Codex** reads `AGENTS.md` plus `.agents/skills/*/SKILL.md`; custom prompts install to `~/.codex/prompts/*.md` (or `--codex-prompts-root <dir>`); subagents dispatch via `spawn_agent`, plans via `update_plan`.
278
+ - **Claude Code** installs `.claude/commands/*.md`, `.claude/agents/*.md` (with `--with-agents`), `.claude/skills/*/SKILL.md`, and adds `@AGENTS.md` to `CLAUDE.md`; subagents dispatch via the Agent tool.
279
+ - **OpenCode** installs `.opencode/command(s)/*.md`, `.opencode/agent/*.md` (with `--with-agents`), skills under `~/.config/opencode/skills`; subagents dispatch via the task tool. Sequential Thinking's permission key is `sequentialthinking_sequentialthinking`.
280
+ - **Kilo** installs `.kilo/command(s)/*.md`, `.kilo/agent/*.md` (with `--with-agents`), skills under `~/.kilo/skills`/`.kilo/skills`; Agent Manager worktrees live under `.kilo/worktrees/`. Same Sequential Thinking permission key as OpenCode.
281
+
282
+ ### Flow adherence
283
+
284
+ Agents tend to skip a mandatory skill out of habit — they see a quick lookup, reach for `grep` or
285
+ `ssh`, and never classify or plan. The installer adds small hooks that steer instead of relying on
286
+ more instructions:
287
+
288
+ - When the main agent starts working on a prompt with no orchestrate-core run open, the model gets
289
+ one sentence (`additionalContext`, invisible in your conversation) pointing it back at the flow:
290
+ classify, then `llm-orchestrator run start --type <TYPE>`, or declare the task trivial with
291
+ `llm-orchestrator run start --trivial "<reason>"`. Once per prompt, never for subagents, never for
292
+ reading the orchestration instructions.
293
+ - The first prompt of a session gets one more sentence, once per session: orchestrate-core is
294
+ mandatory here, load the skill (Claude Code: the Skill tool, `orchestrate-core` or the plugin's
295
+ `llm-orchestrator:orchestrate-core`; elsewhere the installed skill or the bridge), classify, open a
296
+ run — and how a project opts out. It arrives on `SessionStart` or `UserPromptSubmit`, whichever
297
+ fires first, and never again once the skill was loaded in the session. Until then the work
298
+ reminder above also says to load the skill first.
299
+ - **One tool call is refused: an unrouted subagent start.** A subagent (`Agent`/`Task` on Claude
300
+ Code, `spawn_agent` on Codex, `task` on OpenCode and Kilo) starts only inside a typed run and after
301
+ a `llm-orchestrator dispatch` (or `budget spend`) paid for it; one dispatch pays for one subagent.
302
+ Otherwise the `PreToolUse` hook answers `permissionDecision: "deny"` with the command to run, and
303
+ the OpenCode/Kilo plugin throws the same sentence. A subagent's own helpers are not checked.
304
+ `LLM_ORCHESTRATOR_NO_ENFORCE=1` turns the refusal back into a once-per-run reminder; `doctor`
305
+ counts `denied_dispatches`.
306
+ - **Other refusals, each where a reminder alone was ignored in real sessions.** `run start` is
307
+ refused until the `orchestrate-core` skill was loaded in the session (the command line alone
308
+ leaves out routing, roles and tools). `--inline` is refused on a plan of more than one shard. On a
309
+ trivial run that has outgrown one line, the next edit is refused until the run is reopened as
310
+ typed. With no run open, a file change or a command other than reading is refused after the first
311
+ reminder of the prompt; reading and searching stay allowed. In a typed run on Claude Code, an
312
+ `Agent` call with a generic type (`general-purpose`, or none) is refused in favour of a named
313
+ role. At turn end, a typed run that ends on a plain-text question is sent back once to ask it
314
+ through the question tool. A mandatory tool reminded and still unused three work calls later
315
+ holds back changes (reads stay allowed) until it is used — by the main thread or a subagent — or
316
+ skipped: by the user's decision, or as unavailable in this session
317
+ (`tools skip <tool> --reason "unavailable: <what failed>"`). A run of several shards whose main
318
+ thread keeps editing four work calls after the dispatch reminder has its edits refused until it
319
+ dispatches or reopens as one stateful shard. `run close` is sent back once when the run did real
320
+ work without its verification pass or memory checkpoint, or used a frontier model (the advisor
321
+ role, `fable`/`astra`, `strategy advisor --run`) without a `strategy add`; the next close goes
322
+ through and records `closed_without`. `LLM_ORCHESTRATOR_NO_ENFORCE=1` turns every refusal back
323
+ into a reminder. Every other tool call passes; the handler fails open on any error and is wrapped so a
324
+ missing runtime is a silent no-op.
325
+ - **One thing is decided, at the end of a turn.** When a typed run is still open and the model's
326
+ last message announces more work instead of doing it ("Next, I'll…", "I will now…"), the `Stop`
327
+ hook answers `decision: "block"` with one sentence: continue, or ask the user explicitly, or
328
+ verify and close the run. It never fires when the message ends with a question to you, when the
329
+ model says it is waiting on background work or the harness reports background tasks, for a
330
+ subagent, for a trivial run or with no run open. At most two continuations per prompt. Only the
331
+ end of the message is classified and nothing of it is stored; the audit counts
332
+ `forced_continues`. The allowance is restored by a tool call, so only a model that keeps talking
333
+ without working is bounded; work that waits for your approval ("once you approve…") and quoted or
334
+ code text never count. `LLM_ORCHESTRATOR_NO_CONTINUE=1` switches it off. Claude Code and Codex honour
335
+ it; OpenCode and Kilo have no documented way to continue a turn, so there it is not sent.
336
+ - **Tool reminders.** The gate records which tool each call uses and reminds once per run when a
337
+ mandatory or recommended one should have been used by now: memory recall and checkpoint
338
+ (`mempalace`), decision checkpoints (`sequentialthinking`), `exa` on a plain web search,
339
+ `context7` when a dependency changes, `impeccable` on interface code, `serena` after a streak of
340
+ plain code searches, `systematic-debugging` on a bug, `test-driven-development` when production
341
+ code is edited, `playwright` on a UI bug, `copywriting` on prose, and
342
+ `verification-before-completion` when the run closes. The rules are data
343
+ (`registries/tool-use.json`). The gate sees the main thread only, and a reminder is a sentence,
344
+ never a denial.
345
+ - **A tool you do not want.** `llm-orchestrator tools skip <tool> --reason "<why>"` stops its
346
+ reminder in this project (`--global`: everywhere); `tools unskip <tool>` undoes it and
347
+ `tools status` lists rules and skips. A line `orchestrate-core: skip <tool>` in `AGENTS.md` or
348
+ `CLAUDE.md`, or `LLM_ORCHESTRATOR_SKIP_TOOLS=<tool>`, does the same. The work then carries a
349
+ `degraded: <tool>` line. The agent is told to skip only on your word.
350
+ - **Routed dispatches.** See the refusal above and "Cost-aware routing". `doctor` counts
351
+ dispatches, refused and unrouted dispatches, and runs that dispatched without a strategy decision.
352
+ - **The project's own tools.** With the first-prompt notice, the session is told once which MCP
353
+ servers and skills the project declares (`.mcp.json`, harness configuration, project skill
354
+ folders) — names only — so they are used in place of a generic equivalent.
355
+ - Each project keeps a ledger in `.orchestrator-run/` (self-gitignored): ids, task types, counts
356
+ and timestamps only — never prompts, tool inputs or file contents. `doctor` reports it under
357
+ `flow.adherence`: runs, trivial declarations, tasks that skipped the flow, runs started outside
358
+ it, runs opened without a PlanShard count, runs that planned several shards but started no
359
+ subagents, and runs still open.
360
+ - Trivial is the narrow exception — a one-line change such as a typo or a version bump. A run
361
+ declared trivial that then edits a second file, touches tests, queries a live source twice, or keeps
362
+ working past eight calls (an investigation is not trivial) gets one reminder to reopen it as
363
+ a typed run, and counts as `trivial_overreach` in the audit. Trivial runs close at the end of the
364
+ turn (`Stop` hook), so single-prompt sessions still reach the history. Typed runs stay open across
365
+ turns and close when the session ends (`SessionEnd`), so an unclosed run is never lost.
366
+ - Subagents are counted once each: resuming one (SendMessage) is not a new dispatch. Each is also
367
+ classified by its agent type — one of the orchestrator's roles, or a generic agent such as
368
+ `general-purpose` — and the dispatch reminder names the roles of the task's flow. The audit
369
+ reports `role_dispatches`, `generic_dispatches` and `runs_without_roles`. The Claude Code plugin
370
+ ships the roles as agents (`llm-orchestrator:<role>`), so they are available without a project
371
+ install.
372
+ - A run opened with two or more shards whose main thread keeps doing the work — two work calls per planned shard (one per shard in incident, investigation and research flows, whose reads *are* the shards, with one firmer follow-up if the first reminder is ignored and the evidence is live — `ssh`, remote databases, cluster/cloud CLIs, HTTP; a few small local files are fine read inline), no
373
+ subagent started — gets one more sentence: dispatch the independent shards (searching for the
374
+ Agent tool if it is deferred), or declare the chain inline with
375
+ `run start --type <T> --shards <n> --inline "stateful:<what>"`. Work is inline only while it holds
376
+ live state a subagent cannot inherit (a browser mid-flow, an interactive shell); independent reads
377
+ are never inline. The audit adds `inline_declared`, `inline_after_nudge` (an `--inline` declared only
378
+ after a dispatch reminder — a retroactive justification) and `below_fan_out` (incident, investigation
379
+ or research runs opened with fewer than two shards).
380
+ - Once the entrypoint is loaded, read-only discovery (reading files, `grep`, `git status`, tool
381
+ version checks) before `run start` is SKILL.md steps 2–3, not a deviation. An edit, a write, a
382
+ dispatch or any other shell command before the run is.
383
+ - Every project is steered unless it opts out. The hooks of a global install or of the Claude Code
384
+ plugin fire everywhere, so no per-project install or instruction line is needed. A project says no
385
+ with a `.orchestrator-off` file in its root, a line `orchestrate-core: off` in its `AGENTS.md` or
386
+ `CLAUDE.md`, or `LLM_ORCHESTRATOR_OFF=1` in the environment; it then gets no reminders and no
387
+ `.orchestrator-run/` directory, even if a run is started. Outside a project — no `.git`,
388
+ `AGENTS.md`, `CLAUDE.md` or ledger, or your home directory itself — the hooks stay silent until a
389
+ run is started there. `doctor` reports which applies under `flow.engagement`: `global`,
390
+ `per_project`, `opted_out` or `none`. It also lists under `flow.hooks.double_firing` the case
391
+ where the Claude Code plugin is enabled and a settings copy of the hooks exists as well.
392
+ - After a compaction or a resumed session (`SessionStart` with source `compact` or `resume`) an
393
+ open run is restated to the model — its type and how many planned shards were dispatched — so
394
+ the flow continues instead of being re-planned or forgotten.
395
+ - A run command counts only where the shell would run it. Text that merely contains one — a
396
+ `grep` pattern, a commit message, a comment, a heredoc body — never opens or closes a run.
397
+ - The project is the repository: a session started in a subdirectory shares the ledger and the
398
+ opt-out of the repository root.
399
+ - A shell command that carries several run commands (`… run close; … run start --type <T>`) applies
400
+ them in order: the last one is the state the session is left in.
401
+
402
+ | Harness | Where the hooks live |
403
+ | --- | --- |
404
+ | Claude Code (plugin) | the plugin's own `hooks/hooks.json` — active on `/plugin install` |
405
+ | Claude Code (CLI install) | marked entries merged into `.claude/settings.json`; the rest of the file is untouched. Skipped, and listed under `skipped`, when the plugin is enabled for you (`enabledPlugins` in `~/.claude/settings.json`, unless the project's own settings switch it off): both would answer every event. `--flow-hooks` on that run writes them anyway, for a repository shared with people who do not use the plugin |
406
+ | Codex | marked entries in `.codex/hooks.json` — trust them once in `/hooks` |
407
+ | OpenCode / Kilo | `.opencode/plugins/orchestrate-flow.js` / `.kilo/plugin/orchestrate-flow.js` (auto-loaded by each); the reminder is appended to the tool's output, since these harnesses have no pre-tool context channel — the once-per-session sentence rides on the session's first tool output for the same reason |
408
+ | Any of them, `install --global` | the same entries at user scope: `~/.claude/settings.json`, `~/.codex/hooks.json`, `~/.config/opencode/plugins/orchestrate-flow.js` (none for Kilo) |
409
+
410
+ `install --no-flow-hooks` skips them (and withdraws hooks an earlier install wrote); the choice is
411
+ remembered until `--flow-hooks` turns them back on. `uninstall` removes exactly the marked entries
412
+ and restores the rest of each file as it was.
413
+
414
+ ### Uninstall
415
+
416
+ ```sh
417
+ node bin/llm-orchestrator.mjs uninstall --project /path/to/app --harness codex
418
+ node bin/llm-orchestrator.mjs uninstall --project /path/to/app --harness codex --apply
419
+ ```
420
+
421
+ Dry run first, then `--apply`. It removes only unchanged, package-owned files it installed — never a file a human has since edited, and never user tools or provider credentials. A hand-edited `AGENTS.md` span or command file is reported under `preserved`, left exactly as you wrote it, and the (now orphaned) manifest entry for it is dropped so a future reinstall treats it as fresh. The shared `orchestrate-core` runtime under `--skills-root` is only removed by uninstalling the last project that references it; `retained_shared_runtime` in the JSON output lists what stayed.
422
+
423
+ ## Using it from an already-installed project
424
+
425
+ Once a harness has the core installed and its skill catalog reloaded, nothing further is required from you: the harness's own bootstrap step (Codex's `AGENTS.md` sentence, Claude's `@AGENTS.md` import, or the native `/orchestrate`-style command) loads `orchestrate-core` on the **first prompt of the session**, before any planning happens. That load does three things in order:
426
+
427
+ 1. **Bootstrap** — the entrypoint skill is discovered and read (this is itself the first of the 8 mandatory core tools).
428
+ 2. **Mandatory check** — the remaining 7 core tools (`memory.recall`/`memory.checkpoint` via MemPalace, `reasoning.checkpoints` via Sequential Thinking, `communication.concise` via caveman, `shell.rtk`, `docs.current` via context7, `research.retrieve` via Exa) are checked for live evidence, not assumed present from a config file.
429
+ 3. **Degraded rule** — for any of those that are missing, the orchestrator states the gap *first*, recommends the exact install command once, and only continues after an explicit user refusal — carrying a `degraded: <capability>` line on every plan, handoff and final report from then on for that session. It never falls back silently.
430
+
431
+ From there, the `/task` family (`/task`, `/task-plan`, `/task-status`, `/task-verify`, `/task-cancel`) and the `/incident-*` lifecycle commands are available in whatever native form the harness renders (see "Usage once installed" below). Cost-aware routing is available directly from the shell at any time:
432
+
433
+ ```sh
434
+ node bin/llm-orchestrator.mjs route --task FEATURE --phase implementation --role backend-fixer --complexity MODERATE --harness claude
435
+ ```
436
+
437
+ This resolves (task type, phase, role, risk, complexity, context size, harness) to a tier, thinking level, a ranked list of eligible models with a $/task estimate, the independent-review floor and the fan-out minimum — the same resolution the orchestrator uses internally, callable standalone for planning or auditing a routing decision.
438
+
439
+ ## Cost-aware routing (built in)
440
+
441
+ Routing is data, not prose: `registries/routing-matrix.json` encodes the W/S/X/F tiers, the T0–T5 thinking levels with their per-provider controls (`effort` on Claude, `reasoning_effort` on Codex, budget-only on Haiku), the tier × thinking resolution table, default routing, the per-task-type flows (phase → pair → roles → gate), 21 risk-floor areas with implementation and independent-review floors, agent defaults, both escalation ladders, fan-out minimums (2 MODERATE / 3 COMPLEX / 4 CRITICAL), the target tier distribution and the quota degradation ladder. `models/top-models.json` carries the model registry — 33 models: 19 seated on a provider ladder (the seat-holders and the models they succeeded, which stay routable as fallbacks), ten measured candidates and four priced-but-unrated models — with their supported thinking levels, list prices with the date and page each was read from (`price_as_of`, `price_source`), measured $/task per effort and thinking-cost indices (Artificial Analysis v4.3.2 snapshot, copied verbatim, never invented). `lib/router.mjs` resolves a dispatch; `bin/route.mjs` exposes it:
442
+
443
+ ```sh
444
+ node bin/llm-orchestrator.mjs route --list # vocab: task types, phases, roles, areas
445
+ node bin/llm-orchestrator.mjs route --task BUG_FIX --phase fix --area refund --risk critical --harness codex
446
+ node bin/llm-orchestrator.mjs route --task FEATURE --complexity COMPLEX --flow --provider anthropic # whole flow, $ estimate, tier histogram
447
+ node bin/llm-orchestrator.mjs route --task FEATURE --phase implementation --include-candidates --cheapest-thinking
448
+ node bin/llm-orchestrator.mjs route --task FEATURE --phase implementation --harness kilo --inventory inventory.json # seats from what the runtime exposes
449
+ ```
450
+
451
+ - `--include-candidates` ranks the ten measured candidates alongside the incumbents. They are held out by default, and an exposed candidate in a runtime inventory is admitted for noncritical lanes only — never for an independent-review seat, a T4/T5 pair or a risk-floor review row, and not for the implementation seat of a dispatch that requires an independent reviewer. The same seats are closed to a free variant (`…:free`) and to a gateway variant (an id whose vendor segments do not name the model's provider, such as `ollama/kimi-k3`), and an unmeasured successor is never promoted into one: the measured predecessor keeps the seat and the successor is listed as the alternative, `unmeasured: not seated for critical review`.
452
+ - `--trust-configured` seats models that an inventory only marks `configured` — read from the harness configuration by `models discover --config`, dispatch not proven. Without it such an inventory seats nothing and the output says why; with it every seat carries the label "configured, not verified in this session".
453
+ - `--cheapest-thinking` (with `--max-score-loss <n>`, default 2) returns the lowest-cost (model, effort) whose measured score is within that many displayed points of the incumbent config for the resolved pair — the thinking-cost optimisation, in one line.
454
+ - `--provider <name>` ranks one provider's models. Any provider in the registry is accepted (`route --list` prints them: openai, anthropic, google, xai, meta, moonshot and the rest) — the list is read from the registry, not hard-coded.
455
+ - `--kind <default-routing kind>` overrides the starting row of the resolution order; `--context-tokens <n>` feeds the context axis (the W working-set cap, and the seated model's own repricing threshold — Haiku 5.5 above a 100K prompt, the Codex models above 272K); `--json` prints the machine-readable form of any of the above.
456
+
457
+ Resolution order: default routing → agent default → task-flow phase → complexity → risk floor (upward only) → context rules (the 150K W working-set cap, each seated model's own window and repricing threshold from the registry) → caps (Terra/Sol never above `high`, Fable 5.1 only with `--explicit-fable-5-1`). A runtime inventory (`--inventory`) filters the ranking to models actually exposed in the session.
458
+
459
+ **Routing adapts to what the harness exposes.** Only Claude Code and Codex have a hard-coded ladder. Any other harness or provider — OpenCode, Kilo, `--provider google` — takes each tier's seat from the inventory: the exposed registry models of that tier, cheapest measured `$/task` first, then token price index, under every admission rule. Inventory ids are matched to registry models by rule, never by resemblance: gateway and vendor prefixes (`openrouter/anthropic/claude-opus-5-5`), Bedrock and Vertex forms (`us.anthropic.claude-sonnet-5-v1:0`, `claude-sonnet-5@20260101`), free-tier suffixes (`opencode/muse-spark-1.3-contributor-free`) and dot-versus-dash spellings all resolve, and the row carries the inventory's own id as the one to dispatch. An id that does not reduce to exactly one registry model is listed as **unrated** and never seated. With nothing eligible — or with no ladder and no inventory at all — the result is `blocked: "no eligible model"`, never a quieter tier and never a default to Claude. `--flow` reports that per phase: on a harness with no ladder and no `--inventory`, every phase is `blocked: "no ladder for this harness: pass --inventory (see models discover)"` and the command exits 2; `--provider openai` or `--provider anthropic` selects a ladder explicitly. A flow total is the sum over the dispatches that have a measured `$/task`, and the mean divides by those alone; when any dispatch is unmeasured the total is marked partial (`est_total_partial`) and the cost band is not judged — `cost band not evaluated: N of M dispatches have no measured $/task`.
460
+
461
+ `models discover --harness <h>` builds that inventory from an active-session snapshot (`--input`), from the harness CLI (`--native`, OpenCode only), or from the harness configuration (`--config`: Claude Code `settings.json`, Codex `config.toml` and its models cache, OpenCode and Kilo config files; `--home <dir>` reads under another directory and overrides `CLAUDE_CONFIG_DIR`, `CODEX_HOME` and `XDG_CONFIG_HOME`, which are honoured otherwise). `--config` reads model and provider ids only — never credentials. A value in a model field is accepted only when it matches a conservative id grammar; a URL, a `user:secret@host` form, a key-shaped segment or a long opaque token is counted (`rejected: <n> value(s) that did not look like a model id`) and never echoed. A settings file or config directory whose real path leaves its root is not followed. It reports every id as `configured`, not `exposed`: a configuration entry does not prove dispatch works, so confirm it against the session before routing on it.
462
+
463
+ ### Per-shard selection, not per task
464
+
465
+ The CLI resolves one dispatch. Inside a flow, the same resolution runs **for every PlanShard, at dispatch time, against the live inventory** — `lib/dispatch-contract.mjs` exposes `buildShardRouting(shard, options)` for one shard, `buildShardContracts(flow, { inventory, harness, includeCandidates })` for all of them (returning the flow ledger: tier histogram against the target distribution, mean `$/task` over the measured shards, a partial-total marker, blocked shards, warnings), and `rerouteRemaining(flow, inventory)` when a model-not-found, a rejected effort or a quota change invalidates the inventory mid-flow — remaining shards only, so the ledger stays true. Each shard carries a `routing` block with exactly these thirteen fields: `pair`, `tier`, `thinking_level`, `model_requested`, `effort_requested`, `model_effective`, `effort_effective`, `review_floor`, `independent_review`, `selection_reason`, `inventory_revision`, `price_source`, `est_usd_per_task`. An inventory that exposes nothing eligible for the resolved tier yields `blocked: "no eligible model"` — the floor is never lowered to fit what happens to be available.
466
+
467
+ ### Shortlisted models and thinking levels (benchmark snapshot 2026-09-23)
468
+
469
+ Incumbents hold a seat on a provider ladder; a model that succeeded another on list price holds the seat and the older one stays as its fallback. Models added after the benchmark snapshot are **unmeasured**: Artificial Analysis now publishes v5.0.2, this dataset is pinned to v4.3.2, and the two are not mixed — so those models are placed by list price and provider succession, never by score, and carry no `$/task`. Candidates are measured but unseated: their tier is a `tier_bands` placement from the best measured Artificial Analysis score (W ≤ 37, S 38–44, X 45–50, F ≥ 51), and they rank only with `--include-candidates` or an inventory that exposes them.
470
+
471
+ | Model | Provider | Ladder | Admission | Tier | Thinking levels | $ in / out per MTok | Price read |
472
+ |---|---|---|---|---|---|---|---|
473
+ | GPT-5.6 Luna | openai | codex | incumbent (fallback for GPT-6 Luna) | W | low, medium, high, xhigh, max (reasoning_effort) | $0.2 / $1.2 | 2026-09-22 |
474
+ | GPT-6 Luna | openai | codex | incumbent (succeeds GPT-5.6 Luna) | W | none, low, medium, high, xhigh, max (reasoning_effort) | $0.1 / $0.5 | 2026-09-23 |
475
+ | GPT-5.6 Terra | openai | codex | incumbent (fallback for GPT-6.1 Terra) | S | low, medium, high, xhigh, max (reasoning_effort) | $2 / $12 | 2026-09-22 |
476
+ | GPT-6.1 Terra | openai | codex | incumbent (succeeds GPT-5.6 Terra) | S | none, low, medium, high, xhigh, max (reasoning_effort) — unmeasured | $1 / $5 | 2026-12-01 |
477
+ | GPT-5.6 Sol | openai | codex | incumbent (fallback for GPT-6 Sol) | X | low, medium, high, xhigh, max (reasoning_effort) | $4 / $20 | 2026-09-22 |
478
+ | GPT-6 Sol | openai | codex | incumbent (succeeds GPT-5.6 Sol; fallback for GPT-6.2 Sol; keeps X T4 and every review X seat; holds the S seat one notch down) | S, X | low, medium, high, xhigh, max (reasoning_effort) | $2 / $10 | 2026-09-23 |
479
+ | GPT-6.1 Sol | openai | codex | incumbent (no seat of its own) | X | low, medium, high, xhigh, max (reasoning_effort) — unmeasured | $2 / $10 | 2026-12-01 |
480
+ | GPT-6.2 Sol | openai | codex | incumbent (succeeds GPT-6 Sol on non-critical X T2/T3 only) | X | low, medium, high, xhigh, max (reasoning_effort) — unmeasured | $2 / $10 | 2026-12-01 |
481
+ | GPT-6 Astra | openai | codex | incumbent (fallback for GPT-6.2 Astra; keeps F T4, F T5 and every review F seat) | F | low, medium, high, xhigh, max (reasoning_effort) | $10 / $50 | 2026-09-22 |
482
+ | GPT-6.2 Astra | openai | codex | incumbent (succeeds GPT-6 Astra on non-critical F T3 only) | F | low, medium, high, xhigh, max (reasoning_effort) — unmeasured | $8 / $40 | 2026-12-01 |
483
+ | Claude Haiku 4.5 | anthropic | claude | incumbent (fallback for Claude Haiku 5.5; keeps every review W seat) | W | disabled, enabled (budget_tokens) | $1 / $5 | 2026-09-22 |
484
+ | Claude Haiku 5.5 | anthropic | claude | incumbent (succeeds Claude Haiku 4.5) | W | low, medium, high, xhigh, max (effort) — unmeasured | $0.1 / $0.5 (≤100K prompt), $0.5 / $2.5 above | 2026-12-01 |
485
+ | Claude Sonnet 5 | anthropic | claude | incumbent (fallback for Claude Sonnet 5.5; keeps every review S seat) | S | low, medium, high, xhigh, max (effort) | $2 / $10 | 2026-09-22 |
486
+ | Claude Sonnet 5.5 | anthropic | claude | incumbent (succeeds Claude Sonnet 5) | S | low, medium, high, xhigh, max (effort) — unmeasured | $2 / $10 | 2026-12-01 |
487
+ | Claude Opus 5 | anthropic | claude | incumbent (fallback for Claude Opus 5.5) | X | low, medium, high, xhigh, max (effort) | $5 / $25 | 2026-09-22 |
488
+ | Claude Opus 5.5 | anthropic | claude | incumbent (succeeds Claude Opus 5) | X | low, medium, high, xhigh, max (effort) | $4 / $20 | 2026-09-22 |
489
+ | Claude Fable 5 | anthropic | claude | incumbent (fallback for Claude Fable 5.2; keeps F T4, F T5 and every review F seat) | F | low, medium, high, xhigh, max (effort) | $10 / $50 | 2026-09-22 |
490
+ | Claude Fable 5.2 | anthropic | claude | incumbent (succeeds Claude Fable 5 on non-critical F T3 only) | F | low, medium, high, xhigh, max (effort) — unmeasured | $8 / $40 | 2026-12-01 |
491
+ | Claude Fable 5.1 | anthropic | claude | incumbent (≤2% cap, explicit only) | F | low, medium, high, xhigh, max (effort) | $10 / $50 | 2026-09-22 |
492
+ | Grok 4.7 | xai | — | unrated | — (unrated) | low, medium, high, xhigh (reasoning_effort) | $2 / $6 | 2026-12-01 |
493
+ | Muse Spark 1.3 | meta | third-party | candidate (deprecated; successor Muse Wonder) | X (48) | xhigh, max (provider-default) | $1.25 / $4.25 | 2026-09-22 |
494
+ | Grok 4.6 | xai | third-party | candidate | S (44) | low, medium, high, xhigh (reasoning_effort) | $2 / $6 | 2026-12-01 |
495
+ | MiMo V2.6 Pro | xiaomi | third-party | candidate | X (46) | default (provider-default) | $0.435 / $0.87 | 2026-09-22 |
496
+ | Gemini 3.8 Flash | google | third-party | candidate | S (41) | low, medium, high (provider-default) | $0.75 / $3.75 | 2026-12-01 |
497
+ | Gemini 4 Carbon | google | — | unrated | — (unrated) | default (provider-default) — unmeasured | $4 / $20 | 2026-12-01 |
498
+ | Gemini 4 Neon | google | — | unrated | — (unrated) | default (provider-default) — unmeasured | $3 / $15 | 2026-12-01 |
499
+ | Gemini 4 Hydrogen | google | — | unrated | — (unrated) | default (provider-default) — unmeasured | $1.5 / $7.5 | 2026-12-01 |
500
+ | Qwen3.8 Max | alibaba | third-party | candidate | X (45) | default (provider-default) | $2 / $6 | 2026-09-22 |
501
+ | GLM 5.3 | z.ai | open | candidate | X (45) | max (provider-default) | $1.4 / $4.4 | 2026-09-22 |
502
+ | GLM 5.3 Flash | z.ai | open | candidate | S (42) | default (provider-default) | $0.15 / $0.5 | 2026-09-22 |
503
+ | Kimi K3 | moonshot | open | candidate | S (44) | low, max (provider-default) | $3 / $15 | 2026-09-22 |
504
+ | DeepSeek V4.1 Flash | deepseek | open | candidate | S (39) | max (provider-default) | $0.3 / $1.2 | 2026-09-22 |
505
+ | MiniMax M3 | minimax | open | candidate | W (29) | default (provider-default) | $0.3 / $1.2 | 2026-09-22 |
506
+
507
+ `control: provider-default` means the real thinking parameter is unverified for that model — dispatch the provider default and never send an invented effort enum. Data retention and endpoint eligibility are unknown for every candidate: no secrets, PII, production tokens or credential-bearing code.
508
+
509
+ Prices and measured costs are dated evidence, not live tariffs; refresh `models/` before relying on the numbers. Gemini 3.8 Flash reprices to $1.50 / $7.50 on 2027-01-01.
510
+
511
+ ### One command before every dispatch
512
+
513
+ ```bash
514
+ llm-orchestrator dispatch --task-type FEATURE --phase implementation --role backend-fixer --tags api,validation
515
+ ```
516
+
517
+ ```text
518
+ dispatch: S T2 — claude-sonnet-5-5 (effort medium), role backend-fixer
519
+ why: default routing (standard_implementation) → S T2; agent default for backend-fixer → S T2
520
+ learning: normal — no stored strategy and no trigger for the advisor; run as routed
521
+ budget: recorded as task; frontier 0 in window (0.0% of cap 10%)
522
+ next: pass the model and the thinking level in the dispatch itself; a subagent does not inherit them
523
+ ```
524
+
525
+ It runs `route`, `strategy decide` and `budget spend` in order, so the cost-effective choice is the
526
+ default path. The brief says which model and thinking level to pass, whether a strategy card from an
527
+ earlier run should be injected (and the cheap tier kept), whether one advisor consult or an upgrade
528
+ is useful and in budget, and whether an independent reviewer is required. A frontier dispatch over
529
+ the cap falls back one tier and says so. Add `--dry-run` to decide without writing the ledger. The
530
+ three commands remain available on their own.
531
+
532
+ ## Advisor, strategy cards and the frontier budget
533
+
534
+ A frontier model (tier F: Fable, Astra and their equivalents) is consulted at a decision point, and what it decides is kept, so the normal model handles that kind of task next time. Three things make that work without raising consumption:
535
+
536
+ - **The frontier tier advises; the routed tier works.** The `advisor` role (read-only, F T3) receives a decision packet of at most 50 lines at a plan, design, hypothesis, synthesis or analysis decision, at most twice per task, and only when no usable stored strategy matched and the task is COMPLEX, CRITICAL or novel — or after a failed verifier that one step up the escalation ladder did not fix.
537
+ - **Distillation is passive.** The advisor's answer *is* the strategy card: cues, single steps written as "when cue, do action, check result", traps and a verification, in at most 60 lines and with no finished output. There is no replay and no with-and-without comparison run. A card starts `provisional` and is validated by the next real task of its class, on the normal model, through the gates that task runs anyway.
538
+ - **The cap is counted.** At most 10% of the last 100 dispatches may run on tier F, and at most 3% may be exploratory upgrades of small tasks, inside that 10% and only while frontier use is under 7%. A frontier dispatch that a risk floor requires always runs and is counted.
539
+
540
+ ```sh
541
+ # For a decision shard, or any shard about to use tier F: inject a card, consult the advisor, explore, or run as routed
542
+ node bin/llm-orchestrator.mjs strategy decide --task-type FEATURE --phase plan --area api-crud --tags rest,pagination --complexity COMPLEX --task T-42
543
+
544
+ # Before every dispatch: check the cap and write the ledger line in one step (exit 2 = refused, nothing written)
545
+ node bin/llm-orchestrator.mjs budget spend --tier F --kind advisor --signature "FEATURE/plan/api-crud" --task T-42
546
+ node bin/llm-orchestrator.mjs budget spend --tier S --signature "FEATURE/plan/api-crud" --task T-42
547
+ node bin/llm-orchestrator.mjs budget status
548
+
549
+ # After the task passed its gates: keep the advisor's card, and score a card that was used
550
+ node bin/llm-orchestrator.mjs strategy add --task-type FEATURE --phase plan --area api-crud --tags rest,pagination --title "Endpoint beside an existing resource" --file card.md
551
+ node bin/llm-orchestrator.mjs strategy outcome --id s-0123456789 --result pass
552
+ node bin/llm-orchestrator.mjs strategy list
553
+ ```
554
+
555
+ | Command | What it does |
556
+ |---|---|
557
+ | `strategy decide` | Matches the task to stored cards and reads the budget, then answers `inject`, `advisor`, `explore` or `normal` with the reason, and prints the `signature` and the normalised tags to reuse. `--task-type` is one of the nine task types, `--phase` a phase of the flow by its name or its workflow label ("Plan / design"), `--area` a risk-floor area or left out; an unknown value is refused with the accepted list. `--novel` sends a decision to the advisor; `--verifier-failed` does so only for a COMPLEX or CRITICAL task or together with `--escalated` (the ladder below the frontier was tried); `--consults <n>` says how many consults the task already used; `--task <id>` keeps sibling shards of the same task from counting as repeats of its class; `--json` prints the machine-readable form |
558
+ | `strategy advisor` | Prints the advisor's full brief for a decision `--packet <file>` and how `--harness <claude\|codex\|opencode\|kilo>` can reach a larger model: a native advisor tool, a subagent on the frontier `--model <id>`, that harness's own headless CLI, or, with no larger model exposed, a declared degraded same-model consult. `--run` executes the headless CLI and prints the answer; it first spends from the budget (`--tier <F\|X>`, default F) and exits 2 without calling the model when the cap is spent. `--existing <id>` and `--exploration` ask for same-or-different direction against a stored card |
559
+ | `strategy match` | One card or none: exact task type, phase and area (or a wildcard on the card), then enough shared tags. A task without tags matches nothing |
560
+ | `strategy add` | Validates and stores a card (`--file card.md`, or `--file -` for standard input). It needs `--title` and at least two `--tags`, taken from the tag vocabulary first. It refuses a card that is too long, lacks the `When` / `Steps` / `Verify` sections, carries more than 40 lines of code, or matches a secret, home-path or email pattern. The same title on the same task class becomes a new revision: provisional again, counters restarted, earlier totals kept. `--kind <advisor\|exploration\|escalation>`, `--source-model <id>`, `--scope <project\|global>` |
561
+ | `strategy outcome` | `--result pass` or `--result fail` after the task's gates. Three passes and no failure in the current revision promote a card; two failures not outnumbered by passes retire it |
562
+ | `strategy explored` | `--result same` or `--result different` after an exploratory upgrade. A class found to go the same direction is not explored again for 90 days |
563
+ | `strategy list` / `show` / `retire` | Inspect the store, or retire a card by hand (`--id`) |
564
+ | `budget spend` | Checks the cap and writes one ledger line, as one locked step, so parallel dispatches cannot share the last frontier slot: `--tier <W\|S\|X\|F>`, `--kind <task\|advisor\|exploration\|review-floor>`, the `--signature` that `strategy decide` printed, and `--task <id>`. Exit 2 means refused and nothing written. `--kind review-floor` is never refused and needs `--area`: a risk-floor area whose floor is tier F (`major-architecture`, `cross-system-redesign`) |
565
+ | `budget record` | The same line for a dispatch that already happened: always written, with `over_cap: true` and a warning when it was past the cap |
566
+ | `budget check` / `status` | Read-only: whether one more dispatch would fit, and the window's shares |
567
+
568
+ Where things live: the dispatch ledger is `.orchestrator-run/dispatches.jsonl` at the repository root — the nearest directory with a `.git` entry above `--project` or the working directory (a tier, a kind, a timestamp and hashes of the signature and the task id per line, never a prompt). Cards live outside every repository, under the package state root (`--state-root`, default `~/.local/state/portable-orchestrator/strategies/`), in one scope per project plus a shared `global` scope. Only the CLI writes the card index and its counters, one writer at a time, and it keeps the previous index as `index.json.bak`.
569
+
570
+ The advisor does not depend on a harness feature. Claude Code dispatches the `advisor` agent with a model override; Codex gets the brief as a `spawn_agent` prompt; OpenCode and Kilo take a subagent's model from its agent file, so `install --with-agents --advisor-model <provider/model>` pins the `advisor` agent to your frontier model. Where none of that is possible, `strategy advisor --run` calls the harness's own CLI headless. The OpenCode and Kilo headless commands are unverified and are labelled so.
571
+
572
+ What it cannot do: no hook sees which model a harness actually ran, so the ledger is what the orchestrator declares, not a measurement — an orchestrator that never calls `budget spend` is not capped, and one that dispatches on tier F after an exit 2 is not stopped. The secret scan on cards is pattern-based and incomplete. And because nothing is replayed, a bad card is found at its second use; cards are short, one per dispatch, and retired quickly for that reason. Tasks with no deterministic verifier keep their decisions on the advisor path. The full rules are in [policies/learning.md](policies/learning.md), and every threshold is in `registries/learning.json`.
573
+
574
+ ## Updating
575
+
576
+ From npm — `npx` always resolves the latest published version, so there is nothing to pull:
577
+
578
+ ```sh
579
+ npx llm-orchestrator@latest install --project /path/to/app --harness <harness> --apply
580
+ ```
581
+
582
+ From a clone:
583
+
584
+ ```sh
585
+ git -C llm-orchestrator pull
586
+ node bin/llm-orchestrator.mjs install --project /path/to/app --harness <harness> --apply
587
+ ```
588
+
589
+ In Claude Code, the plugin updates on its own terms: `/plugin update llm-orchestrator@tbogdan`.
590
+
591
+ Re-running `install --apply` after an update is the entire update procedure — it is the same idempotent apply as a fresh install. Files the package generated and you haven't touched are refreshed to the new version; a project file you hand-edited (an `AGENTS.md` bindings section, a command you customized) is reported as a **conflict** and left untouched — nothing is overwritten silently. Resolve a reported conflict by reviewing the diff yourself and either keeping your edit or deleting the file so the next apply can regenerate it.
592
+
593
+ ## Usage once installed
594
+
595
+ The command set is listed in the [README](../README.md#the-commands). Exact command names and argument shapes are rendered per harness by `adapters/commands.mjs`; run `--help` on any installed command for the harness-native form.
596
+
597
+ ## Development
598
+
599
+ ```sh
600
+ npm test # node --test tests/*.test.mjs tests/models/*.test.mjs
601
+ node bin/llm-orchestrator.mjs doctor --project /path/to/app --harness codex
602
+ node bin/llm-orchestrator.mjs check # attribution markers
603
+ node bin/attribution-check.mjs --fix # insert missing ones
604
+ node bin/llm-orchestrator.mjs models report --check # model matrix is current
605
+ node bin/llm-orchestrator.mjs models discover --harness codex --native
606
+ ```
607
+
608
+ `models discover` writes a model-availability inventory for one harness (`--harness`) — from an
609
+ active-session snapshot (`--input`), by asking that harness's CLI (`--native`, which only OpenCode
610
+ exposes today), from the harness configuration (`--config`, optionally under `--home <dir>`; ids
611
+ only, each reported as `configured`), or, given none of them, an
612
+ explicitly `unknown` inventory rather than a guess; `--output` writes it to a file instead of stdout.
613
+ `models report` renders the matrix the router reads: `--check` fails when
614
+ `models/model-thinking-matrix.md` no longer matches `models/model-thinking-data.json`, and
615
+ `--available <inventory.json>` narrows the report to what that inventory actually exposes. Routing uses the inventory to refuse work rather than fake it: a
616
+ model the harness does not expose is never selected, and a shard whose tier has nothing eligible is
617
+ blocked instead of silently downgraded.
618
+
619
+ `docs/COHERENCE.md` names, for each cross-reference class (field names, drawer names, the 8 mandatory tools, task types, agent roles, risk-floor areas, gate labels, the bridge text, CLI flags, policy references), which file is the single source of truth. `tests/coherence.test.mjs` checks those classes mechanically, so drift fails CI instead of being discovered by a reader.
620
+
621
+ `doctor` prints project bindings, resolved mandatory gaps, and the recommended install command for each — read-only, no mutation. `check` (== `bin/attribution-check.mjs`) verifies every package-owned file carries the attribution marker described below; `--fix` inserts a missing one at the correct position for that file type. `tests/e2e-install.test.mjs` drives the real CLI as a subprocess (temp `HOME`/`XDG_STATE_HOME`, no writes outside the test's own temp directories) through install → doctor → init → uninstall for all four harnesses, plus a realistic fixture project and a `--with-agents` run; `tests/cli.test.mjs` covers help text, unknown subcommands and `check`.
622
+
623
+ ## Troubleshooting
624
+
625
+ - **A newly installed skill isn't discovered.** The harness caches its skill catalog per session — reload it (`/reload` in Claude Code, a new Codex session, restarting `opencode`/Kilo, or `kilo debug skill --pure` to confirm discovery) after any `install --apply`.
626
+ - **`install`/`uninstall` reports a conflict.** That path was hand-edited since the last install (or was never installer-owned to begin with). Nothing was overwritten. Diff it yourself; either keep your version or delete the file so the next `--apply` can (re)generate it. Multiple harnesses claiming inconsistent content for the same shared file (e.g. two different renders of the bridge) also surfaces as a conflict — install one harness at a time in that case, or confirm they'd render identically first.
627
+ - **A mandatory tool is reported missing.** Run `init` (or `doctor`) — both print the exact install command from `registries/preferred-tools.json` for each gap. Until it's installed, the orchestrator runs in declared degraded mode for that capability; it does not pretend the tool is present.
628
+ - **`--skills-root is required` no longer appears.** It used to be mandatory for non-Codex harnesses; it now defaults per harness (see "Install for your IDE"). If several harnesses share a root, make sure each IDE's own config actually points at it — `install` cannot verify a harness's native skill-discovery configuration for you, only render the files.