Red Team — Adversarial Debate Engine
Stress-test any decision by having AI agents with conflicting worldviews debate it.
Prerequisites
One of these coding agent CLIs (uses your existing subscription — no API key needed):
- - Claude Code (default):
claude — INLINECODE1 - Codex:
codex — INLINECODE3 - Gemini:
gemini — INLINECODE5
No Python dependencies beyond the standard library.
Quick Start
CODEBLOCK0
How to Use (as OpenClaw Agent)
When the user asks you to "red team" something, "stress test" an idea, play "devil's advocate", or asks "what could go wrong":
- 1. Identify the question/decision from the user's message
- Choose appropriate personas (default: bull,bear,operator — adjust based on domain)
- Run the script and save output
- Summarize the key findings to the user, share the full report if requested
Persona selection guide:
- - Investment/financial decisions → bull, bear, cash-flow, economist
- Product/startup ideas → bull, customer, operator, technologist
- Legal/compliance questions → regulator, bear, operator
- Strategy/direction → contrarian, economist, historian, bull
- General "should we do X?" → bull, bear, operator (good default)
Available Personas
| Key | Name | Worldview |
|---|
| bull | The Bull | Optimistic, opportunity-focused |
| bear |
The Bear | Risk-averse, capital preservation |
| contrarian | The Contrarian | Oppositional, consensus-challenging |
| operator | The Operator | Execution-focused pragmatist |
| economist | The Economist | Macro trends, opportunity cost |
| local-realist | The Local Realist | Ground truth, local specifics |
| cash-flow | The Cash Flow Analyst | Income, carrying costs, IRR |
| regulator | The Regulator | Compliance, legal risk |
| technologist | The Technologist | Automation, scalability |
| customer | The Customer | End-user demand, willingness to pay |
| ethicist | The Ethicist | Moral implications, stakeholder impact |
| historian | The Historian | Historical patterns, precedent |
Custom Personas
Create a JSON file:
CODEBLOCK1
Use with --custom-personas /path/to/file.json. Custom personas merge with built-ins.
CLI Options
| Flag | Default | Description |
|---|
| INLINECODE7 , INLINECODE8 | required | The question to debate |
| INLINECODE9 , INLINECODE10 |
bull,bear,operator | Comma-separated persona keys |
|
--rounds,
-r | 2 | Number of critique rounds |
|
--output,
-o | stdout | Output file path |
|
--context-file,
-c | none | Additional context file |
|
--custom-personas | none | Custom personas JSON |
|
--model,
-m | sonnet | Model alias (sonnet, opus, haiku, gpt-4o, etc.) |
|
--backend,
-b | claude | CLI backend: claude, codex, or gemini |
|
--list-personas | — | List personas and exit |
Output Structure
The output is a markdown document with:
- 1. Initial Proposals — Each agent's independent take
- Critique Rounds — Agents critique each other
- Refinement — Agents update positions based on critiques
- Conviction Scores — Each agent scores all positions (0-100)
- Synthesis & Decision Brief — Neutral agent produces:
- Executive summary
- Consensus points
- Key disagreements
- Risk matrix
- Conviction score summary
- Synthesized recommendation
- Next steps
When to Use
✅ Good for: Important decisions, investment analysis, product strategy, "go/no-go" calls, pre-mortems, challenging groupthink
❌ Not for: Simple factual questions, time-sensitive emergencies, decisions already made, emotional/personal choices
Integration Tips
- - Save output to memory files for future reference
- Create BEADS tasks from the "Next Steps" section
- Feed context files from Obsidian or project docs
- Re-run with different personas for different perspectives
- Use
--rounds 1 for quick takes, --rounds 3 for deep analysis
红队 — 对抗性辩论引擎
通过让持有不同世界观的AI智能体对任何决策进行辩论,对其进行压力测试。
前置条件
以下任一编码智能体CLI(使用您现有的订阅——无需API密钥):
- - Claude Code(默认):claude — npm i -g @anthropic-ai/claude-code
- Codex:codex — npm i -g @openai/codex
- Gemini:gemini — npm i -g @google/gemini-cli
除标准库外,无需Python依赖。
快速开始
bash
基础三人格辩论(通过claude CLI使用Max订阅)
python3 ~/.openclaw/skills/red-team/scripts/red-team.py \
--question 我们应该做X吗? \
--personas bull,bear,operator
带上下文和输出文件的完整辩论
python3 ~/.openclaw/skills/red-team/scripts/red-team.py \
-q 我们应该在这笔交易中投资5万美元吗? \
-p bull,bear,cash-flow,local-realist \
-r 3 \
-c /path/to/deal-data.md \
-o /tmp/red-team-result.md
使用不同模型
python3 ~/.openclaw/skills/red-team/scripts/red-team.py \
-q 我们应该推出这个产品吗? \
-p bull,customer,operator \
-m opus
列出所有可用人格
python3 ~/.openclaw/skills/red-team/scripts/red-team.py --list-personas
使用方法(作为OpenClaw智能体)
当用户要求您对某事进行红队测试、压力测试某个想法、扮演魔鬼代言人或询问可能出什么问题时:
- 1. 从用户消息中识别问题/决策
- 选择合适的人格(默认:bull,bear,operator——根据领域调整)
- 运行脚本并保存输出
- 向用户总结关键发现,如有要求则分享完整报告
人格选择指南:
- - 投资/财务决策 → bull, bear, cash-flow, economist
- 产品/创业想法 → bull, customer, operator, technologist
- 法律/合规问题 → regulator, bear, operator
- 战略/方向 → contrarian, economist, historian, bull
- 通用我们应该做X吗? → bull, bear, operator(良好默认值)
可用人格
| 键值 | 名称 | 世界观 |
|---|
| bull | 乐观派 | 乐观,关注机会 |
| bear |
悲观派 | 风险规避,资本保值 |
| contrarian | 逆向派 | 对立,挑战共识 |
| operator | 执行派 | 以执行为中心的实用主义者 |
| economist | 经济学家 | 宏观趋势,机会成本 |
| local-realist | 本地现实主义者 | 地面真相,本地具体情况 |
| cash-flow | 现金流分析师 | 收入,持有成本,内部收益率 |
| regulator | 监管者 | 合规,法律风险 |
| technologist | 技术专家 | 自动化,可扩展性 |
| customer | 客户 | 终端用户需求,支付意愿 |
| ethicist | 伦理学家 | 道德影响,利益相关者影响 |
| historian | 历史学家 | 历史模式,先例 |
自定义人格
创建一个JSON文件:
json
{
my-persona: {
name: 怀疑论者,
description: 质疑一切,不信任任何事物,
system: 你是怀疑论者——你质疑每一个假设...
}
}
使用 --custom-personas /path/to/file.json。自定义人格与内置人格合并。
CLI选项
| 标志 | 默认值 | 描述 |
|---|
| --question, -q | 必需 | 要辩论的问题 |
| --personas, -p |
bull,bear,operator | 逗号分隔的人格键值 |
| --rounds, -r | 2 | 批评轮数 |
| --output, -o | stdout | 输出文件路径 |
| --context-file, -c | 无 | 额外上下文文件 |
| --custom-personas | 无 | 自定义人格JSON |
| --model, -m | sonnet | 模型别名(sonnet, opus, haiku, gpt-4o等) |
| --backend, -b | claude | CLI后端:claude, codex或gemini |
| --list-personas | — | 列出人格并退出 |
输出结构
输出是一个Markdown文档,包含:
- 1. 初始提案 — 每个智能体的独立观点
- 批评轮次 — 智能体互相批评
- 完善 — 智能体基于批评更新立场
- 信念分数 — 每个智能体对所有立场评分(0-100)
- 综合与决策简报 — 中立智能体生成:
- 执行摘要
- 共识点
- 主要分歧
- 风险矩阵
- 信念分数总结
- 综合建议
- 后续步骤
使用时机
✅ 适用于: 重要决策、投资分析、产品策略、通过/否决决策、事前分析、挑战群体思维
❌ 不适用于: 简单事实性问题、时间敏感的紧急情况、已做出的决策、情感/个人选择
集成技巧
- - 将输出保存到内存文件以供将来参考
- 从后续步骤部分创建BEADS任务
- 从Obsidian或项目文档中提供上下文文件
- 使用不同人格重新运行以获得不同视角
- 使用 --rounds 1 快速获取观点,使用 --rounds 3 进行深度分析