plugins/agent-loops/skills/agent-swarm/SKILL.md
(Industry standard: Parallel Agent) Primary Use Case: Work that can be partitioned into independent sub-tasks running concurrently across multiple agents. Parallel multi-agent execution pattern. Use when: work can be partitioned into independent tasks that N agents can execute simultaneously across worktrees. Includes routing (sequential vs parallel), merge verification, and correction loops.
npx skillsauth add richfrem/agent-plugins-skills agent-swarmInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill requires Python 3.8+ and standard library only. No external packages needed.
To install this skill's dependencies:
pip-compile ./requirements.in
pip install -r ./requirements.txt
See ../../requirements.txt for the dependency lockfile (currently empty — standard library only).
Parallel or pipelined execution across multiple agents and worktrees. The orchestrator partitions work, dispatches to agents, and verifies/merges the results.
agy, claude, copilot, gemini, llama).Gemini 3.5 Flash (Low) or gemini-3.5-flash for agy).swarm_run.py invocation with --engine and --model matching their choices, appending < /dev/null to prevent TTY input halts (SIGTTIN).Each worktree can be assigned to a different worker type based on task complexity:
| Worker | Cost | Best For | |--------|------|----------| | High-reasoning CLI (Opus, Ultra, GPT-5.3) | High | Complex logic, architecture | | Fast CLI (Haiku, Flash 2.0) | Low | Tests, docs, routine tasks | | Low-cost CLI (gpt-5-mini, gemini-3.5-flash) | Low | Standard low-cost reasoning tier | | Free CLI: llama gemma-4-12b | $0 | Self-hosted local inference, zero-cost batch jobs | | Deterministic Script | None | Formatting, linting, data transforms | | Human | N/A | Judgment calls, creative decisions |
Cost Optimization Strategy: For bulk summarization or distillation jobs, use
--engine llama(local Gemma 4) if you have local Metal/CUDA acceleration set up. It is the only truly zero-cost path. Cloud CLIs like--engine copilot(gpt-5-mini) or--engine agy(gemini-3.5-flash) are low-cost but paid (consuming AI Credits or per-token billing). Use--workers 2for cloud CLIs (rate-limit safe) and--workers 1for localllamato avoid context swapping on 16GB Macs.
The ./../scripts/swarm_run.py script is the universal engine for executing this pattern. It is driven by Job Files (.md with YAML frontmatter).
.swarm_state_<job>.json. Use --resume to skip already processed items.check_cmd in the job file to short-circuit work if a file is already processed (e.g. exists in cache).--engine [claude|gemini|copilot|agy] switches CLI backends at runtime.# Zero-cost Copilot batch (2 workers recommended to avoid rate limits)
source ~/.zshrc # NOTE: use source ~/.zshrc, NOT 'export COPILOT_GITHUB_TOKEN=$(gh auth token)'
# gh auth token generates a PAT without Copilot scope -> auth failures
python ./scripts/swarm_run.py \
--engine copilot \
--job ./resources/jobs/my_job.job.md \
--files-from checklist.md \
--resume --workers 2
# Gemini (free, higher parallelism)
python ./scripts/swarm_run.py \
--engine gemini \
--job ./resources/jobs/my_job.job.md \
--files-from checklist.md \
--resume --workers 5
# Claude (paid, highest quality)
python ./scripts/swarm_run.py \
--job ./resources/jobs/my_job.job.md \
[--dir some/dir] [--resume] [--dry-run]
---
model: haiku # haiku -> auto-upgraded to gpt-5-mini (copilot) or gemini-3-pro-preview (gemini)
workers: 2 # keep to 2 for Copilot, up to 5-10 for Gemini/Claude
timeout: 120 # seconds per worker
ext: [".md"] # filters for --dir
# Shell template. {file} is shell-quoted automatically (handles apostrophes safely)
post_cmd: "python ./scripts/my_post_cmd.py --file {file} --summary {output}"
# Optional command to check if work is already done (exit 0 => skip)
check_cmd: "python ./scripts/check_cache.py --file {file}"
vars:
profile: project
---
Prompt for the agent goes here.
IMPORTANT for Copilot engine: The copilot CLI ignores stdin when -p is used.
Instead, the instruction is prepended to the file content automatically by ./scripts/swarm_run.py.
Do NOT use tool calls or filesystem access - rely only on the content provided via stdin.
-p flag -- Copilot ignores stdin when -p is present. ./scripts/swarm_run.py automatically prepends the prompt to the file content instead.source ~/.zshrc to load your token. gh auth token returns a PAT without Copilot permissions, causing auth failures under concurrency.--workers 2 maximum. Higher concurrency trips GitHub's anti-abuse systems and surfaces as authentication errors.fcntl.flock for atomic writes. See inject_summary.py.-p "prompt" flag normallyhaiku -> gemini-3-pro-previewIf a batch run is interrupted partway through and the output store (e.g. cache JSON) is partially corrupted, reconcile the checkpoint before resuming:
# Remove phantom "done" entries that aren't actually in the output store
completed = [f for f in st['completed'] if f in actual_output_keys]
st['failed'] = {}
Then rerun with --resume.
{file} in post_cmd is shell-quoted automatically -- filenames with apostrophes are safetotal_tokens and duration_ms from worker agents to a centralized timing.json log immediately as subtasks complete, rather than waiting for the entire swarm batch to finish.See: ./assets/resources/agent_swarm.mmd
data-ai
Task management agent. Auto-invoked for task creation, status tracking, and kanban board operations using Markdown files across lane directories. V2 enforces Kanban Sovereignty constraints preventing manual task file edits.
development
Create, audit, repair, and document cross-platform symlinks that work correctly on both Windows and macOS/Linux. Use this skill whenever the user mentions symlinks, symbolic links, junction points, .gitconfig symlinks, broken links after git pull, cross-platform path issues, or needs help with ln -s equivalents on Windows. Also trigger when the user reports that files are missing or wrong after switching between Mac and Windows machines using Git. This skill solves the common problem where symlinks committed on macOS show up as plain text files on Windows (and vice versa) because of Git's core.symlinks setting or missing Developer Mode / elevated permissions. **IMPORTANT FOR WINDOWS USERS:** Developer Mode must be enabled before creating symlinks. Without it, Git will check out symlinks as plain-text files or hardlinks, breaking cross-platform workflows.
development
Interactively prepares a targeted Red Team Review package. It conducts a brief discovery interview to determine the threat model, generates a strict security auditor prompt, compiles a manifest of relevant project files, and bundles them into a single Markdown artifact or ZIP archive ready for an external LLM (like Grok, ChatGPT, or Gemini) or a human reviewer.
tools
Reduces AI agent context bloat across three dimensions: (1) duplicate skill deduplication — clears stale agent directory copies since the IDE already reads from plugins/ directly; (2) instruction file optimization — rewrites CLAUDE.md, GEMINI.md, or .github/copilot-instructions.md to under ~80 lines, keeping only rules that directly change agent behaviour; (3) session token efficiency — guidance on cheap subagent delegation, context compounding across turns, and session hygiene. Trigger with "optimize context", "reduce context bloat", "deduplicate skills", "trim CLAUDE.md", "trim GEMINI.md", "fix my context usage", "why are my skills loading twice", "how do I reduce token usage", or "clean up agent directories".