codex-code-review
npx skills add https://github.com/nickcrew/claude-ctx-plugin --skill codex-code-review
Agent 安装分布
Skill 文档
Codex Code Review Loop
Overview
This skill orchestrates the complete remediation workflow for code under review by the codex agent. It handles:
- Requesting reviews from codex using the
codex --full-auto cCLI - Parsing review output to identify P0 (security/correctness), P1 (reliability), P2-P4 (quality) findings
- Remediating critical issues through up to 3 review-fix-review cycles
- Deferring quality improvements to backlog with implementation plans and
origin:ai-reviewlabels - Monorepo handling for selective file commits when working alongside other agents
- Circuit breaker escalation after 3 cycles if P0/P1 issues persist
When to Use
Trigger this skill when code requires codex review. Common usage patterns:
- “codex review this code” â Initiate review loop on current changes
- “run codex review on my changes” â Same as above
- “codex review –uncommitted” â Review all uncommitted changes
- “codex review –commit “ â Review specific commit in monorepo
- Questions about codex (e.g., “how does codex work?”) â Do not trigger this skill; answer directly
Do not trigger on questions. Only activate for direct review requests.
The Review Loop: Step by Step
ENTRY: User requests codex review or skill is triggered by "codex review" in a message
ââââââââââââââââââââââââââââ
â 1. INVOKE CODEX REVIEW â â Run: codex --full-auto c [--uncommitted|--commit <SHA>|--base <BRANCH>]
ââââââââ¬ââââââââââââââââââââ Output goes to .agent/reviews/review-<timestamp>.md
â
â¼
ââââââââââââââââââââââââââââ
â 2. READ & PARSE REVIEW â â Read markdown file, extract P0/P1/P2-P4 findings and verdict
ââââââââ¬ââââââââââââââââââââ
â
âââââââââââââââââââââââââââââââââââââââââââ
â â
â¼ â¼
ANY P0/P1? NO FILE P2-P4 ISSUES â Exit loop
â (via backlog CLI)
â YES Create issue per finding with
â - label: origin:ai-review
ââââââââââââââââââ - Implementation plan
â 3. REMEDIATE â - Priority (P2 or P3)
â P0/P1 FINDINGS â
ââââââ¬ââââââââââââ
â (amend commit or new changes)
â
â¼
ââââââââââââââââââââââââ
â 4. LOOP CHECK â
â Cycle count < 3? â
ââââââ¬ââââââââââââââââ¬ââ
â YES â NO
â âââ SUMMARIZE & ASK USER TO CONTINUE
â (or exit if user declines)
â¼
Re-run codex review (step 1, same files/scope)
Loop back to step 2
Cycle Management
- Cycle 1: Initial review after implementation
- Cycle 2: After first remediation
- Cycle 3: After second remediation
- After Cycle 3: If P0/P1 remain, stop. Summarize findings and ask user if they want to continue (rare; usually indicates design-level issues)
Decision Tree: Handling Findings
When review shows P0/P1 findings (verdict: REQUEST CHANGES)
- Read the codex review markdown file
- Extract each P0 and P1 finding with:
- Finding ID and title
- File location
- Suggested fix
- Fix ONLY the cited findings in the code
- Do NOT refactor, do NOT introduce new functionality
- If a fix requires significant design changes, note this and let codex re-evaluate on next cycle
- Amend your commit OR create a new one (user’s choice via git config; by default amend to keep one commit at end)
- Increment cycle counter and re-run codex review
When review shows P2-P4 findings (verdict: APPROVE or PASS WITH ISSUES)
-
For each P2/P3 finding, decide:
- Fix now: You have discretion; implement the improvement in the same cycle
- Defer: Create a backlog issue with:
- Type label:
remediation - Severity label:
P2orP3 - Custom label:
origin:ai-review - Implementation plan based on codex’s suggested approach
- Acceptance criteria from the review
- Type label:
-
Examples:
# P2 finding deferred to backlog backlog task create "Code clarity: add docstring to validateInput()" \ -d "Review finding: missing documentation on public function" \ -l remediation -p 2 \ --ac "Add docstring explaining parameter types and return value" \ --plan "Add JSDoc comment above function definition per project style"
When review shows no findings (verdict: APPROVE)
Exit the loop. Code is clean. Proceed to test review (if applicable) or commit for merge.
Monorepo Handling
In a monorepo with multiple agents, be selective about what you commit and what scope you review.
Scenario 1: Only Your Changes
If the working directory has ONLY your changes:
codex --full-auto c --uncommitted
Commit your changes once review loop completes.
Scenario 2: Mixed Changes (You + Other Agents)
If there are untracked or uncommitted changes from other agents:
- Commit ONLY your files first:
git add <your-files-only> git commit -m "Your commit message" - Note the commit SHA
- Run review on your commit:
codex --full-auto c --commit <SHA> - Remediate by amending your commit:
(Preserve the original message; the amend adds the fixes)git add <fixed-files> git commit --amend --no-edit - Loop back to review as normal
Result: One clean commit with your changes and fixes. Other agents’ work remains separate.
File Locations
- Review output:
.agent/reviews/review-<timestamp>.md(relative to project root) - One review file per cycle â new file created on each
codex --full-auto cinvocation - Always read the latest file â check the timestamp to ensure you’re reading the current cycle’s review
Bundled References
See references/codex-cli-reference.md for:
- Complete codex CLI syntax and invocation patterns
- How to select
--uncommittedvs.--commitvs.--base - When to use each mode
See references/review-format.md for:
- Structure of the review markdown output
- How to parse P0/P1/P2/P3 sections
- How to identify the verdict (APPROVE / REQUEST CHANGES / BLOCKED)
- Example review output
See references/backlog-integration.md for:
- How to create backlog issues from deferred findings
- Label and priority conventions
- Implementation plan templates
- Examples of issues filed from reviews
See scripts/parse_codex_review.sh for:
- Helper script to extract findings from review markdown
- Counts P0/P1/P2/P3 per cycle
- Quick verdict extraction
Key Rules
- All P0/P1 must be fixed before exiting the loop. No exceptions.
- P2-P4 can be deferred to backlog or fixed at your discretion.
- File one issue per finding â do not batch unrelated P2/P3s into one issue.
- Deferred issues must include a plan â codex identified the problem; you provide the structured approach.
- Amend commits (not new commits) during remediation so you end with one clean commit.
- Max 3 review cycles â after cycle 3, if P0/P1 remain, summarize and ask user to continue.
- In monorepos, commit selectively â review and fix only the files you touched.
Escalation: When Circuit Breaker Triggers
After 3 review cycles, if P0/P1 findings persist:
- Stop remediating. Do not attempt a 4th cycle.
- Produce a structured summary including:
- What was attempted in each cycle
- What P0/P1 findings remain
- Why they persist (agent assessment â design issue? conflicting requirements? ambiguity in spec?)
- Recommended human action
- Present this summary to the user and ask how to proceed.
Escalation usually indicates the original task spec needs clarification or the code requires architectural changes beyond remediation scope.
Integration with Other Skills
- backlog-md: File deferred P2/P3 findings using
backlog task createwithorigin:ai-reviewlabel - git-ops: Commit handling, amending, and selective staging in monorepos
- requesting-code-review: Use after codex review loop completes if human code review is also required
Quick Reference: The Full Workflow
1. User: "codex review"
â
â¼
2. Invoke: codex --full-auto c --uncommitted
â
â¼
3. Read: .agent/reviews/review-<timestamp>.md
â
âââââââââââââââââââââââââââââââââââââââââââ
â¼ â¼
P0/P1 FOUND? NO FILE P2-P4 ISSUES
ââ YES: Fix + Loop ââââââââââââââââ⺠backlog task create ... --plan "..."
ââ NO: File P2-P4 â Exit (each finding = one issue)
â
ââ Cycle 1 â Fix â Review
ââ Cycle 2 â Fix â Review
ââ Cycle 3 â Fix â Review
â
ââ If P0/P1 remain â Summarize + Ask User
â
ââ⺠Continue? (rare) / Stop & Escalate