convez.ai
SkillAutomaçãoAvançado
costrict-plugins-repo

AgentHub — Colaboração Multi-Agent para Claude Code

costrict-plugins-repo/alirezarezvani-claude-code-skills-agenthub

Múltiplos agentes competem em paralelo; melhor solução vence e é mergeada.

Ver no GitHub
InicialPluginScore · de 0 a 100

Skill que spawna N agentes paralelos em worktrees Git isoladas para competir na mesma tarefa, avalia resultados por métrica ou juiz LLM e mescla o vencedor. Transforma otimização, refatoração, geração de conteúdo e problemas de design em um torneio onde a melhor solução vence.

Instalação

$npx convez-ai costrict-plugins-repo/alirezarezvani-claude-code-skills-agenthub

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
37%
Último commit
há 1 semana
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Otimização de performance e redução de latência em múltiplas estratégias
  • Refatoração de código competitiva com iteração automática
  • Geração e melhoria de conteúdo por diversos agentes simultaneamente

Veredito

Skill robusta para problemas de otimização em lote. Requer git, Python e avaliação métrica bem definida; o padrão optimizer com iteração embedded é a força principal. Ideal para times que precisam explorar múltiplas estratégias em paralelo.

README

A tradução para o português deste README ainda está na fila.

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

# 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
/hub:spawn --template optimizer

# 3. Check progress
/hub:status

# 4. Evaluate — rank agents by metric
/hub:eval

# 5. Merge the winner into your branch
/hub:merge

Commands Reference

CommandPurposeExample
/hub:initCreate session with task, agents, eval criteria/hub:init --task "Optimize DB queries" --agents 4 --eval "python bench.py" --metric query_ms --direction lower
/hub:spawnLaunch all agents in parallel worktrees/hub:spawn (uses latest session)
/hub:statusShow DAG state, branches, progress posts/hub:status
/hub:evalRank results by metric or LLM judge/hub:eval --judge (LLM judge mode)
/hub:mergeMerge winner, archive losers, cleanup/hub:merge --agent agent-2 (force pick)
/hub:boardRead/write the message board/hub:board --read progress
/hub:runOne-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 /hub:spawn or /hub:run:

TemplatePatternUse Case
optimizerEdit → eval → keep/discard → repeat x10Performance, latency, size reduction, content quality, research depth
refactorerRestructure → test → iterate until greenCode quality, tech debt, document restructuring
test-writerWrite tests → measure coverage → repeatTest coverage gaps
bug-fixerReproduce → diagnose → fix → verifyBug 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:

  1. Captures baseline (e.g., p50_ms = 180ms)
  2. Assigns diverse strategies (caching, algorithm, I/O batching)
  3. Spawns 3 agents — each iterates up to 10 times in its worktree
  4. Agents commit improvements, revert failures, post progress to the board
  5. Evaluates final metrics across all agents
  6. 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

  1. 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.

  2. Spawn — The coordinator writes dispatch posts to .agenthub/board/dispatch/ with strategy-specific instructions for each agent. Each agent is launched with isolation: "worktree" so it works on an isolated copy of the repo. When a template is used, the dispatch prompt contains the full iteration loop.

  3. 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.

  4. Evaluate — Runs result_ranker.py which checks out each agent's final branch, runs the eval command, extracts the metric, and produces a ranked table with deltas from baseline.

  5. 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

ScriptPurposeExample
hub_init.pyCreate session directory and configpython scripts/hub_init.py --task "Optimize queries" --agents 3 --eval "python bench.py" --metric query_ms --direction lower
board_manager.pyMessage board CRUD (dispatch, progress, results)python scripts/board_manager.py --post --channel progress --author agent-1 --message "Iteration 3: p50=145ms"
session_manager.pySession state machine (init→running→evaluating→merged)python scripts/session_manager.py --list
dag_analyzer.pyGit DAG analysis — frontier detection, branch statuspython scripts/dag_analyzer.py --status --session 20260317-143022
result_ranker.pyEvaluate and rank agent results by metric or diffpython 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:

ChannelDirectionPurpose
dispatchcoordinator → agentsTask assignments and strategy prompts
progressagents → coordinatorStatus updates, iteration results
resultsbidirectionalFinal 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

Ver o original no GitHub

Bom para

Relacionados