spawn
它能做什么
这项技能为已经设置好的会话启动并行智能体。适合希望每个智能体在同一任务上尝试不同策略的人。
适用场景
- ✓当会话已设置完成、智能体准备开始工作的时候。
- ✓当你希望每个智能体在同一任务上尝试不同策略的时候。
- ✓当你希望智能体遵循优化器、重构器、测试编写者或错误修复者的模式时。
技能链接
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/agenthub/skills/spawn/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请使用重构器模板,为最近一次会话启动智能体。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会加载会话设置,并为每个工作树用派发提示启动一个智能体。选择模板后,它会采用该模板的模式,并让每个智能体使用不同的策略。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
/agenthub:spawn — Launch Parallel Agents
Spawn N subagents that work on the same task in parallel, each in an isolated git worktree.
Usage
/agenthub:spawn # Spawn agents for the latest session
/agenthub:spawn 20260317-143022 # Spawn agents for a specific session
/agenthub:spawn --template optimizer # Use optimizer template for dispatch prompts
/agenthub:spawn --template refactorer # Use refactorer template
Templates
When --template <name> is provided, use the dispatch prompt from ../agenthub/references/agent-templates.md instead of the default prompt below. Available templates:
| Template | Pattern | Use Case |
|---|---|---|
optimizer |
Edit → eval → keep/discard → repeat x10 | Performance, latency, size reduction |
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 with competing approaches |
When using a template, replace all {variables} with values from the session config. Assign each agent a different strategy appropriate to the template and task — diverse strategies maximize the value of parallel exploration.
What It Does
- Load session config from
.agenthub/sessions/{session-id}/config.yaml - For each agent 1..N:
- Write task assignment to
.agenthub/board/dispatch/ - Build agent prompt with task, constraints, and board write instructions
- Write task assignment to
- Launch ALL agents in a single message with multiple Agent tool calls:
Agent(
prompt: "You are agent-{i} in hub session {session-id}.
Your task: {task}
Read your full assignment at .agenthub/board/dispatch/{seq}-agent-{i}.md
Instructions:
1. Work in your worktree — make changes, run tests, iterate
2. Commit all changes with descriptive messages
3. Write your result summary to .agenthub/board/results/agent-{i}-result.md
Include: approach taken, files changed, metric if available, confidence level
4. Exit when done
Constraints:
- Do NOT read or modify other agents' work
- Do NOT access .agenthub/board/results/ for other agents
- Commit early and often with descriptive messages
- If you hit a dead end, commit what you have and explain in your result",
isolation: "worktree"
)
- Update session state to
runningvia:
python {skill_path}/scripts/session_manager.py --update {session-id} --state running
Critical Rules
- All agents in ONE message — spawn all Agent tool calls simultaneously for true parallelism
- isolation: "worktree" is mandatory — each agent needs its own filesystem
- Never modify session config after spawn — agents rely on stable configuration
- Each agent gets a unique board post — dispatch posts are numbered sequentially
After Spawn
Tell the user:
- {N} agents launched in parallel
- Each working in an isolated worktree
- Monitor with
/hub-status - Evaluate when done with
/agenthub:eval
常见问题
为什么每个智能体都要使用不同的策略?
不同策略能并行探索更多方案,使最终比较更有价值。
智能体在哪里工作?
每个智能体都在自己独立的 git 工作树中工作。
我能使用哪些模板?
优化器、重构器、测试编写者和错误修复者。
详情
作者的原始描述
Use to launch the competing agents for an initialized AgentHub session in isolated worktrees.
热度
- GitHub 星标
- 29k
- 排名
- #9535
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-launcher-orchestrator
29k帮你的智能体从一个清晰的目标出发,逐步规划、构建、测试并定时运行你自己账户中的 Claude 托管智能体。
grade-iterate
29k让你的智能体按评分标准为托管 AI 智能体的工作打分,并在固定的轮次内改进,因此它永远不会无限循环。
interview
29k让你的智能体就一个 AI 智能体的想法对你进行访谈,并在任何上线之前,把你的回答整理成一份简单的构建计划。
run-without-you
29k帮你的智能体设置托管 AI 智能体,使其按计划或在某个事件发生时运行,并在启动前检查定时设置。