This page covers the layout of the Rust Cargo workspace located at codex-rs/, including crate membership, shared dependency management, and the integration of specialized build tooling like Bazel.
The workspace is defined in codex-rs/Cargo.toml codex-rs/Cargo.toml1-129 It uses Cargo's resolver = "2" codex-rs/Cargo.toml130 for feature resolution and sets a shared [workspace.package] block codex-rs/Cargo.toml132-140 that member crates inherit. This centralized configuration ensures that the Rust edition and license remain consistent across all 120+ crates.
| Field | Value |
|---|---|
resolver | "2" codex-rs/Cargo.toml130 |
version | "0.0.0" (all crates share the same in-development version) codex-rs/Cargo.toml133 |
edition | "2024" codex-rs/Cargo.toml138 |
license | "Apache-2.0" codex-rs/Cargo.toml139 |
Sources: codex-rs/Cargo.toml1-140
The workspace contains over 120 member crates codex-rs/Cargo.toml2-129 These are organized into several functional groups, ranging from the core agent logic to platform-specific utilities.
Core Logic and Engine
| Path in workspace | Crate name | Role |
|---|---|---|
core | codex-core | Central agent engine, thread management, and session logic codex-rs/core/src/lib.rs1-203 |
protocol | codex-protocol | Shared Op/Event protocol types codex-rs/Cargo.toml80 |
config | codex-config | Configuration loading and validation codex-rs/Cargo.toml34 |
rollout | codex-rollout | Session persistence and event replay codex-rs/core/src/lib.rs133 |
models-manager | codex-models-manager | Model discovery and info resolution codex-rs/Cargo.toml76 |
User Interfaces
| Path in workspace | Crate name | Role |
|---|---|---|
cli | codex-cli | The primary codex multitool binary codex-rs/Cargo.toml31 |
tui | codex-tui | Interactive Terminal User Interface codex-rs/tui/Cargo.toml2-5 |
exec | codex-exec | Headless execution mode for automation codex-rs/Cargo.toml46 |
app-server | codex-app-server | JSON-RPC server for IDE integrations codex-rs/Cargo.toml11 |
Tooling and Infrastructure
| Path in workspace | Crate name | Role |
|---|---|---|
codex-mcp | codex-mcp | Model Context Protocol (MCP) client logic codex-rs/Cargo.toml71 |
mcp-server | codex-mcp-server | Implementation of Codex as an MCP server codex-rs/Cargo.toml72 |
sandboxing | codex-sandboxing | Cross-platform sandbox abstractions codex-rs/Cargo.toml87 |
shell-command | codex-shell-command | Shell execution backend codex-rs/Cargo.toml36 |
otel | codex-otel | OpenTelemetry integration codex-rs/Cargo.toml89 |
Sources: codex-rs/Cargo.toml2-129 codex-rs/core/src/lib.rs1-203 codex-rs/tui/Cargo.toml1-20
The following diagrams bridge high-level system components to their implementation crates and entry points.
Crate-to-Binary Mapping
Sandbox Dispatch Mapping
Sources: codex-rs/tui/Cargo.toml8-15 codex-rs/core/Cargo.toml11-14 codex-rs/cli/src/main.rs90-120 codex-rs/cli/src/debug_sandbox.rs45-162 codex-rs/core/Cargo.toml82
The workspace uses a "single source of truth" for dependencies. All shared external and internal dependencies are defined in the root Cargo.toml codex-rs/Cargo.toml141-221 and inherited by member crates.
Dependency Flow
Internal dependencies are mapped to their relative paths in the root manifest:
codex-core = { path = "core" } codex-rs/Cargo.toml177codex-protocol = { path = "protocol" } codex-rs/Cargo.toml222Member crates reference them using the workspace = true syntax:
codex-core = { workspace = true } codex-rs/core/Cargo.toml34codex-protocol = { workspace = true } codex-rs/core/Cargo.toml59Sources: codex-rs/Cargo.toml141-221 codex-rs/core/Cargo.toml1-125
In addition to Cargo, the project uses Bazel for hermetic builds and cross-compilation.
gnullvm MODULE.bazel7-27patches/ directory contains Bazel dependency patches for Windows/cross-compilation MODULE.bazel12-16codex_rust_crate) and handling Windows-specific linker flags defs.bzl10-26 defs.bzl181-192codex-write-config-schema codex-rs/core/Cargo.toml12-13 generates JSON schemas for validation of config.toml.2024 edition for new workspace crates codex-rs/Cargo.toml138Sources: MODULE.bazel1-210 codex-rs/core/Cargo.toml11-14 codex-rs/Cargo.lock1-100 MODULE.bazel.lock1-60 defs.bzl1-192
Refresh this wiki
This wiki was recently refreshed. Please wait 5 days to refresh again.