Refactor workflow output paths to use a standardized sessions directory structure

- Updated output paths in various command files to reflect the new structure: `.workflow/sessions/{session_id}/` instead of `.workflow/{session_id}/`.
- Adjusted documentation and code comments to ensure consistency across all agents and commands.
- Ensured that all references to session-related files are correctly pointing to the new directory format.
This commit is contained in:
catlog22
2025-11-19 23:04:10 +08:00
parent 9b07310d68
commit 89a61acb71
37 changed files with 492 additions and 316 deletions

View File

@@ -102,7 +102,7 @@ Phase 2: Document Generation (Autonomous Output)
1. **Extract Tasks**: Parse `analysis_results.tasks` array 1. **Extract Tasks**: Parse `analysis_results.tasks` array
2. **Map Artifacts**: Use `artifacts_inventory` to add artifact references to task.context 2. **Map Artifacts**: Use `artifacts_inventory` to add artifact references to task.context
3. **Assess Complexity**: Use `analysis_results.complexity` for document structure decision 3. **Assess Complexity**: Use `analysis_results.complexity` for document structure decision
4. **Session Paths**: Use `session_id` to construct output paths (.workflow/{session_id}/) 4. **Session Paths**: Use `session_id` to construct output paths (.workflow/sessions/{session_id}/)
### MCP Integration Guidelines ### MCP Integration Guidelines
@@ -244,14 +244,14 @@ Generate individual `.task/IMPL-*.json` files with:
- Low priority: role_analyses - Low priority: role_analyses
### 3. Implementation Plan Creation ### 3. Implementation Plan Creation
Generate `IMPL_PLAN.md` at `.workflow/{session_id}/IMPL_PLAN.md`: Generate `IMPL_PLAN.md` at `.workflow/sessions/{session_id}/IMPL_PLAN.md`:
**Structure**: **Structure**:
```markdown ```markdown
--- ---
identifier: {session_id} identifier: {session_id}
source: "User requirements" source: "User requirements"
analysis: .workflow/{session_id}/.process/ANALYSIS_RESULTS.md analysis: .workflow/sessions/{session_id}/.process/ANALYSIS_RESULTS.md
--- ---
# Implementation Plan: {Project Title} # Implementation Plan: {Project Title}
@@ -280,7 +280,7 @@ analysis: .workflow/{session_id}/.process/ANALYSIS_RESULTS.md
``` ```
### 4. TODO List Generation ### 4. TODO List Generation
Generate `TODO_LIST.md` at `.workflow/{session_id}/TODO_LIST.md`: Generate `TODO_LIST.md` at `.workflow/sessions/{session_id}/TODO_LIST.md`:
**Structure**: **Structure**:
```markdown ```markdown

View File

@@ -98,7 +98,7 @@ Phase 3: Task JSON Generation
1. Load task JSON template 1. Load task JSON template
2. Populate template with parsed CLI results 2. Populate template with parsed CLI results
3. Add iteration context and previous attempts 3. Add iteration context and previous attempts
4. Write task JSON to .workflow/{session}/.task/IMPL-fix-N.json 4. Write task JSON to .workflow/session/{session}/.task/IMPL-fix-N.json
5. Return success status and task ID to orchestrator 5. Return success status and task ID to orchestrator
``` ```

View File

@@ -238,7 +238,7 @@ const context = {
**3.5 Brainstorm Artifacts Integration** **3.5 Brainstorm Artifacts Integration**
If `.workflow/{session}/.brainstorming/` exists, read and include content: If `.workflow/session/{session}/.brainstorming/` exists, read and include content:
```javascript ```javascript
const brainstormDir = `.workflow/${session}/.brainstorming`; const brainstormDir = `.workflow/${session}/.brainstorming`;
if (dir_exists(brainstormDir)) { if (dir_exists(brainstormDir)) {
@@ -274,7 +274,7 @@ Calculate risk level based on:
**3.7 Context Packaging & Output** **3.7 Context Packaging & Output**
**Output**: `.workflow/{session-id}/.process/context-package.json` **Output**: `.workflow/sessions//{session-id}/.process/context-package.json`
**Note**: Task JSONs reference via `context_package_path` field (not in `artifacts`) **Note**: Task JSONs reference via `context_package_path` field (not in `artifacts`)
@@ -422,7 +422,7 @@ Calculate risk level based on:
## Quality Validation ## Quality Validation
Before completion verify: Before completion verify:
- [ ] context-package.json in `.workflow/{session}/.process/` - [ ] context-package.json in `.workflow/session/{session}/.process/`
- [ ] Valid JSON with all required fields - [ ] Valid JSON with all required fields
- [ ] Metadata complete (description, keywords, complexity) - [ ] Metadata complete (description, keywords, complexity)
- [ ] Project context documented (patterns, conventions, tech stack) - [ ] Project context documented (patterns, conventions, tech stack)
@@ -456,7 +456,7 @@ Conflict Detection:
- Affected: {modules} - Affected: {modules}
- Mitigation: {strategy} - Mitigation: {strategy}
Output: .workflow/{session}/.process/context-package.json Output: .workflow/session/{session}/.process/context-package.json
(Referenced in task JSONs via top-level `context_package_path` field) (Referenced in task JSONs via top-level `context_package_path` field)
``` ```

View File

@@ -304,7 +304,7 @@ if (!validation.all_passed()) {
## Output Location ## Output Location
``` ```
.workflow/{test_session_id}/.process/test-context-package.json .workflow/sessions/{test_session_id}/.process/test-context-package.json
``` ```
## Helper Functions Reference ## Helper Functions Reference

View File

@@ -128,8 +128,8 @@ Generate a complete tech stack SKILL package with Exa research.
1. **Extract Tech Stack Information**: 1. **Extract Tech Stack Information**:
IF MODE == 'session': IF MODE == 'session':
- Read `.workflow/{SESSION_ID}/workflow-session.json` - Read `.workflow/sessions/{session_id}/workflow-session.json`
- Read `.workflow/{SESSION_ID}/.process/context-package.json` - Read `.workflow/sessions/{session_id}/.process/context-package.json`
- Extract tech_stack: {language, frameworks, libraries} - Extract tech_stack: {language, frameworks, libraries}
- Build tech stack name: \"{language}-{framework1}-{framework2}\" - Build tech stack name: \"{language}-{framework1}-{framework2}\"
- Example: \"typescript-react-nextjs\" - Example: \"typescript-react-nextjs\"

View File

@@ -92,7 +92,7 @@ Orchestrates autonomous workflow execution through systematic task discovery, ag
4. **Validate Prerequisites**: Ensure IMPL_PLAN.md and TODO_LIST.md exist and are valid 4. **Validate Prerequisites**: Ensure IMPL_PLAN.md and TODO_LIST.md exist and are valid
**Resume Mode Behavior**: **Resume Mode Behavior**:
- Load existing TODO_LIST.md directly from `.workflow/{session-id}/` - Load existing TODO_LIST.md directly from `.workflow/sessions//{session-id}/`
- Extract current progress from TODO_LIST.md - Extract current progress from TODO_LIST.md
- Generate TodoWrite from TODO_LIST.md state - Generate TodoWrite from TODO_LIST.md state
- Proceed immediately to agent execution (Phase 4) - Proceed immediately to agent execution (Phase 4)
@@ -118,7 +118,7 @@ If IMPL_PLAN.md lacks execution strategy, use intelligent fallback (analyze task
``` ```
while (TODO_LIST.md has pending tasks) { while (TODO_LIST.md has pending tasks) {
next_task_id = getTodoWriteInProgressTask() next_task_id = getTodoWriteInProgressTask()
task_json = Read(.workflow/{session}/.task/{next_task_id}.json) // Lazy load task_json = Read(.workflow/session/{session}/.task/{next_task_id}.json) // Lazy load
executeTaskWithAgent(task_json) executeTaskWithAgent(task_json)
updateTodoListMarkCompleted(next_task_id) updateTodoListMarkCompleted(next_task_id)
advanceTodoWriteToNextTask() advanceTodoWriteToNextTask()

View File

@@ -209,13 +209,13 @@ Iteration N (managed by test-cycle-execute orchestrator):
"pre_analysis": [ "pre_analysis": [
{ {
"step": "load_failure_context", "step": "load_failure_context",
"command": "Read(.workflow/{session}/.process/iteration-{N-1}-failures.json)", "command": "Read(.workflow/session/{session}/.process/iteration-{N-1}-failures.json)",
"output_to": "previous_failures", "output_to": "previous_failures",
"on_error": "skip_optional" "on_error": "skip_optional"
}, },
{ {
"step": "load_fix_strategy", "step": "load_fix_strategy",
"command": "Read(.workflow/{session}/.process/iteration-{N}-strategy.md)", "command": "Read(.workflow/session/{session}/.process/iteration-{N}-strategy.md)",
"output_to": "fix_strategy", "output_to": "fix_strategy",
"on_error": "fail" "on_error": "fail"
} }
@@ -704,7 +704,7 @@ Task(subagent_type="{meta.agent}",
#### Resume from Interruption #### Resume from Interruption
```bash ```bash
# Load iteration state # Load iteration state
iteration_state=$(cat .workflow/{session}/.process/iteration-state.json) iteration_state=$(cat .workflow/session/{session}/.process/iteration-state.json)
current_iteration=$(jq -r '.current_iteration' <<< "$iteration_state") current_iteration=$(jq -r '.current_iteration' <<< "$iteration_state")
# Determine resume point # Determine resume point
@@ -723,7 +723,7 @@ fi
git revert HEAD git revert HEAD
# Remove failed fix task # Remove failed fix task
rm .workflow/{session}/.task/IMPL-fix-{N}.json rm .workflow/session/{session}/.task/IMPL-fix-{N}.json
# Restore iteration state # Restore iteration state
jq '.current_iteration -= 1' iteration-state.json > temp.json jq '.current_iteration -= 1' iteration-state.json > temp.json

View File

@@ -10,7 +10,12 @@ examples:
# Conflict Resolution Command # Conflict Resolution Command
## Purpose ## Purpose
Analyzes conflicts between implementation plans and existing codebase, generating multiple resolution strategies. Analyzes conflicts between implementation plans and existing codebase, **including module scenario uniqueness detection**, generating multiple resolution strategies with **iterative clarification until boundaries are clear**.
**Key Enhancements**:
- **Scenario Uniqueness Detection**: Agent searches all existing modules to identify functional overlaps
- **Iterative Clarification Loop**: Unlimited questions per conflict until scenario boundaries are uniquely defined (max 10 rounds)
- **Dynamic Re-analysis**: Agent updates strategies based on user clarifications
**Scope**: Detection and strategy generation only - NO code modification or task creation. **Scope**: Detection and strategy generation only - NO code modification or task creation.
@@ -21,11 +26,14 @@ Analyzes conflicts between implementation plans and existing codebase, generatin
| Responsibility | Description | | Responsibility | Description |
|---------------|-------------| |---------------|-------------|
| **Detect Conflicts** | Analyze plan vs existing code inconsistencies | | **Detect Conflicts** | Analyze plan vs existing code inconsistencies |
| **Scenario Uniqueness** | **NEW**: Search and compare new modules with existing modules for functional overlaps |
| **Generate Strategies** | Provide 2-4 resolution options per conflict | | **Generate Strategies** | Provide 2-4 resolution options per conflict |
| **Iterative Clarification** | **NEW**: Ask unlimited questions until scenario boundaries are clear and unique |
| **Agent Re-analysis** | **NEW**: Dynamically update strategies based on user clarifications |
| **CLI Analysis** | Use Gemini/Qwen (Claude fallback) | | **CLI Analysis** | Use Gemini/Qwen (Claude fallback) |
| **User Decision** | Present options, never auto-apply | | **User Decision** | Present options ONE BY ONE, never auto-apply |
| **Direct Text Output** | Output questions via text directly, NEVER use bash echo/printf | | **Direct Text Output** | Output questions via text directly, NEVER use bash echo/printf |
| **Single Output** | `CONFLICT_RESOLUTION.md` with findings | | **Structured Data** | JSON output for programmatic processing, NO file generation |
## Conflict Categories ## Conflict Categories
@@ -49,6 +57,13 @@ Analyzes conflicts between implementation plans and existing codebase, generatin
- Setup conflicts - Setup conflicts
- Breaking updates - Breaking updates
### 5. Module Scenario Overlap
- **NEW**: Functional overlap between new and existing modules
- Scenario boundary ambiguity
- Duplicate responsibility detection
- Module merge/split decisions
- **Requires iterative clarification until uniqueness confirmed**
## Execution Flow ## Execution Flow
### Phase 1: Validation ### Phase 1: Validation
@@ -73,23 +88,31 @@ Task(subagent_type="cli-execution-agent", prompt=`
### 1. Load Context ### 1. Load Context
- Read existing files from conflict_detection.existing_files - Read existing files from conflict_detection.existing_files
- Load plan from .workflow/{session_id}/.process/context-package.json - Load plan from .workflow/sessions/{session_id}/.process/context-package.json
- Extract role analyses and requirements - Extract role analyses and requirements
### 2. Execute CLI Analysis ### 2. Execute CLI Analysis (Enhanced with Scenario Uniqueness Detection)
Primary (Gemini): Primary (Gemini):
cd {project_root} && gemini -p " cd {project_root} && gemini -p "
PURPOSE: Detect conflicts between plan and codebase PURPOSE: Detect conflicts between plan and codebase, including module scenario overlaps
TASK: TASK:
• Compare architectures • Compare architectures
• Identify breaking API changes • Identify breaking API changes
• Detect data model incompatibilities • Detect data model incompatibilities
• Assess dependency conflicts • Assess dependency conflicts
• **NEW: Analyze module scenario uniqueness**
- Extract new module functionality from plan
- Search all existing modules with similar functionality
- Compare scenario coverage and identify overlaps
- Generate clarification questions for boundary definition
MODE: analysis MODE: analysis
CONTEXT: @{existing_files} @.workflow/{session_id}/**/* CONTEXT: @**/*.ts @**/*.js @**/*.tsx @**/*.jsx @.workflow/sessions/{session_id}/**/*
EXPECTED: Conflict list with severity ratings EXPECTED: Conflict list with severity ratings, including ModuleOverlap conflicts with:
RULES: Focus on breaking changes and migration needs - Existing module list with scenarios
- Overlap analysis matrix
- Targeted clarification questions
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-analyze-code-patterns.txt) | Focus on breaking changes, migration needs, and functional overlaps | analysis=READ-ONLY
" "
Fallback: Qwen (same prompt) → Claude (manual analysis) Fallback: Qwen (same prompt) → Claude (manual analysis)
@@ -98,9 +121,11 @@ Task(subagent_type="cli-execution-agent", prompt=`
Template per conflict: Template per conflict:
- Severity: Critical/High/Medium - Severity: Critical/High/Medium
- Category: Architecture/API/Data/Dependency - Category: Architecture/API/Data/Dependency/ModuleOverlap
- Affected files + impact - Affected files + impact
- **For ModuleOverlap**: Include overlap_analysis with existing modules and scenarios
- Options with pros/cons, effort, risk - Options with pros/cons, effort, risk
- **For ModuleOverlap strategies**: Add clarification_needed questions for boundary definition
- Recommended strategy + rationale - Recommended strategy + rationale
### 4. Return Structured Conflict Data ### 4. Return Structured Conflict Data
@@ -116,10 +141,10 @@ Task(subagent_type="cli-execution-agent", prompt=`
"id": "CON-001", "id": "CON-001",
"brief": "一行中文冲突摘要", "brief": "一行中文冲突摘要",
"severity": "Critical|High|Medium", "severity": "Critical|High|Medium",
"category": "Architecture|API|Data|Dependency", "category": "Architecture|API|Data|Dependency|ModuleOverlap",
"affected_files": [ "affected_files": [
".workflow/{session}/.brainstorm/guidance-specification.md", ".workflow/sessions/{session}/.brainstorm/guidance-specification.md",
".workflow/{session}/.brainstorm/system-architect/analysis.md" ".workflow/sessions/{session}/.brainstorm/system-architect/analysis.md"
], ],
"description": "详细描述冲突 - 什么不兼容", "description": "详细描述冲突 - 什么不兼容",
"impact": { "impact": {
@@ -128,6 +153,23 @@ Task(subagent_type="cli-execution-agent", prompt=`
"migration_required": true|false, "migration_required": true|false,
"estimated_effort": "人天估计" "estimated_effort": "人天估计"
}, },
"overlap_analysis": {
"// NOTE": "仅当 category=ModuleOverlap 时需要此字段",
"new_module": {
"name": "新模块名称",
"scenarios": ["场景1", "场景2", "场景3"],
"responsibilities": "职责描述"
},
"existing_modules": [
{
"file": "src/existing/module.ts",
"name": "现有模块名称",
"scenarios": ["场景A", "场景B"],
"overlap_scenarios": ["重叠场景1", "重叠场景2"],
"responsibilities": "现有模块职责"
}
]
},
"strategies": [ "strategies": [
{ {
"name": "策略名称(中文)", "name": "策略名称(中文)",
@@ -137,9 +179,15 @@ Task(subagent_type="cli-execution-agent", prompt=`
"effort": "时间估计", "effort": "时间估计",
"pros": ["优点1", "优点2"], "pros": ["优点1", "优点2"],
"cons": ["缺点1", "缺点2"], "cons": ["缺点1", "缺点2"],
"clarification_needed": [
"// NOTE: 仅当需要用户进一步澄清时需要此字段(尤其是 ModuleOverlap",
"新模块的核心职责边界是什么?",
"如何与现有模块 X 协作?",
"哪些场景应该由新模块处理?"
],
"modifications": [ "modifications": [
{ {
"file": ".workflow/{session}/.brainstorm/guidance-specification.md", "file": ".workflow/sessions/{session}/.brainstorm/guidance-specification.md",
"section": "## 2. System Architect Decisions", "section": "## 2. System Architect Decisions",
"change_type": "update", "change_type": "update",
"old_content": "原始内容片段(用于定位)", "old_content": "原始内容片段(用于定位)",
@@ -147,7 +195,7 @@ Task(subagent_type="cli-execution-agent", prompt=`
"rationale": "为什么这样改" "rationale": "为什么这样改"
}, },
{ {
"file": ".workflow/{session}/.brainstorm/system-architect/analysis.md", "file": ".workflow/sessions/{session}/.brainstorm/system-architect/analysis.md",
"section": "## Design Decisions", "section": "## Design Decisions",
"change_type": "update", "change_type": "update",
"old_content": "原始内容片段", "old_content": "原始内容片段",
@@ -204,155 +252,251 @@ Task(subagent_type="cli-execution-agent", prompt=`
`) `)
``` ```
**Agent Internal Flow**: **Agent Internal Flow** (Enhanced):
``` ```
1. Load context package 1. Load context package
2. Check conflict_risk (exit if none/low) 2. Check conflict_risk (exit if none/low)
3. Read existing files + plan artifacts 3. Read existing files + plan artifacts
4. Run CLI analysis (Gemini→Qwen→Claude) 4. Run CLI analysis (Gemini→Qwen→Claude) with enhanced tasks:
5. Parse conflict findings - Standard conflict detection (Architecture/API/Data/Dependency)
6. Generate 2-4 strategies per conflict with modifications - **NEW: Module scenario uniqueness detection**
* Extract new module functionality from plan
* Search all existing modules with similar keywords/functionality
* Compare scenario coverage and responsibilities
* Identify functional overlaps and boundary ambiguities
* Generate ModuleOverlap conflicts with overlap_analysis
5. Parse conflict findings (including ModuleOverlap category)
6. Generate 2-4 strategies per conflict:
- Include modifications for each strategy
- **For ModuleOverlap**: Add clarification_needed questions for boundary definition
7. Return JSON to stdout (NOT file write) 7. Return JSON to stdout (NOT file write)
8. Return execution log path 8. Return execution log path
``` ```
### Phase 3: User Confirmation via Text Interaction ### Phase 3: Iterative User Interaction with Clarification Loop
**Command parses agent JSON output and presents conflicts to user via text**: **Execution Flow**:
```
FOR each conflict (逐个处理,无数量限制):
clarified = false
round = 0
userClarifications = []
WHILE (!clarified && round < 10):
round++
// 1. Display conflict (包含所有关键字段)
- category, id, brief, severity, description
- IF ModuleOverlap: 展示 overlap_analysis
* new_module: {name, scenarios, responsibilities}
* existing_modules[]: {file, name, scenarios, overlap_scenarios, responsibilities}
// 2. Display strategies (2-4个策略 + 自定义选项)
- FOR each strategy: {name, approach, complexity, risk, effort, pros, cons}
* IF clarification_needed: 展示待澄清问题列表
- 自定义选项: {suggestions: modification_suggestions[]}
// 3. User selects strategy
userChoice = readInput()
IF userChoice == "自定义":
customConflicts.push({id, brief, category, suggestions, overlap_analysis})
clarified = true
BREAK
selectedStrategy = strategies[userChoice]
// 4. Clarification loop
IF selectedStrategy.clarification_needed.length > 0:
// 收集澄清答案
FOR each question:
answer = readInput()
userClarifications.push({question, answer})
// Agent 重新分析
reanalysisResult = Task(cli-execution-agent, prompt={
冲突信息: {id, brief, category, 策略}
用户澄清: userClarifications[]
场景分析: overlap_analysis (if ModuleOverlap)
输出: {
uniqueness_confirmed: bool,
rationale: string,
updated_strategy: {name, approach, complexity, risk, effort, modifications[]},
remaining_questions: [] (如果仍有歧义)
}
})
IF reanalysisResult.uniqueness_confirmed:
selectedStrategy = updated_strategy
selectedStrategy.clarifications = userClarifications
clarified = true
ELSE:
// 更新澄清问题,继续下一轮
selectedStrategy.clarification_needed = remaining_questions
ELSE:
clarified = true
resolvedConflicts.push({conflict, strategy: selectedStrategy})
END WHILE
END FOR
// Build output
selectedStrategies = resolvedConflicts.map(r => ({
conflict_id, strategy, clarifications[]
}))
```
**Key Data Structures**:
```javascript ```javascript
// 1. Parse agent JSON output // Custom conflict tracking
const conflictData = JSON.parse(agentOutput); customConflicts[] = {
const conflicts = conflictData.conflicts; // No 4-conflict limit id, brief, category,
suggestions: modification_suggestions[],
// 2. Format conflicts as text output (max 10 per round) overlap_analysis: { new_module{}, existing_modules[] } // ModuleOverlap only
const batchSize = 10;
const batches = chunkArray(conflicts, batchSize);
for (const [batchIdx, batch] of batches.entries()) {
const totalBatches = batches.length;
// Output batch header
console.log(`===== 冲突解决 (第 ${batchIdx + 1}/${totalBatches} 轮) =====\n`);
// Output each conflict in batch
batch.forEach((conflict, idx) => {
const questionNum = batchIdx * batchSize + idx + 1;
console.log(`【问题${questionNum} - ${conflict.category}${conflict.id}: ${conflict.brief}`);
conflict.strategies.forEach((strategy, sIdx) => {
const optionLetter = String.fromCharCode(97 + sIdx); // a, b, c, ...
console.log(`${optionLetter}) ${strategy.name}`);
console.log(` 说明:${strategy.approach}`);
console.log(` 复杂度: ${strategy.complexity} | 风险: ${strategy.risk} | 工作量: ${strategy.effort}`);
});
// Add custom option
const customLetter = String.fromCharCode(97 + conflict.strategies.length);
console.log(`${customLetter}) 自定义修改`);
console.log(` 说明:根据修改建议自行处理,不应用预设策略`);
// Show modification suggestions
if (conflict.modification_suggestions && conflict.modification_suggestions.length > 0) {
console.log(` 修改建议:`);
conflict.modification_suggestions.forEach(suggestion => {
console.log(` - ${suggestion}`);
});
}
console.log();
});
console.log(`请回答 (格式: 1a 2b 3c...)`);
// Wait for user input
const userInput = await readUserInput();
// Parse answers
const answers = parseUserAnswers(userInput, batch);
} }
// 3. Build selected strategies (exclude custom selections) // Agent re-analysis prompt output
const selectedStrategies = answers.filter(a => !a.isCustom).map(a => a.strategy); {
const customConflicts = answers.filter(a => a.isCustom).map(a => ({ uniqueness_confirmed: bool,
id: a.conflict.id, rationale: string,
brief: a.conflict.brief, updated_strategy: {
suggestions: a.conflict.modification_suggestions name, approach, complexity, risk, effort,
})); modifications: [{file, section, change_type, old_content, new_content, rationale}]
},
remaining_questions: string[]
}
``` ```
**Text Output Example**: **Text Output Example** (展示关键字段):
```markdown ```markdown
===== 冲突解决 (第 1/1 轮) ===== ============================================================
冲突 1/3 - 第 1 轮
============================================================
【ModuleOverlap】CON-001: 新增用户认证服务与现有模块功能重叠
严重程度: High | 描述: 计划中的 UserAuthService 与现有 AuthManager 场景重叠
【问题1 - Architecture】CON-001: 现有认证系统与计划不兼容 --- 场景重叠分析 ---
a) 渐进式迁移 新模块: UserAuthService | 场景: 登录, Token验证, 权限, MFA
说明:保留现有系统,逐步迁移到新方案 现有模块: AuthManager (src/auth/AuthManager.ts) | 重叠: 登录, Token验证
复杂度: Medium | 风险: Low | 工作量: 3-5天
b) 完全重写
说明:废弃旧系统,从零实现新认证
复杂度: High | 风险: Medium | 工作量: 7-10天
c) 自定义修改
说明:根据修改建议自行处理,不应用预设策略
修改建议:
- 评估现有认证系统的兼容性,考虑是否可以通过适配器模式桥接
- 检查JWT token格式和验证逻辑是否需要调整
- 确保用户会话管理与新架构保持一致
【问题2 - Data】CON-002: 数据库 schema 冲突 --- 解决策略 ---
a) 添加迁移脚本 1) 合并 (Low复杂度 | Low风险 | 2-3天)
说明:创建数据库迁移脚本处理 schema 变更 ⚠️ 需澄清: AuthManager是否能承担MFA
复杂度: Low | 风险: Low | 工作量: 1-2天
b) 自定义修改
说明:根据修改建议自行处理,不应用预设策略
修改建议:
- 检查现有表结构是否支持新增字段,避免破坏性变更
- 考虑使用数据库版本控制工具如Flyway或Liquibase
- 准备数据迁移和回滚策略
请回答 (格式: 1a 2b) 2) 拆分边界 (Medium复杂度 | Medium风险 | 4-5天)
⚠️ 需澄清: 基础/高级认证边界? Token验证归谁?
3) 自定义修改
建议: 评估扩展性; 策略模式分离; 定义接口边界
请选择 (1-3): > 2
--- 澄清问答 (第1轮) ---
Q: 基础/高级认证边界?
A: 基础=密码登录+token验证, 高级=MFA+OAuth+SSO
Q: Token验证归谁?
A: 统一由 AuthManager 负责
🔄 重新分析...
✅ 唯一性已确认 | 理由: 边界清晰 - AuthManager(基础+token), UserAuthService(MFA+OAuth+SSO)
============================================================
冲突 2/3 - 第 1 轮 [下一个冲突]
============================================================
``` ```
**User Input Examples**: **Loop Characteristics**: 逐个处理 | 无限轮次(max 10) | 动态问题生成 | Agent重新分析判断唯一性 | ModuleOverlap场景边界澄清
- `1a 2a` → Conflict 1: 渐进式迁移, Conflict 2: 添加迁移脚本
- `1b 2b` → Conflict 1: 完全重写, Conflict 2: 自定义修改
- `1c 2c` → Both choose custom modification (user handles manually with suggestions)
### Phase 4: Apply Modifications ### Phase 4: Apply Modifications
```javascript ```javascript
// 1. Extract modifications from selected strategies // 1. Extract modifications from resolved strategies
const modifications = []; const modifications = [];
selectedStrategies.forEach(strategy => { selectedStrategies.forEach(item => {
if (strategy !== "skip") { if (item.strategy && item.strategy.modifications) {
modifications.push(...strategy.modifications); modifications.push(...item.strategy.modifications.map(mod => ({
...mod,
conflict_id: item.conflict_id,
clarifications: item.clarifications
})));
} }
}); });
console.log(`\n正在应用 ${modifications.length} 个修改...`);
// 2. Apply each modification using Edit tool // 2. Apply each modification using Edit tool
modifications.forEach(mod => { const appliedModifications = [];
if (mod.change_type === "update") { const failedModifications = [];
Edit({
file_path: mod.file, modifications.forEach((mod, idx) => {
old_string: mod.old_content, try {
new_string: mod.new_content console.log(`[${idx + 1}/${modifications.length}] 修改 ${mod.file}...`);
});
if (mod.change_type === "update") {
Edit({
file_path: mod.file,
old_string: mod.old_content,
new_string: mod.new_content
});
} else if (mod.change_type === "add") {
// Handle addition - append or insert based on section
const fileContent = Read(mod.file);
const updated = insertContentAfterSection(fileContent, mod.section, mod.new_content);
Write(mod.file, updated);
} else if (mod.change_type === "remove") {
Edit({
file_path: mod.file,
old_string: mod.old_content,
new_string: ""
});
}
appliedModifications.push(mod);
console.log(` ✓ 成功`);
} catch (error) {
console.log(` ✗ 失败: ${error.message}`);
failedModifications.push({ ...mod, error: error.message });
} }
// Handle "add" and "remove" similarly
}); });
// 3. Update context-package.json // 3. Update context-package.json with resolution details
const contextPackage = JSON.parse(Read(contextPath)); const contextPackage = JSON.parse(Read(contextPath));
contextPackage.conflict_detection.conflict_risk = "resolved"; contextPackage.conflict_detection.conflict_risk = "resolved";
contextPackage.conflict_detection.resolved_conflicts = conflicts.map(c => c.id); contextPackage.conflict_detection.resolved_conflicts = selectedStrategies.map(s => ({
conflict_id: s.conflict_id,
strategy_name: s.strategy.name,
clarifications: s.clarifications
}));
contextPackage.conflict_detection.custom_conflicts = customConflicts.map(c => c.id);
contextPackage.conflict_detection.resolved_at = new Date().toISOString(); contextPackage.conflict_detection.resolved_at = new Date().toISOString();
Write(contextPath, JSON.stringify(contextPackage, null, 2)); Write(contextPath, JSON.stringify(contextPackage, null, 2));
// 4. Output custom conflict summary (if any) // 4. Output custom conflict summary with overlap analysis (if any)
if (customConflicts.length > 0) { if (customConflicts.length > 0) {
console.log("\n===== 需要自定义处理的冲突 =====\n"); console.log(`\n${'='.repeat(60)}`);
console.log(`需要自定义处理的冲突 (${customConflicts.length})`);
console.log(`${'='.repeat(60)}\n`);
customConflicts.forEach(conflict => { customConflicts.forEach(conflict => {
console.log(`${conflict.id}${conflict.brief}`); console.log(`${conflict.category}${conflict.id}: ${conflict.brief}`);
console.log("修改建议:");
// Show overlap analysis for ModuleOverlap conflicts
if (conflict.category === 'ModuleOverlap' && conflict.overlap_analysis) {
console.log(`\n场景重叠信息:`);
console.log(` 新模块: ${conflict.overlap_analysis.new_module.name}`);
console.log(` 场景: ${conflict.overlap_analysis.new_module.scenarios.join(', ')}`);
console.log(`\n 与以下模块重叠:`);
conflict.overlap_analysis.existing_modules.forEach(mod => {
console.log(` - ${mod.name} (${mod.file})`);
console.log(` 重叠场景: ${mod.overlap_scenarios.join(', ')}`);
});
}
console.log(`\n修改建议:`);
conflict.suggestions.forEach(suggestion => { conflict.suggestions.forEach(suggestion => {
console.log(` - ${suggestion}`); console.log(` - ${suggestion}`);
}); });
@@ -360,25 +504,43 @@ if (customConflicts.length > 0) {
}); });
} }
// 5. Return summary // 5. Output failure summary (if any)
if (failedModifications.length > 0) {
console.log(`\n⚠️ 部分修改失败 (${failedModifications.length}):`);
failedModifications.forEach(mod => {
console.log(` - ${mod.file}: ${mod.error}`);
});
}
// 6. Return summary
return { return {
resolved: modifications.length, total_conflicts: conflicts.length,
custom: customConflicts.length, resolved_with_strategy: selectedStrategies.length,
modified_files: [...new Set(modifications.map(m => m.file))], custom_handling: customConflicts.length,
custom_conflicts: customConflicts modifications_applied: appliedModifications.length,
modifications_failed: failedModifications.length,
modified_files: [...new Set(appliedModifications.map(m => m.file))],
custom_conflicts: customConflicts,
clarification_records: selectedStrategies.filter(s => s.clarifications.length > 0)
}; };
``` ```
**Validation**: **Validation**:
``` ```
✓ Agent returns valid JSON structure ✓ Agent returns valid JSON structure with ModuleOverlap conflicts
Text output displays all conflicts (max 10 per round) Conflicts processed ONE BY ONE (not in batches)
User selections captured correctly ModuleOverlap conflicts include overlap_analysis field
✓ Strategies with clarification_needed display questions
✓ User selections captured correctly per conflict
✓ Clarification loop continues until uniqueness confirmed
✓ Agent re-analysis returns uniqueness_confirmed and updated_strategy
✓ Maximum 10 rounds per conflict safety limit enforced
✓ Edit tool successfully applies modifications ✓ Edit tool successfully applies modifications
✓ guidance-specification.md updated ✓ guidance-specification.md updated
✓ Role analyses (*.md) updated ✓ Role analyses (*.md) updated
✓ context-package.json marked as resolved ✓ context-package.json marked as resolved with clarification records
Agent log saved to .workflow/{session_id}/.chat/ Custom conflicts display overlap_analysis for manual handling
✓ Agent log saved to .workflow/sessions/{session_id}/.chat/
``` ```
## Output Format: Agent JSON Response ## Output Format: Agent JSON Response
@@ -435,31 +597,45 @@ If Edit tool fails mid-application:
**Output**: **Output**:
- Modified files: - Modified files:
- `.workflow/{session_id}/.brainstorm/guidance-specification.md` - `.workflow/sessions/{session_id}/.brainstorm/guidance-specification.md`
- `.workflow/{session_id}/.brainstorm/{role}/analysis.md` - `.workflow/sessions/{session_id}/.brainstorm/{role}/analysis.md`
- `.workflow/{session_id}/.process/context-package.json` (conflict_risk → resolved) - `.workflow/sessions/{session_id}/.process/context-package.json` (conflict_risk → resolved)
- NO report file generation - NO report file generation
**User Interaction**: **User Interaction**:
- Text-based strategy selection (max 10 conflicts per round) - **Iterative conflict processing**: One conflict at a time, not in batches
- Each conflict: 2-4 strategy options + "自定义修改" option (with suggestions) - Each conflict: 2-4 strategy options + "自定义修改" option (with suggestions)
- **Clarification loop**: Unlimited questions per conflict until uniqueness confirmed (max 10 rounds)
- **ModuleOverlap conflicts**: Display overlap_analysis with existing modules
- **Agent re-analysis**: Dynamic strategy updates based on user clarifications
### Success Criteria ### Success Criteria
``` ```
✓ CLI analysis returns valid JSON structure ✓ CLI analysis returns valid JSON structure with ModuleOverlap category
Conflicts presented in batches (max 10 per round) Agent performs scenario uniqueness detection (searches existing modules)
✓ Conflicts processed ONE BY ONE with iterative clarification
✓ Min 2 strategies per conflict with modifications ✓ Min 2 strategies per conflict with modifications
✓ ModuleOverlap conflicts include overlap_analysis with existing modules
✓ Strategies requiring clarification include clarification_needed questions
✓ Each conflict includes 2-5 modification_suggestions ✓ Each conflict includes 2-5 modification_suggestions
✓ Text output displays all conflicts correctly with suggestions ✓ Text output displays conflict with overlap analysis (if ModuleOverlap)
✓ User selections captured and processed ✓ User selections captured per conflict
✓ Clarification loop continues until uniqueness confirmed (unlimited rounds, max 10)
✓ Agent re-analysis with user clarifications updates strategy
✓ Uniqueness confirmation based on clear scenario boundaries
✓ Edit tool applies modifications successfully ✓ Edit tool applies modifications successfully
✓ Custom conflicts displayed with suggestions for manual handling ✓ Custom conflicts displayed with overlap_analysis for manual handling
✓ guidance-specification.md updated with resolved conflicts ✓ guidance-specification.md updated with resolved conflicts
✓ Role analyses (*.md) updated with resolved conflicts ✓ Role analyses (*.md) updated with resolved conflicts
✓ context-package.json marked as "resolved" ✓ context-package.json marked as "resolved" with clarification records
✓ No CONFLICT_RESOLUTION.md file generated ✓ No CONFLICT_RESOLUTION.md file generated
✓ Modification summary includes custom conflict count ✓ Modification summary includes:
✓ Agent log saved to .workflow/{session_id}/.chat/ - Total conflicts
- Resolved with strategy (count)
- Custom handling (count)
- Clarification records
- Overlap analysis for custom ModuleOverlap conflicts
✓ Agent log saved to .workflow/sessions/{session_id}/.chat/
✓ Error handling robust (validate/retry/degrade) ✓ Error handling robust (validate/retry/degrade)
``` ```

View File

@@ -22,7 +22,7 @@ Orchestrator command that invokes `context-search-agent` to gather comprehensive
- **Agent Delegation**: Delegate all discovery to `context-search-agent` for autonomous execution - **Agent Delegation**: Delegate all discovery to `context-search-agent` for autonomous execution
- **Detection-First**: Check for existing context-package before executing - **Detection-First**: Check for existing context-package before executing
- **Plan Mode**: Full comprehensive analysis (vs lightweight brainstorm mode) - **Plan Mode**: Full comprehensive analysis (vs lightweight brainstorm mode)
- **Standardized Output**: Generate `.workflow/{session}/.process/context-package.json` - **Standardized Output**: Generate `.workflow/sessions/{session}/.process/context-package.json`
## Execution Flow ## Execution Flow

View File

@@ -36,7 +36,7 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
// Path selected by command based on --cli-execute flag, agent reads it // Path selected by command based on --cli-execute flag, agent reads it
"session_metadata": { "session_metadata": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/workflow-session.json // Else: Load from .workflow/sessions//{session-id}/workflow-session.json
}, },
"brainstorm_artifacts": { "brainstorm_artifacts": {
// Loaded from context-package.json → brainstorm_artifacts section // Loaded from context-package.json → brainstorm_artifacts section
@@ -50,10 +50,10 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
"synthesis_output": {"path": "...", "exists": true}, "synthesis_output": {"path": "...", "exists": true},
"conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium "conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium
}, },
"context_package_path": ".workflow/{session-id}/.process/context-package.json", "context_package_path": ".workflow/sessions//{session-id}/.process/context-package.json",
"context_package": { "context_package": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/.process/context-package.json // Else: Load from .workflow/sessions//{session-id}/.process/context-package.json
}, },
"mcp_capabilities": { "mcp_capabilities": {
"code_index": true, "code_index": true,
@@ -67,14 +67,14 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
1. **Load Session Context** (if not in memory) 1. **Load Session Context** (if not in memory)
```javascript ```javascript
if (!memory.has("workflow-session.json")) { if (!memory.has("workflow-session.json")) {
Read(.workflow/{session-id}/workflow-session.json) Read(.workflow/sessions//{session-id}/workflow-session.json)
} }
``` ```
2. **Load Context Package** (if not in memory) 2. **Load Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("context-package.json")) { if (!memory.has("context-package.json")) {
Read(.workflow/{session-id}/.process/context-package.json) Read(.workflow/sessions//{session-id}/.process/context-package.json)
} }
``` ```
@@ -176,18 +176,18 @@ Refer to: @.claude/agents/action-planning-agent.md for:
### Required Outputs Summary ### Required Outputs Summary
#### 1. Task JSON Files (.task/IMPL-*.json) #### 1. Task JSON Files (.task/IMPL-*.json)
- **Location**: `.workflow/{session-id}/.task/` - **Location**: `.workflow/sessions//{session-id}/.task/`
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag) - **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
- **Schema**: 5-field structure (id, title, status, meta, context, flow_control) with artifacts integration - **Schema**: 5-field structure (id, title, status, meta, context, flow_control) with artifacts integration
- **Details**: See action-planning-agent.md § Task JSON Generation - **Details**: See action-planning-agent.md § Task JSON Generation
#### 2. IMPL_PLAN.md #### 2. IMPL_PLAN.md
- **Location**: `.workflow/{session-id}/IMPL_PLAN.md` - **Location**: `.workflow/sessions//{session-id}/IMPL_PLAN.md`
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt` - **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
- **Details**: See action-planning-agent.md § Implementation Plan Creation - **Details**: See action-planning-agent.md § Implementation Plan Creation
#### 3. TODO_LIST.md #### 3. TODO_LIST.md
- **Location**: `.workflow/{session-id}/TODO_LIST.md` - **Location**: `.workflow/sessions//{session-id}/TODO_LIST.md`
- **Format**: Hierarchical task list with status indicators (▸, [ ], [x]) and JSON links - **Format**: Hierarchical task list with status indicators (▸, [ ], [x]) and JSON links
- **Details**: See action-planning-agent.md § TODO List Generation - **Details**: See action-planning-agent.md § TODO List Generation

View File

@@ -74,7 +74,7 @@ Autonomous TDD task JSON and IMPL_PLAN.md generation using action-planning-agent
"workflow_type": "tdd", "workflow_type": "tdd",
"session_metadata": { "session_metadata": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/workflow-session.json // Else: Load from .workflow/sessions//{session-id}/workflow-session.json
}, },
"brainstorm_artifacts": { "brainstorm_artifacts": {
// Loaded from context-package.json → brainstorm_artifacts section // Loaded from context-package.json → brainstorm_artifacts section
@@ -88,12 +88,12 @@ Autonomous TDD task JSON and IMPL_PLAN.md generation using action-planning-agent
"synthesis_output": {"path": "...", "exists": true}, "synthesis_output": {"path": "...", "exists": true},
"conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium "conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium
}, },
"context_package_path": ".workflow/{session-id}/.process/context-package.json", "context_package_path": ".workflow/sessions//{session-id}/.process/context-package.json",
"context_package": { "context_package": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/.process/context-package.json // Else: Load from .workflow/sessions//{session-id}/.process/context-package.json
}, },
"test_context_package_path": ".workflow/{session-id}/.process/test-context-package.json", "test_context_package_path": ".workflow/sessions//{session-id}/.process/test-context-package.json",
"test_context_package": { "test_context_package": {
// Existing test patterns and coverage analysis // Existing test patterns and coverage analysis
}, },
@@ -109,21 +109,21 @@ Autonomous TDD task JSON and IMPL_PLAN.md generation using action-planning-agent
1. **Load Session Context** (if not in memory) 1. **Load Session Context** (if not in memory)
```javascript ```javascript
if (!memory.has("workflow-session.json")) { if (!memory.has("workflow-session.json")) {
Read(.workflow/{session-id}/workflow-session.json) Read(.workflow/sessions//{session-id}/workflow-session.json)
} }
``` ```
2. **Load Context Package** (if not in memory) 2. **Load Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("context-package.json")) { if (!memory.has("context-package.json")) {
Read(.workflow/{session-id}/.process/context-package.json) Read(.workflow/sessions//{session-id}/.process/context-package.json)
} }
``` ```
3. **Load Test Context Package** (if not in memory) 3. **Load Test Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("test-context-package.json")) { if (!memory.has("test-context-package.json")) {
Read(.workflow/{session-id}/.process/test-context-package.json) Read(.workflow/sessions//{session-id}/.process/test-context-package.json)
} }
``` ```
@@ -245,7 +245,7 @@ Refer to: @.claude/agents/action-planning-agent.md for:
#### Required Outputs Summary #### Required Outputs Summary
##### 1. TDD Task JSON Files (.task/IMPL-*.json) ##### 1. TDD Task JSON Files (.task/IMPL-*.json)
- **Location**: `.workflow/{session-id}/.task/` - **Location**: `.workflow/sessions//{session-id}/.task/`
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag) - **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
- **Schema**: 5-field structure with TDD-specific metadata - **Schema**: 5-field structure with TDD-specific metadata
- `meta.tdd_workflow`: true (REQUIRED) - `meta.tdd_workflow`: true (REQUIRED)
@@ -259,14 +259,14 @@ Refer to: @.claude/agents/action-planning-agent.md for:
- **Details**: See action-planning-agent.md § TDD Task JSON Generation - **Details**: See action-planning-agent.md § TDD Task JSON Generation
##### 2. IMPL_PLAN.md (TDD Variant) ##### 2. IMPL_PLAN.md (TDD Variant)
- **Location**: `.workflow/{session-id}/IMPL_PLAN.md` - **Location**: `.workflow/sessions//{session-id}/IMPL_PLAN.md`
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt` - **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
- **TDD-Specific Frontmatter**: workflow_type="tdd", tdd_workflow=true, feature_count, task_breakdown - **TDD-Specific Frontmatter**: workflow_type="tdd", tdd_workflow=true, feature_count, task_breakdown
- **TDD Implementation Tasks Section**: Feature-by-feature with internal Red-Green-Refactor cycles - **TDD Implementation Tasks Section**: Feature-by-feature with internal Red-Green-Refactor cycles
- **Details**: See action-planning-agent.md § TDD Implementation Plan Creation - **Details**: See action-planning-agent.md § TDD Implementation Plan Creation
##### 3. TODO_LIST.md ##### 3. TODO_LIST.md
- **Location**: `.workflow/{session-id}/TODO_LIST.md` - **Location**: `.workflow/sessions//{session-id}/TODO_LIST.md`
- **Format**: Hierarchical task list with internal TDD phase indicators (Red → Green → Refactor) - **Format**: Hierarchical task list with internal TDD phase indicators (Red → Green → Refactor)
- **Status**: ▸ (container), [ ] (pending), [x] (completed) - **Status**: ▸ (container), [ ] (pending), [x] (completed)
- **Details**: See action-planning-agent.md § TODO List Generation - **Details**: See action-planning-agent.md § TODO List Generation
@@ -384,7 +384,7 @@ This section provides quick reference for TDD task JSON structure. For complete
## Output Files Structure ## Output Files Structure
``` ```
.workflow/{session-id}/ .workflow/sessions//{session-id}/
├── IMPL_PLAN.md # Unified plan with TDD Implementation Tasks section ├── IMPL_PLAN.md # Unified plan with TDD Implementation Tasks section
├── TODO_LIST.md # Progress tracking with internal TDD phase indicators ├── TODO_LIST.md # Progress tracking with internal TDD phase indicators
├── .task/ ├── .task/

View File

@@ -77,8 +77,8 @@ The command follows a streamlined, three-step process to convert analysis into e
### Step 1: Input & Discovery ### Step 1: Input & Discovery
The process begins by gathering all necessary inputs. It follows a **Memory-First Rule**, skipping file reads if documents are already in the conversation memory. The process begins by gathering all necessary inputs. It follows a **Memory-First Rule**, skipping file reads if documents are already in the conversation memory.
1. **Session Validation**: Loads and validates the session from `.workflow/{session_id}/workflow-session.json`. 1. **Session Validation**: Loads and validates the session from `.workflow/sessions/{session_id}/workflow-session.json`.
2. **Context Package Loading** (primary source): Reads `.workflow/{session_id}/.process/context-package.json` for smart context and artifact catalog. 2. **Context Package Loading** (primary source): Reads `.workflow/sessions/{session_id}/.process/context-package.json` for smart context and artifact catalog.
3. **Brainstorm Artifacts Extraction**: Extracts role analysis paths from `context-package.json``brainstorm_artifacts.role_analyses[]` (supports `analysis*.md` automatically). 3. **Brainstorm Artifacts Extraction**: Extracts role analysis paths from `context-package.json``brainstorm_artifacts.role_analyses[]` (supports `analysis*.md` automatically).
4. **Document Loading**: Reads role analyses, guidance specification, synthesis output, and conflict resolution (if exists) using paths from context package. 4. **Document Loading**: Reads role analyses, guidance specification, synthesis output, and conflict resolution (if exists) using paths from context package.
@@ -353,10 +353,10 @@ This document provides a high-level overview of the entire implementation plan.
--- ---
identifier: WFS-{session-id} identifier: WFS-{session-id}
source: "User requirements" | "File: path" | "Issue: ISS-001" source: "User requirements" | "File: path" | "Issue: ISS-001"
role_analyses: .workflow/{session-id}/.brainstorming/[role]/analysis*.md role_analyses: .workflow/sessions//{session-id}/.brainstorming/[role]/analysis*.md
artifacts: .workflow/{session-id}/.brainstorming/ artifacts: .workflow/sessions//{session-id}/.brainstorming/
context_package: .workflow/{session-id}/.process/context-package.json # CCW smart context context_package: .workflow/sessions//{session-id}/.process/context-package.json # CCW smart context
guidance_specification: .workflow/{session-id}/.brainstorming/guidance-specification.md # Finalized decisions with resolved conflicts guidance_specification: .workflow/sessions//{session-id}/.brainstorming/guidance-specification.md # Finalized decisions with resolved conflicts
workflow_type: "standard | tdd | design" # Indicates execution model workflow_type: "standard | tdd | design" # Indicates execution model
verification_history: # CCW quality gates verification_history: # CCW quality gates
synthesis_clarify: "passed | skipped | pending" # Brainstorm phase clarification synthesis_clarify: "passed | skipped | pending" # Brainstorm phase clarification
@@ -606,7 +606,7 @@ A simple Markdown file for tracking the status of each task.
### 6.4. Output Files Diagram ### 6.4. Output Files Diagram
The command organizes outputs into a standard directory structure. The command organizes outputs into a standard directory structure.
``` ```
.workflow/{session-id}/ .workflow/sessions//{session-id}/
├── IMPL_PLAN.md # Implementation plan ├── IMPL_PLAN.md # Implementation plan
├── TODO_LIST.md # Progress tracking ├── TODO_LIST.md # Progress tracking
├── .task/ ├── .task/

View File

@@ -21,7 +21,7 @@ Analyze test coverage and verify Red-Green-Refactor cycle execution for TDD work
### Phase 1: Extract Test Tasks ### Phase 1: Extract Test Tasks
```bash ```bash
find .workflow/{session_id}/.task/ -name 'TEST-*.json' -exec jq -r '.context.focus_paths[]' {} \; find .workflow/sessions/{session_id}/.task/ -name 'TEST-*.json' -exec jq -r '.context.focus_paths[]' {} \;
``` ```
**Output**: List of test directories/files from all TEST tasks **Output**: List of test directories/files from all TEST tasks
@@ -29,20 +29,20 @@ find .workflow/{session_id}/.task/ -name 'TEST-*.json' -exec jq -r '.context.foc
### Phase 2: Run Test Suite ### Phase 2: Run Test Suite
```bash ```bash
# Node.js/JavaScript # Node.js/JavaScript
npm test -- --coverage --json > .workflow/{session_id}/.process/test-results.json npm test -- --coverage --json > .workflow/sessions/{session_id}/.process/test-results.json
# Python # Python
pytest --cov --json-report > .workflow/{session_id}/.process/test-results.json pytest --cov --json-report > .workflow/sessions/{session_id}/.process/test-results.json
# Other frameworks (detect from project) # Other frameworks (detect from project)
[test_command] --coverage --json-output .workflow/{session_id}/.process/test-results.json [test_command] --coverage --json-output .workflow/sessions/{session_id}/.process/test-results.json
``` ```
**Output**: test-results.json with coverage data **Output**: test-results.json with coverage data
### Phase 3: Parse Coverage Data ### Phase 3: Parse Coverage Data
```bash ```bash
jq '.coverage' .workflow/{session_id}/.process/test-results.json > .workflow/{session_id}/.process/coverage-report.json jq '.coverage' .workflow/sessions/{session_id}/.process/test-results.json > .workflow/sessions/{session_id}/.process/coverage-report.json
``` ```
**Extract**: **Extract**:
@@ -58,7 +58,7 @@ For each TDD chain (TEST-N.M -> IMPL-N.M -> REFACTOR-N.M):
**1. Red Phase Verification** **1. Red Phase Verification**
```bash ```bash
# Check TEST task summary # Check TEST task summary
cat .workflow/{session_id}/.summaries/TEST-N.M-summary.md cat .workflow/sessions/{session_id}/.summaries/TEST-N.M-summary.md
``` ```
Verify: Verify:
@@ -69,7 +69,7 @@ Verify:
**2. Green Phase Verification** **2. Green Phase Verification**
```bash ```bash
# Check IMPL task summary # Check IMPL task summary
cat .workflow/{session_id}/.summaries/IMPL-N.M-summary.md cat .workflow/sessions/{session_id}/.summaries/IMPL-N.M-summary.md
``` ```
Verify: Verify:
@@ -80,7 +80,7 @@ Verify:
**3. Refactor Phase Verification** **3. Refactor Phase Verification**
```bash ```bash
# Check REFACTOR task summary # Check REFACTOR task summary
cat .workflow/{session_id}/.summaries/REFACTOR-N.M-summary.md cat .workflow/sessions/{session_id}/.summaries/REFACTOR-N.M-summary.md
``` ```
Verify: Verify:
@@ -90,7 +90,7 @@ Verify:
### Phase 5: Generate Analysis Report ### Phase 5: Generate Analysis Report
Create `.workflow/{session_id}/.process/tdd-cycle-report.md`: Create `.workflow/sessions/{session_id}/.process/tdd-cycle-report.md`:
```markdown ```markdown
# TDD Cycle Analysis - {Session ID} # TDD Cycle Analysis - {Session ID}
@@ -146,7 +146,7 @@ Create `.workflow/{session_id}/.process/tdd-cycle-report.md`:
## Output Files ## Output Files
``` ```
.workflow/{session-id}/ .workflow/sessions//{session-id}/
└── .process/ └── .process/
├── test-results.json # Raw test execution results ├── test-results.json # Raw test execution results
├── coverage-report.json # Parsed coverage data ├── coverage-report.json # Parsed coverage data

View File

@@ -30,7 +30,7 @@ Specialized analysis tool for test generation workflows that uses Gemini to anal
### Phase 1: Validation & Preparation ### Phase 1: Validation & Preparation
1. **Session Validation** 1. **Session Validation**
- Load `.workflow/{test_session_id}/workflow-session.json` - Load `.workflow/sessions/{test_session_id}/workflow-session.json`
- Verify test session type is "test-gen" - Verify test session type is "test-gen"
- Extract source session reference - Extract source session reference
@@ -48,11 +48,11 @@ Specialized analysis tool for test generation workflows that uses Gemini to anal
**Tool Configuration**: **Tool Configuration**:
```bash ```bash
cd .workflow/{test_session_id}/.process && gemini -p " cd .workflow/sessions/{test_session_id}/.process && gemini -p "
PURPOSE: Analyze test coverage gaps and design comprehensive test generation strategy PURPOSE: Analyze test coverage gaps and design comprehensive test generation strategy
TASK: Study implementation context, existing tests, and generate test requirements for missing coverage TASK: Study implementation context, existing tests, and generate test requirements for missing coverage
MODE: analysis MODE: analysis
CONTEXT: @{.workflow/{test_session_id}/.process/test-context-package.json} CONTEXT: @{.workflow/sessions/{test_session_id}/.process/test-context-package.json}
**MANDATORY FIRST STEP**: Read and analyze test-context-package.json to understand: **MANDATORY FIRST STEP**: Read and analyze test-context-package.json to understand:
- Test coverage gaps from test_coverage.missing_tests[] - Test coverage gaps from test_coverage.missing_tests[]
@@ -226,13 +226,13 @@ RULES:
- Prioritize critical business logic tests - Prioritize critical business logic tests
- Specify clear test scenarios and coverage targets - Specify clear test scenarios and coverage targets
- Identify all dependencies requiring mocks - Identify all dependencies requiring mocks
- **MUST write output to .workflow/{test_session_id}/.process/gemini-test-analysis.md** - **MUST write output to .workflow/sessions/{test_session_id}/.process/gemini-test-analysis.md**
- Do NOT generate actual test code or implementation - Do NOT generate actual test code or implementation
- Output ONLY test analysis and generation strategy - Output ONLY test analysis and generation strategy
" --approval-mode yolo " --approval-mode yolo
``` ```
**Output Location**: `.workflow/{test_session_id}/.process/gemini-test-analysis.md` **Output Location**: `.workflow/sessions/{test_session_id}/.process/gemini-test-analysis.md`
### Phase 3: Results Synthesis ### Phase 3: Results Synthesis
@@ -408,7 +408,7 @@ Synthesize Gemini analysis into standardized format:
- **Coverage Tools**: {coverage_tool_if_detected} - **Coverage Tools**: {coverage_tool_if_detected}
``` ```
**Output Location**: `.workflow/{test_session_id}/.process/TEST_ANALYSIS_RESULTS.md` **Output Location**: `.workflow/sessions/{test_session_id}/.process/TEST_ANALYSIS_RESULTS.md`
## Error Handling ## Error Handling

View File

@@ -22,7 +22,7 @@ Orchestrator command that invokes `test-context-search-agent` to gather comprehe
- **Detection-First**: Check for existing test-context-package before executing - **Detection-First**: Check for existing test-context-package before executing
- **Coverage-First**: Analyze existing test coverage before planning new tests - **Coverage-First**: Analyze existing test coverage before planning new tests
- **Source Context Loading**: Import implementation summaries from source session - **Source Context Loading**: Import implementation summaries from source session
- **Standardized Output**: Generate `.workflow/{test_session_id}/.process/test-context-package.json` - **Standardized Output**: Generate `.workflow/sessions/{test_session_id}/.process/test-context-package.json`
## Execution Flow ## Execution Flow
@@ -164,7 +164,7 @@ Refer to `test-context-search-agent.md` Phase 3.2 for complete `test-context-pac
## Success Criteria ## Success Criteria
- ✅ Valid test-context-package.json generated in `.workflow/{test_session_id}/.process/` - ✅ Valid test-context-package.json generated in `.workflow/sessions/{test_session_id}/.process/`
- ✅ Source session context loaded successfully - ✅ Source session context loaded successfully
- ✅ Test coverage gaps identified (>90% accuracy) - ✅ Test coverage gaps identified (>90% accuracy)
- ✅ Test framework detected and documented - ✅ Test framework detected and documented

View File

@@ -54,14 +54,14 @@ Autonomous test-fix task JSON generation using action-planning-agent with two-ph
"use_codex": true | false, // Determined by --use-codex flag "use_codex": true | false, // Determined by --use-codex flag
"session_metadata": { "session_metadata": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{test-session-id}/workflow-session.json // Else: Load from .workflow/sessions/{test-session-id}/workflow-session.json
}, },
"test_analysis_results_path": ".workflow/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md", "test_analysis_results_path": ".workflow/sessions/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md",
"test_analysis_results": { "test_analysis_results": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from TEST_ANALYSIS_RESULTS.md // Else: Load from TEST_ANALYSIS_RESULTS.md
}, },
"test_context_package_path": ".workflow/{test-session-id}/.process/test-context-package.json", "test_context_package_path": ".workflow/sessions/{test-session-id}/.process/test-context-package.json",
"test_context_package": { "test_context_package": {
// Existing test patterns and coverage analysis // Existing test patterns and coverage analysis
}, },
@@ -81,28 +81,28 @@ Autonomous test-fix task JSON generation using action-planning-agent with two-ph
1. **Load Test Session Context** (if not in memory) 1. **Load Test Session Context** (if not in memory)
```javascript ```javascript
if (!memory.has("workflow-session.json")) { if (!memory.has("workflow-session.json")) {
Read(.workflow/{test-session-id}/workflow-session.json) Read(.workflow/sessions/{test-session-id}/workflow-session.json)
} }
``` ```
2. **Load TEST_ANALYSIS_RESULTS.md** (if not in memory, REQUIRED) 2. **Load TEST_ANALYSIS_RESULTS.md** (if not in memory, REQUIRED)
```javascript ```javascript
if (!memory.has("TEST_ANALYSIS_RESULTS.md")) { if (!memory.has("TEST_ANALYSIS_RESULTS.md")) {
Read(.workflow/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md) Read(.workflow/sessions/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md)
} }
``` ```
3. **Load Test Context Package** (if not in memory) 3. **Load Test Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("test-context-package.json")) { if (!memory.has("test-context-package.json")) {
Read(.workflow/{test-session-id}/.process/test-context-package.json) Read(.workflow/sessions/{test-session-id}/.process/test-context-package.json)
} }
``` ```
4. **Load Source Session Summaries** (if source_session_id exists) 4. **Load Source Session Summaries** (if source_session_id exists)
```javascript ```javascript
if (sessionMetadata.source_session_id) { if (sessionMetadata.source_session_id) {
const summaryFiles = Bash("find .workflow/{source-session-id}/.summaries/ -name 'IMPL-*-summary.md'") const summaryFiles = Bash("find .workflow/sessions/{source-session-id}/.summaries/ -name 'IMPL-*-summary.md'")
summaryFiles.forEach(file => Read(file)) summaryFiles.forEach(file => Read(file))
} }
``` ```
@@ -205,7 +205,7 @@ Refer to: @.claude/agents/action-planning-agent.md for:
#### Required Outputs Summary #### Required Outputs Summary
##### 1. Test Task JSON Files (.task/IMPL-*.json) ##### 1. Test Task JSON Files (.task/IMPL-*.json)
- **Location**: `.workflow/{test-session-id}/.task/` - **Location**: `.workflow/sessions/{test-session-id}/.task/`
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag) - **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
- **Schema**: 5-field structure with test-specific metadata - **Schema**: 5-field structure with test-specific metadata
- IMPL-001: `meta.type: "test-gen"`, `meta.agent: "@code-developer"` - IMPL-001: `meta.type: "test-gen"`, `meta.agent: "@code-developer"`
@@ -214,14 +214,14 @@ Refer to: @.claude/agents/action-planning-agent.md for:
- **Details**: See action-planning-agent.md § Test Task JSON Generation - **Details**: See action-planning-agent.md § Test Task JSON Generation
##### 2. IMPL_PLAN.md (Test Variant) ##### 2. IMPL_PLAN.md (Test Variant)
- **Location**: `.workflow/{test-session-id}/IMPL_PLAN.md` - **Location**: `.workflow/sessions/{test-session-id}/IMPL_PLAN.md`
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt` - **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
- **Test-Specific Frontmatter**: workflow_type="test_session", test_framework, source_session_id - **Test-Specific Frontmatter**: workflow_type="test_session", test_framework, source_session_id
- **Test-Fix-Retest Cycle Section**: Iterative fix cycle with Gemini diagnosis - **Test-Fix-Retest Cycle Section**: Iterative fix cycle with Gemini diagnosis
- **Details**: See action-planning-agent.md § Test Implementation Plan Creation - **Details**: See action-planning-agent.md § Test Implementation Plan Creation
##### 3. TODO_LIST.md ##### 3. TODO_LIST.md
- **Location**: `.workflow/{test-session-id}/TODO_LIST.md` - **Location**: `.workflow/sessions/{test-session-id}/TODO_LIST.md`
- **Format**: Task list with test generation and execution phases - **Format**: Task list with test generation and execution phases
- **Status**: [ ] (pending), [x] (completed) - **Status**: [ ] (pending), [x] (completed)
- **Details**: See action-planning-agent.md § TODO List Generation - **Details**: See action-planning-agent.md § TODO List Generation

View File

@@ -98,7 +98,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Write(*), Bash(*)
**Session Integration**: **Session Integration**:
- `--session` flag determines session integration or standalone execution - `--session` flag determines session integration or standalone execution
- Integrated: Design system automatically added to session artifacts - Integrated: Design system automatically added to session artifacts
- Standalone: Output in `.workflow/{run_id}/` - Standalone: Output in `.workflow/sessions/{run_id}/`
## 5-Phase Execution ## 5-Phase Execution
@@ -188,7 +188,7 @@ IF --session:
session_mode = "integrated" session_mode = "integrated"
ELSE: ELSE:
session_id = null session_id = null
relative_base_path = ".workflow/{design_id}" relative_base_path = ".workflow/sessions/{design_id}"
session_mode = "standalone" session_mode = "standalone"
# Create base directory and convert to absolute path # Create base directory and convert to absolute path

View File

@@ -102,7 +102,7 @@ Phase 2: Document Generation (Autonomous Output)
1. **Extract Tasks**: Parse `analysis_results.tasks` array 1. **Extract Tasks**: Parse `analysis_results.tasks` array
2. **Map Artifacts**: Use `artifacts_inventory` to add artifact references to task.context 2. **Map Artifacts**: Use `artifacts_inventory` to add artifact references to task.context
3. **Assess Complexity**: Use `analysis_results.complexity` for document structure decision 3. **Assess Complexity**: Use `analysis_results.complexity` for document structure decision
4. **Session Paths**: Use `session_id` to construct output paths (.workflow/{session_id}/) 4. **Session Paths**: Use `session_id` to construct output paths (.workflow/sessions/{session_id}/)
### MCP Integration Guidelines ### MCP Integration Guidelines
@@ -244,14 +244,14 @@ Generate individual `.task/IMPL-*.json` files with:
- Low priority: role_analyses - Low priority: role_analyses
### 3. Implementation Plan Creation ### 3. Implementation Plan Creation
Generate `IMPL_PLAN.md` at `.workflow/{session_id}/IMPL_PLAN.md`: Generate `IMPL_PLAN.md` at `.workflow/sessions/{session_id}/IMPL_PLAN.md`:
**Structure**: **Structure**:
```markdown ```markdown
--- ---
identifier: {session_id} identifier: {session_id}
source: "User requirements" source: "User requirements"
analysis: .workflow/{session_id}/.process/ANALYSIS_RESULTS.md analysis: .workflow/sessions/{session_id}/.process/ANALYSIS_RESULTS.md
--- ---
# Implementation Plan: {Project Title} # Implementation Plan: {Project Title}
@@ -280,7 +280,7 @@ analysis: .workflow/{session_id}/.process/ANALYSIS_RESULTS.md
``` ```
### 4. TODO List Generation ### 4. TODO List Generation
Generate `TODO_LIST.md` at `.workflow/{session_id}/TODO_LIST.md`: Generate `TODO_LIST.md` at `.workflow/sessions/{session_id}/TODO_LIST.md`:
**Structure**: **Structure**:
```markdown ```markdown

View File

@@ -98,7 +98,7 @@ Phase 3: Task JSON Generation
1. Load task JSON template 1. Load task JSON template
2. Populate template with parsed CLI results 2. Populate template with parsed CLI results
3. Add iteration context and previous attempts 3. Add iteration context and previous attempts
4. Write task JSON to .workflow/{session}/.task/IMPL-fix-N.json 4. Write task JSON to .workflow/session/{session}/.task/IMPL-fix-N.json
5. Return success status and task ID to orchestrator 5. Return success status and task ID to orchestrator
``` ```

View File

@@ -238,7 +238,7 @@ const context = {
**3.5 Brainstorm Artifacts Integration** **3.5 Brainstorm Artifacts Integration**
If `.workflow/{session}/.brainstorming/` exists, read and include content: If `.workflow/session/{session}/.brainstorming/` exists, read and include content:
```javascript ```javascript
const brainstormDir = `.workflow/${session}/.brainstorming`; const brainstormDir = `.workflow/${session}/.brainstorming`;
if (dir_exists(brainstormDir)) { if (dir_exists(brainstormDir)) {
@@ -274,7 +274,7 @@ Calculate risk level based on:
**3.7 Context Packaging & Output** **3.7 Context Packaging & Output**
**Output**: `.workflow/{session-id}/.process/context-package.json` **Output**: `.workflow/sessions//{session-id}/.process/context-package.json`
**Note**: Task JSONs reference via `context_package_path` field (not in `artifacts`) **Note**: Task JSONs reference via `context_package_path` field (not in `artifacts`)
@@ -422,7 +422,7 @@ Calculate risk level based on:
## Quality Validation ## Quality Validation
Before completion verify: Before completion verify:
- [ ] context-package.json in `.workflow/{session}/.process/` - [ ] context-package.json in `.workflow/session/{session}/.process/`
- [ ] Valid JSON with all required fields - [ ] Valid JSON with all required fields
- [ ] Metadata complete (description, keywords, complexity) - [ ] Metadata complete (description, keywords, complexity)
- [ ] Project context documented (patterns, conventions, tech stack) - [ ] Project context documented (patterns, conventions, tech stack)
@@ -456,7 +456,7 @@ Conflict Detection:
- Affected: {modules} - Affected: {modules}
- Mitigation: {strategy} - Mitigation: {strategy}
Output: .workflow/{session}/.process/context-package.json Output: .workflow/session/{session}/.process/context-package.json
(Referenced in task JSONs via top-level `context_package_path` field) (Referenced in task JSONs via top-level `context_package_path` field)
``` ```

View File

@@ -304,7 +304,7 @@ if (!validation.all_passed()) {
## Output Location ## Output Location
``` ```
.workflow/{test_session_id}/.process/test-context-package.json .workflow/sessions/{test_session_id}/.process/test-context-package.json
``` ```
## Helper Functions Reference ## Helper Functions Reference

View File

@@ -128,8 +128,8 @@ Generate a complete tech stack SKILL package with Exa research.
1. **Extract Tech Stack Information**: 1. **Extract Tech Stack Information**:
IF MODE == 'session': IF MODE == 'session':
- Read `.workflow/{SESSION_ID}/workflow-session.json` - Read `.workflow/sessions/{session_id}/workflow-session.json`
- Read `.workflow/{SESSION_ID}/.process/context-package.json` - Read `.workflow/sessions/{session_id}/.process/context-package.json`
- Extract tech_stack: {language, frameworks, libraries} - Extract tech_stack: {language, frameworks, libraries}
- Build tech stack name: \"{language}-{framework1}-{framework2}\" - Build tech stack name: \"{language}-{framework1}-{framework2}\"
- Example: \"typescript-react-nextjs\" - Example: \"typescript-react-nextjs\"

View File

@@ -92,7 +92,7 @@ Orchestrates autonomous workflow execution through systematic task discovery, ag
4. **Validate Prerequisites**: Ensure IMPL_PLAN.md and TODO_LIST.md exist and are valid 4. **Validate Prerequisites**: Ensure IMPL_PLAN.md and TODO_LIST.md exist and are valid
**Resume Mode Behavior**: **Resume Mode Behavior**:
- Load existing TODO_LIST.md directly from `.workflow/{session-id}/` - Load existing TODO_LIST.md directly from `.workflow/sessions//{session-id}/`
- Extract current progress from TODO_LIST.md - Extract current progress from TODO_LIST.md
- Generate TodoWrite from TODO_LIST.md state - Generate TodoWrite from TODO_LIST.md state
- Proceed immediately to agent execution (Phase 4) - Proceed immediately to agent execution (Phase 4)
@@ -118,7 +118,7 @@ If IMPL_PLAN.md lacks execution strategy, use intelligent fallback (analyze task
``` ```
while (TODO_LIST.md has pending tasks) { while (TODO_LIST.md has pending tasks) {
next_task_id = getTodoWriteInProgressTask() next_task_id = getTodoWriteInProgressTask()
task_json = Read(.workflow/{session}/.task/{next_task_id}.json) // Lazy load task_json = Read(.workflow/session/{session}/.task/{next_task_id}.json) // Lazy load
executeTaskWithAgent(task_json) executeTaskWithAgent(task_json)
updateTodoListMarkCompleted(next_task_id) updateTodoListMarkCompleted(next_task_id)
advanceTodoWriteToNextTask() advanceTodoWriteToNextTask()

View File

@@ -209,13 +209,13 @@ Iteration N (managed by test-cycle-execute orchestrator):
"pre_analysis": [ "pre_analysis": [
{ {
"step": "load_failure_context", "step": "load_failure_context",
"command": "Read(.workflow/{session}/.process/iteration-{N-1}-failures.json)", "command": "Read(.workflow/session/{session}/.process/iteration-{N-1}-failures.json)",
"output_to": "previous_failures", "output_to": "previous_failures",
"on_error": "skip_optional" "on_error": "skip_optional"
}, },
{ {
"step": "load_fix_strategy", "step": "load_fix_strategy",
"command": "Read(.workflow/{session}/.process/iteration-{N}-strategy.md)", "command": "Read(.workflow/session/{session}/.process/iteration-{N}-strategy.md)",
"output_to": "fix_strategy", "output_to": "fix_strategy",
"on_error": "fail" "on_error": "fail"
} }
@@ -704,7 +704,7 @@ Task(subagent_type="{meta.agent}",
#### Resume from Interruption #### Resume from Interruption
```bash ```bash
# Load iteration state # Load iteration state
iteration_state=$(cat .workflow/{session}/.process/iteration-state.json) iteration_state=$(cat .workflow/session/{session}/.process/iteration-state.json)
current_iteration=$(jq -r '.current_iteration' <<< "$iteration_state") current_iteration=$(jq -r '.current_iteration' <<< "$iteration_state")
# Determine resume point # Determine resume point
@@ -723,7 +723,7 @@ fi
git revert HEAD git revert HEAD
# Remove failed fix task # Remove failed fix task
rm .workflow/{session}/.task/IMPL-fix-{N}.json rm .workflow/session/{session}/.task/IMPL-fix-{N}.json
# Restore iteration state # Restore iteration state
jq '.current_iteration -= 1' iteration-state.json > temp.json jq '.current_iteration -= 1' iteration-state.json > temp.json

View File

@@ -73,7 +73,7 @@ Task(subagent_type="cli-execution-agent", prompt=`
### 1. Load Context ### 1. Load Context
- Read existing files from conflict_detection.existing_files - Read existing files from conflict_detection.existing_files
- Load plan from .workflow/{session_id}/.process/context-package.json - Load plan from .workflow/sessions/{session_id}/.process/context-package.json
- Extract role analyses and requirements - Extract role analyses and requirements
### 2. Execute CLI Analysis ### 2. Execute CLI Analysis
@@ -87,7 +87,7 @@ Task(subagent_type="cli-execution-agent", prompt=`
• Detect data model incompatibilities • Detect data model incompatibilities
• Assess dependency conflicts • Assess dependency conflicts
MODE: analysis MODE: analysis
CONTEXT: @{existing_files} @.workflow/{session_id}/**/* CONTEXT: @{existing_files} @.workflow/sessions/{session_id}/**/*
EXPECTED: Conflict list with severity ratings EXPECTED: Conflict list with severity ratings
RULES: Focus on breaking changes and migration needs RULES: Focus on breaking changes and migration needs
" "
@@ -118,8 +118,8 @@ Task(subagent_type="cli-execution-agent", prompt=`
"severity": "Critical|High|Medium", "severity": "Critical|High|Medium",
"category": "Architecture|API|Data|Dependency", "category": "Architecture|API|Data|Dependency",
"affected_files": [ "affected_files": [
".workflow/{session}/.brainstorm/guidance-specification.md", ".workflow/session/{session}/.brainstorm/guidance-specification.md",
".workflow/{session}/.brainstorm/system-architect/analysis.md" ".workflow/session/{session}/.brainstorm/system-architect/analysis.md"
], ],
"description": "详细描述冲突 - 什么不兼容", "description": "详细描述冲突 - 什么不兼容",
"impact": { "impact": {
@@ -139,7 +139,7 @@ Task(subagent_type="cli-execution-agent", prompt=`
"cons": ["缺点1", "缺点2"], "cons": ["缺点1", "缺点2"],
"modifications": [ "modifications": [
{ {
"file": ".workflow/{session}/.brainstorm/guidance-specification.md", "file": ".workflow/session/{session}/.brainstorm/guidance-specification.md",
"section": "## 2. System Architect Decisions", "section": "## 2. System Architect Decisions",
"change_type": "update", "change_type": "update",
"old_content": "原始内容片段(用于定位)", "old_content": "原始内容片段(用于定位)",
@@ -147,7 +147,7 @@ Task(subagent_type="cli-execution-agent", prompt=`
"rationale": "为什么这样改" "rationale": "为什么这样改"
}, },
{ {
"file": ".workflow/{session}/.brainstorm/system-architect/analysis.md", "file": ".workflow/session/{session}/.brainstorm/system-architect/analysis.md",
"section": "## Design Decisions", "section": "## Design Decisions",
"change_type": "update", "change_type": "update",
"old_content": "原始内容片段", "old_content": "原始内容片段",
@@ -378,7 +378,7 @@ return {
✓ guidance-specification.md updated ✓ guidance-specification.md updated
✓ Role analyses (*.md) updated ✓ Role analyses (*.md) updated
✓ context-package.json marked as resolved ✓ context-package.json marked as resolved
✓ Agent log saved to .workflow/{session_id}/.chat/ ✓ Agent log saved to .workflow/sessions/{session_id}/.chat/
``` ```
## Output Format: Agent JSON Response ## Output Format: Agent JSON Response
@@ -435,9 +435,9 @@ If Edit tool fails mid-application:
**Output**: **Output**:
- Modified files: - Modified files:
- `.workflow/{session_id}/.brainstorm/guidance-specification.md` - `.workflow/sessions/{session_id}/.brainstorm/guidance-specification.md`
- `.workflow/{session_id}/.brainstorm/{role}/analysis.md` - `.workflow/sessions/{session_id}/.brainstorm/{role}/analysis.md`
- `.workflow/{session_id}/.process/context-package.json` (conflict_risk → resolved) - `.workflow/sessions/{session_id}/.process/context-package.json` (conflict_risk → resolved)
- NO report file generation - NO report file generation
**User Interaction**: **User Interaction**:
@@ -459,7 +459,7 @@ If Edit tool fails mid-application:
✓ context-package.json marked as "resolved" ✓ context-package.json marked as "resolved"
✓ No CONFLICT_RESOLUTION.md file generated ✓ No CONFLICT_RESOLUTION.md file generated
✓ Modification summary includes custom conflict count ✓ Modification summary includes custom conflict count
✓ Agent log saved to .workflow/{session_id}/.chat/ ✓ Agent log saved to .workflow/sessions/{session_id}/.chat/
✓ Error handling robust (validate/retry/degrade) ✓ Error handling robust (validate/retry/degrade)
``` ```

View File

@@ -22,7 +22,7 @@ Orchestrator command that invokes `context-search-agent` to gather comprehensive
- **Agent Delegation**: Delegate all discovery to `context-search-agent` for autonomous execution - **Agent Delegation**: Delegate all discovery to `context-search-agent` for autonomous execution
- **Detection-First**: Check for existing context-package before executing - **Detection-First**: Check for existing context-package before executing
- **Plan Mode**: Full comprehensive analysis (vs lightweight brainstorm mode) - **Plan Mode**: Full comprehensive analysis (vs lightweight brainstorm mode)
- **Standardized Output**: Generate `.workflow/{session}/.process/context-package.json` - **Standardized Output**: Generate `.workflow/session/{session}/.process/context-package.json`
## Execution Flow ## Execution Flow

View File

@@ -36,7 +36,7 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
// Path selected by command based on --cli-execute flag, agent reads it // Path selected by command based on --cli-execute flag, agent reads it
"session_metadata": { "session_metadata": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/workflow-session.json // Else: Load from .workflow/sessions//{session-id}/workflow-session.json
}, },
"brainstorm_artifacts": { "brainstorm_artifacts": {
// Loaded from context-package.json → brainstorm_artifacts section // Loaded from context-package.json → brainstorm_artifacts section
@@ -50,10 +50,10 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
"synthesis_output": {"path": "...", "exists": true}, "synthesis_output": {"path": "...", "exists": true},
"conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium "conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium
}, },
"context_package_path": ".workflow/{session-id}/.process/context-package.json", "context_package_path": ".workflow/sessions//{session-id}/.process/context-package.json",
"context_package": { "context_package": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/.process/context-package.json // Else: Load from .workflow/sessions//{session-id}/.process/context-package.json
}, },
"mcp_capabilities": { "mcp_capabilities": {
"code_index": true, "code_index": true,
@@ -67,14 +67,14 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
1. **Load Session Context** (if not in memory) 1. **Load Session Context** (if not in memory)
```javascript ```javascript
if (!memory.has("workflow-session.json")) { if (!memory.has("workflow-session.json")) {
Read(.workflow/{session-id}/workflow-session.json) Read(.workflow/sessions//{session-id}/workflow-session.json)
} }
``` ```
2. **Load Context Package** (if not in memory) 2. **Load Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("context-package.json")) { if (!memory.has("context-package.json")) {
Read(.workflow/{session-id}/.process/context-package.json) Read(.workflow/sessions//{session-id}/.process/context-package.json)
} }
``` ```
@@ -176,18 +176,18 @@ Refer to: @.claude/agents/action-planning-agent.md for:
### Required Outputs Summary ### Required Outputs Summary
#### 1. Task JSON Files (.task/IMPL-*.json) #### 1. Task JSON Files (.task/IMPL-*.json)
- **Location**: `.workflow/{session-id}/.task/` - **Location**: `.workflow/sessions//{session-id}/.task/`
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag) - **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
- **Schema**: 5-field structure (id, title, status, meta, context, flow_control) with artifacts integration - **Schema**: 5-field structure (id, title, status, meta, context, flow_control) with artifacts integration
- **Details**: See action-planning-agent.md § Task JSON Generation - **Details**: See action-planning-agent.md § Task JSON Generation
#### 2. IMPL_PLAN.md #### 2. IMPL_PLAN.md
- **Location**: `.workflow/{session-id}/IMPL_PLAN.md` - **Location**: `.workflow/sessions//{session-id}/IMPL_PLAN.md`
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt` - **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
- **Details**: See action-planning-agent.md § Implementation Plan Creation - **Details**: See action-planning-agent.md § Implementation Plan Creation
#### 3. TODO_LIST.md #### 3. TODO_LIST.md
- **Location**: `.workflow/{session-id}/TODO_LIST.md` - **Location**: `.workflow/sessions//{session-id}/TODO_LIST.md`
- **Format**: Hierarchical task list with status indicators (▸, [ ], [x]) and JSON links - **Format**: Hierarchical task list with status indicators (▸, [ ], [x]) and JSON links
- **Details**: See action-planning-agent.md § TODO List Generation - **Details**: See action-planning-agent.md § TODO List Generation

View File

@@ -74,7 +74,7 @@ Autonomous TDD task JSON and IMPL_PLAN.md generation using action-planning-agent
"workflow_type": "tdd", "workflow_type": "tdd",
"session_metadata": { "session_metadata": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/workflow-session.json // Else: Load from .workflow/sessions//{session-id}/workflow-session.json
}, },
"brainstorm_artifacts": { "brainstorm_artifacts": {
// Loaded from context-package.json → brainstorm_artifacts section // Loaded from context-package.json → brainstorm_artifacts section
@@ -88,12 +88,12 @@ Autonomous TDD task JSON and IMPL_PLAN.md generation using action-planning-agent
"synthesis_output": {"path": "...", "exists": true}, "synthesis_output": {"path": "...", "exists": true},
"conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium "conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium
}, },
"context_package_path": ".workflow/{session-id}/.process/context-package.json", "context_package_path": ".workflow/sessions//{session-id}/.process/context-package.json",
"context_package": { "context_package": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{session-id}/.process/context-package.json // Else: Load from .workflow/sessions//{session-id}/.process/context-package.json
}, },
"test_context_package_path": ".workflow/{session-id}/.process/test-context-package.json", "test_context_package_path": ".workflow/sessions//{session-id}/.process/test-context-package.json",
"test_context_package": { "test_context_package": {
// Existing test patterns and coverage analysis // Existing test patterns and coverage analysis
}, },
@@ -109,21 +109,21 @@ Autonomous TDD task JSON and IMPL_PLAN.md generation using action-planning-agent
1. **Load Session Context** (if not in memory) 1. **Load Session Context** (if not in memory)
```javascript ```javascript
if (!memory.has("workflow-session.json")) { if (!memory.has("workflow-session.json")) {
Read(.workflow/{session-id}/workflow-session.json) Read(.workflow/sessions//{session-id}/workflow-session.json)
} }
``` ```
2. **Load Context Package** (if not in memory) 2. **Load Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("context-package.json")) { if (!memory.has("context-package.json")) {
Read(.workflow/{session-id}/.process/context-package.json) Read(.workflow/sessions//{session-id}/.process/context-package.json)
} }
``` ```
3. **Load Test Context Package** (if not in memory) 3. **Load Test Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("test-context-package.json")) { if (!memory.has("test-context-package.json")) {
Read(.workflow/{session-id}/.process/test-context-package.json) Read(.workflow/sessions//{session-id}/.process/test-context-package.json)
} }
``` ```
@@ -245,7 +245,7 @@ Refer to: @.claude/agents/action-planning-agent.md for:
#### Required Outputs Summary #### Required Outputs Summary
##### 1. TDD Task JSON Files (.task/IMPL-*.json) ##### 1. TDD Task JSON Files (.task/IMPL-*.json)
- **Location**: `.workflow/{session-id}/.task/` - **Location**: `.workflow/sessions//{session-id}/.task/`
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag) - **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
- **Schema**: 5-field structure with TDD-specific metadata - **Schema**: 5-field structure with TDD-specific metadata
- `meta.tdd_workflow`: true (REQUIRED) - `meta.tdd_workflow`: true (REQUIRED)
@@ -259,14 +259,14 @@ Refer to: @.claude/agents/action-planning-agent.md for:
- **Details**: See action-planning-agent.md § TDD Task JSON Generation - **Details**: See action-planning-agent.md § TDD Task JSON Generation
##### 2. IMPL_PLAN.md (TDD Variant) ##### 2. IMPL_PLAN.md (TDD Variant)
- **Location**: `.workflow/{session-id}/IMPL_PLAN.md` - **Location**: `.workflow/sessions//{session-id}/IMPL_PLAN.md`
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt` - **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
- **TDD-Specific Frontmatter**: workflow_type="tdd", tdd_workflow=true, feature_count, task_breakdown - **TDD-Specific Frontmatter**: workflow_type="tdd", tdd_workflow=true, feature_count, task_breakdown
- **TDD Implementation Tasks Section**: Feature-by-feature with internal Red-Green-Refactor cycles - **TDD Implementation Tasks Section**: Feature-by-feature with internal Red-Green-Refactor cycles
- **Details**: See action-planning-agent.md § TDD Implementation Plan Creation - **Details**: See action-planning-agent.md § TDD Implementation Plan Creation
##### 3. TODO_LIST.md ##### 3. TODO_LIST.md
- **Location**: `.workflow/{session-id}/TODO_LIST.md` - **Location**: `.workflow/sessions//{session-id}/TODO_LIST.md`
- **Format**: Hierarchical task list with internal TDD phase indicators (Red → Green → Refactor) - **Format**: Hierarchical task list with internal TDD phase indicators (Red → Green → Refactor)
- **Status**: ▸ (container), [ ] (pending), [x] (completed) - **Status**: ▸ (container), [ ] (pending), [x] (completed)
- **Details**: See action-planning-agent.md § TODO List Generation - **Details**: See action-planning-agent.md § TODO List Generation
@@ -384,7 +384,7 @@ This section provides quick reference for TDD task JSON structure. For complete
## Output Files Structure ## Output Files Structure
``` ```
.workflow/{session-id}/ .workflow/sessions//{session-id}/
├── IMPL_PLAN.md # Unified plan with TDD Implementation Tasks section ├── IMPL_PLAN.md # Unified plan with TDD Implementation Tasks section
├── TODO_LIST.md # Progress tracking with internal TDD phase indicators ├── TODO_LIST.md # Progress tracking with internal TDD phase indicators
├── .task/ ├── .task/

View File

@@ -77,8 +77,8 @@ The command follows a streamlined, three-step process to convert analysis into e
### Step 1: Input & Discovery ### Step 1: Input & Discovery
The process begins by gathering all necessary inputs. It follows a **Memory-First Rule**, skipping file reads if documents are already in the conversation memory. The process begins by gathering all necessary inputs. It follows a **Memory-First Rule**, skipping file reads if documents are already in the conversation memory.
1. **Session Validation**: Loads and validates the session from `.workflow/{session_id}/workflow-session.json`. 1. **Session Validation**: Loads and validates the session from `.workflow/sessions/{session_id}/workflow-session.json`.
2. **Context Package Loading** (primary source): Reads `.workflow/{session_id}/.process/context-package.json` for smart context and artifact catalog. 2. **Context Package Loading** (primary source): Reads `.workflow/sessions/{session_id}/.process/context-package.json` for smart context and artifact catalog.
3. **Brainstorm Artifacts Extraction**: Extracts role analysis paths from `context-package.json``brainstorm_artifacts.role_analyses[]` (supports `analysis*.md` automatically). 3. **Brainstorm Artifacts Extraction**: Extracts role analysis paths from `context-package.json``brainstorm_artifacts.role_analyses[]` (supports `analysis*.md` automatically).
4. **Document Loading**: Reads role analyses, guidance specification, synthesis output, and conflict resolution (if exists) using paths from context package. 4. **Document Loading**: Reads role analyses, guidance specification, synthesis output, and conflict resolution (if exists) using paths from context package.
@@ -353,10 +353,10 @@ This document provides a high-level overview of the entire implementation plan.
--- ---
identifier: WFS-{session-id} identifier: WFS-{session-id}
source: "User requirements" | "File: path" | "Issue: ISS-001" source: "User requirements" | "File: path" | "Issue: ISS-001"
role_analyses: .workflow/{session-id}/.brainstorming/[role]/analysis*.md role_analyses: .workflow/sessions//{session-id}/.brainstorming/[role]/analysis*.md
artifacts: .workflow/{session-id}/.brainstorming/ artifacts: .workflow/sessions//{session-id}/.brainstorming/
context_package: .workflow/{session-id}/.process/context-package.json # CCW smart context context_package: .workflow/sessions//{session-id}/.process/context-package.json # CCW smart context
guidance_specification: .workflow/{session-id}/.brainstorming/guidance-specification.md # Finalized decisions with resolved conflicts guidance_specification: .workflow/sessions//{session-id}/.brainstorming/guidance-specification.md # Finalized decisions with resolved conflicts
workflow_type: "standard | tdd | design" # Indicates execution model workflow_type: "standard | tdd | design" # Indicates execution model
verification_history: # CCW quality gates verification_history: # CCW quality gates
synthesis_clarify: "passed | skipped | pending" # Brainstorm phase clarification synthesis_clarify: "passed | skipped | pending" # Brainstorm phase clarification
@@ -606,7 +606,7 @@ A simple Markdown file for tracking the status of each task.
### 6.4. Output Files Diagram ### 6.4. Output Files Diagram
The command organizes outputs into a standard directory structure. The command organizes outputs into a standard directory structure.
``` ```
.workflow/{session-id}/ .workflow/sessions//{session-id}/
├── IMPL_PLAN.md # Implementation plan ├── IMPL_PLAN.md # Implementation plan
├── TODO_LIST.md # Progress tracking ├── TODO_LIST.md # Progress tracking
├── .task/ ├── .task/

View File

@@ -21,7 +21,7 @@ Analyze test coverage and verify Red-Green-Refactor cycle execution for TDD work
### Phase 1: Extract Test Tasks ### Phase 1: Extract Test Tasks
```bash ```bash
find .workflow/{session_id}/.task/ -name 'TEST-*.json' -exec jq -r '.context.focus_paths[]' {} \; find .workflow/sessions/{session_id}/.task/ -name 'TEST-*.json' -exec jq -r '.context.focus_paths[]' {} \;
``` ```
**Output**: List of test directories/files from all TEST tasks **Output**: List of test directories/files from all TEST tasks
@@ -29,20 +29,20 @@ find .workflow/{session_id}/.task/ -name 'TEST-*.json' -exec jq -r '.context.foc
### Phase 2: Run Test Suite ### Phase 2: Run Test Suite
```bash ```bash
# Node.js/JavaScript # Node.js/JavaScript
npm test -- --coverage --json > .workflow/{session_id}/.process/test-results.json npm test -- --coverage --json > .workflow/sessions/{session_id}/.process/test-results.json
# Python # Python
pytest --cov --json-report > .workflow/{session_id}/.process/test-results.json pytest --cov --json-report > .workflow/sessions/{session_id}/.process/test-results.json
# Other frameworks (detect from project) # Other frameworks (detect from project)
[test_command] --coverage --json-output .workflow/{session_id}/.process/test-results.json [test_command] --coverage --json-output .workflow/sessions/{session_id}/.process/test-results.json
``` ```
**Output**: test-results.json with coverage data **Output**: test-results.json with coverage data
### Phase 3: Parse Coverage Data ### Phase 3: Parse Coverage Data
```bash ```bash
jq '.coverage' .workflow/{session_id}/.process/test-results.json > .workflow/{session_id}/.process/coverage-report.json jq '.coverage' .workflow/sessions/{session_id}/.process/test-results.json > .workflow/sessions/{session_id}/.process/coverage-report.json
``` ```
**Extract**: **Extract**:
@@ -58,7 +58,7 @@ For each TDD chain (TEST-N.M -> IMPL-N.M -> REFACTOR-N.M):
**1. Red Phase Verification** **1. Red Phase Verification**
```bash ```bash
# Check TEST task summary # Check TEST task summary
cat .workflow/{session_id}/.summaries/TEST-N.M-summary.md cat .workflow/sessions/{session_id}/.summaries/TEST-N.M-summary.md
``` ```
Verify: Verify:
@@ -69,7 +69,7 @@ Verify:
**2. Green Phase Verification** **2. Green Phase Verification**
```bash ```bash
# Check IMPL task summary # Check IMPL task summary
cat .workflow/{session_id}/.summaries/IMPL-N.M-summary.md cat .workflow/sessions/{session_id}/.summaries/IMPL-N.M-summary.md
``` ```
Verify: Verify:
@@ -80,7 +80,7 @@ Verify:
**3. Refactor Phase Verification** **3. Refactor Phase Verification**
```bash ```bash
# Check REFACTOR task summary # Check REFACTOR task summary
cat .workflow/{session_id}/.summaries/REFACTOR-N.M-summary.md cat .workflow/sessions/{session_id}/.summaries/REFACTOR-N.M-summary.md
``` ```
Verify: Verify:
@@ -90,7 +90,7 @@ Verify:
### Phase 5: Generate Analysis Report ### Phase 5: Generate Analysis Report
Create `.workflow/{session_id}/.process/tdd-cycle-report.md`: Create `.workflow/sessions/{session_id}/.process/tdd-cycle-report.md`:
```markdown ```markdown
# TDD Cycle Analysis - {Session ID} # TDD Cycle Analysis - {Session ID}
@@ -146,7 +146,7 @@ Create `.workflow/{session_id}/.process/tdd-cycle-report.md`:
## Output Files ## Output Files
``` ```
.workflow/{session-id}/ .workflow/sessions//{session-id}/
└── .process/ └── .process/
├── test-results.json # Raw test execution results ├── test-results.json # Raw test execution results
├── coverage-report.json # Parsed coverage data ├── coverage-report.json # Parsed coverage data

View File

@@ -30,7 +30,7 @@ Specialized analysis tool for test generation workflows that uses Gemini to anal
### Phase 1: Validation & Preparation ### Phase 1: Validation & Preparation
1. **Session Validation** 1. **Session Validation**
- Load `.workflow/{test_session_id}/workflow-session.json` - Load `.workflow/sessions/{test_session_id}/workflow-session.json`
- Verify test session type is "test-gen" - Verify test session type is "test-gen"
- Extract source session reference - Extract source session reference
@@ -48,11 +48,11 @@ Specialized analysis tool for test generation workflows that uses Gemini to anal
**Tool Configuration**: **Tool Configuration**:
```bash ```bash
cd .workflow/{test_session_id}/.process && gemini -p " cd .workflow/sessions/{test_session_id}/.process && gemini -p "
PURPOSE: Analyze test coverage gaps and design comprehensive test generation strategy PURPOSE: Analyze test coverage gaps and design comprehensive test generation strategy
TASK: Study implementation context, existing tests, and generate test requirements for missing coverage TASK: Study implementation context, existing tests, and generate test requirements for missing coverage
MODE: analysis MODE: analysis
CONTEXT: @{.workflow/{test_session_id}/.process/test-context-package.json} CONTEXT: @{.workflow/sessions/{test_session_id}/.process/test-context-package.json}
**MANDATORY FIRST STEP**: Read and analyze test-context-package.json to understand: **MANDATORY FIRST STEP**: Read and analyze test-context-package.json to understand:
- Test coverage gaps from test_coverage.missing_tests[] - Test coverage gaps from test_coverage.missing_tests[]
@@ -226,13 +226,13 @@ RULES:
- Prioritize critical business logic tests - Prioritize critical business logic tests
- Specify clear test scenarios and coverage targets - Specify clear test scenarios and coverage targets
- Identify all dependencies requiring mocks - Identify all dependencies requiring mocks
- **MUST write output to .workflow/{test_session_id}/.process/gemini-test-analysis.md** - **MUST write output to .workflow/sessions/{test_session_id}/.process/gemini-test-analysis.md**
- Do NOT generate actual test code or implementation - Do NOT generate actual test code or implementation
- Output ONLY test analysis and generation strategy - Output ONLY test analysis and generation strategy
" --approval-mode yolo " --approval-mode yolo
``` ```
**Output Location**: `.workflow/{test_session_id}/.process/gemini-test-analysis.md` **Output Location**: `.workflow/sessions/{test_session_id}/.process/gemini-test-analysis.md`
### Phase 3: Results Synthesis ### Phase 3: Results Synthesis
@@ -408,7 +408,7 @@ Synthesize Gemini analysis into standardized format:
- **Coverage Tools**: {coverage_tool_if_detected} - **Coverage Tools**: {coverage_tool_if_detected}
``` ```
**Output Location**: `.workflow/{test_session_id}/.process/TEST_ANALYSIS_RESULTS.md` **Output Location**: `.workflow/sessions/{test_session_id}/.process/TEST_ANALYSIS_RESULTS.md`
## Error Handling ## Error Handling

View File

@@ -22,7 +22,7 @@ Orchestrator command that invokes `test-context-search-agent` to gather comprehe
- **Detection-First**: Check for existing test-context-package before executing - **Detection-First**: Check for existing test-context-package before executing
- **Coverage-First**: Analyze existing test coverage before planning new tests - **Coverage-First**: Analyze existing test coverage before planning new tests
- **Source Context Loading**: Import implementation summaries from source session - **Source Context Loading**: Import implementation summaries from source session
- **Standardized Output**: Generate `.workflow/{test_session_id}/.process/test-context-package.json` - **Standardized Output**: Generate `.workflow/sessions/{test_session_id}/.process/test-context-package.json`
## Execution Flow ## Execution Flow
@@ -164,7 +164,7 @@ Refer to `test-context-search-agent.md` Phase 3.2 for complete `test-context-pac
## Success Criteria ## Success Criteria
- ✅ Valid test-context-package.json generated in `.workflow/{test_session_id}/.process/` - ✅ Valid test-context-package.json generated in `.workflow/sessions/{test_session_id}/.process/`
- ✅ Source session context loaded successfully - ✅ Source session context loaded successfully
- ✅ Test coverage gaps identified (>90% accuracy) - ✅ Test coverage gaps identified (>90% accuracy)
- ✅ Test framework detected and documented - ✅ Test framework detected and documented

View File

@@ -54,14 +54,14 @@ Autonomous test-fix task JSON generation using action-planning-agent with two-ph
"use_codex": true | false, // Determined by --use-codex flag "use_codex": true | false, // Determined by --use-codex flag
"session_metadata": { "session_metadata": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from .workflow/{test-session-id}/workflow-session.json // Else: Load from .workflow/sessions/{test-session-id}/workflow-session.json
}, },
"test_analysis_results_path": ".workflow/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md", "test_analysis_results_path": ".workflow/sessions/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md",
"test_analysis_results": { "test_analysis_results": {
// If in memory: use cached content // If in memory: use cached content
// Else: Load from TEST_ANALYSIS_RESULTS.md // Else: Load from TEST_ANALYSIS_RESULTS.md
}, },
"test_context_package_path": ".workflow/{test-session-id}/.process/test-context-package.json", "test_context_package_path": ".workflow/sessions/{test-session-id}/.process/test-context-package.json",
"test_context_package": { "test_context_package": {
// Existing test patterns and coverage analysis // Existing test patterns and coverage analysis
}, },
@@ -81,28 +81,28 @@ Autonomous test-fix task JSON generation using action-planning-agent with two-ph
1. **Load Test Session Context** (if not in memory) 1. **Load Test Session Context** (if not in memory)
```javascript ```javascript
if (!memory.has("workflow-session.json")) { if (!memory.has("workflow-session.json")) {
Read(.workflow/{test-session-id}/workflow-session.json) Read(.workflow/sessions/{test-session-id}/workflow-session.json)
} }
``` ```
2. **Load TEST_ANALYSIS_RESULTS.md** (if not in memory, REQUIRED) 2. **Load TEST_ANALYSIS_RESULTS.md** (if not in memory, REQUIRED)
```javascript ```javascript
if (!memory.has("TEST_ANALYSIS_RESULTS.md")) { if (!memory.has("TEST_ANALYSIS_RESULTS.md")) {
Read(.workflow/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md) Read(.workflow/sessions/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md)
} }
``` ```
3. **Load Test Context Package** (if not in memory) 3. **Load Test Context Package** (if not in memory)
```javascript ```javascript
if (!memory.has("test-context-package.json")) { if (!memory.has("test-context-package.json")) {
Read(.workflow/{test-session-id}/.process/test-context-package.json) Read(.workflow/sessions/{test-session-id}/.process/test-context-package.json)
} }
``` ```
4. **Load Source Session Summaries** (if source_session_id exists) 4. **Load Source Session Summaries** (if source_session_id exists)
```javascript ```javascript
if (sessionMetadata.source_session_id) { if (sessionMetadata.source_session_id) {
const summaryFiles = Bash("find .workflow/{source-session-id}/.summaries/ -name 'IMPL-*-summary.md'") const summaryFiles = Bash("find .workflow/sessions/{source-session-id}/.summaries/ -name 'IMPL-*-summary.md'")
summaryFiles.forEach(file => Read(file)) summaryFiles.forEach(file => Read(file))
} }
``` ```
@@ -205,7 +205,7 @@ Refer to: @.claude/agents/action-planning-agent.md for:
#### Required Outputs Summary #### Required Outputs Summary
##### 1. Test Task JSON Files (.task/IMPL-*.json) ##### 1. Test Task JSON Files (.task/IMPL-*.json)
- **Location**: `.workflow/{test-session-id}/.task/` - **Location**: `.workflow/sessions/{test-session-id}/.task/`
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag) - **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
- **Schema**: 5-field structure with test-specific metadata - **Schema**: 5-field structure with test-specific metadata
- IMPL-001: `meta.type: "test-gen"`, `meta.agent: "@code-developer"` - IMPL-001: `meta.type: "test-gen"`, `meta.agent: "@code-developer"`
@@ -214,14 +214,14 @@ Refer to: @.claude/agents/action-planning-agent.md for:
- **Details**: See action-planning-agent.md § Test Task JSON Generation - **Details**: See action-planning-agent.md § Test Task JSON Generation
##### 2. IMPL_PLAN.md (Test Variant) ##### 2. IMPL_PLAN.md (Test Variant)
- **Location**: `.workflow/{test-session-id}/IMPL_PLAN.md` - **Location**: `.workflow/sessions/{test-session-id}/IMPL_PLAN.md`
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt` - **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
- **Test-Specific Frontmatter**: workflow_type="test_session", test_framework, source_session_id - **Test-Specific Frontmatter**: workflow_type="test_session", test_framework, source_session_id
- **Test-Fix-Retest Cycle Section**: Iterative fix cycle with Gemini diagnosis - **Test-Fix-Retest Cycle Section**: Iterative fix cycle with Gemini diagnosis
- **Details**: See action-planning-agent.md § Test Implementation Plan Creation - **Details**: See action-planning-agent.md § Test Implementation Plan Creation
##### 3. TODO_LIST.md ##### 3. TODO_LIST.md
- **Location**: `.workflow/{test-session-id}/TODO_LIST.md` - **Location**: `.workflow/sessions/{test-session-id}/TODO_LIST.md`
- **Format**: Task list with test generation and execution phases - **Format**: Task list with test generation and execution phases
- **Status**: [ ] (pending), [x] (completed) - **Status**: [ ] (pending), [x] (completed)
- **Details**: See action-planning-agent.md § TODO List Generation - **Details**: See action-planning-agent.md § TODO List Generation

View File

@@ -98,7 +98,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Write(*), Bash(*)
**Session Integration**: **Session Integration**:
- `--session` flag determines session integration or standalone execution - `--session` flag determines session integration or standalone execution
- Integrated: Design system automatically added to session artifacts - Integrated: Design system automatically added to session artifacts
- Standalone: Output in `.workflow/{run_id}/` - Standalone: Output in `.workflow/sessions/{run_id}/`
## 5-Phase Execution ## 5-Phase Execution
@@ -188,7 +188,7 @@ IF --session:
session_mode = "integrated" session_mode = "integrated"
ELSE: ELSE:
session_id = null session_id = null
relative_base_path = ".workflow/{design_id}" relative_base_path = ".workflow/sessions/{design_id}"
session_mode = "standalone" session_mode = "standalone"
# Create base directory and convert to absolute path # Create base directory and convert to absolute path

View File

@@ -5,7 +5,7 @@ Validate technical feasibility and identify implementation risks for proposed so
□ Assess complexity, validate technology choices □ Assess complexity, validate technology choices
□ Evaluate performance and security implications □ Evaluate performance and security implications
□ Focus on TECHNICAL FEASIBILITY and RISK ASSESSMENT □ Focus on TECHNICAL FEASIBILITY and RISK ASSESSMENT
□ Write output to specified .workflow/{session_id}/.process/ path □ Write output to specified .workflow/sessions/{session_id}/.process/ path
## PREREQUISITE ANALYSIS ## PREREQUISITE ANALYSIS
@@ -94,7 +94,7 @@ Review Gemini's proposed code targets:
## OUTPUT REQUIREMENTS ## OUTPUT REQUIREMENTS
### Output File ### Output File
**Path**: `.workflow/{session_id}/.process/codex-feasibility-validation.md` **Path**: `.workflow/sessions/{session_id}/.process/codex-feasibility-validation.md`
**Format**: Follow structure from `~/.claude/workflows/cli-templates/prompts/workflow/analysis-results-structure.txt` **Format**: Follow structure from `~/.claude/workflows/cli-templates/prompts/workflow/analysis-results-structure.txt`
### Required Sections ### Required Sections
@@ -171,6 +171,6 @@ Rate each aspect on 1-5 scale:
□ Risk mitigation strategies provided □ Risk mitigation strategies provided
□ Resource requirements estimated □ Resource requirements estimated
□ Final feasibility judgment (PROCEED/RECONSIDER/REJECT) □ Final feasibility judgment (PROCEED/RECONSIDER/REJECT)
□ Output written to .workflow/{session_id}/.process/codex-feasibility-validation.md □ Output written to .workflow/sessions/{session_id}/.process/codex-feasibility-validation.md
Focus: Technical feasibility validation with realistic risk assessment and mitigation strategies. Focus: Technical feasibility validation with realistic risk assessment and mitigation strategies.

View File

@@ -5,7 +5,7 @@ Analyze and design optimal solution with comprehensive architecture evaluation a
□ Analyze current architecture patterns and code structure □ Analyze current architecture patterns and code structure
□ Propose solution design with key decisions and rationale □ Propose solution design with key decisions and rationale
□ Focus on SOLUTION IMPROVEMENTS and KEY DESIGN DECISIONS □ Focus on SOLUTION IMPROVEMENTS and KEY DESIGN DECISIONS
□ Write output to specified .workflow/{session_id}/.process/ path □ Write output to specified .workflow/sessions/{session_id}/.process/ path
## ANALYSIS PRIORITY ## ANALYSIS PRIORITY
@@ -73,7 +73,7 @@ For each target:
## OUTPUT REQUIREMENTS ## OUTPUT REQUIREMENTS
### Output File ### Output File
**Path**: `.workflow/{session_id}/.process/gemini-solution-design.md` **Path**: `.workflow/sessions/{session_id}/.process/gemini-solution-design.md`
**Format**: Follow structure from `~/.claude/workflows/cli-templates/prompts/workflow/analysis-results-structure.txt` **Format**: Follow structure from `~/.claude/workflows/cli-templates/prompts/workflow/analysis-results-structure.txt`
### Required Sections ### Required Sections
@@ -126,6 +126,6 @@ If brainstorming artifacts exist:
□ Code targets specified in correct format □ Code targets specified in correct format
□ Feasibility scores provided (X/5) □ Feasibility scores provided (X/5)
□ Final recommendation (PROCEED/RECONSIDER/REJECT) □ Final recommendation (PROCEED/RECONSIDER/REJECT)
□ Output written to .workflow/{session_id}/.process/gemini-solution-design.md □ Output written to .workflow/sessions/{session_id}/.process/gemini-solution-design.md
Focus: Comprehensive solution design emphasizing architecture decisions and critical insights. Focus: Comprehensive solution design emphasizing architecture decisions and critical insights.

View File

@@ -6,9 +6,9 @@ IMPL_PLAN.md Template - Implementation Plan Document Structure
--- ---
identifier: WFS-{session-id} identifier: WFS-{session-id}
source: "User requirements" | "File: path" | "Issue: ISS-001" source: "User requirements" | "File: path" | "Issue: ISS-001"
analysis: .workflow/{session-id}/.process/ANALYSIS_RESULTS.md analysis: .workflow/sessions//{session-id}/.process/ANALYSIS_RESULTS.md
artifacts: .workflow/{session-id}/.brainstorming/ artifacts: .workflow/sessions//{session-id}/.brainstorming/
context_package: .workflow/{session-id}/.process/context-package.json # CCW smart context context_package: .workflow/sessions//{session-id}/.process/context-package.json # CCW smart context
workflow_type: "standard | tdd | design" # Indicates execution model workflow_type: "standard | tdd | design" # Indicates execution model
verification_history: # CCW quality gates verification_history: # CCW quality gates
concept_verify: "passed | skipped | pending" concept_verify: "passed | skipped | pending"