A terminal-based Python tool that allows you to orchestrate and converse with three powerful AI models (Claude, Codex, and Gemini) simultaneously in a shared "conference room" environment.
Instead of asking the same question in three different chat interfaces, you can ask once and get diverse, cross-validated responses. The models can even read each other's answers and collaborate to find the optimal solution!
- Multi-Model Support: Interfaces seamlessly with
claude-code,codex, andgeminiCLIs. - Cross-Validation: Let the AIs review and critique each other's code suggestions.
- Context-Aware: The bots share the same conversation history context and know who is speaking via
[speaker]tags. - Cross-Platform: Handles Windows CMD truncation, TTY buffering issues, and encoding safely (works flawlessly on Windows, macOS, and Linux).
- Project-Aware: AI models execute in your current working directory, granting them access to analyze, read, and modify your local codebase.
This module provides a turn-based execution architecture:
- How it works: Spawns a new CLI process for each AI every time you send a message, injecting the entire conversation history into the prompt.
- Pros: Highly stable, zero zombie processes.
- Cons: Slower response times due to CLI startup overhead on every turn.
- Best for: Deep, deliberate code reviews and architectural planning where you need time to digest long answers.
cli/
โโโ relay.py # Main entry point
โโโ cli_common.py # Shared CLI resolution utilities
โโโ run_claude_cli.py # Claude Code wrapper
โโโ run_codex_cli.py # Codex wrapper
โโโ run_gemini_cli.py # Gemini wrapper
โโโ requirements.txt # Python dependencies
โโโ .env.example # Environment variable template
-
Python 3.10+
-
Node.js (Required for all three CLI tools)
-
The AI CLIs: You must install and authenticate the respective CLI tools before using the hub:
- Claude Code (
npm install -g @anthropic-ai/claude-code) - Gemini CLI (
npm install -g @anthropic-ai/gemini-cliornpm install -g @google/gemini-cli) - Codex CLI (
npm install -g @openai/codex)
- Claude Code (
-
Python dependencies:
pip install -r requirements.txt(onlypython-dotenvfor.envauto-loading; optional but recommended)
Before running the hub, you must run each CLI manually at least once in your target directory to accept any interactive prompts, EULAs, or login requests. The hub runs the CLIs in headless/non-interactive mode, so they will freeze if they wait for user input.
# 1. Start Claude, login, and approve the project directory
claude
# 2. Start Gemini and authenticate
gemini
# 3. Start Codex, ensure it trusts the directory
codexNavigate to the codebase you want the AIs to analyze, and run the relay script from there. (The script will dynamically locate its wrapper dependencies).
# Start the turn-based, stable panel:
python /path/to/cli/relay.pyCopy .env.example to .env and adjust as needed, or set environment variables directly:
| Variable | Default | Description |
|---|---|---|
RELAY_TIMEOUT_SEC |
600 |
Timeout (seconds) for each AI subprocess |
MAX_CONTEXT_CHARS |
32000 |
Maximum context characters sent to each AI |
RELAY_MODE |
readonly |
readonly = AIs cannot write files; full = AIs can use tools freely |
In relay.py, if you simply hit Enter without typing a message, the hub will automatically prompt the AIs to:
"Please review what the other AIs said in the previous round. Add any corrections, disagreements, or additional insights if you have them..."
This is the ultimate way to trigger an autonomous code review!
To bypass complex TTY handling and interactive CLI constraints, the hub uses Wrapper Scripts (run_claude_cli.py, run_gemini_cli.py, run_codex_cli.py), with shared utilities in cli_common.py.
relay.pywraps your message in a JSON payload.- The payload is piped into the wrappers.
- The wrapper scripts parse the JSON, prepend the
[human]or[ai]tags, inject aSYSTEM_PROMPTemphasizing their role in a multi-AI room, and execute the actual CLI binaries usingsubprocess.run. - The outputs are captured, buffered, and returned to the hub for display.
Each wrapper's SYSTEM_PROMPT includes anti-narration instructions that tell the AIs to skip process descriptions (e.g. "Let me read file X...", "I will now check Y...") and give results directly. This keeps responses concise and reduces visual clutter.
Each wrapper includes a flag to auto-approve tool operations (file read/write, command execution). These flags are only enabled when RELAY_MODE=full.
By default, RELAY_MODE=readonly โ all bypass flags are stripped, and the AIs operate in read-only mode.
| CLI | Flag | Effect |
|---|---|---|
| Claude | --permission-mode bypassPermissions |
Skips all tool confirmation prompts |
| Codex | --dangerously-bypass-approvals-and-sandbox |
Skips approvals and disables sandbox |
| Gemini | --yolo |
Auto-approves all tool actions |
Caution
When RELAY_MODE=full, AI agents can automatically execute file operations without manual approval.
In full mode, the wrappers use auto-approval flags so the AIs can modify files immediately. This means they may create, modify, overwrite, or even delete files.
You are effectively giving full write permission to an LLM.
The default mode is readonly, which disables all auto-approval flags.
- Git repositories (so you can diff/revert changes)
- Disposable test projects
- Sandboxed folders
- Local copies of your code
- System directories
- Home root (
~or%USERPROFILE%) - Production servers
- Folders containing sensitive secrets/credentials
Tip
Run inside a Git repo! git restore . is your best friend if the AI makes a mistake.
On Windows, the wrapper scripts execute the AI CLIs by calling node directly against their .js entry points, instead of going through .cmd wrapper files. This avoids two common pitfalls:
- Stray
.bat/.cmdfiles in the current directory being picked up before the real CLI (Windows searches cwd first). .cmdwrapper files spawning unwantedcmd.exewindows. Runningnode cli.jsdirectly is completely silent.
cli_common.py resolves CLI paths in this order:
- Known
.jsentry points under the npm global directory (%APPDATA%\npm\) - Parse the
.cmdfile to extract the actual.jspath - Fallback to the full-path
.cmdfile (not cwd-relative)
The wrapper scripts search for these paths (relative to your npm global directory). If your installation differs, update the CLI_JS_CANDIDATES list in the corresponding wrapper script.
Claude Code (run_claude_cli.py):
%APPDATA%\npm\node_modules\@anthropic-ai\claude-code\cli.js
Codex (run_codex_cli.py):
%APPDATA%\npm\node_modules\@openai\codex\bin\codex.js
Gemini CLI (run_gemini_cli.py):
%APPDATA%\npm\node_modules\@google\gemini-cli\dist\index.js
If the default paths don't match your installation, you can find the correct .js entry point:
# 1. Find where the CLI is installed
where claude # or: where codex / where gemini
# 2. Look at the .cmd file to find the .js path
type "%APPDATA%\npm\claude.cmd"
# 3. Or search for .js files in the package directory
dir "%APPDATA%\npm\node_modules\@anthropic-ai\claude-code\*.js" /bThen update the CLI_JS_CANDIDATES list at the top of the relevant wrapper script:
# Example: run_claude_cli.py
CLI_JS_CANDIDATES = [
os.path.join("node_modules", "@anthropic-ai", "claude-code", "cli.js"),
# Add your custom path here if needed:
# os.path.join("node_modules", "my-custom-path", "cli.js"),
]On Linux and macOS, path resolution simply uses shutil.which() to find the CLI binary. No special handling is needed.
โ ๏ธ Important: Do not place files namedclaude.bat,codex.bat, orgemini.batin your working directory. While the resolver is designed to avoid them, removing potential conflicts is the safest approach.
Note: Special care has been taken in the wrappers to bypass Windows cmd.exe string truncation by escaping horizontal newlines (\n).
