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
- Python 3.10+
- Claude Code CLI installed
- Codex CLI installed
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! │
│ │
└─────────────────────────────────────────────────────────────────┘
- Claude writes code - Implements the task
- Codex reviews - Checks for bugs, edge cases, best practices
- Iterate - Claude addresses feedback, Codex re-reviews
- 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
fcntlfor 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_codex_duo-0.1.1.tar.gz.
File metadata
- Download URL: claude_codex_duo-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f3256efedc947e3fd60d3492ebfca48ae99fabe664526ed4bd9e6fba7491f3b
|
|
| MD5 |
96bb0f63602003b001c53bf36accf047
|
|
| BLAKE2b-256 |
91f82df27d0f75e2dd06d81e353e03df919610feb62711f84e5acade69b315b1
|
Provenance
The following attestation bundles were made for claude_codex_duo-0.1.1.tar.gz:
Publisher:
ci.yml on Sigma5C-Corp/claude-codex-duo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_codex_duo-0.1.1.tar.gz -
Subject digest:
6f3256efedc947e3fd60d3492ebfca48ae99fabe664526ed4bd9e6fba7491f3b - Sigstore transparency entry: 833918091
- Sigstore integration time:
-
Permalink:
Sigma5C-Corp/claude-codex-duo@ec5b3f4a3b77c345c478fb242d774a49ecc190e0 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Sigma5C-Corp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ec5b3f4a3b77c345c478fb242d774a49ecc190e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file claude_codex_duo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: claude_codex_duo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a2d26cb19a2147c70e584df9a38b22df65d13c4c608c234cf57f94fb9d44b30
|
|
| MD5 |
78459e635915b5ac3e32ed1c432b8fbf
|
|
| BLAKE2b-256 |
d396ddbd9bf7f848089bd64d54f9fbcd70eab38ee3ce8dafcaa84116b1afa756
|
Provenance
The following attestation bundles were made for claude_codex_duo-0.1.1-py3-none-any.whl:
Publisher:
ci.yml on Sigma5C-Corp/claude-codex-duo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_codex_duo-0.1.1-py3-none-any.whl -
Subject digest:
2a2d26cb19a2147c70e584df9a38b22df65d13c4c608c234cf57f94fb9d44b30 - Sigstore transparency entry: 833918108
- Sigstore integration time:
-
Permalink:
Sigma5C-Corp/claude-codex-duo@ec5b3f4a3b77c345c478fb242d774a49ecc190e0 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Sigma5C-Corp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ec5b3f4a3b77c345c478fb242d774a49ecc190e0 -
Trigger Event:
push
-
Statement type: