Codex review

From ulpi-io/browse · View interactive version

Codex review is an AI agent skill from the GitHub repository ulpi-io/browse. Run OpenAI Codex CLI to review code changes made in the current session or branch. Invokes `codex review` with focused instructions derived from the actual changes. Use when the user says "codex review", "second opinion", "rival review", "cross-review", or "/codex-review".

How to use this skill

Skill file

Codex Review

Use OpenAI Codex CLI to get an independent AI review of code changes.

When to Use

Prerequisites

Workflow

Step 1: Determine the Review Scope

Identify what to review:

# Option A: Review current branch against main
git log --oneline main..HEAD | head -20

# Option B: Review uncommitted changes
git diff --stat

# Option C: Review a specific commit
git show --stat <sha>

Pick the right codex review flag:

Step 2: Analyze the Changes and Build Instructions

Read the diff to understand what areas need review focus. Build a

focused instruction file based on the actual code changes.

# Get the diff summary
git diff --stat <base>..HEAD

# Identify key areas
git diff --name-only <base>..HEAD | sed 's|/[^/]*$||' | sort -u

Write a focused instruction file to /tmp/codex-review-instructions.md:

You are reviewing [brief description of what changed].

Focus your review on:
1. [Area 1 based on actual changes]
2. [Area 2 based on actual changes]
3. [Area 3 based on actual changes]

Verify each finding against the actual code. Read the relevant
source files before reporting.

Key principles for instructions:

Step 3: Run Codex Review

codex review \
  --base <base-branch> \
  --title "<descriptive title>" \
  -c 'sandbox_permissions=["disk-full-read-access","disk-full-write-access","network-full-access"]' \
  -c 'instructions="/tmp/codex-review-instructions.md"' \
  2>&1

Important flags:

Run this in the background if the review is expected to take long:

Step 4: Parse and Report Findings

Read the codex output and extract findings. Look for lines matching:

Report findings to the user in a clear table:

| # | Priority | Description | File:Line |
|---|----------|-------------|-----------|
| 1 | P1       | ...         | ...       |

Step 5: Fix Findings (if requested)

If the user wants to fix the findings:

  1. Read each cited file to verify the finding is real
  2. Apply fixes
  3. Run tests and typecheck
  4. Commit the fixes

Step 6: Iterate (if requested)

For thorough review, run multiple rounds:

  1. Fix findings from round N
  2. Update instructions to list all previously fixed issues
  3. Run round N+1 with the updated instructions
  4. Repeat until findings converge to zero

Critical for iteration: Always add previously fixed issues to the

instruction file's exclusion list. Otherwise codex will re-report the

same issues every round, wasting time and API costs.

Example: Branch Review

# 1. Write instructions
cat > /tmp/codex-review-instructions.md << 'EOF'
You are reviewing a new authentication module.

Focus on:
1. SECURITY: JWT validation, token expiry, session management
2. CORRECTNESS: Error handling, edge cases, missing null checks
3. TESTING: Are there tests for error paths?

Verify each finding against the actual code before reporting.
EOF

# 2. Run review
codex review \
  --base main \
  --title "feat(auth): security review" \
  -c 'sandbox_permissions=["disk-full-read-access"]' \
  -c 'instructions="/tmp/codex-review-instructions.md"' \
  2>&1

Example: Iterative Deep Review

# Round 2 instructions (after fixing round 1 findings)
cat > /tmp/codex-review-instructions.md << 'EOF'
Round 2 review. Prior fixes (do NOT re-report):
- SQL injection in user query (parameterized)
- Missing auth check on /api/admin (added middleware)
- XSS in profile page (escaped output)

Focus on genuinely NEW issues only.
EOF

codex review --base main \
  --title "feat(auth): review round 2" \
  -c 'sandbox_permissions=["disk-full-read-access"]' \
  -c 'instructions="/tmp/codex-review-instructions.md"' \
  2>&1

Safety Rules

| Rule | Reason |

|------|--------|

| Never run codex without sandbox permissions | It needs file read access to verify findings |

| Always list prior fixes in iterative reviews | Prevents wasting rounds on already-fixed issues |

| Always verify findings before fixing | Codex can produce false positives |

| Run from the correct directory | Codex reviews the repo it's invoked in |

| Never pass secrets in instructions | The instruction file may be logged |

Failure Modes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.