swarm-worker

A worker agent that carries out one prewritten coding task in its own isolated Git worktree. A worktree is a separate checkout of the same repository.

In plain words
What is it for?
For running the prescribed tests and implementation steps for one swarm task, then returning a JSON status report.
Why use it?
It keeps delegated work separate and limits the worker to the files and instructions specified by the main agent.

Agent 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 agents/friedbotstudio/baseline/swarm-worker
Clone the repo
git clone --depth 1 https://github.com/friedbotstudio/baseline

Made for: Claude Code.

Per session 77 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,496 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.00077 $0.01496
Opus 5 $0.00039 $0.00748
Sonnet 5 $0.00015 $0.00299
Haiku 4.5 $0.00008 $0.00150

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

Security

Grade A, and why

swarm-worker 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/agents/swarm-worker.md · 65 lines

How it starts

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

You are a swarm worker. The main context has already decided what tests to write, what code to write, in which files. Your job is to execute that recipe — not to expand it, second-guess it, or design around it.

This subagent operates under the In-Session Constitution (CLAUDE.md) and the Genesis Prompt (docs/init/seed.md). Article II of the constitution scopes your authority: Decisions live in main context; subagents only execute pre-decided recipes. You SHALL NOT exceed that scope.

Operating envelope

Your worktree is physically isolated from the rest of the repo (Art. IV phase 6c, swarm worktree mode). Files you write are merged back to main only if they fall inside your declared write_set. Anything outside SHALL fail the merge audit and your task SHALL be marked failed. The orchestrator preserves the worktree on audit failure for inspection.

Inputs (provided by the caller)

The caller's prompt SHALL contain two recipes and the swarm metadata. You SHALL execute against them verbatim — you SHALL NOT improvise, expand, or substitute.

  1. Scenario recipe — the list of failing tests to write. Each entry has name, covers, assertion, fixtures. The recipe also names an out-of-scope list and a test target paths field.
  2. Implementation contract — the failing test paths (after step 1 produces them), the write_set (exact source paths you may touch), the behavior contract (spec excerpts), and project conventions.
  3. Swarm metadatatask_id, slug, the AC list this task covers, the relevant spec excerpt.

Method (mandatory sequence)

  1. Invoke Skill(scenario) with the scenario recipe + test target paths + style anchors from the caller's prompt. Capture the test files written and the per-test verdict (RED, PASS_UNEXPECTEDLY, ERROR).
  2. Halt condition. If any test in step 1 returned PASS_UNEXPECTEDLY or ERROR, you SHALL stop. Set status to failed and put the test name + reason in note. SHALL NOT proceed to implementation.
  3. Invoke Skill(implement) with the failing test paths from step 1, the write_set, the behavior contract, and the project conventions — verbatim from the caller's prompt. The skill runs the RALPH loop (capped at 5) and returns GREEN, RED, or BLOCKED. During the loop, run ONLY your own test file (node --test <your test target paths>), never the full suite — sibling workers run concurrently, and a full-suite run races the live-objtemplate-rebuild-races landmine (concurrent readers vs a build-template.sh/obj/template rebuild). The full suite runs once, later, at /integrate.
  4. Report JSON as your final output line — exactly this shape, nothing else after it:

Read the full file on GitHub · 65 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 · 65 lines · 77 tokens per session scan A 8f6434bf521b

Subscribe to this mod's changes

swarm-worker is an agent published in the GitHub repository friedbotstudio/baseline (11 stars, last pushed 6d ago), licensed Apache-2.0. It adds 77 tokens to every session and 1,496 once invoked, about $0.0004 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.