/praxis:codex-review-wrapfrom praxis
Worktree-aware wrapper for /codex:review. Forces explicit worktree selection when several worktrees are active, preventing silent cwd mismatch, then gates every returned finding: premise verification before fact-modifying edits, flip detection halting A→B→A oscillation, sibling cross-checks for a port or parallel hotfix, a diminishing-returns advisory (PRAXIS_DIMINISHING_RETURNS_N), and a per-finding approval ask. It also reaps leaked openai-codex brokers (PRAXIS_CODEX_REAP=1).
Ships in praxis. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
/codex:review selects the working tree based on cwd. When multiple worktrees
are active — the common case mid-session after a merge or context switch — cwd
drifts away from the intended target without warning.
This wrapper intercepts before Codex runs:
git worktree listAskUserQuestion forces explicit selection/codex:review behaviour)/codex:review with the confirmed worktree as cwdAfter Codex returns, a second responsibility activates: every fact-modifying
finding must pass an independent premise check before it becomes an edit, and
the wrapper maintains a session ledger that halts same-session A→B→A flips.
When the PR is a port / parallel hotfix / A/B implementation of logic in a
sibling PR or repo, Step 5d additionally cross-checks each verified finding
against the sibling and records the result. Step 5f tracks how many rounds
have touched each {file}:{region} pair and emits a one-time non-blocking
advisory when the count exceeds the configured threshold (default: 4 rounds,
env var PRAXIS_DIMINISHING_RETURNS_N). Step 5i then puts every finding
that survived 5b and 5c — fact-modifying, structural, or stylistic — in
front of the user via AskUserQuestion before any edit lands: the agent's
verdict is a recommendation, the user's answer is the decision.
See Step 5 for the full gate.
A third responsibility runs at phase end: Step 6 reaps openai-codex
app-server brokers that outlived their owning session (a process leak that
spikes kernel_task once accumulated RSS crosses the macOS compressor
threshold). See Step 6 for the reaper and its safety gate.
Reference map:
references/step4-run-review.mdreferences/step5-premise-verification.mdreferences/step5-siblings-and-regions.mdreferences/step5-approval-and-rounds.mdreferences/appendices.mdreferences/example-flow.mdreferences/verification-log.mdCardinality: This skill handles exactly one PR per invocation. For N PRs, invoke the skill N times sequentially. Batch for-loops are not supported — they collapse Step 5c per-round ledger emission across multiple PRs and break flip-detection guarantees.
One invocation may still run N rounds against that single PR: the axis the batch prohibition guards is PR cardinality, while Step 5j loops on round cardinality, and every one of its iterations passes through an explicit user decision.
/codex:review from any multi-worktree project/codex-review-wrap
/codex-review-wrap --model opus
Optional --model is forwarded to /codex:review unchanged.
git worktree list --porcelain
Parse output into a list of {path, branch, HEAD, detached} entries.
Filter out entries with the explicit bare marker — they have no working tree.
Keep detached worktrees (no branch line but no bare marker) as valid review targets.
Expected output shape per entry:
worktree /path/to/repo
HEAD <sha>
branch refs/heads/<branch-name>
worktree /path/to/repo-wt/feature-xyz
HEAD <sha>
branch refs/heads/feature-xyz
worktree /path/to/repo-wt/detached-xyz
HEAD <sha>
detached
Evaluate Case A2 first; Cases A and B apply only when no PR is named.
Case A2 — the review is for a named PR:
Read the PR's headRefOid (gh pr view <N> --json headRefOid). If exactly
one worktree's HEAD equals it, that worktree is the target: skip the
question and proceed to Step 3. The commit match removes the ambiguity the
question exists for. Ask as in Case B when no worktree or more than one
matches — even when only one worktree exists, since its HEAD is then not
the PR's head and reviewing cwd would review unrelated code.
Case A — exactly 1 non-bare worktree (no named PR):
Skip selection. Proceed directly to Step 3 using cwd.
Case B — 2 or more non-bare worktrees:
Call AskUserQuestion with at most 3 worktree options + "취소" to
respect the AskUserQuestion.options maxItems: 4 runtime cap (see
RUNTIME_CONSTRAINTS.md). When more than 3 worktrees are active, rank
by recency (most recent HEAD commit time first) and surface the top 3;
the runtime's automatic "Other" slot lets the user type any worktree
path not in the list.
title: "어느 worktree 를 review 할까요?"
question: "현재 활성 worktrees:\n{numbered list of ALL worktrees}\n\n번호를 선택하거나 'Other' 에 경로를 직접 입력하세요."
options: [{path}: ({branch}) for top 3 most-recently-updated worktrees] + ["취소"]
The full worktree list still appears in the question body so the user
can read every path even when only the top 3 are surfaced as options.
If the user picks "Other" and types a path, validate it against the
full git worktree list output before proceeding.
Wait for user response. If "취소" or no selection → abort with message:
"Review 취소됨. 대상을 선택하지 않았습니다."
Show a one-line summary before delegating:
Review target: {selected_path} (branch: {branch})
If the selected path differs from cwd, note it explicitly:
⚠ cwd ({cwd}) ≠ review target ({selected_path}) — codex:review 를 선택된 경로에서 실행합니다.
Before delegating to codex-companion, verify the PR is not already closed. Using the branch resolved in Steps 1–2:
gh pr view "{branch}" --json state --jq '.state' 2>/dev/null
"CLOSED" or "MERGED": abort immediately:ABORT: "PR is {state} — review aborted. Re-open or target a different PR."
MUST NOT call Skill("codex:review"). /codex:review declares
disable-model-invocation: true, so the Skill tool always returns the
following error and the call wastes a turn every time:
Skill codex:review cannot be used with Skill tool due to disable-model-invocation
This is a constant property of /codex:review — not session-dependent,
not retry-able, not environment-gated. Do not probe it as a pre-check;
do not attempt it as a "primary path before fallback"; do not
re-attempt it on a later round in the same session. Route straight to the
companion script in 4a/4b on every invocation, including the first.
The only Skill(...) call legitimately reachable from Step 4 is the
oh-my-claudecode:code-reviewer fallback in 4a — and only when the
codex-companion.mjs path does not resolve. Under Hermes there is no
/codex:review and no omc; the companion is the only Codex path (see
Running under Hermes).
Read the install path from the canonical installed_plugins.json; when it
does not resolve, offer the oh-my-claudecode:code-reviewer / Manual /
Cancel alternatives via AskUserQuestion. Either way, record a
review-path: ledger row on every first round of a target — a 5j re-entry
reads that row instead of re-resolving or re-asking. Full procedure:
references/step4-run-review.md.
Always run the companion via Bash(..., run_in_background: true) — a
foreground tool timeout kills a review mid-run and the round then looks
clean while having verified nothing. Return the script's stdout verbatim.
Judge liveness on ps + log mtime, never on status or elapsed (both
report a dead job as a healthy one). A completed background round re-enters
Step 5 from the top; findings are never applied from the completion
notification alone. Full procedure — measured against the companion version
pinned there:
references/step4-run-review.md.
Codex review output is advisory, not authoritative. Findings whose rationale depends on assumed facts (table contents, column names, CLI flag shapes, filter semantics) must be verified against the actual system before any edit is applied. Skipping this gate is the cause of A→B→A flip oscillation across consecutive Codex rounds.
This step runs once Codex has returned its findings and the agent is about to translate them into edits. It applies to every round in the same session, not just the first. Terminology used below:
Sub-sections below are numbered for cross-reference, not execution order. The execution order each round is:
claude -p, background worker, a Hermes cron job or kanban worker, any
context where AskUserQuestion / clarify has no recipient), skip every question step (5d-i and 5i) and take the
non-interactive path in Error Handling: classify and verify findings
(5a–5c) but apply nothing, deferring the survivors. Doing this first is
what keeps the unconditional 5d-i question from stalling the round before
classification happens.round-started: ledger row — write it unconditionally, before any
finding is known, so a round that ends up empty still advances the
round number (5c → Round number).rounds_per_region:
ledger for each region touched; emit the diminishing-returns advisory if
cumulative = threshold + 1.AskUserQuestion to confirm
whether the PR is a port / parallel hotfix / A/B implementation
(interactive runs only, per step 0).applied: /
rejected: collisions before each edit.Probe: n/a.적용
answers. Runs after classification/verification/flip-scan/probe
check (so the question carries evidence) and before the first edit
of the round.Premise-Verified: trailer on the
committed fact-modifying edit.AskUserQuestion whether to run another Codex round. On continue,
re-enter Step 4 for round N+1; otherwise proceed to Step 6.
Re-entry skips Steps 1–3 and item 3 (5d-i) above.The full sub-step procedures live in three reference files — open the file at the point of use. Every normative rule of 5a–5j is stated there, not here; the lines below only say what each sub-step guarantees.
references/step5-premise-verification.md
— from findings to verified findings:
Probe: citation at the assertion
site before it may be surfaced; includes the critic prompt template block.references/step5-siblings-and-regions.md
— cross-checks and counters:
rounds_per_region: counter
and the once-per-region advisory at cumulative = threshold + 1
(PRAXIS_DIMINISHING_RETURNS_N, default 4).references/step5-approval-and-rounds.md
— decisions and the round boundary:
Premise-Verified: trailer on every committed
fact-modifying edit; the single rule for trailer scope.AskUserQuestion (batches of at most 4;
적용 / 미적용 / 후속이슈); there is no auto-apply path.The openai-codex plugin starts a per-session app-server broker that is
reparented to launchd (ppid=1) and is not killed when its owning Claude
session exits. Across multi-day uptime these accumulate; once cumulative RSS
crosses the macOS memory-compressor threshold, each idle broker's periodic
wakeup drives compress/decompress churn that surfaces as kernel_task system
CPU — a non-linear spike, not a linear one.
Run the co-located reaper at the end of every review invocation — macOS
only: the leak is a launchd//var/folders mechanism and the script uses BSD
stat, so on other platforms skip this step entirely. It is the
single source of truth for safe reaping, shared with the launchd job (see
LAUNCHD.md). Resolve it via the plugin root, mirroring the strike-counter
convention used by the strike / reset-strikes skills. Under Hermes
CLAUDE_PLUGIN_ROOT is unset in the agent's shell, so substitute the
skill directory Hermes prints with the loaded skill ([Skill directory: …])
for ${CLAUDE_PLUGIN_ROOT}/skills/codex-review-wrap:
Default — GC only (zero risk). Removes the stale tmp sessionDirs of brokers whose pid is already dead. Never signals a running process.
"${CLAUDE_PLUGIN_ROOT}/skills/codex-review-wrap/codex-broker-reaper.sh" --gc
Opt-in — also reap running idle brokers. When PRAXIS_CODEX_REAP=1 is set,
additionally kill running brokers whose broker.log has been idle longer than
--max-age minutes (default 30). A broker actively serving a review has a
freshly-touched log and is skipped by the idle gate, so this stays safe to run
from inside a session even while sibling sessions hold their own brokers.
if [ "${PRAXIS_CODEX_REAP:-0}" = "1" ]; then
"${CLAUDE_PLUGIN_ROOT}/skills/codex-review-wrap/codex-broker-reaper.sh" --reap --max-age 30
fi
Never broad-kill (pkill -f codex, pkill node): sibling Claude sessions
share the same broker process class, and an unscoped kill aborts their
in-flight reviews. The reaper's per-broker idle gate is the only sanctioned
path. The heavy, session-independent reclaim of running orphans belongs to the
launchd job (LAUNCHD.md), not to a per-review phase end — phase end only
keeps the count below the compressor threshold.
Hermes Agent loads this skill from the same checkout and runs the same procedure. Substitute the host tools; every gate, ledger row, and decision rule stays as written.
| Written for Claude Code | Under Hermes |
|---|---|
AskUserQuestion (Steps 2, 4a, 5d-i, 5i, 5j) | clarify — same 4-choice cap, and Hermes appends its own Other row |
Bash(..., run_in_background: true) (Step 4b) | terminal(background=true, notify_on_complete=true) (some builds name the flag notify), then end the turn; Step 5 starts when the completion notification arrives |
Skill("oh-my-claudecode:code-reviewer") fallback (Step 4a) | not available — offer delegate_task with a reviewer goal, Manual, or Cancel |
${CLAUDE_PLUGIN_ROOT}/skills/codex-review-wrap/… (Step 6) | the [Skill directory: …] path Hermes prints with the skill |
companion state under $CLAUDE_PLUGIN_DATA/state/ | $TMPDIR/codex-companion/<workspace-slug>-<hash>/ — CLAUDE_PLUGIN_DATA is unset, so the companion uses its own fallback root (os.tmpdir()). The reaper reads that root too, from TMPDIR, or from getconf DARWIN_USER_TEMP_DIR when a macOS launchd run has no TMPDIR |
Step 4a's companion resolution is unchanged: the manifest stays at
~/.claude/plugins/installed_plugins.json (codex@openai-codex) whichever
host runs the skill.
Two traps seen under Hermes:
codex review --base <ref> refuses a prompt argument (the argument '--base <BRANCH>' cannot be used with '[PROMPT]') and exits 2 before reviewing anything.
Run the companion as Step 4b says.running. A Hermes
background process can end with exit 143 (SIGTERM) and no completion
notification while the companion's job record still says running.
Apply Step 4b's liveness rule: check the pid with ps, and on a dead pid
cancel the job and re-launch — never read the silence as a clean round.cd <worktree> && node <companion> review --base origin/<base> <forwarded arguments> > <scratch>/codex-<pr>-r<N>.out 2>&1; echo "exit=$?" >> <file> in a background terminal, where the forwarded arguments are the
ones Step 4b passes on (--model, a scope). The completion notification
carries only shell noise (e.g. can't change option: zle) and reports
success whatever node returned, so read the file's exit= line first: on
a nonzero status, report that status and the file's error text and stop.
Only after exit=0 extract the findings, which start at the
# Codex Review line (sed -n '/^# Codex Review/,$p').clarify popup), the
run has a recipient, so step 0 treats it as interactive, and 5i is one
queued decision per round: list every surviving finding with its premise
probe result and the planned fix, offer apply-all / a named subset with
the rest recorded on the open issue / none, recommend one, and end the
turn waiting. A finding the user already deferred in an earlier round is
named as "already decided" in the next round's ask, not asked again.Unverified list and the
merge ask as "not reviewed by codex".The full error-handling table — per-situation actions for every step, several
of which change control flow (abort, skip, halt) rather than wording — and
the limitations list live in
references/appendices.md. Consult the table the
moment a step hits an unexpected state.
A worked end-to-end transcript — worktree selection (Steps 1–3), the review
run (Step 4), every Step 5 gate firing on concrete findings across multiple
rounds, flip halts, and the 5j round loop — lives in
references/example-flow.md.
LAUNCHD.md (opens in a new tab)codex-broker-reaper.plist (opens in a new tab)codex-broker-reaper.sh (opens in a new tab)references/appendices.md (opens in a new tab)references/example-flow.md (opens in a new tab)references/step4-run-review.md (opens in a new tab)references/step5-approval-and-rounds.md (opens in a new tab)references/step5-premise-verification.md (opens in a new tab)references/step5-siblings-and-regions.md (opens in a new tab)references/verification-log.md (opens in a new tab)tests/fixture-sibling-defect-cross-check.md (opens in a new tab)tests/fixture-step4-no-skill-probe.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Triggers on "codex review", "review codex", "safe review", "/codex-review-wrap", "premise verification", "flip detection", "sibling defect", "sibling cross-check", "diminishing returns", "broker reap", "finding approval", "적용 승인".
npx claudepluginhub devseunggwan/praxis --plugin praxis16 skills in this plugin
/cmux-delegateHand off an existing independent issue that surfaced mid-task to its own Claude Code session in a new cmux workspace, with auto-collected context; that session runs issue→worktree→PR alone. Not for splitting the current task./cmux-recover-sessionsBulk recover Claude Code sessions after a crash, power loss, OOM kill, or reboot by scanning the .jsonl files Claude Code persists automatically. Interactive interview chooses recovery scope and layout. Use this when sessions died and you need them back. The .jsonl scan reflects each session's real final state, so no snapshot taken before the crash is needed.
/merge-briefingBrief and ask before merging any PR: probe CI, reviews and inline threads, grade every open finding by its blocking decoration, carry the anchor's `Unverified` gaps, write the six-part briefing, and end on the approve-ask.