swarm: Command for Claude Code

.claude/commands/publish_figures.md

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

A command that creates comparative charts from SWARM experiment data. SWARM data records results from scenarios, runs, and sometimes individual time periods.

In plain words
What is it for?
Use it to compare scenarios with bar charts and scatter plots, load data from SQLite, history files, or CSV exports, and save figures in paper-oriented styles.
Why use it?
It avoids manually querying run data and preparing repeated charts for research or technical reports.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/publish_figures"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/publish_figures.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 902 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.00902
Opus 5 $0.00000 $0.00451
Sonnet 5 $0.00000 $0.00180
Haiku 4.5 $0.00000 $0.00090

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

Security

Grade A, and why

publish_figures 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/publish_figures.md · 85 lines

How it starts

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

/publish_figures

Generate publication-quality cross-run comparative figures from SWARM run data.

Usage

/publish_figures <output_dir> [scenario_ids...] [--style paper|nature|arxiv]

Examples:

  • /publish_figures docs/papers/figures/ collusion_detection network_effects emergent_capabilities
  • /publish_figures docs/papers/figures/ --style nature
  • /publish_figures runs/20260209_sweep/plots/ (uses all runs in SQLite)

Behavior

  1. Gather data: query the scenario_runs SQLite table for the specified scenario_ids (or all if none given). Also load epoch-level data from <run_dir>/history.json or CSV exports where available for time-series plots.

  2. Generate a standard set of comparative figures using matplotlib:

    a) Scenario comparison bar chart (fig_scenario_comparison.png):

    • Grouped bars: acceptance_rate, avg_toxicity, welfare_per_epoch (scaled) across all scenarios.
    • Error bars if multiple seeds exist for a scenario.
    • Value annotations above each bar.

    b) Regime scatter plot (fig_regime_scatter.png):

    • X-axis: adversarial_fraction, Y-axis: acceptance_rate.
    • Color by regime (Cooperative / Managed Friction / Collapse Risk) using the 35% threshold line.
    • Each scenario labeled with its name.

    c) Timeline overlay (fig_timeline_overlay.png):

    • Multi-line time series of welfare or acceptance_rate across scenarios.
    • Each scenario as a distinct colored line with legend.
    • Epochs on x-axis, metric on y-axis.

    d) Pairwise comparison panels (fig_pairwise_<a>_vs_<b>.png):

    • Only generated if exactly 2 scenario_ids are given.
    • Side-by-side subplots comparing epoch-by-epoch welfare, toxicity, and acceptance.
    • Includes mean lines and fill_between for variance.

    e) Scaling/sensitivity plot (fig_scaling.png):

    • Only if incoherence variants or sweep data detected.
    • Metric vs. agent_count or parameter value.
  3. Apply consistent styling based on --style flag (default: paper):

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

Subscribe to this mod's changes

publish_figures 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 902 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.