swarm: Command for Claude Code

.claude/commands/deploy_demo.md

deploy_demo is a command for Claude Code from swarm-ai-research/swarm. It costs 0 tokens per session (2,185 once invoked), scanned C, original, MIT.

A command that publishes or updates a Streamlit interactive demo on Hugging Face Spaces. Streamlit is a Python framework for small interactive web apps, and Hugging Face Spaces hosts such apps online.

In plain words
What is it for?
Use it to rebuild and deploy the demo, or to check whether the online Space is running and uses the latest code.
Why use it?
It handles the preparation and path changes needed when the demo's repository layout differs from the deployed Space, reducing manual deployment mistakes.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/deploy_demo"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/deploy_demo.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 2,185 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 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.02185
Opus 5 $0.00000 $0.01092
Sonnet 5 $0.00000 $0.00437
Haiku 4.5 $0.00000 $0.00218

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

Security

Grade C, and why

deploy_demo scanned grade C with 2 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

find "$STAGE" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null

Makes network callslowCapability

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

curl -s -o /dev/null -w "%{http_code}" https://Swarm-AI-Research-swarm-sandbox.hf.space/_stcore/health
.claude/commands/deploy_demo.md · 217 lines

How it starts

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

/deploy_demo

Deploy (or update) the Streamlit interactive demo to Hugging Face Spaces.

Usage

/deploy_demo — full rebuild and push /deploy_demo --check — just check if the Space is running and on the latest code

Context

The demo app lives at examples/demo/ in the main repo but the HF Space at Swarm-AI-Research/swarm-sandbox uses a flat layout (/app/ root). This command handles the path rewriting that breaks every time you push manually.

Space URL: https://Swarm-AI-Research-swarm-sandbox.hf.space Space repo: https://huggingface.co/spaces/Swarm-AI-Research/swarm-sandbox

Behavior

--check mode

  1. Check health endpoint:

    curl -s -o /dev/null -w "%{http_code}" https://Swarm-AI-Research-swarm-sandbox.hf.space/_stcore/health
    
  2. Check runtime status and deployed SHA:

    curl -s -H "Authorization: Bearer $(cat ~/.cache/huggingface/token)" \
      "https://huggingface.co/api/spaces/Swarm-AI-Research/swarm-sandbox/runtime"
    
  3. Report: stage (RUNNING/BUILDING/ERROR), deployed SHA, health status.

Full deploy (default)

Step 1: Prepare staging directory
STAGE=$(mktemp -d)

Copy the required files from the main repo:

cp examples/demo/app.py "$STAGE/app.py"
cp -r examples/demo/pages "$STAGE/pages"
cp -r examples/demo/utils "$STAGE/utils"
cp -r swarm "$STAGE/swarm"
cp -r scenarios "$STAGE/scenarios"
cp pyproject.toml "$STAGE/pyproject.toml"
mkdir -p "$STAGE/.streamlit"
cp .streamlit/config.toml "$STAGE/.streamlit/config.toml"

Clean pycache:

find "$STAGE" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null
find "$STAGE" -name "*.pyc" -delete 2>/dev/null
Step 2: Rewrite paths for flat layout

The main repo has examples/demo/app.py (3 levels deep) but the Space has app.py at root. Fix PROJECT_ROOT in all files:

app.py: Path(__file__).resolve().parent (1 parent — app.py is at Space root)

utils/simulation.py: Path(__file__).resolve().parent.parent (2 parents — utils/ is one level down)

Read the full file on GitHub · 217 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 · 217 lines · 0 tokens per session scan C 95e579bec8c8

Subscribe to this mod's changes

deploy_demo 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 2,185 tokens. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.