swarm: Command for Claude Code

.claude/commands/retro.md

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

A session-review command that examines the agent’s work for repeated tasks, manual steps, and recurring problems.

In plain words
What is it for?
Use it during or after a session to summarize tool use, errors, corrections, files touched, and possible workflow improvements.
Why use it?
It helps turn patterns in a coding session into reusable commands, hooks, or specialist agents instead of repeating the same work.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions AGENTS.md.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/retro"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/retro.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 1,925 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.01925
Opus 5 $0.00000 $0.00962
Sonnet 5 $0.00000 $0.00385
Haiku 4.5 $0.00000 $0.00193

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

Security

Grade A, and why

retro 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/retro.md · 154 lines

How it starts

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

/retro

Analyze the current session for repeated workflows, pain points, or manual multi-step patterns that should become new slash commands, hooks, or specialist agents. Can be invoked mid-session or at the end.

Usage

/retro

Phase 1: Session Health Summary

Compute aggregate statistics from the conversation before mining patterns:

  • Tool calls: total count, by type (git, file edit, search, test, etc.)
  • Error rate: failed commands / total commands
  • Corrections: times the user said "no", "undo", "actually", or re-requested
  • Retries: same tool called 2+ times with minor variations
  • Files touched: count of unique files read, edited, created
  • Session complexity: distinct tasks attempted (estimated from user messages)

Present as a compact block:

Session Health
  Tool calls: 47 (git: 18, edit: 12, search: 9, test: 5, other: 3)
  Error rate: 4/47 (8.5%)
  User corrections: 2
  Files touched: 15 (8 edited, 4 created, 3 read-only)
  Tasks: 4

Provenance Analysis

If .claude/provenance.jsonl exists and is non-empty, filter entries relevant to this session (by session_id field if present, otherwise use entries from the last 4 hours as a heuristic). Report:

Provenance (this session)
  Commits tracked: 4
  Docs co-staged:  2/4 (50%)
  Reminders resolved: 3/5 (60%)
  Reminders unresolved: 2

Where:

  • Commits tracked: number of provenance entries matching the session filter
  • Docs co-staged: entries where files_changed includes CHANGELOG.md, README.md, or AGENTS.md
  • Reminders resolved: sum of docs_reminders_resolved across entries
  • Reminders unresolved: sum of docs_reminders_unresolved across entries

If .claude/provenance.jsonl doesn't exist or has no matching entries, skip this sub-section silently.

Phase 2: Trajectory Decomposition

Before scanning for patterns, decompose the session into structured steps:

Step N: [thought] → [action(s)] → [observation] → [outcome: success/fail/retry]

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

Subscribe to this mod's changes

retro is a command published in the GitHub repository swarm-ai-research/swarm (41 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,925 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.