How zeromac/codex works
Codex CLI is a local coding agent: a user starts a session, supplies a coding task, and receives streamed responses and workspace changes. The visible tree indicates a Rust runtime with terminal and app-server interfaces, thread and model management, command execution with sandboxing, authentication, and optional MCP/plugin integrations. The README establishes the product and local workflow; most Rust implementation files were not sampled, so the graph uses tree-supported module paths and omits uncertain internal call links.
Main entry points: core/src Thread manager · tui/src Terminal UI · process_manager.rs Command execution · codex-mcp/src MCP connections
Components 18
User interfaces
- CLI launcher
codex-cli/bin/codex.js - Terminal UI
codex-rs/tui/src - App server
codex-rs/app-server-daemon/src - App protocol
codex-rs/app-server-protocol/src
Agent runtime
- Thread manager
codex-rs/core/src - Stream rendering
codex-rs/tui/src/streaming/controller.rs - Conversation memory
codex-rs/memories/write/src/storage.rs
Workspace execution
- Command execution
codex-rs/core/src/unified_exec/process_manager.rs - Sandbox policy
codex-rs/sandboxing/src/manager.rs - Local workspace
Accounts and models
- Model manager
codex-rs/models-manager/src - Authentication
codex-rs/login/src/auth/storage.rs - Analytics
codex-rs/analytics/src
Extensions
- MCP connections
codex-rs/codex-mcp/src - Plugins
codex-rs/core-plugins/src
Other components
- User
- Model service
- MCP servers
Connections 19
- User → CLI launcher: starts
- CLI launcher → Terminal UI: opens
- User → Terminal UI: enters task
- Terminal UI → Thread manager: submits task
- Thread manager → Stream rendering: streams response
- Stream rendering → Terminal UI: renders
- Thread manager → Model manager: requests model
- Model manager → Model service: fetches models
- Thread manager → Command execution: runs commands
- Command execution → Sandbox policy: applies policy
- Command execution → Local workspace: reads and writes
- Thread manager → Conversation memory: stores memories
- Thread manager → Authentication: uses credentials
- Thread manager → Analytics: records events
- Thread manager → MCP connections: uses tools
- MCP connections → MCP servers: connects
- Plugins → MCP connections: configures servers
- User → App server: connects
- App server → App protocol: exchanges messages