From grok-swarm
Multi-agent intelligence powered by Grok 4.20 via OpenRouter. Use for codebase analysis, refactoring, code generation, and complex reasoning. Triggers: "use grok swarm", "grok 4.20", "multi-agent analysis", "codebase audit", "grok refactor", "16 agent mode"
How this skill is triggered — by the user, by Claude, or both
Slash command
/grok-swarm:grok-swarmThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Give Claude Code access to a 4-agent swarm with ~2M token context for powerful code analysis, refactoring, and reasoning.
Give Claude Code access to a 4-agent swarm with ~2M token context for powerful code analysis, refactoring, and reasoning.
On first use, Grok Swarm will automatically prompt for your API key:
/grok-swarm:analyze Find bugs in this codebase
→ "I need an OpenRouter API key to use Grok Swarm. Would you like me to help you set one up?"
→ "Yes, here's my key: sk-or-v1-..."
→ Setup complete! Now analyzing...
Get a free API key at: https://openrouter.ai/keys
If you prefer manual setup:
/grok-swarm:setup
This stores your API key in ~/.claude/grok-swarm.local.md (plugin settings pattern).
| Mode | Description |
|---|---|
refactor | Improve code quality while preserving behavior |
analyze | Security, bug, and architecture audit |
code | Generate clean, production-ready code |
reason | Collaborative multi-perspective reasoning |
/grok-swarm:refactor Convert this to async/await
/grok-swarm:analyze Find security vulnerabilities in auth/
/grok-swarm:code Write a FastAPI endpoint for user registration
/grok-swarm:reason Compare microservices vs monolith for this project
When installed via the plugin system or claude mcp add, Grok Swarm registers as a native MCP server. These tools are available directly — no slash commands needed:
| Tool | Description |
|---|---|
grok_query | Stateless single call — analyze, refactor, code, or reason |
grok_session_start | Begin a multi-turn conversation with Grok |
grok_session_continue | Continue an existing session (Grok remembers history) |
grok_agent | Run the autonomous agent loop (discover → modify → verify) |
grok_session_start(mode="analyze", files=["src/auth.py"])
→ { session_id: "abc123" }
grok_session_continue(session_id="abc123", message="What about password hashing?")
→ Grok remembers the previous analysis
Grok Swarm uses a PKCE OAuth flow to obtain your OpenRouter API key. Your key never passes through the LLM context window.
/grok-swarm:setup
→ Opens browser to OpenRouter authorization
→ Browser redirects back to localhost callback
→ Key saved to ~/.config/grok-swarm/config.json (mode 600)
Get a free API key at: https://openrouter.ai/keys
API keys are resolved in priority order:
$OPENROUTER_API_KEY or $XAI_API_KEY (highest priority)~/.config/grok-swarm/config.json~/.openclaw/auth-profiles.jsonDry-Run (Preview Only)
/grok-swarm:code Write a FastAPI user endpoint --output-dir ./src
Apply Mode (Write Files)
/grok-swarm:code Write a FastAPI user endpoint --output-dir ./src --apply
Execute After Generation
/grok-swarm:refactor Improve auth/ --apply --execute "pytest tests/"
For complex tasks, use High Thinking for deeper reasoning:
/grok-swarm:analyze Security audit --thinking high
Or: "grok 16 agent swarm, analyze this codebase"
For partial file edits:
/grok-swarm:refactor Convert to async --use-morph --apply
Requires Morph LLM MCP: claude mcp add morphllm
Monitor your API usage:
/grok-swarm:stats
This shows tokens used and estimated cost based on OpenRouter pricing.
View or change settings:
/grok-swarm:setup # Re-run setup
| Flag | Description |
|---|---|
--output-dir | Directory to write files (used with --apply) |
--apply | Actually write files (default is dry-run) |
--execute | Run a command after generation |
--use-morph | Use Morph LLM MCP for partial edits |
--thinking | Thinking level: standard or high |
--timeout | API timeout in seconds (default: 120) |
claude mcp add morphllm)npx claudepluginhub khaentertainment/grok-multiagent-plugin --plugin grok-swarmExpert in using Claude Code CLI for advanced configuration, hooks, MCPs, CLAUDE.md, workflows, sub-agents, and permissions to maximize productivity.
Leverages OpenAI Codex/GPT models for autonomous code implementation, reviews, and sandboxed task execution. Triggers on 'codex', 'use gpt', 'full-auto' etc.
Delegates complex code generation, refactoring, architectural analysis, and review tasks to OpenAI's Codex CLI (GPT-5.3-codex models) via safe workflows with sandboxing and approvals. Activates on explicit triggers like 'use codex' or 'codex exec'.