使用git worktrees为并行子协调器生成和管理tmux会话。当各部分准备好执行时使用。
View on GitHubblueif16/amazing-claude-code-plugins
infistack
infistack/skills/execution-manager/SKILL.md
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/blueif16/amazing-claude-code-plugins/blob/main/infistack/skills/execution-manager/SKILL.md -a claude-code --skill execution-managerInstallation paths:
.claude/skills/execution-manager/# 执行管理器
**所有者:** 仅主协调器
## 职责
1. 读取 meta.yaml 获取所有待执行部分
2. 为每个部分创建 git worktree
3. 为每个 worktree 生成 tmux 会话
4. 在每个会话中初始化子协调器,传递:
- section_path(部分目录路径,如 `docs/prds/reddit-bot/sections/auth`)
- 分支名称
- 工作空间路径
5. 生成后立即更新 meta.yaml 中的部分状态
6. 监控完成信号
7. 完成/失败时清理
## 重要约束
**主协调器代码修复规则:**
当需要修复主协调器(当前 agent 所在环境)中的代码时,**必须先询问人工**。
主协调器的职责范围:
- ✅ 协调和生成 tmux 会话
- ✅ 管理 git worktree
- ✅ 检查各部分进度
- ✅ 简洁地调用 skills
- ❌ 不应思考具体执行计划
- ❌ 不应直接修改业务代码
所有具体的执行计划和代码实现应由子协调器在各自的 tmux 会话中完成。
## 生成模式
```bash
# 读取 meta.yaml 获取项目信息
project_name=$(yq '.project' meta.yaml)
sections=$(yq '.sections | keys' meta.yaml)
# 对每个部分:
for section in $sections; do
branch="${project_name}/${section}"
section_path="docs/prds/${project_name}/sections/${section}"
# 创建 worktree
git worktree add ../worktrees/${section} -b ${branch}
# 创建 tmux 会话并初始化子协调器
tmux new-session -d -s ${section} -c ../worktrees/${section} \
claude "You are Sub Coordinator for ${section}. Read fix-engine skill. Task files in .task/ directory. Begin."
# 更新 meta.yaml 状态
yq -i ".sections.${section}.status = \"in_progress\"" meta.yaml
done
```
## 强制 Worktree 规则
所有部分必须在各自的 worktree 中执行,无例外。
生成前验证:
1. 验证 worktree 存在:`git worktree list | grep {section-id}`
2. 验证 tmux 会话在 worktree 中运行:`-c ../worktrees/{section-id}`
3. 永远不要在主仓库中为部分工作生成 Claude
## 监控循环 (REQUIRED)
生成所有会话后,**必须继续监控**。不要交给人工处理。
```bash
# 监控状态变量
all_done=false
check_interval=30 # 秒
while [ "$all_done" = false ]; do
echo "检查所有部分状态..."
completed_count=0
blocked_count=0
in_progress_count=0
total_sections=$(yq '.sections | length' meta.yaml)
# 检查每个部分的状态
for section in $(yq '.sections | keys | .[]' meta.yaml); do
status=$(yq ".sections.${section}.status" meta.yaml)
case "$status" in
completed)
((completed_count++))
echo "✅ $section: COMPLETE"
;;
blocked)
((blocked_count++))
echo "❌ $section: BLOCKED"
;;
in_progress)
((in_progress_count++))
#