swarm: Command for Claude Code

.claude/commands/write_paper.md

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

A quick reference for tmux, a terminal tool that lets you arrange multiple command-line sessions in panes and windows. It lists keyboard shortcuts for navigation, resizing, scrolling, and session management.

In plain words
What is it for?
Use it to look up tmux shortcuts or set up and navigate the project's multi-session Claude Code environment.
Why use it?
It helps when you forget how to control a multi-session terminal layout while running several coding-agent sessions.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/write_paper.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/write_paper)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/write_paper"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/write_paper.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,009 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.01009
Opus 5 $0.00000 $0.00504
Sonnet 5 $0.00000 $0.00202
Haiku 4.5 $0.00000 $0.00101

Measured 3d ago against content hash 312ab4a67a4d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

write_paper 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 3d 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/write_paper.md · 106 lines

How it starts

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

/write_paper

Scaffold a research paper from SWARM run data, pre-populated with methods, results tables, and figure references.

Usage

/write_paper <title_slug> [scenario_ids...] [--figures]

Examples:

  • /write_paper collusion_dynamics collusion_detection network_effects --figures
  • /write_paper governance_sweep (uses all runs in SQLite)
  • /write_paper adversarial_threshold baseline redteam_v1 redteam_v3 collusion

Behavior

  1. Query run data from the scenario_runs SQLite table (at $SWARM_RUNS_DB_PATH or runs/runs.db):

    • If scenario_ids are given, filter to those. Otherwise use all rows.
    • Extract: scenario_id, seed, n_agents, n_epochs, acceptance_rate, avg_toxicity, welfare_per_epoch, adversarial_fraction, collapse_epoch, notes.
    • If multiple seeds exist per scenario, compute mean +/- std for each metric.
  2. Read scenario configs: for each scenario_id, read the corresponding scenarios/<id>.yaml to extract:

    • Agent composition (types, counts, adversarial fraction)
    • Governance parameters (tax rate, reputation decay, circuit breakers, etc.)
    • Network topology (if any)
    • Simulation parameters (epochs, steps, seed)
  3. Generate docs/papers/<title_slug>.md with this structure:

# <Title from slug, title-cased>

**Authors:** <resolve from $SWARM_AUTHOR, then git config user.name, then ask user>
**Date:** <today>
**Framework:** SWARM v<from pyproject.toml>

## Abstract
[TODO: 150-word summary. Key numbers pre-filled below.]
- N scenarios, M total epochs, K agents
- Key finding 1: [TODO]
- Key finding 2: [TODO]

## 1. Introduction
[TODO: Motivation and research question]

## 2. Experimental Setup

### 2.1 Scenarios
| Scenario | Agents | Adversarial % | Epochs | Governance |
|----------|--------|---------------|--------|------------|
<auto-populated from scenario YAMLs>

### 2.2 Governance Parameters
<auto-populated table of governance config per scenario>

### 2.3 Metrics
- **Acceptance rate**: fraction of interactions accepted by governance
- **Toxicity**: E[1-p | accepted], expected harm from accepted interactions
- **Welfare**: cumulative payoff across agents per epoch
- **Quality gap**: E[p|accepted] - E[p|rejected]

## 3. Results

### 3.1 Cross-Scenario Summary
| Scenario | Acceptance | Toxicity | Welfare/Epoch | Collapse? |
|----------|-----------|----------|---------------|-----------|
<auto-populated from SQLite data>

### 3.2 Detailed Analysis
[TODO: Narrative analysis of patterns]

<figure references if --figures>

## 4. Discussion
[TODO: Interpretation, regime classification, threshold findings]

## 5. Conclusion
[TODO: 1-paragraph summary of key findings, implications, and future work]

## 6. Limitations
[TODO: Known limitations of this analysis]

## 7. References
[TODO]

Read the full file on GitHub · 106 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. 3d ago First seen · 106 lines · 0 tokens per session scan A 312ab4a67a4d

Subscribe to this mod's changes

write_paper 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,009 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-09-03.