Agent-to-agent pair programming between Claude and Codex.
AgentPair orchestrates pair programming sessions between AI agents. One agent works on the task while the other reviews, iterating until completion or max iterations reached.
- 🤝 Paired mode: Claude and Codex work together, one implements while the other reviews
- 👤 Single-agent mode: Run
--claude-onlyor--codex-onlyfor simpler tasks - 🌉 Bridge communication: JSONL-based messaging with SHA256 deduplication
- 🔌 MCP integration: Agents communicate via Model Context Protocol tools
- 🔍 Review modes:
claude,codex, orclaudex(both review) - 🖥️ tmux support: Side-by-side terminal panes for watching agents work
- 🌲 Git worktree isolation: Each run can use an isolated worktree
- 💾 Session persistence: Resume runs from any state
- 📊 Live dashboard: Monitor active runs in real-time
- 🔄 Auto-update: Self-updating binary
go install github.com/plexusone/agentpair@latestOr build from source:
git clone https://github.com/plexusone/agentpair
cd agentpair
go build -o agentpair ./cmd/agentpair- Go 1.21+
claudeCLI (Claude Code)codexCLI (OpenAI Codex)- Optional:
tmuxfor side-by-side view - Optional: Git for worktree isolation
# Paired session (Codex works, Claude reviews)
agentpair --prompt "Implement a REST API for user management"
# Claude as primary worker
agentpair --agent claude --prompt "Add unit tests for the auth module"
# Single-agent mode
agentpair --claude-only "Refactor the logging system"
agentpair --codex-only "Fix the memory leak in cache.go"
# With tmux side-by-side view
agentpair --tmux --prompt "Implement OAuth2 authentication"
# With git worktree isolation
agentpair --worktree --prompt "Experimental feature X"agentpair [flags] [prompt]
Flags:
-p, --prompt string Task prompt (or provide as argument)
-a, --agent string Primary worker: claude or codex (default "codex")
-m, --max-iterations int Maximum loop iterations (default 20)
--proof string Proof/verification command (e.g., "go test ./...")
--review string Review mode: claude, codex, claudex (default "claudex")
--done string Custom done signal (default "DONE")
--claude-only Run Claude in single-agent mode
--codex-only Run Codex in single-agent mode
--tmux Use tmux for side-by-side panes
--worktree Create git worktree for isolation
--run-id int Resume by run ID
--session string Resume by session ID
-v, --verbose Verbose output
Commands:
dashboard Show live dashboard of active runs
bridge Show bridge status for a run
update Check for and install updates
version Print version information
github.com/plexusone/agentpair/
├── cmd/agentpair/ # CLI entry point
├── internal/
│ ├── agent/ # Agent interface
│ │ ├── claude/ # Claude CLI wrapper (NDJSON protocol)
│ │ └── codex/ # Codex App Server client (JSON-RPC 2.0)
│ ├── bridge/ # Agent-to-agent messaging
│ │ ├── bridge.go # JSONL storage with SHA256 dedup
│ │ └── server.go # MCP server for bridge tools
│ ├── loop/ # Orchestration state machine
│ ├── run/ # Run persistence (~/.agentpair/runs/)
│ ├── review/ # PASS/FAIL signal parsing
│ ├── tmux/ # tmux session management
│ ├── worktree/ # Git worktree automation
│ ├── dashboard/ # Live dashboard UI
│ ├── config/ # Configuration and paths
│ ├── logger/ # Structured logging (slog)
│ └── update/ # Auto-update mechanism
└── pkg/jsonl/ # JSONL utilities
init → working → reviewing → working → ... → complete
↓ ↑
fail ←────────────────────────┘
- Init: Run created, agents starting
- Working: Primary agent executes the task
- Reviewing: Secondary agent reviews the work
- Complete: Both agents signal DONE/PASS
- Failed: Max iterations reached or agent error
Agents communicate through a JSONL bridge file with MCP tools:
send_to_agent: Send a message to the other agentreceive_messages: Get pending messagesbridge_status: Check bridge state
Message types:
task: Initial task or follow-up workresult: Work outputreview: Review feedbacksignal: Control signals (DONE, PASS, FAIL)chat: Free-form discussion
| Mode | Behavior |
|---|---|
claude |
Only Claude reviews |
codex |
Only Codex reviews |
claudex |
Both review; consensus required |
Create ~/.agentpair/config.yaml:
agent: codex
max_iterations: 20
review_mode: claudex
done_signal: DONE
use_tmux: false
use_worktree: false
verbose: false
timeout: 2hCLI flags override config file values.
Runs are stored in ~/.agentpair/runs/{repo-id}/{run-id}/:
~/.agentpair/runs/
└── github-plexusone-myrepo/
└── 1/
├── manifest.json # Run metadata
├── bridge.jsonl # Agent messages
└── transcript.jsonl # Audit log
Resume a run:
agentpair --run-id 5
agentpair --session abc123# Run tests
go test -v ./...
# Run tests with race detection
go test -race ./...
# Lint
golangci-lint run
# Build
go build -o agentpair ./cmd/agentpair| Package | Status |
|---|---|
| pkg/jsonl | ✓ |
| internal/bridge | ✓ |
| internal/config | ✓ |
| internal/logger | ✓ |
| internal/loop | ✓ |
| internal/review | ✓ |
| internal/run | ✓ |
| internal/tmux | ✓ |
| internal/worktree | ✓ |
MIT