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/guard.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/guard)<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/guard"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/guard.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.01199 |
| Opus 5 | $0.00000 | $0.00600 |
| Sonnet 5 | $0.00000 | $0.00240 |
| Haiku 4.5 | $0.00000 | $0.00120 |
Grade A, and why
guard 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 — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/guard
Verify branch identity and detect file conflicts from concurrent Claude Code worktree sessions before starting destructive work — use when opening a worktree pane, before modifying shared files, or when you suspect another session may have touched the same paths. Use --files mode to check specific files; omit for branch-only verification. Consolidates the former /branch_guard and /session_guard commands. Distinct from /preflight (pre-commit lint/test checks) and /healthcheck (code health after external changes).
Usage
/guard [expected-branch]
/guard --files <file1> [file2] ...
/guard [expected-branch] --files <file1> [file2] ...
Examples:
/guard(show current branch and context)/guard main(verify you're on main)/guard feat/isometric-viz(verify you're on the expected branch)/guard --files swarm/core/orchestrator.py(check if files were modified by other sessions)/guard main --files swarm/core/orchestrator.py swarm/logging/event_log.py(both checks)
Argument parsing
--files <file1> [file2] ...: Check listed files for concurrent modification (session guard mode)- Any non-flag token that doesn't look like a file path: treated as expected branch name
- If neither branch nor
--filesis given: show current branch info (default)
Branch check (default, or when branch name is given)
1) Check current branch
- Run
git branch --show-current. - Run
git status --shortto show working tree state.
2) Compare against expected
- If an expected branch is specified and the current branch doesn't match:
- Warn clearly: "WARNING: On branch
<current>, expected<expected>" - Show uncommitted changes on current branch (if any).
- Ask: "Switch to
<expected>?" before doing anything.
- Warn clearly: "WARNING: On branch
- If they match, confirm: "On correct branch:
<expected>"
3) If no expected branch given
- Show the current branch, its tracking remote, and how many commits ahead/behind.
- Show any in-progress beads (
bd list --status=in_progress) to remind what work is active. - This gives enough context to decide if you're in the right place.
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 · 127 lines · 0 tokens per session scan A ab47d989d651
guard 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,199 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
eval-merge
Use the Read tool to load .skill-compass/{skill-name}/manifest.json. Verify.
speckit.git.feature
Create a feature branch with sequential or timestamp numbering.
speckit.git.commit
Auto-commit changes after a Spec Kit command completes.
speckit.git.initialize
Initialize a Git repository with an initial commit.
speckit.git.validate
Validate current branch follows feature branch naming conventions.
speckit.git.remote
Detect Git remote URL for GitHub integration.