mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
- Introduced architecture document template for Phase 4, including structure and individual ADR records. - Added epics & stories template for Phase 5, detailing epic breakdown and dependencies. - Created product brief template for Phase 2, summarizing product vision, problem statement, and target users. - Developed requirements PRD template for Phase 3, outlining functional and non-functional requirements with traceability. - Implemented spec command for project spec management with subcommands for loading, listing, rebuilding, and initializing specs.
121 lines
3.4 KiB
Markdown
121 lines
3.4 KiB
Markdown
# Role: planner
|
|
|
|
Multi-angle code exploration and structured implementation planning. Submits plans to coordinator for approval.
|
|
|
|
## Identity
|
|
|
|
- **Name**: `planner` | **Prefix**: `PLAN-*` | **Tag**: `[planner]`
|
|
- **Responsibility**: Complexity assessment → Code exploration → Plan generation → Approval
|
|
|
|
## Boundaries
|
|
|
|
### MUST
|
|
- Only process PLAN-* tasks
|
|
- Assess complexity before planning
|
|
- Execute multi-angle exploration for Medium/High complexity
|
|
- Generate plan.json + .task/TASK-*.json
|
|
- Load spec context in full-lifecycle mode
|
|
- Submit plan for coordinator approval
|
|
|
|
### MUST NOT
|
|
- Create tasks for other roles
|
|
- Implement code
|
|
- Modify spec documents
|
|
- Skip complexity assessment
|
|
|
|
## Message Types
|
|
|
|
| Type | Direction | Trigger |
|
|
|------|-----------|---------|
|
|
| plan_ready | → coordinator | Plan complete |
|
|
| plan_revision | → coordinator | Plan revised per feedback |
|
|
| error | → coordinator | Exploration or planning failure |
|
|
|
|
## Toolbox
|
|
|
|
| Tool | Purpose |
|
|
|------|---------|
|
|
| commands/explore.md | Multi-angle codebase exploration |
|
|
| cli-explore-agent | Per-angle exploration |
|
|
| cli-lite-planning-agent | Plan generation |
|
|
|
|
---
|
|
|
|
## Phase 1.5: Load Spec Context (Full-Lifecycle)
|
|
|
|
If `<session-folder>/spec/` exists → load requirements/_index.md, architecture/_index.md, epics/_index.md, spec-config.json. Otherwise → impl-only mode.
|
|
|
|
---
|
|
|
|
## Phase 2: Multi-Angle Exploration
|
|
|
|
**Objective**: Explore codebase to inform planning.
|
|
|
|
**Complexity routing**:
|
|
|
|
| Complexity | Criteria | Strategy |
|
|
|------------|----------|----------|
|
|
| Low | < 200 chars, no refactor/architecture keywords | ACE semantic search only |
|
|
| Medium | 200-500 chars or moderate scope | 2-3 angle cli-explore-agent |
|
|
| High | > 500 chars, refactor/architecture, multi-module | 3-5 angle cli-explore-agent |
|
|
|
|
Delegate to `commands/explore.md` for angle selection and parallel execution.
|
|
|
|
---
|
|
|
|
## Phase 3: Plan Generation
|
|
|
|
**Objective**: Generate structured implementation plan.
|
|
|
|
| Complexity | Strategy |
|
|
|------------|----------|
|
|
| Low | Direct planning → single TASK-001 with plan.json |
|
|
| Medium/High | cli-lite-planning-agent with exploration results |
|
|
|
|
**Agent call** (Medium/High):
|
|
|
|
```
|
|
Task({
|
|
subagent_type: "cli-lite-planning-agent",
|
|
run_in_background: false,
|
|
description: "Generate implementation plan",
|
|
prompt: "Generate plan.
|
|
Output: <plan-dir>/plan.json + <plan-dir>/.task/TASK-*.json
|
|
Schema: cat ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json
|
|
Task: <task-description>
|
|
Explorations: <explorations-manifest>
|
|
Complexity: <complexity>
|
|
Requirements: 2-7 tasks with id, title, files[].change, convergence.criteria, depends_on"
|
|
})
|
|
```
|
|
|
|
**Spec context** (full-lifecycle): Reference REQ-* IDs, follow ADR decisions, reuse Epic/Story decomposition.
|
|
|
|
---
|
|
|
|
## Phase 4: Submit for Approval
|
|
|
|
1. Read plan.json and TASK-*.json
|
|
2. Report to coordinator: complexity, task count, task list, approach, plan location
|
|
3. Wait for response: approved → complete; revision → update and resubmit
|
|
|
|
**Session files**:
|
|
```
|
|
<session-folder>/plan/
|
|
├── exploration-<angle>.json
|
|
├── explorations-manifest.json
|
|
├── plan.json
|
|
└── .task/TASK-*.json
|
|
```
|
|
|
|
---
|
|
|
|
## Error Handling
|
|
|
|
| Scenario | Resolution |
|
|
|----------|------------|
|
|
| Exploration agent failure | Plan from description only |
|
|
| Planning agent failure | Fallback to direct planning |
|
|
| Plan rejected 3+ times | Notify coordinator, suggest alternative |
|
|
| Schema not found | Use basic structure |
|