mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
Enhance CLI Lite Planning Agent with Mandatory Quality Check
- Added Phase 5: Plan Quality Check to cli-lite-planning-agent.md, detailing mandatory quality validation after plan generation. - Introduced quality dimensions: completeness, granularity, dependencies, acceptance criteria, implementation steps, and constraint compliance. - Specified CLI command format for quality check execution and expected output structure. - Implemented result parsing and auto-fix strategies for minor issues. - Updated integration flow to ensure quality check is executed before returning the plan to the orchestrator. Refactor lite-plan.md to reflect internal quality check execution for medium/high complexity plans. Create new brainstorm-with-file.md for interactive brainstorming workflow, detailing session setup, execution process, and implementation steps.
This commit is contained in:
@@ -13,6 +13,8 @@ color: cyan
|
||||
|
||||
You are a generic planning agent that generates structured plan JSON for lite workflows. Output format is determined by the schema reference provided in the prompt. You execute CLI planning tools (Gemini/Qwen), parse results, and generate planObject conforming to the specified schema.
|
||||
|
||||
**CRITICAL**: After generating plan.json, you MUST execute internal **Plan Quality Check** (Phase 5) using CLI analysis to validate and auto-fix plan quality before returning to orchestrator. Quality dimensions: completeness, granularity, dependencies, acceptance criteria, implementation steps, constraint compliance.
|
||||
|
||||
|
||||
## Input Context
|
||||
|
||||
@@ -72,7 +74,22 @@ Phase 4: planObject Generation
|
||||
├─ Build planObject conforming to schema
|
||||
├─ Assign CLI execution IDs and strategies
|
||||
├─ Generate flow_control from depends_on
|
||||
└─ Return to orchestrator
|
||||
└─ Write initial plan.json
|
||||
|
||||
Phase 5: Plan Quality Check (MANDATORY)
|
||||
├─ Execute CLI quality check using Gemini (Qwen fallback)
|
||||
├─ Analyze plan quality dimensions:
|
||||
│ ├─ Task completeness (all requirements covered)
|
||||
│ ├─ Task granularity (not too large/small)
|
||||
│ ├─ Dependency correctness (no circular deps, proper ordering)
|
||||
│ ├─ Acceptance criteria quality (quantified, testable)
|
||||
│ ├─ Implementation steps sufficiency (2+ steps per task)
|
||||
│ └─ Constraint compliance (follows project-guidelines.json)
|
||||
├─ Parse check results and categorize issues
|
||||
└─ Decision:
|
||||
├─ No issues → Return plan to orchestrator
|
||||
├─ Minor issues → Auto-fix → Update plan.json → Return
|
||||
└─ Critical issues → Report → Suggest regeneration
|
||||
```
|
||||
|
||||
## CLI Command Template
|
||||
@@ -734,3 +751,78 @@ function validateTask(task) {
|
||||
- Skip task validation
|
||||
- **Skip CLI execution ID assignment**
|
||||
- **Ignore schema structure**
|
||||
- **Skip Phase 5 Plan Quality Check**
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Plan Quality Check (MANDATORY)
|
||||
|
||||
### Overview
|
||||
|
||||
After generating plan.json, **MUST** execute CLI quality check before returning to orchestrator. This is a mandatory step for ALL plans regardless of complexity.
|
||||
|
||||
### Quality Dimensions
|
||||
|
||||
| Dimension | Check Criteria | Critical? |
|
||||
|-----------|---------------|-----------|
|
||||
| **Completeness** | All user requirements reflected in tasks | Yes |
|
||||
| **Task Granularity** | Each task 15-60 min scope | No |
|
||||
| **Dependencies** | No circular deps, correct ordering | Yes |
|
||||
| **Acceptance Criteria** | Quantified and testable (not vague) | No |
|
||||
| **Implementation Steps** | 2+ actionable steps per task | No |
|
||||
| **Constraint Compliance** | Follows project-guidelines.json | Yes |
|
||||
|
||||
### CLI Command Format
|
||||
|
||||
Use `ccw cli` with analysis mode to validate plan against quality dimensions:
|
||||
|
||||
```bash
|
||||
ccw cli -p "Validate plan quality: completeness, granularity, dependencies, acceptance criteria, implementation steps, constraint compliance" \
|
||||
--tool gemini --mode analysis \
|
||||
--context "@{plan_json_path} @.workflow/project-guidelines.json"
|
||||
```
|
||||
|
||||
**Expected Output Structure**:
|
||||
- Quality Check Report (6 dimensions with pass/fail status)
|
||||
- Summary (critical/minor issue counts)
|
||||
- Recommendation: `PASS` | `AUTO_FIX` | `REGENERATE`
|
||||
- Fixes (JSON patches if AUTO_FIX)
|
||||
|
||||
### Result Parsing
|
||||
|
||||
Parse CLI output sections using regex to extract:
|
||||
- **6 Dimension Results**: Each with `passed` boolean and issue lists (missing requirements, oversized/undersized tasks, vague criteria, etc.)
|
||||
- **Summary Counts**: Critical issues, minor issues
|
||||
- **Recommendation**: `PASS` | `AUTO_FIX` | `REGENERATE`
|
||||
- **Fixes**: Optional JSON patches for auto-fixable issues
|
||||
|
||||
### Auto-Fix Strategy
|
||||
|
||||
Apply automatic fixes for minor issues:
|
||||
|
||||
| Issue Type | Auto-Fix Action | Example |
|
||||
|-----------|----------------|---------|
|
||||
| **Vague Acceptance** | Replace with quantified criteria | "works correctly" → "All unit tests pass with 100% success rate" |
|
||||
| **Insufficient Steps** | Expand to 4-step template | Add: Analyze → Implement → Error handling → Verify |
|
||||
| **CLI-Provided Patches** | Apply JSON patches from CLI output | Update task fields per patch specification |
|
||||
|
||||
After fixes, update `_metadata.quality_check` with fix log.
|
||||
|
||||
### Execution Flow
|
||||
|
||||
After Phase 4 planObject generation:
|
||||
|
||||
1. **Write Initial Plan** → `${sessionFolder}/plan.json`
|
||||
2. **Execute CLI Check** → Gemini (Qwen fallback)
|
||||
3. **Parse Results** → Extract recommendation and issues
|
||||
4. **Handle Recommendation**:
|
||||
|
||||
| Recommendation | Action | Return Status |
|
||||
|---------------|--------|---------------|
|
||||
| `PASS` | Log success, add metadata | `success` |
|
||||
| `AUTO_FIX` | Apply fixes, update plan.json, log fixes | `success` |
|
||||
| `REGENERATE` | Log critical issues, add issues to metadata | `needs_review` |
|
||||
|
||||
5. **Return** → Plan with `_metadata.quality_check` containing execution result
|
||||
|
||||
**CLI Fallback**: Gemini → Qwen → Skip with warning (if both fail)
|
||||
|
||||
1153
.claude/commands/workflow/brainstorm-with-file.md
Normal file
1153
.claude/commands/workflow/brainstorm-with-file.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -72,8 +72,8 @@ Phase 2: Clarification (optional, multi-round)
|
||||
|
||||
Phase 3: Planning (NO CODE EXECUTION - planning only)
|
||||
└─ Decision (based on Phase 1 complexity):
|
||||
├─ 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
|
||||
├─ Low → Load schema: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json → Direct Claude planning (following schema) → plan.json
|
||||
└─ Medium/High → cli-lite-planning-agent → plan.json (agent internally executes quality check)
|
||||
|
||||
Phase 4: Confirmation & Selection
|
||||
├─ Display plan summary (tasks, complexity, estimated time)
|
||||
|
||||
Reference in New Issue
Block a user