claude-code-swarm
CLAUDE.md0 starsChanged 5 months agoMITView on GitHub
Claude Code plugin: multi-agent swarm orchestration (director skill, agents, workflow scripts, two tiny hooks). Plain markdown/JS — no package.json, no build step. On Windows, run in Git Bash. CI additionally lints skill/agent frontmatter (name: must match dir/filename). The last line is the sanitize gate (branding rule, tools/sanitize.sh, tested by tools/sanitize.test.mjs): .sanitize-terms is a gitignored, one-regex-per-line term list that must never be committed — when the file is absent (CI, forks) the check passes silently. Pass 1 scans tracked and untracked…
In this repository7 other files it gives its agents.
- repo-entrySkill
- swarm-directorSkill
- swarm-doctorSkill
- swarm-greenfieldSkill
- swarm-issuesSkill
- swarm-resumeSkill
- swarm-setupSkill
The file
Files
codeswarm — repo context
Claude Code plugin: multi-agent swarm orchestration (director skill, agents, workflow scripts, two tiny hooks). Plain markdown/JS — no package.json, no build step.
Dev gate (must pass before any commit)
node -e "JSON.parse(require('fs').readFileSync('.claude-plugin/plugin.json','utf8')); JSON.parse(require('fs').readFileSync('.claude-plugin/marketplace.json','utf8')); JSON.parse(require('fs').readFileSync('hooks/hooks.json','utf8'))"
for f in hooks/*.js tools/*.js runner/*.js; do node --check "$f"; done
node --test workflows/*.test.mjs tools/*.test.mjs runner/*.test.mjs
sh hooks/hooks.test.sh
sh tools/sanitize.shOn Windows, run in Git Bash. CI additionally lints skill/agent frontmatter
(name: must match dir/filename).
The last line is the sanitize gate (branding rule, tools/sanitize.sh,
tested by tools/sanitize.test.mjs): .sanitize-terms is a gitignored,
one-regex-per-line term list that must never be committed — when the file is
absent (CI, forks) the check passes silently. Pass 1 scans tracked and
untracked files outside the exclusions (LICENSE + manifest attribution,
.claude-plugin manifests); pass 2 scans the gitignored local my-*
artifacts that declare scope: global in their frontmatter (an agent .md,
or a skill's SKILL.md, which covers the whole skill dir minus
node_modules) — git grep otherwise skips them. Unmarked my-* files are
project-specific by design and stay unscanned. Any hit fails the gate: fix the leak, never
widen the exclusions. It runs on git grep because msys grep -f (Git Bash
ships grep 3.0) can abort on the combined term list — and only a genuinely
clean scan (exit 1 on both passes) passes: a matching term (exit 0) or a
crashed grep (exit >1) both fail loud instead of passing silently.
node --check is for hooks, tools/ and runner/ only: the workflow
scripts are Workflow-harness modules (export const meta + top-level
return) that plain node cannot parse — their syntax gate is
workflows/syntax.test.mjs, which runs inside the node --test step.
Invariants
See CONTRIBUTING.md — hard rules: never hardcode a top-tier model in a
workflow script; quiet is the default for every agent; upstream never ships
my-* files; generation is approval-gated (content review included); hooks
stay tiny, exit 0, offline, no writes.
Structural constraints (deliberate — do not "fix")
- Everything rides on Claude Code's Workflow tool, which has no stable
public API.
workflows/syntax.test.mjsmirrors the harness wrapper andworkflows/harness-contract.test.mjsexecutes every script against a mock of the documented harness semantics (numbered contract clauses — diagnose breakage there first). After a Claude Code update, prove the plumbing live with/codeswarm:swarm smoke(plus the gradedfixtures/evalrun) before trusting the scripts; a passing smoke recordslastSmokeVersionin the config and the SessionStart canary nudges when the running version drifts from it. Last live proof: 2026-09-23 on Claude Code 2.1.280, plugin 1.5.0 (fixtures/smokeplumbing pass, plus four gradedfixtures/eval3review-tier runs, lite, canonical bait target — two on the pre-1.5.0 verify code, two on 1.5.0 — all 2/2 with zero lures flagged; eight more that day, incl.execRepro, sonnet finders and the newfixtures/eval4, same result), from a session whose model was Opus 5.5 — which proves the PLUMBING under that session (script parse, dispatch, schema-forced output, phase/token accounting), not top-tier finding:swarm-smoke.jspins BOTH its finder and its verifier to haiku, so no smoke run has ever exercised the top tier. Prior proof: 2026-07-15 on 2.1.210 (fixtures/smokeplumbing pass;fixtures/eval2graded 4/4 0 FP pass;fixtures/evalgraded 3/5 — the two documented haiku misses;fixtures/eval3graded 2/2 pass), recorded against a different config dir than the one this machine reads. NOTE on the live log (one log per config dir, so per MACHINE — logs are never merged; the 2026-09-11 external-review check read another machine's log and wrongly concluded this run was never recorded): the log's FIRST non-zero verify delta landed 2026-08-17 in the Windows machine's~/.claude/codeswarm-eval-log.jsonl, fixture labelfixtures/eval3-bait-review(baselineUnexpected 4 → unexpected 1, logged before run conditions had fields of their own) — a gradedeval3run viaswarm-review.jswith a deliberately suspicion-biased target killed 3 false positives (all threeguards.jslures) and wrongly rejected nothing; both planted bugs survived. Every other genuine run is still zero-delta, and the smoke tier CANNOT produce this measurement (haiku flagged nothing inguards.jsacross 4 runs) — to measure the delta, runswarm-review.jsoneval3with an aggressive target, at least twice (an identical re-run flipped one finding between confirmed and rejected). One false positive survived that run, with a repro that does not actually reproduce. Read the log orrecord-eval.jsoutput for the current count/totals, never a frozen number here. On 2026-07-15 the log was purged of a 20-line2026-07-06batch that had been backfilled into it (19/20 lines shared an identical placeholderoutputTokens, so they were reconstructed history, not independent live runs); a backup sits next to the config. The 2026-07-06 figures below are therefore DOCUMENTED HISTORY only, not live-log evidence. Run 1: 5/5 recall, 0 false positives, baseline identical. The fixture then gained two pure false-positive trap files (jobs.js, thenschedule.js); a re-baseline run scored 3/5 recall (graded FAIL) and produced the first reported verify delta (1 FP killed). A follow-up 20-run batch at the haiku tier (ad hoc script, not shipped) surfaced two things now recorded infixtures/eval/README.md:jobs.jshad an UNINTENDED real bug (firstSuccessful([])threwundefined) that verify correctly confirmed as real 4/20 times — fixed, not a verify failure; and haiku-tier recall on this fixture is uneven per bug (cart.js/stats.jsmissed 13/20,dates.jsmissed 0/20) — a property of the cheapest tierswarm-smoke.jsdeliberately hardcodes, not a claim aboutswarm-review.js(session-model finder, sonnet verify). Reported totals from that documented 2026-07-06 batch (NOT in the live log): 1 false positive killed, 1 real bug wrongly rejected — opposite signs, and both from data no longer on disk. The live A/B evidence is the 2026-08-17eval3run noted above (3 FPs killed, 0 wrongly rejected): one data point in the layer's favour, not a trend — see the honesty section in README. Read the log for the run count; never freeze one here. A third fixture,fixtures/eval3, is precision-weighted: itsguards.jsis correct code shaped like notorious bugs (including the correct-form twin ofeval2's real<=off-by-one) to make a finder emit a false positive the verify layer can kill — the fixture built to make the delta non-zero over repeated runs. Every graded run is recorded viatools/record-eval.jsintocodeswarm-eval-log.jsonlnext to the config (accumulating A/B evidence; the tool also owns thelastSmokeVersionwrite). - The Workflow-tool dependency has a shipped fallback: the standalone
runner (
runner/) executes the workflow scripts UNCHANGED viaclaude -psubprocesses (the public headless interface), with its own journal/resume under<configDir>/codeswarm-runs/.runner/harness.test.mjsasserts the same C1–C8 contract clauses against the real implementation and runs every shipped script through it. When an update breaks the Workflow tool: canary fires → smoke fails → dispatch vianode runner/run.jsinstead (degraded — no /workflows UI, no in-session permission prompts — not dead). Read docs/security.md "Standalone runner" before touching its permission flags. - Prompt text is duplicated between
agents/*.mdand the workflow scripts on purpose: scripts run without filesystem access and the repo has no build step, so single-sourcing is impossible.dimension-sync.test.mjsguards the copies — extend it when adding a new duplicated clause. (The standalone runner does readagents/*.mdat spawn time — under it the agentType body is single-sourced; the in-script duplication stays for the Workflow-tool path.) - The director skill stays PROSE for judgment work (triage, fit & cost
gate, estimates, task grouping) — that is inherently model judgment and
cannot move into code. Only mechanical bookkeeping is codified
(
tools/record-eval.jsowns the eval log +lastSmokeVersionwrite); new bookkeeping goes there too, never back into skill prose. - The review dedup key (
swarm-review.js) matches EXACT line numbers on purpose: no ±N line fuzz — distinct findings on adjacent lines must never merge; an occasional double-verify of the same reworded finding is the accepted cost. - The verify layer's value is deliberately stated as THIN evidence (README
"What's measured vs. designed"): the eval evidence to date holds two
measured deltas in OPPOSITE directions (one false positive killed, one real
bug wrongly rejected — from the documented 2026-07-06 batch, NOT retained in
the current log) plus the one 2026-08-17
eval3-bait-reviewrow in favour of the layer, and twelve 2026-09-23 review-tier rows at delta 0 (sixteen by the end of the day, four with finderReadOnly) because the finders emitted no false positives — reading-only finders included, so it is finder precision, not only finders running their own claims; and the two REAL-code rows (2026-09-23, full rigor, one private repo, blind model grader): an older branch — 29 findings, 27 real, verify confirmed all 29, both false positives at critical; the current develop branch — 29 findings, 28 real + 1 unsure, verify confirmed the 28 and left the unsure one inconclusive. Killed 0, wrongly rejected 0 in both, for 275k and 224k of verify output tokens. The README states this; never drop it — anecdotes, not a trend, and repeating the SAME fixture adds correlated samples, not independent evidence (see the 2026-07-06 batch note above). The only real fix is more/varied fixtures graded over time — never reword the README claim stronger without log evidence, and never "fix" the honesty section away. - README repeats context that also lives in
docs/on purpose (cost levers, eval story): the README must stand alone for a first-time reader; dedup against docs/ is not wanted.
Docs
docs/ — architecture, workflows, configuration, security model. Read
docs/security.md before touching token handling, hooks, or the onboard
flow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

