本地运行的 AI 代理群组系统,由 Zoe 协调器管理。
┌─────────────┐
│ Zoe │ ← 主协调器 (任务分析、模型选择、prompt 生成)
└──────┬──────┘
│
├─────────────┬─────────────┐
▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐
│Claude │ │Gemini │ │ ... │ ← 专业 Agent
└───┬───┘ └───┬───┘ └───┬───┘
│ │ │
└─────────────┴─────────────┘
│
┌─────────────▼─────────────┐
│ tmux sessions + logs │
└─────────────┬─────────────┘
│
┌─────────────▼─────────────┐
│ GitHub PR + CI/CD │
└─────────────┬─────────────┘
│
┌─────────────▼─────────────┐
│ Auto Review (3 models) │
└───────────────────────────┘
~/clawdbot/
├── active-tasks.json # 任务注册表
├── README.md # 本文件
├── scripts/
│ ├── spawn-agent.sh # 启动 Agent
│ ├── check-agents.sh # 监控循环 (每 10 分钟)
│ ├── review-pr.sh # PR 审查
│ ├── zoe.sh # Zoe 协调器
│ ├── cleanup.sh # 清理脚本 (每日)
│ ├── notify.sh # 通知发送 (Telegram/Discord/Slack)
│ ├── setup-cron.sh # 配置定时任务
│ ├── remove-cron.sh # 移除定时任务
│ └── auth/ # 认证模块
│ ├── db.sh # 数据库管理
│ ├── user.sh # 用户 CRUD 操作
│ └── test/ # 认证测试
├── prompts/
│ ├── zoe-scoping.md # Zoe 任务分解模板
│ ├── codex-reviewer.md # Claude 审查模板
│ └── gemini-reviewer.md # Gemini 审查模板
├── logs/ # Agent 日志
└── worktrees/ # Git worktrees
~/clawdbot/scripts/zoe.sh "添加用户登录功能"~/clawdbot/scripts/spawn-agent.sh "my-task" "claude" "实现 JWT 认证..."# 查看活跃任务
jq '.tasks[] | select(.status == "running")' ~/clawdbot/active-tasks.json
# 查看 tmux 会话
tmux list-sessions | grep -E "(claude|gemini)-"
# 查看日志
tail -f ~/clawdbot/logs/task-*.log~/clawdbot/scripts/check-agents.sh- 任务接收 → Zoe 分析任务,选择合适 Agent
- 启动 Agent → 创建 worktree + tmux 会话
- 开发 → Agent 编写代码、提交
- PR 创建 → Agent 自动创建 PR
- CI 运行 → GitHub Actions 自动测试
- 自动审查 → Claude + Gemini 审查代码
- 通知 → PR 就绪,等待人工合并
- 清理 → 每日清理旧任务
# 配置定时任务(一键设置)
~/clawdbot/scripts/setup-cron.sh
# 查看已配置的 cron
crontab -l | grep clawdbot
# 移除定时任务
~/clawdbot/scripts/remove-cron.sh
# 定时任务说明:
# */10 * * * * ~/clawdbot/scripts/check-agents.sh # 每10分钟监控
# 0 3 * * * ~/clawdbot/scripts/cleanup.sh # 每日凌晨3点清理编辑 ~/clawdbot/.env,配置你想要的通知渠道:
# Telegram 通知
TELEGRAM_BOT_TOKEN="your-bot-token"
TELEGRAM_CHAT_ID="your-chat-id"
# Discord 通知
DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/xxx/xxx"
# Slack 通知
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/xxx/xxx/xxx"通知类型:
pr_ready- PR 就绪,等待人工合并ci_failed- CI 测试失败merged- PR 已合并crashed- Agent 崩溃
手动发送通知:
~/clawdbot/scripts/notify.sh pr_ready task-xxx 123 "https://github.com/xxx/pull/123" "Ready for review"编辑 ~/clawdbot/active-tasks.json:
{
"config": {
"maxRetries": 3, # 最大重试次数
"checkIntervalMinutes": 10, # 监控间隔
"agents": {
"claude": { "model": "claude-opus-4-5-20251029" },
"gemini": { "model": "gemini-2.5-pro" }
}
}
}# 查看 tmux 会话
tmux attach -t claude-my-task
# 发送指令
tmux send-keys -t claude-my-task "Stop. Focus on the API layer." Enter
# 或重启
tmux kill-session -t claude-my-task
~/clawdbot/scripts/spawn-agent.sh "my-task" "claude" "新 prompt"# 实时查看
tail -f ~/clawdbot/logs/task-*.log
# 搜索错误
grep -r "ERROR" ~/clawdbot/logs/# 手动更新状态
jq '.tasks[] |= if .id == "my-task" then .status = "failed" else . end' \
~/clawdbot/active-tasks.json > tmp.json && mv tmp.json ~/clawdbot/active-tasks.json- 任务分解 - 大任务拆成小任务,每个任务专注一个功能
- 明确 Prompt - 包含具体文件路径、预期输出、约束条件
- 及时审查 - PR 就绪后尽快 review,避免 Agent 等待
- 定期清理 - cleanup.sh 每天运行,保持系统整洁
- 日志归档 - 重要任务的日志定期备份
添加新 Agent 类型:
- 在
active-tasks.json添加配置 - 在
spawn-agent.sh添加启动逻辑 - 在
zoe.sh更新选择逻辑
- 逻辑修复: 修复了任务协调逻辑中的重复执行问题,优化了Zoe协调器的agent选择算法
生产力统计 (参考):
- 日均提交:50+ commits
- PR 创建速度:7 PRs / 30 分钟
- 自动化率:90%+ 小中型任务一键完成