swarm: Command for Claude Code

.claude/commands/install_hooks.md

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

A command that copies repository-provided Git hooks into Git's active hooks directory and makes them executable. Git hooks are scripts that run automatically at events such as commits or pushes.

In plain words
What is it for?
Installing or updating the repository's pre-commit and pre-push checks, verifying they match their source files, and preserving differing existing hooks with backups.
Why use it?
It ensures the repository's research-hygiene checks are actually active after cloning or changing the source hooks.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/install_hooks.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/install_hooks)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/install_hooks"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/install_hooks.svg" alt="Measured on agentmods" 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 710 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.00710
Opus 5 $0.00000 $0.00355
Sonnet 5 $0.00000 $0.00142
Haiku 4.5 $0.00000 $0.00071

Measured today against content hash e8b7aeb26d79, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

install_hooks 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 today.

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/install_hooks.md · 61 lines

How it starts

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

/install_hooks

Install repo-provided git hooks that enforce research hygiene. Also use this after editing any hook in .claude/hooks/.

Usage

/install_hooks

Behavior

  1. Discover all hook scripts in .claude/hooks/ (e.g. pre-commit, pre-push).

  2. For each hook found:

  • If a hook already exists in .git/hooks/ that differs from the source, create a .bak copy first.
  • Copy from .claude/hooks/<hook> to .git/hooks/<hook>.
  • Ensure it is executable (chmod +x).
  1. Print a summary:
  • Which hooks were installed or updated.
  • Which hooks were unchanged (already in sync).
  • How to bypass (only for emergencies): SKIP_SWARM_HOOKS=1 git commit ...
  1. Verify the installed hooks match the source (diff check).

What pre-push enforces

In order, before any push leaves the machine:

  1. make lint typecheck test-parallel — the same checks CI's lint, type-check and test jobs run (parallel, -m "not slow"). This used to be make ci, whose serial coverage run takes 10+ minutes locally; coverage thresholds stay a CI concern. The hook first clears GIT_DIR/GIT_INDEX_FILE/ GIT_WORK_TREE, which git exports to hooks: without that, tests that git init a temp repo run against this repo instead (found 2026-09-06 on the first real run of this hook — it had never been installed).
  2. Main-parity checks (bead 9qrv.1, Joel Test Q3): the two cheap CI jobs that most often turn main red when a direct push skips the PR gate — python scripts/build_kb_graph.py --check (~1s) and mkdocs build --strict (~20s, skipped with a notice when mkdocs is not installed). A failure here would fail quality-gate on main, so it blocks the push locally instead.
  3. Review panel (bead 9qrv.3, Joel Test Q10): python -m swarm.agentgit review --base <remote-ref> over the commits being pushed. Advisory: the synthesis is printed; set SWARM_REVIEW_PANEL_BLOCK=1 to refuse the push on a block verdict.
  4. Repo topics guard (existing behaviour).

Read the full file on GitHub · 61 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. today Changed · +25 lines e8b7aeb26d79
  2. 8d ago First seen · 36 lines · 0 tokens per session scan A 62b429f9d510

Subscribe to this mod's changes

install_hooks 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 710 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.