aarontzeng/dev-lead/codex-adversarial-review

Claude Code and agent skill by aarontzeng/dev-lead

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Run a read-only Codex challenge review of a git diff with `codex exec` and the suite's adversarial framing (the Codex companion's adversarial-review is the fallback), then verify each finding against the code. Use when the user asks for an adversarial or challenge review from Codex/GPT, wants a second opinion on a design or implementation, or needs the review gate after codex-implement.

Install

npx vskill@latest install aarontzeng/dev-lead/codex-adversarial-review

SKILL.md

The same SKILL.md was published earlier as aarontzeng/dev-lead/codex-adversarial-review.

Codex adversarial review

Run the review as codex exec in a read-only sandbox, with the lead's lens wrapped in the suite's adversarial framing (`references/adversarial-framing.md`) and the effort set per run. Since 0.6.28 this is the default: in an equivalence test on three frozen targets with known answers (codex-runtime.md, 2026-09-23) it matched or beat the companion's adversarial-review on known-answer recall and false positives, read the base revision in every run where the companion did in fewer than half, and — unlike the companion — takes the effort the roster or triage asks for. The companion stays as the fallback below. This is a challenge review: inspect chosen boundaries, assumptions, failure modes, and trade-offs, not only local defects.

Before the first run of a session

Read [`references/codex-runtime.md`](references/codex-runtime.md) (same directory). It holds the family-level mechanics shared with codex-implement — companion resolution, the --background launcher-output trap, status lying about liveness, the lossy-pipe report loss, report recovery from session rollouts, sandbox limits, and the model/effort plumbing. Every item was paid for with an incident; this file assumes them and covers only what makes a run a review.

Establish an immutable review target

One frozen directory per reviewer, at the exact commit, that nothing else touches — no lead activity inside it. Not "whenever possible": a reviewer reads the WORKING TREE, not your commit. Measured — a round ran mutation testing in the same worktree mid-review and the reviewer opened a CRITICAL on a mutated, non-compiling file it was never meant to see.

Freeze it with the suite's tested helpers instead of hand-rolling the shell; every bug ever found in this step was in a hand-rolled copy. The suite-root resolver and both calls — freeze-target.sh to create it, verify-target.sh before AND after the run — are in dev-lead Phase 2, and the reasoning is in methodology.md §7. Everything below assumes $REVIEW_TARGET_DIR is that frozen directory and $REVIEW_HEAD is the SHA it was frozen at.

Capture the exact base SHA and require a clean review target before launch:

bash
git status --short
BASE=$(git rev-parse HEAD~1)
REVIEW_HEAD=$(git rev-parse HEAD)

For a worktree created by an implement skill, use its recorded BASE. For a single committed change use HEAD~1. Do not review a moving or partially staged implementation; finish and commit first.

For a multi-commit topic branch, `BASE` is the merge-base — never the branch it targets. BASE=$(git merge-base origin/main "$REVIEW_HEAD"). Writing BASE=origin/main is the natural move and it is wrong the moment the target has advanced past the branch point: the range then carries the author's change plus the reversal of everything the target gained meanwhile, so the delegate reviews other people's commits as if they were the author's.

The same trap hides in the diff spelling, because the two ranges look identical: git log A..B is genuinely "commits in B not in A" and is the range you want, but git diff A..B means git diff A B — not merge-base. Use git diff A...B (three dots) or diff against the captured BASE.

Nothing errors, and the HEAD assertion below still passes — it proves you launched at the right commit, not that the delegate read the right span. Measured: a target 10 commits ahead of the branch point turned a 3-file review into one that also read two other teams' files. Confirm the span before launching, not after:

bash
git diff --stat "$BASE" "$REVIEW_HEAD" # file list must match the change under review

Launch the review: codex exec with the suite's framing

Compose it with leg-cmd.sh, which emits both steps chained with &&: the builder wraps the brief (the LENS, in $RUN_DIR/prompt.md) in the framing, then codex exec reads the framed prompt from stdin:

Before this recipe, complete the frozen-target triage step in dev-lead Phase 2; the review launcher requires its record for this exact commit.

bash
DEV_LEAD=${DEV_LEAD_ROOT:-$(ls -d "$HOME"/.claude/plugins/cache/dev-lead/dev-lead/* 2>/dev/null | sort -V | tail -1)}
eval "$("$DEV_LEAD/scripts/leg-cmd.sh" codex review --model <model> --effort <tier> \
--base "$BASE" --target "$REVIEW_TARGET_DIR" --run-dir "$RUN_DIR")" > "$RUN_DIR/review.log" 2>&1

What the script emits, spelled out (for a lead without it): an export RUN_DIR=…, a guard that the brief exists and is not empty, then the builder and the run chained with &&. Nothing else -- the checks under it are the lead's, before and after.

bash
# export RUN_DIR=<the --run-dir, made absolute> -- emitted first, on its own line
test -n "$RUN_DIR" && test -s "$RUN_DIR/prompt.md" || { echo 'leg-cmd: RUN_DIR unset, or brief empty/missing:' "$RUN_DIR/prompt.md" >&2; false; } &&
python3 "$DEV_LEAD/scripts/review-prompt.py" --adapter codex --base "$BASE" --target "$REVIEW_TARGET_DIR" \
< "$RUN_DIR/prompt.md" > "$RUN_DIR/framed-prompt.md" && \
codex exec -C "$REVIEW_TARGET_DIR" -s read-only -m "$MODEL" -c "model_reasoning_effort=$TIER" \
-o "$RUN_DIR/review.md" -- - < "$RUN_DIR/framed-prompt.md"

Around it, the lead runs (these are NOT in the emitted command):

bash
"$DEV_LEAD/scripts/verify-target.sh" "$REVIEW_TARGET_DIR" "$REVIEW_HEAD" # before: frozen at the right SHA
rm -f "$RUN_DIR/review.md" # a stale report cannot pass for this run
rc=0; eval "$(…leg-cmd.sh codex review …)" > "$RUN_DIR/review.log" 2>&1 || rc=$?
"$DEV_LEAD/scripts/verify-target.sh" "$REVIEW_TARGET_DIR" "$REVIEW_HEAD" # after: nothing touched it
[ "$rc" -eq 0 ] || { echo "codex exec exited $rc; see review.log" >&2; exit 1; }
used=$(sed -n 's/^reasoning effort: //p' "$RUN_DIR/review.log" | head -1)
[ "$used" = "$TIER" ] || { echo "effort used '$used', wanted '$TIER'" >&2; exit 1; }
[ -s "$RUN_DIR/review.md" ] || { echo "no review written" >&2; exit 1; }
  • $RUN_DIR lives outside the frozen worktree; $BASE, $REVIEW_HEAD and

$REVIEW_TARGET_DIR are set as above. Quote $MODEL: an unquoted <…> placeholder is a shell redirection.

since 0.6.30; codex-review-prompt.py is its codex name) substitutes in one pass, so a {{HEAD}} inside the lens stays literal; it refuses an empty lens, an unknown placeholder or an unreadable HEAD, and the && stops the paid run.

  • The prompt goes on stdin (-- -): no argv length cap, a prompt that starts

with - stays text (a -s workspace-write first line did not change the sandbox; codex-cli 0.156.1), and codex never waits on an inherited stdin.

  • -C must name a directory inside a git repository; outside one codex

prints Not inside a trusted directory … and exits without reviewing.

  • review.md holds the final message only; review.log holds the tool calls

and the reasoning effort: header — the only record of the effort that actually ran, and where "did it read the base revision" is checked.

  • codex exec review --base is not a substitute: it refuses a custom prompt

together with --base (codex-cli 0.156.0), so neither lens nor framing can ride on it. Inlining the diff into the prompt showed no gain.

The report ends with a plain Verdict: approve or Verdict: needs-attention line, which `scripts/leg-log-check.sh` accepts; check it before reading.

Fallback: the companion's adversarial-review

Use it only when codex exec is unavailable, and say so in the report. It supplies its own framing and tracks the run as a job, but it has no effort flag: the review runs at model_reasoning_effort from the machine's ~/.codex/config.toml, whatever the roster or triage asked for. Read that value and report it; do not assert one.

Resolve the newest installed plugin without hardcoding a home or version:

bash
REVIEW_WORKTREE=/absolute/path/to/target-worktree
SCRIPT=$(ls -d "$HOME"/.claude/plugins/cache/openai-codex/codex/*/scripts/codex-companion.mjs \
2>/dev/null | sort -V | tail -1)
[ -n "$SCRIPT" ] || { echo "codex plugin not installed"; exit 1; }
cd "$REVIEW_WORKTREE" && \
[ "$(git rev-parse HEAD)" = "$REVIEW_HEAD" ] && \
node "$SCRIPT" adversarial-review \
--background --base "$BASE" --scope branch --model <model> "$FOCUS"

The identity assertion between the cd and the launch is not decoration — measured: a launch composed without the cd (a stale shell cwd pointing at a DIFFERENT repo) started a real, billed review of the wrong tree, caught only by a human noticing before it finished. An in-command HEAD check makes a wrong target fail loud in milliseconds instead.

Launch under the host's own background mechanism with output redirected to a file, per the runtime's launcher rules (--background does not guarantee a prompt return; a lossy pipe can destroy the only copy of the report).

Running this leg as a subagent? You are a leaf — block, do not "wait". Nothing will wake you when the job finishes; ending your turn on "waiting for the notification" abandons the review. Poll to terminal inside a single tool call, and issue another such call immediately if it times out (dev-lead Phase 2).

Model choice

The exec path takes both --model and the effort: use the roster's review leg, raised to triage's effort for the change when it gives one (the table only raises). The companion fallback takes --model only and runs at the machine's config effort (runtime file has the plumbing). Pick per your calibration journal, with two measured priors:

  • Review is the highest-leverage step — when quota allows, spend the

strongest tier here rather than on implementation.

  • Match the model to the ROLE. A fast tier that underperforms at defect

hunting produced the deepest finding of a five-round sequence when given the challenge brief ("is this the right approach at all, what assumption is unexamined") — while a stronger model on a sequence brief returned an under-evidenced HOLDS on the same question. When you spend multiple legs, change the brief, not just the model; identically-briefed legs buy redundancy, differently-briefed legs' findings overlapped zero percent.

Omitting --model inherits the user's codex-config default — pass it explicitly rather than inheriting silently.

Both paths run read-only (-s read-only on exec; the companion enforces it); do not add any bypass flag. After the run, verify the review itself changed nothing — verify-target.sh in the block above, or by hand:

bash
test "$(git rev-parse HEAD)" = "$REVIEW_HEAD"
test -z "$(git status --porcelain)"

If either check fails, stop and report the unexpected mutation before trusting the review output.

  • Materializing evidence the frozen tree does not contain — another

revision's copy, a merge-base baseline — has cross-family rules on where it goes and what guarantees it carries: `docs/materializing-evidence.md`. Never write scratch files into the frozen target; a leg that genuinely cannot keep them elsewhere declares those exact paths to verify-target.sh instead.

Write a useful focus prompt

The framing already tells the reviewer to read every touched file at the base revision with nl -ba, to stay read-only (no tests, builds, MCP or external tools), to separate introduced from inherited defects, to check whether a later check mitigates a hazard, to answer each posed claim with HOLDS / BROKEN / NOT REACHED, and to end with a plain verdict line. The lens you write supplies the rest (on the companion fallback, include all of it):

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
7-day trend score
5

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/aarontzeng/dev-lead/codex-adversarial-review/badge)](https://verified-skill.com/skills/aarontzeng/dev-lead/codex-adversarial-review)

Something wrong with this skill or its page? Tell us.