Skip to content

alchaincyf/huashu-skills / huashu-agent-swarm

huashu-agent-swarm

Verified

多Agent蜂群并行协作,纯git自组织,适合大型项目开发。当用户提到"蜂群模式"、"多agent"、"并行开发"、"agent swarm"时使用。

FileKindSize
SKILL.mdskill md3.6 KB
references/agent-prompt-template.mdmarkdown4.1 KB
references/carlini-lessons.mdmarkdown3.3 KB
scripts/agent_loop.shexecutablescript2.8 KB
scripts/dashboard.pyexecutablescript20.6 KB
scripts/send_input.shexecutablescript1.0 KB
scripts/setup_project.shexecutablescript2.7 KB
scripts/start_swarm.shexecutablescript3.3 KB
scripts/status.shexecutablescript2.7 KB
scripts/stop_swarm.shexecutablescript2.3 KB

references/carlini-lessons.md

View on GitHub
# Carlini实验经验教训

> Nicholas Carlini用16个Claude实例自主构建了一个C编译器。
> 以下是从他的实验中提炼的关键经验。

## 核心发现

### 1. Git是最好的协调机制

不需要复杂的消息队列或中央调度器。Git本身就是:
- 状态同步工具(pull/push)
- 冲突检测器(merge conflict)
- 进度记录器(git log)
- 任务追踪器(通过约定的文件结构)

### 2. Agent需要清晰的「自我认知」

AGENT_PROMPT.md必须告诉agent:
- 你是谁(多个并行agent之一)
- 你的工作方式(认领-执行-提交循环)
- 如何与其他agent协调(通过git,不是通过对话)
- 什么时候停下来(任务完成/遇到阻塞)

### 3. 小粒度Commit是关键

Carlini发现,让agent做大量改动再一次性提交会导致:
- 合并冲突概率剧增
- 其他agent无法及时获取进展
- 出错时难以回滚

正确做法:每完成一个有意义的步骤就commit+push。

### 4. Lock文件机制足够用

不需要数据库或分布式锁服务:
- 创建文件 = 认领任务
- 删除文件 = 释放任务
- Git commit = 广播给所有人
- 偶尔的冲突可以接受(两个agent同时认领同一任务,后push的会失败)

### 5. Agent会自发分工

给8个agent同样的prompt,它们会:
- 自然地选择不同的任务
- 发现并填补空缺
- 甚至自发地添加新任务到TASKS.md

不需要人工分配,只需要一个好的任务清单。

## 常见问题和解决方案

### 问题:Agent陷入循环做无用功

**症状**:agent反复修改同一个文件,没有实质进展
**原因**:任务描述不清晰,或agent不知道「完成」的标准
**解决**:在AGENT_PROMPT中明确定义每个任务的验收标准(通常是测试通过)

### 问题:合并冲突频繁

**症状**:多个agent频繁修改同一个文件
**原因**:任务粒度太粗,或文件职责不清
**解决**:
- 拆分大文件为小模块
- 在TASKS.md中标注文件所有权
- 鼓励agent先创建新文件,再集成

### 问题:Agent做了不该做的事

**症状**:agent修改了配置文件、删除了重要代码
**原因**:AGENT_PROMPT没有明确禁止
**解决**:在AGENT_PROMPT中添加「禁止」清单

### 问题:API限流

**症状**:agent报错rate limit
**原因**:太多agent同时请求
**解决**:
- 增加sleep间隔
- 减少agent数量
- 使用不同的API key(如果有多个)

### 问题:Worktree磁盘空间

**症状**:磁盘空间不足
**原因**:worktree虽然共享.git对象,但工作文件是独立的
**解决**:stop_swarm.sh会自动清理;大项目减少agent数量

## 最佳实践

1. **先小规模测试**:用2个agent测试,确认流程正常再扩展
2. **任务要具体**:「实现用户登录」比「完善认证系统」更好
3. **测试是锚点**:有测试的项目,agent更容易判断自己的改动是否正确
4. **日志要看**:定期检查agent_logs,发现问题早期干预
5. **主分支要干净**:agent在自己的分支工作,合并到main时检查

## 适用场景

### 非常适合
- 功能明确、可并行的开发任务
- 有完善测试的项目
- 模块化架构的代码库

### 不太适合
- 需要大量讨论和决策的架构设计
- 高度耦合的代码修改
- 需要人类审查每一步的敏感操作
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall