Skip to content

Commit 2a11d5f

Browse files
catlog22claude
andcommitted
refactor: Add tree-style execution flow diagrams to all workflow commands
Added tree-style execution process diagrams using ASCII art (├─, └─, │) to 34 workflow command files across three directories for improved readability and execution flow clarity. ## Changes by Directory ### workflow/ root (17 files) - lite-plan.md, lite-execute.md, lite-fix.md - plan.md, execute.md, replan.md - status.md, review.md, review-fix.md - review-session-cycle.md, review-module-cycle.md - session commands (start, complete, resume, list) - tdd-plan.md, tdd-verify.md, test-cycle-execute.md, test-gen.md, test-fix-gen.md ### workflow/ui-design/ (10 files) - layout-extract.md, animation-extract.md, style-extract.md - generate.md, import-from-code.md, codify-style.md - imitate-auto.md, explore-auto.md - reference-page-generator.md, design-sync.md ### workflow/tools/ (8 files) - conflict-resolution.md, task-generate-agent.md, context-gather.md - tdd-coverage-analysis.md, task-generate-tdd.md - test-task-generate.md, test-concept-enhanced.md, test-context-gather.md ## Diagram Features - Input parsing with flag enumeration - Decision branching with conditional paths - Phase/step hierarchy with clear nesting - Mode detection and validation flows 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 964bbbf commit 2a11d5f

27 files changed

+940
-79
lines changed

.claude/commands/workflow/action-plan-verify.md

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,32 @@ Identify inconsistencies, duplications, ambiguities, and underspecified items be
3232
IF --session parameter provided:
3333
session_id = provided session
3434
ELSE:
35-
CHECK: find .workflow/active/ -name "WFS-*" -type d
36-
IF active_session EXISTS:
37-
session_id = get_active_session()
38-
ELSE:
35+
# Auto-detect active session
36+
active_sessions = bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null)
37+
IF active_sessions is empty:
3938
ERROR: "No active workflow session found. Use --session <session-id>"
4039
EXIT
40+
ELSE IF active_sessions has multiple entries:
41+
# Use most recently modified session
42+
session_id = bash(ls -td .workflow/active/WFS-*/ 2>/dev/null | head -1 | xargs basename)
43+
ELSE:
44+
session_id = basename(active_sessions[0])
4145

4246
# Derive absolute paths
4347
session_dir = .workflow/active/WFS-{session}
4448
brainstorm_dir = session_dir/.brainstorming
4549
task_dir = session_dir/.task
4650

4751
# Validate required artifacts
48-
SYNTHESIS = brainstorm_dir/role analysis documents
52+
# Note: "role analysis documents" refers to [role]/analysis.md files (e.g., product-manager/analysis.md)
53+
SYNTHESIS_DIR = brainstorm_dir # Contains role analysis files: */analysis.md
4954
IMPL_PLAN = session_dir/IMPL_PLAN.md
5055
TASK_FILES = Glob(task_dir/*.json)
5156

5257
# Abort if missing
53-
IF NOT EXISTS(SYNTHESIS):
54-
ERROR: "role analysis documents not found. Run /workflow:brainstorm:synthesis first"
58+
SYNTHESIS_FILES = Glob(brainstorm_dir/*/analysis.md)
59+
IF SYNTHESIS_FILES.count == 0:
60+
ERROR: "No role analysis documents found in .brainstorming/*/analysis.md. Run /workflow:brainstorm:synthesis first"
5561
EXIT
5662

5763
IF NOT EXISTS(IMPL_PLAN):
@@ -135,40 +141,40 @@ Focus on high-signal findings. Limit to 50 findings total; aggregate remainder i
135141
- **Unmapped Tasks**: Tasks with no clear requirement linkage
136142
- **NFR Coverage Gaps**: Non-functional requirements (performance, security, scalability) not reflected in tasks
137143

138-
#### B. Consistency Validation
144+
#### C. Consistency Validation
139145

140146
- **Requirement Conflicts**: Tasks contradicting synthesis requirements
141147
- **Architecture Drift**: IMPL_PLAN architecture not matching synthesis ADRs
142148
- **Terminology Drift**: Same concept named differently across IMPL_PLAN and tasks
143149
- **Data Model Inconsistency**: Tasks referencing entities/fields not in synthesis data model
144150

145-
#### C. Dependency Integrity
151+
#### D. Dependency Integrity
146152

147153
- **Circular Dependencies**: Task A depends on B, B depends on C, C depends on A
148154
- **Missing Dependencies**: Task requires outputs from another task but no explicit dependency
149155
- **Broken Dependencies**: Task depends on non-existent task ID
150156
- **Logical Ordering Issues**: Implementation tasks before foundational setup without dependency note
151157

152-
#### D. Synthesis Alignment
158+
#### E. Synthesis Alignment
153159

154160
- **Priority Conflicts**: High-priority synthesis requirements mapped to low-priority tasks
155161
- **Success Criteria Mismatch**: IMPL_PLAN success criteria not covering synthesis acceptance criteria
156162
- **Risk Mitigation Gaps**: Critical risks in synthesis without corresponding mitigation tasks
157163

158-
#### E. Task Specification Quality
164+
#### F. Task Specification Quality
159165

160166
- **Ambiguous Focus Paths**: Tasks with vague or missing focus_paths
161167
- **Underspecified Acceptance**: Tasks without clear acceptance criteria
162168
- **Missing Artifacts References**: Tasks not referencing relevant brainstorming artifacts in context.artifacts
163169
- **Weak Flow Control**: Tasks without clear implementation_approach or pre_analysis steps
164170
- **Missing Target Files**: Tasks without flow_control.target_files specification
165171

166-
#### F. Duplication Detection
172+
#### G. Duplication Detection
167173

168174
- **Overlapping Task Scope**: Multiple tasks with nearly identical descriptions
169175
- **Redundant Requirements Coverage**: Same requirement covered by multiple tasks without clear partitioning
170176

171-
#### G. Feasibility Assessment
177+
#### H. Feasibility Assessment
172178

173179
- **Complexity Misalignment**: Task marked "simple" but requires multiple file modifications
174180
- **Resource Conflicts**: Parallel tasks requiring same resources/files
@@ -203,7 +209,9 @@ Use this heuristic to prioritize findings:
203209

204210
### 6. Produce Compact Analysis Report
205211

206-
Output a Markdown report (no file writes) with the following structure:
212+
**Report Generation**: Generate report content and save to file.
213+
214+
Output a Markdown report with the following structure:
207215

208216
```markdown
209217
## Action Plan Verification Report
@@ -217,7 +225,11 @@ Output a Markdown report (no file writes) with the following structure:
217225
### Executive Summary
218226

219227
- **Overall Risk Level**: CRITICAL | HIGH | MEDIUM | LOW
220-
- **Recommendation**: BLOCK_EXECUTION | PROCEED_WITH_FIXES | PROCEED_WITH_CAUTION | PROCEED
228+
- **Recommendation**: (See decision matrix below)
229+
- BLOCK_EXECUTION: Critical issues exist (must fix before proceeding)
230+
- PROCEED_WITH_FIXES: High issues exist, no critical (fix recommended before execution)
231+
- PROCEED_WITH_CAUTION: Medium issues only (proceed with awareness)
232+
- PROCEED: Low issues only or no issues (safe to execute)
221233
- **Critical Issues**: {count}
222234
- **High Issues**: {count}
223235
- **Medium Issues**: {count}
@@ -322,14 +334,27 @@ Output a Markdown report (no file writes) with the following structure:
322334

323335
#### Action Recommendations
324336

325-
**If CRITICAL Issues Exist**:
326-
- **BLOCK EXECUTION** - Resolve critical issues before proceeding
327-
- Use TodoWrite to track all required fixes
328-
- Fix broken dependencies and circular references
337+
**Recommendation Decision Matrix**:
338+
339+
| Condition | Recommendation | Action |
340+
|-----------|----------------|--------|
341+
| Critical > 0 | BLOCK_EXECUTION | Must resolve all critical issues before proceeding |
342+
| Critical = 0, High > 0 | PROCEED_WITH_FIXES | Fix high-priority issues before execution |
343+
| Critical = 0, High = 0, Medium > 0 | PROCEED_WITH_CAUTION | Proceed with awareness of medium issues |
344+
| Only Low or None | PROCEED | Safe to execute workflow |
329345

330-
**If Only HIGH/MEDIUM/LOW Issues**:
331-
- **PROCEED WITH CAUTION** - Fix high-priority issues first
332-
- Use TodoWrite to systematically track and complete all improvements
346+
**If CRITICAL Issues Exist** (BLOCK_EXECUTION):
347+
- Resolve all critical issues before proceeding
348+
- Use TodoWrite to track required fixes
349+
- Fix broken dependencies and circular references first
350+
351+
**If HIGH Issues Exist** (PROCEED_WITH_FIXES):
352+
- Fix high-priority issues before execution
353+
- Use TodoWrite to systematically track and complete improvements
354+
355+
**If Only MEDIUM/LOW Issues** (PROCEED_WITH_CAUTION / PROCEED):
356+
- Can proceed with execution
357+
- Address issues during or after implementation
333358

334359
#### TodoWrite-Based Remediation Workflow
335360

@@ -359,13 +384,18 @@ Priority Order:
359384

360385
### 7. Save Report and Execute TodoWrite-Based Remediation
361386

362-
**Save Analysis Report**:
387+
**Step 7.1: Save Analysis Report**:
363388
```bash
364389
report_path = ".workflow/active/WFS-{session}/.process/ACTION_PLAN_VERIFICATION.md"
365390
Write(report_path, full_report_content)
366391
```
367392

368-
**After Report Generation**:
393+
**Step 7.2: Display Report Summary to User**:
394+
- Show executive summary with counts
395+
- Display recommendation (BLOCK/PROCEED_WITH_FIXES/PROCEED_WITH_CAUTION/PROCEED)
396+
- List critical and high issues if any
397+
398+
**Step 7.3: After Report Generation**:
369399

370400
1. **Extract Findings**: Parse all issues by severity
371401
2. **Create TodoWrite Task List**: Convert findings to actionable todos

.claude/commands/workflow/execute.md

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Orchestrates autonomous workflow execution through systematic task discovery, ag
1616
**Lazy Loading**: Task JSONs read **on-demand** during execution, not upfront. TODO_LIST.md + IMPL_PLAN.md provide metadata for planning.
1717

1818
**Loading Strategy**:
19-
- **TODO_LIST.md**: Read in Phase 2 (task metadata, status, dependencies)
20-
- **IMPL_PLAN.md**: Read existence in Phase 2, parse execution strategy when needed
21-
- **Task JSONs**: Complete lazy loading (read only during execution)
19+
- **TODO_LIST.md**: Read in Phase 3 (task metadata, status, dependencies for TodoWrite generation)
20+
- **IMPL_PLAN.md**: Check existence in Phase 2 (normal mode), parse execution strategy in Phase 4A
21+
- **Task JSONs**: Lazy loading - read only when task is about to execute (Phase 4B)
2222

2323
## Core Rules
2424
**Complete entire workflow autonomously without user interruption, using TodoWrite for comprehensive progress tracking.**
@@ -39,6 +39,48 @@ Orchestrates autonomous workflow execution through systematic task discovery, ag
3939
- **Progress tracking**: Continuous TodoWrite updates throughout entire workflow execution
4040
- **Autonomous completion**: Execute all tasks without user interruption until workflow complete
4141

42+
## Execution Process
43+
44+
```
45+
Normal Mode:
46+
Phase 1: Discovery
47+
├─ Count active sessions
48+
└─ Decision:
49+
├─ count=0 → ERROR: No active sessions
50+
├─ count=1 → Auto-select session → Phase 2
51+
└─ count>1 → AskUserQuestion (max 4 options) → Phase 2
52+
53+
Phase 2: Planning Document Validation
54+
├─ Check IMPL_PLAN.md exists
55+
├─ Check TODO_LIST.md exists
56+
└─ Validate .task/ contains IMPL-*.json files
57+
58+
Phase 3: TodoWrite Generation
59+
├─ Parse TODO_LIST.md for task statuses
60+
├─ Generate TodoWrite for entire workflow
61+
└─ Prepare session context paths
62+
63+
Phase 4: Execution Strategy & Task Execution
64+
├─ Step 4A: Parse execution strategy from IMPL_PLAN.md
65+
└─ Step 4B: Execute tasks with lazy loading
66+
└─ Loop:
67+
├─ Get next in_progress task from TodoWrite
68+
├─ Lazy load task JSON
69+
├─ Launch agent with task context
70+
├─ Mark task completed
71+
└─ Advance to next task
72+
73+
Phase 5: Completion
74+
├─ Update task statuses in JSON files
75+
├─ Generate summaries
76+
└─ Auto-call /workflow:session:complete
77+
78+
Resume Mode (--resume-session):
79+
├─ Skip Phase 1 & Phase 2
80+
└─ Entry Point: Phase 3 (TodoWrite Generation)
81+
└─ Continue: Phase 4 → Phase 5
82+
```
83+
4284
## Execution Lifecycle
4385

4486
### Phase 1: Discovery
@@ -81,15 +123,30 @@ bash(for dir in .workflow/active/WFS-*/; do
81123
done)
82124
```
83125

84-
Use AskUserQuestion to present formatted options:
126+
Use AskUserQuestion to present formatted options (max 4 options shown):
127+
```javascript
128+
// If more than 4 sessions, show most recent 4 with "Other" option for manual input
129+
const sessions = getActiveSessions() // sorted by last modified
130+
const displaySessions = sessions.slice(0, 4)
131+
132+
AskUserQuestion({
133+
questions: [{
134+
question: "Multiple active sessions detected. Select one:",
135+
header: "Session",
136+
multiSelect: false,
137+
options: displaySessions.map(s => ({
138+
label: s.id,
139+
description: `${s.project} | ${s.progress}`
140+
}))
141+
// Note: User can select "Other" to manually enter session ID
142+
}]
143+
})
85144
```
86-
Multiple active workflow sessions detected. Please select one:
87-
88-
1. WFS-auth-system | Authentication System | 3/5 tasks (60%)
89-
2. WFS-payment-module | Payment Integration | 0/8 tasks (0%)
90145

91-
Enter number, full session ID, or partial match:
92-
```
146+
**Input Validation**:
147+
- If user selects from options: Use selected session ID
148+
- If user selects "Other" and provides input: Validate session exists
149+
- If validation fails: Show error and re-prompt or suggest available sessions
93150

94151
Parse user input (supports: number "1", full ID "WFS-auth-system", or partial "auth"), validate selection, and continue to Phase 2.
95152

@@ -103,20 +160,19 @@ bash(cat .workflow/active/${sessionId}/workflow-session.json)
103160

104161
**Resume Mode**: This entire phase is skipped when `--resume-session="session-id"` flag is provided.
105162

106-
### Phase 2: Planning Document Analysis
163+
### Phase 2: Planning Document Validation
107164
**Applies to**: Normal mode only (skipped in resume mode)
108165

109-
**Optimized to avoid reading all task JSONs upfront**
166+
**Purpose**: Validate planning artifacts exist before execution
110167

111168
**Process**:
112-
1. **Check IMPL_PLAN.md**: Verify file exists and has valid structure (defer detailed parsing to Phase 4)
113-
2. **Read TODO_LIST.md**: Get current task statuses and execution progress
114-
3. **Extract Task Metadata**: Parse task IDs, titles, and dependency relationships from TODO_LIST.md
115-
4. **Build Execution Queue**: Determine ready tasks based on TODO_LIST.md status and dependencies
169+
1. **Check IMPL_PLAN.md**: Verify file exists (defer detailed parsing to Phase 4A)
170+
2. **Check TODO_LIST.md**: Verify file exists (defer reading to Phase 3)
171+
3. **Validate Task Directory**: Ensure `.task/` contains at least one IMPL-*.json file
116172

117-
**Key Optimization**: Use IMPL_PLAN.md (existence check only) and TODO_LIST.md as primary sources instead of reading all task JSONs. Detailed IMPL_PLAN.md parsing happens in Phase 4A.
173+
**Key Optimization**: Only existence checks here. Actual file reading happens in later phases.
118174

119-
**Resume Mode**: When `--resume-session` flag is provided, **session discovery** (Phase 1) is skipped, but **task metadata loading** (TODO_LIST.md reading) still occurs in Phase 3 for TodoWrite generation.
175+
**Resume Mode**: This phase is skipped when `--resume-session` flag is provided. Resume mode entry point is Phase 3.
120176

121177
### Phase 3: TodoWrite Generation
122178
**Applies to**: Both normal and resume modes (resume mode entry point)
@@ -156,7 +212,7 @@ If IMPL_PLAN.md lacks execution strategy, use intelligent fallback (analyze task
156212
```
157213
while (TODO_LIST.md has pending tasks) {
158214
next_task_id = getTodoWriteInProgressTask()
159-
task_json = Read(.workflow/session/{session}/.task/{next_task_id}.json) // Lazy load
215+
task_json = Read(.workflow/active/{session}/.task/{next_task_id}.json) // Lazy load
160216
executeTaskWithAgent(task_json)
161217
updateTodoListMarkCompleted(next_task_id)
162218
advanceTodoWriteToNextTask()

.claude/commands/workflow/init.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,40 @@ Initialize `.workflow/project.json` with comprehensive project understanding by
2020
/workflow:init --regenerate # Force regeneration
2121
```
2222

23+
## Execution Process
24+
25+
```
26+
Input Parsing:
27+
└─ Parse --regenerate flag → regenerate = true | false
28+
29+
Decision:
30+
├─ EXISTS + no --regenerate → Exit: "Already initialized"
31+
├─ EXISTS + --regenerate → Backup existing → Continue analysis
32+
└─ NOT_FOUND → Continue analysis
33+
34+
Analysis Flow:
35+
├─ Get project metadata (name, root)
36+
├─ Invoke cli-explore-agent
37+
│ ├─ Structural scan (get_modules_by_depth.sh, find, wc)
38+
│ ├─ Semantic analysis (Gemini CLI)
39+
│ ├─ Synthesis and merge
40+
│ └─ Write .workflow/project.json
41+
└─ Display summary
42+
43+
Output:
44+
└─ .workflow/project.json (+ .backup if regenerate)
45+
```
46+
2347
## Implementation
2448

25-
### Step 1: Check Existing State
49+
### Step 1: Parse Input and Check Existing State
50+
51+
**Parse --regenerate flag**:
52+
```javascript
53+
const regenerate = $ARGUMENTS.includes('--regenerate')
54+
```
55+
56+
**Check existing state**:
2657

2758
```bash
2859
bash(test -f .workflow/project.json && echo "EXISTS" || echo "NOT_FOUND")
@@ -59,8 +90,9 @@ Task(
5990
prompt=`
6091
Analyze project for workflow initialization and generate .workflow/project.json.
6192
62-
## Output Schema Reference
63-
~/.claude/workflows/cli-templates/schemas/project-json-schema.json
93+
## MANDATORY FIRST STEPS
94+
1. Execute: cat ~/.claude/workflows/cli-templates/schemas/project-json-schema.json (get schema reference)
95+
2. Execute: ~/.claude/scripts/get_modules_by_depth.sh (get project structure)
6496
6597
## Task
6698
Generate complete project.json with:

0 commit comments

Comments
 (0)