| name | nova-codex-review-fix |
| description | Run a semi-automated Codex review -> Claude Code fix -> local checks -> Codex verify closure loop for the current branch. Use when Claude Code should orchestrate review-driven fixes with external Bash scripts, structured review artifacts, validation reports, merge readiness, and residual-risk summaries. |
| license | MIT |
| allowed-tools | Read Glob Grep Write Edit |
| disallowed-tools | NotebookEdit |
| user-invocable | true |
| disable-model-invocation | true |
| compatibility | Requires Node.js 22+, Bash 3.2+, an authenticated Codex CLI, and network access for the external review/fix/verify loop. |
| metadata | {"nova-user-invocable":"true","nova-model-invocable":"false","nova-subagent-safe":"false","nova-destructive-actions":"medium"} |
| argument-hint | Example: codex-review-fix BASE=main GOAL='fix current branch until merge-ready' |
Shared Execution Policy
This file is the supporting behavioral contract for /nova-plugin:codex-review-fix and the deprecated /nova-plugin:nova-codex-review-fix compatibility entrypoint. Prefer the direct command; the compatibility name remains only for the current major-version migration window.
- Resolve natural-language and explicit
KEY=value inputs using ../_shared/parameter-resolution.md; explicit non-conflicting values take precedence.
- Apply
../_shared/safety-preflight.md before side effects. Never infer approval, destructive scope, credentials, or output destinations.
- Follow
../_shared/output-contracts.md and ../_shared/artifact-policy.md; report completed, skipped, and blocked validation truthfully.
- Respect the frontmatter tool boundary. Missing inputs, unavailable dependencies, overlapping user changes, or repository-policy conflicts are blockers rather than permission to broaden scope.
Execution
- Parse
$ARGUMENTS against the workflow-specific inputs below.
- Read only the context required for the requested scope.
- Apply the workflow contract and its strict output format.
- Stop before unauthorized side effects; otherwise validate in proportion to risk and report residual risk.
Workflow Contract
Generated from workflow-specs/behaviors.json. This block is authoritative. Run node scripts/generate-behavior-surfaces.mjs --write after changing the IR; if explanatory text below conflicts, fail closed.
Generated Behavior Index
- Purpose: Run an external Codex review, fix high-confidence findings, run project checks, and verify closure.
- Canonical inputs:
REVIEW_SCOPE(required aliases=INPUT,SCOPE); BASE(optional aliases=BASE_BRANCH); REVIEW_MODE(optional aliases=MODE default="branch" exact="branch","staged","full"); INCLUDE_UNTRACKED_CONTENT(optional default=false exact=true,false)
- Decision entries: 3.
- Workflow steps:
review → triage → repair → check → verify → close
- Output: mode=
workspace-and-chat; order=review artifact → fix summary → checks evidence → verification artifact → merge recommendation → residual risk; severity=must-fix, should-fix, ignorable.
- Deviation/failure: mode=
approval-required; failure order=status → completed phase → blocker → retained evidence → safe next action.
- Full IR:
runtime/contracts/codex-review-fix.json#behaviorContract embeds the complete decision table, invariants, stops, field definitions, validation, and failure contract from the same source. Detailed guidance below may not override it.
目的
执行一个面向当前分支的半自动闭环:
- 运行 Codex review 脚本产出结构化问题报告。
- 阅读
必须修、建议修 中高置信问题。
- 由 Claude Code 修改代码,必要时补测试。
- 运行本地检查脚本。
- 运行 Codex verify 脚本确认问题是否解决。
- 输出闭环结论、剩余风险、下一步建议。
何时使用
- 当前分支已经有改动,需要先 review 再修复。
- 希望让 Claude Code 负责修复与编排,Codex 只做 reviewer / verifier。
- 需要一套可沉淀到仓库、可复制到其他项目的 review-fix workflow。
资源导航
- 主说明:
README.md
- Prompt 模板:
prompts/*.prompt.md
- 外部脚本:
scripts/*.sh
只有在需要具体调用方式、参数细节或排障说明时再读取 README.md。
执行步骤
- 先确认当前目录是 Git 仓库,并识别默认基线分支。
- 运行
scripts/codex-review.sh。
- 读取输出目录中的
review.md,只提取高置信、高优先级问题。
- 参考
prompts/claude-fix.prompt.md 组织修复,不做与问题无关的大改。
- 如问题涉及行为缺口,优先补单测或集成校验。
- 运行
scripts/run-project-checks.sh --all --report-file <checks-file>。默认使用 .codex/codex-review-fix/latest-artifacts/checks.txt;显式 OUTPUT_DIR 时使用 <OUTPUT_DIR>/artifacts/checks.txt。
- 运行
scripts/codex-verify.sh --review-file <review.md> --checks-file <checks-file>。
- 读取
verify.md,按“已解决 / 未解决 / 不确定 / 新增高风险问题”总结。
优先级策略
- 先修
必须修 中会导致错误行为、数据风险、异常路径缺口、测试缺失的条目。
- 再处理
建议修 中高置信、低改动成本、能显著降低回归风险的条目。
可忽略 不默认处理,除非顺手即可消除且不会扩大改动范围。
安全边界
- 不执行
git reset --hard、git clean -fd、批量删除等危险命令。
- 不把 Codex 产物当成绝对真理;对低置信问题保持克制。
- 不因为 review 报告而主动重构无关模块。
- 本技能默认只操作当前仓库工作区,不负责发布、部署或远程环境变更。
输出要求
- Review 阶段:保留
review.md。
- 修复阶段:总结已修改内容、未修改原因、补充测试情况。
- 校验阶段:保留 checks 输出摘要。
- Verify 阶段:保留
verify.md。
- 收尾:输出本轮是否建议合并、剩余阻塞项、后续建议。
变体
nova-codex-review-only:只做 review,不进入修复闭环。
nova-codex-verify-only:基于已有 review.md 做 verify。
Detailed Contract
CODEX REVIEW -> FIX -> VERIFY LOOP
你是 Claude Code,扮演 fixer / orchestrator。
本命令用于当前分支的半自动闭环:
- 运行 Codex review
- 读取 review 结果
- 只修复高置信、高优先级问题
- 运行本地 checks
- 运行 Codex verify
- 输出本轮闭环结论
输入参数
从 $ARGUMENTS 中提取以下信息:
BASE:可选,review/verify 基线分支,默认自动识别
GOAL:可选,本轮修复目标,例如“修到可合并”
REVIEW_MODE:可选,branch / staged / full
OUTPUT_DIR:可选,review/verify artifact 输出目录
FIX_SCOPE:可选,修复选择策略;不改变脚本行为
INCLUDE_UNTRACKED_CONTENT:可选,默认为 false;仅与 REVIEW_MODE=full 搭配,显式允许未跟踪文件内容进入 review/verify patch
如果未提供,按当前仓库状态做最保守且最合理的选择。
强制执行流程
第一步:运行 review 脚本
先确认 CLAUDE_PLUGIN_ROOT 可用;如果不可用,必须停止并提示插件未正确启用。
执行:
bash "${CLAUDE_PLUGIN_ROOT}/skills/nova-codex-review-fix/scripts/codex-review.sh"
根据参数决定是否追加:
--base <BASE>
--only-staged
--full
--include-untracked-content only when REVIEW_MODE=full and INCLUDE_UNTRACKED_CONTENT=true
--output-dir <OUTPUT_DIR>
第二步:读取 review 结果
review 脚本会把结果写入 .codex/codex-review-fix/latest-artifacts/review.md(同时保留时间戳目录下的副本)。从该路径读取,只提取:
忽略低置信、纯风格、会扩大改动范围的问题。
第三步:实施修复
- 只改与问题直接相关的代码
- 必要时补测试
- 不做无谓大改或额外重构
第四步:运行本地验证
执行:
bash "${CLAUDE_PLUGIN_ROOT}/skills/nova-codex-review-fix/scripts/run-project-checks.sh" --all --report-file .codex/codex-review-fix/latest-artifacts/checks.txt
第五步:运行 verify 脚本
执行:
bash "${CLAUDE_PLUGIN_ROOT}/skills/nova-codex-review-fix/scripts/codex-verify.sh" --review-file .codex/codex-review-fix/latest-artifacts/review.md --checks-file .codex/codex-review-fix/latest-artifacts/checks.txt
Append --include-untracked-content to verify only when REVIEW_MODE=full and
INCLUDE_UNTRACKED_CONTENT=true.
第六步:输出总结
必须输出:
- 已修复问题
- 未修复问题及原因
- 本地验证结果
- Verify 结论
- 是否建议合并
- 剩余阻塞项
- 下一步建议
严格限制
你必须:
- 优先修复高风险 / 高置信问题
- 保持改动最小闭环
- 如实报告验证结果
你不得:
- 把 Codex 的所有建议都强行落地
- 伪造检查通过
- 执行高风险 Git 清理操作
- 因 review 报告而主动重构无关模块
结束条件
当以下条件满足时,本轮可视为闭环完成:
- review 已生成
- 代码修复已完成或明确受阻
- 本地 checks 已执行
- verify 已生成
- 最终结论已输出