ap-swarm

A command that starts a local swarm of multiple software agents. The agents coordinate through a journal file in the project instead of using the network.

In plain words
What is it for?
Use it to start, inspect, or configure a local multi-agent workflow, including its participants, storage location, and run options.
Why use it?
It provides a shared record for agent turns and lets several participants work through repeated dispatch cycles. It also supports running just one cycle when a continuous loop is unnecessary.

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/agentproto/ts/ap-swarm
Clone the repo
git clone --depth 1 https://github.com/agentproto/ts

Made for: Claude Code.

Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 633 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.00021 $0.00633
Opus 5 $0.00010 $0.00316
Sonnet 5 $0.00004 $0.00127
Haiku 4.5 $0.00002 $0.00063

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

Security

Grade A, and why

ap-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.

packages/runtime-profile-standard/files/.claude/commands/ap-swarm.md · 57 lines

How it starts

The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are starting a local-mode MultiAgentRuntime swarm using @agentproto/agent-runtime via the pnpm agentproto run-swarm verb.

Quick path

  1. If .runtime/multi-agent.yaml does not exist, copy the template:

    mkdir -p .runtime && cp .claude/examples/swarm-local.md .runtime/multi-agent.yaml
    

    Then read it back and tell the user what's wired (participants, substrate kind, state dir).

  2. Build the agent-runtime + cli packages if they haven't been built yet:

    pnpm --filter @agentproto/agent-runtime build && pnpm --filter @agentproto/cli build
    

    You only need this on first run or after pulling changes — tsup --watch (from pnpm dev) keeps it fresh.

  3. Start the swarm. Pass through any user-supplied args (--once, --interval, --verbose). Default:

    pnpm agentproto run-swarm --manifest .runtime/multi-agent.yaml --verbose
    

    This is a long-running loop. Suggest the user open a separate terminal for it, OR run with --once to do a single dispatch cycle and exit.

  4. Seeding the journal: tell the user that participant turns only fire on @Mention of a known participant. Show them how to add a seed turn manually:

    cat <<'EOF' >> .runtime/conversation.md
    === TURN id=t_seed participant=user ts=$(date -u +%FT%TZ) ===
    @Reviewer please look at <file or topic>
    EOF
    

    Or just edit .runtime/conversation.md directly in the editor.

Notes

  • The journal at .runtime/conversation.md is the source of truth for file mode. It's gitignored. Resetting = deleting the file.
  • Per-participant scratch state lives at .runtime/state/<participantId>.json. Also gitignored.
  • Other substrates (chat servers, MCP bridges, …) ship as separate plugin packages. Register them via --plugin <module-id> on run-swarm, or list them under plugins[] in ~/.agentproto/config.json.

Errors to watch

  • "unknown substrate kind ''. Registered kinds: […]" → the manifest's substrate.kind has no matching factory. Either fix the kind, or install the plugin that provides it and pass --plugin <module-id>.
  • "manifest file not found" → check the path; the verb resolves it from the current cwd.
  • Spawned claude returning non-zero → the participant agent's command failed. Check stderr in the swarm process output.

Read the full file on GitHub · 57 lines

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 · 57 lines · 0 tokens per session scan A f7e9615baed7

Subscribe to this mod's changes

ap-swarm is a command published in the GitHub repository agentproto/ts (5 stars, last pushed 2d ago), licensed Apache-2.0. It adds 21 tokens to every session and 633 once invoked, about $0.0001 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-31.