Review Plan
You MUST follow these steps exactly. Do NOT skip, reorder, or substitute any step.
Step 1: Locate the plan file
- •If
$ARGUMENTSis provided and non-empty, treat it as the plan file path. Resolve~to$HOME. - •If
$ARGUMENTSis empty or not provided:- •Use Glob to find all
*.mdfiles in~/.claude/plans/. - •The Glob results are sorted by modification time (most recent last). Pick the last file in the list.
- •If no files are found, tell the user: "No plan files found in ~/.claude/plans/. Provide a path:
/review-plan /path/to/plan.md" and stop.
- •Use Glob to find all
Step 2: Validate the plan file
Read the file to read the plan file. This is a validation gate — confirm the file exists and has content before spawning the subprocess. If the file does not exist or is empty, tell the user and stop. You do NOT need to analyze the content yourself; just confirm it's readable.
Step 3: Run the subprocess review
You MUST use Bash to run claude -p as a subprocess. Do NOT review the plan yourself — the entire point is to get an independent second opinion from a sandboxed subprocess.
Constructing the command
Use this exact pattern, substituting only the file path:
claude -p "$(cat <<'PROMPT' You are a senior staff engineer reviewing an implementation plan written by a junior developer. Your job is to find problems, not to be encouraging. Analyze the plan provided via stdin. Check for: 1. Logical inconsistencies or circular reasoning 2. Missing edge cases or failure modes 3. Overengineering or unnecessary complexity 4. Missing error handling at system boundaries 5. Unclear or ambiguous steps that could be misinterpreted 6. Missing verification steps or testing gaps 7. Architectural concerns (coupling, scalability, maintainability) 8. Security implications (injection, data exposure, auth gaps) 9. Dependency ordering problems (steps that assume prior work not yet done) Output format — use EXACTLY this structure: ## Grade: X/5 A single number from 0 to 5, followed by a one-line justification. - 0 — Critical errors that will cause failure if executed as-is - 1 — Major problems that need significant rework - 2 — Several important issues that must be addressed - 3 — Solid plan with some gaps to fill - 4 — Good plan, only minor improvements needed - 5 — Totally safe to continue as written ## Overall Assessment 1-2 sentences. Be direct. ## Concerns Number each concern. Tag severity as [Critical], [Important], or [Minor]. Explain WHY it is a problem and WHAT to do about it. ## What Works Well Brief summary of strengths (2-3 bullet points max). PROMPT )" --output-format text --tools "" < PLAN_FILE_PATH
Replace PLAN_FILE_PATH with the actual absolute path to the plan file. Use input redirection (< file) rather than cat file | to avoid shell quoting issues with pipe.
Non-negotiable requirements
- •
--tools ""MUST be present. This sandboxes the subprocess so it cannot execute code or read files — analysis only. - •
--output-format textMUST be present. This gives clean plaintext output. - •Do NOT add any other flags.
- •Do NOT pipe with
cat. Use< fileinput redirection. - •Set a Bash timeout of 120000 (2 minutes) since the subprocess needs time to analyze.
- •If the subprocess returns an error or empty output, show the error to the user and suggest they try again.
Step 4: Present the results
Show the subprocess output to the user, prefixed with a brief note about which plan file was reviewed. Example:
Reviewed: ~/.claude/plans/gleaming-tumbling-allen.md [subprocess output here]
Do NOT add your own commentary or re-analyze the plan. The subprocess output IS the deliverable.
Step 5: Capture session ID for follow-ups
The claude -p command prints a session ID to stderr (format: Session ID: ses_...). Capture it by appending 2>&1 or by extracting from the combined output.
After presenting the review, tell the user:
Session: <session-id> To continue this review conversation, run: /review-plan --resume <session-id>
Resuming a previous session
If $ARGUMENTS starts with --resume, extract the session ID that follows and run:
claude --resume SESSION_ID
This continues the existing review conversation so the user can ask follow-up questions, request clarification on specific concerns, or discuss fixes. Use --tools "" again to keep it sandboxed. Skip all other steps — go straight to this command and present the output.