跳到正文
Skillpedia
智能体29k · #9528

agenthub

它能做什么

这项技能让多个智能体在同一任务上相互竞争,每个都在你代码的独立副本中工作。适合希望比较不同方法并保留最佳结果的人。

适用场景

  • ✓当你希望同时尝试几种不同方法、并保留最好的一种的时候。
  • ✓当你想通过把任务拆分给并行智能体来加快速度的时候。
  • ✓当你想并排比较不同的文案或研究角度的时候。

技能链接

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/agenthub/skills/agenthub/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/alirezarezvani/claude-skills/blob/main/engineering/agenthub/skills/agenthub/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请同时尝试三种加快我们 API 的方法,并保留最快的那一种。”

每周 5 个新技能,1 分钟读完。

工作原理

协调者会建立一个会话,并在独立的 git 工作树中启动多个智能体。它会按可测量的指标或评委对结果排名,然后合并获胜者并归档其他结果。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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

-
常见问题

智能体会直接修改我的主代码吗?

不会。每个智能体都在自己独立的 git 工作树中工作,在合并获胜者之前,主分支不会改变。

获胜者如何选出?

通过 eval 命令得出的可测量指标,或由 LLM 评委比较差异的正确性和简洁性。

这些模板有什么用?

它们为提升速度、重构、编写测试或修复错误等工作提供可重复的模式。

详情

作者的原始描述

Use when a task should be attempted by several agents in parallel and the best result kept (code speed, copy variants, research angles). Spawns N agents in git worktrees, ranks results by metric or judge with result_ranker.py and merges the winner.

repo: alirezarezvani/claude-skills

热度

GitHub 星标
29k
排名
#9528
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能