Skip to main content

Duo peer programming between Claude Code and Codex - two AIs are better than one

Project description

Claude-Codex Duo

Claude codes. Codex reviews. Better code together.

A simple library for duo peer programming between Claude Code and Codex. Two AI coding assistants working together to write better code.

Why Use Both?

Claude Codex
Superior tool calling & code generation Excellent at catching bugs & edge cases
Great at understanding context Strong code review capabilities
Creative problem solving Thorough analysis

Together, they create a peer programming experience that's greater than either alone.

Quick Start

Prerequisites

Installation

pip install claude-codex-duo

Or install from source:

git clone https://github.com/Sigma5C-Corp/claude-codex-duo
cd claude-codex-duo
pip install -e .

Basic Usage

from claude_codex_duo import create_session, Verdict

# Create a peer programming session
session = create_session("auth_feature", "Implement user authentication")

# Claude submits code for review
session.submit_code("""
def authenticate(username: str, password: str) -> bool:
    user = get_user(username)
    if user and verify_password(password, user.password_hash):
        return True
    return False
""")

# Wait for Codex's review
exchange = session.wait_for_review(timeout=120)

if exchange and exchange.verdict == Verdict.APPROVED:
    print("Consensus reached! Code approved.")
else:
    print(f"Feedback: {exchange.codex_review}")

How It Works

┌─────────────────────────────────────────────────────────────────┐
│                                                                 │
│    ┌──────────┐                           ┌──────────┐         │
│    │  Claude  │  ───── submits code ────► │  Codex   │         │
│    │  (coder) │                           │(reviewer)│         │
│    └──────────┘  ◄──── sends review ───── └──────────┘         │
│         │                                       │               │
│         │          ┌─────────────┐              │               │
│         └─────────►│   Session   │◄─────────────┘               │
│                    │   (files)   │                              │
│                    └─────────────┘                              │
│                                                                 │
│    Round 1: Claude writes → Codex reviews → Feedback           │
│    Round 2: Claude fixes  → Codex reviews → Approved!          │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
  1. Claude writes code - Implements the task
  2. Codex reviews - Checks for bugs, edge cases, best practices
  3. Iterate - Claude addresses feedback, Codex re-reviews
  4. Consensus - When Codex approves, the code is ready

All communication happens via file-based messaging (no database needed).

API Reference

create_session(session_id, task, workspace=None, max_rounds=10)

Create a new peer programming session.

session = create_session(
    "my_session",           # Unique session ID
    "Build a REST API",     # Task description
    workspace="/path/to/project",
    max_rounds=5
)

DuoSession.submit_code(content, files_modified=None)

Submit code from Claude for Codex review.

session.submit_code(
    "def hello(): return 'world'",
    files_modified=["src/utils.py"]
)

DuoSession.wait_for_review(timeout=300)

Wait for Codex's review response.

exchange = session.wait_for_review(timeout=120)
if exchange:
    print(f"Verdict: {exchange.verdict}")
    print(f"Feedback: {exchange.codex_review}")

Session Status

session.status        # SessionStatus.ACTIVE, REVIEWING, CONSENSUS, etc.
session.has_consensus # True if approved
session.is_complete   # True if done (approved or max rounds)
session.current_round # Current review round number

Configuration

Set the data directory via environment variable:

export CLAUDE_CODEX_DUO_DATA=~/.my-duo-data

Default: ~/.claude-codex-duo/

Session files are stored in:

~/.claude-codex-duo/
└── sessions/
    └── my_session/
        ├── session.json       # Session state
        ├── claude_inbox.json  # Messages for Claude
        ├── codex_inbox.json   # Messages for Codex
        └── conversation.jsonl # Full history

Advanced Usage

Manual Provider Control

from claude_codex_duo import ClaudeProvider, CodexProvider

# Direct Claude interaction
claude = ClaudeProvider(workspace="/my/project")
response = claude.execute("Write a function to validate emails")

# Direct Codex interaction
codex = CodexProvider(model="o3", reasoning_effort="high")
review = codex.execute(codex.review_prompt(code, task))
verdict = codex.extract_verdict(review)

Load Existing Session

from claude_codex_duo import load_session

session = load_session("my_session")
print(f"Round {session.current_round} of {session.max_rounds}")

Requirements

  • Python 3.10+
  • Unix-like OS (uses fcntl for file locking)
  • Claude Code CLI
  • Codex CLI

License

MIT License - see LICENSE

Contributing

Contributions welcome! Please read our contributing guidelines.

About

Built by Sigma5C - Leaders in multi-agent AI systems.

We believe AI tools work better together. Claude's superior reasoning and tool-calling combined with Codex's bug-catching creates a peer programming experience that's greater than either alone.


"Two AIs are better than one."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_codex_duo-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_codex_duo-0.1.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file claude_codex_duo-0.1.0.tar.gz.

File metadata

  • Download URL: claude_codex_duo-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for claude_codex_duo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1bb536dec0224d98eb87a7a176a06805276178e3175a7d46bf96223312de9acc
MD5 38355e58ef0bea3a2f863220bfa63dd2
BLAKE2b-256 99cb8cdd32e06eb4985a1132a868c1701912c4fadad0e160dffa3f4809078bbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_codex_duo-0.1.0.tar.gz:

Publisher: ci.yml on Sigma5C-Corp/claude-codex-duo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_codex_duo-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_codex_duo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8a461fd1679ca141dc7a30107a24fb9cd283c0b408f7b8000b6ff99f8a9652f
MD5 b001da8ed71e2e327b6364fd529a3dec
BLAKE2b-256 5d102e186c95f77cdf9919f50f32161cd655acaeecf1622dcb4b2b02b60ecbd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_codex_duo-0.1.0-py3-none-any.whl:

Publisher: ci.yml on Sigma5C-Corp/claude-codex-duo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page