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/preflight.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/preflight)<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/preflight"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/preflight.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.01402 |
| Opus 5 | $0.00000 | $0.00701 |
| Sonnet 5 | $0.00000 | $0.00280 |
| Haiku 4.5 | $0.00000 | $0.00140 |
Grade A, and why
preflight 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 8d 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 — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/preflight
Run all pre-commit checks on staged files without committing. Shows all issues at once and optionally auto-fixes what it can.
Use --secrets [path] to run the secrets scanner standalone (replaces the former /scan_secrets command).
Usage
/preflight [--fix]
/preflight --secrets [path]
Examples:
/preflight— check only, report all issues/preflight --fix— auto-fix ruff/isort issues, then report remaining/preflight --secrets— scan all tracked + untracked files for secrets/preflight --secrets swarm/bridges/— scan a specific directory/preflight --secrets swarm/bridges/gastown/bridge.py— scan a single file
Argument parsing
--fix: Auto-fix ruff/isort issues before reporting.--secrets [path]: Run secrets scanner only (skip all other checks). If no path given, scans the whole repo. Equivalent tobash .claude/hooks/scan_secrets.sh [path].
Behavior
- Get the list of staged Python files:
git diff --cached --name-only --diff-filter=ACM | grep '\.py$'
If no staged .py files, report "No staged Python files to check" and exit.
-
Run all checks, collecting results before reporting (do NOT stop on first failure):
a) Syntax check — for each staged
.pyfile, runpython -m py_compile <file>. This catchesIndentationError,SyntaxError, and other parse-level errors that concurrent sessions may introduce. Report any failures immediately — these block everything else.for f in $staged_py_files; do python -m py_compile "$f" 2>&1 || echo "SYNTAX ERROR: $f" doneb) Secrets scan — run the same secret-pattern check from
.claude/hooks/pre-commiton the staged diff. Report any matches.c) Ruff lint —
ruff check <staged_files>. If--fixflag was given, first runruff check --fix <staged_files>, then re-stage the fixed files withgit add, then re-check to report remaining unfixable issues.d) Mypy type check — only for staged files under
swarm/:mypy --follow-imports=skip <swarm_files>. Report type errors (cannot auto-fix).
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.
- 8d ago First seen · 115 lines · 0 tokens per session scan A d5461386811c
preflight 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,402 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
story-long-scan
A command for scanning long-form online fiction rankings on platforms such as Qidian, Fanqie, and Jinjiang, then analyzing the ranking data.
story-short-scan
A tool for scanning and analysing popular short web-fiction rankings on platforms such as Zhihu Yanyan and Fanqie Short Stories.
eval-merge
Use the Read tool to load .skill-compass/{skill-name}/manifest.json. Verify.
speckit.git.validate
Validate current branch follows feature branch naming conventions.
reflect
Curate and compress recent memory. This command reviews the last 7 days of journal entries, extracts durable insights, and updates long-term memory files. Think of it as memory maintenance -- moving important things from short-term to long-term storage.
checklist
Generate a custom checklist for the current feature based on user requirements.