Use at the start of ANY coding task in a git repo - implement, add, build, fix, debug, or refactor a feature, bug fix, refactor, quick fix, docs change, or investigation - and when resuming a senior-dev session. Classifies the task, routes it through the mandatory installed-skill chain (superpowers brainstorming/worktrees/plans/TDD/systematic-debugging/code-review/verification, read-only Codex phase reviews), runs the scoped test loop, records every phase in .senior-dev/state.json via the sta...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Conductor?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/foundry-studio-lab-conductor)
---
name: conductor
description: Use at the start of ANY coding task in a git repo - implement, add, build, fix, debug, or refactor a feature, bug fix, refactor, quick fix, docs change, or investigation - and when resuming a senior-dev session. Classifies the task, routes it through the mandatory installed-skill chain (superpowers brainstorming/worktrees/plans/TDD/systematic-debugging/code-review/verification, read-only Codex phase reviews), runs the scoped test loop, records every phase in .senior-dev/state.json via the state CLI, and drives the docs gate and zero-leftovers hygiene sweep. Also use when the user runs /senior-dev:start, asks what phase the session is in, or asks to finish/close the session.
---
# senior-dev conductor
You are running a senior-dev session. You do not write code casually: every
task goes through classification, the mandatory skill chain, recorded phases,
review gates, and a clean close. The state CLI is the only way you record
progress — never hand-edit `.senior-dev/state.json`, never claim a phase is
done without recording it at that moment.
State CLI (all commands run from inside the target repo):
```
node "${CLAUDE_PLUGIN_ROOT}/scripts/state-cli.mjs" <subcommand> [flags]
```
## 1. Engage
1. Run `node <plugin>/scripts/state-cli.mjs status` (the session bootstrap
gives the exact path). If it reports an active session, resume at the
reported phase — its skill source and guard answer are already recorded,
so skip the rest of §1; do not restart completed phases. On resume also
run `state-cli guard status`; if it prints `stale`, run `state-cli guard
install` (consent already given) so the hooks carry the current gate
logic. If it prints a `codex:` update line, offer `codex update` before
the first Codex pass —
the review lanes use whatever CLI is on PATH. In a Codex-app host (no
Claude subagent tool) check the `claude` CLI is present
(`claude --version`); the Claude review pass runs through it.
2. **Skill source (fresh run only, before classifying).** Decide which skills
fill the process phases this run. Run `node <plugin>/scripts/state-cli.mjs
skills-config show`.
- **Config present:** state its `source` as the project default and ask a
one-beat confirm — "Project default: **<source>** (with this repo's
`<mapped phases>`). Use it, or choose another?" A bare "yes"/"use it"
proceeds; naming another source switches.
- **No config:** ask the four-way question, `superpowers` marked default:
1. **own** — this project's own skills fill each phase.
2. **superpowers** (default) — the canonical chain.
3. **combo** — superpowers base, this project's skills layered on where
they exist.
4. **suggest** — search for skills with `find-skills` and pick.
- Record the operator's answer for next time:
`state-cli skills-config set --source <s> [--steps 'plan=<skill>,review=<skill>']`,
and on first creation ask once: keep this config **private** (default) or
**share** it with the team? On "share" run `state-cli skills-config share`
and tell them to `git add .senior-dev/skills.json`.
- Record the run's choice once the session exists (after `init`):
`state-cli skill-source --source <s> --map '<phase→skill json>' [--suggestions '<json array of candidates the operator took>']`
(add `--suggestions` when the source is `suggest`).
3. **Universal guard (fresh run only, once per repo).** Run
`state-cli guard status`.
- `absent` and no recorded answer: ask once — "Install the universal
enforcement hooks? They make the gates hold in Cowork, Codex, and plain
terminals too — written to this repo's git hooks; existing hooks are
preserved and chained." Yes → `state-cli guard install`. No → run
`state-cli guard uninstall` (records the decline; safe no-op when
nothing is installed); never re-ask.
- `installed`: proceed silently. `stale`: run `state-cli guard install`
again (silent refresh; consent already given).
- `absent` but the config says installed (hooks went missing): mention it
once and re-offer (tell them apart via the `guard` key in step 2's
`skills-config show` output — `guard status` prints bare `absent` in
both cases).
- `declined`: stay silent; `/senior-dev:guard` remains available.
4. Classify the task as exactly one of the types below. If genuinely
ambiguous, ask the operator ONE multiple-choice question.
5. Initialise: `state-cli init --task "<one-line task>" --type <type>`
6. **Skill check (fresh run only, after `init`).** Check every phase skill the
resolved chain names against the skills visible in this session, once. Any
that is not listed: record it now, not mid-run: `state-cli degrade --wanted
"<skill>" --used "<fallback>" --reason "not in visible skill list"`.
7. **Test commands (once per repo, the first time a lane with an `implement`
phase starts; never for `docs-only` or `investigation`).** If `state-cli skills-config show` has no `tests` block,
ask for the commands, offering a guess from `package.json` (or the repo's
CLAUDE.md): `full` (required), plus `related`, `one`, `report` (a JUnit XML
path), `setup`, `build` where they exist. Record with
`state-cli skills-config set-tests --full "<cmd>" [--related "<cmd with {files}>"]
[--one "<cmd with {test}>"] [--report <junit.xml>] [--setup "<cmd>"] [--build "<cmd>"]`.
Declined: `state-cli skills-config set-tests --none` and the repo stays on
`tests-green`.
| Type | When |
|---|---|
| `feature` | New behaviour or capability |
| `bug-fix` | Existing behaviour is wrong |
| `refactor` | Behaviour preserved, structure improved |
| `quick-fix` | ≤3 files, ≤~30 min, obvious change |
| `docs-only` | Prose/docs only, no code |
| `investigation` | Read-only question answering |
**Escalation rule:** a `quick-fix` that grows past 3 files or ~30 minutes is
no longer a quick fix. Tell the operator you are escalating, then run
`state-cli reclassify --type <stricter type> --reason "<why>"` in the same
session (phases, reviews and runs are kept; the reclassification is logged
and shown by `status`). Going to a lower lane needs the operator's yes, then
add `--by-operator`.
## Skill source resolution
The phase spine never changes; the source decides which skill fills each phase.
- **own** — each phase resolves to a project skill: `skills.json` `steps`
mapping first, then a project skill you can see (project `CLAUDE.md` /
installed project skills). A phase with neither is a gap (below).
- **superpowers** — each phase resolves to its canonical `superpowers:*` /
built-in skill (the chains in §2). This is the default.
- **combo** — superpowers base; a project `steps` mapping or visible project
skill overrides that phase; phases the project doesn't cover stay on
superpowers.
- **suggest** — invoke `find-skills` to search skills.sh, present ranked
candidates, let the operator pick; fold chosen skills into the chain. Install
only on an explicit yes.
**Per-phase picker.** When the operator chooses `own` or `combo` — or asks to
customise skills — offer the picker for the current lane. Offer it once the
lane is known — after `init` — or ask the operator which lane to configure
before running `resolve`/`set-lane`. For each phase show the current mapping
(`state-cli skills-config resolve --lane <lane>`), the project skills you can
see, and installed candidates; let the operator pick per phase or accept all
defaults in one answer. Record picks with
`state-cli skills-config set-lane <lane> --steps 'phase=skill|fallback,...'`
(`|` = ordered fallback, first INSTALLED skill wins; skipping an uninstalled
entry is recorded with `state-cli degrade` when the phase runs — degrade needs
an active session). Never hand-edit skills.json.
**Resolution precedence** (the CLI applies it; you honour it): lane mapping →
flat `steps` → the source's default for that phase.
**Gaps** — a phase that resolves to no available skill, whether caught here or
mid-run:
- **Chain-plugin gap** (a `superpowers:*` / `codex:*` skill isn't installed):
read `references/skill-sources.md`, give the operator the exact install
commands, and — especially when they *chose* superpowers — **offer to run
them** (their yes required). State the restart caveat plainly: a fresh
install's skills/hooks load on the next Claude Code restart, not this session.
Then offer the choice: (a) proceed now on the built-in fallback (record
`state-cli degrade …`), or (b) install, restart, resume (state is resumable).
Never block; never install without the yes.
- **Domain/capability gap** (the task wants a capability no installed skill
covers): invoke `find-skills`, present ranked candidates, install only on a
yes.
Either way the gap is recorded via `state-cli degrade`, the nearest built-in
carries the phase if the operator declines to install, and the step is never
silently skipped.
## Gates and bypass
- **Commit gate**: blocks `git commit` during `implement`/`debug` until a
green `state-cli test` run is recorded for that phase (`tests-green` only
for repos without a tests config); blocks `push`/`merge`/`gh pr create`
until reviews are APPROVED, `verify` is done, the docs gate is clear,
and, with a tests config, the test rules hold: one full run, green or
waived, plus coverage on push/PR of the tree being shipped. `finish` and
`status` apply the same test rules. Use literal paths after `git -C` for
push and `gh pr create` (never `$(...)` or a variable): the gate cannot
expand them and judges such a push by the cwd's repo only. On repos that
ship, install the universal guard, which checks inside the target repo.
- **Stop gate**: challenges any claim that the session is done (or that
you've reached the `finish` phase) while gate items are still open.
- The waivers are `/senior-dev:bypass <reason>` and, for test failures
proven to pre-exist on the base commit only, `/senior-dev:ship <reason>` -
both operator-initiated only; you never arm either yourself.
`finish --force-open` likewise requires operator sign-off. (Escalating a
lane is `state-cli reclassify`, not a waiver.)
- **Waiting on external work**: when the session is genuinely parked on
background/external work (reviewers in flight, CI, a cloud job), arm
`state-cli waiting --on "<what>"` before ending the turn — the stop gate
stands down while it is set; clear it with `state-cli waiting --clear`
the moment you resume. It is logged in state and visible in status; it is
never a way to dodge a gate — commits/integration stay gated, and
`finish` refuses while a wait is active, even with `--force-open`.
## 2. The chains
Phases are recorded with `state-cli phase <name> --status in_progress|done
[--artefact <path>]` — `in_progress` when you start, `done` with the artefact
path the moment the phase's deliverable exists.
**feature** — `brainstorm → worktree → plan → implement → review → verify → docs → finish`
1. `brainstorm`: invoke `superpowers:brainstorming`. Artefact: committed spec.
2. `worktree`: invoke `superpowers:using-git-worktrees`. Session state lives
at `.senior-dev/state.json` in the MAIN checkout, not the worktree - the
state CLI and both hard gates resolve the main checkout root
automatically, so they keep working unchanged once you `cd` into the
worktree. Note: worktree tools may branch from origin/main — commits
that exist only on local main (the fresh spec/plan) must be pushed or
cherry-picked into the worktree before implementing; check before you
build.
3. `plan`: invoke `superpowers:writing-plans`. Artefact: committed plan.
4. `implement`: invoke `superpowers:subagent-driven-development` (or
`superpowers:executing-plans` inline) with
`superpowers:test-driven-development`. Test policy (repos with a `tests`
config; see also refactor and bug-fix, which follow it too):
- After each fix run `state-cli test --affected` (files default to what
changed). Use `test --one <id>` to re-check a single test. A green run
satisfies the commit gate; no `tests-green` needed. So does a run that
prints `counts as green`: red only on failures already proven
pre-existing - its non-zero exit is expected, do not chase it.
- Run `state-cli test --full` ONCE, when implement is complete - in the
background when it can outlast the Bash timeout. Never run the full
suite a second time to check a fix; later changes are covered by
affected runs, which the integration gate checks at push / PR creation
(not at local merge).
- A failure outside your diff: `state-cli test --preexisting <id>` proves
it fails on the base commit too. Proven, and the operator wants to
proceed: they run `/senior-dev:ship <reason>` (operator-only); after
that stop chasing pre-existing failures. Not proven means your change
caused it - fix it. Refused as `ambiguous id` or `different test`: the
id names more than one test - give those tests unique names. A proof
counts only for the full run it was made against, so after another red
full run, re-prove its failures. `passed no tests` means the full
command didn't run the suite (with `node --test`, pass a glob such as
`'test/*.test.mjs'`, not a directory) - fix the command.
- If a run prints `CONTRADICTION: ...` STOP fixing. Show the operator both
tests, ask which behaviour is right, and record the answer with
`state-cli test --resolve <id> --reason "<answer>"`.
- If `build` is configured, `state-cli test --build` before shipping.
- Repos with no `tests` config (or `--none`) keep `state-cli tests-green`
after each green run.
5. `review`: see §3.
6. `verify`: invoke `superpowers:verification-before-completion`. Record:
`state-cli phase verify --status done`.
7. `docs`: see §4.
8. `finish`: see §5.
**bug-fix** — `debug → implement → review → verify → docs → finish`
`debug` MUST be `superpowers:systematic-debugging` — no fixes before a root
cause. `implement` starts with a failing test reproducing the bug (TDD), and the
test policy under feature step 4 applies.
**refactor** — `worktree → plan → implement → review → verify → docs → finish`
Record a green baseline (`state-cli test --full`, or `tests-green` without a
`tests` config) BEFORE changing anything, then record a green run on
`implement` after each change (test policy under feature step 4) - the
baseline stamp does not carry forward as proof of a later green state. With a
`tests` config, that pre-change `test --full` baseline IS the lane's one full
run; later changes need only `test --affected`, never a second full run.
**quick-fix** — `implement → review → verify → docs → finish`
No spec/plan. Review is one focused Claude pass (§3 step 1); no subagent
fan-out - plus ONE Codex pass.
**docs-only** — `implement → review → docs → finish`
Use `elements-of-style:writing-clearly-and-concisely` (and `humanizer` where
apt). Review = operator read-through. No Codex pass (low value on prose).
**investigation** — `investigate → finish`
Read-only. Report findings; offer to open a real lane. No gates beyond an
honest close.
**Domain overlays:** load the domain skills the task touches (frontend →
`impeccable`/design skills; project-specific skills per that repo's
CLAUDE.md). Project CLAUDE.md and operator instructions ALWAYS outrank these
defaults.
**Missing skills:** handled by "Skill source resolution" above — chain-plugin
gaps use `references/skill-sources.md` (with assisted install), domain gaps use
`find-skills`. Always record the gap
(`state-cli degrade --wanted <skill> --used <fallback> --reason "<why>"`) and fall to the
nearest built-in; never silently skip a step.
## Model economy
Tiers come from config, not memory. Before EVERY subagent dispatch run
`state-cli dispatch --phase <phase>` and pass the printed `claude=` tier as
`model:` on the Agent call. The printed tier is a floor: to raise it, name
one of the SDD complexity signals and record it —
`state-cli dispatch --phase <phase> --claude <tier> --reason "<signal>"` —
where the signals are: multi-file integration, debugging, design judgement,
a subtle or risky diff, or fix-loop escalation at rounds 4–5. Never pass a
tier below the floor; the CLI refuses it. Brainstorm, plan, worktree,
verify, docs, and investigate run inline on the controller and are never
dispatched. `state-cli models --phase <phase>` is the read-only lookup
(use it for the Codex effort and the adjudicate tier). Show and change the
table with `/senior-dev:skills` and `state-cli skills-config set-models`.
Every dispatch still carries a fully scoped brief — complete requirements,
exact interfaces and file paths, verification commands, and a report
contract. A fresh subagent inherits nothing.
## 3. Review phase (every lane except docs-only/investigation)
1. Claude pass: `superpowers:requesting-code-review` on the phase diff. Use
`/code-review` as well ONLY when a skill of that exact name is in this
session's skill list, and note which one ran (`state-cli degrade` if the
chosen skill was missing). For lanes with a committed spec, brief the
reviewer: "compare the diff to it and report missing requirements, scope
beyond it, and behaviour that contradicts it as concerns." Fix findings via
`superpowers:systematic-debugging` + TDD, never by patching blind.
- Record: `state-cli review --phase <phase> --reviewer claude --verdict <V> --cycle <n> --skill <the skill that ran>`
- A host with no Claude subagent tool (the Codex app): run the same runner
as `review-run.mjs --reviewer claude --phase <phase> --range <a..b> --spec <path|none> --model <the claude= tier from state-cli models --phase review>`
(same background + `waiting` handling and exit codes as step 2) and record
with `--skill claude-headless`.
2. Codex pass (READ-ONLY, never `--write`):
- Read the effort: `state-cli models --phase review` for a per-phase pass,
`state-cli models --phase finish` for the final whole-branch pass →
`codex=<effort>`. (The lookup names the review's own tier row, not the
phase being reviewed, which has no Codex effort.)
- Run the runner (it finds the codex companion, checks the repo before and
after, and retries once on a non-JSON reply itself):
`node <plugin>/scripts/review-run.mjs --reviewer codex --phase <phase> --range <a..b> --spec <path|none> --effort <effort>`
(`--spec` is the committed spec path, or `none`; the prompt is
`references/review-prompt.md`). Run it in the background (Bash
`run_in_background`) and arm `state-cli waiting --on "codex review"`
while it runs; clear it when it returns.
`/codex:adversarial-review` stays available to the operator directly.
- Exit 0 → it prints the verdict JSON; record that verdict. Exit 3 (Codex
unusable) → run the printed `state-cli degrade` line and tell the
operator. Exit 4 (`WRITE DETECTED`) → stop everything and tell the
operator immediately. Exit 2 is a usage error: fix the flags.
- Record: `state-cli review --phase <phase> --reviewer codex --verdict <V> --cycle <n>`
3. `NEEDS_REVISION` → address concerns → re-review at cycle n+1. Cycle
counters restart at 1 for each new `--phase` value - they don't carry
over from a prior phase's reviews. **Cycle cap is 3** (the CLI enforces
it). After cycle-3 fixes, cycle 4 may be recorded ONLY as `--verdict
APPROVED` (the confirming pass); a cycle-4 NEEDS_REVISION or any cycle 5+
is refused. At that point: stop iterating, present both positions to the
operator, let them decide.
3a. **Adjudication (split verdict).** When the two reviewers' latest
verdicts for the phase differ, do not start cycle `n+1` yet:
- `state-cli models --phase adjudicate` → the adjudicator tier.
- Dispatch ONE subagent on that tier with: the rejecting reviewer's
concerns verbatim, the diff range, the approving reviewer's reasoning
if any, and this reply contract as the only permitted output:
`{"concerns":[{"id":"<n>","decision":"uphold"|"overrule","reason":"<text>"}]}`
Record the dispatch: `state-cli dispatch --phase adjudicate`.
- Non-JSON reply → treat every concern as upheld and say so.
- Any concern upheld → the fix loop for the upheld ones; re-review at
cycle `n+1`. Do NOT record an overrule for this cycle: an overrule is
reviewer-wide and would clear the upheld concerns too. Overruled
concerns simply need no fix.
- Every concern overruled → ask the operator ONE question listing each
concern with the adjudicator's reason. On yes:
`state-cli review --phase <phase> --reviewer <rejecting> --cycle <n> --overrule --reason "<operator's words>"`
— the phase now counts as approved. On no → the fix loop.
- Optionally record upheld ones for the audit trail:
`state-cli review ... --cycle <n> --uphold --reason "<why>"`.
Adjudication consumes no review cycle. You never arm an overrule
yourself; only the operator's yes clears a block.
The §5 final pass over the whole branch diff uses this same contract and
records both reviewer passes as `--phase finish`.
## 4. Docs gate
Tick items only when true, the moment they become true:
`state-cli docs --spec true` / `--plan true` / `--handover true` / `--affectedDocs true`
- `spec`/`plan`: committed spec + plan (full lanes only; the CLI omits them
from light lanes).
- `handover`: the repo's handover doc (SESSION-HANDOVER.md or the project's
convention; ask once if none exists) describes the TRUE end state.
- `affectedDocs`: walk the final diff; any README/docs page the change
invalidates is updated in the same branch. List what you checked.
## 5. Finish
Steps 1-2 apply only to lanes with a diff to integrate. `docs-only` skips
step 1 (no Codex pass on prose). `investigation` skips both 1 and 2 (no
branch exists) and goes straight to the sweep.
1. Final review passes - Claude (§3 step 1 naming rules) + read-only Codex - over the
complete branch diff, same procedure, runner (`review-run.mjs`, effort from
`state-cli models --phase finish`) and recording as §3 (the Claude
record carries `--skill <the skill that ran>`), recorded as
`--phase finish`. Where the lane had a single implement phase already
reviewed in full (§3), scope the final pass to integration diffs and
unreviewed deltas rather than re-reviewing the same code — record it
the same way.
2. `superpowers:finishing-a-development-branch` (merge/PR/discard menu).
3. Hygiene sweep: `state-cli sweep` — then FIX anything it shows: stray
worktrees, leftover branches, dirty status, surviving scratch files
(track them during the session with `state-cli scratch --add <path>`).
Where a remote exists, verify the pushed end, not just local state.
4. `state-cli finish` — archives state to `.senior-dev/history/` (refuses
if gate items are still open; see "Gates and bypass"). When nothing needed
doing (no commits, no new branches, clean tree, no extra worktrees), close
with `state-cli finish --no-change "<reason>"` instead; it verifies that
itself and refuses otherwise.
5. Report to the operator with the sweep evidence pasted verbatim — actual
command output, never assertions — and the `models used:` and
`adjudications:` lines from `state-cli status` when present.
## Red flags — you are rationalizing if you think:
| Thought | Reality |
|---|---|
| "This change is too small for the flow" | That's what quick-fix lane is FOR. Classify it. |
| "I'll record the phases at the end" | Record at the moment of transition, or the gates lie. |
| "Codex will just agree" | Then the pass is cheap. Run it. |
| "I can skip the sweep, the repo looks clean" | Looks ≠ evidence. Run `state-cli sweep`. |
| "The docs are probably fine" | Walk the diff. Tick items only when verified. |
| "I'll bypass just this once, quietly" | Only the operator can bypass, and it is logged. Ask; don't arm it yourself. |