swarm: Command for Claude Code

.claude/commands/analyze_experiment.md

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

A command for statistically analysing SWARM experiment results. It can run scenarios across several random seeds or analyse an existing sweep CSV, reporting measures such as p-values, confidence intervals, and effect sizes.

In plain words
What is it for?
Running multi-seed analyses, grouping experiment conditions, and analysing previously generated sweep-result CSV files.
Why use it?
It adds statistical checks to experiment results instead of relying on a single run or raw averages.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

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/analyze_experiment.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 analyze_experiment

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/analyze_experiment/github.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/analyze_experiment)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/analyze_experiment"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/analyze_experiment/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for analyze_experiment

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/analyze_experiment"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/analyze_experiment.svg" alt="Reviewed on agentmods" width="80" 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 2,405 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.02405
Opus 5 $0.00000 $0.01203
Sonnet 5 $0.00000 $0.00481
Haiku 4.5 $0.00000 $0.00241

Measured 10d ago against content hash 154fbddb1d07, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

analyze_experiment 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 10d 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/analyze_experiment.md · 244 lines

How it starts

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

/analyze_experiment

Run statistical analysis on SWARM experiment data. Two modes: run a scenario across multiple seeds, or analyze an existing sweep CSV — use when you have run data and need statistical rigor (p-values, confidence intervals, effect sizes). Distinct from /sweep (generates data without analysis), /run_scenario (single run without statistics), and /full_study (chains sweep + analysis + plots + paper end-to-end). Consolidates the former /stats command (now /analyze_experiment --csv).

Usage

/analyze_experiment <scenario_path_or_id> [--seeds N|seed1,seed2,...] [--groups auto|key=ids,...]
/analyze_experiment --csv <sweep_csv> [--output <dir>]

Examples:

  • /analyze_experiment rlm_recursive_collusion
  • /analyze_experiment scenarios/rlm_memory_as_power.yaml --seeds 20
  • /analyze_experiment rlm_governance_lag --seeds 42,7,123,256,999
  • /analyze_experiment rlm_memory_as_power --groups high=rlm_1,rlm_2,rlm_3 mid=rlm_4,rlm_5,rlm_6 low=rlm_7
  • /analyze_experiment --csv runs/20260210-223119_kernel_market_v2/sweep_results.csv
  • /analyze_experiment --csv runs/latest/sweep_results.csv --output runs/latest/

Argument parsing

Parse $ARGUMENTS to extract:

  • --csv <path>: CSV mode — run statistics on an existing sweep CSV (see CSV Mode below)
  • --seeds: Either an integer N (generate N random seeds) or a comma-separated list. Default: 42,7,123,256,999,2024,314,577,1337,8080 (10 seeds).
  • --groups: How to group agents for comparison. auto (default) infers from scenario YAML. Otherwise label=id1,id2,....
  • --output <dir>: Output directory (CSV mode only). Default: same directory as the CSV.

If --csv is present → CSV mode. Otherwise → Scenario mode.


Scenario Mode (default)

Preferred: Use the persistent analysis script

python -m swarm.scripts.analyze <scenario_path_or_id> [--seeds <seeds>]

This handles everything: scenario loading, seed execution, group detection, statistics, corrections, and artifact export. Just run it and print the output.

Read the full file on GitHub · 244 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. 10d ago First seen · 244 lines · 0 tokens per session scan A 154fbddb1d07

Subscribe to this mod's changes

analyze_experiment is a command published in the GitHub repository swarm-ai-research/swarm (42 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,405 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.