swarms
AGENTS.md86 starsChanged 7 months agoMITView on GitHub
Swarm is a Claude Code plugin for launching agent teams. Eight commands drive an interactive setup that creates a coordinated team with defined roles and rules; users extend it with custom mode skills — full modes or thin wrappers over a built-in mode. Everything is a prompt. No runtime composition, no imports, no framework — self-contained markdown consumed in one pass.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Everything is a prompt: No runtime composition, no imports, no framework — self-contained markdown consumed in one pass.
- Very specific: line 76
Skill invocations: must use the Skill tool explicitly: "You MUST use the Skill tool to invoke swarm:<name>.
- Distinctive: line 85
No build step, no tests, no linter.
- Very specific: line 100
Step 0 future enhancement: If CLAUDE_CODE_ENTRYPOINT reliably distinguishes web/IDE entrypoints, scope the disabled-branch "try proceeding" …
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Anti-ratchet constraint on the briefing templates
- The briefing templates are FIXED (canonical in skills/workflow-rules/SKILL.md). No added sections, no prescribed investigation steps, no "first action" items, no acknowledgment rituals. If a member needs more context, improve the noun-phrase identity in suggest-members — never the template. (Observed regression vector: f7db555 sprayed framing into every brief → premature-termination and step-repetition failures.)
- Carve-out: harness protocol mechanics are permitted. One instruction on HOW members communicate (SendMessage is the wire; plain text dies with the turn) is transport, not task prescription. Task framing, lifecycle framing, phase framing, and rituals remain forbidden.
What This Is
Swarm is a Claude Code plugin for launching agent teams. Eight commands drive an interactive setup that creates a coordinated team with defined roles and rules; users extend it with custom mode skills — full modes or thin wrappers over a built-in mode.
Architecture
Everything is a prompt. No runtime composition, no imports, no framework — self-contained markdown consumed in one pass.
commands/launch.md # Catch-all command — interactive team setup (Steps 0–8)
commands/code.md # Mode shortcut — pre-selects Code, delegates to launch.md
commands/triage.md # Mode shortcut — pre-selects Triage, delegates to launch.md
commands/write.md # Mode shortcut — pre-selects Writing, delegates to launch.md
commands/refine.md # Standalone — runs Review/Refine/Deliver against the current branch + PR
commands/workflow.md # Custom mode entry point — takes a mode skill name, delegates to launch.md
commands/create-workflow.md # Scaffolding — interviews user, generates mode skill + shortcut command (wrapper or full)
commands/update-workflow.md # Refresh — regenerates the plugin-owned wiring of an existing shortcut command
skills/code-mode/ # Code mode: lead identity, facilitator title, rules, phase arc
skills/triage-mode/ # Triage mode: diagnose an issue (cause + blast radius), no code change; phase arc has no Refine
skills/writing-mode/ # Writing mode: lead identity, facilitator title, ownership boundaries, editorial baseline, phase arc
skills/general-mode/ # General mode: silent fallback + wrapper base — no shortcut command
skills/workflow-rules/ # CANONICAL governance spec — hard rules, briefing templates, gate presentation contract, launch mechanics, pulse
skills/gate-presentation/ # Frozen per-gate constants (question/options/digest/preview) — invoked fresh at each gate
skills/suggest-members/ # Recommends team composition based on outcomes and mode
skills/writing-style/ # Structural pattern analysis (trope detection) for writing-mode review
skills/resolve-dispute/ # Resolves stuck review findings via put-up-or-concede exchange
skills/define-rubric/ # Available skill for teams that genuinely need formal validation criteria
skills/independent-review-loop/ # Independent pre-delivery review loop — Codex or swarm-native fallback
agents/swarm-member.md # Read-only team-member agent definition — every spawned teammate
agents/swarm-reviewer.md # Ephemeral read-only reviewer for the independent-review-loop fallback — never a teammate
.claude-plugin/plugin.json # Plugin manifest
.claude-plugin/marketplace.json # Marketplace registry entry
.claude/swarm-ship.md # Per-project ship definition (created at first launch, user-owned)- Commands spawn teams (Agent tool; teams form implicitly at first spawn; requires Claude Code ≥ v2.1.178). Shortcuts read launch.md via
${CLAUDE_PLUGIN_ROOT}and run it with mode pre-set;/swarm:workflowtakes a custom mode name as argument. - Skills are Skill-tool helpers — they cannot launch teams. Mode skills are invoked by the lead at Step 8b and return the phase arc + mode rules.
swarm:workflow-rulesis the canonical governance spec (hard rules, briefing templates, gate presentation contract, launch mechanics, pulse) — invoked by launch.md Step 1 and by project-local commands that cannot read${CLAUDE_PLUGIN_ROOT}.swarm:gate-presentationholds the frozen per-gate constants, invoked fresh at each gate.
How launch.md works
- Flow: Step 0 pre-flight → Step 1 governance → Step 2 (outcomes → explicit tier pick → silent mode inference + suggest-members → team approval) → Step 7 confirmation → Step 8 spawn. Steps 3–6 are definitions serving Step 2 and "I have changes," not a walked sequence.
- Three gates stand between outcomes and spawn — tier, team, launch. Inline
$ARGUMENTSoutcomes exempt none of them (that skip caused a real regression).$ARGUMENTSis substituted before the model sees the prompt; when present, only the outcomes question is skipped. - Step 7 and Step 8 labels are load-bearing cross-references throughout the plugin — keep the names.
Phase arc
Research → Converge → Approve → Execute → Review → Refine → Deliver — the universal skeleton; the mode skill defines each phase's semantics and may omit a phase. Triage drops Refine (a diagnosis has an evidentiary terminal); its Deliver restates the omission so the lead doesn't re-import the refine-or-deliver question by habit.
Independent review loop
- What: an independent reviewer (Codex preferred; swarm-native fallback of fresh Codex-style subagents) reads the whole branch diff against the approved outcome; the lead triages, fixes in-scope functional findings, and re-runs until clean (no round cap on Codex; backstop 15 rounds on the Swarm fallback; oscillation → user). Differentiator: independence + exhaustiveness — distinct from the recursive-refinement ladder, never a replacement.
- When: offered at code-mode's unified pre-ship gate (recursive+independent / recursive only / independent only / ship as is); runs at Deliver AFTER the ship steps. No GitHub PR required — the PR is only a push target. The lead relays every round's reviewer output verbatim with a one-line disposition, clean rounds included.
- Engine: persists to
.claude/swarm-review.md(ask-once / read-thereafter; a saved pref selects but never asserts availability — re-checks at runtime, degrades without rewriting the file). Codex runs read-only via stdin (codex exec review -); depends only on thecodexbinary. Usage-limit errors auto-wait on a durablecodex-reset-waittask within a ~5–6h cap, escalating beyond it. Rubric adapted from OpenAI Codex (codex-rs, Apache-2.0). - Durable state, not recall: the gate records
independent-review-loop pendingas a run-state task; Deliver branches on it (ship → loop → terminal). The run-state task list is a closed two-item vocabulary defined in workflow-rules — not a general tracker. The pulse ends the run at the true terminal (CronDelete first, then keep-open/shutdown); its two governing rules live in Team Lead Rules, never General Rules. - The pulse holds pending decisions two deliberately-different ways — do not harmonize. A codex-reset-wait escalation surfaces once then holds (its durable task survives compaction); an AFK-timed-out decision gate is re-emitted in full on each hold (the re-emission is what survives compaction). Kept here, never in the shipped pulse prompt.
Mode skills and custom workflows
- Invocation: the lead invokes the mode skill at Step 8b — built-ins with the
swarm:prefix, custom modes by unqualified name from the project's.claude/skills/. - Full-mode interface: Lead Identity; Facilitator Title; Facilitator Identity; Lead Allowlist (opt); Pre-flight Reads (opt); Mode-Specific Rules; Information Flow (opt); Outcomes Question (opt); Suggest-Members Guidance; Phase Arc.
- Wrapper interface:
extends:frontmatter; Extension Contract; additive Mode-Specific Rules; Lead Allowlist additions; Suggest-Members supplement. Any full mode is a valid wrapper base. - Extension hard contract: wrappers cannot override the base's phase arc, lead identity, or facilitator; their additions are additive-only. A workflow needing different phase semantics is authored as a full mode.
- Entry points:
/swarm:workflow <mode>(plugin-shipped; resolvesextends:at runtime); per-workflow shortcuts generated by/swarm:create-workflow(they invokeswarm:workflow-rulesfor governance);/swarm:update-workflow <name>regenerates only the plugin-owned## Workflowsection, with diff + confirmation. Generated files carrygenerated-by: swarm@<version>.
Key Conventions
- Skill invocations must use the Skill tool explicitly: "You MUST use the Skill tool to invoke
swarm:<name>. Do NOT perform this step yourself." - All members except lead are read-only (behavioral constraint in hard rules).
- Hard rules live once in
skills/workflow-rules/SKILL.md(canonical); launch.md Step 1 invokes it rather than mirroring it. Edits to the hard rules there are user customizations — preserve them during upgrades. - Terse definitions. One sentence for agent roles, few lines for skills. More context makes LLMs worse (VISION.md compression principle).
- When withholding capability "on principle," the only acceptable principle is end-user experience. Deliberate limits that serve it (read-only members) stay; never deny a command what it needs to do its job — a permission prompt is acceptable, a dead end is not.
- Shipped commands are cross-platform. They run on macOS, Linux, and Windows (Git Bash) — prefer portable instructions and let the executing model adapt to the local shell.
Development Notes
- No build step, no tests, no linter. The deliverables are markdown prompts.
disable-model-invocation: trueon all shortcut commands — users invoke explicitly; remove only if a command should be model-offered.REFERENCE_PROMPT.mdis gitignored — the original requirements doc, kept locally.- Plugin enablement requires
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1"; swarm requires Claude Code ≥ v2.1.178 — the release that removed the TeamCreate tool upstream (2026-06-15). - No maintainer commentary in shipped files. Rationale, provenance, and future-enhancement notes go in Maintainer Notes below — never in
commands/orskills/. - Governance is single-source.
skills/workflow-rules/SKILL.mdis canonical; launch.md references it (Step 1, Step 8). Do not re-inline governance into launch.md — the pre-2026-07 mirror demonstrably drifted.
Maintainer Notes
Dev-process rationale relocated out of shipped command/skill files (see Development Notes).
- Version floor (v2.1.178+; upstream release 2026-06-15). Swarm's TeamCreate/
team_namebranch was removed in #78 (2026-07-02) — teams form implicitly,team_namenever passed. If explicit team creation returns, resurrect from git history (launch.md 8a, pre-#78: 9d315e7, 2026-07-02). The pre-spawnToolSearch(select:TeamCreate)floor probe was removed 2026-07 (it violated the spec's own detect-by-env-flag principle); the floor now surfaces in the spawn-failure remedy, which names v2.1.178+ explicitly. - Mode-confirm modal removed (2026-07). Mode is inferred silently and surfaced at Step 7. If a mode-confirm modal is reintroduced adjacent to the outcome fork, re-evaluate the reflex-tap adjacency.
- AskUserQuestion preemption is upstream (observed, unresolved — no confirmed issue number; a previously cited #64651 tracks an unrelated VSCode background-output bug, do not re-cite it). Live teammate notifications can preempt a modal; split-pane (tmux/iTerm2) avoids it; the live-gate net recovers in-process terminals. Do NOT force-set teammateMode — it silently falls back. The recovery catch assumes a preempted modal returns detectably-invalid content (observed n=2, not proven universal); revisit if a future Claude Code returns valid-looking stale content. Related rendering fact (observed 2026-07-09, two live sessions, terminal CLI, same local install): mid-turn text streams to the user in a plain working turn; a same-turn AskUserQuestion collapses that turn's streamed text (both observed non-renders sat in modal-adjacent turns). The independent-review-loop relay ordering depends on the streaming half; its escalation modals are self-sufficient because of the collapsing half.
- AskUserQuestion 60s AFK auto-resolve fixed upstream (v2.1.200, 2026-07-03) — recovery RETAINED deliberately. The fix makes auto-resolve default-off, opt-in via /config, so the sentinel still fires for opt-in users (and residual v2.1.198–2.1.199 sessions); detection is self-scoping (keys off the sentinel string appearing, not a version), so it costs nothing dormant. Do not strip the recovery on "the bug is fixed": the plain-text restatement, declared AFK carriers, and pulse re-emission are SHARED machinery — they also serve preemption recovery (still live, above) and compaction durability of a pending gate. A future removal would need all three consumers gone, not just the AFK bug.
- Step 0 future enhancement. If CLAUDE_CODE_ENTRYPOINT reliably distinguishes web/IDE entrypoints, scope the disabled-branch "try proceeding" offer to them. Verify it actually differentiates first.
- 8c future enhancement (#34750). A Step-0 SendMessage-availability check could catch the silent no-teammate case pre-spawn; cut because SendMessage is deferred (presence ambiguous). Revisit if it becomes non-deferred.
- Known limitation — Fable-tier lead: member model overrides not served (upstream; no swarm fix by user decision 2026-07-02). A swarm-member spawned from a Fable parent runs Fable weights despite the transmitted
modeloverride (opus n=2, sonnet n=1; both tiers — Balanced silently draws Fable quota). Any future detect/warn must key off the server persona line inside the member; a member self-report collides with the anti-ratchet ban — resolve via the protocol carve-out or a non-brief channel, never brief sections. - Gate presentation is catalog-driven, split hybrid (contract, partition rule, and authoring rubric: the Gate Presentation section in skills/workflow-rules/SKILL.md; frozen per-gate constants: skills/gate-presentation/SKILL.md, invoked fresh at each gate and rendered same-turn). Each lead→user gate is a frozen constant — question, header, options, digest field-list, preview content — projected into three renders (question text / option
preview/ AFK plain-text restatement) under a verbatim-transport contract: runtime fills declared slots and selects among frozen options, never authors shape. The hybrid split is a user decision (2026-07-03) over the resident-section shape it replaced: constants are byte-sensitive and the late gates (Approve/Finish/Refine/Terminal) render post-compaction — a compaction preserves meaning, not bytes — so constants re-read from disk on gate arrival and on pulse re-emissions — a same-turn re-issue of a held gate reuses the loaded entry (actor-split, user steer 2026-07-07: per-render re-fetch inside the compaction-free 60s re-ask loop was pure redundancy) — while the discipline rules are comprehension-material and stay resident. Partition rule: no field in two carriers at the same fidelity — question carries handles, preview carries elaboration. Sites (launch Steps 2/4/7, /swarm:refine Step 3, generated workflow steps 3–5, mode-skill Approve/Finish/Refine/Terminal gates) name their gate only — the invoke-fresh instruction lives ONCE, as a Team Lead rule in workflow-rules (user steer 2026-07-03: no per-site invocation boilerplate); do not re-inline presentation at a site, and do not fold the constants back into workflow-rules. The transport layer is verifiable (string-match against the catalog); the authoring rubric is an authoring-time aid, not a runtime guarantee. Runtime facts (v2.1.198): question field renders plain text only;previewrenders markdown (single-select only); no schema caps — over-length truncates silently. Two dead ends, do not re-walk: don't cram the full markdown block into the question text — it renders as literal syntax noise and flattens into an unreadable wall; and don't instruct "print the plan in the main window" — that target is undefined for the executing model, and the same-turn modal covers whatever gets printed anyway (also why the Approve synthesis now rides in the modal preview). Both were shipped and reverted (history, if needed: PRs #78/#81/#83). Residual: pre-change shortcuts keep old wording until their repo runs/swarm:update-workflow. agents/swarm-reviewer.mdtool omissions are deliberate (2026-07-10). The independent-review-loop fallback spawns it ephemerally (noname; findings return to the lead on completion) — the fix for fallback reviewers joining the roster as teammates. Its kit is exactlyRead, Bash, Grep, Glob, LS: no SendMessage and no ToolSearch, because ToolSearch is the re-fetch vector (agents/swarm-member.md:11 documents re-fetching SendMessage that way) — only the hand-picked kit structurally prevents team messaging. Do not normalize the kit to swarm-member's; that reopens the path. The reviewer persona stays single-sourced in the spawn prompt (skills/independent-review-loop/SKILL.md, Swarm fallback section), never in the def. There is no rule mandating teammates over sub-agents — do not add an "exception" clause for one.- Independent-review-loop relay renders before fixes (2026-07-09).
skills/independent-review-loop/SKILL.mdstep 3 emits each round's relay (header + verbatim reviewer output + intent-phrased disposition) as one contiguous leading block ahead of the round's fix edits; the prior rule cramming the whole relay into the turn's final text block rested on a false premise (only-final-block-renders) and produced the reported inversion — edits streamed first, findings landed last. The final block now carries only a thin disposition recap. Rejected, do not restore: the final-block cram (the inversion returns) and every turn-split variant — relay-ends-turn/fix-next-turn, ping-wakers, self-crons — because a mid-loop bare-idle yield races the live pulse (re-enters the loop from the top on an uncommitted diff, resets the round count, double-drives), and making it safe needs a third run-state task in a deliberately closed two-item vocabulary. Modal-ending escalation rounds (e.g. oscillation, auth/fatal degrade, and — Swarm fallback only — its round cap) carry their substance inside the modal — self-sufficient, quoting the reviewer's own line where a valid review ran — because a same-turn modal collapses streamed text. Ordering is the invariant the skill asserts, not a rendering guarantee; observed in the terminal CLI entrypoint. One deliberate turn boundary remains (independent-reviewer finding, 2026-07-09): the loop's final relay ends its turn and Deliver's terminal handshake (pulse-delete + Terminal gate) runs on the next wake via the pulse's existing terminal backstop — a same-turn Terminal modal would collapse the final relay; safe here, unlike mid-round, because the terminated loop cannot race the pulse. Rounds themselves run backgrounded, one per turn, so no escalation modal shares a turn with an earlier round's relay; the terminating turn also carries any in-session delivery artifact (no-PR digest, refine summary) before the deferred handshake.
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.

