Codex CLI(AI IDE 平台市场研究)
1. 介绍
Codex CLI 是 OpenAI 的开源编码智能体工具,也是本组六个平台中唯一把沙箱与审批机制完整开源的一个。2025-04-17 以 TypeScript 实现首次开源发布;2025-05-30 宣布以 Rust 重写并很快完成,TypeScript 版本进入维护状态;2025-05-16 起配套的云端 Codex(研究预览)新增互联网访问、任务追踪与变更审核,同年 6 月向 ChatGPT Pro / Enterprise / Team 用户开放。
它的独特价值不在单点能力,而在透明度:沙箱怎么搭、审批怎么分、配置怎么生效,全部落在可读的源码与配置文件里。对研究 AI Harness 的人而言,Codex CLI 是 L2(工具与执行)与 L6(治理与安全)的参考实现——本组 README 的对比矩阵把它评为「沙箱 + 审批正交 + 配置即策略」,这三件事构成了本篇的主线。
1.1. 开发商与产品沿革
| 项目 | 内容 |
|---|---|
| 开发商 | OpenAI |
| 开源首发 | 2025-04-17(TypeScript 实现,Apache 2.0) |
| 云端研究预览 | 2025-05-16,新增互联网访问、任务追踪与变更审核 |
| Rust 重写 | 2025-05-30 宣布,2025-06 完成;TypeScript 版进入维护状态 |
| 版本节奏 | 2026-08 处于 rust-v0.150.x 系列( 当期最新版) |
| 工程规模 | 10,000+ commits、640+ tagged releases、约 400 contributors、GitHub stars 超过 100K(第三方统计) |
| 默认模型 | GPT-5.6 家族(第三方口径) |
1.2. 定位与最新版本
Codex CLI 的定位是开源、终端优先、以沙箱与审批为骨架的编码智能体。与 Claude Code 的区别在于三点:其一,开源(Apache 2.0),执行栈可审计、可自行构建;其二,权限模型是显式的二维设计——「沙箱管技术上能碰什么,审批管何时停下来问」;其三,多界面共享同一核心,CLI、VS Code 扩展、桌面端与 Web 端经由同一个 app-server 协议复用同一套 Codex Core。
2026-09 的版本线(官方 Changelog 口径,经第三方汇总核对,B级):GPT-6 Astra 自 v0.153.4 起成为 Codex 默认模型;0.154.0(09-09)将 GPT-6 Astra 纳入模型选择器并登陆 Amazon Bedrock,新增实验性 worktree 支持与任务中途内联提问;/plugins 将远程插件分为 OpenAI Curated / Workspace / Shared-with-me 三区并可在回合中途主动推荐安装;引入可配置的 rollout token 预算——跨智能体线程追踪支出、余量提醒并在耗尽时中止回合。更早的标签序列锚点为 rust-v0.150.x(2026-08)。
1.3. 定价体系
Codex CLI 本体免费开源,用量计入 OpenAI 付费计划:
| 档位 | 价格 | 与 Codex 的关系 |
|---|---|---|
| 使用前提 | 需 ChatGPT 付费计划或 API Key | 具体档位权益与配额未在检索到的官方页完整给出,标 |
| ChatGPT Plus | $20/月起(第三方口径) | 含 Codex 用量额度 |
| Business / Enterprise | 定制 | 组织级使用与治理能力 |
| API Key 模式 | 按 token 计费 | 无订阅用户的选择,成本随用量线性增长 |
计费结构的工程含义:与 Claude Code 相同,订阅制使长任务成本可预测,跑飞的代理循环不会带来意外账单;这是终端型工具在 CI 与批量场景中的成本优势。
2. 名词解释
| 术语 | 英文 / 缩写 | 释义 |
|---|---|---|
| 沙箱 | Sandbox | 限制代理「技术上能碰什么」的操作系统级隔离层;macOS 用 Seatbelt,Linux 用 bubblewrap 与 Landlock + seccomp,Windows 用 Job Objects |
| Seatbelt | Seatbelt | Apple 提供的沙箱机制,macOS 12+ 上经 sandbox-exec -p <profile> 限定进程的文件与网络访问 |
| bubblewrap | bubblewrap | Linux 上的轻量容器化沙箱工具,与 Landlock / seccomp 配合构成 Codex CLI 的 Linux 隔离方案 |
| Landlock | Landlock | Linux 内核提供的非特权访问控制机制,可在无 root 权限下限定进程可访问的文件系统范围 |
| 沙箱模式 | sandbox_mode | 配置项,取值 read-only / workspace-write / danger-full-access,决定文件系统与网络的可触达范围 |
| 审批模式 | Approval Mode | 决定代理「何时停下来问人」的档位;早期版本为 suggest / auto-edit / full-auto 三级 |
| suggest 模式 | Suggest | 早期审批档位:所有改动与命令均需人工确认 |
| auto-edit 模式 | Auto-Edit | 早期审批档位:文件改动自动应用,命令执行仍需确认 |
| full-auto 模式 | Full-Auto | 早期审批档位:改动与命令在沙箱内自动执行;2026-04 起该 flag 被弃用,改由 profiles 加显式信任提示授权 |
| 审批策略 | approval_policy | 现行配置项,取值 untrusted / on-request / never,与 sandbox_mode 正交配置 |
| 项目说明书 | AGENTS.md | 项目级 Agent 指令文件,按全局 → 仓库根 → 当前目录三层发现与合并 |
| 响应式接口 | Responses API | OpenAI 面向智能体的模型调用接口,支持多轮工具调用与状态延续,是 Codex 的模型层依赖 |
| 配置文件 | config.toml | ~/.codex/config.toml(或 $CODEX_HOME)中的 TOML 配置,承载沙箱、审批、模型与 MCP 配置;项目级可在仓库根 .codex/config.toml 覆盖 |
| 配置档位 | Profiles | 把一整套沙箱、审批与模型配置命名化的机制(如 codex --profile careful) |
| 非交互执行 | codex exec | 无终端交互的 headless 运行模式,用于 CI 与脚本 |
| 应用服务协议 | app-server | JSON-RPC over stdio 的协议服务,使 CLI / VS Code / Desktop / Web 共享同一 Codex Core |
| 守护子代理 | guardian subagent | 2026-04 引入的轻量子代理,对待执行动作做审查而非照单批准 |
| 模型上下文协议 | MCP(Model Context Protocol) | 外部工具接入协议,配置写在 config.toml 的 mcp_servers 段(TOML 而非 JSON) |
3. 功能说明
3.1. 交互模式
| 模式 | 命令 | 场景 |
|---|
| 交互式 TUI | codex 或 codex “任务描述” | 日常开发,逐条审批或按 profile 授权 |
|---|---|---|
| 非交互执行 | codex exec “任务描述” | CI、脚本、夜间批量任务;需显式配置审批与沙箱 |
codex resumecodex --search/init、/status、/permissions、/model、/review3.2. 沙箱与审批能力
Codex CLI 的权限模型由两个独立旋钮构成,这一设计是本篇的核心,详见 5.2 与 5.6 的完整拆解。概要如下:
- sandbox_mode:
read-only(只读)、workspace-write(仅工作区可写,网络默认关闭)、danger-full-access(无隔离)。 - approval_policy:
untrusted(默认拒绝并请求批准)、on-request(代理可按需申请提权)、never(从不打断)。 - 早期的
--suggest/--auto-edit/--full-auto三级审批模式在 2026-04 起被 profiles + 显式信任提示的机制取代,旧 flag 明确弃用。
3.3. 扩展与集成能力
- MCP:在
~/.codex/config.toml的mcp_servers段配置(TOML 格式);2026 年起默认启用 tool search,大型 MCP 服务器的工具定义不再全量灌入上下文;codex mcp可把 Codex 自身作为 MCP server 供其他智能体调用。 - 多代理:MultiAgentV2 配置提供线程上限、深度与等待时间控制、root / subagent 提示分离。
- 持久化目标:
/goal把长期目标持久化到 app-server,可创建、暂停、恢复与清理。 - 桌面端:可自主操作 macOS 桌面应用(独立光标、看屏、点击、输入),内置浏览器,新增记忆(保存偏好、常用工作流与技术栈),并能自主调度未来数天至数周的工作计划(第三方口径)。
- 自更新与插件:
codex update自更新;插件市场、远程插件缓存与 hook 开关。
4. 平台架构
图 4-1|Codex CLI 平台总体架构:多界面共享单一核心,沙箱为独立可替换层
数据来源:基于本文分析绘制的示意图。
4.1. 总体架构
仓库结构与三层本质(第三方对开源代码的分析,与官方仓库结构一致):
openai/codex/
├── codex-rs/ # Rust 主代码库(约 95.6%)
│ ├── core/ # Agent Loop / Session / TurnContext / 上下文管理
│ ├── tui/ 与 tui2/ # 终端 UI
│ ├── protocol/ # Op / Event 枚举,客户端与服务端共享
│ ├── mcp/ # MCP client 与工具调度
│ ├── exec/ # 非交互 headless 模式(CI 用)
│ ├── app-server/ # JSON-RPC over stdio,IDE 集成入口
│ ├── sandbox/ # Seatbelt / Landlock / Job Objects 策略
│ └── apply-patch/ # 把 LLM 输出 patch 应用到文件系统
├── codex-cli/ # 遗留 TypeScript CLI(维护状态)
├── sdk/ # TypeScript SDK
└── AGENTS.md # 项目自身的 Agent 指令(Rust 开发规范) 工程上的关键判断是「三层本质」:模型层 + 宿主层(Harness)+ 沙箱层。Codex CLI 把宿主层与沙箱层的边界画得极清楚——core/ 与 sandbox/ 是两个独立模块,权限不是散落在各处的 if 判断,而是一个独立的、可替换的层。
4.2. 操作系统级沙箱绑定
| 平台 | 机制 | 说明 |
|---|---|---|
| macOS 12+ | Apple Seatbelt | 经 sandbox-exec -p <profile> 以配置化 profile 限定文件与网络访问 |
| Linux | bubblewrap + Landlock + seccomp | 非特权隔离:Landlock 限定文件系统可见范围,seccomp 过滤系统调用 |
| Windows | Job Objects | 经 WSL2 环境执行,以 Windows 作业对象约束进程 |
容器环境的已知边界:在 Docker 容器中,若宿主机或容器配置不支持 Landlock / seccomp,沙箱可能失效。官方建议此时由容器自身提供隔离保证,再以 danger-full-access 或 --dangerously-bypass-approvals-and-sandbox 在容器内运行——这一条是「无人值守必须显式声明信任边界」原则的教科书式表述:放弃沙箱必须是一个被明确写进配置与命令行的决定,而不是静默降级。
系统要求:macOS 12+、Ubuntu 20.04+ / Debian 10+、Windows 11 经 WSL2;RAM 4 GB 起(8 GB 推荐)。
4.3. 多界面一致性架构
app-server 以 JSON-RPC over stdio 向上层暴露 Codex Core,使 CLI、VS Code 扩展、桌面端与 Web 端共享同一套会话、配置与沙箱策略。工程含义与 Cursor 的双运行时问题相反:Codex 通过「单一核心 + 协议分发」避免了「本地跑得好、IDE 里跑偏」的割裂——策略与状态只有一份,界面只是视图。
5. Harness 设计
5.1. L1 上下文工程层
AGENTS.md 的发现与合并顺序(官方文档口径):
- 全局作用域:
~/.codex(或$CODEX_HOME)下先读AGENTS.override.md,否则读AGENTS.md;该层仅采用第一个非空文件。 - 项目作用域:从 Git 根目录向下走到当前工作目录,逐目录检查
AGENTS.override.md,再检查AGENTS.md。 - 合并次序:全局(个人偏好)→ 仓库根(团队共享)→ 当前目录(子模块约定),越靠近当前目录的指令越具体。
两个值得注意的设计:
AGENTS.override.md的存在意味着团队可以为某台机器、某个环境显式覆盖共享指令,而无需修改版本控制内的文件——这是「个人化与共享化分离」在指令层的落点。/init生成起始 AGENTS.md,写入测试命令、风格规则与「不要碰 migrations 目录」一类工作约定,降低了冷启动成本。
config.toml 中的 model_reasoning_effort 等模型参数也属于广义的上下文管理:推理档位决定单位任务的思考深度与 token 消耗,与规则文件共同决定「每次任务花了多少上下文预算」。
5.2. L2 工具与执行层(本平台重点)
沙箱模式(sandbox_mode)——「技术上能碰什么」:
| 档位 | 文件系统 | 网络 | 风险边界 |
|---|---|---|---|
read-only | 全部只读,工作区亦不可写 | 关闭 | 代理只能看不能改;适合研究与审计陌生仓库 |
workspace-write | 仅当前工作区可写 | 默认关闭(可显式开启) | 改动被限定在工作区,但恶意代码仍可被写入并等待执行;网络关闭防外传与投毒 |
danger-full-access | 无限制 | 无限制 | 与普通进程无异;必须由用户显式选择,且官方建议仅在自备隔离(如一次性容器)时使用 |
审批策略(approval_policy)——「何时停下来问」:
| 档位 | 行为 | 风险边界 |
|---|---|---|
untrusted | 默认拒绝,未经批准的动作一律请求批准 | 打断最多,爆炸半径最小 |
on-request | 代理在需要提权(如出沙箱执行)时自行申请 | 打断与自主度平衡;官方推荐的日常档位 |
never | 从不打断,一切动作按沙箱允许范围直接执行 | 沙箱即唯一防线;与 read-only 搭配合理,与 danger-full-access 搭配等同无人值守 root 级代理 |
历史审批模式(2025 年 TypeScript 版口径,已由现行配置模型取代):
| 模式 | 文件改动 | 命令执行 | 与现行模型的对应 |
|---|---|---|---|
suggest | 需确认 | 需确认 | 约等于 untrusted 审批 |
auto-edit | 自动应用 | 需确认 | 约等于「宽松编辑 + 谨慎命令」的组合,现行模型中由沙箱承担文件边界 |
full-auto | 自动应用 | 沙箱内自动执行 | 约等于 workspace-write + on-request / never;该 flag 已于 2026-04 弃用 |
三个层次的演进方向一致:从「按动作类型的一维分档」走向「沙箱 × 审批的二维正交」。一维分档的缺陷在于它把「改文件」「跑命令」「碰网络」三件事捆在一个档位里,而三者风险性质完全不同;二维模型让团队可以独立配置「能碰什么」与「何时问」,这是 Codex CLI 对同类产品最有参考价值的贡献。
5.3. L3 编排与控制层
| 机制 | 说明 |
|---|---|
| Agent Loop | core/ 中的单会话循环:规划、执行、观察、迭代 |
| codex exec | 非交互 headless 模式,CI 接入的标准形态;典型配置为 approval_policy = "never" + read-only 或 workspace-write 沙箱 |
| codex resume | 会话恢复,长任务跨终端窗口继续 |
/goal | 持久化目标工作流:以目标为单位存于 app-server,可暂停、恢复、清理,是 CLI 内的半自动任务编排器 |
| MultiAgentV2 | 显式多代理配置:线程上限、深度与等待时间控制、root / subagent 提示分离 |
| guardian subagent | 审查待执行动作的轻量子代理(详见 L6) |
Codex 的 L3 取向是「把编排交给配置与协议,而非界面」:codex exec 使任意 CI 系统都能成为编排器,/goal 与 MultiAgentV2 提供最小但显式的内置编排原语。与编辑器型工具相比,它缺少可视化看板,但换来的是可脚本化与可版本化——编排策略本身可以进 git。
5.4. L4 记忆与状态层
| 组件 | 范围 | 说明 |
|---|---|---|
| AGENTS.md | 跨会话 | 文件化记忆,随仓库版本化,三层合并 |
| codex resume | 会话级 | 恢复最近会话的完整上下文 |
| 桌面端记忆 | 跨会话 | 保存用户偏好、常用工作流与技术栈,可从对话线程恢复;并能自主调度未来数天至数周的工作计划(第三方口径) |
| 检查点 | — | 未检索到官方 checkpoint 机制,标注「无结果」 |
L4 的取向是「文件为基、会话为辅」:跨会话记忆以 AGENTS.md 为权威来源,会话恢复解决临时连续性,桌面端记忆尚处早期。这与 Anthropic「把状态外化到文件与版本历史」的结论殊途同归。
5.5. L5 评估与观测层
| 机制 | 说明 |
|---|---|
/review | 让 Codex 检查当前改动并在提交前报告问题 |
/status | 确认当前模型、沙箱与审批策略的实际生效状态——防止「以为有沙箱、其实没有」 |
| tool search 观测 | 2026 年起默认启用,大型 MCP 服务器的工具定义按需检索,间接可从上下文占用观察效果 |
| 第三方基准 | SWE-bench Verified 约 77.3%、Terminal-Bench 约 62%(第三方口径);同类任务较部分闭源竞品消耗更少 token(第三方口径) |
注:SWE-bench Verified 已于 2026-02-23 被 OpenAI 官方宣布弃用(原因是 ≥59.4% 的缺陷测试与全前沿模型可复现 gold patch),所引分数为弃用前的历史口径,详见 02-行业赋能/03-软件工程组/06-benchmark.md。
/status 是一个容易被低估的 L5 设计:治理配置的可观测性与治理本身同等重要。如果用户无法低成本确认「沙箱是否真的开着」,那么沙箱的实际防线就依赖运气。
官方企业级量化案例:本次检索未获得,标注「无结果」。
5.6. L6 治理与安全层(本平台重点)
Codex CLI 的 L6 是开源生态中完成度最高的参考实现,核心是四条原则:
- 沙箱 × 审批正交(见 5.2)。官方与社区反复强调两个旋钮必须成对阅读:
never + read-only对研究任务完全合理(什么也损坏不了);never + danger-full-access则是一个无人值守、对宿主机有 root 级可达性的代理。单看任何一个旋钮都没有意义,风险只在组合中显形。 - 网络默认关闭。
workspace-write下network_access = false是最值得保持的设置——依赖安装必须成为显式决策,以避免无人值守运行中的供应链攻击。这与本组 README 提出的「文件系统隔离与网络隔离缺一不可」互为印证。 - 守护子代理(2026-04):guardian subagent 对待执行动作做审查而非照单批准,直接回应「代理无人值守执行破坏性命令」的风险。值得注意的是它把一部分 L6 判定交给了第二个模型实例——用代理审查代理,其可靠性依赖审查模型自身的鲁棒性。
- 配置即策略:profiles 把沙箱、审批、模型与 MCP 状态统一命名化;项目级
.codex/config.toml允许仓库团队固化安全基线并随 git 评审。旧的--full-auto弃用正是为了收敛「绕过配置体系的一键放开」路径。文件系统权限方面,0.131 / 0.132 起deny成为文件系统权限的规范标准。 - 预算护栏(2026-09):rollout token 预算把“任务与租户级预算上限 + 熔断”落进了 CLI 本体——跨智能体线程统一记账、余量提醒、耗尽即中止回合。这是对 L6 成本失控风险(见白皮书 07-治理与风险 §4.7)在单机工具侧的工程化回应:预算不再是平台托管运行时的专属能力,而是随开源执行栈分发。
对 L6 反面教材的回应:Amazon Q 事件(2025-08-11,提示注入诱导删除 AWS 资源)暴露的攻击面在 Codex 的模型中对应为——never + workspace-write 档位下,被注入的指令可以在沙箱内为所欲为(写文件、写恶意脚本),虽然网络关闭阻断了外传,但「等待人工执行的恶意脚本」仍可能经由后续人工操作生效。结论:沙箱约束的是执行域,不约束语义——高危档位的无人值守使用,应叠加一次性容器与事后全量 diff 审查。
5.7. 六层能力小结
| 层 | 评级 | 一句话判断 |
|---|---|---|
| L1 上下文工程 | ★★★ | AGENTS.md 三层发现 + override 机制 + 配置化推理档位,简洁而完备 |
| L2 工具与执行 | ★★★ | OS 级三套沙箱原生绑定 + apply-patch 独立模块,执行层透明度最高 |
| L3 编排与控制 | ★★★ | TUI / exec / resume / goal / 多代理齐备,编排可脚本化 |
| L4 记忆与状态 | ★★ | 文件为基 + 会话恢复;缺检查点,桌面端记忆尚早 |
| L5 评估与观测 | ★★ | /status 的治理可观测性是亮点;无官方轨迹与回归集 |
| L6 治理与安全 | ★★★ | 沙箱 × 审批正交 + 网络默认关闭 + guardian + 配置即策略,开源参考实现 |
6. 实际案例
说明:截至撰写时,未检索到 OpenAI 官方发布的带量化指标的企业采用案例;下列案例为官方 cookbook 与公开报道中的可复现工作流,量化数字均已标注来源等级。
案例一:遗留系统现代化。官方 cookbook 提供了 COBOL → 现代技术栈的完整案例:以 read-only 沙箱让 Codex 先通读并解释遗留代码,再在 workspace-write 沙箱内逐步重写,每一步的改动以 patch 形式落盘并由人工审查。该案例的可复用结构是「读用只读档、写用工作区档」,把审批档位与任务阶段对齐。
案例二:CI 自动审查。以 codex exec 承接 PR 触发的自动审查:CI 在 PR 进入评审时以 approval_policy = "never" + read-only 沙箱运行 Codex,产出审查意见而不触碰代码。这是 L2 与 L6 组合在流程中的最小落点:非交互、只读、可审计。
案例三:夜间批量重构。团队在一次性容器内运行 codex exec,容器本身提供隔离保证(见 4.2 的容器边界),Codex 以 danger-full-access + never 在容器内自由执行,任务产出以分支与 diff 回传,人工只审查最终 diff。爆炸半径被一次性容器兜住,是高危档位唯一被官方认可的使用方式。
案例四:规模口径(营销性质)。2026-04 OpenAI 宣布 Codex 为「超过 300 万开发者的伙伴」(官方口径转载, 统计口径)。仓库侧的第三方工程分析显示 10,000+ commits、640+ 发版、最高每日 3—4 次发版节奏,可侧面印证其迭代强度,均属第三方统计。
7. 总结
7.1. 优势
- L6 的开源参考实现:沙箱 × 审批二维模型、三套 OS 级沙箱、配置即策略,全部开源可审计,是同类产品中最透明的治理设计。
- 执行栈零依赖:Rust 重写带来单二进制安装,CI 与受限环境接入成本最低。
- 多界面一致性:app-server 协议使 CLI / IDE / 桌面 / Web 共享同一核心与同一份策略。
- token 效率高:第三方评测普遍认为其同等任务消耗低于部分闭源竞品,对按量计费与批量作业友好。
- 权限是一等公民:
/status使治理配置可观测,deny成为文件系统权限规范标准,权限不依附于界面。
7.2. 局限
- 长链路自主规划弱于部分闭源竞品:第三方评测指出 3—4 步以上的任务可能丢失方向感,复杂长任务需拆解或搭配
/goal。 - 模型绑定单一:强依赖 OpenAI 模型与 Responses API,完全离线或跨模型对比场景不合适。
- 企业能力需自建:RBAC、审计日志、多租户、组织级策略下发均不在 CLI 范围内,需团队自行封装。
- 无检查点机制:出错后的回退依赖 git 与人工操作,L4 完整度低于编辑器型工具。
- 单 crate 复杂度压力:官方 AGENTS.md 自我声明「codex-core crate is bloated, resist adding code to codex-core」,核心模块的维护成本在上升。
7.3. 适用边界
| 场景 | 是否适用 | 理由 |
|---|---|---|
| CI / 脚本化批量任务 | 适用 | codex exec + 显式沙箱档位是最标准的接入形态 |
| 需要开源可审计的执行栈 | 适用 | Apache 2.0,沙箱与审批实现全部可读 |
| 无人值守长任务 | 部分适用 | 必须叠加一次性容器与事后 diff 审查 |
| 编辑器内逐处审阅的开发流 | 部分适用 | 有 VS Code 扩展,但体验以终端为中心 |
| 跨模型对比与成本优化 | 不适用 | 绑定 OpenAI 模型体系 |
| 需要组织级 RBAC 与审计的平台化能力 | 不适用 | 需自建封装 |
7.4. 选型建议
选 Codex CLI 的判断标准是:任务以脚本化、批量化、CI 化为主,且团队需要治理机制可读、可审计、可自行修改。它是本组唯一能把「沙箱怎么隔离、审批怎么触发」读到源码级的工具——对正在设计自建 Harness 的团队,其配置体系(config.toml + profiles + 二维权限)值得直接借鉴。
无论是否选用,本组建议照搬其三条治理实践:网络默认关闭,依赖安装显式化;放弃沙箱必须是显式声明(而非静默降级);用 /status 一类的自检命令让治理配置可观测。这三条的移植成本极低,而收益覆盖所有代理工具。
信息缺口声明
- 当期最新版本号:以 GitHub rust-v0.150.x 标签序列(2026-08)为锚点,当期稳定版标
[待填写]。 - 定价与配额细节:各 ChatGPT 档位内含的 Codex 用量额度未在检索到的官方页完整给出,标 。
- 默认模型与基准分数:GPT-5.6 家族与 SWE-bench Verified 77.3%、Terminal-Bench 约 62% 均来自第三方口径,标 。
- 桌面端记忆与自主调度的能力边界:来自第三方转述,标 。
- 企业落地效果数据:未检索到带量化指标的一手企业案例,本文未采用任何未经核实的量化效果数字。
- guardian subagent 的触发条件与覆盖范围:官方 changelog 口径之外的行为细节标 。
8. 参考资料
- openai/codex 官方仓库(含 AGENTS.md 与沙箱实现)— OpenAI,2025—2026。https://github.com/openai/codex
- OpenAI Codex 官方文档 — OpenAI,2026。https://developers.openai.com/codex/
- Introducing Codex(云端研究预览公告)— OpenAI,2025-05-16。https://openai.com/index/introducing-codex/
- Harness engineering: leveraging Codex in an agent-first world — OpenAI,2026-02-11。https://openai.com/index/harness-engineering/
- OpenAI API 文档 · Responses API — OpenAI,2025—2026。https://platform.openai.com/docs/guides/responses
- Landlock 内核文档(Linux kernel userspace API)— Linux Kernel Organization,2024—2026。https://docs.kernel.org/userspace-api/landlock.html
- Model Context Protocol 官方站 — MCP / AAIF,2024—2026。https://modelcontextprotocol.io/
- SWE-bench 官方站 — Princeton / 社区,2023—2026。https://www.swebench.com/
- Terminal-Bench 官方站 — Stanford / Laude Institute,2025—2026。https://www.tbench.ai/
- 2025 Stack Overflow Developer Survey — Stack Overflow,2025-07-30。https://survey.stackoverflow.co/2025/
- DORA 2025 State of AI-assisted Software Development — Google Cloud / DORA,2025。https://dora.dev/
- Effective context engineering for AI agents — Anthropic,2025。https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
Codex CLI (AI IDE Platform Market Research)
1. Introduction
Codex CLI is OpenAI's open-source coding agent tool, and among the six platforms in this group it is the only one that open-sources its sandbox and approval mechanisms in full. It was first released as open source in TypeScript on 2025-04-17; on 2025-05-30 it announced a rewrite in Rust that was completed quickly, with the TypeScript version entering maintenance status; from 2025-05-16 the bundled cloud Codex (research preview) added internet access, task tracking and change review, and opened to ChatGPT Pro / Enterprise / Team users in June of the same year.
Its distinctive value lies not in any single capability but in transparency: how the sandbox is built, how approval is divided, and how configuration takes effect all live in readable source code and configuration files. For those studying AI Harness, Codex CLI is the reference implementation for L2 (tools and execution) and L6 (governance and security) — this group's README comparison matrix rates it as "sandbox + approval orthogonal + configuration as policy", and these three things form the main thread of this article.
1.1. Developer and Product History
| Item | Details |
|---|---|
| Developer | OpenAI |
| First open-source release | 2025-04-17 (TypeScript implementation, Apache 2.0) |
| Cloud research preview | 2025-05-16, added internet access, task tracking and change review |
| Rust rewrite | Announced 2025-05-30, completed 2025-06; the TypeScript version entered maintenance status |
| Release cadence | As of 2026-08 in the rust-v0.150.x series ( current latest version) |
| Engineering scale | 10,000+ commits, 640+ tagged releases, ~400 contributors, GitHub stars exceeding 100K (third-party statistics) |
| Default model | GPT-5.6 family (third-party report) |
1.2. Positioning and Latest Version
Codex CLI is positioned as an open-source, terminal-first coding agent built on a skeleton of sandbox and approval. It differs from Claude Code in three ways: first, it is open source (Apache 2.0), so the execution stack is auditable and can be built by anyone; second, its permission model is an explicit two-dimensional design — "the sandbox governs what can technically be touched, approval governs when to stop and ask"; third, multiple interfaces share the same core, with the CLI, VS Code extension, desktop and Web endpoints all reusing the same Codex Core via the same app-server protocol.
The 2026-09 version line (official Changelog basis, cross-checked against a third-party aggregation, Grade B): GPT-6 Astra has been Codex's default model since v0.153.4; 0.154.0 (09-09) added GPT-6 Astra to the model selector and made it available on Amazon Bedrock, with new experimental worktree support and mid-task inline questioning; /plugins divides remote plugins into three zones — OpenAI Curated / Workspace / Shared-with-me — and can proactively recommend installation mid-turn; a configurable rollout token budget was introduced — tracking spend across agent threads, reminding on remaining quota and aborting the turn when exhausted. The earlier anchor in the tag sequence is rust-v0.150.x (2026-08).
1.3. Pricing Model
Codex CLI itself is free and open source; usage is charged to an OpenAI paid plan:
| Tier | Price | Relationship to Codex |
|---|---|---|
| Prerequisite | Requires a paid ChatGPT plan or an API Key | Specific tier benefits and quotas are not fully stated on the official pages found in the search, marked [To be verified] |
| ChatGPT Plus | From $20/month (third-party report) | Includes a Codex usage quota () |
| Business / Enterprise | Custom | Organization-level usage and governance capabilities () |
| API Key mode | Billed per token | An option for users without a subscription; cost grows linearly with usage |
Engineering implications of the billing structure: as with Claude Code, the subscription model makes long-task costs predictable, and runaway agent loops do not produce surprise bills; this is the cost advantage of terminal-based tools in CI and batch scenarios.
2. Glossary
| Term | English / Abbreviation | Definition |
|---|---|---|
| Sandbox | Sandbox | An operating-system-level isolation layer that restricts what an agent can "technically touch"; macOS uses Seatbelt, Linux uses bubblewrap with Landlock + seccomp, and Windows uses Job Objects |
| Seatbelt | Seatbelt | Apple's sandbox mechanism; on macOS 12+ it limits a process's file and network access via sandbox-exec -p <profile> |
| bubblewrap | bubblewrap | A lightweight containerization sandbox tool on Linux that, together with Landlock / seccomp, forms Codex CLI's Linux isolation scheme |
| Landlock | Landlock | A non-privileged access control mechanism provided by the Linux kernel that can limit the filesystem scope a process can access without root privileges |
| Sandbox mode | sandbox_mode | A configuration item with values read-only / workspace-write / danger-full-access, determining the reachable scope of the filesystem and network |
| Approval mode | Approval Mode | The tier that determines when the agent "stops and asks a human"; the early versions had three levels: suggest / auto-edit / full-auto |
| suggest mode | Suggest | An early approval tier: all changes and commands require human confirmation |
| auto-edit mode | Auto-Edit | An early approval tier: file changes are applied automatically, while command execution still requires confirmation |
| full-auto mode | Full-Auto | An early approval tier: changes and commands execute automatically inside the sandbox; from 2026-04 this flag was deprecated, replaced by authorization through profiles plus an explicit trust prompt |
| Approval policy | approval_policy | The current configuration item, with values untrusted / on-request / never, configured orthogonally with sandbox_mode |
| Project spec | AGENTS.md | A project-level agent instruction file, discovered and merged across three layers: global → repository root → current directory |
| Responsive API | Responses API | OpenAI's model-calling interface for agents, supporting multi-turn tool calls and state continuation; it is Codex's model-layer dependency |
| Configuration file | config.toml | The TOML configuration in ~/.codex/config.toml (or $CODEX_HOME), carrying sandbox, approval, model and MCP configuration; at the project level it can be overridden by .codex/config.toml at the repository root |
| Configuration tier | Profiles | A mechanism that names an entire set of sandbox, approval and model configuration (e.g. codex --profile careful) |
| Non-interactive execution | codex exec | A headless running mode without terminal interaction, used for CI and scripts |
| App service protocol | app-server | A protocol service using JSON-RPC over stdio, allowing CLI / VS Code / Desktop / Web to share the same Codex Core |
| Guardian subagent | guardian subagent | A lightweight subagent introduced in 2026-04 that reviews actions to be executed rather than approving them blindly |
| Model Context Protocol | MCP (Model Context Protocol) | An external tool integration protocol, configured in the mcp_servers section of config.toml (TOML rather than JSON) |
3. Feature Overview
3.1. Interaction Modes
| Mode | Command | Scenario |
|---|---|---|
| Interactive TUI | codex or codex "task description" | Day-to-day development, approving item by item or authorizing per profile |
| Non-interactive execution | codex exec "task description" | CI, scripts, overnight batch tasks; requires explicit approval and sandbox configuration |
| Session resume | codex resume | Resume the most recent session to continue working |
| Web search | codex --search | Explicitly enable real-time Web search |
| Slash commands | /init, /status, /permissions, /model, /review | Initialize the project spec, confirm the effective configuration, review changes |
3.2. Sandbox and Approval Capabilities
Codex CLI's permission model consists of two independent knobs, and this design is the core of this article; see the full breakdown in 5.2 and 5.6. The summary is as follows:
- sandbox_mode:
read-only(read-only),workspace-write(only the workspace is writable, network off by default),danger-full-access(no isolation). - approval_policy:
untrusted(deny by default and request approval),on-request(the agent can request privilege escalation as needed),never(never interrupt). - The early three-tier approval modes
--suggest/--auto-edit/--full-autowere replaced from 2026-04 by a mechanism of profiles plus an explicit trust prompt, and the old flags are explicitly deprecated.
3.3. Extension and Integration Capabilities
- MCP: configured in the
mcp_serverssection of~/.codex/config.toml(TOML format); from 2026 tool search is enabled by default, so tool definitions of large MCP servers are no longer fully loaded into context;codex mcpcan expose Codex itself as an MCP server for other agents to call. - Multi-agent: the MultiAgentV2 configuration provides thread limits, depth and wait-time controls, and separation of root / subagent prompts.
- Persistent goals:
/goalpersists long-term goals to the app-server, which can be created, paused, resumed and cleaned up. - Desktop: can autonomously operate macOS desktop applications (independent cursor, viewing the screen, clicking, typing), has a built-in browser, newly added memory (saving preferences, common workflows and tech stacks), and can autonomously schedule work plans ranging from days to weeks ahead (third-party report).
- Self-update and plugins:
codex updateself-updates; plugin marketplace, remote plugin caching and hook switches.
4. Platform Architecture
图 4-1|Codex CLI 平台总体架构:多界面共享单一核心,沙箱为独立可替换层
数据来源:基于本文分析绘制的示意图。
4.1. Overall Architecture
Repository structure and the three-layer essence (third-party analysis of the open-source code, consistent with the official repository structure):
openai/codex/
├── codex-rs/ # Rust 主代码库(约 95.6%)
│ ├── core/ # Agent Loop / Session / TurnContext / 上下文管理
│ ├── tui/ 与 tui2/ # 终端 UI
│ ├── protocol/ # Op / Event 枚举,客户端与服务端共享
│ ├── mcp/ # MCP client 与工具调度
│ ├── exec/ # 非交互 headless 模式(CI 用)
│ ├── app-server/ # JSON-RPC over stdio,IDE 集成入口
│ ├── sandbox/ # Seatbelt / Landlock / Job Objects 策略
│ └── apply-patch/ # 把 LLM 输出 patch 应用到文件系统
├── codex-cli/ # 遗留 TypeScript CLI(维护状态)
├── sdk/ # TypeScript SDK
└── AGENTS.md # 项目自身的 Agent 指令(Rust 开发规范) The key engineering judgment is the "three-layer essence": model layer + host layer (Harness) + sandbox layer. Codex CLI draws the boundary between the host layer and the sandbox layer extremely clearly — core/ and sandbox/ are two independent modules, and permissions are not scattered if-statements here and there but an independent, replaceable layer.
4.2. Operating-System-Level Sandbox Binding
| Platform | Mechanism | Description |
|---|---|---|
| macOS 12+ | Apple Seatbelt | Limits file and network access via sandbox-exec -p <profile> with a configured profile |
| Linux | bubblewrap + Landlock + seccomp | Non-privileged isolation: Landlock limits the visible filesystem scope, seccomp filters system calls |
| Windows | Job Objects | Executed via a WSL2 environment, constraining processes with Windows job objects |
Known boundary in container environments: in a Docker container, if the host or container configuration does not support Landlock / seccomp, the sandbox may fail. In that case the official recommendation is for the container itself to provide isolation guarantees and then run inside it with danger-full-access or --dangerously-bypass-approvals-and-sandbox — this is a textbook statement of the principle that "unattended operation must explicitly declare its trust boundary": giving up the sandbox must be a decision explicitly written into the configuration and command line, not a silent downgrade.
System requirements: macOS 12+, Ubuntu 20.04+ / Debian 10+, Windows 11 via WSL2; 4 GB RAM minimum (8 GB recommended).
4.3. Multi-Interface Consistency Architecture
app-server exposes Codex Core to upper layers over JSON-RPC over stdio, so the CLI, VS Code extension, desktop and Web endpoints share the same set of sessions, configuration and sandbox policies. The engineering implication is the opposite of Cursor's dual-runtime problem: Codex, through "a single core + protocol distribution", avoids the split where "it runs well locally but runs wrong in the IDE" — there is only one copy of policy and state; the interface is just a view.
5. Harness Design
5.1. L1 Context Engineering Layer
AGENTS.md discovery and merge order (per the official documentation):
- Global scope: read
AGENTS.override.mdfirst under~/.codex(or$CODEX_HOME); otherwise readAGENTS.md; this layer only takes the first non-empty file. - Project scope: from the Git root walk downward to the current working directory, checking
AGENTS.override.mdin each directory, thenAGENTS.md. - Merge order: global (personal preference) → repository root (team-shared) → current directory (submodule conventions); the closer to the current directory, the more specific the instructions.
Two designs worth noting:
- The existence of
AGENTS.override.mdmeans a team can explicitly override shared instructions for a particular machine or environment without modifying files under version control — this is the landing point of "separation of personalization and sharing" at the instruction layer. /initgenerates an initial AGENTS.md, writing in test commands, style rules and working conventions such as "do not touch the migrations directory", which lowers cold-start costs.
Model parameters such as model_reasoning_effort in config.toml also belong to context management in a broad sense: the reasoning tier determines the depth of thinking and token consumption per unit task, and together with the rules files decides "how much context budget each task spends".
5.2. L2 Tool and Execution Layer (Focus of This Platform)
Sandbox mode (sandbox_mode) — "what can technically be touched":
| Tier | Filesystem | Network | Risk Boundary |
|---|---|---|---|
read-only | Everything read-only; the workspace is not writable either | Off | The agent can only look, not modify; suited to research and auditing unfamiliar repositories |
workspace-write | Only the current workspace is writable | Off by default (can be explicitly enabled) | Changes are confined to the workspace, but malicious code can still be written and await execution; turning the network off prevents exfiltration and poisoning |
danger-full-access | Unlimited | Unlimited | No different from a normal process; must be explicitly chosen by the user, and the official recommendation is to use it only with self-provided isolation (e.g. one-off containers) |
Approval policy (approval_policy) — "when to stop and ask":
| Tier | Behavior | Risk Boundary |
|---|---|---|
untrusted | Deny by default; any action without approval requests approval | Most interruptions, smallest blast radius |
on-request | The agent requests privilege escalation on its own when needed (e.g. executing outside the sandbox) | Balances interruption and autonomy; the official recommended daily tier |
never | Never interrupts; all actions execute directly within what the sandbox allows | The sandbox is the only line of defense; sensible paired with read-only, but paired with danger-full-access it is equivalent to an unattended root-level agent |
Historical approval modes (per the 2025 TypeScript version, now superseded by the current configuration model):
| Mode | File Changes | Command Execution | Correspondence to the Current Model |
|---|---|---|---|
suggest | Requires confirmation | Requires confirmation | Roughly equivalent to untrusted approval |
auto-edit | Applied automatically | Requires confirmation | Roughly equivalent to a "lenient editing + cautious commands" combination; in the current model the sandbox holds the file boundary |
full-auto | Applied automatically | Executes automatically inside the sandbox | Roughly equivalent to workspace-write + on-request / never; this flag was deprecated in 2026-04 |
The evolution across all three levels points in the same direction: from "a one-dimensional tiering by action type" toward "a two-dimensional orthogonality of sandbox × approval". The defect of one-dimensional tiering is that it bundles "modify files", "run commands" and "touch the network" into a single tier even though the three differ entirely in risk profile; the two-dimensional model lets teams configure "what can be touched" and "when to ask" independently — this is Codex CLI's most valuable contribution for similar products.
5.3. L3 Orchestration and Control Layer
| Mechanism | Description |
|---|---|
| Agent Loop | The single-session loop in core/: plan, execute, observe, iterate |
| codex exec | A non-interactive headless mode and the standard form of CI integration; a typical configuration is approval_policy = "never" + a read-only or workspace-write sandbox |
| codex resume | Session resume, allowing long tasks to continue across terminal windows |
/goal | Persistent goal workflow: goals are stored in the app-server and can be paused, resumed and cleaned up; it is a semi-automatic task orchestrator inside the CLI |
| MultiAgentV2 | Explicit multi-agent configuration: thread limits, depth and wait-time controls, and root / subagent prompt separation |
| guardian subagent | A lightweight subagent that reviews actions to be executed (see L6) |
Codex's L3 orientation is "give orchestration to configuration and protocol, not to the interface": codex exec lets any CI system become the orchestrator, while /goal and MultiAgentV2 provide minimal but explicit built-in orchestration primitives. Compared with editor-style tools, it lacks a visual kanban, but in exchange it is scriptable and versionable — the orchestration policy itself can go into git.
5.4. L4 Memory and State Layer
| Component | Scope | Description |
|---|---|---|
| AGENTS.md | Cross-session | File-based memory, versioned with the repository, merged across three layers |
| codex resume | Session-level | Restores the full context of the most recent session |
| Desktop memory | Cross-session | Saves user preferences, common workflows and tech stacks, restorable from a conversation thread; and can autonomously schedule work plans ranging from days to weeks ahead (third-party report) |
| Checkpoints | — | No official checkpoint mechanism was found; marked "no result" |
L4's orientation is "file-based, session-assisted": cross-session memory uses AGENTS.md as the authoritative source, session resume handles temporary continuity, and desktop memory is still early. This converges with Anthropic's conclusion of "externalizing state into files and version history".
5.5. L5 Evaluation and Observability Layer
| Mechanism | Description |
|---|---|
/review | Have Codex examine the current changes and report issues before committing |
/status | Confirm the actual effective state of the current model, sandbox and approval policy — preventing "thinking the sandbox is on when it is not" |
| tool search observability | Enabled by default from 2026; tool definitions of large MCP servers are retrieved on demand, and the effect can be observed indirectly through context usage |
| Third-party benchmarks | SWE-bench Verified ~77.3%, Terminal-Bench ~62% (third-party report); consumes fewer tokens than some closed-source competitors on similar tasks (third-party report) |
Note: SWE-bench Verified was officially deprecated by OpenAI on 2026-02-23 (because ≥59.4% of the defect tests have gold patches reproducible by all frontier models); the scores cited are the historical figures before deprecation. See 02-行业赋能/03-软件工程组/06-benchmark.md.
/status is an easily underestimated L5 design: the observability of governance configuration is as important as governance itself. If users cannot cheaply confirm "whether the sandbox is really on", then the sandbox's actual line of defense depends on luck.
Official enterprise-grade quantitative case: none was obtained in this search; marked "no result".
5.6. L6 Governance and Security Layer (Focus of This Platform)
Codex CLI's L6 is the most complete reference implementation in the open-source ecosystem; its core consists of four principles:
- Sandbox × approval orthogonality (see 5.2). Both the official documents and the community repeatedly stress that the two knobs must be read in pairs:
never + read-onlyis entirely reasonable for research tasks (nothing can be damaged);never + danger-full-accessis an unattended agent with root-level reach over the host. Looking at either knob alone is meaningless; risk only shows itself in the combination. - Network off by default. Under
workspace-write,network_access = falseis the setting most worth keeping — dependency installation must become an explicit decision to avoid supply-chain attacks in unattended runs. This mutually confirms the "filesystem isolation and network isolation are both indispensable" point raised in this group's README. - Guardian subagent (2026-04): the guardian subagent reviews actions to be executed rather than approving them blindly, directly responding to the risk of "an agent executing destructive commands unattended". Notably, it delegates part of the L6 decision to a second model instance — using an agent to review agents, whose reliability depends on the robustness of the reviewing model itself.
- Configuration as policy: profiles unify and name the sandbox, approval, model and MCP states; project-level
.codex/config.tomllets repository teams fix a security baseline and review it with git. The deprecation of the old--full-autois precisely to close the "one-click enablement that bypasses the configuration system" path. On filesystem permissions, from 0.131 / 0.132denybecame the normative standard for filesystem permissions. - Budget guardrails (2026-09): the rollout token budget brings "task- and tenant-level budget caps + circuit breaking" into the CLI itself — unified accounting across agent threads, headroom reminders and turn abort on exhaustion. This is the single-machine-tool-side engineering response to the L6 cost-runaway risk (see whitepaper 07-治理与风险 §4.7): budgeting is no longer a capability exclusive to platform-managed runtimes, but ships with the open-source execution stack.
Response to the L6 cautionary example: the attack surface exposed by the Amazon Q incident (2025-08-11, prompt injection inducing deletion of AWS resources) maps in Codex's model to — under the never + workspace-write tier, an injected instruction can do whatever it wants inside the sandbox (write files, write malicious scripts); although turning the network off blocks exfiltration, a "malicious script awaiting human execution" can still take effect through subsequent human operations. Conclusion: the sandbox constrains the execution domain, not semantics — unattended use of a high-risk tier should be paired with one-off containers and a full post-hoc diff review.
5.7. Summary of the Six Layers
| Layer | Rating | One-Sentence Assessment |
|---|---|---|
| L1 Context engineering | ★★★ | AGENTS.md three-layer discovery + override mechanism + configurable reasoning tiers, simple yet complete |
| L2 Tools and execution | ★★★ | Three native OS-level sandbox bindings + independent apply-patch module, the highest transparency in the execution layer |
| L3 Orchestration and control | ★★★ | TUI / exec / resume / goal / multi-agent all present, orchestration scriptable |
| L4 Memory and state | ★★ | File-based + session resume; lacks checkpoints, desktop memory still early |
| L5 Evaluation and observability | ★★ | The governance observability of /status is a highlight; no official traces or regression set |
| L6 Governance and security | ★★★ | Sandbox × approval orthogonality + network off by default + guardian + configuration as policy, an open-source reference implementation |
6. Practical Cases
Note: as of the time of writing, no enterprise adoption case with quantitative metrics published by OpenAI was found; the following cases are reproducible workflows from the official cookbook and public reports, and every quantitative figure has been tagged with its source level.
Case 1: Legacy system modernization. The official cookbook provides a complete COBOL → modern stack case: use a read-only sandbox to have Codex first read through and explain the legacy code, then rewrite it progressively inside a workspace-write sandbox, with each step's changes written to disk as patches and reviewed by a human. The reusable structure of this case is "read with the read-only tier, write with the workspace tier", aligning the approval tier with the task phase.
Case 2: CI automatic review. Use codex exec to take on PR-triggered automatic review: when a PR enters review, CI runs Codex with approval_policy = "never" + a read-only sandbox, producing review comments without touching the code. This is the minimal landing point of the L2 + L6 combination in a workflow: non-interactive, read-only, auditable.
Case 3: Overnight batch refactoring. A team runs codex exec inside a one-off container, where the container itself provides the isolation guarantee (see the container boundary in 4.2); Codex executes freely inside the container with danger-full-access + never, the task output is returned as a branch and diff, and a human only reviews the final diff. The blast radius is contained by the one-off container, making it the only officially recognized way to use the high-risk tier.
Case 4: Scale figures (marketing-oriented). In 2026-04 OpenAI announced Codex as "a companion to over 3 million developers" (reproduced from the official source statistical basis). Third-party engineering analysis on the repository side shows 10,000+ commits, 640+ releases and a peak cadence of 3–4 releases per day, which indirectly corroborates its iteration intensity; these are all third-party statistics ().
7. Summary
7.1. Strengths
- An open-source reference implementation for L6: the two-dimensional sandbox × approval model, the three OS-level sandboxes and configuration-as-policy are all open source and auditable, making it the most transparent governance design among similar products.
- Zero-dependency execution stack: the Rust rewrite delivers a single-binary install, giving the lowest integration cost for CI and constrained environments.
- Multi-interface consistency: the app-server protocol lets CLI / IDE / desktop / Web share the same core and the same policy.
- High token efficiency: third-party evaluations generally find it consumes less on equivalent tasks than some closed-source competitors (), friendly to usage-based billing and batch workloads.
- Permissions as a first-class citizen:
/statusmakes governance configuration observable,denybecame the normative standard for filesystem permissions, and permissions are not tied to the interface.
7.2. Limitations
- Long-chain autonomous planning is weaker than some closed-source competitors: third-party evaluations point out that tasks beyond 3–4 steps may lose direction (); complex long tasks need decomposition or pairing with
/goal. - Single model binding: strongly dependent on OpenAI models and the Responses API; not suited to fully offline or cross-model comparison scenarios.
- Enterprise capabilities must be self-built: RBAC, audit logs, multi-tenancy and organization-level policy distribution are all outside the CLI's scope and must be wrapped by the team.
- No checkpoint mechanism: rollback after errors relies on git and manual operations, so L4 completeness is lower than editor-style tools.
- Single-crate complexity pressure: the official AGENTS.md declares that "codex-core crate is bloated, resist adding code to codex-core", and the maintenance cost of the core module is rising.
7.3. Applicability Boundary
| Scenario | Applicable? | Reason |
|---|---|---|
| CI / scripted batch tasks | Applicable | codex exec + an explicit sandbox tier is the most standard integration form |
| Need an open-source, auditable execution stack | Applicable | Apache 2.0; the sandbox and approval implementations are fully readable |
| Unattended long tasks | Partially applicable | Must be paired with one-off containers and post-hoc diff review |
| Editor-internal step-by-step review workflows | Partially applicable | Has a VS Code extension, but the experience is terminal-centric |
| Cross-model comparison and cost optimization | Not applicable | Bound to the OpenAI model system |
| Platform capabilities requiring organization-level RBAC and audit | Not applicable | Requires a self-built wrapper |
7.4. Selection Recommendation
The criteria for choosing Codex CLI are: tasks are primarily scripted, batched and CI-oriented, and the team needs governance mechanisms that are readable, auditable and modifiable. It is the only tool in this group whose "how the sandbox isolates and how approval is triggered" can be read down to the source-code level — for teams designing their own Harness, its configuration system (config.toml + profiles + two-dimensional permissions) is worth borrowing directly.
Whether or not it is selected, this group recommends copying its three governance practices: network off by default, dependency installation made explicit; giving up the sandbox must be an explicit declaration (rather than a silent downgrade); use self-check commands such as /status to make governance configuration observable. The migration cost of these three is extremely low, while the benefit covers all agent tools.
Information Gap Declaration
- Current latest version number: anchored to the GitHub rust-v0.150.x tag sequence (2026-08); the current stable version is marked
[To be filled]. - Pricing and quota details: the Codex usage quotas included in each ChatGPT tier are not fully stated on the official pages found in the search, marked
[To be verified]. - Default model and benchmark scores: the GPT-5.6 family and SWE-bench Verified 77.3%, Terminal-Bench ~62% all come from third-party reports, marked
[To be verified]. - The capability boundary of desktop memory and autonomous scheduling: from third-party retelling, marked
[To be verified]. - Enterprise deployment effectiveness data: no first-hand enterprise case with quantitative metrics was found; this article does not use any unverified quantitative effectiveness figures.
- The trigger conditions and coverage of the guardian subagent: behavioral details beyond the official changelog are marked
[To be verified].
8. References
- openai/codex official repository (including AGENTS.md and the sandbox implementation) — OpenAI, 2025—2026. https://github.com/openai/codex
- OpenAI Codex official documentation — OpenAI, 2026. https://developers.openai.com/codex/
- Introducing Codex (cloud research preview announcement) — OpenAI, 2025-05-16. https://openai.com/index/introducing-codex/
- Harness engineering: leveraging Codex in an agent-first world — OpenAI, 2026-02-11. https://openai.com/index/harness-engineering/
- OpenAI API documentation · Responses API — OpenAI, 2025—2026. https://platform.openai.com/docs/guides/responses
- Landlock kernel documentation (Linux kernel userspace API) — Linux Kernel Organization, 2024—2026. https://docs.kernel.org/userspace-api/landlock.html
- Model Context Protocol official site — MCP / AAIF, 2024—2026. https://modelcontextprotocol.io/
- SWE-bench official site — Princeton / community, 2023—2026. https://www.swebench.com/
- Terminal-Bench official site — Stanford / Laude Institute, 2025—2026. https://www.tbench.ai/
- 2025 Stack Overflow Developer Survey — Stack Overflow, 2025-07-30. https://survey.stackoverflow.co/2025/
- DORA 2025 State of AI-assisted Software Development — Google Cloud / DORA, 2025. https://dora.dev/
- Effective context engineering for AI agents — Anthropic, 2025. https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents