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

scripts/stop_swarm.sh

View on GitHub
#!/bin/bash
# stop_swarm.sh - 停止所有Agent并清理worktrees
# 用法: bash stop_swarm.sh [项目目录]

PROJECT_DIR="${1:-.}"
PROJECT_DIR="$(cd "$PROJECT_DIR" && pwd)"
PROJECT_NAME="$(basename "$PROJECT_DIR")"
SESSION="swarm-${PROJECT_NAME}"

echo "=== 停止蜂群: $SESSION ==="

# ===== 停止tmux session =====
if tmux has-session -t "$SESSION" 2>/dev/null; then
    tmux kill-session -t "$SESSION"
    echo "tmux session 已停止"
else
    echo "tmux session 不存在(可能已停止)"
fi

# ===== 合并agent分支的成果到main =====
echo ""
echo "检查agent分支的未合并提交..."
cd "$PROJECT_DIR"
MAIN_BRANCH=$(git branch --show-current 2>/dev/null || echo "main")

for dir in "${PROJECT_DIR}"-agent-*; do
    [ -d "$dir" ] || continue
    AGENT_NUM=$(echo "$dir" | grep -o '[0-9]*$')
    BRANCH_NAME="agent-${AGENT_NUM}-work"

    # 检查分支是否有未合并的提交
    AHEAD=$(git log "${MAIN_BRANCH}..${BRANCH_NAME}" --oneline 2>/dev/null | wc -l | tr -d ' ')
    if [ "$AHEAD" -gt 0 ]; then
        echo "  Agent-${AGENT_NUM}: 有 ${AHEAD} 个未合并提交"
        echo "  合并 ${BRANCH_NAME} → ${MAIN_BRANCH}..."
        git merge "$BRANCH_NAME" --no-edit 2>/dev/null || {
            echo "  警告: 合并冲突,请手动解决"
            echo "  运行: git merge $BRANCH_NAME"
        }
    fi
done

# ===== 清理worktrees =====
echo ""
echo "清理 worktrees..."
for dir in "${PROJECT_DIR}"-agent-*; do
    if [ -d "$dir" ]; then
        AGENT_NUM=$(echo "$dir" | grep -o '[0-9]*$')
        git -C "$PROJECT_DIR" worktree remove "$dir" --force 2>/dev/null || {
            echo "  警告: 无法清理 $dir,尝试强制删除..."
            rm -rf "$dir"
            git -C "$PROJECT_DIR" worktree prune
        }
        echo "  Agent-${AGENT_NUM}: worktree 已清理"

        # 删除agent分支
        BRANCH_NAME="agent-${AGENT_NUM}-work"
        git -C "$PROJECT_DIR" branch -D "$BRANCH_NAME" 2>/dev/null || true
    fi
done

git -C "$PROJECT_DIR" worktree prune 2>/dev/null

# ===== 清理lock文件 =====
echo ""
echo "清理 lock 文件..."
rm -f "$PROJECT_DIR/current_tasks/"*.lock 2>/dev/null
echo "lock 文件已清理"

echo ""
echo "=== 蜂群已完全停止 ==="
echo ""
echo "查看成果:"
echo "  git -C $PROJECT_DIR log --oneline -20"
echo ""
echo "日志在: $PROJECT_DIR/agent_logs/"
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