claudex — Adversarial Claude+Codex Plan Review Loop

A Claude Code plugin that pressure-tests a plan before any code is written: Claude writes PLAN.md, Codex adversarially reviews it from three different reviewer angles in rotation, and a Stop hook drives the draft-critique-revise cycle autonomously in one terminal window until the plan survives review or a round cap is reached.

prompt
→ Claude
/claudex:plan <feature> — Claude drafts PLAN.md from a one-line feature description. A Claude Code Stop hook blocks the turn and runs Codex (via `codex exec`) against the plan using a rotating reviewer persona: round 1 senior engineer, round 2 security/data-integrity, round 3+ ops/SRE. Claude reads Codex's findings and either revises PLAN.md or calls mark-done. The hook re-fires each turn, incrementing the round and rotating the persona, until Codex reports no material findings or the max-rounds cap (default 3, configurable via --rounds) is hit.
claude-code

Implementation note

Plan-mode only writes PLAN.md and .claude/claudex/ state files — does not touch source code (a separate review mode for code diffs is read-only in v1, no auto-apply). Stop hook is fail-open on every error (explicit ERR trap) so a broken loop can't trap the session; includes concurrent-loop detection and a 15-minute stale-loop sweep. Requires a ChatGPT Plus/Pro/Team/Enterprise account since Codex authenticates against it — a cross-vendor cost/dependency worth calling out to users evaluating it.

Source: promptadvisers/claudex

More planning loops

loop-init, loop-audit, loop-cost CLI patterns

/ralphnew

Three starter CLI tools that turn loop design into a repeatable workflow: scaffold a loop with a goal, budget, and verify step; audit an existing loop design; and estimate cost before you run.

prompt
→ Claude
Starter CLI tools: `loop-init` scaffolds a loop (goal, budget, verify step), `loop-audit` reviews an existing loop design, `loop-cost` estimates spend before running.
planningmedium risk

Ralph the PRD backlog

The canonical Ralph loop: each iteration starts fresh, reads the PRD and guardrails, ships exactly one backlog item end-to-end, and records what it learned.

prompt
→ Claude
/loop start each iteration with fresh context: read PROMPT.md, prd.json, and .ralph/guardrails.md; pick the single highest-priority item in prd.json not marked done, implement it with tests, run the full check suite, commit and mark it done only if green; if blocked or a check fails twice the same way, append the lesson to .ralph/guardrails.md and move on; stop when every item is done or after 30 turns
planninghigh risk

Set agent continuation budget

/goalnew

Configure max turns before agent stops, preventing runaway loops and controlling execution cost.

prompt
→ Claude
/goal budget <n Set max continuation turns
planninglow risk