Skip to content

Repository files navigation

Dual Agent Development Environment

A collaborative development environment that pairs Claude Code (Anthropic) with Codex CLI (OpenAI, GPT-5.5) and ChatGPT Pro (GPT-5.5 Pro), enabling you to leverage the strengths of multiple AI models.

Why Multiple Agents?

Claude Code (Primary) Codex CLI (GPT-5.5) ChatGPT Pro (GPT-5.5 Pro)
Fast iteration & prototyping Deep, thorough code review Extended thinking for complex analysis
Planning & orchestration Complex algorithm implementation Maximum context for large codebases
Quick fixes & refactoring Security vulnerability analysis Second opinion on architecture
Context switching & multitasking Meticulous edge case handling Long-running deep reviews (5-30 min)

By combining multiple models, you get rapid development velocity with rigorous quality checks and diverse perspectives.

Prerequisites

# macOS
brew install tmux jq node

# Claude Code & Codex CLI - follow their respective installation guides

Installation

git clone https://github.com/antorsae/dual-agent.git
cd dual-agent
./setup-dual-agent.sh

This will:

  • Build the codex-delegate MCP server
  • Install Claude skills to ~/.claude/skills/
  • Install Codex skills to ~/.codex/skills/
  • Configure Claude Code with MCP server and permissions
  • Initialize the .agent-collab/ directory

Four Ways to Use

Option 1: MCP Tools (Recommended)

After running setup, Claude Code has Codex tools available directly. Just ask naturally:

You: Review src/auth.ts for security vulnerabilities using codex

You: Have codex implement a rate limiter for the API

You: Ask codex to review my migration plan

Available MCP Tools:

Tool Description
delegate_codex_review Code review (security, bugs, performance)
delegate_codex_implement Implement features with Codex
delegate_codex_plan_review Review implementation plans
delegate_codex Send any custom prompt to Codex

Option 2: Tmux Dual-Pane

For interactive side-by-side work with both agents visible:

./start-dual-agent.sh

This opens a split tmux session with Claude (left) and Codex (right).

Skills:

Claude Skills Codex Skills
/codex-review $read-task
/codex-implement $respond
/codex-plan-review $claude-status
/codex-read
/codex-status

Option 3: ChatGPT Code Review (Chrome)

Use GPT-5.5 Pro via Claude Code's Chrome integration for deep, extended-thinking code reviews:

# Start Claude Code with Chrome integration
claude --chrome

Then ask naturally:

You: Review src/auth.ts with ChatGPT

You: Get GPT-5.5 Pro to review this migration plan

Prerequisites:

  • Claude Code with --chrome flag
  • Claude in Chrome extension (v1.0.36+)
  • Logged into chat.com with ChatGPT Pro subscription

Workflow:

  1. Claude submits the code review request to GPT-5.5 Pro
  2. Returns immediately (non-blocking) - GPT-5.5 Pro can take 5-30 minutes
  3. Ask Claude to "fetch ChatGPT results" when ready

Skill: /chatgpt-code-review

Option 4: ChatGPT Pro Worker for Codex

Use GPT-5.5 Pro as an external worker for arbitrary Codex tasks: implementation, debugging, refactoring, planning, review, or custom analysis. The worker can automate ChatGPT through Playwright using a persistent Chromium profile.

Install only this component:

./setup-dual-agent.sh --pro-worker

Then restart Codex and ask:

$chatgpt-pro-worker implement rate limiting for the API and return an apply-ready patch

$chatgpt-pro-worker debug this failing test and ask GPT-5.5 Pro for a unified diff

Workflow:

  1. Codex gathers repo context and calls the chatgpt-pro-worker MCP server.
  2. The MCP server opens ChatGPT in Playwright Chromium, selects GPT-5.5 Pro when possible, submits the prompt, waits for the answer, and saves the response.
  3. Codex reads the saved result, applies patches when appropriate, and runs verification.

Login bootstrap:

The automated worker uses a persistent Chromium profile at ~/.codex/chatgpt-pro-worker/browser-profile. You must log in to ChatGPT Pro once in that profile.

open_pro_login
login_status

On a headless machine with no browser/display, first login cannot be completed purely in the terminal because ChatGPT login may require interactive browser UI, CAPTCHA, passkey, or 2FA. Use one of these:

  • Run the Pro worker once on a workstation with a desktop browser, log in, then keep using it there.
  • Use SSH X forwarding or VNC/noVNC on the headless host, then call open_pro_login with headless=false.
  • Copy a compatible already-authenticated Chromium profile into ~/.codex/chatgpt-pro-worker/browser-profile.

After login, headless automation can run on the host.

Available MCP Tools:

Tool Description
login_status Check whether the persistent ChatGPT profile is logged in
open_pro_login Open ChatGPT for one-time login in the persistent profile
submit_pro_task Submit an arbitrary Pro task through automated Playwright Chromium
await_pro_task Wait for an automated task result
save_pro_result Save the completed ChatGPT Pro response
get_pro_task Read job status and saved result
show_pro_prompt Show the prepared Pro prompt
list_pro_tasks List recent Pro jobs

Quick Start

MCP Tools (Simplest)

# 1. Run setup
./setup-dual-agent.sh

# 2. Restart Claude Code to load MCP tools
claude

# 3. Use naturally
> Review src/auth.ts for security issues using codex

Tmux Dual-Pane

# 1. Run setup
./setup-dual-agent.sh

# 2. Start dual-agent environment
./start-dual-agent.sh

# 3. In Claude pane, use skills
> /codex-review

Detailed Example: Security Review

Using MCP Tools

You: I just implemented authentication. Review src/auth.ts using codex
     for security vulnerabilities.

Claude: I'll use the delegate_codex_review tool to have Codex analyze this file...

[Claude calls delegate_codex_review tool]

Claude: Codex found the following issues:

## Critical Issues

1. **SQL Injection (Line 45)**
   The query uses string concatenation instead of parameterized queries.

   Fix:
   ```python
   cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
   ```

2. **Weak Password Hashing (Line 78)**
   Using MD5 instead of bcrypt/argon2.

...

Using Tmux Dual-Pane

[Claude Pane]
You: Review src/auth.ts for security issues

Claude: I'll delegate this to Codex for a thorough security review.
        Delegating to Codex...

[Codex Pane - automatically receives task]
Codex: Reading task from Claude...
       Analyzing src/auth.ts for security vulnerabilities...
       [Deep analysis]
       Response ready.

[Claude Pane - automatically reads response]
Claude: Codex completed the review. Here are the findings:
        [Presents Codex's analysis]

Architecture

+-----------------------------------------------------------------------------------+
|                                    Claude Code                                    |
|                                                                                   |
|+-----------------------+  +-----------------------+  +---------------------------+|
||       MCP Tools       |  |     Skills (tmux)     |  |      Skills (Chrome)      ||
||   delegate_codex_*    |  |     /codex-review     |  |   /chatgpt-code-review    ||
|+-----------+-----------+  +-----------+-----------+  +-------------+-------------+|
+------------+--------------------------+----------------------------+--------------+
             |                          |                            |
             v                          v                            v
 +-----------------------+  +-----------------------+  +---------------------------+
 |    codex-delegate     |  |    .agent-collab/     |  |     Chrome + chat.com     |
 |      MCP Server       |  |   (file-based IPC)    |  |   (browser automation)    |
 |                       |  |                       |  |                           |
 |   Spawns codex CLI    |  |   requests/task.md    |  |   JavaScript injection    |
 +-----------+-----------+  +-----------+-----------+  +-------------+-------------+
             |                          |                            |
             v                          v                            v
 +-----------+--------------------------+-----------+  +-------------+-------------+
 |                Codex CLI (GPT-5.5)               |  |       GPT-5.5 Pro        |
 |                                                  |  |                           |
 |        Deep code review & Implementation         |  | Extended thinking (5-30m) |
 |         Security analysis & Plan review          |  | Maximum context + analysis |
 +--------------------------------------------------+  +---------------------------+

Configuration

Shared Context

Edit .agent-collab/context/shared.md to provide both agents with project context:

# Shared Project Context

## Project Overview
E-commerce platform using FastAPI + Redis + PostgreSQL

## Architecture Decisions
- All auth uses JWT with refresh rotation
- Redis for rate limiting and session storage

## Conventions
- Type hints required on all functions
- Pydantic models for all API schemas

Claude Settings

The setup script configures ~/.claude/settings.json with:

{
  "mcpServers": {
    "codex-delegate": {
      "command": "node",
      "args": ["/path/to/dual-agent/agent/dist/mcp.js"]
    }
  },
  "permissions": {
    "allow": [
      "Bash(cat .agent-collab:*)",
      "Bash(tmux send-keys:*)",
      ...
    ]
  }
}

Tmux Key Bindings

Keys Action
Ctrl-b ←/→ Switch between Claude and Codex panes
Ctrl-b d Detach from session
Ctrl-b z Zoom current pane (fullscreen toggle)

Troubleshooting

MCP tools not available

  1. Check the setup completed successfully:

    cat ~/.claude/settings.json | jq '.mcpServers'
  2. Restart Claude Code:

    claude

Codex not receiving tasks (tmux mode)

  1. Check tmux pane numbers: tmux list-panes
  2. Ensure Codex is running in pane 1
  3. Manually trigger: tmux send-keys -t 1 '$read-task' Enter

Status stuck (tmux mode)

echo "idle" > .agent-collab/status

Codex not working

# Verify codex is installed and authenticated
codex "hello"

Project Structure

dual-agent/
├── agent/                    # MCP server & CLI
│   ├── src/
│   │   ├── mcp.ts           # Claude MCP server (delegate_codex_* tools)
│   │   ├── chatgptProMcp.ts # Codex MCP server (ChatGPT Pro worker)
│   │   ├── cli.ts           # CLI wrapper
│   │   └── codex.ts         # Codex subprocess spawner
│   └── dist/                # Compiled JS
├── .claude/skills/          # Claude Code skills
│   ├── codex-review/        # /codex-review (tmux mode)
│   ├── codex-implement/     # /codex-implement (tmux mode)
│   ├── codex-plan-review/   # /codex-plan-review (tmux mode)
│   ├── codex-read/          # /codex-read (tmux mode)
│   ├── codex-status/        # /codex-status (tmux mode)
│   └── chatgpt-code-review/ # /chatgpt-code-review (Chrome)
├── .codex/skills/           # Codex CLI skills, including chatgpt-pro-worker
├── setup-dual-agent.sh      # Setup script
├── start-dual-agent.sh      # Tmux launcher
└── README.md

License

MIT

About

Dual-agent development environment pairing Claude Code with Codex CLI in a collaborative tmux session

Resources

Stars

17 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages