swarm: Command for Claude Code

.claude/commands/sweep.md

sweep is a command for Claude Code from swarm-ai-research/swarm. It costs 0 tokens per session (1,486 once invoked), scanned A, original, MIT.

A command that runs a parameter sweep: it tests many combinations of settings for a simulation or experiment. It saves the results in a dated run folder and can also create summary files.

In plain words
What is it for?
Use it to compare many parameter combinations, save their CSV results, optionally create Parquet data, and produce per-configuration statistics.
Why use it?
It removes the repetitive work of launching each configuration and organizing the resulting data.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is swarm-ai-research/swarm's own configuration. It tells Claude Code how to work on swarm itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything swarm configures →

Reuse

Borrowing it

Nothing to install: this file belongs to swarm-ai-research/swarm. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/swarm-ai-research/swarm/main/.claude/commands/sweep.md
Clone the repo
git clone --depth 1 https://github.com/swarm-ai-research/swarm

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sweep

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/sweep.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/sweep)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/sweep"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/sweep.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 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,486 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.01486
Opus 5 $0.00000 $0.00743
Sonnet 5 $0.00000 $0.00297
Haiku 4.5 $0.00000 $0.00149

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

Security

Grade A, and why

sweep 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 8d 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/sweep.md · 123 lines

How it starts

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

/sweep

Run a parameter sweep and write results to a standardized run folder — use standalone when you need sweep data only, without statistical analysis or paper scaffolding. Distinct from /run_scenario (single scenario, single seed), /analyze_experiment (statistical analysis on existing data), and /full_study (end-to-end pipeline chaining sweep + analysis + plots + paper).

Usage

/sweep [scenario_path] [output_name]

Examples:

  • /sweep (defaults to scenarios/baseline.yaml)
  • /sweep scenarios/boundary_test.yaml boundary_sweep

Behavior

  1. Create runs/<YYYYMMDD-HHMMSS>_sweep/.
  2. Execute the built-in sweep example:
  • python examples/parameter_sweep.py --scenario <scenario_path> --output <run_dir>/<output_name>.csv
  1. If pandas+pyarrow are available, also write Parquet:
  • <run_dir>/<output_name>.parquet
  1. Auto-generate summary.json: After the CSV is written, read it with pandas, group by parameter columns, and compute per-config summary statistics:
import pandas as pd, json
from pathlib import Path

df = pd.read_csv(csv_path)
run_dir = Path(run_dir)

# Identify parameter columns (governance.* or any column with few unique values)
param_cols = [c for c in df.columns if c.startswith("governance.")]
grouped = df.groupby(param_cols)

configs = []
for name, group in grouped:
    config = dict(zip(param_cols, name if isinstance(name, tuple) else [name]))
    config["n_runs"] = len(group)
    for metric in ["welfare", "toxicity_rate", "quality_gap", "honest_payoff", "adversarial_payoff", "opportunistic_payoff"]:
        if metric in group.columns:
            config[f"mean_{metric}"] = round(group[metric].mean(), 4)
            config[f"std_{metric}"] = round(group[metric].std(), 4)
    configs.append(config)

summary = {
    "scenario": scenario_id,
    "seed_base": seed,
    "epochs": epochs,
    "runs_per_config": runs_per_config,
    "total_runs": len(df),
    "param_combinations": len(configs),
    "configs": configs,
}
(run_dir / "summary.json").write_text(json.dumps(summary, indent=2))

This eliminates the manual post-processing step that was previously required before running /council_review.

Read the full file on GitHub · 123 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. 8d ago First seen · 123 lines · 0 tokens per session scan A 86625865792e

Subscribe to this mod's changes

sweep is a command published in the GitHub repository swarm-ai-research/swarm (41 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,486 tokens. 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.