refactor: Improve task granularity and reduce over-decomposition in workflow planning

- Increase complexity thresholds: Simple (≤8), Medium (9-15), Complex (>15) tasks
- Add core task granularity principles: function-based vs file-based decomposition
- Replace time-based merge conditions with clear functional criteria
- Update automatic decomposition threshold from >5 to >15 tasks
- Add comprehensive task pattern examples for better guidance
- Remove micro-task creation to improve workflow efficiency

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-09-14 15:53:59 +08:00
parent 381c4af865
commit e736ca45e0

View File

@@ -68,12 +68,30 @@ The command automatically detects input type:
- Generates session ID: WFS-[topic-slug]
### Complexity Detection with Saturation
- **Simple**: <3 saturated tasks → Direct IMPL_PLAN.md
- **Medium**: 3-8 saturated tasks → IMPL_PLAN.md + TODO_LIST.md
- **Complex**: >8 saturated tasks → Full decomposition
- **Simple**: ≤8 saturated tasks → Direct IMPL_PLAN.md
- **Medium**: 9-15 saturated tasks → IMPL_PLAN.md + TODO_LIST.md
- **Complex**: >15 saturated tasks → Full decomposition
**Note**: 1 complex preparation task = 0.5 saturated task for counting
### Task Granularity Principles
- **按功能分解,不按文件分解**: 一个任务应该完成一个完整功能
- **保持功能完整性**: 每个任务产出可独立运行或测试的功能单元
- **相关组件一起实现**: UI、逻辑、测试等相关部分在同一任务中完成
- **避免技术步骤分解**: 不要把"创建文件"、"添加函数"作为独立任务
### 任务分解反模式
**错误示例 - 按文件/步骤分解**
- IMPL-001: 创建数据库模型
- IMPL-002: 创建API端点
- IMPL-003: 创建前端组件
- IMPL-004: 添加路由配置
- IMPL-005: 编写单元测试
**正确示例 - 按功能分解**
- IMPL-001: 实现用户认证功能包含模型、API、UI、测试
- IMPL-002: 实现数据导出功能包含处理逻辑、UI、文件生成
### Task Generation with Saturation Control
- **Task Saturation Assessment**: Evaluates whether to merge preparation and execution
- **Default merge mode**: "Analyze and implement X" instead of "Analyze X" + "Implement X"
@@ -87,26 +105,29 @@ The command automatically detects input type:
### Task Saturation Assessment
Evaluates whether to merge preparation and execution:
**Merge Conditions** (Saturated Tasks):
- Preparation work < 30min estimated
- Analysis scope ≤ 3 files
- No complex dependencies
- Single module operation
**默认合并原则** (Saturated Tasks):
- 同一功能模块的所有组件
- 前后端配套实现
- 功能与其对应的测试
- 配置与其使用的代码
- 相互依赖的多个小功能
**Separate Preparation Conditions**:
- Cross-module architecture analysis (>5 modules)
- Deep performance analysis or security audit required
- Database migration design needed
- Third-party API integration research
**仅在以下情况分离任务**:
- 完全独立的功能模块(无共享代码)
- 不同技术栈的独立服务(如前端/后端分离部署)
- 需要不同专业知识的模块如ML模型训练 vs Web开发
- 有明确先后顺序依赖的大型功能
**Task Examples**:
- **Saturated**: "IMPL-001: Analyze auth patterns and implement JWT token management"
- **Split needed**: "IMPL-001: Design cross-service auth architecture" + "IMPL-002: Implement auth service"
- **合并示例**: "IMPL-001: 实现用户认证系统包含JWT管理、API端点、UI组件和测试"
- **分离示例**: "IMPL-001: 设计跨服务认证架构" + "IMPL-002: 实现前端认证模块" + "IMPL-003: 实现后端认证服务"
### Task Breakdown Process
- **Automatic decomposition**: Tasks with complexity >5 are broken into subtasks (impl-N.M format)
- **Automatic decomposition**: Only when task count >15 are tasks broken into subtasks (impl-N.M format)
- **Function-based decomposition**: Split by independent functional boundaries, not by technical layers
- **Container tasks**: Parent tasks with subtasks become containers (marked with ▸ in TODO_LIST)
- **Smart decomposition**: AI analyzes task title to suggest logical subtask structure
- **Smart decomposition**: AI analyzes task title to suggest logical functional subtask structure
- **Complete unit principle**: Each subtask must still represent a complete functional unit
- **Context inheritance**: Subtasks inherit parent's requirements and scope, refined for specific needs
- **Agent assignment**: Automatic agent mapping based on subtask type (planning/code/test/review)
- **Maximum depth**: 2 levels (impl-N.M) to maintain manageable hierarchy
@@ -180,4 +201,21 @@ Generated in .task/ directory when decomposition enabled
- Rejected examples: "do something", "fix it", "make it better", "add feature"
- Response: Direct rejection message, no further assistance
**System ensures**: Unified planning interface with intelligent input detection and automatic complexity handling
### Recommended Task Patterns
#### Complete Feature Implementation
"Implement user management system" - includes CRUD operations, permissions, UI components, API endpoints, and tests
#### End-to-End Features
"Add Excel export functionality" - includes data processing, file generation, download API, UI buttons, and error handling
#### System Integration
"Integrate payment gateway" - includes API integration, order processing, payment flows, webhook handling, and testing
#### Problem Resolution
"Fix and optimize search functionality" - includes bug fixes, performance optimization, UI improvements, and related tests
#### Module Development
"Create notification system" - includes email/SMS sending, template management, subscription handling, and admin interface
**System ensures**: Unified planning interface with intelligent input detection and function-based task granularity