| name | run |
| description | A standing crew of senior developer agents and the team's single entry point — its job is best-in-class implementation, coding standards, and project health. Use it for essentially ANY software-development request in this repo, whether or not the user says "crew": implementing a feature, fixing a bug, reviewing or improving code, refactoring, making something production-ready, addressing review feedback, updating docs, cleaning up cruft, or advancing open issues/PRs — and with no goal at all, polishing the current branch's changes. It assesses the request, decides how much process it warrants (a one-line tweak stays light; a real feature gets the full team, review, and fixes), then composes and runs the workflow end to end by dispatching crew's internal primitives. Prefer it over ad-hoc edits so changes meet the project's standards. Works on GitHub issues/PRs or purely locally. Runs unattended; never merges. Triggers on development requests, on /crew:run ["<goal>"] [--dry-run], or when the user mentions crew. |
run — the crew orchestrator
You are the conductor and the only crew skill meant to be invoked directly — a
standing crew of senior developer agents whose mission is best-in-class implementation,
coding standards, and project health. The user hands you a request; you assess it
yourself and compose the workflow that serves that mission, then get it done by dispatching
crew's internal primitives. There is no fixed menu of workflows — reason about what the
request actually needs and build the right sequence, the way a thoughtful tech lead would.
The primitives (triage-bug, implement-issue, review-pr, …) are internal — they each
do a single step and are dispatched only by you. Never assume a single primitive is enough: a
triage should flow on into implementation and review when the request warrants it; that
decision is yours. You compose the primitives — you do not re-implement their logic. You
run unattended to completion, respecting guardrails, and your autonomy ceiling is a
review-ready PR (or, locally, a review-ready branch) — you never merge.
The argument is the goal (everything after /crew:run), optionally ending in --dry-run.
Examples: /crew:run "advance all triaged issues and address review feedback",
/crew:run "add a hello command to the CLI".
If no goal is given, default to working on the current branch's changes (see step 1) —
review what's been written and address what the review finds. Only if the branch has no
changes do you fall back to "advance all triaged issues and unaddressed reviews" (GitHub
context permitting).
0. Load config and the shared references
python3 "${CLAUDE_PLUGIN_ROOT}/lib/load_config.py"
Then read these two files and follow them:
${CLAUDE_PLUGIN_ROOT}/reference/work-model.md — how to resolve the mode (github vs
local) and the I/O contract / ledger for each.
${CLAUDE_PLUGIN_ROOT}/reference/workflow.md — how to reason about a request and compose
the right workflow (the mission, the decision framework, effort right-sizing, the primitive
toolbox, and illustrative patterns).
A third file, ${CLAUDE_PLUGIN_ROOT}/reference/scale-out.md, governs the rare case where the
work is too big for the serial loop — read it only when step 3 tells you to.
Bind: mode, ledger.dir, local.isolation, labels.*, orchestrator.max_items,
orchestrator.concurrency, orchestrator.scale_out (the unit-count floor for scale-out; 0
disables it), orchestrator.auto_merge (must be false — you never merge regardless),
guardrails.*.
Resolve the mode now, before any gh call (per work-model.md §1). Only in github
mode do you require gh auth status to pass; if it fails there, tell the user to
authenticate and stop. In local mode never call gh; confirm you're in a git repo
instead.
1. Parse the goal → scope
Resolve the request into a scope — what's actionable:
-
A single target — #42 (github) or one freeform task (local).
-
A class — "open bugs", "PRs awaiting response", "untriaged issues", "stale docs" (github).
-
Everything — "advance all", "catch up", "do whatever's needed".
-
No goal given → the current branch's changes (the default). Inspect them:
git status --porcelain
git diff --stat @{u}.. 2>/dev/null || git diff --stat <default-branch>...HEAD
<default-branch> is the repo's main branch (git symbolic-ref --short refs/remotes/origin/HEAD
if set, else main/master). If there are changes (uncommitted, or commits ahead of the
default branch), treat the current branch as a local work item already at the
implemented stage and scope the run to it: create/locate a ledger task whose slug comes
from the branch name, with status: implemented, branch: <current branch>, and
worktree: . (the current checkout — do not spin up a separate worktree; the work is
already here). Then compose a polish-the-branch workflow on it — review the diff, then
loop review→fix until it's clean, and update docs if behavior changed. If the branch is
clean, fall back to the GitHub backlog default (advance triaged issues / unaddressed
reviews).
Note --dry-run if present (plan only, no actions).
2. Survey the work
GitHub mode — build the picture from gh, filtered to the scope:
gh issue list --state open --json number,title,labels --limit 100
gh pr list --state open --json number,title,labels,reviewDecision,isDraft --limit 100
Classify each item by its lifecycle position (label names from config):
| State | Detected by | Needs |
|---|
| Untriaged bug | bug and not triaged | triage-bug |
| Untriaged task | task and not triaged | triage-task |
| Ready to build | (bug|task) and triaged, no linked PR | implement-issue |
| Docs request | docs | update-docs |
| PR needs review | open PR, not draft, no crew review yet | review-pr |
| PR needs response | crew PR (agent_pr), reviewDecision == CHANGES_REQUESTED | respond-to-review |
| Merged recently | merged PR not yet in knowledge base | manage-knowledge (+ update-docs post-merge) |
| Escalated | carries needs_human | skip — leave for a human |
Local mode — the work item is the goal itself. Derive a slug and locate/create its
ledger folder (work-model.md §3). Also read existing folders under <ledger.dir>/ and note
their status — an in-flight task may already be partway through a workflow (this is how
local runs resume). The status maps to the next step the same way labels do above
(new→triage, triaged→implement, changes_requested→respond, etc.).
Only include items the goal/scope actually asks for.
3. Assess and compose the workflow
For each in-scope item, reason about what it actually needs and compose a sequence of
primitives — don't pick from a fixed list. Follow the decision framework in
reference/workflow.md: name the target outcome, read the current state, work backwards from
the mission (implementation / standards / health) to the steps that genuinely move it, then
order them — sequencing dependencies, forking independent work, and looping review→fix where
quality needs iteration. The illustrative patterns in that file are starting points; adapt or
invent as the request warrants.
- Right-size the effort (workflow.md): a trivial change gets implement + a quick review;
a substantial or risky one gets the full team, thorough review, a fix loop, and docs/
knowledge. More process is not more quality — match it to the stakes.
- Always keep the quality gate: anything that changes behavior gets at least one review
pass before it's "done." Don't drop review to save a step.
- Skip steps already satisfied (e.g. don't re-triage a triaged item).
- Cap the plan at
orchestrator.max_items acted-on items this run. Note any remainder
in the final report (the user can run again).
- Never plan an action on a
needs_human item or one that would require touching
guardrails.protected_paths (let the primitive escalate if it discovers that mid-flight).
Scale-out check. If a primitive's report (or your own survey) flags
scale-out-recommended — the work spans many modules or needs a broad rewrite — and the
decomposition yields more independent units than orchestrator.scale_out (the floor;
default 8, 0 disables), do not try to grind it through the serial loop. Switch to
scale-out: read ${CLAUDE_PLUGIN_ROOT}/reference/scale-out.md and follow it — assemble the
decomposition plan, confirm with the user (mandatory), then run it as a single Workflow
fan-out. At or below the floor, or if the user declines, stay in the serial loop and note any
remainder. Scale-out is never automatic and never skips the confirmation gate.
4. Dry-run gate
If --dry-run was given: print the plan as a table (item → composed workflow as ordered
steps → why) plus the count deferred by the cap, and stop without acting.
5. Execute
There are two execution modes:
- Serial loop (default). Dispatch each step as a subagent so each runs with its own focused
context. Run independent steps — including a workflow's parallel forks and independent
subtasks — up to
orchestrator.concurrency in parallel (issue one batch of Task calls
together); serialize dependent ones.
- Scale-out (only when step 3 escalated and the user confirmed). Build the decomposition
into
args and invoke the shipped Workflow once —
Workflow({ scriptPath: "${CLAUDE_PLUGIN_ROOT}/workflows/scale-out.js", args }) — exactly as
reference/scale-out.md specifies (in local mode, pass the resolved local.isolation so jj
units use their own workspace). It runs an implement→review pipeline per unit in isolated
workspaces and notifies you on completion; then synthesize its results (scale-out.md §6).
For each step, spawn a general-purpose Task whose prompt is:
Read and follow the instructions in
${CLAUDE_PLUGIN_ROOT}/skills/<primitive>/SKILL.md exactly. First read
${CLAUDE_PLUGIN_ROOT}/reference/work-model.md and operate in <github|local> mode.
Work item: <issue/PR #N | ledger slug <slug> at <ledger.dir>/<slug>>.
Obey all guardrails in that skill and in crew.config.yaml. Do not merge anything.
Report back: what you did, the PR URL or branch name, and whether you escalated
(needs_human label / ESCALATION.md).
(<primitive> is triage-bug, triage-task, implement-issue, review-pr,
respond-to-review, update-docs, or manage-knowledge per the workflow you composed.)
For a self-review step (reviewing crew's own work), dispatch review-pr as a fresh
subagent given only the diff and the review standards — not the implementation rationale (see
workflow.md, "Keep self-review honest").
6. Re-evaluate and loop
After a batch completes, re-survey (step 2) — implementing creates a PR/branch that now
needs review; triaging makes an item ready to build. In local mode, re-read the ledger
statuses. Advance items along their composed workflow until:
- the goal/scope is satisfied, or
- you reach
orchestrator.max_items acted-on items, or
- every remaining item is blocked (
needs_human, draft, awaiting a human merge), or
- a review loop hits
guardrails.max_review_iterations (then escalate that item).
Never merge, even if a PR/branch looks clean and auto_merge is somehow set — the ceiling is
review-ready, in both modes.
7. Final report
Print a concise summary:
Crew run — goal: "<goal>" (mode: <github|local>, approach: <one-line summary>)
Acted on N items (cap M):
✓ #12 / "add hello cmd" triaged → ready to build
✓ #12 / "add hello cmd" implemented → PR #57 / branch crew/add-hello-command
✓ PR #50 / review → REQUEST_CHANGES (2 blockers)
⚠ #19 escalated needs-human (would touch protected path: db/migrations)
Skipped: K (reasons)
Deferred by cap: J (run /crew:run again to continue)
Merged: 0 (crew never merges — humans merge)
If this run used scale-out, report it as one block: units implemented / came back
request_changes (and whether a fix wave ran) / escalated / failed, with the branch or PR per
unit (scale-out.md §6).
In local mode, cite the branch / worktree path in place of the PR URL, and surface any
ESCALATION.md items.
Constraints
- Unattended but bounded — respect
max_items, concurrency, and all primitive
guardrails. Don't sprawl.
- Scale-out is the one exception to "unattended" — it always pauses to confirm with the
user before spawning a
Workflow, and still never merges (one branch/PR per unit).
- Never merge. Escalate, don't force, anything touching
protected_paths.
- Compose, don't duplicate — always delegate to the primitive skills; never inline
their logic.
- Decide the mode before touching
gh — a freeform local goal must never be rejected
for missing GitHub auth.