refactor: Simplify lite-plan complexity assessment with Claude intelligent analysis

- Replace keyword-based estimateComplexity() with Claude intelligent analysis
- Remove exploration-driven complexityScore in Phase 3
- Unify complexity assessment to Phase 1 only
- Update Execution Process to tree-style flow diagram
- Fix step numbering error (duplicate step 4 → step 6)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-11-27 15:21:09 +08:00
parent 75ad427862
commit 964bbbf5bc

View File

@@ -34,15 +34,36 @@ Intelligent lightweight planning command with dynamic workflow adaptation based
## Execution Process ## Execution Process
``` ```
User Input → Task Analysis & Exploration Decision (Phase 1) Phase 1: Task Analysis & Exploration
├─ Parse input (description or .md file)
Clarification (Phase 2, optional) ├─ Claude intelligent complexity assessment (Low/Medium/High)
├─ Exploration decision (auto-detect or --explore flag)
Complexity Assessment & Planning (Phase 3) └─ Decision:
├─ needsExploration=true → Launch parallel cli-explore-agents (1-4 based on complexity)
Task Confirmation & Execution Selection (Phase 4) └─ needsExploration=false → Skip to Phase 2/3
Dispatch to Execution (Phase 5) Phase 2: Clarification (optional)
├─ Aggregate clarification_needs from all exploration angles
├─ Deduplicate similar questions
└─ Decision:
├─ Has clarifications → AskUserQuestion (max 4 questions)
└─ No clarifications → Skip to Phase 3
Phase 3: Planning
└─ Decision (based on Phase 1 complexity):
├─ Low → Direct Claude planning → plan.json
└─ Medium/High → cli-lite-planning-agent → plan.json
Phase 4: Confirmation & Selection
├─ Display plan summary (tasks, complexity, estimated time)
└─ AskUserQuestion:
├─ Confirm: Allow / Modify / Cancel
├─ Execution: Agent / Codex / Auto
└─ Review: Gemini / Agent / Skip
Phase 5: Dispatch
├─ Build executionContext (plan + explorations + clarifications + selections)
└─ SlashCommand("/workflow:lite-execute --in-memory")
``` ```
## Implementation ## Implementation
@@ -76,34 +97,19 @@ if (!needsExploration) {
} }
``` ```
**Complexity Assessment & Exploration Count**: **Complexity Assessment** (Claude Intelligent Analysis):
```javascript ```javascript
// Estimate task complexity based on description // Claude analyzes task complexity based on:
function estimateComplexity(taskDescription) { // - Scope: How many systems/modules are affected?
const wordCount = taskDescription.split(/\s+/).length // - Depth: Surface change vs architectural impact?
const text = taskDescription.toLowerCase() // - Risk: Potential for breaking existing functionality?
// - Dependencies: How interconnected is the change?
const indicators = { const complexity = analyzeTaskComplexity(task_description)
high: ['refactor', 'migrate', 'redesign', 'architecture', 'system'], // Returns: 'Low' | 'Medium' | 'High'
medium: ['implement', 'add feature', 'integrate', 'modify module'], // Low: Single file, isolated change, minimal risk
low: ['fix', 'update', 'adjust', 'tweak'] // Medium: Multiple files, some dependencies, moderate risk
} // High: Cross-module, architectural, high risk
let score = 0
if (wordCount > 50) score += 2
else if (wordCount > 20) score += 1
if (indicators.high.some(w => text.includes(w))) score += 3
else if (indicators.medium.some(w => text.includes(w))) score += 2
else if (indicators.low.some(w => text.includes(w))) score += 1
// 0-2: Low, 3-4: Medium, 5+: High
if (score >= 5) return 'High'
if (score >= 3) return 'Medium'
return 'Low'
}
const complexity = estimateComplexity(task_description)
// Angle assignment based on task type (orchestrator decides, not agent) // Angle assignment based on task type (orchestrator decides, not agent)
const ANGLE_PRESETS = { const ANGLE_PRESETS = {
@@ -320,19 +326,9 @@ if (uniqueClarifications.length > 0) {
--- ---
### Phase 3: Complexity Assessment & Planning ### Phase 3: Planning
**Complexity Assessment**: **Planning Strategy Selection** (based on Phase 1 complexity):
```javascript
complexityScore = {
file_count: exploration?.relevant_files?.length || 0,
integration_points: exploration?.dependencies?.length || 0,
architecture_changes: exploration?.constraints?.includes('architecture'),
task_scope: estimated_steps > 5
}
// Low: score < 3, Medium: 3-5, High: > 5
```
**Low Complexity** - Direct planning by Claude: **Low Complexity** - Direct planning by Claude:
- Generate plan directly, write to `${sessionFolder}/plan.json` - Generate plan directly, write to `${sessionFolder}/plan.json`
@@ -391,7 +387,7 @@ Generate plan.json with:
3. Synthesize findings from multiple exploration angles 3. Synthesize findings from multiple exploration angles
4. Parse output and structure plan 4. Parse output and structure plan
5. Write JSON: Write('${sessionFolder}/plan.json', jsonContent) 5. Write JSON: Write('${sessionFolder}/plan.json', jsonContent)
4. Return brief completion summary 6. Return brief completion summary
` `
) )
``` ```