/swarmesh:swarm-vote runs instead · from swarmesh
Runs isolated multi-AI voting with LLM consensus analysis. Dispatches ask/list/report/next-round/cancel subcommands. Use for independent opinions, multi-round debate, or avoiding groupthink.
This skill never runs in Claude Code
It ships in swarmesh at skills/, but /swarmesh:swarm-vote (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
各 CLI 独立作答、互不可见,LLM 综合生成共识/分歧/立场/建议决策四段。
# Locate swarmesh plugin root (优先 $SWARM_ROOT env)
if [[ -z "${SWARM_ROOT:-}" || ! -d "$SWARM_ROOT/scripts" ]]; then
SWARM_ROOT=$(find "$HOME/.codex/plugins/cache" -type d -name scripts 2>/dev/null \
| grep -E '/swarmesh/[^/]+/scripts$' | head -1 | sed 's|/scripts$||')
fi
[[ -n "${SWARM_ROOT:-}" && -d "$SWARM_ROOT/scripts" ]] || { echo "⚠ 未找到 swarmesh plugin root,请 export SWARM_ROOT=/path/to/swarmesh"; exit 1; }
不要让 LLM 自由判断。先用 bash 按第一个 token 硬路由:
# 参数解析:$1 = 第一个 token,$2+ = 剩余参数
_FIRST="${1:-}"
case "$_FIRST" in
"" | list)
"$SWARM_ROOT/scripts/lib/discuss-vote.sh" list
exit $?
;;
report | collect | next-round | cancel)
_ID="${2:-}"
[[ -n "$_ID" ]] || { echo "⚠ $_FIRST 需要 vote-id 作为第 2 个参数"; exit 1; }
"$SWARM_ROOT/scripts/lib/discuss-vote.sh" "$_FIRST" --id "$_ID"
exit $?
;;
*)
# 其他文本视作问题正文,走 ask 流程(见 §3)
_QUESTION="$*"
;;
esac
dispatch 表:
| 第一个 token | 行为 |
|---|---|
空 / list | list 列历史 |
report <id> | report --id <id> |
collect <id> | collect --id <id> |
next-round <id> | next-round --id <id>(多轮辩论) |
cancel <id> | cancel --id <id> |
| 其他任何文本 | 作为"问题"走 §3 ask |
示例:
$swarm-vote # 列历史
$swarm-vote list # 列历史(显式)
$swarm-vote report vote-xxx-abc # 看报告
$swarm-vote next-round vote-xxx-abc # 下一轮
$swarm-vote cancel vote-xxx-abc # 取消
$swarm-vote "Redis vs Dynamo?" # 发起新投票
MODE=$(jq -r '.mode' .swarm/runtime/state.json)
[[ "$MODE" == "discuss" ]] || { echo "⚠️ 必须先 \$swarm-chat 启动"; exit 1; }
jq -r '.discuss.participants | length' .swarm/runtime/state.json # >= 2
VOTE_ID=$("$SWARM_ROOT/scripts/lib/discuss-vote.sh" ask \
--question "<问题正文>" \
[--participants cx,cl,gm] \
[--timeout 180] \
[--min-responses 2] \
[--rounds 3] \
[--files 'src/**/*.go:L10-L50,README.md'] \
[--auto-promote full-stack] | tail -1)
后台每 5 秒 collect。v0.3-A 起用"hash 不变 + 命中提示符"连续 N 次稳定判定。所有人答完或超时自动出 report.md。
cat .swarm/runtime/discuss/votes/$VOTE_ID/report.md
或主动出最新版:
"$SWARM_ROOT/scripts/lib/discuss-vote.sh" report --id $VOTE_ID
--rounds N + next-round 子命令,每轮看上轮立场修正(v0.5.2)| Env | 默认 | 说明 |
|---|---|---|
VOTE_STABLE_HITS | 2 | 稳定性判定次数 |
VOTE_LLM_COMPRESS_THRESHOLD | 150000 | pane 字符超此值触发压缩 |
VOTE_LLM_EXTRACT_PARALLEL | pending 人数 | LLM extract 并发度 |
VOTE_LLM_EXTRACT_MAX | 10 | 并发硬上限 |
# 代码评审型投票
$swarm-vote --files 'scripts/lib/*.sh:L1-L100,docs/ARCHITECTURE.md' \
"这些代码该不该重构?"
# 多轮辩论
ID=$($swarm-vote --rounds 3 --question "方案 A vs B?")
$swarm-vote collect $ID
$swarm-vote report $ID
$swarm-vote next-round $ID
# ... 重复直到最终轮
# 全自动闭环
$swarm-vote --auto-promote full-stack "下一步做什么?"
# → 投票 → LLM 综合 → 建议决策 → 自动 brief → 切 execute → supervisor 开工
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub soein/swarmesh --plugin swarmesh13 skills in this plugin
/swarm-chatStart a discuss-mode roundtable with multiple AI CLIs (Codex/Claude/Gemini) in a single tmux session. Use when user asks to "discuss X with multiple AIs", "start a roundtable", "brainstorm with other CLIs", "start multi-AI conversation", or mentions "discuss 模式" / "圆桌讨论" / "多 AI 讨论"./swarm-chat-addAdd a new AI CLI participant to an ongoing discuss-mode roundtable. Use when user asks to "add another AI", "bring in claude/gemini/codex", "add participant to discussion", or mentions "加入讨论" / "加参与者"./swarm-chat-listList current participants of the discuss-mode roundtable (show who can be @-mentioned). Use when user asks "who's in the discussion", "list participants", "who can I @", "看下有谁", "列出参与者".Other plugins' skills for the same job