swarm: Command for Claude Code

.claude/commands/run_scenario.md

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

A command for running one SWARM simulation scenario with one random seed and a reproducible results folder. It can also create plots and supports different simulation engines and run limits.

In plain words
What is it for?
Running a named scenario or configuration with chosen seed, epochs, steps, engine, scale, and round limit, optionally followed by plot generation.
Why use it?
It provides a consistent way to repeat one experiment and keep its results organized, without running a larger parameter sweep or study.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/run_scenario/github.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/run_scenario)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/run_scenario"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/run_scenario/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 run_scenario

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/run_scenario"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/run_scenario.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 1,215 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.01215
Opus 5 $0.00000 $0.00607
Sonnet 5 $0.00000 $0.00243
Haiku 4.5 $0.00000 $0.00121

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

Security

Grade A, and why

run_scenario 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/run_scenario.md · 86 lines

How it starts

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

/run_scenario

Run a single SWARM scenario with a single seed and standardized, reproducible run folder. Optionally generate plots immediately after. Distinct from /sweep (parameter grid across multiple configs), /benchmark (standardized multi-condition evaluation suite), and /full_study (end-to-end pipeline including analysis and paper).

Consolidates the former /run_and_plot command (now /run_scenario --plot).

Usage

/run_scenario <scenario_path_or_id> [seed] [epochs] [steps] [--plot] [--engine swarm|miroshark] [--scale N] [--max-rounds N]

Examples:

  • /run_scenario baseline
  • /run_scenario scenarios/collusion_detection.yaml 123
  • /run_scenario emergent_capabilities 42 15 20
  • /run_scenario baseline --plot (run + generate plots)
  • /run_scenario scenarios/strict_governance.yaml 42 15 12 --plot
  • /run_scenario adversarial_redteam --engine miroshark --scale 5 --max-rounds 10 (run via the MiroShark social-cascade engine)

Argument parsing

Parse $ARGUMENTS to extract:

  • --plot: After the run completes, generate plots from the results (see Phase 2 below)
  • --engine <swarm|miroshark>: Which engine to run on. Default: swarm (the in-tree game-theoretic engine). miroshark translates the scenario into a MiroShark seed briefing and runs through the MiroShark backend at $MIROSHARK_API_URL (default http://localhost:5001).
  • --scale N (only with --engine miroshark): Multiply each agent-type count by N before generating the briefing roster. Default 20.
  • --max-rounds N (only with --engine miroshark): Cap the MiroShark simulation length. Default 30.
  • Positional args: <scenario_path_or_id> [seed] [epochs] [steps]

Behavior

Phase 1: Run the scenario

  1. Resolve <scenario_path_or_id>:
  • If it contains / or ends with .yaml, treat it as a path.
  • Otherwise resolve to scenarios/<id>.yaml.
  1. Create a run directory:
  • runs/<YYYYMMDD-HHMMSS>_<scenario_id>_seed<seed>/
  1. Run the scenario via the project CLI (preferred):
  • python -m swarm run <scenario.yaml> --seed <seed> --epochs <epochs> --steps <steps> --export-json <run_dir>/history.json --export-csv <run_dir>/csv --export-dolt

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

Subscribe to this mod's changes

run_scenario 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 1,215 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.