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/compile_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/compile_paper)<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.
<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>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.00981 |
| Opus 5 | $0.00000 | $0.00491 |
| Sonnet 5 | $0.00000 | $0.00196 |
| Haiku 4.5 | $0.00000 | $0.00098 |
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.
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 todocs/papers/<slug>.md(source) anddocs/papers/<slug>.tex(output).
Behavior
Step 1: Locate source
Look for files in this order:
docs/papers/<slug>.tex— if it exists and is newer than the.md, skip conversiondocs/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:
- Read
docs/papers/template.texfor the standard preamble - Read
docs/papers/<slug>.mdfor content - Convert markdown to LaTeX:
# Title→\title{}## Section→\section{}### Subsection→\subsection{}**bold**→\textbf{}*italic*→\textit{}`code`→\texttt{}$math$→ pass through- Tables →
\begin{table}[H]withbooktabs - Lists →
\begin{itemize}/\begin{enumerate} - Code blocks →
\begin{verbatim} %→\%,_in prose →\_
- 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:
$SWARM_AUTHORenvironment variablegit config user.name- Ask the user (do not guess from OS username)
Step 2b: Auto-copy figures
Before compiling, ensure referenced figures are available:
- Scan the
.texfor\includegraphics{...}paths - 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>/
- Search
- This prevents "File not found" errors during tectonic compilation
Step 3: Compile
cd docs/papers/ && tectonic <slug>.tex
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.
- 9d ago First seen · 104 lines · 0 tokens per session scan A 36e4b499ade9
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.
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.
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…
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.
wtfp:export-latex
Export the manuscript and bibliography to portable LaTeX source with declared formatting.
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.
render-figures
Compile all .tex and .typ figure files in a directory.