swarm: Command for Claude Code

.claude/commands/compare_studies.md

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

A command that combines results from two or more completed study runs. It calculates summary statistics, compares pairs of runs, and creates a comparison plot.

In plain words
What is it for?
Use it to compare metrics such as welfare, toxicity rate, quality gap, or participant payoffs across study runs.
Why use it?
It avoids manually collecting results from separate run folders when you need to see how study settings or scenarios differ.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/compare_studies.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/compare_studies)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/compare_studies"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/compare_studies.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,428 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.01428
Opus 5 $0.00000 $0.00714
Sonnet 5 $0.00000 $0.00286
Haiku 4.5 $0.00000 $0.00143

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

Security

Grade A, and why

compare_studies 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/compare_studies.md · 127 lines

How it starts

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

/compare_studies

Compare results across multiple completed study run directories: compute cross-study descriptive statistics, pairwise tests, and generate a comparison plot.

Usage

/compare_studies <run_dir1> <run_dir2> [run_dir3 ...] [--metric welfare] [--output <path>]

Examples:

  • /compare_studies runs/20260213-003757_ldt_large_population_study runs/20260213-003812_ldt_low_prior_study
  • /compare_studies runs/*_ldt_*_study
  • /compare_studies runs/study_a runs/study_b runs/study_c --metric toxicity_rate

Arguments

  • run_dir: Two or more run directories containing sweep_results.csv and/or analysis/summary.json
  • --metric: Primary metric for comparison (default: welfare). Also accepts toxicity_rate, quality_gap, honest_payoff, adversarial_payoff.
  • --output: Output directory for combined analysis and plots (default: runs/ with auto-generated filename).

Behavior

Phase 1: Load and validate

For each run directory:

  1. Look for sweep_results.csv — load as DataFrame
  2. Look for analysis/summary.json — load descriptive stats and pairwise tests
  3. Extract the scenario name from summary.jsonscenario field, or infer from directory name
  4. If neither file exists, skip with a warning

Validate that all studies sweep the same parameter (e.g. all sweep acausality_depth). If parameters differ, warn but proceed (label axes accordingly).

Phase 2: Cross-study descriptive statistics

For each study, extract per-condition means and SDs for all available metrics. Produce a combined table:

| Study          | Condition | Welfare (mean +/- SD) | Toxicity | Honest Payoff | Adversarial Payoff |
|----------------|-----------|----------------------|----------|---------------|--------------------|
| large_pop      | depth=1   | 366.38 +/- 19.69     | 0.3425   | 22.47         | 3.34               |
| large_pop      | depth=2   | 371.41 +/- 16.33     | 0.3434   | 23.41         | 3.15               |
| ...            | ...       | ...                  | ...      | ...           | ...                |

Read the full file on GitHub · 127 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 · 127 lines · 0 tokens per session scan A a188d1d9b901

Subscribe to this mod's changes

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