Building the Rust Implementation
The Rust implementation is the maintained version of Codex CLI and lives incodex-rs/.
Quick Start
1
Navigate to Workspace
2
Build with Cargo
3
Run the TUI
Launch the TUI with a sample prompt:
Build-Related Commands
After making changes, use these workspace helpers:Workspace Organization
Thecodex-rs/ directory is a Cargo workspace with these key crates:
For detailed information about each crate, read the module-level
README.md files under each crate directory.Building the TypeScript Implementation
The legacy TypeScript CLI lives incodex-cli/.
1
Navigate to CLI Directory
2
Build with pnpm
3
Run Locally
TypeScript Build Commands
Debugging
Debugging the Rust CLI
1
Enable Verbose Logging
Set the
RUST_LOG environment variable:2
View TUI Logs
The TUI logs to Override the log directory with:
~/.codex/log/codex-tui.log by default:RUST_LOG environment variable details
RUST_LOG environment variable details
The TUI defaults to
RUST_LOG=codex_core=info,codex_tui=info,codex_rmcp_client=info.Non-interactive mode (codex exec) defaults to RUST_LOG=error with messages printed inline.See the Rust documentation on RUST_LOG for more configuration options.Debugging the TypeScript CLI
1
Build with Source Maps
cli.js.map alongside cli.js in the dist folder.2
Run with Debugger
3
Attach Debugger
Choose one:
- VS Code: Run Debug: Attach to Node Process from the command palette and select the option with debug port
9229 - Chrome: Go to
chrome://inspectand find localhost:9229, then click inspect
Enable Debug Output
For the TypeScript CLI, enable full API request and response logging:Troubleshooting
Build fails with missing dependencies
Build fails with missing dependencies
Ensure all required tools are installed:
Tests fail after building
Tests fail after building
Make sure you’re running tests from the correct directory:
- Rust: Run from
codex-rs/ - TypeScript: Run from
codex-cli/
Format or lint errors
Format or lint errors
Run the automatic fixers:
Next Steps
Testing
Learn about testing workflows
Guidelines
Review coding standards