npx claudepluginhub blueif16/amazing-claude-code-plugins --plugin infistackThis skill uses the workspace's default tool permissions.
**所有者:** 仅主协调器
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
所有者: 仅主协调器
docs/prds/reddit-bot/sections/auth)主协调器代码修复规则:
当需要修复主协调器(当前 agent 所在环境)中的代码时,必须先询问人工。
主协调器的职责范围:
所有具体的执行计划和代码实现应由子协调器在各自的 tmux 会话中完成。
# 读取 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 中执行,无例外。
生成前验证:
git worktree list | grep {section-id}-c ../worktrees/{section-id}生成所有会话后,必须继续监控。不要交给人工处理。
# 监控状态变量
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++))
# 检查 tmux 会话是否还在运行
if ! tmux has-session -t "$section" 2>/dev/null; then
echo "⚠️ $section: tmux 会话异常退出"
yq -i ".sections.${section}.status = \"blocked\"" meta.yaml
else
# 检查最近输出
last_output=$(tmux capture-pane -t "$section" -p | tail -20)
echo "🔄 $section: WORKING"
fi
;;
esac
done
# 检查是否所有部分都完成或阻塞
if [ $((completed_count + blocked_count)) -eq $total_sections ]; then
all_done=true
echo ""
echo "所有部分已完成或阻塞,准备合并..."
echo "- 已完成: $completed_count"
echo "- 已阻塞: $blocked_count"
echo ""
# 自动调用 merge-resolver
if [ $completed_count -gt 0 ]; then
echo "调用 merge-resolver 处理已完成的部分..."
# 这里 Claude 会调用 merge-resolver skill
# 人工只需在 merge-resolver 完成后看到最终报告
else
echo "没有已完成的部分可以合并"
echo "所有部分都被阻塞,需要人工干预"
fi
else
echo ""
echo "状态摘要: $completed_count 完成, $in_progress_count 进行中, $blocked_count 阻塞"
echo "等待 ${check_interval} 秒后再次检查..."
sleep $check_interval
fi
done
每 30-60 秒检查每个会话:
tmux send-keys 提供额外上下文tmux send-keys -t {section-id} "状态更新?" Enter
对问题做出反应:
tmux send-keys -t {section-id} "额外上下文:..." Enter
仅在以下情况停止监控:
不要只是生成后就离开。你负责监控循环直到所有部分完成并调用 merge-resolver。
当监控循环检测到所有部分都是 completed 或 blocked 状态时:
如果有任何 blocked 部分:
调用 merge-resolver:
completed 部分的列表merge-resolver 返回后:
只有在 merge-resolver 完成后才返回控制权给人工
execution-manager 的职责是完整的端到端执行管理:
不要:
人工只应看到:
定期检查 meta.yaml 中各部分的状态:
completed - 部分完成,等待所有部分完成后触发 merge-resolverblocked - 已升级到人工,暂停该部分in_progress - 继续监控同时监控 tmux 会话是否异常退出。
tmux kill-session -t {section-id}
git worktree remove ../worktrees/{section-id}
git branch -d {section-id} # 仅在合并后
# 列出所有工作会话
tmux ls
# 查看工作输出(最后50行,非阻塞)
tmux capture-pane -t {section-id} -p | tail -50
# 向工作会话发送后续指令
tmux send-keys -t {section-id} "Also handle edge case X" Enter
# 附加到会话实时观察(Ctrl+B D 分离)
tmux attach -t {section-id}
# 终止卡住的工作会话
tmux kill-session -t {section-id}
# 创建带新分支的 worktree
git worktree add ../worktrees/{section-id} -b {section-id}
# 列出所有 worktrees
git worktree list
# 删除 worktree(合并后)
git worktree remove ../worktrees/{section-id}
# 清理过期的 worktree 引用
git worktree prune
# 从主分支合并完成的部分
git merge {section-id} --no-ff -m "Merge {section-id}"