swarm: Command for Claude Code

.claude/commands/healthcheck.md

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

A command that scans a codebase for health problems caused by parallel work, merges, or outside changes. It checks for duplicate Python definitions and can also apply fixes.

In plain words
What is it for?
Use it after merging or receiving external changes to inspect the codebase, or run it with the fix option to repair supported issues.
Why use it?
It helps find problems introduced after changes arrive, which a pre-commit check may not detect.

Command for Claude Code

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/healthcheck"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/healthcheck.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,366 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.01366
Opus 5 $0.00000 $0.00683
Sonnet 5 $0.00000 $0.00273
Haiku 4.5 $0.00000 $0.00137

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

Security

Grade A, and why

healthcheck scanned grade A with 1 finding 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 11d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

HTTP=$(curl -s -o /dev/null -w "%{http_code}" https://Swarm-AI-Research-swarm-sandbox.hf.space/_stcore/health)
.claude/commands/healthcheck.md · 161 lines

How it starts

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

/healthcheck

Scan the codebase for code health issues that arise from parallel commits, merges, or external changes. Complements /preflight (which checks before commit) by checking after external changes arrive.

Usage

/healthcheck or /healthcheck --fix or /healthcheck --hf-space

Behavior

Step 1: Duplicate Definitions (AST-based)

Use Python's ast module to find duplicate function/class definitions at the same scope (same class or module level). This avoids false positives from same-named methods on different classes (e.g. multiple classes each defining __init__ or to_dict).

import ast, os, collections

issues = []
for root_dir in ['swarm', 'tests']:
    for dirpath, dirs, files in os.walk(root_dir):
        for f in sorted(files):
            if not f.endswith('.py'):
                continue
            path = os.path.join(dirpath, f)
            with open(path) as fh:
                try:
                    tree = ast.parse(fh.read(), filename=path)
                except SyntaxError:
                    continue

            # Check module-level duplicates
            mod_names = collections.defaultdict(list)
            for node in ast.iter_child_nodes(tree):
                if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
                    mod_names[node.name].append(node.lineno)
                elif isinstance(node, ast.ClassDef):
                    # Check class-level duplicates
                    cls_names = collections.defaultdict(list)
                    for item in ast.iter_child_nodes(node):
                        if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef)):
                            cls_names[item.name].append(item.lineno)
                    for name, linenos in sorted(cls_names.items()):
                        if len(linenos) > 1:
                            issues.append((path, node.name, name, linenos))

            for name, linenos in sorted(mod_names.items()):
                if len(linenos) > 1:
                    issues.append((path, '<module>', name, linenos))

for path, scope, name, linenos in issues:
    lines_str = ', '.join(str(l) for l in linenos)
    print(f'SHADOW: {path}  {scope}.{name}  (lines {lines_str})')

Read the full file on GitHub · 161 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. 11d ago First seen · 161 lines · 0 tokens per session scan A 8a464f564527

Subscribe to this mod's changes

healthcheck is a command published in the GitHub repository swarm-ai-research/swarm (42 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,366 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.