codex

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex Second Opinion

Codex 第二意见

Use Codex to get an independent review from OpenAI's reasoning models.
Use when:
  • You want a second opinion on a plan, diff, or architecture decision.
  • You need a fresh pass for bugs, edge cases, or missing requirements.
  • You want a quick sanity check before sharing with users or stakeholders.
借助Codex从OpenAI的推理模型获取独立审查意见。
适用场景:
  • 你需要对计划、代码差异(diff)或架构决策获取第二意见时
  • 你需要重新排查bug、边缘情况或遗漏的需求时
  • 你需要在向用户或利益相关者分享前快速进行合理性检查时

Invocation

调用方式

Use
codex exec
for non-interactive execution. The prompt can be passed as an argument or piped via stdin.
bash
undefined
使用
codex exec
进行非交互式执行。提示语可作为参数传入,或通过标准输入(stdin)管道传输。
bash
undefined

Direct prompt

Direct prompt

codex exec "Read the files in src/ and review them for bugs"

```bash
codex exec "Read the files in src/ and review them for bugs"

```bash

Pipe via stdin

Pipe via stdin

git diff main..HEAD | codex exec "Review this diff for issues"
undefined
git diff main..HEAD | codex exec "Review this diff for issues"
undefined

Key Options

关键选项

  • -m MODEL
    : Select model (always use the most capable available:
    gpt-5.2-codex
    )
  • -c key=value
    : Override config values inline (e.g.,
    -c model="gpt-5.2-codex"
    )
  • -p PROFILE
    : Use a config profile from
    ~/.codex/config.toml
    to avoid repeating flags
  • -C DIR
    : Set working directory
  • --full-auto
    : Automatic execution with workspace-write sandbox (fewer approval pauses)
  • -s SANDBOX_POLICY
    : Sandbox policy (
    read-only
    ,
    workspace-write
    )
  • --skip-git-repo-check
    : Skip repo detection (saves time outside git)
  • -m MODEL
    : 选择模型(始终使用可用的最强大模型:
    gpt-5.2-codex
  • -c key=value
    : 内联覆盖配置值(例如:
    -c model="gpt-5.2-codex"
  • -p PROFILE
    : 使用
    ~/.codex/config.toml
    中的配置文件,避免重复输入标志
  • -C DIR
    : 设置工作目录
  • --full-auto
    : 自动执行,使用可写入工作区的沙箱(减少确认停顿)
  • -s SANDBOX_POLICY
    : 沙箱策略(
    read-only
    workspace-write
  • --skip-git-repo-check
    : 跳过仓库检测(在Git外的环境节省时间)

Workflow

工作流程

  1. Gather context: Identify the files, plans, or diffs Codex needs
  2. Define the objective: What does “good” look like? Include constraints and acceptance criteria
  3. Compose a focused prompt: Be specific about what to review and what feedback you want
  4. Invoke Codex: Use
    codex exec
    with appropriate options
  5. Report findings: Present Codex's feedback to the user with your own assessment of which points are valid
  1. 收集上下文:确定Codex需要的文件、计划或代码差异
  2. 明确目标:“合格”的标准是什么?包含约束条件和验收标准
  3. 编写聚焦的提示语:明确说明需要审查的内容和想要的反馈类型
  4. 调用Codex:使用
    codex exec
    并搭配合适的选项
  5. 汇报结果:向用户展示Codex的反馈,并附上你对哪些反馈有效的评估

Model Policy

模型策略

  • Prefer
    gpt-5.2-codex
    ; if unavailable, use
    gpt-5.2
    .
  • If neither is available in this environment, select the strongest model supported by
    codex
    and note the fallback.
  • 优先使用
    gpt-5.2-codex
    ;若不可用,则使用
    gpt-5.2
  • 若当前环境中两者都不可用,选择
    codex
    支持的最强大模型,并记录降级使用情况。

Safety and Scope

安全与范围

  • Default to
    -s read-only
    for review-only tasks.
  • Use
    workspace-write
    only when Codex needs to run tests or inspect generated artifacts.
  • Never pass secrets, tokens, or private customer data.
  • 对于仅审查的任务,默认使用
    -s read-only
  • 仅当Codex需要运行测试或检查生成的产物时,才使用
    workspace-write
  • 切勿传入密钥、令牌或客户隐私数据。

Prompt Guidelines

提示语指南

  • State the review goal explicitly (e.g., "find logical errors", "evaluate scalability", "check for missing edge cases")
  • Include constraints or requirements Codex should check against
  • Ask for structured output (numbered issues, severity levels) for actionable feedback
  • Ask for concrete references (file:line) when reviewing code or diffs
  • 明确说明审查目标(例如:“查找逻辑错误”、“评估可扩展性”、“检查遗漏的边缘情况”)
  • 包含Codex需要对照检查的约束条件或需求
  • 要求结构化输出(编号问题、严重程度等级)以便获取可执行的反馈
  • 审查代码或差异时,要求提供具体的引用(文件:行号)

Interpreting Results

结果解读

  • Treat Codex feedback as a second opinion, not authority.
  • Verify any claims that seem uncertain or conflict with known constraints.
  • Prefer actionable items: bugs, regressions, missing tests, and unclear requirements.
  • 将Codex的反馈视为第二意见,而非权威结论。
  • 验证任何看起来不确定或与已知约束条件冲突的结论。
  • 优先关注可执行项:bug、回归问题、缺失的测试、不明确的需求。

Prompt Examples

提示语示例

Plan Review

计划审查

bash
cat plan.md | codex exec -m gpt-5.2-codex -s read-only \
"Review this plan for risks, missing steps, and unclear assumptions.
Return:
1) Critical issues
2) Medium risks
3) Suggested improvements
4) Questions to clarify"
bash
cat plan.md | codex exec -m gpt-5.2-codex -s read-only \
"Review this plan for risks, missing steps, and unclear assumptions.
Return:
1) Critical issues
2) Medium risks
3) Suggested improvements
4) Questions to clarify"

Diff Review

差异审查

bash
git diff main..HEAD | codex exec -m gpt-5.2-codex -s read-only \
"Review this diff for bugs, regressions, security issues, and missing tests.
Return numbered findings with severity and file:line references."
bash
git diff main..HEAD | codex exec -m gpt-5.2-codex -s read-only \
"Review this diff for bugs, regressions, security issues, and missing tests.
Return numbered findings with severity and file:line references."

Architecture Review

架构审查

bash
cat design.md | codex exec -m gpt-5.2-codex -s read-only \
"Evaluate this architecture for scalability, fault tolerance, and operational risk.
Call out assumptions and suggest alternatives where applicable."
bash
cat design.md | codex exec -m gpt-5.2-codex -s read-only \
"Evaluate this architecture for scalability, fault tolerance, and operational risk.
Call out assumptions and suggest alternatives where applicable."

Large Codebase Review

大型代码库审查

bash
codex exec -m gpt-5.2-codex -s read-only \
"Review the codebase with focus on correctness, edge cases, and missing tests.
Read these folders: src/, scripts/, and packages/.
Return numbered findings with severity and file:line references."
bash
codex exec -m gpt-5.2-codex -s read-only \
"Review the codebase with focus on correctness, edge cases, and missing tests.
Read these folders: src/, scripts/, and packages/.
Return numbered findings with severity and file:line references."