agenthub
Multi-agent tournament plugin that runs parallel agents on one task and merges the best result.
- CCM score
- 62 of 100
- version
- 2.14.11
- GitHub stars
- 30.6K
Own this plugin? Claim it
What it does
- Adds the
/hub-init,/hub-status,/hub-run,/agenthub:spawn,/agenthub:eval,/agenthub:merge, and/agenthub:boardcommands, plus thehub-coordinatoragent - Covers the full lifecycle: baseline capture, spawn in git worktrees, metric or LLM judge ranking, and merge of the winning branch
- Archives losing branches as tags and cleans up worktrees, so only the chosen result lands in your branch
- Designed for optimization, refactoring, and content tasks where several competing approaches are worth comparing
Multi-agent collaboration — spawn N parallel subagents that compete on code optimization, content drafts, research approaches, or any task that benefits from diverse solutions. 7 slash commands (/hub-init, /agenthub:spawn, /hub-status, /agenthub:eval, /agenthub:merge, /agenthub:board, /hub-run), agent templates, DAG-based orchestration, LLM judge mode, message board coordination.
Add marketplace
/plugin marketplace add alirezarezvani/claude-skillsRun it inside Claude Code once, then install the plugin below.
Install
/plugin install agenthub@claude-code-skillsRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceAgentHub — 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-init | Create a new collaboration session — task, agent count, eval criteria |
/agenthub:spawn | Launch N parallel subagents in isolated worktrees |
/hub-status | Show DAG state, agent progress, branch status |
/agenthub:eval | Rank agent results by metric or LLM judge |
/agenthub:merge | Merge winning branch, archive losers |
/agenthub: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-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 /agenthub: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-status to check progress:
dag_analyzer.py --status --session {id}shows branch state- Board
progress/channel has agent updates
4. Evaluate
Run /agenthub: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 /agenthub:merge to finalize:
git merge --no-ffwinner 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:
- Correctness (does it solve the task?)
- Simplicity (fewer lines changed preferred)
- 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 | /agenthub:spawn completes |
running | evaluating | All agents return |
evaluating | merged | /agenthub: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 |
Related Skills
- 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)
More in this skill
Load these only when the task needs them.
-
references/coordination-strategies.md — Multi-Agent Coordination Strategies
-
references/dag-patterns.md — Git DAG Patterns for Multi-Agent Collaboration
-
python3 scripts/dry_run.py --help— Dry-run validation for the AgentHub plugin
Readme
AgentHub — Multi-Agent Collaboration for Claude Code
AgentHub spawns N parallel agents in isolated git worktrees to compete on the same task, then evaluates results by metric or LLM judge and merges the winner. It turns any optimization, refactoring, content generation, or design problem into a tournament where the best solution wins.
Quick Start
/plugin marketplace add alirezarezvani/claude-skills
/plugin install agenthub@claude-code-skills
# One command — full lifecycle
/hub-run --task "Reduce p50 latency" --agents 3 \
--eval "pytest bench.py --json" --metric p50_ms --direction lower \
--template optimizer
Or step by step:
# 1. Initialize a session — define the task, agent count, and evaluation criteria
/hub-init --task "Reduce API p50 latency" --agents 3 \
--eval "pytest bench.py --json" --metric p50_ms --direction lower
# 2. Spawn agents — launches 3 parallel agents in isolated worktrees
/agenthub:spawn --template optimizer
# 3. Check progress
/hub-status
# 4. Evaluate — rank agents by metric
/agenthub:eval
# 5. Merge the winner into your branch
/agenthub:merge
Skill hints (UserPromptSubmit hook)
Some skills in this plugin rarely load on their own: in our trigger evals the model answered prompts squarely in their scope without opening them. The plugin ships a small hook, hooks/skill_router.py, that reads each prompt and, when it clearly matches one of these skills, adds one line telling Claude which skill fits: agenthub:agenthub.
It is quiet by design. It prints nothing on prompts that don't match, suggests at most one skill per prompt and each skill at most once per session, skips prompts that start with /, never blocks a prompt and makes no network or model calls. The patterns live in hooks/skill_routes.json. Turn it off with SKILL_ROUTER=0 (all plugins) or SKILL_ROUTER_AGENTHUB=0 (this plugin only).
Commands Reference
| Command | Purpose | Example |
|---|---|---|
/hub-init | Create session with task, agents, eval criteria | /hub-init --task "Optimize DB queries" --agents 4 --eval "python bench.py" --metric query_ms --direction lower |
/agenthub:spawn | Launch all agents in parallel worktrees | /agenthub:spawn (uses latest session) |
/hub-status | Show DAG state, branches, progress posts | /hub-status |
/agenthub:eval | Rank results by metric or LLM judge | /agenthub:eval --judge (LLM judge mode) |
/agenthub:merge | Merge winner, archive losers, cleanup | /agenthub:merge --agent agent-2 (force pick) |
/agenthub:board | Read/write the message board | /agenthub:board --read progress |
/hub-run | One-shot full lifecycle | /hub-run --task "Reduce latency" --agents 3 --eval "pytest bench.py" --metric p50_ms --direction lower --template optimizer |
The Optimizer Pattern
AgentHub's most powerful pattern: N agents compete using different strategies, each running an iterative improvement loop in its own worktree.
How It Works
/hub-run --task "Reduce p50 latency" --agents 3 \
--eval "pytest bench.py --json" --metric p50_ms --direction lower \
--template optimizer
Each agent follows the same loop independently:
┌─── Agent 1 (worktree) ──────────────────────────┐
│ Strategy: Caching │
│ Loop: edit → eval → keep/discard → repeat ×10 │
└─────────────────────────────────────────────────┘
┌─── Agent 2 (worktree) ──────────────────────────┐
│ Strategy: Algorithm optimization │
│ Loop: edit → eval → keep/discard → repeat ×10 │
└─────────────────────────────────────────────────┘
┌─── Agent 3 (worktree) ──────────────────────────┐
│ Strategy: I/O batching │
│ Loop: edit → eval → keep/discard → repeat ×10 │
└─────────────────────────────────────────────────┘
The optimizer template embeds the iteration loop directly in each agent's dispatch prompt — no external dependencies required.
Agent Templates
Templates define the dispatch prompt pattern. Use --template with /agenthub:spawn or /hub-run:
| Template | Pattern | Use Case |
|---|---|---|
optimizer | Edit → eval → keep/discard → repeat x10 | Performance, latency, size reduction, content quality, research depth |
refactorer | Restructure → test → iterate until green | Code quality, tech debt, document restructuring |
test-writer | Write tests → measure coverage → repeat | Test coverage gaps |
bug-fixer | Reproduce → diagnose → fix → verify | Bug fix with competing approaches |
Templates live in references/agent-templates.md.
Example: 3 Strategies Competing on API Latency
/hub-run --task "Reduce API p50 latency below 150ms" --agents 3 \
--eval "pytest bench.py --json" --metric p50_ms --direction lower \
--template optimizer
AgentHub automatically:
- Captures baseline (e.g.,
p50_ms = 180ms) - Assigns diverse strategies (caching, algorithm, I/O batching)
- Spawns 3 agents — each iterates up to 10 times in its worktree
- Agents commit improvements, revert failures, post progress to the board
- Evaluates final metrics across all agents
- Presents ranked results for merge confirmation
# Example output:
# RANK AGENT METRIC DELTA FILES
# 1 agent-2 128ms -52ms 4
# 2 agent-1 145ms -35ms 2
# 3 agent-3 171ms -9ms 1
Example: 3 Agents Drafting Competing Blog Posts
/hub-run --task "Write a 1500-word blog post on zero-downtime deployments" \
--agents 3 --judge
No eval command needed — --judge activates LLM judge mode. Each agent takes a different angle (tutorial, case study, opinion piece). The coordinator reads all three drafts and picks the winner by clarity, depth, and engagement.
Power-Up: Autoresearch for Richer Tracking
If you also have the autoresearch-agent skill installed, agents can optionally use its tracking tools for:
- results.tsv — structured iteration history with timestamps and metrics
- Strategy escalation — start with low-hanging fruit, escalate to radical changes
- program.md — self-improving agent instructions that refine across iterations
This is entirely optional. The optimizer template works standalone — autoresearch just adds richer per-agent tracking if available. Both plugins remain independent; install either or both.
Step-by-Step Walkthrough
-
Init + Baseline — Sets up session config with task description, agent count, eval command, and target metric. Captures baseline metric value. Creates
.agenthub/sessions/{id}/config.yaml. -
Spawn — The coordinator writes dispatch posts to
.agenthub/board/dispatch/with strategy-specific instructions for each agent. Each agent is launched withisolation: "worktree"so it works on an isolated copy of the repo. When a template is used, the dispatch prompt contains the full iteration loop. -
Agents iterate — Each agent independently: reads its dispatch instructions, makes changes to the target files, runs the eval command, commits improvements, reverts failures, and posts progress updates.
-
Evaluate — Runs
result_ranker.pywhich checks out each agent's final branch, runs the eval command, extracts the metric, and produces a ranked table with deltas from baseline. -
Merge — Merges the winning branch with
--no-ff, archives loser branches as tags (hub/archive/{session}/{agent}), cleans up worktrees, and posts a merge summary to the board.
Coordination Patterns
Fan-Out / Fan-In (Default)
One coordinator spawns N agents with the same task but different strategies or constraints. All run in parallel. Results are evaluated and one winner is merged.
Best for: Performance optimization, competing implementations, A/B testing approaches, competing marketing copy variations.
Tournament (Multi-Round Elimination)
Multiple rounds of fan-out/fan-in. Winners advance, losers are eliminated. Each round can narrow the strategy space.
Best for: Large solution spaces where you want to prune early, iterative refinement of the best approaches, multi-round content refinement.
Ensemble (Combine All Agents' Work)
Each agent works on a different subtask rather than competing on the same one. Results are combined rather than compared.
Best for: Large refactoring tasks, multi-file changes where work can be parallelized by module, multi-section reports or whitepapers.
Pipeline (Sequential Phases)
Agent 1's output becomes Agent 2's input. Each phase builds on the previous result.
Best for: Multi-stage workflows (e.g., Agent 1 writes tests, Agent 2 writes implementation, Agent 3 optimizes) or research → draft → edit pipelines.
Scripts
| Script | Purpose | Example |
|---|---|---|
hub_init.py | Create session directory and config | python scripts/hub_init.py --task "Optimize queries" --agents 3 --eval "python bench.py" --metric query_ms --direction lower |
board_manager.py | Message board CRUD (dispatch, progress, results) | python scripts/board_manager.py --post --channel progress --author agent-1 --message "Iteration 3: p50=145ms" |
session_manager.py | Session state machine (init→running→evaluating→merged) | python scripts/session_manager.py --list |
dag_analyzer.py | Git DAG analysis — frontier detection, branch status | python scripts/dag_analyzer.py --status --session 20260317-143022 |
result_ranker.py | Evaluate and rank agent results by metric or diff | python scripts/result_ranker.py --session 20260317-143022 --eval-cmd "pytest bench.py --json" --metric p50_ms --direction lower |
All scripts support --help for full usage and --demo for example output.
Installation
Claude Code
# Install from ClawHub
claude install agenthub
# Or add manually — copy the engineering/agenthub/ folder to your project,
# then add to your .claude/settings.json:
{
"skills": ["./engineering/agenthub"]
}
OpenAI Codex
# Copy to your agents directory
cp -r engineering/agenthub/ .codex/agents/agenthub/
OpenClaw
openclaw install agenthub
Architecture
Session Model
Each /hub-init creates a session with a timestamp-based ID (YYYYMMDD-HHMMSS). Sessions progress through states:
init → running → evaluating → merged
→ archived
State is tracked in .agenthub/sessions/{session-id}/state.json.
Branch Naming
hub/{session-id}/agent-{N}/attempt-{M}
# Example:
hub/20260317-143022/agent-1/attempt-1
hub/20260317-143022/agent-2/attempt-1
hub/20260317-143022/agent-3/attempt-1
Board Channels
The message board uses three channels stored as YAML-frontmatter markdown files:
| Channel | Direction | Purpose |
|---|---|---|
dispatch | coordinator → agents | Task assignments and strategy prompts |
progress | agents → coordinator | Status updates, iteration results |
results | bidirectional | Final metrics, merge summaries |
Immutability Rules
- Append-only board — posts are never edited or deleted
- Append-only DAG — no rebase, no force-push
- Archive losers — loser branches become tags, not deleted
- Worktree cleanup — removed only after merge is complete
Directory Structure
.agenthub/
├── sessions/{session-id}/
│ ├── config.yaml # Task, agents, eval criteria
│ └── state.json # State machine, agent status
└── board/
├── _index.json # Channel metadata
├── dispatch/ # Coordinator → agents
├── progress/ # Agents → coordinator
└── results/ # Final results + merge summary
License
MIT
Details
- Marketplace
- alirezarezvani/claude-skills
- Source
- engineering/agenthub
- Author
- Alireza Rezvani
- Category
- Development
- Keywords
- multi-agent, collaboration, parallel, git-dag, orchestration, competition, worktree, content-generation, research, optimization
- Listed since
- Apr 7, 2026
More from alirezarezvani/claude-skills
All 121- agile-product-ownerv2.14.5
- andreessenv2.14.6
- apple-hig-expertv2.14.5
- arquiteto-de-empresav2.14.5
- autoresearch-agentv2.14.11
- behumanv2.14.6
- book-to-skillv2.14.6
- business-growth-skillsv2.14.14
- business-investment-advisorv2.14.5
- business-operations-skillsv2.14.6
- c-level-agentsv2.14.18
- c-level-skillsv2.14.18
- capture-skillv2.14.5
- cavemanv2.14.9
- chaos-engineeringv2.14.5
- chief-ai-officer-advisorv2.14.18
- chief-customer-officer-advisorv2.14.5
- chief-data-officer-advisorv2.14.5
- cinematic-shot-promptingv2.14.13
- cloud-finopsv2.14.14
- cmmc-readinessv2.14.5
- code-to-prdv2.14.5
- code-tourv2.14.5
- coding-agent-rolloutv2.14.8
Similar to agenthub
More Agent Workflow & PlanningagenthubSkillalirezarezvani/claude-skills609 installsParallel agents compete on one task in git worktrees, and the best branch is merged.
spawnSkillalirezarezvani/claude-skills1.4K installsLaunches N parallel subagents in isolated git worktrees to compete on one session task.
AgentMCP serverrinadelph1.3K starsMulti-agent orchestration, task delegation, and shared project memory exposed through MCP tools.
voltagent-metaPluginVoltAgent/awesome-claude-code-subagents26.8K starsAgent coordination and meta-programming - multi-agent orchestration, workflow automation, and safe refactor governance. Works best with other voltagent plugins
agent-orchestrationPluginwshobson/agents42.9K starsMulti-agent system optimization, agent improvement workflows, and context management