claude-code-workflow 6.3.39 → 6.3.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1040 @@
1
+ ---
2
+ name: develop-with-file
3
+ description: Multi-agent development workflow with documented progress, Gemini-guided planning, and incremental iteration support
4
+ argument-hint: "\"feature description or task file.md\""
5
+ allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*)
6
+ ---
7
+
8
+ # Workflow Develop-With-File Command (/workflow:develop-with-file)
9
+
10
+ ## Overview
11
+
12
+ Production-grade development workflow with **2-document state tracking**. Combines multi-agent parallel exploration, Gemini-assisted planning/verification, and incremental iteration in a single coherent workflow.
13
+
14
+ **Core workflow**: Explore → Plan → Execute → Verify → Iterate
15
+
16
+ **Key features**:
17
+ - **progress.md**: Single source of truth for exploration, planning, execution timeline
18
+ - **plan.json**: Current execution plan (derived from progress.md)
19
+ - **Multi-agent exploration**: Parallel cli-explore-agents from multiple angles
20
+ - **Multi-CLI execution**: Support gemini/codex/agent per task
21
+ - **Gemini-guided planning**: Intelligent task decomposition and validation
22
+ - **Gemini verification**: Post-execution review and correction
23
+ - **Incremental iteration**: Resume from any phase, add new tasks dynamically
24
+
25
+ ## Usage
26
+
27
+ ```bash
28
+ /workflow:develop-with-file [FLAGS] <TASK_DESCRIPTION>
29
+
30
+ # Flags
31
+ -e, --explore Force exploration phase
32
+ --resume <session-id> Resume existing session
33
+
34
+ # Arguments
35
+ <task-description> Feature description or path to .md file (required)
36
+ ```
37
+
38
+ ## Execution Process
39
+
40
+ ```
41
+ Session Detection:
42
+ ├─ Check if session exists (--resume or auto-detect)
43
+ ├─ EXISTS → Continue mode (read progress.md for current phase)
44
+ └─ NOT_FOUND → Explore mode
45
+
46
+ Explore Mode (Multi-Agent):
47
+ ├─ Assess task complexity (Low/Medium/High)
48
+ ├─ Launch 1-4 parallel cli-explore-agents (angle-based)
49
+ ├─ Aggregate exploration results
50
+ ├─ Document in progress.md → Exploration section
51
+ └─ Transition → Plan mode
52
+
53
+ Plan Mode (Gemini-Guided):
54
+ ├─ Read progress.md exploration findings
55
+ ├─ Invoke Gemini for task decomposition
56
+ ├─ Generate plan.json (2-7 tasks with dependencies)
57
+ ├─ Assign executor per task (gemini/codex/agent)
58
+ ├─ Document in progress.md → Planning section
59
+ ├─ User confirmation (Allow/Modify/Cancel)
60
+ └─ Transition → Execute mode
61
+
62
+ Execute Mode (Multi-Agent/CLI):
63
+ ├─ For each task in plan.json:
64
+ │ ├─ Check dependencies (wait if needed)
65
+ │ ├─ Execute via assigned executor (agent/gemini/codex)
66
+ │ ├─ Document progress in progress.md → Execution section
67
+ │ └─ Handle failures (retry/skip/abort)
68
+ ├─ Aggregate execution results
69
+ └─ Transition → Verify mode
70
+
71
+ Verify Mode (Gemini-Assisted):
72
+ ├─ Invoke Gemini CLI for code review
73
+ ├─ Analyze: correctness, style, potential issues
74
+ ├─ Document in progress.md → Verification section
75
+ ├─ Decision:
76
+ │ ├─ All passed → Complete
77
+ │ ├─ Minor issues → Document corrections, iterate
78
+ │ └─ Major issues → Rollback, re-plan
79
+ └─ Transition → Iterate or Complete
80
+
81
+ Iterate Mode (Incremental):
82
+ ├─ User provides new requirements or fixes
83
+ ├─ Read progress.md for current state
84
+ ├─ Gemini analyzes delta (what changed?)
85
+ ├─ Generate incremental tasks, append to plan.json
86
+ ├─ Update progress.md → New iteration section
87
+ └─ Transition → Execute mode (incremental tasks only)
88
+ ```
89
+
90
+ ## Implementation
91
+
92
+ ### Session Setup & Mode Detection
93
+
94
+ ```javascript
95
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
96
+
97
+ const taskSlug = task_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
98
+ const dateStr = getUtc8ISOString().substring(0, 10)
99
+
100
+ const sessionId = flags.resume || `DEV-${taskSlug}-${dateStr}`
101
+ const sessionFolder = `.workflow/.develop/${sessionId}`
102
+ const progressPath = `${sessionFolder}/progress.md`
103
+ const planPath = `${sessionFolder}/plan.json`
104
+
105
+ // Auto-detect mode
106
+ const sessionExists = fs.existsSync(sessionFolder)
107
+ const hasProgress = sessionExists && fs.existsSync(progressPath)
108
+ const hasPlan = sessionExists && fs.existsSync(planPath)
109
+
110
+ let mode = 'explore'
111
+ if (hasProgress) {
112
+ const progress = Read(progressPath)
113
+ // Parse progress.md to determine current phase
114
+ if (progress.includes('## Verification Results')) mode = 'iterate'
115
+ else if (progress.includes('## Execution Timeline')) mode = 'verify'
116
+ else if (progress.includes('## Planning Results')) mode = 'execute'
117
+ else if (progress.includes('## Exploration Results')) mode = 'plan'
118
+ }
119
+
120
+ if (!sessionExists) {
121
+ bash(`mkdir -p ${sessionFolder}`)
122
+ }
123
+
124
+ console.log(`
125
+ ## Session Info
126
+ - Session ID: ${sessionId}
127
+ - Mode: ${mode}
128
+ - Folder: ${sessionFolder}
129
+ `)
130
+ ```
131
+
132
+ ---
133
+
134
+ ### Explore Mode (Multi-Agent Parallel)
135
+
136
+ **Step 1.1: Complexity Assessment**
137
+
138
+ ```javascript
139
+ // Analyze task complexity based on:
140
+ // - Scope: How many systems/modules affected?
141
+ // - Depth: Surface change vs architectural impact?
142
+ // - Risk: Potential for breaking existing functionality?
143
+ // - Dependencies: How interconnected is the change?
144
+
145
+ const complexity = analyzeTaskComplexity(task_description)
146
+ // Returns: 'Low' (1 angle) | 'Medium' (2-3 angles) | 'High' (4 angles)
147
+
148
+ const ANGLE_PRESETS = {
149
+ architecture: ['architecture', 'dependencies', 'modularity', 'integration-points'],
150
+ feature: ['patterns', 'integration-points', 'testing', 'dependencies'],
151
+ bugfix: ['error-handling', 'dataflow', 'state-management', 'edge-cases'],
152
+ refactor: ['code-quality', 'patterns', 'dependencies', 'testing']
153
+ }
154
+
155
+ function selectAngles(taskDescription, complexity) {
156
+ const text = taskDescription.toLowerCase()
157
+ let preset = 'feature' // default
158
+
159
+ if (/refactor|architect|restructure/.test(text)) preset = 'architecture'
160
+ else if (/fix|bug|error|issue/.test(text)) preset = 'bugfix'
161
+ else if (/clean|improve|simplify/.test(text)) preset = 'refactor'
162
+
163
+ const count = complexity === 'High' ? 4 : (complexity === 'Medium' ? 3 : 1)
164
+ return ANGLE_PRESETS[preset].slice(0, count)
165
+ }
166
+
167
+ const selectedAngles = selectAngles(task_description, complexity)
168
+ ```
169
+
170
+ **Step 1.2: Launch Parallel Explorations**
171
+
172
+ ```javascript
173
+ // Launch agents with pre-assigned angles
174
+ const explorationTasks = selectedAngles.map((angle, index) =>
175
+ Task(
176
+ subagent_type="cli-explore-agent",
177
+ run_in_background=false, // ⚠️ MANDATORY: Must wait for results
178
+ description=`Explore: ${angle}`,
179
+ prompt=`
180
+ ## Task Objective
181
+ Execute **${angle}** exploration for development planning context.
182
+
183
+ ## Assigned Context
184
+ - **Exploration Angle**: ${angle}
185
+ - **Task Description**: ${task_description}
186
+ - **Output File**: ${sessionFolder}/exploration-${angle}.json
187
+
188
+ ## MANDATORY FIRST STEPS
189
+ 1. cat ~/.claude/workflows/cli-templates/schemas/explore-json-schema.json (schema)
190
+ 2. ccw tool exec get_modules_by_depth '{}' (project structure)
191
+ 3. Read .workflow/project-tech.json (tech stack)
192
+ 4. Read .workflow/project-guidelines.json (constraints)
193
+
194
+ ## Exploration Strategy (${angle} focus)
195
+
196
+ **Structural Scan** (Bash):
197
+ - get_modules_by_depth.sh → modules related to ${angle}
198
+ - rg -l "{keywords}" --type ts → locate relevant files
199
+ - Analyze imports/dependencies from ${angle} perspective
200
+
201
+ **Semantic Analysis** (Gemini CLI):
202
+ - ccw cli -p "PURPOSE: Analyze ${angle} aspect for: ${task_description}
203
+ TASK: • Identify ${angle} patterns • Locate integration points • List constraints
204
+ MODE: analysis
205
+ CONTEXT: @**/* | Task: ${task_description}
206
+ EXPECTED: ${angle} findings with file:line references
207
+ CONSTRAINTS: Focus on ${angle}" --tool gemini --mode analysis
208
+
209
+ **Output**: ${sessionFolder}/exploration-${angle}.json (follow schema)
210
+
211
+ ## Required Fields
212
+ - project_structure: ${angle}-relevant modules
213
+ - relevant_files: [{path, relevance (0-1), rationale}]
214
+ - patterns: ${angle} patterns with code examples
215
+ - integration_points: Where to integrate (file:line)
216
+ - constraints: ${angle}-specific limitations
217
+ - clarification_needs: [{question, context, options, recommended}]
218
+ - _metadata.exploration_angle: "${angle}"
219
+
220
+ ## Success Criteria
221
+ - Schema validated
222
+ - ≥3 relevant files with rationale
223
+ - Integration points with file:line
224
+ - Actionable patterns (code examples)
225
+ - JSON output matches schema
226
+ `
227
+ )
228
+ )
229
+
230
+ // Execute all explorations
231
+ ```
232
+
233
+ **Step 1.3: Aggregate Exploration Results**
234
+
235
+ ```javascript
236
+ // Auto-discover exploration files
237
+ const explorationFiles = bash(`find ${sessionFolder} -name "exploration-*.json" -type f`)
238
+ .split('\n')
239
+ .filter(f => f.trim())
240
+
241
+ const explorations = explorationFiles.map(file => {
242
+ const data = JSON.parse(Read(file))
243
+ return {
244
+ angle: data._metadata.exploration_angle,
245
+ data: data
246
+ }
247
+ })
248
+
249
+ // Aggregate clarification needs
250
+ const allClarifications = []
251
+ explorations.forEach(exp => {
252
+ if (exp.data.clarification_needs?.length > 0) {
253
+ exp.data.clarification_needs.forEach(need => {
254
+ allClarifications.push({ ...need, source_angle: exp.angle })
255
+ })
256
+ }
257
+ })
258
+
259
+ // Intelligent deduplication
260
+ const dedupedClarifications = intelligentMerge(allClarifications)
261
+
262
+ // Multi-round clarification (max 4 questions per round)
263
+ if (dedupedClarifications.length > 0) {
264
+ const BATCH_SIZE = 4
265
+ for (let i = 0; i < dedupedClarifications.length; i += BATCH_SIZE) {
266
+ const batch = dedupedClarifications.slice(i, i + BATCH_SIZE)
267
+ AskUserQuestion({
268
+ questions: batch.map(need => ({
269
+ question: `[${need.source_angle}] ${need.question}`,
270
+ header: need.source_angle.substring(0, 12),
271
+ multiSelect: false,
272
+ options: need.options.map((opt, idx) => ({
273
+ label: need.recommended === idx ? `${opt} ★` : opt,
274
+ description: need.recommended === idx ? "Recommended" : `Use ${opt}`
275
+ }))
276
+ }))
277
+ })
278
+ }
279
+ }
280
+ ```
281
+
282
+ **Step 1.4: Document in progress.md**
283
+
284
+ Create or update `progress.md`:
285
+
286
+ ```markdown
287
+ # Development Progress
288
+
289
+ **Session ID**: ${sessionId}
290
+ **Task Description**: ${task_description}
291
+ **Started**: ${getUtc8ISOString()}
292
+ **Complexity**: ${complexity}
293
+
294
+ ---
295
+
296
+ ## Exploration Results
297
+
298
+ ### Exploration Summary (${getUtc8ISOString()})
299
+
300
+ **Angles Explored**: ${selectedAngles.join(', ')}
301
+ **Exploration Count**: ${explorations.length}
302
+
303
+ ${explorations.map(exp => `
304
+ #### ${exp.angle.toUpperCase()}
305
+
306
+ **Relevant Files** (top 5):
307
+ ${exp.data.relevant_files.slice(0, 5).map(f =>
308
+ `- ${f.path} (${(f.relevance * 100).toFixed(0)}%) - ${f.rationale}`
309
+ ).join('\n')}
310
+
311
+ **Integration Points**:
312
+ ${exp.data.integration_points.map(p => `- ${p}`).join('\n')}
313
+
314
+ **Patterns**:
315
+ ${exp.data.patterns.map(p => `- ${p}`).join('\n')}
316
+
317
+ **Constraints**:
318
+ ${exp.data.constraints.map(c => `- ${c}`).join('\n')}
319
+ `).join('\n')}
320
+
321
+ ### Clarifications Collected
322
+
323
+ ${dedupedClarifications.length > 0 ? dedupedClarifications.map((c, i) => `
324
+ ${i+1}. **[${c.source_angle}]** ${c.question}
325
+ - Answer: ${c.user_answer || 'Pending'}
326
+ `).join('\n') : 'No clarifications needed'}
327
+
328
+ ---
329
+
330
+ ## Current State
331
+
332
+ **Phase**: Exploration complete, ready for planning
333
+ **Next Steps**: Invoke Gemini for task decomposition
334
+ ```
335
+
336
+ ---
337
+
338
+ ### Plan Mode (Gemini-Guided)
339
+
340
+ **Step 2.1: Gemini-Assisted Planning**
341
+
342
+ ```bash
343
+ ccw cli -p "
344
+ PURPOSE: Generate implementation plan for: ${task_description}
345
+ Success criteria: 2-7 structured tasks with clear dependencies, executor assignments
346
+
347
+ TASK:
348
+ • Read progress.md exploration findings (all angles)
349
+ • Analyze task requirements and constraints
350
+ • Decompose into 2-7 substantial tasks (15-60min each)
351
+ • Assign executor per task (gemini/codex/agent) based on:
352
+ - User explicit mention (\"use gemini for X\")
353
+ - Task nature (analysis → gemini, implementation → agent, git-aware → codex)
354
+ - Default → agent
355
+ • Define true dependencies only (Task B needs Task A's output)
356
+ • Group by feature/module, NOT by file
357
+
358
+ MODE: analysis
359
+
360
+ CONTEXT: @${progressPath} | Exploration findings in progress.md
361
+
362
+ EXPECTED:
363
+ - plan.json following schema (cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json)
364
+ - tasks: [{id, title, description, files, executor (gemini/codex/agent), depends_on, complexity}]
365
+ - executorAssignments: {taskId: {executor, reason}}
366
+ - estimated_time, complexity, summary, approach
367
+
368
+ CONSTRAINTS:
369
+ - Respect project-guidelines.json constraints
370
+ - Prefer parallel tasks (minimal depends_on)
371
+ - Group related changes into single task
372
+ - Explicit executor rationale
373
+ " --tool gemini --mode analysis --rule planning-breakdown-task-steps
374
+ ```
375
+
376
+ **Step 2.2: Parse Gemini Output → plan.json**
377
+
378
+ ```javascript
379
+ // Gemini returns plan structure
380
+ const planFromGemini = parseGeminiOutput()
381
+
382
+ const plan = {
383
+ summary: planFromGemini.summary,
384
+ approach: planFromGemini.approach,
385
+ tasks: planFromGemini.tasks.map(t => ({
386
+ id: t.id,
387
+ title: t.title,
388
+ description: t.description,
389
+ files: t.files,
390
+ executor: t.executor || 'agent', // gemini/codex/agent
391
+ depends_on: t.depends_on || [],
392
+ complexity: t.complexity,
393
+ status: 'pending' // pending/in_progress/completed/failed
394
+ })),
395
+ executorAssignments: planFromGemini.executorAssignments || {},
396
+ estimated_time: planFromGemini.estimated_time,
397
+ complexity: complexity,
398
+ _metadata: {
399
+ timestamp: getUtc8ISOString(),
400
+ source: 'gemini-planning',
401
+ exploration_angles: selectedAngles
402
+ }
403
+ }
404
+
405
+ Write(planPath, JSON.stringify(plan, null, 2))
406
+ ```
407
+
408
+ **Step 2.3: Update progress.md**
409
+
410
+ Append to `progress.md`:
411
+
412
+ ```markdown
413
+ ## Planning Results
414
+
415
+ ### Plan Generated (${getUtc8ISOString()})
416
+
417
+ **Summary**: ${plan.summary}
418
+ **Approach**: ${plan.approach}
419
+ **Estimated Time**: ${plan.estimated_time}
420
+ **Complexity**: ${plan.complexity}
421
+
422
+ **Tasks** (${plan.tasks.length}):
423
+
424
+ ${plan.tasks.map((t, i) => `
425
+ ${i+1}. **${t.id}**: ${t.title}
426
+ - Files: ${t.files.join(', ')}
427
+ - Executor: ${t.executor}
428
+ - Depends on: ${t.depends_on.join(', ') || 'None'}
429
+ - Complexity: ${t.complexity}
430
+ `).join('\n')}
431
+
432
+ **Executor Assignments**:
433
+ ${Object.entries(plan.executorAssignments).map(([id, assign]) =>
434
+ `- ${id}: ${assign.executor} (Reason: ${assign.reason})`
435
+ ).join('\n')}
436
+
437
+ **Gemini Insights**:
438
+ ${planFromGemini.gemini_insights || 'N/A'}
439
+
440
+ ---
441
+
442
+ ## Current State
443
+
444
+ **Phase**: Planning complete, awaiting user confirmation
445
+ **Next Steps**: User confirms → Execute tasks
446
+ ```
447
+
448
+ **Step 2.4: User Confirmation**
449
+
450
+ ```javascript
451
+ AskUserQuestion({
452
+ questions: [
453
+ {
454
+ question: `Confirm plan? (${plan.tasks.length} tasks, ${plan.complexity})`,
455
+ header: "Confirm",
456
+ multiSelect: false,
457
+ options: [
458
+ { label: "Allow", description: "Proceed as-is" },
459
+ { label: "Modify", description: "Adjust tasks/executors" },
460
+ { label: "Cancel", description: "Abort workflow" }
461
+ ]
462
+ }
463
+ ]
464
+ })
465
+
466
+ // If Modify → allow editing plan.json, re-confirm
467
+ // If Allow → proceed to Execute mode
468
+ ```
469
+
470
+ ---
471
+
472
+ ### Execute Mode (Multi-Agent/CLI)
473
+
474
+ **Step 3.1: Task Execution Loop**
475
+
476
+ ```javascript
477
+ const plan = JSON.parse(Read(planPath))
478
+ const completedTasks = []
479
+ const failedTasks = []
480
+
481
+ for (const task of plan.tasks) {
482
+ // Check dependencies
483
+ const depsCompleted = task.depends_on.every(depId =>
484
+ completedTasks.some(t => t.id === depId)
485
+ )
486
+
487
+ if (!depsCompleted) {
488
+ console.log(`⏸️ Task ${task.id} waiting for dependencies: ${task.depends_on.join(', ')}`)
489
+ continue
490
+ }
491
+
492
+ console.log(`\n## Executing Task: ${task.id} (${task.executor})\n`)
493
+
494
+ // Update progress.md
495
+ appendToProgress(`
496
+ ### Task ${task.id} - ${task.title} (${getUtc8ISOString()})
497
+
498
+ **Status**: In Progress
499
+ **Executor**: ${task.executor}
500
+ **Files**: ${task.files.join(', ')}
501
+ `)
502
+
503
+ // Execute based on assigned executor
504
+ try {
505
+ if (task.executor === 'gemini') {
506
+ // Gemini CLI execution
507
+ bash(`ccw cli -p "
508
+ PURPOSE: ${task.description}
509
+ TASK: Implement changes in: ${task.files.join(', ')}
510
+ MODE: write
511
+ CONTEXT: @${task.files.join(' @')} | Memory: Task ${task.id} from ${sessionId}
512
+ EXPECTED: Code implementation following project patterns
513
+ CONSTRAINTS: ${task.constraints || 'Follow project-guidelines.json'}
514
+ " --tool gemini --mode write --cd ${sessionFolder}`, run_in_background=true)
515
+
516
+ // Wait for callback
517
+
518
+ } else if (task.executor === 'codex') {
519
+ // Codex CLI execution
520
+ bash(`ccw cli -p "
521
+ ${task.description}
522
+
523
+ Files to modify: ${task.files.join(', ')}
524
+ " --tool codex --mode write`, run_in_background=true)
525
+
526
+ // Wait for callback
527
+
528
+ } else {
529
+ // Agent execution
530
+ Task(
531
+ subagent_type="code-developer",
532
+ run_in_background=false,
533
+ description=`Execute task ${task.id}`,
534
+ prompt=`
535
+ ## Task: ${task.title}
536
+
537
+ ${task.description}
538
+
539
+ ## Context from Exploration
540
+ Read ${progressPath} for exploration findings relevant to:
541
+ ${task.files.map(f => `- ${f}`).join('\n')}
542
+
543
+ ## Files to Modify
544
+ ${task.files.join('\n')}
545
+
546
+ ## Constraints
547
+ - Follow patterns identified in exploration
548
+ - Respect project-guidelines.json
549
+ - Write tests if applicable
550
+
551
+ ## Success Criteria
552
+ - Code compiles without errors
553
+ - Tests pass (if applicable)
554
+ - Follows existing code style
555
+ `
556
+ )
557
+ }
558
+
559
+ // Mark completed
560
+ task.status = 'completed'
561
+ completedTasks.push(task)
562
+
563
+ appendToProgress(`
564
+ **Status**: ✅ Completed
565
+ **Output**: ${task.output || 'Code changes applied'}
566
+ `)
567
+
568
+ } catch (error) {
569
+ task.status = 'failed'
570
+ failedTasks.push(task)
571
+
572
+ appendToProgress(`
573
+ **Status**: ❌ Failed
574
+ **Error**: ${error.message}
575
+ `)
576
+
577
+ // Ask user: retry/skip/abort
578
+ AskUserQuestion({
579
+ questions: [{
580
+ question: `Task ${task.id} failed. How to proceed?`,
581
+ header: "Error",
582
+ multiSelect: false,
583
+ options: [
584
+ { label: "Retry", description: "Retry with same executor" },
585
+ { label: "Skip", description: "Skip and continue" },
586
+ { label: "Abort", description: "Stop workflow" }
587
+ ]
588
+ }]
589
+ })
590
+ }
591
+
592
+ // Update plan.json
593
+ Write(planPath, JSON.stringify(plan, null, 2))
594
+ }
595
+
596
+ // Final summary
597
+ appendToProgress(`
598
+ ---
599
+
600
+ ## Execution Summary (${getUtc8ISOString()})
601
+
602
+ **Total Tasks**: ${plan.tasks.length}
603
+ **Completed**: ${completedTasks.length}
604
+ **Failed**: ${failedTasks.length}
605
+
606
+ ${failedTasks.length > 0 ? `
607
+ **Failed Tasks**:
608
+ ${failedTasks.map(t => `- ${t.id}: ${t.title}`).join('\n')}
609
+ ` : ''}
610
+
611
+ ---
612
+
613
+ ## Current State
614
+
615
+ **Phase**: Execution complete, ready for verification
616
+ **Next Steps**: Invoke Gemini for code review
617
+ `)
618
+ ```
619
+
620
+ ---
621
+
622
+ ### Verify Mode (Gemini-Assisted)
623
+
624
+ **Step 4.1: Gemini Code Review**
625
+
626
+ ```bash
627
+ ccw cli -p "
628
+ PURPOSE: Review code changes from development session ${sessionId}
629
+ Success criteria: Identify issues, validate correctness, suggest improvements
630
+
631
+ TASK:
632
+ • Review all modified files from execution
633
+ • Check: correctness, style consistency, potential bugs, test coverage
634
+ • Validate against project-guidelines.json
635
+ • Provide actionable feedback with file:line references
636
+
637
+ MODE: review
638
+
639
+ CONTEXT: @${progressPath} | Execution results in progress.md
640
+
641
+ EXPECTED:
642
+ - Review report with severity levels (Critical/High/Medium/Low)
643
+ - Issues with file:line references and fix suggestions
644
+ - Overall quality score (1-10)
645
+ - Recommendations for improvements
646
+
647
+ CONSTRAINTS: Evidence-based feedback only
648
+ " --tool gemini --mode review
649
+ ```
650
+
651
+ **Step 4.2: Parse Review Results**
652
+
653
+ ```javascript
654
+ const reviewResults = parseGeminiReview()
655
+
656
+ const hasBlockers = reviewResults.issues.some(i => i.severity === 'Critical')
657
+ const hasMajorIssues = reviewResults.issues.some(i => i.severity === 'High')
658
+ ```
659
+
660
+ **Step 4.3: Update progress.md**
661
+
662
+ Append to `progress.md`:
663
+
664
+ ```markdown
665
+ ## Verification Results
666
+
667
+ ### Code Review (${getUtc8ISOString()})
668
+
669
+ **Reviewer**: Gemini
670
+ **Quality Score**: ${reviewResults.quality_score}/10
671
+
672
+ **Issues Found** (${reviewResults.issues.length}):
673
+
674
+ ${reviewResults.issues.map(issue => `
675
+ #### ${issue.severity}: ${issue.title}
676
+ - **File**: ${issue.file}:${issue.line}
677
+ - **Description**: ${issue.description}
678
+ - **Suggested Fix**:
679
+ \`\`\`${issue.language || 'typescript'}
680
+ ${issue.suggested_fix}
681
+ \`\`\`
682
+ `).join('\n')}
683
+
684
+ ${reviewResults.issues.length === 0 ? '✅ No issues found. Code review passed.' : ''}
685
+
686
+ **Recommendations**:
687
+ ${reviewResults.recommendations.map(r => `- ${r}`).join('\n')}
688
+
689
+ **Gemini Analysis**:
690
+ ${reviewResults.gemini_analysis}
691
+
692
+ ---
693
+
694
+ ## Current State
695
+
696
+ **Phase**: Verification complete
697
+ **Decision**: ${hasBlockers ? 'BLOCKERS FOUND - Fix required' : (hasMajorIssues ? 'Major issues - Recommend fixing' : 'PASSED - Ready to commit')}
698
+ ```
699
+
700
+ **Step 4.4: Decision**
701
+
702
+ ```javascript
703
+ if (hasBlockers) {
704
+ // Critical issues → must fix before commit
705
+ console.log(`
706
+ ❌ Critical issues found. Transitioning to Iterate mode for fixes.
707
+ `)
708
+ mode = 'iterate'
709
+
710
+ } else if (hasMajorIssues) {
711
+ // Ask user
712
+ AskUserQuestion({
713
+ questions: [{
714
+ question: "High severity issues found. How to proceed?",
715
+ header: "Review",
716
+ multiSelect: false,
717
+ options: [
718
+ { label: "Fix Issues", description: "Iterate to fix high severity issues" },
719
+ { label: "Accept As-Is", description: "Proceed despite issues" },
720
+ { label: "Manual Review", description: "Stop and review manually" }
721
+ ]
722
+ }]
723
+ })
724
+
725
+ } else {
726
+ // All passed
727
+ console.log(`
728
+ ✅ Code review passed. Development complete.
729
+
730
+ Session artifacts saved in: ${sessionFolder}
731
+ - progress.md: Full development timeline
732
+ - plan.json: Execution plan
733
+
734
+ Run \`/workflow:develop-with-file --resume ${sessionId}\` to iterate.
735
+ `)
736
+ }
737
+ ```
738
+
739
+ ---
740
+
741
+ ### Iterate Mode (Incremental)
742
+
743
+ **Step 5.1: Analyze Delta**
744
+
745
+ User provides new requirements or fix instructions:
746
+
747
+ ```bash
748
+ ccw cli -p "
749
+ PURPOSE: Analyze incremental changes for session ${sessionId}
750
+ Success criteria: Identify minimal tasks to address new requirements
751
+
752
+ TASK:
753
+ • Read progress.md for current state
754
+ • Compare new requirements with existing implementation
755
+ • Identify delta (what changed?)
756
+ • Generate incremental tasks (append to existing plan)
757
+
758
+ MODE: analysis
759
+
760
+ CONTEXT:
761
+ @${progressPath}
762
+ @${planPath}
763
+ | New requirements: ${new_requirements}
764
+
765
+ EXPECTED:
766
+ - Delta analysis (what's new, what needs changing)
767
+ - Incremental tasks [{id, title, description, files, executor}]
768
+ - Updated plan.json with new tasks
769
+
770
+ CONSTRAINTS: Minimal changes, preserve existing work
771
+ " --tool gemini --mode analysis --rule planning-breakdown-task-steps
772
+ ```
773
+
774
+ **Step 5.2: Append Incremental Tasks**
775
+
776
+ ```javascript
777
+ const plan = JSON.parse(Read(planPath))
778
+ const incrementalTasks = parseGeminiDelta()
779
+
780
+ // Assign new task IDs
781
+ const maxId = Math.max(...plan.tasks.map(t => parseInt(t.id.replace('T', ''))))
782
+ incrementalTasks.forEach((task, i) => {
783
+ task.id = `T${maxId + i + 1}`
784
+ task.status = 'pending'
785
+ plan.tasks.push(task)
786
+ })
787
+
788
+ Write(planPath, JSON.stringify(plan, null, 2))
789
+ ```
790
+
791
+ **Step 5.3: Update progress.md**
792
+
793
+ Append new iteration section:
794
+
795
+ ```markdown
796
+ ---
797
+
798
+ ## Iteration ${iteration_number} (${getUtc8ISOString()})
799
+
800
+ ### New Requirements
801
+ ${new_requirements}
802
+
803
+ ### Delta Analysis
804
+ ${incrementalTasks.delta_analysis}
805
+
806
+ ### Incremental Tasks
807
+ ${incrementalTasks.tasks.map(t => `
808
+ - **${t.id}**: ${t.title}
809
+ - Files: ${t.files.join(', ')}
810
+ - Executor: ${t.executor}
811
+ `).join('\n')}
812
+
813
+ ---
814
+
815
+ ## Current State
816
+
817
+ **Phase**: Iteration planning complete
818
+ **Next Steps**: Execute incremental tasks
819
+ ```
820
+
821
+ **Step 5.4: Execute Incremental Tasks**
822
+
823
+ Re-enter Execute Mode, but only process tasks with `status: 'pending'`.
824
+
825
+ ---
826
+
827
+ ## Session Folder Structure
828
+
829
+ ```
830
+ .workflow/.develop/{session-id}/
831
+ ├── progress.md # Timeline: exploration → planning → execution → verification
832
+ ├── plan.json # Current execution plan (tasks, statuses, executors)
833
+ └── exploration-{angle}.json # Temporary exploration results (optional, can delete after planning)
834
+ ```
835
+
836
+ **Example**:
837
+ ```
838
+ .workflow/.develop/DEV-implement-jwt-refresh-2025-01-23/
839
+ ├── progress.md
840
+ ├── plan.json
841
+ ├── exploration-architecture.json
842
+ ├── exploration-patterns.json
843
+ └── exploration-testing.json
844
+ ```
845
+
846
+ ## Progress.md Template
847
+
848
+ ```markdown
849
+ # Development Progress
850
+
851
+ **Session ID**: DEV-xxx-2025-01-23
852
+ **Task Description**: [original description]
853
+ **Started**: 2025-01-23T10:00:00+08:00
854
+ **Complexity**: Medium
855
+
856
+ ---
857
+
858
+ ## Exploration Results
859
+
860
+ ### Exploration Summary (2025-01-23 10:05)
861
+ ...
862
+
863
+ ### Clarifications Collected
864
+ ...
865
+
866
+ ---
867
+
868
+ ## Planning Results
869
+
870
+ ### Plan Generated (2025-01-23 10:15)
871
+ ...
872
+
873
+ ---
874
+
875
+ ## Execution Timeline
876
+
877
+ ### Task T1 - ... (2025-01-23 10:20)
878
+ **Status**: ✅ Completed
879
+ ...
880
+
881
+ ### Task T2 - ... (2025-01-23 10:35)
882
+ **Status**: ✅ Completed
883
+ ...
884
+
885
+ ---
886
+
887
+ ## Verification Results
888
+
889
+ ### Code Review (2025-01-23 11:00)
890
+ ...
891
+
892
+ ---
893
+
894
+ ## Iteration 2 (2025-01-23 14:00)
895
+
896
+ ### New Requirements
897
+ ...
898
+
899
+ ### Delta Analysis
900
+ ...
901
+
902
+ ---
903
+
904
+ ## Current State
905
+
906
+ **Phase**: Complete
907
+ **Quality Score**: 8/10
908
+ **Artifacts**: progress.md, plan.json
909
+ ```
910
+
911
+ ## Plan.json Schema
912
+
913
+ ```json
914
+ {
915
+ "summary": "Implementation summary",
916
+ "approach": "Technical approach description",
917
+ "tasks": [
918
+ {
919
+ "id": "T1",
920
+ "title": "Task title",
921
+ "description": "Detailed description",
922
+ "files": ["src/file1.ts", "src/file2.ts"],
923
+ "executor": "agent", // gemini/codex/agent
924
+ "depends_on": [],
925
+ "complexity": "Medium",
926
+ "status": "completed" // pending/in_progress/completed/failed
927
+ }
928
+ ],
929
+ "executorAssignments": {
930
+ "T1": {
931
+ "executor": "agent",
932
+ "reason": "Standard implementation task, agent handles well"
933
+ }
934
+ },
935
+ "estimated_time": "2-3 hours",
936
+ "complexity": "Medium",
937
+ "_metadata": {
938
+ "timestamp": "2025-01-23T10:15:00+08:00",
939
+ "source": "gemini-planning",
940
+ "exploration_angles": ["architecture", "patterns", "testing"]
941
+ }
942
+ }
943
+ ```
944
+
945
+ ## Gemini Integration Points
946
+
947
+ ### 1. Planning (Plan Mode)
948
+
949
+ **Purpose**: Intelligent task decomposition with executor assignment
950
+
951
+ **Prompt Pattern**:
952
+ ```
953
+ PURPOSE: Generate implementation plan + executor assignments
954
+ TASK: Analyze exploration → decompose → assign executors (gemini/codex/agent)
955
+ CONTEXT: @progress.md (exploration findings)
956
+ EXPECTED: plan.json with tasks, executorAssignments, rationale
957
+ ```
958
+
959
+ ### 2. Verification (Verify Mode)
960
+
961
+ **Purpose**: Post-execution code review and quality check
962
+
963
+ **Prompt Pattern**:
964
+ ```
965
+ PURPOSE: Review code changes + validate quality
966
+ TASK: Check correctness, style, bugs → severity levels → fix suggestions
967
+ CONTEXT: @progress.md (execution results)
968
+ EXPECTED: Review report with issues (Critical/High/Medium/Low), quality score
969
+ ```
970
+
971
+ ### 3. Iteration (Iterate Mode)
972
+
973
+ **Purpose**: Analyze delta and generate incremental tasks
974
+
975
+ **Prompt Pattern**:
976
+ ```
977
+ PURPOSE: Analyze incremental changes + minimal tasks
978
+ TASK: Compare new requirements with current state → delta → incremental tasks
979
+ CONTEXT: @progress.md @plan.json | New requirements
980
+ EXPECTED: Delta analysis + incremental tasks
981
+ ```
982
+
983
+ ## Error Correction Mechanism
984
+
985
+ ### Correction Format in progress.md
986
+
987
+ When verification finds issues:
988
+
989
+ ```markdown
990
+ ### Corrected Understanding (Iteration 2)
991
+
992
+ - ~~Assumed API returns array~~ → API returns object with data array
993
+ - Why wrong: Misread API response structure
994
+ - Evidence: Runtime error "map is not a function"
995
+ - Fix applied: Changed `response.map` to `response.data.map`
996
+
997
+ - ~~Thought validation was client-side~~ → Validation is server-side
998
+ - Why wrong: Only checked frontend code
999
+ - Evidence: Backend validation logic found in exploration
1000
+ - Fix applied: Removed redundant client validation
1001
+ ```
1002
+
1003
+ ## Error Handling
1004
+
1005
+ | Situation | Action |
1006
+ |-----------|--------|
1007
+ | Exploration agent failure | Skip angle, continue with remaining explorations |
1008
+ | Gemini planning unavailable | Fallback to direct Claude planning (Low complexity mode) |
1009
+ | Task execution failure | Ask user: Retry/Skip/Abort |
1010
+ | Verification finds blockers | Force iteration mode, cannot proceed |
1011
+ | plan.json corrupted | Regenerate from progress.md + Gemini |
1012
+ | >5 iterations | Suggest breaking into sub-sessions |
1013
+
1014
+ ## Comparison with /workflow:lite-plan
1015
+
1016
+ | Feature | /workflow:lite-plan | /workflow:develop-with-file |
1017
+ |---------|---------------------|----------------------------|
1018
+ | State tracking | In-memory → lite-execute | progress.md (persistent) |
1019
+ | Exploration | Multi-agent parallel | ✅ Same |
1020
+ | Planning | cli-lite-planning-agent | Gemini CLI (more flexible) |
1021
+ | Execution | Delegated to lite-execute | Built-in (multi-agent/CLI) |
1022
+ | Verification | None | ✅ Gemini code review |
1023
+ | Iteration support | ❌ | ✅ Incremental tasks |
1024
+ | Document continuity | ❌ (session ends) | ✅ (progress.md timeline) |
1025
+ | Executor assignment | Global only | ✅ Per-task |
1026
+
1027
+ ## Usage Recommendations
1028
+
1029
+ Use `/workflow:develop-with-file` when:
1030
+ - Complex features requiring multiple phases (explore → plan → execute → verify)
1031
+ - Need persistent progress tracking across sessions
1032
+ - Want Gemini-assisted planning and verification
1033
+ - Anticipate multiple iterations/refinements
1034
+ - Team needs to understand development rationale
1035
+
1036
+ Use `/workflow:lite-plan` when:
1037
+ - Quick one-off tasks
1038
+ - Simple features (Low complexity)
1039
+ - Don't need verification
1040
+ - Session-level documentation not needed
@@ -1,5 +1,6 @@
1
1
  ---
2
- description: Stateless iterative development loop workflow with documented progress. Supports develop, debug, and validate phases with file-based state tracking. Triggers on "ccw-loop", "dev loop", "development loop".
2
+ name: CCW Loop
3
+ description: Stateless iterative development loop workflow with documented progress. Supports develop, debug, and validate phases with file-based state tracking. Triggers on "ccw-loop", "dev loop", "development loop", "开发循环", "迭代开发".
3
4
  argument-hint: TASK="<task description>" [--loop-id=<id>] [--auto]
4
5
  ---
5
6
 
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: CCW Loop-B
2
3
  description: Hybrid orchestrator pattern for iterative development. Coordinator + specialized workers with batch wait support. Triggers on "ccw-loop-b".
3
4
  argument-hint: TASK="<task description>" [--loop-id=<id>] [--mode=<interactive|auto|parallel>]
4
5
  ---
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: Parallel Dev Cycle
2
3
  description: Multi-agent parallel development cycle with requirement analysis, exploration planning, code development, and validation. Supports continuous iteration with markdown progress documentation.
3
4
  argument-hint: TASK="<task description>" [--cycle-id=<id>] [--auto] [--parallel=<count>]
4
5
  ---
@@ -299,7 +299,7 @@ async function refreshWorkspace() {
299
299
  });
300
300
 
301
301
  [...(data.liteTasks?.litePlan || []), ...(data.liteTasks?.liteFix || [])].forEach(s => {
302
- const sessionKey = `lite-${s.session_id}`.replace(/[^a-zA-Z0-9-]/g, '-');
302
+ const sessionKey = `lite-${s.type}-${s.id}`.replace(/[^a-zA-Z0-9-]/g, '-');
303
303
  liteTaskDataStore[sessionKey] = s;
304
304
  });
305
305
 
@@ -823,7 +823,7 @@ async function refreshWorkspaceData(newData) {
823
823
  });
824
824
 
825
825
  [...(newData.liteTasks?.litePlan || []), ...(newData.liteTasks?.liteFix || [])].forEach(s => {
826
- const key = `lite-${s.session_id}`.replace(/[^a-zA-Z0-9-]/g, '-');
826
+ const key = `lite-${s.type}-${s.id}`.replace(/[^a-zA-Z0-9-]/g, '-');
827
827
  liteTaskDataStore[key] = s;
828
828
  });
829
829
 
@@ -2817,7 +2817,7 @@ function showLiteTaskDetailPage(sessionKey) {
2817
2817
  </div>
2818
2818
 
2819
2819
  <!-- Tab Content -->
2820
- <div class="detail-tab-content" id="liteDetailTabContent">
2820
+ <div class="detail-tab-content active" id="liteDetailTabContent">
2821
2821
  ${renderLiteTasksTab(session, tasks, completed, inProgress, pending)}
2822
2822
  </div>
2823
2823
  </div>
@@ -107,7 +107,7 @@ function showSessionDetailPage(sessionKey) {
107
107
  </div>
108
108
 
109
109
  <!-- Tab Content -->
110
- <div class="detail-tab-content" id="detailTabContent">
110
+ <div class="detail-tab-content active" id="detailTabContent">
111
111
  ${renderTasksTab(session, tasks, completed, inProgress, pending)}
112
112
  </div>
113
113
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-workflow",
3
- "version": "6.3.39",
3
+ "version": "6.3.41",
4
4
  "description": "JSON-driven multi-agent development framework with intelligent CLI orchestration (Gemini/Qwen/Codex), context-first architecture, and automated workflow execution",
5
5
  "type": "module",
6
6
  "main": "ccw/src/index.js",