New: Earn 20% as an AgentAlley affiliate. Share your link and earn on every sale you refer. Join now New: Earn 20% as an affiliate. Join now

Multi-agent collaboration plugin that spawns N parallel

AgentHub — Multi-Agent Collaboration

by alirezarezvani · MIT license · ★ 26,349 on GitHub · updated Aug 30

AgentHub — Multi-Agent Collaboration cover

Multi-agent collaboration plugin that spawns N parallel subagents competing on the same task via git worktree isolation. Agents work independently, results are evaluated by metric or LLM judge, and the best branch is merged.

---
name: "agenthub"
description: "Multi-agent collaboration plugin that spawns N parallel subagents competing on the same task via git worktree isolation. Agents work independently, results are evaluated by metric or LLM judge, and the best branch is merged. Use when: user wants multiple approaches tried in parallel — code optimization, content variation, research exploration, or any task that benefits from parallel competition. Requires: a git repo."
license: MIT
metadata:
  version: 2.1.2
  author: Alireza Rezvani
  category: engineering
  updated: 2026-03-17
---

# AgentHub — Multi-Agent Collaboration

Spawn N parallel AI agents that compete on the same task. Each agent works in an isolated git worktree. The coordinator evaluates results and merges the winner.

## Slash Commands

| Command | Description |

Overview

Spawn N parallel AI agents that compete on the same task. Each agent works in an isolated git worktree. The coordinator evaluates results and merges the winner.

Manual install (npx, ZIP)
Claude Codenpx skills add alirezarezvani/claude-skills --skill agenthub -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/alirezarezvani/claude-skills/tar.gz/19392f7a0826 \ | tar -xz -C ~/.claude/skills --strip-components=4 claude-skills-19392f7a0826/engineering/agenthub/skills/agenthub
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/89159d0f4c96cc02b8da/agenthub.zip" -OutFile "$env:TEMP\agenthub.zip"; Expand-Archive "$env:TEMP\agenthub.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md7.7 KB
  • references/3 files · 17.4 KB
  • scripts/6 files · 56.6 KB
Read the files here
alirezarezvani/19392f710 files
SKILL.md
Show the full text258 lines

AgentHub — Multi-Agent Collaboration

Spawn N parallel AI agents that compete on the same task. Each agent works in an isolated git worktree. The coordinator evaluates results and merges the winner.

Slash Commands

Command Description
/hub:hub-init Create a new collaboration session — task, agent count, eval criteria
/hub:spawn Launch N parallel subagents in isolated worktrees
/hub:hub-status Show DAG state, agent progress, branch status
/hub:eval Rank agent results by metric or LLM judge
/hub:merge Merge winning branch, archive losers
/hub:board Read/write the agent message board
/hub:run One-shot lifecycle: init → baseline → spawn → eval → merge

Agent Templates

When spawning with --template, agents follow a predefined iteration pattern:

Template Pattern Use Case
optimizer Edit → eval → keep/discard → repeat x10 Performance, latency, size
refactorer Restructure → test → iterate until green Code quality, tech debt
test-writer Write tests → measure coverage → repeat Test coverage gaps
bug-fixer Reproduce → diagnose → fix → verify Bug fix approaches

Templates are defined in references/agent-templates.md.

When This Skill Activates

Trigger phrases:

  • "try multiple approaches"
  • "have agents compete"
  • "parallel optimization"
  • "spawn N agents"
  • "compare different solutions"
  • "fan-out" or "tournament"
  • "generate content variations"
  • "compare different drafts"
  • "A/B test copy"
  • "explore multiple strategies"

Coordinator Protocol

The main Claude Code session is the coordinator. It follows this lifecycle:

INIT → DISPATCH → MONITOR → EVALUATE → MERGE
1. Init

Run /hub:hub-init to create a session. This generates:

  • .agenthub/sessions/{session-id}/config.yaml — task config
  • .agenthub/sessions/{session-id}/state.json — state machine
  • .agenthub/board/ — message board channels
2. Dispatch

Run /hub:spawn to launch agents. For each agent 1..N:

  • Post task assignment to .agenthub/board/dispatch/
  • Spawn via Agent tool with isolation: "worktree"
  • All agents launched in a single message (parallel)
3. Monitor

Run /hub:hub-status to check progress:

  • dag_analyzer.py --status --session {id} shows branch state
  • Board progress/ channel has agent updates
4. Evaluate

Run /hub:eval to rank results:

  • Metric mode: run eval command in each worktree, parse numeric result
  • Judge mode: read diffs, coordinator ranks by quality
  • Hybrid: metric first, LLM-judge for ties
5. Merge

Run /hub:merge to finalize:

  • git merge --no-ff winner into base branch
  • Tag losers: git tag hub/archive/{session}/agent-{i}
  • Clean up worktrees
  • Post merge summary to board

Agent Protocol

Each subagent receives this prompt pattern:

You are agent-{i} in hub session {session-id}.
Your task: {task description}

Instructions:
1. Read your assignment at .agenthub/board/dispatch/{seq}-agent-{i}.md
2. Work in your worktree — make changes, run tests, iterate
3. Commit all changes with descriptive messages
4. Write your result summary to .agenthub/board/results/agent-{i}-result.md
5. Exit when done

Agents do NOT see each other's work. They do NOT communicate with each other. They only write to the board for the coordinator to read.

DAG Model

Branch Naming
hub/{session-id}/agent-{N}/attempt-{M}
  • Session ID: timestamp-based (YYYYMMDD-HHMMSS)
  • Agent N: sequential (1 to agent-count)
  • Attempt M: increments on retry (usually 1)
Frontier Detection

Frontier = branch tips with no child branches. Equivalent to AgentHub's "leaves" query.

python scripts/dag_analyzer.py --frontier --session {id}
Immutability

The DAG is append-only:

  • Never rebase or force-push agent branches
  • Never delete commits (only branch refs after archival)
  • Every approach preserved via git tags

Message Board

Location: .agenthub/board/

Channels
Channel Writer Reader Purpose
dispatch/ Coordinator Agents Task assignments
progress/ Agents Coordinator Status updates
results/ Agents + Coordinator All Final results + merge summary
Post Format
---
author: agent-1
timestamp: 2026-03-17T14:30:22Z
channel: results
parent: null
---

## Result Summary

- **Approach**: Replaced O(n²) sort with hash map
- **Files changed**: 3
- **Metric**: 142ms (baseline: 180ms, delta: -38ms)
- **Confidence**: High — all tests pass
Board Rules
  • Append-only: never edit or delete posts
  • Unique filenames: {seq:03d}-{author}-{timestamp}.md
  • YAML frontmatter required on all posts

Evaluation Modes

Metric-Based

Best for: benchmarks, test pass rates, file sizes, response times.

python scripts/result_ranker.py --session {id} \
  --eval-cmd "pytest bench.py --json" \
  --metric p50_ms --direction lower

The ranker runs the eval command in each agent's worktree directory and parses the metric from stdout.

LLM Judge

Best for: code quality, readability, architecture decisions.

The coordinator reads each agent's diff (git diff base...agent-branch) and ranks by:

  1. Correctness (does it solve the task?)
  2. Simplicity (fewer lines changed preferred)
  3. Quality (clean execution, good structure)
Hybrid

Run metric first. If top agents are within 10% of each other, use LLM judge to break ties.

Session Lifecycle

init → running → evaluating → merged
                            → archived (if no winner)

State transitions managed by session_manager.py:

From To Trigger
init running /hub:spawn completes
running evaluating All agents return
evaluating merged /hub:merge completes
evaluating archived No winner / all failed

Proactive Triggers

The coordinator should act when:

Signal Action
All agents crashed Post failure summary, suggest retry with different constraints
No improvement over baseline Archive session, suggest different approaches
Orphan worktrees detected Run session_manager.py --cleanup {id}
Session stuck in running Check board for progress, consider timeout

Installation

# Copy to your Claude Code skills directory
cp -r engineering/agenthub ~/.claude/skills/agenthub

# Or install via ClawHub
clawhub install agenthub

Scripts

Script Purpose
hub_init.py Initialize .agenthub/ structure and session
dag_analyzer.py Frontier detection, DAG graph, branch status
board_manager.py Message board CRUD (channels, posts, threads)
result_ranker.py Rank agents by metric or diff quality
session_manager.py Session state machine and cleanup
  • autoresearch-agent — Single-agent optimization loop (use AgentHub when you want N agents competing)
  • self-improving-agent — Self-modifying agent (use AgentHub when you want external competition)
  • git-worktree-manager — Git worktree utilities (AgentHub uses worktrees internally)
1---
2name: "agenthub"
3description: "Multi-agent collaboration plugin that spawns N parallel subagents competing on the same task via git worktree isolation. Agents work independently, results are evaluated by metric or LLM judge, and the best branch is merged. Use when: user wants multiple approaches tried in parallel — code optimization, content variation, research exploration, or any task that benefits from parallel competition. Requires: a git repo."
4license: MIT
5metadata:
6 version: 2.1.2
7 author: Alireza Rezvani
8 category: engineering
9 updated: 2026-03-17
10---
11 
12# AgentHub — Multi-Agent Collaboration
13 
14Spawn N parallel AI agents that compete on the same task. Each agent works in an isolated git worktree. The coordinator evaluates results and merges the winner.
15 
16## Slash Commands
17 
18| Command | Description |
19|---------|-------------|
20| `/hub:hub-init` | Create a new collaboration session — task, agent count, eval criteria |
21| `/hub:spawn` | Launch N parallel subagents in isolated worktrees |
22| `/hub:hub-status` | Show DAG state, agent progress, branch status |
23| `/hub:eval` | Rank agent results by metric or LLM judge |
24| `/hub:merge` | Merge winning branch, archive losers |
25| `/hub:board` | Read/write the agent message board |
26| `/hub:run` | One-shot lifecycle: init → baseline → spawn → eval → merge |
27 
28## Agent Templates
29 
30When spawning with `--template`, agents follow a predefined iteration pattern:
31 
32| Template | Pattern | Use Case |
33|----------|---------|----------|
34| `optimizer` | Edit → eval → keep/discard → repeat x10 | Performance, latency, size |
35| `refactorer` | Restructure → test → iterate until green | Code quality, tech debt |
36| `test-writer` | Write tests → measure coverage → repeat | Test coverage gaps |
37| `bug-fixer` | Reproduce → diagnose → fix → verify | Bug fix approaches |
38 
39Templates are defined in `references/agent-templates.md`.
40 
41## When This Skill Activates
42 
43Trigger phrases:
44- "try multiple approaches"
45- "have agents compete"
46- "parallel optimization"
47- "spawn N agents"
48- "compare different solutions"
49- "fan-out" or "tournament"
50- "generate content variations"
51- "compare different drafts"
52- "A/B test copy"
53- "explore multiple strategies"
54 
55## Coordinator Protocol
56 
57The main Claude Code session is the coordinator. It follows this lifecycle:
58 
59```
60INIT → DISPATCH → MONITOR → EVALUATE → MERGE
61```
62 
63### 1. Init
64 
65Run `/hub:hub-init` to create a session. This generates:
66- `.agenthub/sessions/{session-id}/config.yaml` — task config
67- `.agenthub/sessions/{session-id}/state.json` — state machine
68- `.agenthub/board/` — message board channels
69 
70### 2. Dispatch
71 
72Run `/hub:spawn` to launch agents. For each agent 1..N:
73- Post task assignment to `.agenthub/board/dispatch/`
74- Spawn via Agent tool with `isolation: "worktree"`
75- All agents launched in a single message (parallel)
76 
77### 3. Monitor
78 
79Run `/hub:hub-status` to check progress:
80- `dag_analyzer.py --status --session {id}` shows branch state
81- Board `progress/` channel has agent updates
82 
83### 4. Evaluate
84 
85Run `/hub:eval` to rank results:
86- **Metric mode**: run eval command in each worktree, parse numeric result
87- **Judge mode**: read diffs, coordinator ranks by quality
88- **Hybrid**: metric first, LLM-judge for ties
89 
90### 5. Merge
91 
92Run `/hub:merge` to finalize:
93- `git merge --no-ff` winner into base branch
94- Tag losers: `git tag hub/archive/{session}/agent-{i}`
95- Clean up worktrees
96- Post merge summary to board
97 
98## Agent Protocol
99 
100Each subagent receives this prompt pattern:
101 
102```
103You are agent-{i} in hub session {session-id}.
104Your task: {task description}
105 
106Instructions:
1071. Read your assignment at .agenthub/board/dispatch/{seq}-agent-{i}.md
1082. Work in your worktree — make changes, run tests, iterate
1093. Commit all changes with descriptive messages
1104. Write your result summary to .agenthub/board/results/agent-{i}-result.md
1115. Exit when done
112```
113 
114Agents do NOT see each other's work. They do NOT communicate with each other. They only write to the board for the coordinator to read.
115 
116## DAG Model
117 
118### Branch Naming
119 
120```
121hub/{session-id}/agent-{N}/attempt-{M}
122```
123 
124- Session ID: timestamp-based (`YYYYMMDD-HHMMSS`)
125- Agent N: sequential (1 to agent-count)
126- Attempt M: increments on retry (usually 1)
127 
128### Frontier Detection
129 
130Frontier = branch tips with no child branches. Equivalent to AgentHub's "leaves" query.
131 
132```bash
133python scripts/dag_analyzer.py --frontier --session {id}
134```
135 
136### Immutability
137 
138The DAG is append-only:
139- Never rebase or force-push agent branches
140- Never delete commits (only branch refs after archival)
141- Every approach preserved via git tags
142 
143## Message Board
144 
145Location: `.agenthub/board/`
146 
147### Channels
148 
149| Channel | Writer | Reader | Purpose |
150|---------|--------|--------|---------|
151| `dispatch/` | Coordinator | Agents | Task assignments |
152| `progress/` | Agents | Coordinator | Status updates |
153| `results/` | Agents + Coordinator | All | Final results + merge summary |
154 
155### Post Format
156 
157```markdown
158---
159author: agent-1
160timestamp: 2026-03-17T14:30:22Z
161channel: results
162parent: null
163---
164 
165## Result Summary
166 
167- **Approach**: Replaced O(n²) sort with hash map
168- **Files changed**: 3
169- **Metric**: 142ms (baseline: 180ms, delta: -38ms)
170- **Confidence**: High — all tests pass
171```
172 
173### Board Rules
174 
175- Append-only: never edit or delete posts
176- Unique filenames: `{seq:03d}-{author}-{timestamp}.md`
177- YAML frontmatter required on all posts
178 
179## Evaluation Modes
180 
181### Metric-Based
182 
183Best for: benchmarks, test pass rates, file sizes, response times.
184 
185```bash
186python scripts/result_ranker.py --session {id} \
187 --eval-cmd "pytest bench.py --json" \
188 --metric p50_ms --direction lower
189```
190 
191The ranker runs the eval command in each agent's worktree directory and parses the metric from stdout.
192 
193### LLM Judge
194 
195Best for: code quality, readability, architecture decisions.
196 
197The coordinator reads each agent's diff (`git diff base...agent-branch`) and ranks by:
1981. Correctness (does it solve the task?)
1992. Simplicity (fewer lines changed preferred)
2003. Quality (clean execution, good structure)
201 
202### Hybrid
203 
204Run metric first. If top agents are within 10% of each other, use LLM judge to break ties.
205 
206## Session Lifecycle
207 
208```
209init → running → evaluating → merged
210 → archived (if no winner)
211```
212 
213State transitions managed by `session_manager.py`:
214 
215| From | To | Trigger |
216|------|----|---------|
217| `init` | `running` | `/hub:spawn` completes |
218| `running` | `evaluating` | All agents return |
219| `evaluating` | `merged` | `/hub:merge` completes |
220| `evaluating` | `archived` | No winner / all failed |
221 
222## Proactive Triggers
223 
224The coordinator should act when:
225 
226| Signal | Action |
227|--------|--------|
228| All agents crashed | Post failure summary, suggest retry with different constraints |
229| No improvement over baseline | Archive session, suggest different approaches |
230| Orphan worktrees detected | Run `session_manager.py --cleanup {id}` |
231| Session stuck in `running` | Check board for progress, consider timeout |
232 
233## Installation
234 
235```bash
236# Copy to your Claude Code skills directory
237cp -r engineering/agenthub ~/.claude/skills/agenthub
238 
239# Or install via ClawHub
240clawhub install agenthub
241```
242 
243## Scripts
244 
245| Script | Purpose |
246|--------|---------|
247| `hub_init.py` | Initialize `.agenthub/` structure and session |
248| `dag_analyzer.py` | Frontier detection, DAG graph, branch status |
249| `board_manager.py` | Message board CRUD (channels, posts, threads) |
250| `result_ranker.py` | Rank agents by metric or diff quality |
251| `session_manager.py` | Session state machine and cleanup |
252 
253## Related Skills
254 
255- **autoresearch-agent** — Single-agent optimization loop (use AgentHub when you want N agents competing)
256- **self-improving-agent** — Self-modifying agent (use AgentHub when you want external competition)
257- **git-worktree-manager** — Git worktree utilities (AgentHub uses worktrees internally)
258 
View all files on GitHub →

Details

Updated
Aug 30, 2026
License
MIT
Stars on the repo
★ 26,349
Checked
Source
alirezarezvani/claude-skills ↗
Creator
alirezarezvani · 363 listings
View creator

Similar skills

See all →
SkillAutomates CI/CD pipeline setupCI/CD and Automationaddyosmani/agent-skills · by addyosmaniAutomates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.★ 98.7k GitHub starsSkillAutomated semantic versioning and release workflowVersion Bump & Release Workflowthedotmack/claude-mem · by thedotmackAutomated semantic versioning and release workflow for Claude Code plugins. Handles version increments across package.json, marketplace.json, plugin.json manifests, build verification, git tagging, GitHub releases, and changelog generation. NPM publishing is the final human-required handoff because the maintainer raised npm security.★ 95.6k GitHub starsSkillOperate Orca-managed worktrees, folder contexts, terminalsOrca CLIstablyai/orca · by stablyaiOperate Orca-managed worktrees, folder contexts, terminals, repos, automations, artifacts, skill sharing, worktree comments, and Orca's embedded browser through the `orca` CLI. Use when the user says "$orca-cli", "Orca worktree", "child worktree", "spawn codex/claude in a worktree", "read/wait/send Orca terminal", "handoff" / "handover" / "give this to another agent", "Orca browser", "orca artifacts", or "share skills". Prefer it over raw git worktree, ad hoc PTYs, or Computer Use when Orca state is involved. Use Computer Use only when a visible window needs GUI control that a CLI, filesystem, or API cannot do.★ 84.5k GitHub starsSkillThreaded messages, blocking ask/reply, task dispatchOrca Orchestrationstablyai/orca · by stablyaiCoordinate supervised Orca workers: threaded messages, blocking ask/reply, task dispatch, worker_done/escalation waits, task DAGs, decision gates, coordinator loops, and decomposing work across agents. Use `orca-cli` for full ownership handoffs — "hand off", "handoff", "handover", "give this to another agent", "another worktree" — unless asked to supervise, monitor, or coordinate a DAG, and for terminal control, lightweight terminal prompts, shell commands, Orca worktree management, and reading or waiting on terminals.★ 84.5k GitHub starsSkillDeploy applications and websites to VercelVercel deploybytedance/deer-flow · by bytedanceDeploy applications and websites to Vercel. Use this skill when the user requests deployment actions such as "Deploy my app", "Deploy this to production", "Create a preview deployment", "Deploy and give me the link", or "Push this live". No authentication required - returns preview URL and claimable deployment link.★ 83.5k GitHub starsSkillOpen or update a pull request on pascalorg/editorOpen PRpascalorg/editor · by pascalorgOpen or update a pull request on pascalorg/editor from the current branch, describing only what the branch actually did. Use when the user asks to open/create a PR, push and PR, or ship a branch in the editor repo.★ 24.6k GitHub stars

More from alirezarezvani

SkillResume a paused experiment/ar:ar-resume — Resume Experimentalirezarezvani/claude-skills · by alirezarezvaniResume a paused experiment. Checkout the experiment branch, read results history, continue iterating. Use when the user runs /ar:ar-resume or asks to pick up a previously started autoresearch experiment.★ 26.3k GitHub starsSkillShow experiment dashboard with results, active loops/ar:ar-status — Experiment Dashboardalirezarezvani/claude-skills · by alirezarezvaniShow experiment dashboard with results, active loops, and progress. Use when the user runs /ar:ar-status or asks how an autoresearch experiment is going.★ 26.3k GitHub starsSkillStart an autonomous experiment loop with user-selected/ar:loop — Autonomous Experiment Loopalirezarezvani/claude-skills · by alirezarezvaniStart an autonomous experiment loop with user-selected interval (10min, 1h, daily, weekly, monthly). Uses CronCreate for scheduling. Use when the user runs /ar:loop or asks to run an autoresearch experiment continuously on a schedule.★ 26.3k GitHub starsSkillRun a single experiment iteration/ar:run — Single Experiment Iterationalirezarezvani/claude-skills · by alirezarezvaniRun a single experiment iteration. Edit the target file, evaluate, keep or discard. Use when the user runs /ar:run or asks for one manual autoresearch iteration.★ 26.3k GitHub starsSkillSet up a new autoresearch experiment interactively/ar:setup — Create New Experimentalirezarezvani/claude-skills · by alirezarezvaniSet up a new autoresearch experiment interactively. Collects domain, target file, eval command, metric, direction, and evaluator. Use when the user runs /ar:setup or asks to start optimizing a file with the autoresearch loop.★ 26.3k GitHub starsSkill/cs:boardroom <brief/cs:boardroom — Multi-Role Boardroom Deliberationalirezarezvani/claude-skills · by alirezarezvani/cs:boardroom <brief> — 6-phase multi-role deliberation across the C-suite with Phase 2 isolation, critic pre-screen, and synthesis. Outputs a board memo. Use when a decision spans multiple executive domains — e.g. a pricing change touching finance, positioning, and product, or a raise-vs-cut runway call.★ 26.3k GitHub stars