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.
curl -O https://raw.githubusercontent.com/swarm-ai-research/swarm/main/.claude/commands/write_paper.mdgit clone --depth 1 https://github.com/swarm-ai-research/swarmWrote 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.
[](https://agentmods.dev/commands/swarm-ai-research/swarm/write_paper)<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>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.
| Model | Per session | Once 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 |
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.
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
-
Query run data from the
scenario_runsSQLite table (at$SWARM_RUNS_DB_PATHorruns/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.
-
Read scenario configs: for each scenario_id, read the corresponding
scenarios/<id>.yamlto 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)
-
Generate
docs/papers/<title_slug>.mdwith 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]
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.
- 3d ago First seen · 106 lines · 0 tokens per session scan A 312ab4a67a4d
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.
Other commands, from other repositories
notify
Send a notification to your device.
briefing
Morning summary. Show the user where things stand so they can pick up where they left off. This is the "catch me up" command.
OPSX: Apply
Implement tasks from an OpenSpec change (Experimental).
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.