From 98b72f086d3e5c8d88e16c18c2a9d9956241c48c Mon Sep 17 00:00:00 2001 From: catlog22 Date: Fri, 28 Nov 2025 11:04:47 +0800 Subject: [PATCH] refactor: Move schema loading to Low complexity path only in lite-plan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Schema loading is only needed for direct Claude planning (Low complexity). The cli-lite-planning-agent handles schema internally for Medium/High complexity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude/commands/workflow/lite-plan.md | 34 ++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.claude/commands/workflow/lite-plan.md b/.claude/commands/workflow/lite-plan.md index 5d38db0c..b7d737c4 100644 --- a/.claude/commands/workflow/lite-plan.md +++ b/.claude/commands/workflow/lite-plan.md @@ -49,11 +49,10 @@ Phase 2: Clarification (optional) ├─ Has clarifications → AskUserQuestion (max 4 questions) └─ No clarifications → Skip to Phase 3 -Phase 3: Planning - ├─ Load schema: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json (REQUIRED) +Phase 3: Planning (NO CODE EXECUTION - planning only) └─ Decision (based on Phase 1 complexity): - ├─ Low → Direct Claude planning (following schema) → plan.json - └─ Medium/High → cli-lite-planning-agent → plan.json + ├─ Low → Load schema: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json → Direct Claude planning (following schema) → plan.json → MUST proceed to Phase 4 + └─ Medium/High → cli-lite-planning-agent → plan.json → MUST proceed to Phase 4 Phase 4: Confirmation & Selection ├─ Display plan summary (tasks, complexity, estimated time) @@ -331,10 +330,29 @@ if (uniqueClarifications.length > 0) { **Planning Strategy Selection** (based on Phase 1 complexity): +**IMPORTANT**: Phase 3 is **planning only** - NO code execution. All execution happens in Phase 5 via lite-execute. + **Low Complexity** - Direct planning by Claude: -- Read schema: `cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json` -- Generate plan following schema structure, write to `${sessionFolder}/plan.json` -- No agent invocation +```javascript +// Step 1: Read schema +const schema = Bash(`cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json`) + +// Step 2: Generate plan following schema (Claude directly, no agent) +const plan = { + summary: "...", + approach: "...", + tasks: [...], // Follow Task Grouping Rules below + estimated_time: "...", + recommended_execution: "Agent", + complexity: "Low", + _metadata: { timestamp: new Date().toISOString(), source: "direct-planning", planning_mode: "direct" } +} + +// Step 3: Write plan to session folder +Write(`${sessionFolder}/plan.json`, JSON.stringify(plan, null, 2)) + +// Step 4: MUST continue to Phase 4 (Confirmation) - DO NOT execute code here +``` **Medium/High Complexity** - Invoke cli-lite-planning-agent: @@ -473,6 +491,8 @@ AskUserQuestion({ ### Phase 5: Dispatch to Execution +**CRITICAL**: lite-plan NEVER executes code directly. ALL execution MUST go through lite-execute. + **Step 5.1: Build executionContext** ```javascript