Model Orchestration
ASecurityRun a question past the default (cheap) panel of external reviewers in parallel, at maximum depth, with verification that each one actually did the work. `--ask` is the cheap one-shot form. Use this EVERY TIME the user asks for a "second opinion", «второе мнение», a review or verification of a document, plan or analysis by an external model, or names any of those channels; `--task` (references/tasks.md) when a CLI must DO a task («поручи CLI»). §0 is one command. 🔴 "Second opinion" without a...
- 2 stars
- 0 votes
- 0 copies
- 1 view
- Added November 29, 2026
Works with
Security analysis
92/100- Installs packages at runtime which could introduce malicious dependencies
Pro scans all 17 files and shows the line behind each finding
npx -y skills add igorsaevets/ai-second-opinion --skill model-orchestration --agent claude-codeAre you the author of Model Orchestration?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/igorsaevets-model-orchestration)---
name: model-orchestration
description: >
Run a question past the default (cheap) panel of external reviewers in parallel, at maximum
depth, with verification that each one actually did the work. `--ask` is the cheap one-shot
form. Use this EVERY TIME the user asks for a "second opinion", «второе мнение», a review or
verification of a document, plan or analysis by an external model, or names any of those
channels; `--task` (references/tasks.md) when a CLI must DO a task («поручи CLI»). §0 is one
command. 🔴 "Second opinion" without a tier/panel name = the **cheap** panel; NEVER pass
`--panel standard` unless the user explicitly asks for it (words: «стандартная», «все модели»,
«all», «standard», «full panel»). Also holds the wire parameters, CLI flag traps, retry rules,
and the checks that catch a model which silently did nothing.
user_invocable: true
---
# Model orchestration
**Before the first run on a new machine: `python <SKILL_DIR>/doctor.py`.** It probes every
prerequisite, prints the live version of each CLI, and its last line is the exact command to run
**with the real path already filled in** — so nothing in this file has to hardcode one.
`<SKILL_DIR>` below means the directory this SKILL.md sits in:
| install method | `<SKILL_DIR>` |
|---|---|
| Claude Code plugin | `${CLAUDE_PLUGIN_ROOT}/skills/model-orchestration` |
| `install.ps1`/`install.sh` | `~/.claude/skills/model-orchestration`, `~/.agents/skills/model-orchestration`, `~/.config/opencode/skills/model-orchestration` (all three) |
Fallback (no discovery): `python "$HOME/.claude/skills/model-orchestration/orchestrate.py" --ask "question"` (Win: `%USERPROFILE%/.claude/skills/model-orchestration/orchestrate.py`)
Everything here is empirical: each rule exists because it failed at least once, on a real run.
---
## 0.0 Hard rules — these decide outcomes, read them before §0
Auto-compaction re-attaches each skill's most recent invocation after the summary, **keeping the
first 5,000 tokens**, inside a 25,000-token budget shared across skills and filled
most-recent-first — so an older skill can be dropped entirely. This file is kept **under** that
budget and never clipped; detail lives in `references/`, read on demand (§0.3). Everything that
changes a decision is in this block.
- **A channel that "ran" is not a review that happened.** Exit code, `status`, and even the end
marker can all be satisfied by a failure. agy returns `status:"SUCCESS"` + exit 0 on an empty
answer, and `status:"ERROR"` on a complete one (`references/channels.md`). Codex returned a 162-byte **refusal**
ending in the end marker and was reported OK. Gate on content, never on status.
- 🔴 **A vendor can deliver the answer with characters MISSING and every other check still passes.**
35 `(` absent from a 26 KB review — `208(a)(2)(D)` → `208(a)2)(D)`, marker present, `ok` true.
Every channel is bracket-checked. On `TEXT INTEGRITY:`, copy no quotation or section number out
of that answer without opening the source. Details: `references/when-it-breaks.md`.
- 🔴 **A flag can be accepted and grant nothing, and one tool can have two spellings.** Grok Build:
`--allow web_fetch` inert, `--allow WebFetch` works. Assert the effect, never the exit code.
- **A refusal on a legal/immigration brief is a FRAMING bug, not a subject ban.** Pass
`--system legal-research` and write the brief as source-verification for attorney review, not as
filing strategy: codex then answers 6/6. Recipe: **`references/legal-briefs.md`**, read it FIRST.
- 🔴 **agy dies silently on an UNLISTED tool — a DENIED one is harmless.** **Silence is the
dangerous state.** Fixed by `patch_agy_permissions.py`; run it after any update (rules in
`~/.gemini/`, not this tree). Check it first if agy returns empty. Detail: `references/channels.md`.
- **agy re-runs itself once if it cites sources and opened none** — announced before it spends
(0/3 grounded → 8/8). If the retry also grounds nothing the *first* answer is returned, both
marked unverified. Never edit this into a loop.
- **Citations are not evidence — the most reliable failure there is.** Read the `CITATIONS:` line.
For **Codex, which reports no tool telemetry**, "was it opened" is unanswerable, so ask the only
remaining question: `citecheck.py --answer reviews\CODEX.md --resolve-urls`. `DEAD` = the page is
not there; `BLOCKED`/`UNKNOWN` = the check failed and prove nothing. `references/verification.md`.
- **Every model answers in English**, enforced by the default preset: Russian costs ~2× (§0.2).
- **Choosing models is config, not code.** `--route`, `--skip`, `--set`; free `--dry-run` (§0.1).
- **Codex is expensive and slow (~6-25 min).** Never send it a lookup: `--ask "…"` is one command.
- 🔴 **CONTEXT IS CHEAP; SEARCH IS THE BILL.** 2M input ≈ $0.20; 128 searches = $0.32 (60%).
Send material, not search demands.
- 🔴 **Use `orchestrate.py` — do not hand-roll calls.** Three incidents: DNS failure, non-streaming
at 100K budget, `adaptive` doing zero searches.
- 🔴 **"Second opinion" / «второе мнение» without a panel name = the CHEAP panel.** Do NOT pass
`--panel standard` unless the user explicitly asks for the standard panel by name — «стандартная
панель», «все модели», «all channels», «standard», «full panel». When in doubt, omit `--panel`
entirely — the code defaults to cheap. The standard panel adds expensive models (Codex, Kimi K3
paid, Qwen, Spark Standard) and is slower and costlier.
## 0.3 Reference files — read on demand
`SKILL.md` stays under the 5,000-token budget an auto-compaction re-attaches, so it is never
truncated. Detail lives beside it in `references/` (paths relative to this skill's directory).
| file | read it when |
|---|---|
| `policy.md` | Rule A, Rule B, sub-agent discipline — who to ask, when, at what cost |
| `legal-briefs.md` | **before** any legal / immigration / regulatory brief — a refusal there is a framing bug, and rewriting after one costs a whole round |
| `channels.md` | wire parameters and CLI traps per channel; a channel misbehaves, or you are changing flags |
| `briefs.md` | building any brief: what goes in it, and the live-web-search demand |
| `verification.md` | judging whether a review actually happened; signatures; citation spot-checks |
| `reading-the-answers.md` | **a round landed** — the manifest, the read cost, when to defer to a fresh context |
| `when-it-breaks.md` | **anything failed** — symptom → cause → fix, and the status fields that lie |
| `systems.md` | the `--system` presets in full, and why the legal one omits a clause |
| `kit/README.md` + `package.py` | giving this to another machine — `package.py --out <dir>` regenerates the kit |
## 0. Just run it
From any folder, with the absolute path:
```powershell
python "<SKILL_DIR>\orchestrate.py" `
--brief "<BRIEF_FILE>" `
--marker REVIEW-DONE-01 `
--out "<RUN_DIR>"
```
Runs **the default panel in parallel**: one `<CHANNEL>.md` per channel in `--out`, plus
`REPORT.md` and a verification block.
🔴 **Do not count the channels from this file, and do not list them** — every prose copy has been
wrong within days. `python routing.py` prints the live set and spends nothing. Output filenames
are the registry key, upper-cased.
🔴 **Some channels are deliberately off HERE and on in the published kit, and vice versa**, per
`distribution`: this machine holds direct vendor keys; the kit's story is one OpenRouter key.
`--dry-run` shows which.
| flag | what it does |
|---|---|
| `--brief` | file with the question. Required unless `--ask`. Last line should ask for your marker |
| `--ask` | **one-shot question instead of a round.** `--ask "text"` or `--ask @file`. Default per `ask_default` in channels.json; `--ask-channel` overrides. Prints the ANSWER to stdout; no citation audit. ~20 s |
| `--tier` | **one tier, `max`, and it is the default.** `strategic`/`deep` are aliases kept so old commands run. Depth is never a choice — see §2 |
| `--panel` | `cheap` (default) · `standard`. WHO is in the room; never changes depth. See §2 |
| `--marker` | literal string the reply must end with; absent ⇒ incomplete |
| `--out` | run folder (default `./reviews`): outside every project, not TEMP. A new drive-root folder is refused |
| `--system` | preset name or path (§0.2). The no-non-existence rule is appended — end the file with a newline |
| `--attach` / `--attach-dir` | document / folder beside the brief. API channels get the file **inline**; CLIs get its **path**. 🔴 Only material you authored |
| `--answer-cap` | cap each reviewer's FINAL answer at N chars (default `20000`; `0` = off). `HANDOFF.md` names who exceeded it |
| `--only` | restrict channels. Names, aliases and **group** words all work — vendor families and billing paths; `routing.py` prints every accepted spelling. 🔴 One channel per argument: `--only a b c`, never `--only "a b c"` |
| `--skip` | the inverse of `--only`; on a clash (`--only <group> --skip <member>`) **skip wins** |
| `--set` | pin: `--set codex=gpt-5.4` (a model's alias works too); unlisted → HYPOTHESIS on network kinds |
| `--route` / `--new-channel` | route: §0.1; `--new-channel N:K:S` → overlay |
| `--dry-run` | full preflight (plan, payload, keys, gates), then exit — spends nothing |
| `--strict-pii` | identifier gate OFF by default; `--warn-pii` itemises, `--strict-pii` refuses. **Secrets can never be sent** |
🔴 **`--only agy` is a GROUP — it returns EVERY agy channel.** When user names CLIs individually,
use specific channel names for one-per-binary; `--dry-run` shows which names a word expands to.
### 0.1 Choosing channels and models without editing code
Weekly limits run out on one model at a time, so the channel/model choice changes per request,
in prose: *«не использовать 5.6 Sol, а использовать вместо нее 5.5»*, *«не использовать для
этого промта Spark»*. Paste that string into `--route`. Parsed deterministically (RU/EN,
negation, substitution incl. anaphora, *«только»*) against the alias table in
**`channels.json`** — the single home of every model name.
```powershell
--route "не использовать 5.6 Sol, а использовать вместо нее 5.5. И не использовать для этого промта Spark"
```
The resolved plan is **always printed before anything is spent**: panel, `[RUN ]`/`[skip]` per
channel with model+effort+role, and the **vendor tally**. Read it before money moves.
Rules: an unparseable route is a **hard stop**. A refused model falls back to the next in
registry order. `--new-channel NAME:KIND:SLUG` → overlay. Free preflight: `--dry-run`.
### 0.2 System presets — one line each, detail in `references/systems.md`
`--system <preset|path>` frames the reviewer. Presets: **`base-depth`** (the default — the
maximum-depth amplifier) and **`legal-research`** (any legal / immigration / regulatory brief —
read `references/legal-briefs.md` **before** writing it). All presets force English output.
Not interchangeable — the legal one omits a clause; see `references/systems.md`.
**Timing**: most channels 1–4 min; **Codex 8–35 min** sets the wall-clock (`--panel cheap` is
far faster). Run rounds in the background; sanity-check with `--ask` (~20 s).
---
## 1. What is on this machine — ask, do not assume
**Never pin a version here** — both CLIs moved inside one week. Ask instead:
```powershell
python "<SKILL_DIR>\doctor.py"
```
Live versions, both CLI paths, key presence **without printing it**, the agy permission patch, the
installed version, your settings file, and a compile check. `--json` for machine form. What is
stable and worth knowing:
| thing | value |
|---|---|
| `MODEL_API_KEY` | the **only** environment variable that must be set. Everything else has a working default |
| HTTPS endpoint / model | `https://api.meta.ai/v1`; the model comes from `channels.json` (the registry wins over `MODEL_NAME`). Docs: `dev.meta.ai/docs` |
| Codex CLI | resolved via `CODEX_BIN` → PATH → known install dirs |
| Antigravity CLI | `agy`, **not on PATH** on Windows; resolved via `AGY_BIN` → PATH → `%LOCALAPPDATA%\agy\bin\agy.exe` |
| agy models | one model per channel, base slug plus `--effort`; a suffixed slug (`-high`) plus a disagreeing `--effort` is exit 1 in 3 s (`references/channels.md` §6.3) |
| Grok Build CLI | `grok`, **not on PATH**; `GROK_BIN` → PATH → `%USERPROFILE%\.grok\bin`. Subscription, no key; neutral cwd. 🔴 One denied tool discards the whole turn (`references/channels.md`) |
| harness | `orchestrate.py`, standard library only, no `pip install`, Python 3.9+ (`patch_codex_firecrawl.py` alone needs 3.11+ and says so) |
**Secrets.** Never `Read`, `cat`, `echo` or `Write-Output` the key. The script reads it from the
environment; `doctor.py` reports presence and length only. Printing the value is a hard failure —
and `orchestrate.py` refuses to SEND one, with no override at any setting. Identifiers warn and go
(`--strict-pii` to block) as one count line (`--warn-pii`: by line), never a value. `--dry-run` is free.
---
## 2. ONE axis — WHO is in the room. Depth is always maximum.
**`--panel`** picks the reviewers. That is the only choice. Since 2026-08-15 every channel runs
at the ceiling its own vendor accepts, in every mode: **only the number of models differs.**
| `--panel` | who runs |
|---|---|
| **`cheap`** (default since 2026-08-16) | free, subscription and low-rate channels; `python routing.py` prints who. *«запусти дешевые»* |
| **`standard`** | every enabled channel except `explicit_only` ones (Wonder). *«запусти все»*, *«стандартная панель»* |
🔴 **When the user says "second opinion" or «второе мнение» without naming a panel, this is a
cheap-panel request — do not escalate to standard.** Omit `--panel` (the code defaults to cheap)
or pass `--panel cheap` explicitly. Standard only when the user said so.
**Premium (true-batch + Flex) is a separate script, not a panel**: `premium/premium_panel.py`;
`--panel premium` prints it; lane→key table: kit README.
🔴 **Neither a panel nor a GROUP enables anything.** `--only openrouter`, *«только грок»* run only
the members already on. **Naming a channel is the one way to start one that ships off** —
`--only goog36flash`. 🔴 **What `cheap` costs is vendor diversity, not depth**: the plan prints the
vendor tally and what `standard` adds — six Geminis agreeing is one opinion repeated.
**`--tier` parses and chooses nothing.** One tier, `max`; `strategic`/`deep` are aliases so old
commands work. Resolved depth is printed per channel.
**A below-floor note names its cause.** With the default `--answer-cap` a short FINAL answer is
what was asked for; "under-allocated" means something only with the cap off.
**Your own settings go in `~/.claude/model-orchestration.local.json`, never in `channels.json`** —
an update replaces the skill folder and cannot reach that file. `{"channels": {"<name>":
{"enabled": true}}}`. There it may change anything and add channels or tiers (`"_new": true`).
Both files' changes print in the plan. 🔴 A
change to WHERE a document goes needs `python routing.py --accept-settings` once, or a paid round
refuses. Rules and errors: `references/when-it-breaks.md`. Update: `python update_check.py --apply`; self-updating? `--status`. Relay a session-start `[ai-second-opinion]` notice in one line.
🔴 **A depth knob you have only SENT is not a depth knob.** `python echocheck.py --only <channel>
--samples 3` judges by the reasoning counter that comes back, refusing CONFIRMED on overlap.
---
## 3. Verify the answer is real — the whole point
A call that ran is not a review that happened. The harness prints all of this.
**Hard failures — the answer is unusable, never report it as a review:**
1. `stop_reason` is anything other than `end_turn` → truncated, the tail of the analysis is gone.
2. The marker is not present → output is incomplete.
3. Empty body despite HTTP 200. 🔴 **Read the warning before diagnosing it** — it now names which
of three things happened: the reasoning filled `max_tokens` (raise it or split the brief), the
vendor ended its loop mid-turn, or the model spent its last turn calling tools.
**Soft signals — the answer exists, judge it yourself:**
4. **Tool-invocation count is 0.** `tools:` is *permission*, not instruction. A model handed web
search may never call it and then answer dated questions from training data.
**Zero means every dated fact in that answer is unverified.**
5. Output tokens below the floor, *with an uncapped brief* → the model under-allocated. There is
no deeper setting; split the question into more sub-questions instead.
Never let a soft signal mark a run failed. A check that cries wolf on a good answer trains you to
ignore the alarm that matters — made twice here, fixed twice.
---
## 9. When it breaks
**The symptom → cause → fix table is `references/when-it-breaks.md`.** Read it before diagnosing
anything from source. Three that decide what you do next:
- **A status field is not evidence.** `agy` reports `SUCCESS` on an empty answer; `codex exec`
exits 0 on a hard 400; an HTTP 200 can mean only that the request parsed. Judge by the end
marker and the counters.
- **`FILTERED` on the Spark probe**: neutralise the phrasing **in the sent copy only**, never on
disk, and strip appendices. Do not retry unchanged.
- **A channel is off and nothing explains why**: your own settings file, whose path and changed
fields the plan prints at the top.
- 🔴 **The LAUNCH is refused with «Auto mode could not evaluate this action»**: the permission
classifier returned no verdict — not a decision about your command. **Retry the identical
command**, never a rewritten one.
---
## 10. Report back — always
🔴 **Name every channel WITH its model and depth** — `codex (gpt-5.4 @ xhigh)`, never a bare name.
Per channel: seconds, in/out tokens, **tool/fetch
count**, **grounding** (pages we fetched / vendor-stated / none) and **citations in the text** — a
web-capable channel that cited nothing is a fact to state, not a blank column: the review is
training-data-plus-brief, which R45's table hid. Then separately: **accepted**, **rejected with
proof**, and where the channels **disagreed with each other**.
The disagreement is the product; one reviewer is not a second opinion. **Which channel wins is not
predictable from cost or from the last round** — four rounds, four winners. And convergence is not
independence: R49 had three channels agree on a Cyrillic token ratio that one measurement refuted.
One shape recurs: the highest-value finding was **not an answer to a question that was asked**. It
arrived in the UNASKED section or under "what are we missing". Always include that question in the
brief, and when reading results, **always read the UNASKED section and all other unsolicited
observations** — not just the answers to the questions you asked.
🔴 **Read while the round runs (R193, the operator 2026-11-20).** Launch it in the background, then
loop `orchestrate.py --wait <RUN_DIR>` (Claude Code: `run_in_background`; other agents: a tool
timeout ≥ 10 min). Read each READ NOW answer YOURSELF, smart-first (★ = the mandatory minimum; 3s
only if room remains; never via sub-agents), then append `## <FILE>.md` + findings to
`<RUN_DIR>/READING.md` — your memory across `/compact` (after one: `--progress <RUN_DIR>` + READING.md; folder lost: `--rounds`).
FAILED = will not answer, never «still working». NEVER READ (Nemotron): never open, grep or count it
(written into hidden `.never-read/`, gzipped at the end). A plan's «NOT started» voice is not offered here.
Still running 2 h after the launch: synthesise on the rest («rests on k of n»), revise when it lands.
`HANDOFF.md` (a `listdir`, priced, smart-first) is the final manifest; over ~40K tokens in a large
session, let a fresh context read. Detail: `references/reading-the-answers.md`.
---
## 11. Policy rules
Rule A, Rule B and sub-agent discipline: `references/policy.md` (merged from
`second-opinion-consult`, R115).
Files in this skill
- CHANGELOG.md
- SKILL.md
- VERSION
- citecheck.py
- doctor.py
- echocheck.py
- ground_classify.py
- kit/PRIVACY.md
- kit/README.md
- patch_agy_permissions.py
- patch_codex_firecrawl.py
- premium/aggregate_findings.py
- premium/batch_one.py
- premium/batch_transport.py
- premium/flex_lane.py
- premium/models_snapshot.json
- premium/poll_loop.py
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.