Bridge between Claude Code and OpenAI Codex CLI for seamless cross-tool collaboration
The Codex CLI Bridge creates seamless interoperability between Claude Code and OpenAI's Codex CLI by:
- Generating AGENTS.md from CLAUDE.md - Translates Claude Code configuration to Codex CLI format
- Documenting Skills for Codex Users - Shows how to use Claude Skills with Codex CLI
- Providing Execution Helpers - Python wrappers for Codex CLI commands
The Problem: Teams using both Claude Code and Codex CLI maintain duplicate documentation and can't easily share skills/workflows.
The Solution: This bridge auto-generates AGENTS.md from CLAUDE.md with file references (no duplication), enabling both tools to work with the same project structure.
- ✅ CLAUDE.md → AGENTS.md automatic generation
- ✅ Reference-based (links to files, no duplication)
- ✅ One-way sync (CLAUDE.md is source of truth)
- ✅ Functional skills: Bash execution examples
- ✅ Prompt-based skills: Codex prompt templates
- ✅ Most relevant method per skill type
- ✅ Auto-checks Codex CLI installation
- ✅ Auto-runs /init if CLAUDE.md missing
- ✅ User-friendly notifications
- ✅ Python wrappers for Codex CLI commands
- ✅ Always uses
codex exec(not plaincodex) - ✅ Intelligent model selection (gpt-5 vs gpt-5-codex)
- ✅ Sandbox mode helpers (read-only, workspace-write)
# 1. Codex CLI installed
codex --version # Should show v0.48.0+
# 2. Python 3.7+ with PyYAML
python3 --version
pip3 install PyYAML
# 3. Claude Code project (or auto-create)# 1. Navigate to your project
cd /your/claude-code-project
# 2. Run the bridge
python /path/to/codex-cli-bridge/bridge.py
# 3. Done! ✅
# AGENTS.md created in project rootOutput:
================================================================
✅ SUCCESS - AGENTS.MD GENERATED
================================================================
📄 Output: /your/project/AGENTS.md
📊 Skills documented: 13
🤖 Agents documented: 59
Next steps:
1. Review AGENTS.md
2. Test with Codex CLI
3. Share with team (works in both Claude Code and Codex CLI)
| Module | Purpose |
|---|---|
bridge.py |
Main orchestrator (runs complete workflow) |
safety_mechanism.py |
Environment validation (Codex CLI + CLAUDE.md checks) |
claude_parser.py |
Parse CLAUDE.md and project structure |
project_analyzer.py |
Analyze project metadata and structure |
agents_md_generator.py |
Generate AGENTS.md (template-based) |
skill_documenter.py |
Document skills for Codex CLI users |
codex_executor.py |
Codex CLI execution helpers |
| File | Description |
|---|---|
SKILL.md |
Complete skill reference |
README.md |
This file |
HOW_TO_USE.md |
Comprehensive usage guide |
| Template | Purpose |
|---|---|
templates/ |
AGENTS.md generation templates (future) |
# Generate AGENTS.md for current directory
python bridge.py# Generate for a different project
python bridge.py --project /path/to/other/project# Check environment without generating
python bridge.py --validatefrom bridge import CodexCliBridge
# Create bridge
bridge = CodexCliBridge(project_root="/your/project")
# Run complete workflow
success = bridge.run()
if success:
print("✅ AGENTS.md generated successfully")from codex_executor import CodexExecutor, CodexModel
executor = CodexExecutor()
# Execute analysis task
result = executor.exec_analysis(
prompt="Analyze this codebase for security issues",
model=CodexModel.GPT5
)
print(result.stdout)Claude Code Project
├── CLAUDE.md (Source of truth)
├── .claude/
│ ├── skills/
│ └── agents/
└── documentation/
↓ bridge.py
1. Safety Check
├── Codex CLI installed? ✅
└── CLAUDE.md exists? ✅ (auto-create if missing)
2. Parse & Analyze
├── Parse CLAUDE.md sections
├── Scan skills (functional vs prompt-based)
├── Scan agents
└── Analyze project structure
3. Generate AGENTS.md
├── Project overview
├── Skills documentation (Codex CLI usage)
├── Workflow patterns (slash commands → Codex)
├── MCP integration
└── Command reference
4. Write AGENTS.md
└── Output: AGENTS.md (reference-based, 19KB example)
Result: Claude Code & Codex CLI Interoperability ✅
- Auto-init: Yes (runs /init if CLAUDE.md missing)
- Output: AGENTS.md in project root
- Approach: Reference-based (no file duplication)
- Sync: One-way (CLAUDE.md → AGENTS.md)
# Disable auto-init
python bridge.py --no-auto-init
# Show status only
python bridge.py --status
# Validate only (no generation)
python bridge.py --validate# Navigate to codex-cli-bridge folder
cd generated-skills/codex-cli-bridge
# Generate AGENTS.md for claude-code-skills-factory
python bridge.py --project ../..
# Check output
cat ../../AGENTS.mdExpected Results:
- ✅ AGENTS.md created (19KB, 629 lines)
- ✅ 13 skills documented (8 functional, 5 prompt-based)
- ✅ 59 agents documented
- ✅ All file references valid
| Issue | Solution |
|---|---|
| "Codex CLI not found" | Install Codex CLI: which codex |
| "ModuleNotFoundError: yaml" | Install PyYAML: pip3 install PyYAML |
| "CLAUDE.md not found" | Let auto-init create it (default) or run /init |
| "stdout is not a terminal" | Use codex exec not plain codex (skill does this automatically) |
| AGENTS.md out of sync | Regenerate: python bridge.py |
# Show help
python bridge.py --help
# Check status
python bridge.py --status
# Validate environment
python bridge.py --validateSee HOW_TO_USE.md for comprehensive troubleshooting.
- SKILL.md - Complete skill reference
- HOW_TO_USE.md - Comprehensive usage guide
- AGENTS.md - Example output (this repository)
- Codex CLI Docs - Official Codex documentation
Scenario: Team uses both Claude Code and Codex CLI
Solution:
- Developers using Claude Code maintain CLAUDE.md
- Developers using Codex CLI use AGENTS.md
- Both files reference same skills, agents, documentation
- Bridge keeps AGENTS.md in sync
Scenario: Migrating from Claude Code to Codex CLI (or vice versa)
Solution:
- Generate AGENTS.md for existing Claude Code project
- Codex CLI users have instant documentation
- Skills remain usable (Python scripts execute directly)
- Gradual migration possible
Scenario: Auto-sync AGENTS.md when CLAUDE.md changes
Solution:
# .github/workflows/sync-agents-md.yml
on:
push:
paths: ['CLAUDE.md']
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: python /path/to/bridge.py
- run: git add AGENTS.md && git commit && git pushScenario: Share Claude Skills with Codex CLI users
Solution:
- Include both CLAUDE.md and AGENTS.md in skill package
- Claude Code users: Auto-load from CLAUDE.md
- Codex CLI users: Follow AGENTS.md documentation
- Universal compatibility
This skill was created as part of the Claude Code Skills Factory.
Improvements Welcome:
- Bidirectional sync (AGENTS.md → CLAUDE.md) - planned for v2.0
- Watch mode (auto-regenerate on file changes)
- Additional templates
- More execution helpers
Apache 2.0
v1.0.0 - Initial Release (2025-10-30)
Features:
- ✅ CLAUDE.md → AGENTS.md generation
- ✅ Reference-based architecture (no duplication)
- ✅ Safety mechanisms (Codex CLI + CLAUDE.md checks)
- ✅ Skill documentation (functional vs prompt-based)
- ✅ Codex execution helpers
- ✅ Command reference table
- ✅ Workflow patterns (Claude → Codex)
Future (v2.0):
- 🔄 Bidirectional sync
- 🔄 Watch mode
- 🔄 Additional templates
- 🔄 Plugin integration
- OpenAI - Codex CLI
- Anthropic - Claude Code
- Skills Factory - Comprehensive skill generation templates
- Issues: GitHub Issues
- Documentation: See HOW_TO_USE.md
- Examples: See AGENTS.md in this repository
Built with ❤️ for cross-tool collaboration
Claude Code ↔ Codex CLI Bridge v1.0.0