Index of every page on this site: llms.txt
All skills
david-crespo avatar

/codex-review

@d229350
Run it yourself

For non-Codex agents, get a Codex second opinion on your changes. Claude sends the diff to Codex for review, discusses the feedback, and synthesizes actionable results.

Use this Skill: https://skilld.dev/gh/david-crespo/dotfiles/codex-review

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈46 tokens for metadata: the name and description. ≈1.1k when used: this file.

Description uses 2.3% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈183 characters, or 2.3%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Codex Review

Use Codex as a second pair of eyes on the current changes. Claude sends the diff to Codex, reads the response, and can go back and forth with Codex to clarify or push back on feedback before presenting a synthesis to the user.

Input

The user may provide:

  • A description of what to have Codex review (defaults to the current diff)
  • A specific revision or range to diff (defaults to fork point from trunk)
  • How many rounds of back-and-forth to allow (defaults to up to 2)

How to call Codex

Use {baseDir}/codex-call.ts for all Codex interactions. It wraps codex exec with the right model (gpt-5.4), reasoning effort (xhigh), JSON extraction, and cost calculation.

On new sessions, the script automatically prepends a preamble to the prompt that tells Codex:

  • It's being called by Claude Code to review a change
  • It's in a read-only sandbox (can read files, can't run tests or write)
  • If it wants to test a hypothesis, it should describe the test and Claude will run it
  • It should focus on substantive issues, not style

On --resume calls the prompt is sent as-is since Codex already has context.

Important: Codex calls can take several minutes. Always set a 10 minute timeout (600000ms) on Bash calls to codex-call.ts.

Starting a session:

RESULT=$({baseDir}/codex-call.ts "The diff is in /tmp/codex-review-diff.patch — read it and provide your review.")
THREAD_ID=$(echo "$RESULT" | jq -r '.thread_id')
RESPONSE=$(echo "$RESULT" | jq -r '.response')

Continuing a session:

RESULT=$({baseDir}/codex-call.ts --resume "$THREAD_ID" "follow-up prompt")

Output format:

{
  "thread_id": "019c...",
  "response": "review text here",
  "input_tokens": 9725,
  "cached_tokens": 0,
  "output_tokens": 40,
  "cost_usd": 0.03
}

Process

1. Get the diff

When the user says "this change" or doesn't specify, diff the current change against its fork point from trunk:

jj diff -r 'fork_point(trunk() | @)..@'

If the user specifies a revision, use that instead. For large diffs, use --stat first to understand scope, then get the full diff.

2. Send to Codex for review

Write the diff to a temp file and ask Codex to review it.

jj diff -r 'fork_point(trunk() | @)..@' > /tmp/codex-review-diff.patch
RESULT=$({baseDir}/codex-call.ts "The diff is in /tmp/codex-review-diff.patch — read it and provide your review.")

Save the thread ID and response from the JSON output.

3. Evaluate the response

Read Codex's review. For each point raised:

  • If it's clearly valid, note it
  • If it's unclear or seems wrong, formulate a follow-up question
  • If it's noise (style nits, theoretical concerns), skip it
  • If Codex proposes a test to verify a concern, run it locally and report the result back via --resume

4. Follow up if needed (up to 2 rounds)

If there are points worth discussing, send a follow-up using --resume:

RESULT=$({baseDir}/codex-call.ts --resume "$THREAD_ID" "your follow-up")

This might be:

  • Pushing back on a point with additional context
  • Asking Codex to elaborate on a vague concern
  • Reporting test results from running Codex's suggested verification
  • Asking it to read specific files to check a claim

Each round uses the same thread ID, so Codex has full context.

Do not do more rounds than necessary. If the first response is clear and actionable, skip follow-ups. The max is there for cases where clarification genuinely helps.

5. Synthesize for the user

Present a summary that includes:

  • Issues worth addressing, with file locations and suggested fixes
  • Points raised by Codex that were investigated and dismissed (briefly, with reasoning)
  • Any disagreements between your analysis and Codex's

If there's nothing substantive, say so. Don't inflate minor points.

Sum up cost_usd across all calls and include total usage at the end:

Codex usage: 15,230 input tokens (8,400 cached), 1,204 output tokens across 2 turns — ~$0.03

Notes

  • Codex runs read-only in the default sandbox. It can read files and run read-only commands (cat, rg, etc.) to verify its claims.
  • If Codex proposes a test to verify a concern, run it locally in this Claude session rather than asking Codex to execute it. Report the result back to Codex via --resume if needed.
  • If Codex seems to be hallucinating about file contents, ask it to cat the file in a follow-up rather than trusting its memory.
  • Model, preamble, and pricing are configured in codex-call.ts.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

2 warnings7mo3 checks · Risk MEDIUM
  • Gen Agent Trust Hub7mo

    The skill performs code reviews by sending code diffs to an external service. It is designed to execute 'tests' or commands suggested by that external service, which creates a risk of indirect prompt injection leading to unauthorized command execution on the local system.

  • Socket7mo

    No alerts

  • Snyk7mo

    Risk: MEDIUM · 1 issue

Signed by skilld at d229350. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 4 months ago

README badge

README badge for david-crespo/dotfiles/codex-review