AGENT SKILL

多智能体并行协作

agenthub

多智能体协作插件,通过 git worktree 隔离生成 N 个并行子智能体,让它们在同一任务上相互竞争。各智能体独立工作,结果由指标或 LLM 评审进行评估,随后合并最佳分支。适用场景:用户希望并行尝试多种方法——代码优化、内容变体、研究探索,或任何受益于并行竞争的任务。要求:一个 git 仓库。

适用职业AI 工程师
使用场景编码任务委派
License 许可
MIT
最近更新
2026-10-28
Stars
★ 0
Forks
0

01 前言 Front Matter

name
agenthub
license
MIT
metadata
{ "author": "Alireza Rezvani", "updated": 1773705600000, "version": "2.1.2", "category": "engineering" }
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.

02 资源文件 9

03 SKILL.md 正文

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

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)

04 同仓库更多 Skills

mne20114-hash
mne20114-hash/gest35bi

课程大纲阅读清单生成

syllabus

使用 Consensus 学术搜索从任意课程大纲生成精选的补充阅读清单。在任何搜索运行之前,进行'拷问式'信息收集(syllabus 输入格式 + 课程受众 + 年份范围)以及分组强制选项检查点——以确保阅读清单匹配课程的层次和时效性需求。解析大纲以提取主题和学习成果,针对每个主题在 Consensus 中搜索近期同行评审论文,并生成专业排版的 .docx 文档,包含可点击的 Consensus 链接、按受众层次校准的通俗语言摘要,以及与课程学习目标关联的布鲁姆(Bloom)高阶层次讨论问题。当用户上传课程大纲、课程概要或课程文档并希望获得补充阅读材料时使用(例如'create a reading list from this syllabus'、'find recent papers for my course')——即使是附带大纲的随意提及也应触发此技能。

教师学习引导
★ 0
mne20114-hash
mne20114-hash/gest35bi

话题动态多源调研

pulse

多源近期研究技能,可在可配置的近期时间窗口(默认 30 天)内,跨 Reddit、Hacker News、开放网络以及可选的 X/Twitter 把握任意话题的动态。强制信息收集(intake)会在搜索前明确话题的具体性、角度(趋势/情绪/问题/机会/对比)、时间窗口和平台范围。返回一份综合简报,包含引用来源、互动指标和跨平台模式分析。当用户请求对某话题进行多源近期情报调研时使用(例如'pulse on [topic]'、'what's happening with [topic]'、'what are people saying about [topic]'、'current conversation about [topic]'、'take the pulse of [topic]'、'trending: [topic]'、'find me info on [topic]'),也适用于竞品研究、趋势发现、工具对比和受众情绪分析。

营销专员网页搜索与信息研究
★ 0
mne20114-hash
mne20114-hash/gest35bi

专利现有技术检索分析

patent

专利现有技术检索与专利景观情报技能——并非通用专利助手。在任何检索运行之前,通过强制问询确定五种子用例之一(新颖性检索 / 自由实施 FTO / 竞争景观 / 收购尽调 / 诉讼现有技术)。检索 Google Patents、Espacenet、USPTO,并可选检索 Lens.org 以获取引文图谱信号。输出为可编辑的 Word 文档(.docx),包含结论、按相关度排序的最接近现有技术(附提取的权利要求文本)、考虑 CPC 分类的景观分析、经家族解析的命中结果、地域覆盖、适用时的 FTO 标记、策略建议以及完整审计日志。当用户要求进行专利检索或分析时使用(例如“针对 [invention] 的现有技术检索”“针对 [product] 的自由实施分析”)。产出的是检索信号而非法律建议——在提交申请或许可决策前始终建议咨询专利律师。商标、版权和商业秘密问题不在范围内。

法务专员网页搜索与信息研究
★ 0
mne20114-hash
mne20114-hash/gest35bi

NotebookLM 笔记本自动化管理

notebooklm

用于控制 Google NotebookLM 的浏览器自动化技能。当用户希望在 NotebookLM 中完成任何操作时使用(例如“打开 NotebookLM”“查看我的 [name] 笔记本”“向我的笔记本询问 X”“将 [source] 添加到 NotebookLM”“从我的笔记本生成视频概览”“使用 NotebookLM Studio”)。可处理读取与查询笔记本、添加来源(URL、文本、文件、YouTube 链接、合成内容)、生成 Studio 输出(音频/视频概览、思维导图、报告,包括简报文档/学习指南/FAQ、抽认卡、测验、幻灯片、信息图——需从实时 Studio 面板发现确切的输出集合;其 UI 迭代很快),以及创建新笔记本。需要浏览器自动化环境——不可用时优雅降级。

知识工作者浏览器自动化与网页交互
★ 0
mne20114-hash
mne20114-hash/gest35bi

学术文献综述指南

litreview

学术文献导向技能,默认通过免费、无需密钥的API(PubMed E-utilities + OpenAlex)检索论文——连接后可将Consensus MCP作为可选的增强通道——使用PICO(默认)或SPIDER / Decomposition / hybrid作为后备来构建战略检索计划,并将发现综合成格式化的Word(.docx)研究指南。在侦察性检索(recon search)前进行Grill-me式信息收集(研究问题的具体程度+框架提示+初步深度);在Phase 2之后设置第二个强制检查点,先确认框架+子领域+深度,再让检索消耗预算。可配置的深度(5/10/20次查询)用于控制覆盖面与速度。输出是一个'起点'(launching pad)——让研究者能自信地深入展开的方向性指南,而非已完成的综述。当用户开始文献导向的研究时使用(例如'litreview on [topic]'、'literature review on [topic]'、'I'm starting a literature review on X'、'I'm writing a paper on X'、'help me research X'、'I'm doing research on X'、'can you help me research X')。不要用于只想快速获得列表的单个一次性论文检索——那属于普通的PubMed/OpenAlex(或Consensus)查询。

学术研究员科研论文写作
★ 0
mne20114-hash
mne20114-hash/gest35bi

NIH科研基金申请

grants

面向临床研究人员的NIH科研基金申请技能。Grill-me式信息收集(研究想法+职业阶段+初步数据+研究环境+提交姿态+已知的目标研究所)会在任何检索开始前锁定资助策略。运行5个维度的Consensus定位分析(含起草的Significance/Innovation措辞),通过RePORTER将研究映射到合适的NIH研究所(institutes)与研究部门(study sections),查找NOSIs及已获资助的重叠项目,并生成可编辑的Word文档(.docx),包含考虑预算与范围的机制推荐、提交时间线以及必须给出的项目官员(program officer)推荐。当用户询问研究资助或提出任何与基金申请相关的请求时使用(例如'[某主题]的基金'、'为我的研究想法找基金'、'哪些基金与我的研究匹配'、'帮我找NIH资助'、'我研究的基金机会')。仅限NIH范围——非NIH资助方(PCORI、DOD CDMRP、VA、基金会)不在范围内,并会在信息收集(intake)时予以提示。

生物医学研究员科研基金申请撰写
★ 0