swarm: Command for Claude Code

.claude/commands/security_review.md

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

A security-focused review of the changes on the current Git branch compared with the main branch.

In plain words
What is it for?
Use it to inspect a branch diff and report high-confidence security issues in the modified code.
Why use it?
It helps find likely vulnerabilities such as injection, authentication mistakes, exposed secrets, unsafe code execution, and data leaks before merging.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions subagents.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/security_review"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/security_review.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 666 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.00666
Opus 5 $0.00000 $0.00333
Sonnet 5 $0.00000 $0.00133
Haiku 4.5 $0.00000 $0.00067

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

Security

Grade A, and why

security_review 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/security_review.md · 80 lines

How it starts

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

/security-review

Perform a security-focused code review of the current branch's changes against main.

Usage

/security-review

Behavior

Phase 1: Gather context

  1. Run git status and git log --oneline main..HEAD to understand the branch scope.
  2. Run git diff main...HEAD to get the full diff.
  3. Identify modified files and their languages/frameworks.
  4. Use file search tools to understand existing security patterns in the codebase (sanitization helpers, auth middleware, validation patterns).

Phase 2: Identify vulnerabilities

Launch a subagent to analyze the diff for security issues. Focus on:

  • Input validation: SQL injection, command injection, path traversal, XXE, template injection
  • Auth/authz: authentication bypass, privilege escalation, session flaws, JWT issues
  • Crypto: hardcoded secrets, weak algorithms, improper key management
  • Code execution: unsafe deserialization (pickle, YAML), eval/exec injection, RCE
  • Data exposure: PII logging, sensitive data in responses, debug info leakage
  • Web: XSS (only if using dangerouslySetInnerHTML or similar), CSRF, SSRF (host/protocol control only)

Only flag issues with >70% confidence of actual exploitability. Skip:

  • DOS / resource exhaustion
  • Secrets on disk (handled by /preflight --secrets)
  • Rate limiting concerns
  • Theoretical race conditions
  • Log spoofing
  • Path-only SSRF
  • Regex injection/DOS
  • Missing hardening (only flag concrete vulns)
  • Test-only code
  • Environment variables and CLI flags (trusted inputs)
  • Client-side JS/TS auth checks (server responsibility)

Phase 3: Validate findings

For each candidate vulnerability, launch a parallel validation subagent that:

  1. Reads the actual source code at the flagged location
  2. Traces the data flow from input to sink
  3. Checks if the input is attacker-controlled vs config/env (trusted)
  4. Checks if existing sanitization/validation already mitigates the issue
  5. Assigns a confidence score (1-10):
    • 1-3: Likely false positive
    • 4-6: Needs investigation
    • 7-10: Likely true vulnerability

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

Subscribe to this mod's changes

security_review 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 666 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.