codex-cli-bridge

Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools

16 stars

Best use case

codex-cli-bridge is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools

Teams using codex-cli-bridge should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/codex-cli-bridge-majiayu000/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/data-ai/codex-cli-bridge-majiayu000/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/codex-cli-bridge-majiayu000/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How codex-cli-bridge Compares

Feature / Agentcodex-cli-bridgeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Codex CLI Bridge Skill

## Purpose

This skill creates a comprehensive bridge between **Claude Code** and **OpenAI's Codex CLI**, enabling seamless interoperability through:

1. **Documentation Translation**: Converts CLAUDE.md → AGENTS.md (reference-based, no file duplication)
2. **Execution Helpers**: Python wrappers for Codex CLI commands (always uses `codex exec`)
3. **Skill Documentation**: Makes Claude Skills accessible to Codex CLI users

## Key Capabilities

### 1. CLAUDE.md → AGENTS.md Generation
- Parses CLAUDE.md and project structure
- Scans `.claude/skills/`, `.claude/agents/`, `documentation/` folders
- Generates comprehensive AGENTS.md with file path references
- **Reference-based**: No file duplication, only links to existing files
- Documents Skills with most relevant usage method (bash scripts vs prompt references)

### 2. Safety Mechanism
- **Auto-checks Codex CLI installation** (`codex --version`)
- **Auto-runs `/init`** if CLAUDE.md missing (with user notification)
- Validates authentication and environment
- User-friendly error messages

### 3. Codex CLI Execution Helpers
- `exec_analysis()` - Read-only analysis tasks (gpt-5, read-only sandbox)
- `exec_edit()` - Code editing tasks (gpt-5-codex, workspace-write)
- `exec_with_search()` - Web search-enabled tasks
- `resume_session()` - Continue last Codex session
- **Always uses `codex exec`** (never plain `codex` - critical for Claude Code)

### 4. Skill Documentation for Codex CLI
- **Prompt-only skills**: Show how to reference in Codex prompts
- **Functional skills**: Show how to execute Python scripts directly
- **Complex skills**: Show both methods
- Includes proper `codex exec` command syntax
- Model selection guidance (gpt-5 vs gpt-5-codex)

## Input Requirements

### For AGENTS.md Generation
```json
{
  "action": "generate-agents-md",
  "project_root": "/path/to/project",
  "options": {
    "validate_codex": true,
    "auto_init": true,
    "include_mcp": true,
    "skill_detail_level": "relevant"
  }
}
```

### For Codex Execution
```json
{
  "action": "codex-exec",
  "task_type": "analysis|edit|search",
  "prompt": "Your task description",
  "model": "gpt-5|gpt-5-codex",
  "sandbox": "read-only|workspace-write|danger-full-access"
}
```

## Output Formats

### AGENTS.md Structure
```markdown
# AGENTS.md

## Project Overview
[From CLAUDE.md]

## Available Skills
### Skill Name
**Location**: `path/to/skill/`
**Using from Codex CLI**: [Most relevant method]

## Workflow Patterns
[Slash commands → Codex equivalents]

## MCP Integration
[MCP server references]

## Command Reference
| Claude Code | Codex CLI |
|-------------|-----------|
[Mappings]
```

### Execution Helper Output
```python
{
  "status": "success|error",
  "output": "Command output",
  "session_id": "uuid",
  "model_used": "gpt-5|gpt-5-codex",
  "command": "codex exec ..."
}
```

## Python Scripts

### safety_mechanism.py
- Check Codex CLI installation
- Validate CLAUDE.md exists (auto-run /init if missing)
- Environment validation
- User notifications

### claude_parser.py
- Parse CLAUDE.md sections
- Scan skills, agents, commands
- Extract quality gates and MCP configuration
- Return file paths only (no content duplication)

### project_analyzer.py
- Auto-detect project structure
- Discover all Claude Code assets
- Generate project metadata
- Build reference map

### agents_md_generator.py
- Template-based AGENTS.md generation
- File path references (no duplication)
- Skill documentation (most relevant method)
- Workflow translation (Claude → Codex)

### skill_documenter.py
- Document skills for Codex CLI users
- Determine most relevant usage method per skill type
- Generate bash examples for Python scripts
- Create Codex prompt templates

### codex_executor.py
- Python wrappers for Codex CLI commands
- Intelligent model selection (gpt-5 vs gpt-5-codex)
- Sandbox mode helpers
- Session management
- **Always uses `codex exec`**

## Usage Examples

### Example 1: Generate AGENTS.md

**User prompt**:
```
Generate AGENTS.md for this project
```

**What happens**:
1. Safety mechanism checks Codex CLI installed
2. Checks CLAUDE.md exists (auto-runs /init if missing)
3. Parses CLAUDE.md and project structure
4. Generates AGENTS.md with file references
5. Documents all skills with most relevant usage method

**Output**: Complete AGENTS.md file in project root

---

### Example 2: Execute Codex Analysis Task

**User prompt**:
```
Use Codex to analyze this codebase for security vulnerabilities
```

**What happens**:
```python
from codex_executor import CodexExecutor

executor = CodexExecutor()
result = executor.exec_analysis(
    "Analyze this codebase for security vulnerabilities",
    model="gpt-5"
)
```

**Executes**:
```bash
codex exec -m gpt-5 -s read-only \
  -c model_reasoning_effort=high \
  "Analyze this codebase for security vulnerabilities"
```

---

### Example 3: Execute Codex Code Editing

**User prompt**:
```
Use Codex to refactor main.py for better async patterns
```

**What happens**:
```python
executor = CodexExecutor()
result = executor.exec_edit(
    "Refactor main.py for better async patterns",
    model="gpt-5-codex"
)
```

**Executes**:
```bash
codex exec -m gpt-5-codex -s workspace-write \
  -c model_reasoning_effort=high \
  "Refactor main.py for better async patterns"
```

---

### Example 4: Resume Codex Session

**User prompt**:
```
Continue the previous Codex session
```

**What happens**:
```python
executor = CodexExecutor()
result = executor.resume_session()
```

**Executes**:
```bash
codex exec resume --last
```

## Best Practices

### For AGENTS.md Generation
1. **Always run on projects with CLAUDE.md** (or let auto-init create it)
2. **Validate Codex CLI installed first**
3. **Keep skills documented with most relevant method** (bash vs prompt)
4. **Use reference-based approach** (no file duplication)

### For Codex Execution
1. **Use `codex exec` always** (never plain `codex` in Claude Code)
2. **Choose correct model**:
   - `gpt-5`: General reasoning, architecture, analysis
   - `gpt-5-codex`: Code editing, specialized coding tasks
3. **Choose correct sandbox**:
   - `read-only`: Safe analysis (default)
   - `workspace-write`: File modifications
   - `danger-full-access`: Network access (rarely needed)
4. **Enable search when needed** (`--search` flag)

### For Skill Documentation
1. **Prompt-only skills**: Reference in Codex prompts
2. **Functional skills**: Execute Python scripts directly
3. **Complex skills**: Show both methods
4. **Always provide working examples**

## Command Integration

This skill integrates with existing Claude Code commands:

- **`/init`**: Auto-generates AGENTS.md after CLAUDE.md creation
- **`/update-claude`**: Regenerates AGENTS.md when CLAUDE.md changes
- **`/check-docs`**: Validates AGENTS.md exists and is in sync
- **`/sync-agents-md`**: Manual AGENTS.md regeneration
- **`/codex-exec <task>`**: Wrapper using codex_executor.py

## Installation

### Prerequisites
1. **Codex CLI installed**:
   ```bash
   codex --version  # Should show v0.48.0 or higher
   ```

2. **Codex authenticated**:
   ```bash
   codex login
   ```

3. **Claude Code v1.0+**

### Install Skill

**Option 1: Copy to project**
```bash
cp -r generated-skills/codex-cli-bridge ~/.claude/skills/
```

**Option 2: Use from this repository**
```bash
# Skill auto-discovered when Claude Code loads this project
```

## Troubleshooting

### Error: "Codex CLI not found"
**Solution**: Install Codex CLI and ensure it's in PATH
```bash
which codex  # Should return path
codex --version  # Should work
```

### Error: "CLAUDE.md not found"
**Solution**: Skill auto-runs `/init` with notification. If it fails:
```bash
# Manually run /init
/init
```

### Error: "stdout is not a terminal"
**Solution**: Always use `codex exec`, never plain `codex`
```bash
❌ codex -m gpt-5 "task"
✅ codex exec -m gpt-5 "task"
```

### AGENTS.md Out of Sync
**Solution**: Regenerate manually
```bash
/sync-agents-md
```

## References

- **Codex CLI Docs**: `openai-codex-cli-instructions.md`
- **Claude Skills Docs**: `claude-skills-instructions.md`
- **Example Skills**: `claude-skills-examples/codex-cli-skill.md`
- **AGENTS.md Spec**: https://agents.md/

## Version

**v1.0.0** - Initial release (2025-10-30)

## License

Apache 2.0

---

**Created by**: Claude Code Skills Factory
**Maintained for**: Cross-tool team collaboration (Claude Code ↔ Codex CLI)
**Sync Status**: Reference-based bridge (one-way sync: CLAUDE.md → AGENTS.md)

Related Skills

julien-workflow-advice-codex

16
from diegosouzapw/awesome-omni-skill

Get OpenAI Codex CLI's opinion on code, bugs, or implementation. Use when you want a second AI perspective during coding sessions.

consult-codex

16
from diegosouzapw/awesome-omni-skill

Compare OpenAI Codex GPT-5.2 and code-searcher responses for comprehensive dual-AI code analysis. Use when you need multiple AI perspectives on code questions.

codex-team

16
from diegosouzapw/awesome-omni-skill

Use when you have 2+ tasks that Codex agents should execute. Runtime-native: Codex sub-agents when available, Codex CLI fallback otherwise. Handles file conflicts via merge/wave strategies. Triggers: "codex team", "spawn codex", "codex agents", "use codex for", "codex fix".

codex

16
from diegosouzapw/awesome-omni-skill

Run OpenAI's Codex CLI agent in non-interactive mode using `codex exec`. Use when delegating coding tasks to Codex, running Codex in scripts/automation, or when needing a second agent to work on a task in parallel.

codex-sessions-skill-scan

16
from diegosouzapw/awesome-omni-skill

Daily skill health scan: analyze ~/.codex/sessions plus per-repo session logs under ~/dev (default last 1 day) and summarize skill invocations + likely failures for personal skills in ~/dev/agent-skills (missing paths, tool failures, complex-task word triggers). Optional: include best-effort local OTel signals.

codex-reviewer

16
from diegosouzapw/awesome-omni-skill

Use OpenAI's Codex CLI as an independent code reviewer to provide second opinions on code implementations, architectural decisions, code specifications, and pull requests. Trigger when users request code review, second opinion, independent review, architecture validation, or mention Codex review. Provides unbiased analysis using GPT-5-Codex model through the codex exec command for non-interactive reviews.

codex-review

16
from diegosouzapw/awesome-omni-skill

Two-pass adversarial review of design documents and implementation plans using OpenAI Codex CLI. Invokes Codex to review plans section-by-section (pass 1), then holistically (pass 2), feeding critique back for revision. Use when you have a design doc, architecture plan, or implementation plan that should be stress-tested before execution.

codex-advisor

16
from diegosouzapw/awesome-omni-skill

Get a second opinion from OpenAI Codex CLI for plan reviews, code reviews, architecture decisions, and hard problems. Use when you need external validation, want to compare approaches, or are stuck on a difficult problem.

arweave-bridge

16
from diegosouzapw/awesome-omni-skill

ZigZag Exchange Arweave Bridge - Pay with zkSync stablecoins (USDC/USDT/DAI) for permanent Arweave storage. Use for building dApps needing decentralized file storage, NFT metadata permanence, or Layer 2 storage solutions.

add-nodebridge-handler

16
from diegosouzapw/awesome-omni-skill

Use this skill when adding a new NodeBridge handler to src/nodeBridge.ts, including updating types in src/nodeBridge.types.ts and optionally testing with scripts/test-nodebridge.ts

plan-refine-codex

16
from diegosouzapw/awesome-omni-skill

Refine a Claude Code plan using OpenAI Codex. Use when you have a plan file and want a second opinion or to improve robustness.

codex-headless

16
from diegosouzapw/awesome-omni-skill

Delegiere Aufgaben an OpenAI Codex CLI im Headless-Mode. Nutzt ChatGPT Subscription (KEIN API Key). Nur Workspace-Zugriff, KEIN System-Zugriff. Auto-Accept mit --full-auto. Web-Recherche mit --search.