Orchestrate CLI workers
Finish the work with the least lead context and the cheapest capable workers, or the strongest mix when the user asks. Plan, delegate bounded units, and integrate results supported by evidence.
- Playbook = the phases and roles.
- Profile = which models each tier uses (
base,savings,aggressive). - Goal = how eagerly to delegate while a mode is on (
passiveby default;save,balanced,max,freestyleexplicitly). - Runner strategy = how one wave runs (
economy,balanced,quality,research,parallel,rescue).
Choose the backend
Honor an explicit request for the local skill or no MCP. It always wins. Otherwise run
scripts/orchestrate.py policy show and use its backend: skill selects this runner, mcp
selects alethe_* tools when present, and auto prefers those tools when available.
Python is optional. If python --version, python3 --version and py --version all fail or report
below 3.9, or the user asks, follow references/manual.md for detection,
options, background workers and reporting. All other sections still apply through manual equivalents.
The skill path needs no MCP. It runs bounded concurrent workers with optional worktree isolation and resumable sessions. CLI workers do not appear on Alethe's board.
First run and configuration
Run scripts/orchestrate.py doctor when the environment may be unprepared or the user asks what
is set up. It checks Python, providers, the saved policy and the user's playbooks copy, and
summarizes quota readings with actionable hints.
When doctor reports no configured policy, or the user asks to set up orchestration, follow
references/onboarding.md: inventory the CLIs, models and routes, build
profiles base, savings and aggressive, and get approval before saving them to the playbooks
copy. Save only confirmed preferences. A proxy such as 9router carries model traffic; it is not a worker.
Setup never blocks work. Mid-task with nothing configured, run doctor, use its logged-in CLIs
with the bundled playbooks, say so in one line and continue. Offer onboarding after the current
step; save nothing until the user agrees.
Translate loose configuration requests into actions:
| The user says | Do |
|---|---|
| "save provider X" as an ongoing preference | confirm, then policy set --conserve-providers X |
| "use cheap models for the small stuff" | confirm the provider and model, then edit tiers in the playbooks copy |
| "at most N workers / T minutes / C dollars" as an ongoing preference | confirm, then policy set --max-calls N --max-wall-seconds T --max-reported-cost-usd C |
| any of the above "for this run only" | put it in the plan's budget or use --strategy; never touch the policy |
| "at most N calls / C dollars / T tokens for this whole task" | budget with those limits before the first wave |
| "where were we", or after the conversation was compacted | status before anything else |
| "back to defaults" | confirm, then policy reset |
| "change the playbooks" or roles per phase | playbook --init, then edit the copy it prints; the UI exports the same file |
| "use savings" or "go aggressive" as an ongoing preference | confirm, then set profile in the playbooks copy |
| "what did it do", "how much did it cost" | report; no confirmation needed |
Short commands
/alethe <args> in Claude Code, or the same words after "alethe" anywhere else, map to one
action. Run-specific commands without a folder use the current orchestration: the one new started,
use picked, or the last run wrote to.
| Words | Do |
|---|---|
| a task, in plain words | orchestrate it as the rest of this skill describes |
| nothing | status; with no current orchestration, list these commands in a few lines |
on, or a standing instruction ("from now on...") |
stay on, as below |
always, or "always on", "in every project" |
mode on --everywhere |
off |
mode off; with the default on, this turns it off in this project only |
off everywhere |
mode off --everywhere |
passive |
mode on --goal passive |
spend [--transcript PATH] [--session ID] [--json] |
spend with those options; show its output as is |
save, balanced, max, freestyle |
mode on --goal <it> |
careful |
mode on --care careful |
report [folder] |
report, and show its output as is, without a summary of your own |
report html, or "show the report" |
report --format html, which writes report.html in the folder and opens it; without Python, fill assets/report.html as in references/manual.md |
status |
status, and show its output as is |
usage |
usage, --refresh-claude when Claude's reading is missing or stale, or --refresh-agy when Antigravity's reading is missing or stale; show windows, resets and freshness |
models |
models; show model prices, ranks and price freshness |
editor, or "show the playbooks" |
editor, which writes the playbooks as a flow page and opens it; without Python, fill assets/editor.html as in references/manual.md |
list |
list; use <folder> makes one of them current again |
stop |
stop, then status once the waves have ended |
clean [--older-than DAYS] [--yes] |
preview completed folders older than 14 days; delete only with --yes |
budget <limit> |
budget --max-calls N, --max-reported-cost-usd C or --max-reported-tokens T |
skip <phase>, switch <playbook>, freeform, add <phase> |
change course as below |
note <text> |
note "<text>" |
mark <worker> used|partial|discarded |
mark <worker> <mark> |
setup |
doctor, then onboarding when no policy is saved |
help |
list these commands in a few lines |
Passive mode (default)
Work as usual, with no playbook, plan or waves unless the user asks. Passive mode watches this
lead session's own spend and provider quota, and delegates only when a short brief and a bounded
unit make a worker cheaper than the lead. Without asking, use only subscription-billed workers
with fresh quota room; billing in alethe-prices.json defaults to subscription. Any API-billed
provider or unknown/stale quota needs the user's ok first, including for the agent's own subagents.
Eligible units are read-only scouting or search across many files, mechanical edits with an
automatic check, writing or running tests, or an independent review of a finished diff. Keep
small steps, ambiguous or design work, tightly coupled edits and integration with the lead. The playbook workflow below applies when explicitly requested.
Prefer Codex while every main window it reports (5h and week, or only month on ChatGPT Go) is
known, fresh and below quota.criticalThreshold: its subscription quota left at reset is lost. Honor billing in
alethe-prices.json and passive.prefer; compare API prices and ask before using that provider,
even if its rate-limit windows have room. Run each bounded Codex unit as a one-worker economy
wave through new, run --detach, and wait, pinning model and effort. When Codex is low or the unit needs
this conversation's context, use the agent's own cheaper subagents instead: in Claude Code,
the Agent tool with model: haiku or sonnet, and a pinned effort where supported. Unknown
quota is not evidence of spare room; ask before routing on unknown/stale readings, without
refreshing Claude from a hook. Cheaper subagents must meet the same billing and quota conditions.
Say it in one line when delegating, without confirmation: "Handing the test sweep to Codex
(5h at 4%) to save Opus." Ask first before more than passive.askAboveWorkers (default 2)
parallel workers, anything on a low provider, anything costing more than doing it yourself,
or passing quota.stopAt. When spend climbs on routine work, suggest /model sonnet once;
the lead model is the user's choice.
The hook gives a short brief on the first prompt, then stays quiet until a time, spend or quota
check is due, including during long tool turns. spend reads Claude Code JSONL locally, separates
lead and delegated usage, and shows a list-price estimate: a subscription yardstick, not a bill.
/alethe off disables it in this project; /alethe off everywhere disables it everywhere.
/alethe passive enables it explicitly here. ALETHE_PASSIVE=0 disables only the implicit
default; explicit modes still apply. Workers never receive hook context. Without the hook,
run mode show at session start and after compaction, and spend/usage before substantial work.
See references/playbooks.md for the optional passive settings.
Stay on
- Use it proactively whenever a request splits into bounded independent units, even when nobody
mentions orchestration, as the description says. Before an unrequested multi-wave or multi-worker
orchestration, show a few lines of
dry-run(playbook, workers, providers/models, estimate, quota) and wait for an ok. This also applies underbalanced,saveandmax; turning on a goal alone is not approval. Exempt are passive one-worker delegations to subscription workers with fresh room withinpassive.askAboveWorkers, explicitly requested orchestrations, and standing instructions that say to go ahead. Small or tightly coupled work stays with you. mode on --everywhereapplies in every project for 30 days from the last time it was set; calling it again renews it, andmode showreportsexpiresAt. After expiry the built-in passive default applies again. Passive itself does not expire.mode offturns it off here;mode off --everywheredisables the passive default everywhere, as doesALETHE_PASSIVE=0.mode onkeeps it on for the current project (the repository root, or the folder) untilmode off, or after 12 hours without a prompt. A project mode wins over the default.
Both modes take the same options:
--goal savespends as little as possible, andbalanced(the default) delegates only when the playbook says it pays.--goal maxgets the most out of the available agents and makes delegation the default. Stay direct only for one file, one obvious edit or about 5 tool calls. For anything larger, write one line before the first tool call ("Alethe: 3 units -> agy flash reads, sonnet writes, I integrate") and delegate every bounded unit; keep decisions, design and integration. Start workers throughscripts/orchestrate.py: the Claude Code Agent tool's limit on spawning covers that tool only. This threshold overridespickOrderand thedirectplaybook. Turning onmaxis still not approval; a standing instruction that says to go ahead is.--goal freestyledrops playbooks, plans and waves: you work as usual and only watch over cost. Check quota before long or heavy steps. When a cheaper or better route exists, say so in one line, at most once per reply and not again once declined: "This rename is mechanical, so I'll hand it to a Sonnet worker to keep it cheap." Take a cheaper route that keeps the quality the step needs and say so in that line; ask before anything that costs more, starts several workers or passes the quota stop line. Your own model is the user's to change: suggest/model <name>. It is notfreeform, which drops the playbook of a running orchestration.--care carefulreads before writing, isolates every writer, reviews every diff before integrating it, and asks before anything hard to undo.--rule "<the user's words>"keeps a standing instruction, up to 8;--clear-rulesdrops them.
Turn it on when the user says /alethe on, gives a standing instruction, or asks for orchestration
"from now on". Map the instruction to a goal or care level when one fits, and keep the user's own
words as a rule. Confirm in one line what is now on, then go back to what they were doing.
The Claude Code hook reminds you every prompt in explicit non-passive modes; without it, run mode show at session start
and after compaction. Delegate where the overhead pays under the goal; under max, delegation is the default and only trivial work stays with you.
Join mid-task
Join at any point, including inside another skill's workflow. Do not start over:
- Take what already exists as the plan: the conversation, a spec, a task list, a design doc, the diff so far. Point workers at those files instead of copying them.
- Keep the other workflow's steps and gates: pending tasks become units and its checks become
gates. Rewrite its files only when one of its steps says to. Under
maxits steps are still units: the other skill keeps the order and the gates, but does not make everything inline. - Use
newonly for delegated work. Keep small, coupled or ambiguous work with the lead; say why in one line.
Pick a playbook, then adapt
Before planning, run scripts/orchestrate.py playbook --pick for the active profile, provider
order, pick conditions and playbook summaries. Then run playbook <id> for the chosen playbook,
resolved tiers and quota and budget rules. Both accept --json; plain playbook prints the whole
file for editing or onboarding only. See references/playbooks.md.
- Pick a playbook with
pickOrder. A playbook the user names wins; so does a runner strategy name, which keeps the single-wave behavior described below.completeadapts per unit when nothing else fits. - Run the phases in order.
who: leadis you, in this session. Every other phase is one wave of workers: itsrunneris the planstrategy,workersthe unit count,readOnlymeansmode: read-only, andisolategives each writer its own worktree. - Skip a phase whose
ifdoes not hold; among paths joined bywith, the first true one runs. Check a phase'sgateyourself; on fail, run itsafterchain once per unit, then check again. - Resolve each worker's tier through the playbooks file and active profile, then apply the first
matching rule. Deprecated
policy.modelTiersoverrides still win when set; save new tiers only in playbooks. Pass model and effort explicitly; keep read-only work on a capable provider. - Say which playbook you picked and why in one line before the first wave.
Watch the quota
Never let a provider run out, under every goal, profile and runner strategy, asked or not. Before every wave:
-
Run
scripts/orchestrate.py usage. Codex readings come from its session files, Claude readings from each Claude worker'srate_limit_event, and Antigravity (agy) readings fromagy -p /usage. When the plan or you use Claude and its reading is missing or stale (>30 minutes), runusage --refresh-claude, a one-line Haiku call. When the plan usesagyand its reading is missing or stale (>30 minutes), runusage --refresh-agy(zero tokens); it checks5handweekfor Gemini models, plusargonfor Argon models and3p-5h/3p-weekfor third-party Claude/GPT models inside Antigravity. -
Read
quotaForecastindry-run: what the wave may take of each window, learned from past waves. With too few samples it is unknown; say so instead of guessing. -
If a provider is low (at or above
quota.criticalThreshold) and the next provider in the order runs the same tier, move the work and tell the user in one line with the numbers and reset time: "Moving the scouts to Codex: your Claude is at 86% of its 5-hour window (resets 14:30), Codex is at 33%." Applyquota.whenSpareonly to subscription-billed providers whose unused quota would be lost, honoringbillinginalethe-prices.json(defaultsubscription). Keep the defaultspend-strong; it never applies to API billing, which has no expiring quota. -
Stop and ask before launching when the only way around a low provider lowers the tier the work needs, every provider is low, or the forecast passes
quota.stopAt. Say what the work needs, what is left and when it resets, then offer two to four options with a recommendation, using the agent's question tool when it has one:- wait for the reset;
- run it on another provider, saying what changes;
- a cheaper tier only for the units that allow it, saying the risk;
- run now only the units that fit;
- connect another CLI or account (
setup); - go on anyway, only on the user's word, with
run --allow-low-quota.
"This migration needs the strong tier (Opus). Your Claude is at 91% of its 5-hour window and resets at 14:30, in 2h10; this wave may take about 15%. 1) wait until 14:30 (recommended), 2) Codex high now, at 40%, 3) Sonnet for the two mechanical units only, 4) connect another CLI."
-
runrefuses a wave, and skips queued workers (failureKind: quota_low), on a provider at or pastquota.stopAt. A worker that hit a limit fails asrate_limited. Handle both as step 4.
The user's pinned provider, and their answer, win over these rules. When you run on a low provider
yourself, say so, keep your own turns short and hand work to a provider with room. If a reading is
stale, say so instead of asserting its number. Record every change with
note "<reason and readings>" --kind switch. See the reference for unknown readings.
Change course
Between waves, adapt the plan to results or the user's request: skip, repeat or add phases, do a step yourself, change providers, models or budget, switch playbooks, or plan freeform waves. The user's request wins over the playbook.
Record each change in one line before the next wave, so the report can explain it:
| Change | Command |
|---|---|
| skip a phase | note "<phase>: <why>" --kind skip |
| add a phase or a worker | note "<what>: <why>" --kind add |
| switch playbook, or go freeform | note "to <playbook or freeform>: <why>" --kind switch |
| do a step yourself | note "<what you did>" --kind lead |
| anything else | note "<what changed and why>" |
A freeform wave is an ordinary plan: leave playbook out and name the phase after what the wave
does. Stop a wave that is no longer useful with stop; workers that already ran keep their results.
Effort decisions
dry-run lists decisions when a worker's effort is one its provider or model cannot take: an
adapter without effortFlag, Kimi, or a model whose models entry lists other efforts. run
refuses that plan. Never drop or change the effort silently. For each decision:
- Ask the user in a short message rather than a question tool that waits without a timeout:
change the provider, the effort or the model? Offer only kinds with options in
decisions, and name the default you will apply after 2 minutes (defaultLabel). An effort name the runner cannot rank, such as a CLI's own variant name, has no default: say so and wait for the answer. - Start a 120-second timer that wakes you, then end your turn: your harness's wake-up or
background-task tool, or a background
sleep 120(POSIX shell) orStart-Sleep -Seconds 120(PowerShell). Stop it when the user answers. - Once the user picks a kind, check what is really possible for it: the efforts the CLI's help or
the model's
modelsentry accept, the models its model list shows, or the providers inoptions.provider(an unverified one has nomodelsentry, so check its CLI). Send the user that list with your recommendation, and start the same 120-second timer. - If a timer fires first, apply
defaultat the first question, your recommendation at the second, and tell the user in one line what you changed. - Edit the plan (
effort: nullruns without an effort flag and drops the tier's), rundry-runagain and record it withnote "<worker>: effort <old> to <new>: <why>" --kind switch. Save a lasting fix in the playbooks copy, such aseffortsundermodels, only when the user agrees.
Orchestrate
- Delegate when the overhead pays; runner strategies
economyandrescueallow one worker. - Read references/routing.md for the runner strategies each wave can use:
auto,economy,balanced,quality,research,parallel, orrescue. An explicit runner strategy in the current request wins over saved preferences. Treat the word after an explicit skill invocation as the playbook or runner strategy when it matches a name. - Run
scripts/orchestrate.py probeand use only available providers. Read references/providers.md when using Agy, Kimi, OpenCode, Copilot, resuming a worker, or adding a custom CLI. - Give writers disjoint ownership. Use an isolated worktree for concurrent writers; a single writer may use the main checkout when existing user changes are preserved.
- Create a version-1 plan JSON outside the repository.
scripts/orchestrate.py scaffold <strategy> --workers Nprints a valid skeleton to fill in. Usestrategy, and useprovider: autoonly when saved provider switching preferences may decide the provider. Use the phase's provider; for a CLI underadapters, name its id, notcustom. Set the plan'sbudgetwhen one wave needs hard limits, and runbudgetwhen a limit covers every wave of the orchestration. Give the plan atitle, theplaybookandphaseit runs, and a one-linewhy; give each worker a shortwhynaming its role and the reason for its model. The report shows them. Write each task as references/briefs.md describes. Codex and Claude workers start without MCP servers; setmcp: trueonly for a brief that needs one. Validate the plan against schemas/plan.schema.json or withscripts/orchestrate.py validate. - Run
models. For a needed missing or stale price (>60 days), look it up only on the vendor's official pricing page, tell the user, and save the entry withsourceandasOfinalethe-prices.jsonnext to the policy; never guess. See references/operations.md. Preview withdry-run: runner strategy, providers, concurrency, prompt tokens, budget andlistPriceEstimateUsd(an estimate) andquotaForecast. Fix warnings, including default models, low providers and the stop line, or explain why they do not apply. Whenvalidate,dry-runorrunrefuses a plan, tell the user the reason in one line, even for an explicitly requested orchestration, and ask before acting on what the refusal suggests: never switch a phase's provider, rungit initor otherwise change the user's folder on your own. Before the first wave of an unrequested multi-wave or multi-worker orchestration, show that preview in a few lines: playbook, worker count, providers/models, estimate and quota. Wait for an ok, including underbalanced/save/max. Exempt are passive one-worker delegations to fresh-room subscription providers withinpassive.askAboveWorkers, explicit orchestration requests, and standing instructions that say to go ahead. Never treat a mode goal alone as that permission; passive API billing or unknown/stale quota still needs approval. When the user wants to see the architecture, save the preview withdry-run --write, then render it withscripts/diagram.pyas described in references/diagram.md. Show the SVG before running workers and use only confirmed proxy routes. - Start the orchestration once with
scripts/orchestrate.py new "<title>" --playbook <name> --why "<one line>" --lead <your CLI>:<your model>, such as--lead claude:opus; it creates the folder, makes it current and names you as the lead in the report. Start every wave withrun <plan> --in current --detach, then callwait [--timeout N](at most 540 seconds) untildoneis true; it returns status too. Claude Code may instead use the shell tool's background mode. Never run a wave in the foreground of a shell tool with a short timeout. Interrupted runners are detected;stopalso kills leftover workers. The runner caps concurrency and budgets and leaves worktrees for review. It uses argument arrays; an unreadable.cmdshim runs throughcmd.exeonly under the argument restrictions in references/providers.md. - Read
state.json, eachoutcome.json(itsworkerStatus,failureKindandreadOnlyViolationfirst), the conciseresult.md, and writerdiff.patchfiles. Do not load raw logs unless diagnosing a failure. When a wave ran isolated workers on providers that cannot be confined to their worktree (all but Codex),checkoutGuardcompares each source checkout and its submodules before and after the wave. Whatever its status, rungit statusandgit diffyourself in every listed root, and inside each changed submodule, before reviewing or integrating worker diffs. Show the user any change and ask before keeping, moving or discarding it; never revert on your own.unverifiedmeans the comparison failed: check by hand the same way. A read-only worker on a CLI without read-only (verifyReadOnlyindry-run) must not have written anything: rungit statusandgit diffin its worktree and checkcheckoutGuardbefore using its answer. If it wrote anything, never integrate those writes; tell the user what it touched,markthe resultpartialordiscarded, and remove the worktree once handled. - Integrate reviewed changes, run validation in the combined checkout,
markeach worker's resultused,partialordiscarded, then remove only temporary data and worktrees whose useful changes were handled.mark <worker> usedfinds the worker in the current orchestration. - Close with
scripts/orchestrate.py reportand show its output: work, reasons, changes, reported spend and what remains. Use it for user cost questions; no folder means the current orchestration.
For plan examples, result semantics, selective dirty-state seeding, and cleanup, read references/operations.md.
Worker contract
Each brief must state the task goal, definition of done, owned paths, relevant repository rules, checks, forbidden changes, and desired handoff. The runner automatically appends these invariants:
- do not delegate, spawn subagents, or launch another agent CLI
- do not commit, push, tag, release, or open a pull request
- return a concise outcome, evidence, changed files, checks, failures, and risks
- finish with a
STATUS:line (DONE,DONE_WITH_CONCERNS,BLOCKEDorNEEDS_CONTEXT) and aSUMMARY:line
The runner blocks Codex and Claude subagents when their CLIs advertise the required flags. Every
worker runs with ALETHE_ORCHESTRATE_WORKER=1; the runner refuses nested orchestration, though a
worker with shell access can unset this advisory guard. A
worker's status and summary are claims; check its diff. For review, validation, judge and panel
briefs, follow references/briefs.md.
Do not put secrets in plans, tasks, arguments, or logs. Do not use bypass flags unless the user
explicitly requested that loss of isolation; custom workers require allowUnsafe: true for known
unsafe flags and trust.allowUnsafe: true in the saved user policy. Agy, Kimi, OpenCode, Copilot and custom CLIs
cannot enforce read-only, so their mode: read-only workers run in a disposable worktree and the
runner checks with git status that they wrote nothing (readOnlyViolation, touchedFiles). Worker cwd
must stay in the invoking checkout (or directory outside git), unless the user allows
trust.cwdRoots; task files stay inside the plan directory or orchestration folder.
The lead never writes trust itself; only the user does, or the lead after the user explicitly
asks for that exact change.
Token discipline
- Treat statements such as "low on tokens", "save quota", or "economize" as runner strategy
economyfor the current run. Persist it withpolicy set economyonly when the user asks for an ongoing default. - A plan
budgetturns saving into a hard limit: cap worker calls, wall time, estimated prompt tokens, reported tokens and reported cost. Usedry-runto see the estimate before anything runs. Only Claude reports cost, somaxReportedTokenscaps the others. Cache reads are reported separately and excluded frommaxReportedTokensand the report's Value token split. - More workers increase total provider usage.
automust choose no orchestration when the task is cheaper to finish directly; if orchestration was explicitly requested, it chooses the smallest valid runner strategy. - Point to files rather than copying them; read concise results and diffs, not transcripts.
- Reuse
sessionIdonly for focused follow-ups. Use cheap workers for bounded discovery and mechanical work; keep ambiguity and integration with the lead or a capable reviewer. - A failed worker may be retried once only when the error has a specific correctable cause.
Do not commit, push, tag, release, or open a pull request unless the user explicitly asked for it.
