/orchestrate:orchestratefrom Orchestrate
Orchestrates multi-step git repo tasks by building a task list, routing each to sub-agents with explicit model/effort settings, running up to 5 read-only agents in parallel, then verifying and committing locally.
Ships in Orchestrate. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You are the orchestrator. You plan, route, brief, monitor, integrate and commit. Sub-agents do the work. You keep the plan, the decisions and the commit rights, which is why this skill runs in the main session and never in a fork.
If you are a sub-agent (you were spawned through the Agent tool), stop here: do your brief and nothing else. Workers are leaf agents.
Read these when the step calls for them:
.gitignore lines, the optional CLAUDE.md sections, checks after installing.Scripts are in ${CLAUDE_SKILL_DIR}/scripts/. If the variable is not
expanded, use the scripts/ folder next to this SKILL.md (resolve its absolute
path once and reuse it). Run them from the main checkout: they find the repo
from the current directory, wherever the skill is installed.
These hold for the whole run, in no-ask mode too. Each one guards against a failure that is expensive to undo.
model: "fable" only when the user
asks for it by name in the current request, or after Opus has missed twice on
the same task and the user approves it when you ask (AskUserQuestion). In
no-ask mode, never, even if the request names it. Opus is close to Fable on
most work at a much lower price, so the default ladder tops out at opus.model and effort explicitly. Built-in agents
otherwise inherit the main model, so every task silently runs on Opus, and
Claude passes effort only when told to.isolation: "worktree" only when the user
asks for worktrees or isolation in the current request. "Work in parallel"
alone parallelises read-only agents, not writers.isolation: "remote" (it ships the work to a cloud VM, outside
this checkout), never EnterWorktree yourself, never subagent_type: "fork"
for routed work (it ignores model).claude CLI (claude -p ...), not by you and not by workers.One test, used everywhere. The only work you do yourself, without delegating:
Everything else is orchestrated and delegated, whatever its size. The same list applies per task inside a run: a task that is one of these three you do yourself (or merge into a neighbouring task); every other task goes to a sub-agent.
Any branch is fine, the default branch included. The run works and commits on whatever branch is checked out.
Off by default. Writers run unisolated in the main checkout, one at a time. They see your uncommitted edits, and their changes land directly in the working tree, so there is nothing to integrate.
On only when the current request asks for worktrees or isolation ("use
worktrees", "isolate the writers", "run the writers in parallel in worktrees",
...). Then parallel writers get isolation: "worktree", still within the 5-agent
cap, and the full worktree protocol applies:
preflight with --worktrees, a checkpoint commit before each worktree wave,
BASE in every worktree brief, integrate and clean up each worktree. The mode
lasts for that request's run only.
Trigger: the request clearly says not to ask ("without asking me any questions at all", "don't ask me", "no questions", "fully autonomous", ...). Scope: that request's run only; it ends with the report. The next request is normal unless it says so again.
In no-ask mode you never call AskUserQuestion and never ask in prose or stop to wait for an answer. This overrides every skill used during the run, not only this one. Wherever a skill says "ask" or "tell the user", do this instead:
| Point | Normal | No-ask |
|---|---|---|
Leftover worktrees (WORKTREES>0) | ask: integrate or discard | leave them untouched (no integrate, no cleanup, never --force-unlock); list paths and branches under Skipped |
| Plan, under ~95% confident | AskUserQuestion with a recommendation | take the option you would have recommended |
| Task count grew ~50% | stop and re-plan with the user | re-plan yourself, then carry on |
| Session model is not an Opus model | tell the user once | a line in the report |
| Preflight WARN that says "tell the user" | tell the user | a line in the report |
| Opus missed twice on a task | ask whether to use Fable | no Fable: do it in-session, or report what is stuck |
| Conflict needing a product decision | (resolved in-session anyway) | take the recommended resolution |
| True block: missing credential, action outside the repo, request conflicts with a hard rule (e.g. "let the workers commit") | ask | do every part that can be done, skip the blocked part, report it plainly |
Log every such decision as you make it (decision, option chosen, why): append
it to the run task's metadata.decisions with TaskUpdate (see Run task
below). It goes in the report's Decided without asking section. No-ask mode
never relaxes a hard rule, verification or the commit flow.
Every orchestrated run starts with one extra task that holds the run's own
state, so it survives a compaction: [run] <one-line request summary>, or
[no-ask] <one-line request summary> in a no-ask run. Keep it in_progress and
mark it completed when you send the report. Its metadata holds
preExisting and preExistingStaged (step 1) and, in no-ask mode,
decisions, each appended with TaskUpdate as it happens. It is not a unit of
work: leave it out of the report table and out of the ~50% growth count.
Without the Task tools there is no run task: keep that state in your replies, and no-ask mode ends at a compaction.
bash "${CLAUDE_SKILL_DIR}/scripts/preflight.sh" # default
bash "${CLAUDE_SKILL_DIR}/scripts/preflight.sh" --worktrees # worktree mode
STOP): you are inside a linked worktree. cd to the main checkout
it prints and re-run. Never dispatch, integrate or commit from a worktree.WARN): commits made in this run belong to no branch. Tell
the user once and suggest git switch -c <name>; don't create a branch
yourself. Carry on (no-ask mode: a report line naming the last commit SHA)./model opus) and carry on (no-ask mode: a report
line). Don't switch it yourself.WARN line as the worktree protocol (§3) says. Keep BASE.
BASE=none (no commits yet) rules out worktree mode: run writers unisolated.TREE=dirty, those paths are the user's own work,
not this run's. Record the full list (git status --porcelain; preflight
shows only 20) in the run task's metadata.preExisting, and the ones already
staged (git diff --cached --name-only) in metadata.preExistingStaged:
step 8's commit form keeps those staged and out of every commit. Normal
mode: ask with AskUserQuestion whether to include them in this run's commits,
recommending to leave them out; any the user includes stop being
pre-existing. No-ask mode: leave them out and log it. Never git add -A:
stage and commit explicit paths only (step 8). In worktree mode,
pre-existing unstaged edits to tracked files must be settled before the
first worktree wave (step 4).[sonnet·medium] Add REST endpoint for presets, [haiku·low] List callers,
[haiku·medium] Shortlist slow-load issues, [opus·high] Review diff vs spec.
The description carries: objective, files owned, inputs, done-criteria.addBlockedBy.CLAUDE_CODE_ENABLE_TODO_TOOLS=1 is not
active (how to set it: references/setup.md), and keep
the same list (with labels) in your replies instead.Size check: trivial work gets 0–1 agents, a small feature 2–4, a broad migration or investigation up to the cap. If the task count grows past the original plan by about half, stop and re-plan with the user instead of spawning more (no-ask mode: re-plan yourself and log it).
For each task pick the agent type, model and effort from
references/model-guide.md. Defaults: sonnet·medium
for scoped implementation; opus·medium for sprawling work and escalations;
opus·high for reviews, architecture, hard debugging and edge-case-heavy work;
Explore for code search on haiku·low (quick), haiku·medium (medium) or
sonnet·medium (very thorough). Record the choice with TaskUpdate:
owner = the agent name, metadata = {agent, model, effort, worktree, base}
(worktree: none outside worktree mode).
The label is the effort you routed. If preflight warned about
CLAUDE_CODE_EFFORT_LEVEL or maxEffortLevel, or the effort parameter is
missing, the report's "Model·effort used" column shows what actually ran.
isolation: "worktree" on the call. Worktree agents start from the last
commit, so with a dirty tree make a checkpoint commit first (step 8), re-run
preflight with --worktrees and use the new BASE. The same applies when a
worktree wave depends on verified but uncommitted results.git diff --name-only), they block the
wave: integrate-worktree.sh stops on them (exit 5). Staged ones do not
block (step 8 never commits them). Never stage, commit or stash them yourself.
Normal mode: before the checkpoint, ask with AskUserQuestion whether the
user commits them or sets them aside (their choice, done by them), or the
wave's writers run unisolated instead; wait for the answer (if the user
acted, update metadata.preExisting). No-ask mode: run that wave's writers
unisolated, one at a time, and log it. Details: worktree protocol §5.name (t3-api) so you can resume it. Explore agents can't be
resumed and need no name. Agent teams must stay off: with them enabled, a name
without isolation launches a teammate instead of a sub-agent.in_progress as you dispatch it. Only you have the Task tools;
workers cannot update the list.The worktree details (what to do with each preflight warning, same-file tasks, BASE) are in references/worktree-protocol.md §4–5.
Every agent gets a full brief from references/brief-template.md: builders and investigators the worker brief, reviewers the reviewer brief, verifiers the verifier brief; you are the only checker (hard rule 9). The worker brief carries objective, context with the settled decisions, files owned and off-limits, tools and sources, the restated rules, output format and size cap, done-criteria with the verify command, and "End with the list of files changed and how you verified them." Worktree briefs (worktree mode only) add BASE and the main checkout path, and Haiku briefs add the budget guardrails. Never send a one-liner.
git status --short and git diff for an unisolated writer; the --stat from
integration for a worktree agent), and run the done-criteria check yourself in
the main checkout. Then TaskUpdate completed, or handle the miss.git add its files by path
(or commit, if it closes a checkpoint), so the next writer's changes show up
apart from it in git diff. Never stage a pre-existing path this way: the
user's edits and the writer's are mixed in it. Avoid giving a task a
pre-existing path (staged or unstaged). If a run change lands in one anyway
(a writer, or an integrated worktree patch), normal mode: ask the user with
AskUserQuestion whether to commit that path with their edits in it or leave
it out; no-ask mode: leave it out of every commit and log it.npm run dev, as the README documents it); never install or touch anything
outside the repo. Still failing → unverified (could not run), report why.
Never send the worker to fix the environment or swap in an unstated weaker check.Unisolated writers need no integration: their changes are already in the main checkout, verified in step 6. Go on to the final verification below.
For each finished worktree agent, one at a time, in dependency order:
bash "${CLAUDE_SKILL_DIR}/scripts/integrate-worktree.sh" <worktreePath> <worktreeBranch> <BASE>
Keep the ROLLBACK: line it prints: git read-tree -u --reset <PRE_TREE>
restores this checkout exactly as it was before this patch. Exit 0 means the change
is staged here: verify it, then mark the task completed. Exit 3 means conflicts:
resolve them in the main session (never hand them to an agent; you hold the
decisions), git add the files and verify both tasks involved, or run the rollback
to abandon the whole patch. Exits 4 and 5 are STOPs: act on them as the worktree
protocol §6 says. Before re-integrating a resumed agent, roll back its earlier
integration if it was the last one; otherwise re-check the --stat for hunks you
had already removed. Full table in the worktree protocol §6–7.
Verification commands in the main checkout must exclude .claude/worktrees/
(test runners and grep -r would find the worktree copies), or run the full
verification after cleanup.
Then clean up, once verified and after your last SendMessage to that agent:
bash "${CLAUDE_SKILL_DIR}/scripts/cleanup-worktree.sh" <worktreePath> <worktreeBranch> --patch <PATCH>
Pass the path and branch from the same agent's completion: the script refuses a mismatched pair and refuses a locked worktree (its agent may still be running).
When all results are in, run the full verification once on the combined result
in the main checkout (after worktree cleanup, in worktree mode). For a large or
risky diff, add one fresh-context review (opus·high, reviewer brief). Skip it
when a test run already proves the change. At most 2 review rounds per run,
round 2 only when a test run does not prove the round-1 fixes; after round-2
fixes re-run verification, never a third review. Stop early when a review has no
confirmed blocker or should-fix.
Fix confirmed blockers and should-fixes (who: model guide §6); carry the
plausible items and nits. A plausible blocker that changes a contract other
code depends on or touches auth, access control, money, stored data, concurrency
or secrets gets one try (you or the resumed reviewer) at a breaking input; success → confirmed.
Commit at each checkpoint: a verified unit of work, before a worktree wave, or before switching to unrelated work. Commit on the current branch, whatever it is.
Handoffs follow the repo's CLAUDE.md. If it has a ## Handoffs section,
write the handoff it asks for (with the handoff-doc skill if it is
available, else by hand as that section says) and stage it in the same
commit. Without such a section, write no handoff file: a clear commit
message is enough.
Run git status --short --untracked-files=all and check nothing unexpected
is listed (Claude Code runtime files, stray reports). Take this run's own
paths from that list: modified, new, deleted (staged or not), both sides of
a rename (R old -> new), and the handoff. Files only, no directories.
Leave out every pre-existing path (unless the user said to include it, step
1 or step 6). A path the list does not show (created and deleted within the
run, so in neither HEAD, the index nor the working tree) has nothing to
commit and must be dropped: git commit rejects it. Then:
git update-index --add --remove -- <paths> && git commit -m "<message>" -- <paths>
update-index --add --remove stages each path as it is now, including new
files, deletions and paths whose deletion or rename is already staged
(where git add fails). The trailing -- <paths> commits only those paths,
so anything else in the index (preExistingStaged, or anything staged by
hand) stays staged and out of the commit. Never git add -A, and never
git commit without the paths.
Never push, unless the user asked for a push in the current request. Then
push only the current branch (git push -u origin HEAD), never
worktree-agent-* branches.
End the run with:
| Task | Model·effort used | Status | Verified how |
|---|---|---|---|
#1 [haiku·low] … | haiku·low | done | spot-checked 3 paths |
#2 [sonnet·medium] … | sonnet·medium → sonnet·high → opus·high (escalated) | done | npm test green |
Then: what failed or stays unverified (say so plainly, never bury it; list each
carried review item once under "unverified"), the commits made (short SHA and
subject, on which branch), a Left uncommitted list (pre-existing paths left
out, with any task changes mixed into them, and anything else not committed),
and, only if worktrees were used, confirmation that git worktree list shows
only the main checkout.
In no-ask mode, add:
Decided without asking
| Decision | Chosen | Why |
|---|---|---|
| Leftover worktrees from an earlier run | left untouched | no-ask mode never discards or integrates earlier work |
plus a Skipped list for any blocked part (what, why, what the user must do).
Agent calls made under any other skill (skills that spawn agents for reviews,
research and the like) still follow hard rules 1–4: explicit model and
effort, Fable only as rule 1 allows, and they count against the 5-agent cap.
Workers may load method skills that don't spawn agents, but never skills that
spawn agents and never this skill. When another active skill says "commit", that
means step 8 here; when it says "push", hard rule 6 applies.
In no-ask mode this skill's rule beats any other skill's AskUserQuestion. For
handoff-doc: never overwrite an existing handoff; write it at the next free
number and log that as a decision.
If the repo uses handoffs (step 8), read the latest one. Then run TaskList,
git log --oneline -10 and git status --short, and re-read the open run task
(TaskGet): its preExisting list still applies, and its decisions feed the
report. Task metadata holds each agent's name, model, BASE and worktree, so you
can pick up where you left off; an in_progress task whose metadata.worktree
is not none means the run is in worktree mode.
No-ask mode survives a compaction only if TaskList shows an open
(in_progress) [no-ask] run task for the same request. A completed one, or
one from another request, never carries it over; when in doubt, the run is
normal.
A session that was closed or crashed takes its running agents with it. Compare
the in_progress tasks with what is still running (and, in worktree mode, with
git worktree list). A task whose agent is not running any more will never send
a notification, so re-dispatch it: an unisolated writer after checking
git status for its partial edits, a worktree agent from the current BASE.
Re-run preflight before any new dispatch.
references/brief-template.md (opens in a new tab)references/model-guide.md (opens in a new tab)references/setup.md (opens in a new tab)references/worktree-protocol.md (opens in a new tab)scripts/cleanup-worktree.sh (opens in a new tab)scripts/integrate-worktree.sh (opens in a new tab)scripts/preflight.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub nathanonn/agent-skills --plugin orchestrateOther plugins' skills for the same job