AI debate simulator that pits two AI agents against each other to collaboratively solve a problem through structured dialogue.
Two AI agents receive the same problem and independently form their initial hypotheses (round 0, in parallel). They then take turns responding to each other's arguments until they reach agreement or hit the message limit. When one agent proposes a conclusion (prefixed with AGREED:), the other is asked to confirm or object.
The script auto-detects which CLI tools are available and picks the best pair:
| Priority | Agent A | Agent B |
|---|---|---|
| 1 | Claude | Codex |
| 2 | Claude | Gemini |
| 3 | Codex | Gemini |
| 4 | Single agent fallback (same tool for both sides) |
Requires at least one of: claude, codex, gemini. Also requires jq.
npm install -g aidebateOr run directly:
bash ai-debate.sh "Your problem here"aidebate [OPTIONS] "<problem>"If no problem argument is provided, you'll be prompted to select an editor (nano, vim, VS Code, or Cursor) to compose a multiline problem. This is useful for complex prompts that don't fit well on a single command line.
After a debate concludes (either by agreement or reaching the message limit), you can continue chatting with one of the agents. The agent retains full context from the debate, allowing you to ask follow-up questions, explore specific points, or dive deeper into the topic.
| Flag | Description | Default |
|---|---|---|
--max-rounds N |
Max number of messages | 10 |
--timeout N |
API timeout in seconds | 60 |
--claude-model MODEL |
Claude model (haiku, sonnet, opus) |
interactive |
--codex-model MODEL |
Codex model (gpt-5.1-codex-mini, gpt-5.2-codex) |
interactive |
--gemini-model MODEL |
Gemini model (gemini-2.5-flash, gemini-3-flash-preview) |
interactive |
--system-prompt-file F |
Custom system prompt from file | built-in |
--output, -o FILE |
Save debate transcript to JSON file | off |
--debug |
Keep raw API responses and show tmpdir | off |
# Basic usage with interactive model selection
aidebate "Is P = NP?"
# Specify models directly
aidebate --claude-model sonnet --codex-model gpt-5.2-codex "Explain monads"
# Short debate with debug output
aidebate --max-rounds 4 --debug "Best sorting algorithm for nearly-sorted data"
# Save transcript to file
aidebate --output debate.json "Is functional programming better than OOP?"When using --output, the transcript is saved as JSON:
{
"problem": "Your problem here",
"agents": {
"a": {"name": "Claude", "model": "sonnet"},
"b": {"name": "Codex", "model": "gpt-5.2-codex"}
},
"messages": [
{"agent": "a", "content": "...", "timestamp": "2024-01-15T10:30:00Z"},
{"agent": "b", "content": "...", "timestamp": "2024-01-15T10:31:00Z"}
],
"conclusion": "The agreed upon conclusion"
}MIT