/swarm-improve — Multi-Agent Project Improvement
End-to-end workflow: plan → branch → delegate execution → verify.
This is a thin orchestrator. The heavy lifting is in /plan (analysis) and /delegate (execution).
Step 0: Validate Baseline
Before anything else:
cdto the project (absolute path — store it, you'll need it for every delegate)- Read
CLAUDE.mdorREADME.md→ find the test command - Run tests:
bash: make test(or equivalent)
If tests FAIL → HARD STOP. Create one P0 task "fix broken tests" and finish. Do NOT plan improvements on a broken project — all delegate work will fail too.
Step 1: Plan
If .tasks/PLAN.md already exists and is recent (< 24h):
- Read it, skip to Step 2
- Tell the user you're using the existing plan
Otherwise, run the /plan workflow inline (this skill has the same tools):
- Recon — already done in Step 0
- Design dimensions — pick 3+ analysis angles adapted to the goal (not hardcoded)
- Check agent availability — try each agent before committing to the plan
- Delegate to 3+ diverse agents — agent diversity mandatory (claude + gemini + codex preferred)
- Wait — poll every 60s with
delegate_status - Synthesize — cross-reference, dedup, create STAR-formatted execution tasks +
.tasks/PLAN.md
Use the task tool for all task creation — never write .tasks/ files manually. Files are named YYYYMMDD-NNN-slug.md automatically.
Step 2: Branch
bash: cd <absolute-project-path> && git checkout -b improve/swarm-$(date +%Y%m%d)
All delegate work happens on this branch. Master/main stays clean.
Step 3: Delegate Execution
Read .tasks/PLAN.md for the prioritized task list. Each task has STAR format — Action tells the delegate what to do, Result tells how to verify.
Assign agents by strength, diversify across agents:
| Task type | Primary | Fallback |
|---|---|---|
| Code changes, refactoring | claude | gemini |
| Quick fixes, single-file | codex | claude |
| Tests, docs | claude | codex |
| Review, analysis | gemini | opencode |
Always pass absolute cwd:
delegate_task {agent: "claude", task_path: ".tasks/YYYYMMDD-001-fix-xxx.md", cwd: "/absolute/path/to/project"} delegate_task {agent: "gemini", task_path: ".tasks/YYYYMMDD-002-refactor-xxx.md", cwd: "/absolute/path/to/project"}
If an agent fails immediately (not installed, auth error) — switch to fallback agent, don't retry the broken one.
Limit: 3 delegates at a time. When one finishes, start the next.
Step 4: Monitor & Collect
Poll every 60s:
bash: sleep 60 delegate_status
When a delegate finishes, read its task file for results:
read_file: <project>/.tasks/YYYYMMDD-001-fix-xxx.md
If a delegate failed — note it, move on. Don't retry in this cycle.
Step 5: Verify
After all delegates finish:
bash: cd <project> && make check(or project's test command)bash: git log --oneline improve/swarm-*..HEAD— what was committedbash: git diff --stat main..HEAD— scope of changes
Step 6: Report
finish: "Improvement complete on branch improve/swarm-YYYYMMDD. - N tasks planned, M completed, K failed - Agents used: claude, gemini, codex (diversity: N unique) - Tests: pass/fail - Files changed: N - Ready for review: git diff main..improve/swarm-YYYYMMDD"
Gotchas
- Baseline MUST pass — HARD STOP if broken — real failure: orchestrator planned 3 tasks on a project with broken tests. All delegates failed because the code didn't compile. Total waste of time and API credits. Run
make testFIRST. - Always branch BEFORE delegating — never delegate on master. If working tree is dirty, stash or commit first.
- 3 delegates max concurrently — agents compete for CPU, rate limits, API quota. When one finishes, start the next.
- Agent diversity on execution too — don't send all tasks to claude. Mix agents: claude for complex edits, codex for simple fixes, gemini for analysis. Real failure: all 3 sent to claude = $0.50+ and no diversity.
- Absolute paths everywhere —
cwdmust be absolute. Task paths indelegate_taskare relative to cwd. Real failure: orchestrator cd'd in bash then used relative paths — delegates couldn't find task files. - Use
tasktool, neverwrite_filefor tasks — thetasktool generates correctYYYYMMDD-NNN-slug.mdnames with proper IDs. Real failure: orchestrator created files viawrite_filewith 60-char names, thendelegate_taskcouldn't find them. - Verify MUST run — even if all tasks report success, run the full test suite. Agents may break each other's work through shared file edits.
- codex/gemini may not be available — check early. If
delegate_taskfails for an agent, switch to fallback immediately. Don't waste time retrying broken agents.


