Files
skills-win/langgraph-plan-review/SKILL.md
T

5.9 KiB

name, description
name description
langgraph-plan-review Use the LangGraph plan-review workflow in E:\LangGraph_Design\lab00 from the current Claude Code session. Trigger when the user asks to create Taskxx plans, run the Claude/Codex review loop, generate or revise Notes/Taskxx.md, or use the LangGraph workflow described by Task00.md. This skill uses the current Claude Code environment for Claude steps and only invokes the Python LangGraph app for Codex review and discuss file numbering.

LangGraph Plan Review Workflow

Use this skill to run the workflow implemented in E:\LangGraph_Design\lab00.

Invariants

  • Use the current Claude Code session for all Claude Code work. Do not launch another claude process.
  • Assume the current Claude Code session already has --dangerously-skip-permissions.
  • Run Python through the recorded conda environment. run_langgraph.ps1 resolves conda from -CondaExe, CONDA_EXE, conda on PATH, or the user-profile miniconda fallback:
    <resolved conda.exe> run -n langgraph python
    
  • Codex CLI is installed in the langgraph conda env as codex.cmd at C:\Users\bowei\.conda\envs\langgraph\codex.cmd. It must be invoked via cmd /c because .cmd files are not directly executable by Python subprocess on Windows.
  • Codex auth uses ChatGPT OAuth tokens stored in C:\Users\bowei\.codex\auth.json. No API key is needed.
  • run_langgraph.ps1 sets CODEX_HOME from -CodexHome, existing CODEX_HOME, or <UserProfile>\.codex.
  • Always use review_task.py as the Codex review shim. Pass it via --codex-review-command as a JSON array with no spaces. This shim handles all Windows-specific codex invocation requirements: cmd /c, stdin prompt passing, --skip-git-repo-check, session resume, and explicit cwd.
  • Keep all workflow files under <Claude launch work_dir>\Notes unless the user explicitly overrides -NotesDir.
  • TaskId is the numeric suffix, such as 01; write the plan to Notes\Task01.md.
  • discussxx-yy.md numbering is managed by the LangGraph app for Codex review files. If Claude rejects a review comment, create the next numbered discuss file manually before rerunning review.
  • The workflow uses LangGraph interrupt() and persists state in workflow_state.db.
  • Each run_langgraph.ps1 invocation advances the graph to the next interrupt or completion. Use -Resume to continue the same thread after completing the requested Claude Code action.

Workflow

  1. Determine TaskId from the user. If missing, ask for it.

  2. Start or resume the LangGraph app:

    # Use double backslashes (\\) in the JSON string so Windows paths are valid JSON.
    $codexCmd = '["C:\\Users\\bowei\\.conda\\envs\\langgraph\\python.exe","review_task.py","$task_path","$latest_discuss_path","$codex_session_id","$work_dir"]'
    E:\LangGraph_Design\lab00\run_langgraph.ps1 `
      -TaskId <TaskId> `
      -Prompt "<original user request>" `
      -CodexReviewCommand $codexCmd `
      -Timeout 300
    
  3. Inspect the returned JSON. If status is waiting, perform action_required in the current Claude Code session:

    • write_plan: write Task<TaskId>.md with project background, task objective, and concrete implementation plan, then resume with -Resume 'true'.
    • decide: read the discuss file and resume with -Resume '{"accepts":true}' or -Resume '{"accepts":false,"reason":"..."}'.
    • revise: revise Task<TaskId>.md, then resume with -Resume 'true'.
    • write_rejection: write the specified output_path, then resume with -Resume 'true'.

    Why review_task.py: Using the shim keeps all codex-specific logic in Python, and the JSON array stays simple.

    run_langgraph.ps1 base64-encodes the JSON command and resume payload before passing them through conda run, so normal PowerShell single-quoted JSON can be used. Windows paths inside the JSON string must use \\ (double backslash) to produce valid JSON, e.g. C:\\Users\\bowei\\.... run_langgraph.ps1 automatically sets PYTHONIOENCODING=utf-8 so prompts containing Unicode (Chinese, etc.) pass through correctly.

  4. Inspect the command output after each resume.

    • Check "status" to determine next action: "waiting" means perform the next action_required; "done" means the workflow is complete.
    • If a new latest_discuss_path is present in the output, read that discuss file for context.
  5. Stop when the workflow returns {"status":"done", ...}.

Rejection File Rule

When the action_required is write_rejection, the interrupt payload already contains the exact file path:

{"action": "write_rejection", "output_path": "Notes/discuss04-01.md", "reason_hint": "..."}

Write the rejection content directly to action_required.output_path:

# discuss<TaskId>-<yy>

## Claude Code Rejection

<reason>

Notes

  • The LangGraph app automatically scans existing discuss files and writes the next Codex review file without overwriting old discussions.
  • The app no longer accepts Claude command arguments; Claude actions happen in this current session.
  • If codex is unavailable, report that the review step cannot run rather than simulating it.
  • review_task.py passes the review prompt through stdin with - to avoid Windows command-line quoting issues with multiline prompts.
  • review_task.py passes --skip-git-repo-check so the workflow can run from Claude launch directories that are not git repositories.
  • review_task.py reads Codex final output via --output-last-message so intermediate JSONL progress messages are not treated as review findings.
  • review_task.py persists the Codex session id through LangGraph state and uses codex exec resume on later review passes.
  • review_task.py runs Codex with the original Claude Code launch working directory as cwd.
  • Codex review output is normalized to JSON for agents.py: {"has_serious_issue":true/false,"comment":"...","codex_session_id":"..."}.