mcpField
D
debate

debate

github.com/agent-shAgent 工作流1.0k117 次安装2 天前更新
代码仓库

关于 debate

debate 是用于 Claude、Gemini、Codex、OpenCode 和 Copilot 等 AI 工具间开展多轮结构化辩论的技能。它组装强调证据的提示词、管理轮次上下文与失败情况,并整理裁决和可执行建议。

主要功能

  1. 01设置提案方与质询方
  2. 02配置轮数、思考强度和模型
  3. 03要求论点提供证据
  4. 04汇总后续轮次的上下文
  5. 05处理调用与解析失败
  6. 06生成结构化裁决

适用场景

  1. 01比较有竞争的技术方案
  2. 02用反方论点检验提案
  3. 03生成附有证据的建议

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/agent-sh/agentsys --skill debate

安装后在 Claude Code 中输入/debate确认已加载。

详细介绍

辩论

用于 AI 工具间结构化多轮辩论的提示词模板、上下文组装规则和综合总结格式。

参数

从 $ARGUMENTS 解析:

  • topic:辩论问题/主题(必填)
  • --proposer:提议方角色使用的工具(claude、gemini、codex、opencode、copilot)
  • --challenger:挑战方角色使用的工具(必须与提议方不同)
  • --rounds:来回辩论的轮数(1-5,默认:2)
  • --effort:应用于所有工具调用的思考投入程度(low、medium、high、max)
  • --model-proposer:提议方使用的特定模型(可选)
  • --model-challenger:挑战方使用的特定模型(可选)

通用规则

所有参与方(提议方和挑战方)都必须用具体证据(文件路径、代码模式、基准测试或有文档记录的行为)支持其主张。任一方的无依据主张都将被另一方指出,并在裁决中注明。此规则适用于每一轮。

提示词模板

第 1 轮:提议方开场
You are participating in a structured debate as the PROPOSER.

Topic: {topic}

Your job: Analyze this topic thoroughly and present your position. Take a clear stance. Do not hedge excessively.

You MUST support each claim with specific evidence (file path, code pattern, benchmark, or documented behavior). Unsupported claims will be challenged. "I think" or "generally speaking" without evidence is not acceptable.

Provide your analysis:
第 1 轮:挑战方回应
You are participating in a structured debate as the CHALLENGER.

Topic: {topic}

The PROPOSER ({proposer_tool}) argued:

---
{proposer_round1_response}
---

Your job: Find weaknesses, blind spots, and flaws in the proposer's argument. You MUST identify at least one genuine flaw or overlooked consideration before agreeing on anything. Propose concrete alternatives where you disagree.

Rules:
- Do NOT say "great point" or validate the proposer's reasoning before critiquing it
- Lead with what's WRONG or MISSING, then acknowledge what's right
- If you genuinely agree on a point, explain what RISK remains despite the agreement
- Propose at least one concrete alternative approach
- You MUST address at least these categories: correctness, security implications, and developer experience
- Do NOT agree with ANY claim unless you can cite specific evidence (file path, code pattern, or documented behavior) that supports the agreement. Unsupported agreement is not allowed.
- If the proposer makes a claim without evidence, call it out: "This claim is unsupported."

Provide your challenge:
第 2 轮及之后:提议方辩护
You are the PROPOSER in round {round} of a structured debate.

Topic: {topic}

{context_summary}

The CHALLENGER ({challenger_tool}) raised these points in round {previous_round}:

---
{challenger_previous_response}
---

Your job: Address each challenge directly. For each point:
- If they're right, concede explicitly and explain how your position evolves
- If they're wrong, explain why with specific evidence (file path, code pattern, benchmark, or documented behavior)
- If it's a tradeoff, acknowledge the tradeoff and explain why you still favor your approach with evidence

Every claim you make -- whether concession, rebuttal, or new argument -- MUST cite specific evidence. The challenger will reject unsupported claims.

Do NOT simply restate your original position. Your response must show you engaged with the specific challenges raised.

Provide your defense:
第 2 轮及之后:挑战方跟进
You are the CHALLENGER in round {round} of a structured debate.

Topic: {topic}

{context_summary}

The PROPOSER ({proposer_tool}) responded to your challenges:

---
{proposer_previous_response}
---

IMPORTANT: Do NOT let the proposer reframe your challenges as agreements. If they say "we actually agree" but haven't addressed the substance, reject it. Default to suspicion, not acceptance.

Your job: Evaluate the proposer's defense. For each point they addressed:
- Did they dodge, superficially address, or respond without evidence? Call it out: "This defense is unsupported" or "This dodges the original concern"
- Did they concede any point? Hold them to it -- they cannot walk it back later without new evidence
- Are there NEW weaknesses in their revised position?
- Did they adequately address your concern with specific evidence? Only then acknowledge it, and cite what convinced you

You MUST either identify at least one new weakness or unresolved concern, OR explicitly certify a previous concern as genuinely resolved with specific evidence for why you're now satisfied. "I'm convinced because [evidence]" is acceptable. "I agree now" without evidence is not.
If you see new problems, raise them.

Provide your follow-up:

上下文组装

第 1-2 轮:完整上下文

在提示词中包含此前所有交流的完整文本。上下文较小(通常总计少于 5000 个词元)。

上下文块格式:

Previous exchanges:

Round 1 - Proposer ({proposer_tool}):
{full response}

Round 1 - Challenger ({challenger_tool}):
{full response}
第 3 轮及之后:摘要上下文

从第 3 轮开始,将第 1 轮至第 N-2 轮的完整交流文本替换为摘要。仅完整包含最近一轮的回应。

格式:

Summary of rounds 1-{N-2}:
{summary of key positions, agreements, and open disagreements}

Round {N-1} - Proposer ({proposer_tool}):
{full response}

Round {N-1} - Challenger ({challenger_tool}):
{full response}

编排 Agent(opus)生成摘要。目标长度:500-800 个词元。必须保留:

  • 双方的核心立场
  • 所有让步(逐字引用,不得改述)
  • 支持共识的所有证据引用
  • 分歧点(尚未解决)
  • 各轮之间的任何矛盾(例如,提议方在第 1 轮让步,却在第 2 轮收回;须明确指出两者)

综合总结格式

所有轮次结束后,编排方生成以下结构化输出:

## Debate Summary

**Topic**: {topic}
**Proposer**: {proposer_tool} ({proposer_model})
**Challenger**: {challenger_tool} ({challenger_model})
**Rounds**: {rounds_completed}
**Rigor**: Structured perspective comparison (prompt-enforced adversarial rules, no deterministic verification)

### Verdict

{winner_tool} had the stronger argument because: {specific reasoning citing debate evidence}

### Debate Quality

Rate the debate on these dimensions:
- **Genuine disagreement**: Did the challenger maintain independent positions, or converge toward the proposer? (high/medium/low)
- **Evidence quality**: Did both sides cite specific examples, or argue from generalities? (high/medium/low)
- **Challenge depth**: Were the challenges substantive, or surface-level? (high/medium/low)

### Key Agreements
- {agreed point 1} (evidence: {what supports this agreement})
- {agreed point 2} (evidence: {what supports this agreement})

### Key Disagreements
- {point}: {proposer_tool} argues {X}, {challenger_tool} argues {Y}

### Unresolved Questions
- {question that neither side adequately addressed}

### Recommendation
{Orchestrator's recommendation - must pick a direction, not "both have merit"}

综合总结规则:

  • 裁决必须明确选择一方。“两种方法各有优点”不可接受。
  • 引用辩论中的具体论点,作为裁决的证据。
  • 建议必须可执行——根据这场辩论,告诉用户应该怎么做。
  • 未解决的问题应指出辩论的不足之处,而不是认为双方“同样有理”。

状态文件架构

保存到 {AI_STATE_DIR}/debate/last-debate.json:

{
  "id": "debate-{ISO timestamp}-{4 char random hex}",
  "topic": "original topic text",
  "proposer": {"tool": "claude", "model": "opus"},
  "challenger": {"tool": "gemini", "model": "gemini-3.1-pro-preview"},
  "effort": "high",
  "rounds_completed": 2,
  "max_rounds": 2,
  "status": "completed",
  "exchanges": [
    {"round": 1, "role": "proposer", "tool": "claude", "response": "...", "duration_ms": 8500},
    {"round": 1, "role": "challenger", "tool": "gemini", "response": "...", "duration_ms": 12000},
    {"round": 2, "role": "proposer", "tool": "claude", "response": "...", "duration_ms": 9200},
    {"round": 2, "role": "challenger", "tool": "gemini", "response": "...", "duration_ms": 11000}
  ],
  "verdict": {
    "winner": "claude",
    "reasoning": "...",
    "agreements": ["..."],
    "disagreements": ["..."],
    "recommendation": "..."
  },
  "timestamp": "{ISO 8601 timestamp}"
}

平台状态目录:

  • Claude Code:.claude/
  • OpenCode:.opencode/
  • Codex CLI:.codex/

错误处理

错误操作
提议方第 1 轮失败中止辩论。没有开场立场则无法继续。
挑战方第 1 轮失败显示提议方的立场,并附注:“[WARN] Challenger failed. Showing proposer's uncontested position.”
辩论中任一工具失败根据已完成的轮次进行综合总结。在输出中注明未完成的轮次。
工具调用超时(>240s)第 1 轮提议方:中止。第 1 轮挑战方:以无争议状态继续。第 2 轮及之后:根据已完成的轮次进行综合总结,并注明超时。
Consult 结果封装指示失败(status/exit/error/empty output)将其视为该角色/轮次的工具失败,并应用上述相同的角色与轮次策略。
成功封装后结构化解析失败将其视为该角色/轮次的工具失败,且仅包含经过净化的解析元数据(PARSE_ERROR:<type>:<code>;删除密钥、剥离控制字符,最多 200 个字符),然后应用上述相同的角色与轮次策略。
所有轮次均超时“[ERROR] Debate failed: all tool invocations timed out.”
未记录任何成功交流(非超时)“[ERROR] Debate failed: no successful exchanges were recorded.”

外部工具快速参考

权威来源:plugins/consult/skills/consult/SKILL.md。使用这些模板直接构建并执行 CLI 命令。不要通过 Skill: consult 调用——在 Claude Code 中,这会加载交互式命令包装器并导致递归循环。先将问题写入 {AI_STATE_DIR}/consult/question.tmp,然后通过 Bash 执行命令。

安全命令模式
提供方安全命令模式
Claudeclaude -p - --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep" < "{AI_STATE_DIR}/consult/question.tmp"
Geminigemini -p - --output-format json -m "MODEL" < "{AI_STATE_DIR}/consult/question.tmp"
Codexcodex exec "$(cat "{AI_STATE_DIR}/consult/question.tmp")" --json -m "MODEL" -c model_reasoning_effort="LEVEL"
OpenCodeopencode run - --format json --model "MODEL" --variant "VARIANT" < "{AI_STATE_DIR}/consult/question.tmp"
Copilotcopilot -p - < "{AI_STATE_DIR}/consult/question.tmp"
推理强度与模型的映射
推理强度ClaudeGeminiCodexOpenCodeCopilot
lowclaude-haiku-4-5(1 轮)gemini-3-flash-previewgpt-5.3-codex(low)默认(low)无法控制
mediumclaude-sonnet-4-6(3 轮)gemini-3-flash-previewgpt-5.3-codex(medium)默认(medium)无法控制
highclaude-opus-4-6(5 轮)gemini-3.1-pro-previewgpt-5.3-codex(high)默认(high)无法控制
maxclaude-opus-4-6(10 轮)gemini-3.1-pro-previewgpt-5.3-codex(high)默认 + --thinking无法控制
输出解析
提供方解析表达式
ClaudeJSON.parse(stdout).result
GeminiJSON.parse(stdout).response
CodexJSON.parse(stdout).message 或原始文本
OpenCode以换行符分隔的 JSON。从 type === "text" 的事件中拼接 part.text。会话 ID 来自 event.sessionID。
Copilot原始 stdout 文本

解析规范:

  1. 先评估执行状态(超时/非零状态/错误/输出为空),再进行任何解析。
  2. 仅在执行成功时解析。
  3. 如果解析失败,只显示经过清理的解析元数据(绝不显示原始 stdout/stderr 片段),并应用角色/轮次失败策略,不要一直等待或悄然继续。
ACP 传输命令

ACP 是提供方支持时可用的替代传输方式。直接构建并执行 CLI 命令——不要使用 Skill: consult(会在 Claude Code 中导致递归循环)。

提供方ACP 命令模式
Claudenode acp/run.js --provider="claude" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000 --model="MODEL"
Gemininode acp/run.js --provider="gemini" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000 --model="MODEL"
Codexnode acp/run.js --provider="codex" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000 --model="MODEL"
OpenCodenode acp/run.js --provider="opencode" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000 --model="MODEL"
Copilotnode acp/run.js --provider="copilot" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000
Kironode acp/run.js --provider="kiro" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=240000

请注意:辩论轮次的超时时间为 240000ms(240s),而 consult 的超时时间为 120000ms(120s)。

Kiro:仅支持 ACP 的提供方。没有 CLI 模式。kiro-cli 位于 PATH 中时即可使用。

ACP 输出解析

ACP 传输输出的解析方式与 CLI 传输相同——ACP 执行器(acp/run.js)会将响应规范化为相同的 JSON 信封格式。信封中的 transport 字段表示 "acp" 或 "cli"。

评论

支持 Markdown