swarm: Command for Claude Code

.claude/commands/compile_paper.md

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

A project command that turns a SWARM paper written in Markdown into a LaTeX source file, compiles it to a PDF, and opens the result.

In plain words
What is it for?
Use it to build a PDF from a paper in `docs/papers/<slug>.md`, or to recompile an existing LaTeX version when the source has changed.
Why use it?
It removes the repeated work of converting headings, lists, tables, code, and formatting by hand before checking a paper as a PDF.

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/compile_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 compile_paper

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/compile_paper"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/compile_paper.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 981 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.00981
Opus 5 $0.00000 $0.00491
Sonnet 5 $0.00000 $0.00196
Haiku 4.5 $0.00000 $0.00098

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

Security

Grade A, and why

compile_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 9d 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/compile_paper.md · 104 lines

How it starts

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

/compile_paper

Convert a SWARM paper from markdown to LaTeX (if needed), compile to PDF, and open it.

Usage

/compile_paper <slug>

Examples:

  • /compile_paper kernel_market_v2
  • /compile_paper collusion_governance

Arguments

  • slug: Paper identifier. Resolves to docs/papers/<slug>.md (source) and docs/papers/<slug>.tex (output).

Behavior

Step 1: Locate source

Look for files in this order:

  1. docs/papers/<slug>.tex — if it exists and is newer than the .md, skip conversion
  2. docs/papers/<slug>.md — convert to LaTeX using the template

Step 2: Convert markdown to LaTeX (if needed)

If the .tex file does not exist or the .md is newer:

  1. Read docs/papers/template.tex for the standard preamble
  2. Read docs/papers/<slug>.md for content
  3. Convert markdown to LaTeX:
    • # Title\title{}
    • ## Section\section{}
    • ### Subsection\subsection{}
    • **bold**\textbf{}
    • *italic*\textit{}
    • `code`\texttt{}
    • $math$ → pass through
    • Tables → \begin{table}[H] with booktabs
    • Lists → \begin{itemize} / \begin{enumerate}
    • Code blocks → \begin{verbatim}
    • %\%, _ in prose → \_
  4. Write docs/papers/<slug>.tex

Use the template preamble exactly. Replace %TITLE%, %AUTHOR%, %ABSTRACT%, and %BODY% placeholders with converted content.

For %AUTHOR%, resolve in order:

  1. $SWARM_AUTHOR environment variable
  2. git config user.name
  3. Ask the user (do not guess from OS username)

Step 2b: Auto-copy figures

Before compiling, ensure referenced figures are available:

  1. Scan the .tex for \includegraphics{...} paths
  2. For each referenced figure not found in docs/papers/figures/:
    • Search runs/*/plots/ for a file with the same name
    • If found, copy it to docs/papers/figures/<slug>/
  3. This prevents "File not found" errors during tectonic compilation

Step 3: Compile

cd docs/papers/ && tectonic <slug>.tex

Read the full file on GitHub · 104 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. 9d ago First seen · 104 lines · 0 tokens per session scan A 36e4b499ade9

Subscribe to this mod's changes

compile_paper 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 981 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.

Related

Other commands, from other repositories

latex-polish

Inspect a cleanly compiling LaTeX document for source pathologies and rendered visual defects by linting and viewing selected PDF pages. Use when compilation succeeds but title pages, floats, tables, figures, or layout still need publication-quality review. Not for basic compilation health; use $latex-health-check.

flonat/flonat-research · 60 tokens

latex

Compile one specified LaTeX document, resolve build errors, audit citations, and report build quality. Use when a .tex source must be built or a concrete compilation failure repaired. Not for corpus-wide build checks, visual polish after a clean build, or creating a project; use $latex-health-check, $latex-polish, or…

flonat/flonat-research · 72 tokens

bib-filter

Filter a LaTeX project's bibliography to the entries actually cited, with Overleaf-source resolution, temporary staging, validation, approval-gated canonical replacement, and compilation. Use before submission or after large revisions.

flonat/flonat-research · 41 tokens

wtfp:export-latex

Export the manuscript and bibliography to portable LaTeX source with declared formatting.

akougkas/wtf-p · 22 tokens

autor.paper-writing

Workflow 3: Full paper writing pipeline. Orchestrates paper-plan → paper-figure → paper-write → paper-compile → paper-improver to go from a narrative report to a polished, submission-ready PDF. Use when user says "write paper pipeline", "paper writing", or wants the complete paper generation workflow.

llv22/AutoResearchWithEyes · 69 tokens

render-figures

Compile all .tex and .typ figure files in a directory.

braininahat/brains-in-a-hat · 17 tokens