更新了langgraph-plan-view,支持windows下使用 langgraph cli;更新了langgraph-vivado-install,要求安装langgraph cli,确定conda环境的名称为langgraph

This commit is contained in:
Myfro9
2026-05-25 13:13:00 +08:00
parent fda6c9a114
commit 48b965ec4e
9 changed files with 980 additions and 145 deletions
+60 -5
View File
@@ -7,6 +7,29 @@ description: Use the LangGraph plan-review workflow from the current Claude Code
Use this skill to run the LangGraph plan-review workflow. All scripts are bundled under the skill's own `scripts\` directory (`C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\`) — no dependency on `E:\LangGraph_Design\lab00`.
## Pre-flight: Environment Setup
Before running the workflow for the first time (or when unsure the environment is ready), verify that the required packages are installed in the `langgraph` conda env:
```powershell
# Install langgraph dev server, SDK, and HTTP client
conda run -n langgraph pip install "langgraph-cli[inmem]" langgraph-sdk httpx
# Verify the SDK is importable
conda run -n langgraph python -c "from langgraph_sdk import get_sync_client; print('SDK OK')"
# Verify the langgraph dev command is available
conda run -n langgraph langgraph --version
```
| Package | Purpose |
|---|---|
| `langgraph-cli[inmem]` | Provides the `langgraph dev` server command |
| `langgraph-sdk` | Python client used by `run_workflow.py` to submit runs |
| `httpx` | HTTP health-check in `run_workflow.py` |
**Codex auth** (if not already set up): `C:\Users\bowei\.codex\auth.json` must contain a valid ChatGPT OAuth token. Run `codex auth login` if the file is missing.
## Invariants
- Use the current Claude Code session for all Claude Code work. Do not launch another `claude` process.
@@ -22,13 +45,40 @@ Use this skill to run the LangGraph plan-review workflow. All scripts are bundle
- 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`.
- The workflow uses LangGraph `interrupt()` and persists state via the langgraph dev server.
- 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.
## Dev Server Lifecycle
The `langgraph dev` server must be running for the entire duration of a workflow session.
Use `manage_dev_server.ps1` to start it before the first `run_langgraph.ps1` call and stop it after the workflow completes.
```powershell
# Start (idempotent — safe to call even if already running)
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 start
# Stop (call once when workflow returns {"status":"done"})
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 stop
# Status check
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 status
```
- `start` waits up to 45 s for `http://127.0.0.1:2024/ok` to respond, then prints the Studio URL.
- `stop` kills the process by PID file and removes it; falls back to killing by port 2024 if the PID is stale.
- If the server is already running, `start` is a no-op.
- Server stdout/stderr logs are written to `%TEMP%\langgraph_dev_server.stdout.log` and `%TEMP%\langgraph_dev_server.stderr.log` for debugging.
- **Studio URL**: `https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024` — open in browser to track workflow execution in real time.
## Workflow
1. Determine `TaskId` from the user. If missing, ask for it.
2. Start or resume the LangGraph app:
2. Start the dev server (idempotent):
```powershell
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 start
```
Wait for the "Ready" confirmation before proceeding. Open the Studio URL in a browser for real-time tracking.
3. Start or resume the LangGraph app:
```powershell
# Use double backslashes (\\) in the JSON string so Windows paths are valid JSON.
# $task_path / $latest_discuss_path / etc. are Python Template placeholders — keep them literal.
@@ -39,7 +89,7 @@ Use this skill to run the LangGraph plan-review workflow. All scripts are bundle
-CodexReviewCommand $codexCmd `
-Timeout 300
```
3. Inspect the returned JSON. If `status` is `waiting`, perform `action_required` in the current Claude Code session:
4. 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'`.
@@ -48,10 +98,13 @@ Use this skill to run the LangGraph plan-review workflow. All scripts are bundle
**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.
5. 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", ...}`.
6. Stop when the workflow returns `{"status":"done", ...}`:
```powershell
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 stop
```
## Rejection File Rule
@@ -82,3 +135,5 @@ Write the rejection content directly to `action_required.output_path`:
- `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":"..."}`.
- If the dev server restarts, `run_workflow.py` detects that the stored thread no longer exists and creates a new thread automatically.
- `run_workflow.py` passes the codex command and timeout as `config["configurable"]` per run — no server restart needed when switching projects.