Summary
Add Codex (@openai/codex) as a third backend alongside Claude Code and OpenCode, allowing users to orchestrate Codex agents from Claudia.
Why
Codex CLI is the second-largest terminal coding agent (75K+ stars, 3M+ weekly users). Users who work across both ecosystems would benefit from managing Codex tasks in the same orchestrator. Claudia already has a CodeBackend abstraction and a working OpenCode backend, making this a natural extension.
Scope
1. CodexBackend implementation (~backend)
Create backend/src/backends/codex-backend.ts implementing CodeBackend.
Codex is PTY-based like Claude Code (interactive TUI), so this backend would closely mirror ClaudeCodeBackend:
| Concern |
Claude Code |
Codex |
Delta |
| Spawn command |
claude / node cli.js |
codex |
New spawn resolution (npm global, brew) |
| Approval modes |
--permission-mode |
--sandbox + --ask-for-approval |
Map Claudia's permission settings to Codex flags |
| Model selection |
--model claude-sonnet-4-... |
--model gpt-5.4 |
Pass through; different model namespace |
| Working dir |
cwd option on spawn |
--cd <path> flag |
Use flag instead of cwd |
| Session resume |
--resume <sessionId> |
codex resume <sessionId> |
Subcommand instead of flag |
| MCP config |
Injected via ~/.claude.json |
codex mcp add CLI or config.toml |
Different injection mechanism |
| State detection |
Pattern-match for Enter to select, Allow/Deny, spinners |
Different TUI — needs new patterns |
New detectWaitingForInput patterns for Codex |
| Session files |
~/.claude/projects/<ws>/*.jsonl |
Unknown location/format |
Research needed |
| Non-interactive |
Not available |
codex exec with --json output |
Could optionally use exec mode instead of PTY |
Key tasks:
2. Shared type updates (~shared)
3. Backend factory (~backend)
4. State detection (~backend)
5. Configuration (~backend + frontend)
6. MCP injection (~backend)
7. Frontend backend selector (~frontend)
8. Task persistence (~backend)
Out of scope (future work)
codex exec (non-interactive) mode — structured JSON-streaming exec mode for headless/CI tasks
codex cloud — cloud-hosted Codex environments
- Codex SDK — programmatic API as alternative to PTY spawning
- Cross-agent collaboration — Claude Code and Codex tasks communicating
Open questions
- State detection patterns: Need to run Codex interactively and document its TUI output patterns. The Rust-based TUI likely has different spinners, prompt formats, and ANSI sequences.
- Session file format: Where does Codex store conversation history? Is it resumable the same way?
- MCP injection: What's the cleanest way to inject Claudia's MCP server into a Codex session? Does
config.toml support per-session MCP overrides?
- Auth flow: Codex supports ChatGPT OAuth login and API keys. Claudia would need to support at least API key mode (
CODEX_API_KEY). OAuth would require a separate flow.
- Model tiering: Codex models (GPT-5.4, GPT-5.3-Codex) are a different namespace. The model tiering feature needs to support both namespaces or be backend-aware.
Estimated effort
- Phase 1 (MVP — PTY backend + basic state detection): Medium — follows
ClaudeCodeBackend pattern, state detection research is the bottleneck
- Phase 2 (MCP injection, settings UI, model tiering): Medium — integration across backend + frontend
- Phase 3 (exec mode, session history, polish): Small-medium
References
Summary
Add Codex (
@openai/codex) as a third backend alongside Claude Code and OpenCode, allowing users to orchestrate Codex agents from Claudia.Why
Codex CLI is the second-largest terminal coding agent (75K+ stars, 3M+ weekly users). Users who work across both ecosystems would benefit from managing Codex tasks in the same orchestrator. Claudia already has a
CodeBackendabstraction and a working OpenCode backend, making this a natural extension.Scope
1.
CodexBackendimplementation (~backend)Create
backend/src/backends/codex-backend.tsimplementingCodeBackend.Codex is PTY-based like Claude Code (interactive TUI), so this backend would closely mirror
ClaudeCodeBackend:claude/node cli.jscodex--permission-mode--sandbox+--ask-for-approval--model claude-sonnet-4-...--model gpt-5.4cwdoption on spawn--cd <path>flag--resume <sessionId>codex resume <sessionId>~/.claude.jsoncodex mcp addCLI or config.tomlEnter to select,Allow/Deny, spinnersdetectWaitingForInputpatterns for Codex~/.claude/projects/<ws>/*.jsonlcodex execwith--jsonoutputKey tasks:
codex, brew, etc.)TaskConfigfields to codex CLI flags (--sandbox,--model,--cd,--image)codex resume <id>codex execas an alternative non-interactive mode (optional, Phase 2)2. Shared type updates (~shared)
'codex'toBackendTypeunion inshared/src/index.tsBACKEND_INFOregistry inbackend/src/backends/types.ts3. Backend factory (~backend)
case 'codex'increateBackend()inbackend/src/backends/index.ts4. State detection (~backend)
codex-state-detection.ts(or parameterize existing)5. Configuration (~backend + frontend)
CODEX_API_KEYenv var or ChatGPT OAuth6. MCP injection (~backend)
codex mcp add), but injection mechanism differs from Claude Code's~/.claude.json~/.codex/config.tomlbefore spawn, (b) pass MCP config via CLI flags, or (c) use env vars7. Frontend backend selector (~frontend)
8. Task persistence (~backend)
backendType: 'codex'already supported in persistence schemaOut of scope (future work)
codex exec(non-interactive) mode — structured JSON-streaming exec mode for headless/CI taskscodex cloud— cloud-hosted Codex environmentsOpen questions
config.tomlsupport per-session MCP overrides?CODEX_API_KEY). OAuth would require a separate flow.Estimated effort
ClaudeCodeBackendpattern, state detection research is the bottleneckReferences
backend/src/backends/types.tsbackend/src/backends/opencode-backend.ts