How 0xsero/codex-local works
Codex-Local is an interactive coding-agent CLI, extended for configurable providers and multi-agent work. The main workflow starts at the CLI, accepts a prompt through the terminal UI, runs a conversation using the model and tool system, and presents streamed results. Tool handlers cover repository inspection and modification, command execution, and external MCP tools; agents can be spawned and report progress. The tree and excerpts support the principal entry points and internal layers; several feature links reflect README documentation rather than inspected implementation.
Main entry points: conversation_manager.rs Conversation manager · codex_conversation.rs Agent conversation · mod.rs Tool handlers · chatwidget.rs Chat interface
Components 23
CLI and Interface
- CLI dispatch
codex-rs/cli/src/main.rs - Terminal UI
codex-rs/tui/src/app.rs - Chat interface
codex-rs/tui/src/chatwidget.rs - Stream rendering
codex-rs/tui/src/streaming/controller.rs
Agent Runtime
- Configuration
codex-rs/core/src/config.rs - Conversation manager
codex-rs/core/src/conversation_manager.rs - Agent conversation
codex-rs/core/src/codex_conversation.rs - Model client
codex-rs/core/src/client.rs - Session history
codex-rs/core/src/rollout/recorder.rs
Tools and Execution
- Tool registry
codex-rs/core/src/tools/registry.rs - Tool router
codex-rs/core/src/tools/router.rs - Tool handlers
codex-rs/core/src/tools/handlers/mod.rs - Command execution
codex-rs/core/src/exec_command/session_manager.rs - Sandbox controls
codex-rs/core/src/executor/sandbox.rs
Agents and Integrations
- Agent tools
codex-rs/core/src/tools/handlers/spawn_agent.rs - Child agent bridge
codex-rs/core/src/child_agent_bridge.rs - Agent orchestration
codex-rs/orchestrator/src/runtime.rs - MCP connections
codex-rs/core/src/mcp_connection_manager.rs - Authentication
codex-rs/core/src/auth.rs - Telemetry events
codex-rs/otel/src/otel_event_manager.rs
Other components
- CLI user
- Model provider
- MCP servers
Connections 24
- CLI user → CLI dispatch: starts command
- CLI dispatch → Terminal UI: launches UI
- Terminal UI → Chat interface: routes events
- Chat interface → Conversation manager: submits prompt
- Chat interface → Stream rendering: renders deltas
- Conversation manager → Configuration: uses settings
- Conversation manager → Agent conversation: spawns conversation
- Agent conversation → Model client: requests response
- Model client → Model provider: sends requests
- Conversation manager → Session history: resumes sessions
- Agent conversation → Session history: records rollout
- Agent conversation → Tool registry: loads tools
- Tool registry → Tool router: dispatches tools
- Tool router → Tool handlers: routes calls
- Tool handlers → Command execution: runs commands
- Command execution → Sandbox controls: applies isolation
- Tool handlers → MCP connections: invokes MCP tools
- MCP connections → MCP servers: calls tools
- Tool handlers → Agent tools: handles agent calls
- Agent tools → Agent orchestration: spawns agents
- Agent orchestration → Conversation manager: creates conversations
- Agent tools → Child agent bridge: reports progress
- Conversation manager → Authentication: uses credentials
- Agent conversation → Telemetry events: emits events