Repository navigation
Description
Problem
revdiff-planning automatically reviews Claude Code plans through PreToolUse/ExitPlanMode, but Codex users only have the manual revdiff-plan skill. The Codex README still says Codex lacks hook support, and the manual skill uses best-effort rollout discovery that is ambiguous when several Codex sessions run concurrently.
Codex CLI now supports lifecycle hooks bundled in plugins. Live testing on Codex CLI 0.144.4 confirms that a root Stop hook can return {"decision":"block","reason":"..."} to continue the turn with feedback. Two details differ from the initial design assumptions:
permission_modeis the approval policy (bypassPermissionsin the tested Plan-mode session), not the collaboration mode, so it cannot gate Plan mode;last_assistant_messageis present butnullin the testedStoppayload. The same payload providestranscript_path,session_id, andturn_id.
Proposed solution
Extend the existing opt-in plugins/revdiff-planning package without changing the revdiff binary or replacing the manual fallback:
- keep the current Claude
PreToolUse/ExitPlanModehook unchanged; - add a Codex plugin manifest and Codex-specific hook config using
Stop; - review only complete
<proposed_plan>blocks from rootStopevents; clarification and normal Build-mode responses have no block and are ignored; - prefer a string
last_assistant_message; when Codex sends it asnull, read only the exacttranscript_pathwhose filename contains the eventsession_id, then select the final assistant message matching the eventturn_id; - do not skip
stop_hook_active == true, because that is the revised-plan pass after annotation feedback; - open the whole plan in revdiff through the existing trusted launcher chain;
- on a clean review, return
{}and let the turn end; - on annotations, return
decision: "block"with the annotations as the reason so Codex revises the plan and the nextStopreviews the new revision; - fail open with a visible warning for malformed or mismatched input, missing revdiff, missing launcher, or overlay failure, so the session cannot be wedged;
- document Codex marketplace install plus hook trust through
/hooks, while keeping/revdiff-planas the manual fallback and correcting the obsolete no-hook statement.
This remains opt-in because it is packaged as the separate revdiff-planning plugin.
Test plan
Add integration coverage for Claude and Codex payloads: clarification skips, clean plans, bypass approval, annotations and revised-plan loops, null-message exact-turn transcript fallback, missing message/binary, launcher failure, and malformed JSON. Verify the fallback ignores other turns and rejects mismatched sessions. Keep manual skill behavior intact.
Live smoke coverage on Codex 0.144.4 should prove: clean plan opens and quits normally; an annotation blocks the turn, causes a full revision, and opens RevDiff again; Build-mode/non-interactive output is unaffected.
If this direction fits the project, I can send a focused PR with no binary/API changes, changelog edits, or version bump.
Activity