How madhav-gohel/codex-plusplus works
Project type and purpose
• This is an open-source, full-featured CLI tool named OpenAI Codex CLI. It lives in a monorepo but the core package is under codex-cli/.
• It’s a terminal-based coding agent that:
• Parses user commands/prompts
• Streams prompts to the OpenAI Responses API
• Renders an interactive text UI in your terminal
• Applies patch-based file modifications and/or executes shell commands under a sandbox
• Manages state (e.g., memory, config, approval mode)
File structure
• Top-level package: codex-cli/
• bin/codex.js – Node-executable entrypoint
• src/ – TypeScript sources organized by feature:
– components/ – React-style TUI components for chat, overlays, editors
– utils/ – Helpers (API client, sandbox adapters, token counting, parsers, file ops, storage)
– hooks/ – React hooks for terminal state
– app.tsx, cli.tsx – Main CLI application and argument parsing
• scripts/ – OS sandbox or Docker helper scripts
• examples/ – Recipe templates that demonstrate extensibility points
• tests/ – Vitest + snapshot tests covering agent behaviors, UI, utils
• Config/build: vite.config.ts, tsconfig.json, .eslintrc.cjs, Husky hooks
Insights from the README
• Core flows described: interactive REPL, non-interactive/CI mode, approval modes
• Security model: sandboxing via Apple Seatbelt (macOS) or Docker+iptables (Linux)
• Extensibility: custom recipes (examples/), project-wide docs (codex.md), user config (~/.codex/)
• Tech stack: Node 22+, TypeScript, Vite, Vitest, ESLint, Prettier, Husky, pnpm, optional Nix flake
Detail
• Break out subcomponents where meaningful (e.g., chat renderer vs input parser)
• Both interactive and CI-mode flows
• sandbox attachments to the agent core (seatbelt vs Docker)
• Config/state stores and how they influence agent behavior (approval mode, memory)