From swarmesh
Dispatches isolated multi-AI voting with LLM consensus analysis for independent judgments, avoiding groupthink. Handles ask/list/report/next-round/cancel subcommands, multi-round debates, and file context injection. Useful for 'vote on X' or consensus requests.
npx claudepluginhub soein/swarmesh --plugin swarmeshThis skill uses the workspace's default tool permissions.
各 CLI 独立作答、互不可见,LLM 综合生成共识/分歧/立场/建议决策四段。
Spawns parallel subagents as judges for multi-model consensus on validation, research, brainstorming, or any task. Supports quick inline checks, deep reviews, debates, mixed vendors, and presets.
Facilitates leaderless consensus among distributed agents via bee-inspired scouting, quorum sensing, threshold voting, and commitment dynamics. For multi-agent AI, distributed databases, or group decisions without central authority.
Orchestrates dynamic agent teams for iterative peer-to-peer debates on decisions, producing tradeoff maps via step-back moderation and contention analysis.
Share bugs, ideas, or general feedback.
各 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 开工