code-review

A command that reviews the current software branch’s code changes through an adversarial Codex discussion. It checks correctness, security, reliability, simplicity, and performance, and does not commit changes.

In plain words
What is it for?
Use it to review the current branch against a chosen base revision, with the default base set to main, and identify issues that the developer must decide whether to fix.
Why use it?
It provides a strict quality check before the developer commits the reviewed code.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/v11g/codex-review-cc/code-review
Clone the repo
git clone --depth 1 https://github.com/v11g/codex-review-cc
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,503 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.04503
Opus 5 $0.00000 $0.02252
Sonnet 5 $0.00000 $0.00901
Haiku 4.5 $0.00000 $0.00450

Measured 2d ago against content hash 345104a31cce, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/code-review.md · 295 lines

How it starts

The opening of the file, as written. The whole thing — 295 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/codex:code-review — Codex correctness/security/reliability/simplification/performance review

Adversarially review the current branch's implementation diff: a Codex debate over correctness, security, reliability, simplification, and performance, looping until Codex approves. Codex is the hard gate. The command never commits — you do. Mechanics live in tested sr_* helpers; adjudicating findings and editing code is your (the agent's) job.

$ARGUMENTS (optional): [base] ref to diff against (default main).

Every shell block below runs under bash. codex-lib.sh and its helpers use bash arrays and abort under zsh/sh, so each block is wrapped in bash <<'CODEX_SH' … CODEX_SH — it runs under bash even when your default shell is zsh. And because each block runs in a fresh shell (sourced functions and vars do not persist between calls), every block re-resolves and re-sources the lib, then hands values to the next block through a per-repo state file (sr_state_file / sr_state_save / sr_state_load). The shared preamble — resolve LIB, source it, sr_state_load "$STATE" — opens every block.

Phase 0 — Resolve scope

bash <<'CODEX_SH'
# Resolve the plugin's lib + checklists. Order: installed plugin root, project-local
# checkout, a manual ~/.claude install, then the plugin cache (the unset-env
# fallback). First hit wins; CKDIR is its sibling.
LIB=""; CKDIR=""
for d in "${CLAUDE_PLUGIN_ROOT:-}" ".claude/commands/codex" "${CLAUDE_HOME:-$HOME/.claude}/commands/codex" $(printf '%s\n' "${CLAUDE_HOME:-$HOME/.claude}"/plugins/cache/*/codex/* 2>/dev/null | sort -Vr); do
  [ -n "$d" ] && [ -f "$d/codex-lib.sh" ] && { LIB="$d/codex-lib.sh"; CKDIR="$d/reference"; break; }
done
[ -n "$LIB" ] || { echo "codex-lib.sh missing — install the plugin or run install.sh"; exit 1; }
. "$LIB" || { echo "codex-lib.sh failed to source"; exit 1; }
command -v codex >/dev/null 2>&1 || { echo "codex CLI not on PATH"; exit 1; }
have="$(codex --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)"
sr_version_ge "${have:-0.0.0}" 0.140.0 || { echo "codex >= 0.140.0 required (have ${have:-none})"; exit 1; }

# Output mode. JSON (preferred): codex --output-schema returns schema-validated JSON,
# so structural parsing collapses to one sr_json_validate call — no fragile text grep.
# Falls back to markdown when no JSON parser (node), no schema file, or the schema is
# not strict-valid for codex (sr_schema_strict_ok) — so a bad schema degrades, not aborts.
# VFN/RFN/IDFN pick the parser so Phases 1.4/1.5 stay mode-agnostic.
SCHEMA=""; [ -n "$CKDIR" ] && SCHEMA="$(dirname "$CKDIR")/schemas/review-output.schema.json"
MODE=markdown; VFN=sr_parse_verdict; RFN=sr_round_findings; IDFN=sr_finding_ids
if sr_have_json && [ -f "$SCHEMA" ] && sr_schema_strict_ok "$SCHEMA"; then
  MODE=json; VFN=sr_json_verdict; RFN=sr_json_round_findings; IDFN=sr_json_finding_ids
fi

# args: token 1 = base ref (default main); token 2 = optional design-doc name hint
set -f; set -- ${ARGUMENTS:-}; set +f
BASE="${1:-main}"
SCOPE="$(sr_diff_scope "$BASE")" || { echo "cannot resolve scope vs '$BASE'"; exit 1; }
MB="$(printf '%s' "$SCOPE" | cut -f1)"
BRANCH="$(printf '%s' "$SCOPE" | cut -f2)"

PAYLOAD="$(sr_review_payload "$MB")"
if [ -z "$PAYLOAD" ]; then echo "Nothing to review (no changes vs $BASE)"; exit 0; fi

# design docs (spec + plan) — referenced by path for correctness/spec-compliance, not embedded
DESIGN="$(sr_design_docs "${2:-$BRANCH}")"
SPEC_DOC="$(printf '%s' "$DESIGN" | cut -f1)"
PLAN_DOC="$(printf '%s' "$DESIGN" | cut -f2)"

REPO="$(basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")"
LOG="$(sr_log_path "${REPO}-$(sr_root_hash)" "$(sr_sanitize_name "$BRANCH")")"
LOG="${LOG/spec-review-/codex-review-}"   # code-review log namespace
DEP="$(sr_audit_summary)"
# Fresh-shell handoff: persist resolved scope for the debate-loop blocks.
STATE="$(sr_state_file code-review)"; : > "$STATE"
sr_state_save "$STATE" LIB CKDIR SCHEMA MODE VFN RFN IDFN BASE MB BRANCH SPEC_DOC PLAN_DOC REPO LOG DEP
echo "Scope:  $BASE...HEAD ($BRANCH)"
echo "Mode:   $MODE"
echo "Log:    $LOG"
echo "Design: ${SPEC_DOC:-(none)} | ${PLAN_DOC:-(none)}"
echo "$DEP"
CODEX_SH

Read the full file on GitHub · 295 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 295 lines · 0 tokens per session scan A 345104a31cce

Subscribe to this mod's changes

code-review is a command published in the GitHub repository v11g/codex-review-cc (6 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,503 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.