Skip to content

Commit a3b303d

Browse files
author
catlog22
committed
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.
1 parent 0c1c87f commit a3b303d

3 files changed

Lines changed: 1248 additions & 3 deletions

File tree

.claude/agents/cli-lite-planning-agent.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ color: cyan
1313

1414
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.
1515

16+
**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.
17+
1618

1719
## Input Context
1820

@@ -72,7 +74,22 @@ Phase 4: planObject Generation
7274
├─ Build planObject conforming to schema
7375
├─ Assign CLI execution IDs and strategies
7476
├─ Generate flow_control from depends_on
75-
└─ Return to orchestrator
77+
└─ Write initial plan.json
78+
79+
Phase 5: Plan Quality Check (MANDATORY)
80+
├─ Execute CLI quality check using Gemini (Qwen fallback)
81+
├─ Analyze plan quality dimensions:
82+
│ ├─ Task completeness (all requirements covered)
83+
│ ├─ Task granularity (not too large/small)
84+
│ ├─ Dependency correctness (no circular deps, proper ordering)
85+
│ ├─ Acceptance criteria quality (quantified, testable)
86+
│ ├─ Implementation steps sufficiency (2+ steps per task)
87+
│ └─ Constraint compliance (follows project-guidelines.json)
88+
├─ Parse check results and categorize issues
89+
└─ Decision:
90+
├─ No issues → Return plan to orchestrator
91+
├─ Minor issues → Auto-fix → Update plan.json → Return
92+
└─ Critical issues → Report → Suggest regeneration
7693
```
7794

7895
## CLI Command Template
@@ -734,3 +751,78 @@ function validateTask(task) {
734751
- Skip task validation
735752
- **Skip CLI execution ID assignment**
736753
- **Ignore schema structure**
754+
- **Skip Phase 5 Plan Quality Check**
755+
756+
---
757+
758+
## Phase 5: Plan Quality Check (MANDATORY)
759+
760+
### Overview
761+
762+
After generating plan.json, **MUST** execute CLI quality check before returning to orchestrator. This is a mandatory step for ALL plans regardless of complexity.
763+
764+
### Quality Dimensions
765+
766+
| Dimension | Check Criteria | Critical? |
767+
|-----------|---------------|-----------|
768+
| **Completeness** | All user requirements reflected in tasks | Yes |
769+
| **Task Granularity** | Each task 15-60 min scope | No |
770+
| **Dependencies** | No circular deps, correct ordering | Yes |
771+
| **Acceptance Criteria** | Quantified and testable (not vague) | No |
772+
| **Implementation Steps** | 2+ actionable steps per task | No |
773+
| **Constraint Compliance** | Follows project-guidelines.json | Yes |
774+
775+
### CLI Command Format
776+
777+
Use `ccw cli` with analysis mode to validate plan against quality dimensions:
778+
779+
```bash
780+
ccw cli -p "Validate plan quality: completeness, granularity, dependencies, acceptance criteria, implementation steps, constraint compliance" \
781+
--tool gemini --mode analysis \
782+
--context "@{plan_json_path} @.workflow/project-guidelines.json"
783+
```
784+
785+
**Expected Output Structure**:
786+
- Quality Check Report (6 dimensions with pass/fail status)
787+
- Summary (critical/minor issue counts)
788+
- Recommendation: `PASS` | `AUTO_FIX` | `REGENERATE`
789+
- Fixes (JSON patches if AUTO_FIX)
790+
791+
### Result Parsing
792+
793+
Parse CLI output sections using regex to extract:
794+
- **6 Dimension Results**: Each with `passed` boolean and issue lists (missing requirements, oversized/undersized tasks, vague criteria, etc.)
795+
- **Summary Counts**: Critical issues, minor issues
796+
- **Recommendation**: `PASS` | `AUTO_FIX` | `REGENERATE`
797+
- **Fixes**: Optional JSON patches for auto-fixable issues
798+
799+
### Auto-Fix Strategy
800+
801+
Apply automatic fixes for minor issues:
802+
803+
| Issue Type | Auto-Fix Action | Example |
804+
|-----------|----------------|---------|
805+
| **Vague Acceptance** | Replace with quantified criteria | "works correctly" → "All unit tests pass with 100% success rate" |
806+
| **Insufficient Steps** | Expand to 4-step template | Add: Analyze → Implement → Error handling → Verify |
807+
| **CLI-Provided Patches** | Apply JSON patches from CLI output | Update task fields per patch specification |
808+
809+
After fixes, update `_metadata.quality_check` with fix log.
810+
811+
### Execution Flow
812+
813+
After Phase 4 planObject generation:
814+
815+
1. **Write Initial Plan** → `${sessionFolder}/plan.json`
816+
2. **Execute CLI Check** → Gemini (Qwen fallback)
817+
3. **Parse Results** → Extract recommendation and issues
818+
4. **Handle Recommendation**:
819+
820+
| Recommendation | Action | Return Status |
821+
|---------------|--------|---------------|
822+
| `PASS` | Log success, add metadata | `success` |
823+
| `AUTO_FIX` | Apply fixes, update plan.json, log fixes | `success` |
824+
| `REGENERATE` | Log critical issues, add issues to metadata | `needs_review` |
825+
826+
5. **Return** → Plan with `_metadata.quality_check` containing execution result
827+
828+
**CLI Fallback**: Gemini → Qwen → Skip with warning (if both fail)

0 commit comments

Comments
 (0)