approve-swarm

A command that records a person's approval of a swarm plan. A swarm plan divides a larger coding task into work assigned to separate worker agents.

In plain words
What is it for?
For approving a named swarm plan by creating a temporary approval record that the dispatch process checks.
Why use it?
It prevents the workers from being dispatched until a human has reviewed and approved the plan.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/friedbotstudio/baseline/approve-swarm
Clone the repo
git clone --depth 1 https://github.com/friedbotstudio/baseline

Made for: Claude Code.

Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 702 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00031 $0.00702
Opus 5 $0.00015 $0.00351
Sonnet 5 $0.00006 $0.00140
Haiku 4.5 $0.00003 $0.00070

Measured 2d ago against content hash 052db5db5856, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

approve-swarm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/approve-swarm.md · 27 lines

What it actually says

The user has reviewed the swarm plan referenced by $ARGUMENTS and approved it for dispatch.

How this works structurally: when the user typed /approve-swarm <slug>, the consent_gate_grant UserPromptSubmit hook ran before this body was passed to Claude and wrote a short-lived consent marker at .claude/state/.swarm_approval_grant whose slug is the bare slug derived from <arg>. The swarm_approval_guard PreToolUse hook reads that marker on the approval-token Write and allows it when the marker is fresh and the approval filename's bare slug matches. Claude cannot forge the marker — that's what makes the gate structural.

State-write discipline (binding — see .claude/CONSTITUTION.md §2 "State-write discipline"). The approval token at .claude/state/swarm_approvals/<slug>.approval is a Tier 1 consent artifact: it SHALL be written with the Write tool only. You SHALL NOT write it via Bash (no >/>> redirect, heredoc, tee, cp, or sed -i) — destructive_cmd_guard blocks Bash writes to consent paths, and the swarm_approval_guard marker is validated only on the Write tool. Read the plan JSON with the Read tool; use Bash solely for date +%s.

Steps:

  1. Derive the bare slug from $ARGUMENTS in-context (no shell needed): strip any directory prefix and a trailing .md. The same canonicalization runs inside consent_gate_grant.
  2. Confirm the plan exists at .claude/state/swarm/<slug>.json by reading it with the Read tool. If the Read fails, stop and ask for the correct slug.
  3. From the plan you just read, confirm it has status: "planned" and a non-null waves array (i.e., the validator ran). If not, tell the user to re-run /swarm-plan first.
  4. Write the approval token with the Write tool to .claude/state/swarm_approvals/<slug>.approval (the Write tool creates the parent directory). Contents:
    • Line 1: APPROVED
    • Line 2: epoch timestamp (run date +%s)
    • Line 3: plan path (.claude/state/swarm/<slug>.json)
    • Line 4: task count + wave count from the plan (e.g., tasks=7 waves=3)
  5. Confirm to the user: "Swarm plan approved for <slug>. Run /swarm-dispatch <slug> to begin parallel execution. Tasks declared at plan time are the ONLY files each wave may write to — the boundary guard enforces this."

Do NOT mark the plan file itself as approved in any status field — the approval token is the authoritative record (mirrors /approve-direction).

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 27 lines · 31 tokens per session scan A 052db5db5856

Subscribe to this mod's changes

approve-swarm is a command published in the GitHub repository friedbotstudio/baseline (11 stars, last pushed 7d ago), licensed Apache-2.0. It adds 31 tokens to every session and 702 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.