From b9e893245ba28aff374190e5e9b1a8293dae3ef4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 20 Nov 2025 03:19:47 +0000 Subject: [PATCH] refactor(workflow): simplify workflow:replan documentation ## Changes ### Documentation Simplification - Removed version information and comparison tables - Removed "Migration from task:replan" section - Removed "Related Commands" section - Removed redundant "Implementation Notes" section - Streamlined examples to essential use cases only ### Followed execute.md Style - Clean, focused structure - Direct entry into core functionality - Clear phase-based execution lifecycle - Concise error handling - Essential file structure reference ### Maintained Core Content - Overview with core capabilities - Operation modes (Session/Task) - 6-phase execution lifecycle - Interactive clarification questions - TodoWrite progress tracking - Error handling examples - Practical usage examples The documentation now follows the established pattern from execute.md and other workflow commands, providing essential information without redundant sections or comparisons. --- .claude/commands/workflow/replan.md | 827 +++++------------- .../reference/commands/workflow/replan.md | 827 +++++------------- 2 files changed, 406 insertions(+), 1248 deletions(-) diff --git a/.claude/commands/workflow/replan.md b/.claude/commands/workflow/replan.md index 1f7889db..d9cc4a34 100644 --- a/.claude/commands/workflow/replan.md +++ b/.claude/commands/workflow/replan.md @@ -5,110 +5,71 @@ argument-hint: "[--session session-id] [task-id] \"requirements\"|file.md [--int allowed-tools: Read(*), Write(*), Edit(*), TodoWrite(*), Glob(*), Bash(*) --- -# Workflow Replan Command (/workflow:replan) +# Workflow Replan Command ## Overview Intelligently replans workflow sessions or individual tasks with interactive boundary clarification and comprehensive artifact updates. -**Dual Mode Design**: -- **Session Replan Mode**: Updates multiple session artifacts (IMPL_PLAN.md, TODO_LIST.md, task JSONs) -- **Task Replan Mode**: Focused task updates within session context +**Core Capabilities**: +- **Session Replan**: Updates multiple artifacts (IMPL_PLAN.md, TODO_LIST.md, task JSONs) +- **Task Replan**: Focused updates within session context +- **Interactive Clarification**: Guided questioning to define modification boundaries +- **Impact Analysis**: Automatic detection of affected files and dependencies +- **Backup Management**: Preserves previous versions with restore capability ## Core Principles **Task System**: @~/.claude/workflows/task-core.md **Workflow Architecture**: @~/.claude/workflows/workflow-architecture.md -## Key Features -- **Interactive Clarification**: Guided questioning to define modification boundaries -- **Session-Aware**: Understands and updates all session artifacts -- **Impact Analysis**: Automatically detects affected files and dependencies -- **Comprehensive Updates**: Modifies IMPL_PLAN.md, TODO_LIST.md, task JSONs, session metadata -- **Backup Management**: Preserves previous versions of all modified files -- **Change Tracking**: Documents all modifications with rationale - ## Operation Modes -### Mode 1: Session Replan (Default) +### Session Replan Mode -#### Auto-detect Active Session ```bash +# Auto-detect active session /workflow:replan "添加双因素认证支持" -``` -Automatically detects active session from `.workflow/active/` -#### Explicit Session -```bash -/workflow:replan --session WFS-oauth-integration "添加双因素认证支持" -``` +# Explicit session +/workflow:replan --session WFS-oauth "添加双因素认证支持" -#### File-based Input -```bash +# File-based input /workflow:replan --session WFS-oauth requirements-update.md + +# Interactive mode +/workflow:replan --interactive ``` -#### Interactive Mode -```bash -/workflow:replan --session WFS-oauth --interactive -``` -Fully guided step-by-step modification process +### Task Replan Mode -### Mode 2: Task Replan - -#### Direct Task Update ```bash +# Direct task update /workflow:replan IMPL-1 "修改为使用 OAuth2.0 标准" -``` -Auto-detects session from active sessions -#### Task with Session -```bash +# Task with explicit session /workflow:replan --session WFS-oauth IMPL-2 "增加单元测试覆盖率到 90%" -``` -#### Task Interactive Mode -```bash +# Interactive mode /workflow:replan IMPL-1 --interactive ``` -## Execution Flow +## Execution Lifecycle ### Phase 1: Mode Detection & Session Discovery -**Step 1.1: Detect Operation Mode** -```bash -# Check if task ID provided (IMPL-N or IMPL-N.M format) -if [[ "$1" =~ ^IMPL-[0-9]+(\.[0-9]+)?$ ]]; then - MODE="task" - TASK_ID="$1" -else - MODE="session" -fi -``` +**Process**: +1. **Detect Operation Mode**: + - Check if task ID provided (IMPL-N or IMPL-N.M format) → Task mode + - Otherwise → Session mode -**Step 1.2: Discover/Validate Session** -```bash -# If --session provided, use it -# Otherwise, auto-detect active session -active_session=$(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1) +2. **Discover/Validate Session**: + - Use `--session` flag if provided + - Otherwise auto-detect from `.workflow/active/` + - Validate session exists -# Validate session exists -if [ ! -d ".workflow/active/$SESSION_ID" ]; then - echo "ERROR: Session $SESSION_ID not found" - exit 1 -fi -``` - -**Step 1.3: Load Session Context** -```bash -# Read session metadata -Read(file_path=".workflow/active/$SESSION_ID/workflow-session.json") - -# List existing tasks -Glob(pattern=".workflow/active/$SESSION_ID/.task/IMPL-*.json") - -# Read planning document -Read(file_path=".workflow/active/$SESSION_ID/IMPL_PLAN.md") -``` +3. **Load Session Context**: + - Read `workflow-session.json` + - List existing tasks + - Read `IMPL_PLAN.md` and `TODO_LIST.md` **Output**: Session validated, context loaded, mode determined @@ -116,134 +77,65 @@ Read(file_path=".workflow/active/$SESSION_ID/IMPL_PLAN.md") ### Phase 2: Interactive Requirement Clarification -**Purpose**: Use guided questioning to precisely define modification scope and boundaries +**Purpose**: Define modification scope through guided questioning -#### Session Mode Clarification +#### Session Mode Questions -**Question 1: Modification Scope** +**Q1: Modification Scope** ```javascript -AskUserQuestion({ - questions: [{ - question: "修改范围是什么?", - header: "Scope", - options: [ - { - label: "仅更新任务细节", - value: "tasks_only", - description: "只修改现有任务的实现细节,不改变整体规划" - }, - { - label: "修改规划方案", - value: "plan_update", - description: "需要更新 IMPL_PLAN.md 中的技术方案或架构设计" - }, - { - label: "重构任务结构", - value: "task_restructure", - description: "需要添加、删除或重组任务,更新 TODO_LIST.md" - }, - { - label: "全面重规划", - value: "comprehensive", - description: "大幅修改需求,需要更新所有规划文档和任务" - } - ], - multiSelect: false - }] -}) +Options: +- 仅更新任务细节 (tasks_only) +- 修改规划方案 (plan_update) +- 重构任务结构 (task_restructure) +- 全面重规划 (comprehensive) ``` -**Question 2: Affected Modules** (if scope >= plan_update) +**Q2: Affected Modules** (if scope >= plan_update) ```javascript -AskUserQuestion({ - questions: [{ - question: "哪些功能模块会受到影响?", - header: "Modules", - options: [ - // Dynamically generated from existing tasks' focus_paths - { label: "认证模块 (src/auth)", value: "auth" }, - { label: "用户管理 (src/user)", value: "user" }, - { label: "API 接口 (src/api)", value: "api" }, - { label: "全部模块", value: "all" } - ], - multiSelect: true - }] -}) +Options: Dynamically generated from existing tasks' focus_paths +- 认证模块 (src/auth) +- 用户管理 (src/user) +- 全部模块 ``` -**Question 3: Task Changes** (if scope >= task_restructure) +**Q3: Task Changes** (if scope >= task_restructure) ```javascript -AskUserQuestion({ - questions: [{ - question: "任务变更类型?", - header: "Task Changes", - options: [ - { label: "添加新任务", value: "add", description: "创建新的 IMPL-*.json 任务" }, - { label: "删除现有任务", value: "remove", description: "移除不需要的任务" }, - { label: "合并任务", value: "merge", description: "将多个任务合并为一个" }, - { label: "拆分任务", value: "split", description: "将一个任务拆分为多个子任务" }, - { label: "仅更新内容", value: "update", description: "保持任务结构,只修改内容" } - ], - multiSelect: true - }] -}) +Options: +- 添加新任务 +- 删除现有任务 +- 合并任务 +- 拆分任务 +- 仅更新内容 ``` -**Question 4: Dependency Changes** (if task changes detected) +**Q4: Dependency Changes** ```javascript -AskUserQuestion({ - questions: [{ - question: "是否需要更新任务依赖关系?", - header: "Dependencies", - options: [ - { label: "是,需要重新梳理依赖", value: "yes" }, - { label: "否,保持现有依赖", value: "no" } - ], - multiSelect: false - }] -}) +Options: +- 是,需要重新梳理依赖 +- 否,保持现有依赖 ``` -#### Task Mode Clarification +#### Task Mode Questions -**Question 1: Update Type** +**Q1: Update Type** ```javascript -AskUserQuestion({ - questions: [{ - question: "需要更新任务的哪些部分?", - header: "Update Type", - options: [ - { label: "需求和验收标准 (requirements & acceptance)", value: "requirements" }, - { label: "实现方案 (implementation_approach)", value: "implementation" }, - { label: "文件范围 (focus_paths)", value: "paths" }, - { label: "依赖关系 (depends_on)", value: "dependencies" }, - { label: "全部更新", value: "all" } - ], - multiSelect: true - }] -}) +Options: +- 需求和验收标准 (requirements & acceptance) +- 实现方案 (implementation_approach) +- 文件范围 (focus_paths) +- 依赖关系 (depends_on) +- 全部更新 ``` -**Question 2: Ripple Effect** +**Q2: Ripple Effect** ```javascript -AskUserQuestion({ - questions: [{ - question: "此修改是否影响其他任务?", - header: "Impact", - options: [ - { label: "是,需要同步更新依赖任务", value: "yes" }, - { label: "否,仅影响当前任务", value: "no" }, - { label: "不确定,请帮我分析", value: "analyze" } - ], - multiSelect: false - }] -}) +Options: +- 是,需要同步更新依赖任务 +- 否,仅影响当前任务 +- 不确定,请帮我分析 ``` -**Output**: -- User selections stored in clarification context -- Modification boundaries clearly defined -- Impact scope determined +**Output**: User selections stored, modification boundaries defined --- @@ -251,26 +143,26 @@ AskUserQuestion({ **Step 3.1: Analyze Required Changes** -Based on clarification responses, determine affected files: +Determine affected files based on clarification: ```typescript interface ImpactAnalysis { affected_files: { - impl_plan: boolean; // IMPL_PLAN.md needs update - todo_list: boolean; // TODO_LIST.md needs update - session_meta: boolean; // workflow-session.json needs update - tasks: string[]; // Array of task IDs (IMPL-*.json) + impl_plan: boolean; + todo_list: boolean; + session_meta: boolean; + tasks: string[]; }; operations: { type: 'create' | 'update' | 'delete' | 'merge' | 'split'; - target: string; // File path or task ID - reason: string; // Why this change is needed + target: string; + reason: string; }[]; backup_strategy: { - timestamp: string; // ISO timestamp for backup folder - files: string[]; // All files to backup + timestamp: string; + files: string[]; }; } ``` @@ -284,33 +176,21 @@ interface ImpactAnalysis { - [ ] IMPL_PLAN.md: 更新技术方案第 3 节 - [ ] TODO_LIST.md: 添加 2 个新任务,删除 1 个废弃任务 - [ ] IMPL-001.json: 更新实现方案 -- [ ] IMPL-002.json: 添加依赖关系 - [ ] workflow-session.json: 更新任务计数 ### 变更操作 1. **创建**: IMPL-004.json (双因素认证实现) 2. **更新**: IMPL-001.json (添加 2FA 准备工作) 3. **删除**: IMPL-003.json (已被新方案替代) - -### 备份策略 -备份到: .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/ ``` **Step 3.3: User Confirmation** ```javascript -AskUserQuestion({ - questions: [{ - question: "确认执行上述修改计划?", - header: "Confirm", - options: [ - { label: "确认执行", value: "confirm", description: "开始应用所有修改" }, - { label: "调整计划", value: "adjust", description: "重新回答问题调整范围" }, - { label: "取消操作", value: "cancel", description: "放弃本次重规划" } - ], - multiSelect: false - }] -}) +Options: +- 确认执行: 开始应用所有修改 +- 调整计划: 重新回答问题调整范围 +- 取消操作: 放弃本次重规划 ``` **Output**: Modification plan confirmed or adjusted @@ -319,51 +199,31 @@ AskUserQuestion({ ### Phase 4: Backup Creation -**Step 4.1: Create Backup Directory** +**Process**: + +1. **Create Backup Directory**: ```bash timestamp=$(date -u +"%Y-%m-%dT%H-%M-%S") backup_dir=".workflow/active/$SESSION_ID/.process/backup/replan-$timestamp" mkdir -p "$backup_dir" ``` -**Step 4.2: Backup All Affected Files** -```bash -# Backup planning documents -if [ -f ".workflow/active/$SESSION_ID/IMPL_PLAN.md" ]; then - cp ".workflow/active/$SESSION_ID/IMPL_PLAN.md" "$backup_dir/" -fi +2. **Backup All Affected Files**: + - IMPL_PLAN.md + - TODO_LIST.md + - workflow-session.json + - Affected task JSONs -if [ -f ".workflow/active/$SESSION_ID/TODO_LIST.md" ]; then - cp ".workflow/active/$SESSION_ID/TODO_LIST.md" "$backup_dir/" -fi - -# Backup session metadata -cp ".workflow/active/$SESSION_ID/workflow-session.json" "$backup_dir/" - -# Backup affected task JSONs -for task_id in "${affected_tasks[@]}"; do - cp ".workflow/active/$SESSION_ID/.task/$task_id.json" "$backup_dir/" -done -``` - -**Step 4.3: Create Backup Manifest** -```bash -cat > "$backup_dir/MANIFEST.md" </dev/null; then - echo "ERROR: Invalid JSON in $task_file" - exit 1 - fi -done - -# Verify task count within limits (max 10) -task_count=$(ls .workflow/active/$SESSION_ID/.task/IMPL-*.json | wc -l) -if [ "$task_count" -gt 10 ]; then - echo "WARNING: Task count ($task_count) exceeds recommended limit of 10" -fi - -# Verify dependency graph is acyclic -# (Check no circular dependencies) -``` +1. Validate all task JSONs are valid JSON +2. Check task count within limits (max 10) +3. Verify dependency graph is acyclic **Step 6.2: Generate Change Summary** @@ -585,40 +307,29 @@ fi ## 重规划完成 ### 会话信息 -- **Session**: WFS-oauth-integration -- **时间**: 2025-11-20 10:30:00 UTC -- **备份**: .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/ +- **Session**: {session-id} +- **时间**: {timestamp} +- **备份**: {backup-path} ### 变更摘要 -**范围**: 全面重规划 (comprehensive) -**原因**: 添加双因素认证支持 +**范围**: {scope} +**原因**: {reason} ### 修改的文件 -- ✓ IMPL_PLAN.md: 更新了第 3 节认证方案 -- ✓ TODO_LIST.md: 添加 1 个任务,删除 1 个任务 -- ✓ IMPL-001.json: 更新实现方案 -- ✓ IMPL-002.json: 添加 2FA 相关依赖 -- ✓ IMPL-004.json: 新建双因素认证任务 -- ✓ workflow-session.json: 更新任务列表和历史记录 +- ✓ IMPL_PLAN.md: {changes} +- ✓ TODO_LIST.md: {changes} +- ✓ Task JSONs: {count} files updated ### 任务变更 -- **新增**: IMPL-004 (实现 TOTP 双因素认证) -- **删除**: IMPL-003 (简单密码重置 - 已废弃) -- **更新**: IMPL-001, IMPL-002 - -### 下一步建议 -1. 运行 `/workflow:action-plan-verify --session WFS-oauth` 验证规划质量 -2. 运行 `/workflow:status` 查看更新后的任务列表 -3. 运行 `/workflow:execute` 开始执行新规划 +- **新增**: {task-ids} +- **删除**: {task-ids} +- **更新**: {task-ids} ### 回滚方法 -如需回滚到重规划前的状态: -\`\`\`bash -cp .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/* .workflow/active/WFS-oauth/ -\`\`\` +cp {backup-path}/* .workflow/active/{session}/ ``` -**Output**: Summary displayed to user, replan complete +**Output**: Summary displayed, replan complete --- @@ -632,10 +343,7 @@ cp .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/* .work {"content": "交互式需求明确", "status": "completed", "activeForm": "交互式需求明确"}, {"content": "影响分析和计划生成", "status": "completed", "activeForm": "影响分析和计划生成"}, {"content": "创建备份", "status": "completed", "activeForm": "创建备份"}, - {"content": "更新 IMPL_PLAN.md", "status": "completed", "activeForm": "更新 IMPL_PLAN.md"}, - {"content": "更新 TODO_LIST.md", "status": "completed", "activeForm": "更新 TODO_LIST.md"}, - {"content": "更新 3 个任务 JSON 文件", "status": "completed", "activeForm": "更新任务 JSON 文件"}, - {"content": "更新会话元数据", "status": "completed", "activeForm": "更新会话元数据"}, + {"content": "更新会话产出文件", "status": "completed", "activeForm": "更新会话产出文件"}, {"content": "验证一致性", "status": "completed", "activeForm": "验证一致性"} ] ``` @@ -645,17 +353,15 @@ cp .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/* .work ```json [ {"content": "检测会话和加载任务", "status": "completed", "activeForm": "检测会话和加载任务"}, - {"content": "交互式更新类型确认", "status": "completed", "activeForm": "交互式更新类型确认"}, - {"content": "分析影响范围", "status": "completed", "activeForm": "分析影响范围"}, - {"content": "创建备份", "status": "completed", "activeForm": "创建备份"}, - {"content": "更新 IMPL-001.json", "status": "completed", "activeForm": "更新 IMPL-001.json"}, - {"content": "更新会话元数据", "status": "completed", "activeForm": "更新会话元数据"} + {"content": "交互式更新确认", "status": "completed", "activeForm": "交互式更新确认"}, + {"content": "应用任务修改", "status": "completed", "activeForm": "应用任务修改"} ] ``` ## Error Handling ### Session Errors + ```bash # No active session found ERROR: No active session found @@ -663,215 +369,56 @@ Run /workflow:session:start to create a session # Session not found ERROR: Session WFS-invalid not found -Available sessions: - - WFS-oauth-integration - - WFS-user-profile +Available sessions: [list] -# No changes detected +# No changes specified WARNING: No modifications specified -Please provide requirements or use --interactive mode +Use --interactive mode or provide requirements ``` ### Task Errors + ```bash # Task not found -ERROR: Task IMPL-999 not found in session WFS-oauth -Available tasks: IMPL-001, IMPL-002, IMPL-003 +ERROR: Task IMPL-999 not found in session +Available tasks: [list] -# Task already completed +# Task completed WARNING: Task IMPL-001 is completed -Consider creating a new task for additional work +Consider creating new task for additional work -# Circular dependency detected -ERROR: Circular dependency detected: IMPL-001 → IMPL-002 → IMPL-001 -Please resolve dependency conflicts +# Circular dependency +ERROR: Circular dependency detected +Resolve dependency conflicts before proceeding ``` ### Validation Errors + ```bash # Task limit exceeded ERROR: Replan would create 12 tasks (limit: 10) -Consider: - 1. Combining related tasks - 2. Splitting into multiple sessions - 3. Removing unnecessary tasks +Consider: combining tasks, splitting sessions, or removing tasks -# Invalid JSON generated -ERROR: Generated invalid JSON for IMPL-004 -Backup preserved at: [backup_path] -Rolling back changes... +# Invalid JSON +ERROR: Generated invalid JSON +Backup preserved, rolling back changes ``` -## Examples - -### Example 1: Session Replan - Add Feature - -```bash -/workflow:replan "添加双因素认证支持" - -# Interactive clarification -Q: 修改范围是什么? -A: 全面重规划 (comprehensive) - -Q: 哪些功能模块会受到影响? -A: [✓] 认证模块 (src/auth) - [✓] API 接口 (src/api) - -Q: 任务变更类型? -A: [✓] 添加新任务 - [✓] 仅更新内容 - -Q: 是否需要更新任务依赖关系? -A: 是,需要重新梳理依赖 - -# Modification plan shown... -# User confirms... - -# Execution -✓ 创建备份 -✓ 更新 IMPL_PLAN.md -✓ 更新 TODO_LIST.md -✓ 创建 IMPL-004.json -✓ 更新 IMPL-001.json, IMPL-002.json -✓ 更新 workflow-session.json - -# Summary displayed -重规划完成! -新增 1 个任务,更新 2 个任务 -备份位置: .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/ -``` - -### Example 2: Task Replan - Update Requirements - -```bash -/workflow:replan IMPL-001 "需要支持 OAuth2.0 标准,而不是自定义认证" - -# Interactive clarification -Q: 需要更新任务的哪些部分? -A: [✓] 需求和验收标准 (requirements & acceptance) - [✓] 实现方案 (implementation_approach) - -Q: 此修改是否影响其他任务? -A: 是,需要同步更新依赖任务 - -# Impact analysis -分析发现以下任务受影响: -- IMPL-002 (依赖 IMPL-001 的认证结果) -- IMPL-003 (使用相同的认证接口) - -# Modification plan -将更新: -- IMPL-001.json: 需求和实现方案 -- IMPL-002.json: 依赖说明 -- IMPL-003.json: 接口调用方式 - -# User confirms... - -✓ 创建备份 -✓ 更新 IMPL-001.json -✓ 更新 IMPL-002.json -✓ 更新 IMPL-003.json -✓ 更新 workflow-session.json - -任务重规划完成! -更新了 3 个任务文件 -``` - -### Example 3: Interactive Session Replan - -```bash -/workflow:replan --interactive - -# Step-by-step guided process -Q: 选择活动会话? -A: WFS-oauth-integration - -Q: 你想要修改什么? -A: [text input] "需要添加 API 速率限制功能" - -Q: 修改范围是什么? -A: 修改规划方案 (plan_update) - -Q: 哪些功能模块会受到影响? -A: [✓] API 接口 (src/api) - -Q: 任务变更类型? -A: [✓] 添加新任务 - -Q: 是否需要更新任务依赖关系? -A: 否,保持现有依赖 - -# Rest of the flow continues... -``` - -## Related Commands - -**Prerequisites**: -- `/workflow:session:start` - Create or discover session before replanning -- `/workflow:plan` - Initial planning that creates session artifacts - -**Related Operations**: -- `/workflow:action-plan-verify` - Verify replan quality after making changes -- `/workflow:status` - Review updated task breakdown -- `/task:replan` - Legacy command for project-level task replanning (deprecated) - -**Follow-up Commands**: -- `/workflow:execute` - Execute updated plan -- `/workflow:review` - Review changes after implementation - -## Migration from task:replan - -### Key Differences - -| Aspect | task:replan (Old) | workflow:replan (New) | -|--------|-------------------|------------------------| -| Scope | Single task or batch | Session-level or task-level | -| Context | Project-level (.task/) | Session-level (.workflow/active/) | -| Artifacts | Only task JSON | IMPL_PLAN.md, TODO_LIST.md, task JSONs, session metadata | -| Interaction | Minimal | Interactive boundary clarification | -| Backup | .task/backup/ | Session-specific .process/backup/ | - -### Migration Guide - -**Old command**: -```bash -/task:replan IMPL-1 "Add OAuth2 support" -``` - -**New command**: -```bash -/workflow:replan IMPL-1 "Add OAuth2 support" -``` - -**Batch mode** (old): -```bash -/task:replan --batch verification-report.md -``` - -**New approach** (use action-plan-verify + workflow:replan): -```bash -/workflow:action-plan-verify --session WFS-oauth -# Review recommendations, then: -/workflow:replan --session WFS-oauth "Apply verification recommendations" -``` - -## Implementation Notes - -### File Structure Assumptions +## File Structure ``` .workflow/active/WFS-session-name/ -├── workflow-session.json # Session metadata -├── IMPL_PLAN.md # Planning document -├── TODO_LIST.md # Task checklist +├── workflow-session.json +├── IMPL_PLAN.md +├── TODO_LIST.md ├── .task/ -│ ├── IMPL-001.json # Task definitions +│ ├── IMPL-001.json │ ├── IMPL-002.json │ └── IMPL-003.json └── .process/ - ├── context-package.json # Context from planning + ├── context-package.json └── backup/ - └── replan-2025-11-20T10-30-00/ + └── replan-{timestamp}/ ├── MANIFEST.md ├── IMPL_PLAN.md ├── TODO_LIST.md @@ -879,17 +426,49 @@ A: 否,保持现有依赖 └── IMPL-*.json ``` -### Interactive Question Design Principles +## Examples -1. **Progressive Disclosure**: Start broad, get specific based on answers -2. **Context-Aware Options**: Dynamically generate options from session data -3. **Clear Descriptions**: Each option explains what will happen -4. **Escape Hatches**: Always provide "cancel" or "adjust" options -5. **Validation**: Confirm plan before executing destructive operations +### Session Replan - Add Feature -### Change Tracking Strategy +```bash +/workflow:replan "添加双因素认证支持" -All modifications are tracked in: -1. **Session metadata**: `workflow-session.json` replan_history array -2. **Backup manifest**: MANIFEST.md in backup folder -3. **Git commits**: Encourage users to commit after replanning +# Interactive clarification +Q: 修改范围? +A: 全面重规划 + +Q: 受影响模块? +A: 认证模块, API接口 + +Q: 任务变更? +A: 添加新任务, 更新内容 + +# Execution +✓ 创建备份 +✓ 更新 IMPL_PLAN.md +✓ 更新 TODO_LIST.md +✓ 创建 IMPL-004.json +✓ 更新 IMPL-001.json, IMPL-002.json + +重规划完成! 新增 1 任务,更新 2 任务 +``` + +### Task Replan - Update Requirements + +```bash +/workflow:replan IMPL-001 "支持 OAuth2.0 标准" + +# Interactive clarification +Q: 更新部分? +A: 需求和验收标准, 实现方案 + +Q: 影响其他任务? +A: 是,需要同步更新依赖任务 + +# Execution +✓ 创建备份 +✓ 更新 IMPL-001.json +✓ 更新 IMPL-002.json (依赖任务) + +任务重规划完成! 更新 2 个任务 +``` diff --git a/.claude/skills/command-guide/reference/commands/workflow/replan.md b/.claude/skills/command-guide/reference/commands/workflow/replan.md index 1f7889db..d9cc4a34 100644 --- a/.claude/skills/command-guide/reference/commands/workflow/replan.md +++ b/.claude/skills/command-guide/reference/commands/workflow/replan.md @@ -5,110 +5,71 @@ argument-hint: "[--session session-id] [task-id] \"requirements\"|file.md [--int allowed-tools: Read(*), Write(*), Edit(*), TodoWrite(*), Glob(*), Bash(*) --- -# Workflow Replan Command (/workflow:replan) +# Workflow Replan Command ## Overview Intelligently replans workflow sessions or individual tasks with interactive boundary clarification and comprehensive artifact updates. -**Dual Mode Design**: -- **Session Replan Mode**: Updates multiple session artifacts (IMPL_PLAN.md, TODO_LIST.md, task JSONs) -- **Task Replan Mode**: Focused task updates within session context +**Core Capabilities**: +- **Session Replan**: Updates multiple artifacts (IMPL_PLAN.md, TODO_LIST.md, task JSONs) +- **Task Replan**: Focused updates within session context +- **Interactive Clarification**: Guided questioning to define modification boundaries +- **Impact Analysis**: Automatic detection of affected files and dependencies +- **Backup Management**: Preserves previous versions with restore capability ## Core Principles **Task System**: @~/.claude/workflows/task-core.md **Workflow Architecture**: @~/.claude/workflows/workflow-architecture.md -## Key Features -- **Interactive Clarification**: Guided questioning to define modification boundaries -- **Session-Aware**: Understands and updates all session artifacts -- **Impact Analysis**: Automatically detects affected files and dependencies -- **Comprehensive Updates**: Modifies IMPL_PLAN.md, TODO_LIST.md, task JSONs, session metadata -- **Backup Management**: Preserves previous versions of all modified files -- **Change Tracking**: Documents all modifications with rationale - ## Operation Modes -### Mode 1: Session Replan (Default) +### Session Replan Mode -#### Auto-detect Active Session ```bash +# Auto-detect active session /workflow:replan "添加双因素认证支持" -``` -Automatically detects active session from `.workflow/active/` -#### Explicit Session -```bash -/workflow:replan --session WFS-oauth-integration "添加双因素认证支持" -``` +# Explicit session +/workflow:replan --session WFS-oauth "添加双因素认证支持" -#### File-based Input -```bash +# File-based input /workflow:replan --session WFS-oauth requirements-update.md + +# Interactive mode +/workflow:replan --interactive ``` -#### Interactive Mode -```bash -/workflow:replan --session WFS-oauth --interactive -``` -Fully guided step-by-step modification process +### Task Replan Mode -### Mode 2: Task Replan - -#### Direct Task Update ```bash +# Direct task update /workflow:replan IMPL-1 "修改为使用 OAuth2.0 标准" -``` -Auto-detects session from active sessions -#### Task with Session -```bash +# Task with explicit session /workflow:replan --session WFS-oauth IMPL-2 "增加单元测试覆盖率到 90%" -``` -#### Task Interactive Mode -```bash +# Interactive mode /workflow:replan IMPL-1 --interactive ``` -## Execution Flow +## Execution Lifecycle ### Phase 1: Mode Detection & Session Discovery -**Step 1.1: Detect Operation Mode** -```bash -# Check if task ID provided (IMPL-N or IMPL-N.M format) -if [[ "$1" =~ ^IMPL-[0-9]+(\.[0-9]+)?$ ]]; then - MODE="task" - TASK_ID="$1" -else - MODE="session" -fi -``` +**Process**: +1. **Detect Operation Mode**: + - Check if task ID provided (IMPL-N or IMPL-N.M format) → Task mode + - Otherwise → Session mode -**Step 1.2: Discover/Validate Session** -```bash -# If --session provided, use it -# Otherwise, auto-detect active session -active_session=$(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1) +2. **Discover/Validate Session**: + - Use `--session` flag if provided + - Otherwise auto-detect from `.workflow/active/` + - Validate session exists -# Validate session exists -if [ ! -d ".workflow/active/$SESSION_ID" ]; then - echo "ERROR: Session $SESSION_ID not found" - exit 1 -fi -``` - -**Step 1.3: Load Session Context** -```bash -# Read session metadata -Read(file_path=".workflow/active/$SESSION_ID/workflow-session.json") - -# List existing tasks -Glob(pattern=".workflow/active/$SESSION_ID/.task/IMPL-*.json") - -# Read planning document -Read(file_path=".workflow/active/$SESSION_ID/IMPL_PLAN.md") -``` +3. **Load Session Context**: + - Read `workflow-session.json` + - List existing tasks + - Read `IMPL_PLAN.md` and `TODO_LIST.md` **Output**: Session validated, context loaded, mode determined @@ -116,134 +77,65 @@ Read(file_path=".workflow/active/$SESSION_ID/IMPL_PLAN.md") ### Phase 2: Interactive Requirement Clarification -**Purpose**: Use guided questioning to precisely define modification scope and boundaries +**Purpose**: Define modification scope through guided questioning -#### Session Mode Clarification +#### Session Mode Questions -**Question 1: Modification Scope** +**Q1: Modification Scope** ```javascript -AskUserQuestion({ - questions: [{ - question: "修改范围是什么?", - header: "Scope", - options: [ - { - label: "仅更新任务细节", - value: "tasks_only", - description: "只修改现有任务的实现细节,不改变整体规划" - }, - { - label: "修改规划方案", - value: "plan_update", - description: "需要更新 IMPL_PLAN.md 中的技术方案或架构设计" - }, - { - label: "重构任务结构", - value: "task_restructure", - description: "需要添加、删除或重组任务,更新 TODO_LIST.md" - }, - { - label: "全面重规划", - value: "comprehensive", - description: "大幅修改需求,需要更新所有规划文档和任务" - } - ], - multiSelect: false - }] -}) +Options: +- 仅更新任务细节 (tasks_only) +- 修改规划方案 (plan_update) +- 重构任务结构 (task_restructure) +- 全面重规划 (comprehensive) ``` -**Question 2: Affected Modules** (if scope >= plan_update) +**Q2: Affected Modules** (if scope >= plan_update) ```javascript -AskUserQuestion({ - questions: [{ - question: "哪些功能模块会受到影响?", - header: "Modules", - options: [ - // Dynamically generated from existing tasks' focus_paths - { label: "认证模块 (src/auth)", value: "auth" }, - { label: "用户管理 (src/user)", value: "user" }, - { label: "API 接口 (src/api)", value: "api" }, - { label: "全部模块", value: "all" } - ], - multiSelect: true - }] -}) +Options: Dynamically generated from existing tasks' focus_paths +- 认证模块 (src/auth) +- 用户管理 (src/user) +- 全部模块 ``` -**Question 3: Task Changes** (if scope >= task_restructure) +**Q3: Task Changes** (if scope >= task_restructure) ```javascript -AskUserQuestion({ - questions: [{ - question: "任务变更类型?", - header: "Task Changes", - options: [ - { label: "添加新任务", value: "add", description: "创建新的 IMPL-*.json 任务" }, - { label: "删除现有任务", value: "remove", description: "移除不需要的任务" }, - { label: "合并任务", value: "merge", description: "将多个任务合并为一个" }, - { label: "拆分任务", value: "split", description: "将一个任务拆分为多个子任务" }, - { label: "仅更新内容", value: "update", description: "保持任务结构,只修改内容" } - ], - multiSelect: true - }] -}) +Options: +- 添加新任务 +- 删除现有任务 +- 合并任务 +- 拆分任务 +- 仅更新内容 ``` -**Question 4: Dependency Changes** (if task changes detected) +**Q4: Dependency Changes** ```javascript -AskUserQuestion({ - questions: [{ - question: "是否需要更新任务依赖关系?", - header: "Dependencies", - options: [ - { label: "是,需要重新梳理依赖", value: "yes" }, - { label: "否,保持现有依赖", value: "no" } - ], - multiSelect: false - }] -}) +Options: +- 是,需要重新梳理依赖 +- 否,保持现有依赖 ``` -#### Task Mode Clarification +#### Task Mode Questions -**Question 1: Update Type** +**Q1: Update Type** ```javascript -AskUserQuestion({ - questions: [{ - question: "需要更新任务的哪些部分?", - header: "Update Type", - options: [ - { label: "需求和验收标准 (requirements & acceptance)", value: "requirements" }, - { label: "实现方案 (implementation_approach)", value: "implementation" }, - { label: "文件范围 (focus_paths)", value: "paths" }, - { label: "依赖关系 (depends_on)", value: "dependencies" }, - { label: "全部更新", value: "all" } - ], - multiSelect: true - }] -}) +Options: +- 需求和验收标准 (requirements & acceptance) +- 实现方案 (implementation_approach) +- 文件范围 (focus_paths) +- 依赖关系 (depends_on) +- 全部更新 ``` -**Question 2: Ripple Effect** +**Q2: Ripple Effect** ```javascript -AskUserQuestion({ - questions: [{ - question: "此修改是否影响其他任务?", - header: "Impact", - options: [ - { label: "是,需要同步更新依赖任务", value: "yes" }, - { label: "否,仅影响当前任务", value: "no" }, - { label: "不确定,请帮我分析", value: "analyze" } - ], - multiSelect: false - }] -}) +Options: +- 是,需要同步更新依赖任务 +- 否,仅影响当前任务 +- 不确定,请帮我分析 ``` -**Output**: -- User selections stored in clarification context -- Modification boundaries clearly defined -- Impact scope determined +**Output**: User selections stored, modification boundaries defined --- @@ -251,26 +143,26 @@ AskUserQuestion({ **Step 3.1: Analyze Required Changes** -Based on clarification responses, determine affected files: +Determine affected files based on clarification: ```typescript interface ImpactAnalysis { affected_files: { - impl_plan: boolean; // IMPL_PLAN.md needs update - todo_list: boolean; // TODO_LIST.md needs update - session_meta: boolean; // workflow-session.json needs update - tasks: string[]; // Array of task IDs (IMPL-*.json) + impl_plan: boolean; + todo_list: boolean; + session_meta: boolean; + tasks: string[]; }; operations: { type: 'create' | 'update' | 'delete' | 'merge' | 'split'; - target: string; // File path or task ID - reason: string; // Why this change is needed + target: string; + reason: string; }[]; backup_strategy: { - timestamp: string; // ISO timestamp for backup folder - files: string[]; // All files to backup + timestamp: string; + files: string[]; }; } ``` @@ -284,33 +176,21 @@ interface ImpactAnalysis { - [ ] IMPL_PLAN.md: 更新技术方案第 3 节 - [ ] TODO_LIST.md: 添加 2 个新任务,删除 1 个废弃任务 - [ ] IMPL-001.json: 更新实现方案 -- [ ] IMPL-002.json: 添加依赖关系 - [ ] workflow-session.json: 更新任务计数 ### 变更操作 1. **创建**: IMPL-004.json (双因素认证实现) 2. **更新**: IMPL-001.json (添加 2FA 准备工作) 3. **删除**: IMPL-003.json (已被新方案替代) - -### 备份策略 -备份到: .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/ ``` **Step 3.3: User Confirmation** ```javascript -AskUserQuestion({ - questions: [{ - question: "确认执行上述修改计划?", - header: "Confirm", - options: [ - { label: "确认执行", value: "confirm", description: "开始应用所有修改" }, - { label: "调整计划", value: "adjust", description: "重新回答问题调整范围" }, - { label: "取消操作", value: "cancel", description: "放弃本次重规划" } - ], - multiSelect: false - }] -}) +Options: +- 确认执行: 开始应用所有修改 +- 调整计划: 重新回答问题调整范围 +- 取消操作: 放弃本次重规划 ``` **Output**: Modification plan confirmed or adjusted @@ -319,51 +199,31 @@ AskUserQuestion({ ### Phase 4: Backup Creation -**Step 4.1: Create Backup Directory** +**Process**: + +1. **Create Backup Directory**: ```bash timestamp=$(date -u +"%Y-%m-%dT%H-%M-%S") backup_dir=".workflow/active/$SESSION_ID/.process/backup/replan-$timestamp" mkdir -p "$backup_dir" ``` -**Step 4.2: Backup All Affected Files** -```bash -# Backup planning documents -if [ -f ".workflow/active/$SESSION_ID/IMPL_PLAN.md" ]; then - cp ".workflow/active/$SESSION_ID/IMPL_PLAN.md" "$backup_dir/" -fi +2. **Backup All Affected Files**: + - IMPL_PLAN.md + - TODO_LIST.md + - workflow-session.json + - Affected task JSONs -if [ -f ".workflow/active/$SESSION_ID/TODO_LIST.md" ]; then - cp ".workflow/active/$SESSION_ID/TODO_LIST.md" "$backup_dir/" -fi - -# Backup session metadata -cp ".workflow/active/$SESSION_ID/workflow-session.json" "$backup_dir/" - -# Backup affected task JSONs -for task_id in "${affected_tasks[@]}"; do - cp ".workflow/active/$SESSION_ID/.task/$task_id.json" "$backup_dir/" -done -``` - -**Step 4.3: Create Backup Manifest** -```bash -cat > "$backup_dir/MANIFEST.md" </dev/null; then - echo "ERROR: Invalid JSON in $task_file" - exit 1 - fi -done - -# Verify task count within limits (max 10) -task_count=$(ls .workflow/active/$SESSION_ID/.task/IMPL-*.json | wc -l) -if [ "$task_count" -gt 10 ]; then - echo "WARNING: Task count ($task_count) exceeds recommended limit of 10" -fi - -# Verify dependency graph is acyclic -# (Check no circular dependencies) -``` +1. Validate all task JSONs are valid JSON +2. Check task count within limits (max 10) +3. Verify dependency graph is acyclic **Step 6.2: Generate Change Summary** @@ -585,40 +307,29 @@ fi ## 重规划完成 ### 会话信息 -- **Session**: WFS-oauth-integration -- **时间**: 2025-11-20 10:30:00 UTC -- **备份**: .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/ +- **Session**: {session-id} +- **时间**: {timestamp} +- **备份**: {backup-path} ### 变更摘要 -**范围**: 全面重规划 (comprehensive) -**原因**: 添加双因素认证支持 +**范围**: {scope} +**原因**: {reason} ### 修改的文件 -- ✓ IMPL_PLAN.md: 更新了第 3 节认证方案 -- ✓ TODO_LIST.md: 添加 1 个任务,删除 1 个任务 -- ✓ IMPL-001.json: 更新实现方案 -- ✓ IMPL-002.json: 添加 2FA 相关依赖 -- ✓ IMPL-004.json: 新建双因素认证任务 -- ✓ workflow-session.json: 更新任务列表和历史记录 +- ✓ IMPL_PLAN.md: {changes} +- ✓ TODO_LIST.md: {changes} +- ✓ Task JSONs: {count} files updated ### 任务变更 -- **新增**: IMPL-004 (实现 TOTP 双因素认证) -- **删除**: IMPL-003 (简单密码重置 - 已废弃) -- **更新**: IMPL-001, IMPL-002 - -### 下一步建议 -1. 运行 `/workflow:action-plan-verify --session WFS-oauth` 验证规划质量 -2. 运行 `/workflow:status` 查看更新后的任务列表 -3. 运行 `/workflow:execute` 开始执行新规划 +- **新增**: {task-ids} +- **删除**: {task-ids} +- **更新**: {task-ids} ### 回滚方法 -如需回滚到重规划前的状态: -\`\`\`bash -cp .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/* .workflow/active/WFS-oauth/ -\`\`\` +cp {backup-path}/* .workflow/active/{session}/ ``` -**Output**: Summary displayed to user, replan complete +**Output**: Summary displayed, replan complete --- @@ -632,10 +343,7 @@ cp .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/* .work {"content": "交互式需求明确", "status": "completed", "activeForm": "交互式需求明确"}, {"content": "影响分析和计划生成", "status": "completed", "activeForm": "影响分析和计划生成"}, {"content": "创建备份", "status": "completed", "activeForm": "创建备份"}, - {"content": "更新 IMPL_PLAN.md", "status": "completed", "activeForm": "更新 IMPL_PLAN.md"}, - {"content": "更新 TODO_LIST.md", "status": "completed", "activeForm": "更新 TODO_LIST.md"}, - {"content": "更新 3 个任务 JSON 文件", "status": "completed", "activeForm": "更新任务 JSON 文件"}, - {"content": "更新会话元数据", "status": "completed", "activeForm": "更新会话元数据"}, + {"content": "更新会话产出文件", "status": "completed", "activeForm": "更新会话产出文件"}, {"content": "验证一致性", "status": "completed", "activeForm": "验证一致性"} ] ``` @@ -645,17 +353,15 @@ cp .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/* .work ```json [ {"content": "检测会话和加载任务", "status": "completed", "activeForm": "检测会话和加载任务"}, - {"content": "交互式更新类型确认", "status": "completed", "activeForm": "交互式更新类型确认"}, - {"content": "分析影响范围", "status": "completed", "activeForm": "分析影响范围"}, - {"content": "创建备份", "status": "completed", "activeForm": "创建备份"}, - {"content": "更新 IMPL-001.json", "status": "completed", "activeForm": "更新 IMPL-001.json"}, - {"content": "更新会话元数据", "status": "completed", "activeForm": "更新会话元数据"} + {"content": "交互式更新确认", "status": "completed", "activeForm": "交互式更新确认"}, + {"content": "应用任务修改", "status": "completed", "activeForm": "应用任务修改"} ] ``` ## Error Handling ### Session Errors + ```bash # No active session found ERROR: No active session found @@ -663,215 +369,56 @@ Run /workflow:session:start to create a session # Session not found ERROR: Session WFS-invalid not found -Available sessions: - - WFS-oauth-integration - - WFS-user-profile +Available sessions: [list] -# No changes detected +# No changes specified WARNING: No modifications specified -Please provide requirements or use --interactive mode +Use --interactive mode or provide requirements ``` ### Task Errors + ```bash # Task not found -ERROR: Task IMPL-999 not found in session WFS-oauth -Available tasks: IMPL-001, IMPL-002, IMPL-003 +ERROR: Task IMPL-999 not found in session +Available tasks: [list] -# Task already completed +# Task completed WARNING: Task IMPL-001 is completed -Consider creating a new task for additional work +Consider creating new task for additional work -# Circular dependency detected -ERROR: Circular dependency detected: IMPL-001 → IMPL-002 → IMPL-001 -Please resolve dependency conflicts +# Circular dependency +ERROR: Circular dependency detected +Resolve dependency conflicts before proceeding ``` ### Validation Errors + ```bash # Task limit exceeded ERROR: Replan would create 12 tasks (limit: 10) -Consider: - 1. Combining related tasks - 2. Splitting into multiple sessions - 3. Removing unnecessary tasks +Consider: combining tasks, splitting sessions, or removing tasks -# Invalid JSON generated -ERROR: Generated invalid JSON for IMPL-004 -Backup preserved at: [backup_path] -Rolling back changes... +# Invalid JSON +ERROR: Generated invalid JSON +Backup preserved, rolling back changes ``` -## Examples - -### Example 1: Session Replan - Add Feature - -```bash -/workflow:replan "添加双因素认证支持" - -# Interactive clarification -Q: 修改范围是什么? -A: 全面重规划 (comprehensive) - -Q: 哪些功能模块会受到影响? -A: [✓] 认证模块 (src/auth) - [✓] API 接口 (src/api) - -Q: 任务变更类型? -A: [✓] 添加新任务 - [✓] 仅更新内容 - -Q: 是否需要更新任务依赖关系? -A: 是,需要重新梳理依赖 - -# Modification plan shown... -# User confirms... - -# Execution -✓ 创建备份 -✓ 更新 IMPL_PLAN.md -✓ 更新 TODO_LIST.md -✓ 创建 IMPL-004.json -✓ 更新 IMPL-001.json, IMPL-002.json -✓ 更新 workflow-session.json - -# Summary displayed -重规划完成! -新增 1 个任务,更新 2 个任务 -备份位置: .workflow/active/WFS-oauth/.process/backup/replan-2025-11-20T10-30-00/ -``` - -### Example 2: Task Replan - Update Requirements - -```bash -/workflow:replan IMPL-001 "需要支持 OAuth2.0 标准,而不是自定义认证" - -# Interactive clarification -Q: 需要更新任务的哪些部分? -A: [✓] 需求和验收标准 (requirements & acceptance) - [✓] 实现方案 (implementation_approach) - -Q: 此修改是否影响其他任务? -A: 是,需要同步更新依赖任务 - -# Impact analysis -分析发现以下任务受影响: -- IMPL-002 (依赖 IMPL-001 的认证结果) -- IMPL-003 (使用相同的认证接口) - -# Modification plan -将更新: -- IMPL-001.json: 需求和实现方案 -- IMPL-002.json: 依赖说明 -- IMPL-003.json: 接口调用方式 - -# User confirms... - -✓ 创建备份 -✓ 更新 IMPL-001.json -✓ 更新 IMPL-002.json -✓ 更新 IMPL-003.json -✓ 更新 workflow-session.json - -任务重规划完成! -更新了 3 个任务文件 -``` - -### Example 3: Interactive Session Replan - -```bash -/workflow:replan --interactive - -# Step-by-step guided process -Q: 选择活动会话? -A: WFS-oauth-integration - -Q: 你想要修改什么? -A: [text input] "需要添加 API 速率限制功能" - -Q: 修改范围是什么? -A: 修改规划方案 (plan_update) - -Q: 哪些功能模块会受到影响? -A: [✓] API 接口 (src/api) - -Q: 任务变更类型? -A: [✓] 添加新任务 - -Q: 是否需要更新任务依赖关系? -A: 否,保持现有依赖 - -# Rest of the flow continues... -``` - -## Related Commands - -**Prerequisites**: -- `/workflow:session:start` - Create or discover session before replanning -- `/workflow:plan` - Initial planning that creates session artifacts - -**Related Operations**: -- `/workflow:action-plan-verify` - Verify replan quality after making changes -- `/workflow:status` - Review updated task breakdown -- `/task:replan` - Legacy command for project-level task replanning (deprecated) - -**Follow-up Commands**: -- `/workflow:execute` - Execute updated plan -- `/workflow:review` - Review changes after implementation - -## Migration from task:replan - -### Key Differences - -| Aspect | task:replan (Old) | workflow:replan (New) | -|--------|-------------------|------------------------| -| Scope | Single task or batch | Session-level or task-level | -| Context | Project-level (.task/) | Session-level (.workflow/active/) | -| Artifacts | Only task JSON | IMPL_PLAN.md, TODO_LIST.md, task JSONs, session metadata | -| Interaction | Minimal | Interactive boundary clarification | -| Backup | .task/backup/ | Session-specific .process/backup/ | - -### Migration Guide - -**Old command**: -```bash -/task:replan IMPL-1 "Add OAuth2 support" -``` - -**New command**: -```bash -/workflow:replan IMPL-1 "Add OAuth2 support" -``` - -**Batch mode** (old): -```bash -/task:replan --batch verification-report.md -``` - -**New approach** (use action-plan-verify + workflow:replan): -```bash -/workflow:action-plan-verify --session WFS-oauth -# Review recommendations, then: -/workflow:replan --session WFS-oauth "Apply verification recommendations" -``` - -## Implementation Notes - -### File Structure Assumptions +## File Structure ``` .workflow/active/WFS-session-name/ -├── workflow-session.json # Session metadata -├── IMPL_PLAN.md # Planning document -├── TODO_LIST.md # Task checklist +├── workflow-session.json +├── IMPL_PLAN.md +├── TODO_LIST.md ├── .task/ -│ ├── IMPL-001.json # Task definitions +│ ├── IMPL-001.json │ ├── IMPL-002.json │ └── IMPL-003.json └── .process/ - ├── context-package.json # Context from planning + ├── context-package.json └── backup/ - └── replan-2025-11-20T10-30-00/ + └── replan-{timestamp}/ ├── MANIFEST.md ├── IMPL_PLAN.md ├── TODO_LIST.md @@ -879,17 +426,49 @@ A: 否,保持现有依赖 └── IMPL-*.json ``` -### Interactive Question Design Principles +## Examples -1. **Progressive Disclosure**: Start broad, get specific based on answers -2. **Context-Aware Options**: Dynamically generate options from session data -3. **Clear Descriptions**: Each option explains what will happen -4. **Escape Hatches**: Always provide "cancel" or "adjust" options -5. **Validation**: Confirm plan before executing destructive operations +### Session Replan - Add Feature -### Change Tracking Strategy +```bash +/workflow:replan "添加双因素认证支持" -All modifications are tracked in: -1. **Session metadata**: `workflow-session.json` replan_history array -2. **Backup manifest**: MANIFEST.md in backup folder -3. **Git commits**: Encourage users to commit after replanning +# Interactive clarification +Q: 修改范围? +A: 全面重规划 + +Q: 受影响模块? +A: 认证模块, API接口 + +Q: 任务变更? +A: 添加新任务, 更新内容 + +# Execution +✓ 创建备份 +✓ 更新 IMPL_PLAN.md +✓ 更新 TODO_LIST.md +✓ 创建 IMPL-004.json +✓ 更新 IMPL-001.json, IMPL-002.json + +重规划完成! 新增 1 任务,更新 2 任务 +``` + +### Task Replan - Update Requirements + +```bash +/workflow:replan IMPL-001 "支持 OAuth2.0 标准" + +# Interactive clarification +Q: 更新部分? +A: 需求和验收标准, 实现方案 + +Q: 影响其他任务? +A: 是,需要同步更新依赖任务 + +# Execution +✓ 创建备份 +✓ 更新 IMPL-001.json +✓ 更新 IMPL-002.json (依赖任务) + +任务重规划完成! 更新 2 个任务 +```