swarm: Command for Claude Code

.claude/commands/red_team.md

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

A command that performs red-team testing, meaning deliberate attempts to find weaknesses through adversarial tests. It produces machine-readable and human-readable reports with failure modes and suggested responses.

In plain words
What is it for?
Use it to evaluate a system in a quick or full mode, record a robustness score and grade, identify attack methods, and plan mitigations.
Why use it?
It helps expose vulnerabilities that normal testing may miss. The summary makes the most serious weaknesses and useful follow-up experiments easier to review.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/red_team"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/red_team.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 568 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.00568
Opus 5 $0.00000 $0.00284
Sonnet 5 $0.00000 $0.00114
Haiku 4.5 $0.00000 $0.00057

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

Security

Grade A, and why

red_team 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 3d 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/red_team.md · 51 lines

How it starts

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

/red_team

Run a red-team evaluation (adaptive/adversarial stress testing) and summarize failure modes.

Usage

/red_team [mode]

Modes:

  • quick (default): minimal set of attacks and one governance config
  • full: full attack library (may be slow)

Behavior

  1. Create runs/<YYYYMMDD-HHMMSS>_redteam/.
  2. Run the red-team evaluator from swarm.redteam:
  • Instantiate RedTeamEvaluator(governance_config=...)
  • Run quick/full evaluation
  1. Write:
  • <run_dir>/report.json (machine-readable)
  • <run_dir>/report.txt (human summary)
  1. Print a short summary suitable for an issue:
  • Robustness score + grade
  • Top vulnerabilities (severity + affected lever)
  • Most effective attack vectors
  • Recommended mitigations / next experiments

Attack library

AttackLibrary.get_all_attacks() in swarm/redteam/attacks.py. Each attack names the governance levers it targets; the evaluator's outcome model responds to the matching governance_config keys.

attack_id Category Responds to
reputation_farming exploitation audit_enabled
collusion_ring coordination collusion_detection_enabled
threshold_dancing evasion circuit_breaker_enabled
sybil_attack coordination sybil_detection_enabled, collusion_detection_enabled
timing_attack, information_laundering, resource_drain, governance_gaming various general defenses only
out_of_band_channel coordination egress_allowlist_enabled (prevents), substrate_population_monitor_enabled (detects at any n_hosts), volume_monitor_enabled (detects, weakening as adversary_config.n_hosts grows); not collusion_detection_enabled

out_of_band_channel is the field exhibit from the collusion.wiki incident (docs/research/wiki-backchannel-field-evidence.md, bead 7y0p): agents coordinate on a third-party substrate the governed observables never see, so task proxies stay green; an ordered cleanup sweep is evaded by inferring its order (the ZZZ pages). The replay (docs/research/collusion-wiki-replay.md) showed pairwise/structural collusion detection saturating on the hub page while aggregate edit volume led the human moderator by three days, which is why that attack ignores collusion_detection_enabled.

Read the full file on GitHub · 51 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. 3d ago Changed · +23 lines b74048baf6da
  2. 9d ago First seen · 28 lines · 0 tokens per session scan A bc893f63ba0f

Subscribe to this mod's changes

red_team 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 568 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.