claude-code-workflow 7.2.29 → 7.2.30

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.
Files changed (124) hide show
  1. package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
  2. package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
  3. package/.claude/agents/action-planning-agent.md +7 -4
  4. package/.claude/agents/cli-explore-agent.md +77 -63
  5. package/.claude/agents/cli-lite-planning-agent.md +11 -10
  6. package/.claude/agents/issue-plan-agent.md +421 -426
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/skills/ccw-chain/SKILL.md +119 -0
  9. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
  10. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
  11. package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
  12. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
  13. package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
  14. package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
  15. package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
  16. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
  17. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
  18. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
  19. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
  20. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
  21. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
  22. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
  23. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
  24. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
  25. package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
  26. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
  27. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
  28. package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
  29. package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
  30. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
  31. package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
  32. package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
  33. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
  34. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
  35. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
  36. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
  37. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
  38. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
  39. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
  40. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
  41. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
  42. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
  43. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
  44. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
  45. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
  46. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
  47. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
  48. package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
  49. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
  50. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
  51. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
  52. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
  53. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
  54. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
  55. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
  56. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
  57. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
  58. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
  59. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
  60. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
  61. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
  62. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
  63. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
  64. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
  65. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
  66. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
  67. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
  68. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
  69. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
  70. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
  71. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
  72. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
  73. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
  74. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
  75. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
  76. package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
  77. package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
  78. package/.claude/skills/chain-loader/SKILL.md +78 -0
  79. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
  80. package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
  81. package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
  82. package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
  83. package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
  84. package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
  85. package/.claude/skills/review-cycle/phases/review-module.md +764 -764
  86. package/.claude/skills/review-cycle/phases/review-session.md +775 -775
  87. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  88. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
  89. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
  90. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
  91. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
  92. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
  93. package/README.md +14 -0
  94. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
  95. package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
  96. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
  97. package/ccw/dist/tools/chain-loader.d.ts +10 -0
  98. package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
  99. package/ccw/dist/tools/chain-loader.js +642 -0
  100. package/ccw/dist/tools/chain-loader.js.map +1 -0
  101. package/ccw/dist/tools/index.d.ts.map +1 -1
  102. package/ccw/dist/tools/index.js +2 -0
  103. package/ccw/dist/tools/index.js.map +1 -1
  104. package/ccw/dist/tools/json-builder.js +20 -0
  105. package/ccw/dist/tools/json-builder.js.map +1 -1
  106. package/ccw/dist/types/chain-types.d.ts +72 -0
  107. package/ccw/dist/types/chain-types.d.ts.map +1 -0
  108. package/ccw/dist/types/chain-types.js +5 -0
  109. package/ccw/dist/types/chain-types.js.map +1 -0
  110. package/ccw/scripts/prepublish-clean.mjs +0 -1
  111. package/package.json +1 -3
  112. package/ccw-litellm/README.md +0 -180
  113. package/ccw-litellm/pyproject.toml +0 -35
  114. package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
  115. package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
  116. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
  117. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
  118. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
  119. package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
  120. package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
  121. package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
  122. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
  123. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
  124. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
@@ -0,0 +1,775 @@
1
+ # Workflow Review-Session-Cycle Command
2
+
3
+ ## Quick Start
4
+
5
+ ```bash
6
+ # Execute comprehensive session review (all 7 dimensions)
7
+ /workflow:review-session-cycle
8
+
9
+ # Review specific session with custom dimensions
10
+ /workflow:review-session-cycle WFS-payment-integration --dimensions=security,architecture,quality
11
+
12
+ # Specify session and iteration limit
13
+ /workflow:review-session-cycle WFS-payment-integration --max-iterations=5
14
+ ```
15
+
16
+ **Review Scope**: Git changes from session creation to present (via `git log --since`)
17
+ **Session Requirement**: Requires active or completed workflow session
18
+ **Output Directory**: `.workflow/active/WFS-{session-id}/.review/` (session-based)
19
+ **Default Dimensions**: Security, Architecture, Quality, Action-Items, Performance, Maintainability, Best-Practices
20
+ **Max Iterations**: 3 (adjustable via --max-iterations)
21
+ **Default Iterations**: 1 (deep-dive runs once; use --max-iterations=0 to skip)
22
+ **CLI Tools**: Gemini → Qwen → Codex (fallback chain)
23
+
24
+ ## What & Why
25
+
26
+ ### Core Concept
27
+ Session-based multi-dimensional code review orchestrator with **hybrid parallel-iterative execution** for comprehensive quality assessment of **git changes within a workflow session**.
28
+
29
+ **Review Scope**:
30
+ - **Session-based**: Reviews only files changed during the workflow session (via `git log --since="${sessionCreatedAt}"`)
31
+ - **For independent module review**: Use `review-cycle` skill command instead
32
+
33
+ **vs Standard Review**:
34
+ - **Standard**: Sequential manual reviews → Inconsistent coverage → Missed cross-cutting concerns
35
+ - **Review-Session-Cycle**: **Parallel automated analysis → Aggregate findings → Deep-dive critical issues** → Comprehensive coverage
36
+
37
+ ### Value Proposition
38
+ 1. **Comprehensive Coverage**: 7 specialized dimensions analyze all quality aspects simultaneously
39
+ 2. **Intelligent Prioritization**: Automatic identification of critical issues and cross-cutting concerns
40
+ 3. **Actionable Insights**: Deep-dive iterations provide step-by-step remediation plans
41
+
42
+ ### Orchestrator Boundary (CRITICAL)
43
+ - **ONLY command** for comprehensive multi-dimensional review
44
+ - Manages: dimension coordination, aggregation, iteration control, progress tracking
45
+ - Delegates: Code exploration and analysis to @cli-explore-agent, dimension-specific reviews via Deep Scan mode
46
+
47
+ ## How It Works
48
+
49
+ ### Execution Flow (Simplified)
50
+
51
+ ```
52
+ Phase 1: Discovery & Initialization
53
+ └─ Validate session, initialize state, create output structure
54
+
55
+ Phase 2: Parallel Reviews (for each dimension)
56
+ ├─ Launch 7 review agents simultaneously
57
+ ├─ Each executes CLI analysis via Gemini/Qwen
58
+ ├─ Generate dimension JSON + markdown reports
59
+ └─ Update review-progress.json
60
+
61
+ Phase 3: Aggregation
62
+ ├─ Load all dimension JSON files
63
+ ├─ Calculate severity distribution (critical/high/medium/low)
64
+ ├─ Identify cross-cutting concerns (files in 3+ dimensions)
65
+ └─ Decision:
66
+ ├─ Critical findings OR high > 5 OR critical files → Phase 4 (Iterate)
67
+ └─ Else → Phase 5 (Complete)
68
+
69
+ Phase 4: Iterative Deep-Dive (optional)
70
+ ├─ Select critical findings (max 5 per iteration)
71
+ ├─ Launch deep-dive agents for root cause analysis
72
+ ├─ Generate remediation plans with impact assessment
73
+ ├─ Re-assess severity based on analysis
74
+ └─ Loop until no critical findings OR max iterations
75
+
76
+ Phase 5: Completion
77
+ └─ Finalize review-progress.json
78
+ ```
79
+
80
+ ### Agent Roles
81
+
82
+ | Agent | Responsibility |
83
+ |-------|---------------|
84
+ | **Orchestrator** | Phase control, session discovery, state management, aggregation logic, iteration control |
85
+ | **@cli-explore-agent** (Review) | Execute dimension-specific code analysis via Deep Scan mode, generate findings JSON with dual-source strategy (Bash + Gemini), create structured analysis reports |
86
+ | **@cli-explore-agent** (Deep-dive) | Focused root cause analysis using dependency mapping, remediation planning with architectural insights, impact assessment, severity re-assessment |
87
+
88
+ ## Enhanced Features
89
+
90
+ ### 1. Review Dimensions Configuration
91
+
92
+ **7 Specialized Dimensions** with priority-based allocation:
93
+
94
+ | Dimension | Template | Priority | Timeout |
95
+ |-----------|----------|----------|---------|
96
+ | **Security** | 03-assess-security-risks.txt | 1 (Critical) | 60min |
97
+ | **Architecture** | 02-review-architecture.txt | 2 (High) | 60min |
98
+ | **Quality** | 02-review-code-quality.txt | 3 (Medium) | 40min |
99
+ | **Action-Items** | 02-analyze-code-patterns.txt | 2 (High) | 40min |
100
+ | **Performance** | 03-analyze-performance.txt | 3 (Medium) | 60min |
101
+ | **Maintainability** | 02-review-code-quality.txt* | 3 (Medium) | 40min |
102
+ | **Best-Practices** | 03-review-quality-standards.txt | 3 (Medium) | 40min |
103
+
104
+ *Custom focus: "Assess technical debt and maintainability"
105
+
106
+ **Category Definitions by Dimension**:
107
+
108
+ ```javascript
109
+ const CATEGORIES = {
110
+ security: ['injection', 'authentication', 'authorization', 'encryption', 'input-validation', 'access-control', 'data-exposure'],
111
+ architecture: ['coupling', 'cohesion', 'layering', 'dependency', 'pattern-violation', 'scalability', 'separation-of-concerns'],
112
+ quality: ['code-smell', 'duplication', 'complexity', 'naming', 'error-handling', 'testability', 'readability'],
113
+ 'action-items': ['requirement-coverage', 'acceptance-criteria', 'documentation', 'deployment-readiness', 'missing-functionality'],
114
+ performance: ['n-plus-one', 'inefficient-query', 'memory-leak', 'blocking-operation', 'caching', 'resource-usage'],
115
+ maintainability: ['technical-debt', 'magic-number', 'long-method', 'large-class', 'dead-code', 'commented-code'],
116
+ 'best-practices': ['convention-violation', 'anti-pattern', 'deprecated-api', 'missing-validation', 'inconsistent-style']
117
+ };
118
+ ```
119
+
120
+ ### 2. Aggregation Logic
121
+
122
+ **Cross-Cutting Concern Detection**:
123
+ 1. Files appearing in 3+ dimensions = **Critical Files**
124
+ 2. Same issue pattern across dimensions = **Systemic Issue**
125
+ 3. Severity clustering in specific files = **Hotspots**
126
+
127
+ **Deep-Dive Selection Criteria**:
128
+ - All critical severity findings (priority 1)
129
+ - Top 3 high-severity findings in critical files (priority 2)
130
+ - Max 5 findings per iteration (prevent overwhelm)
131
+
132
+ ### 3. Severity Assessment
133
+
134
+ **Severity Levels**:
135
+ - **Critical**: Security vulnerabilities, data corruption risks, system-wide failures, authentication/authorization bypass
136
+ - **High**: Feature degradation, performance bottlenecks, architecture violations, significant technical debt
137
+ - **Medium**: Code smells, minor performance issues, style inconsistencies, maintainability concerns
138
+ - **Low**: Documentation gaps, minor refactoring opportunities, cosmetic issues
139
+
140
+ **Iteration Trigger**:
141
+ - Critical findings > 0 OR
142
+ - High findings > 5 OR
143
+ - Critical files count > 0
144
+
145
+ ## Core Responsibilities
146
+
147
+ ### Orchestrator
148
+
149
+ **Phase 1: Discovery & Initialization**
150
+
151
+ **Step 1: Session Discovery**
152
+ ```javascript
153
+ // If session ID not provided, auto-detect
154
+ if (!providedSessionId) {
155
+ // Check for active sessions
156
+ const activeSessions = Glob('.workflow/active/WFS-*');
157
+ if (activeSessions.length === 1) {
158
+ sessionId = activeSessions[0].match(/WFS-[^/]+/)[0];
159
+ } else if (activeSessions.length > 1) {
160
+ // List sessions and prompt user
161
+ error("Multiple active sessions found. Please specify session ID.");
162
+ } else {
163
+ error("No active session found. Create session first with /workflow:session:start");
164
+ }
165
+ } else {
166
+ sessionId = providedSessionId;
167
+ }
168
+
169
+ // Validate session exists
170
+ Bash(`test -d .workflow/active/${sessionId} && echo "EXISTS"`);
171
+ ```
172
+
173
+ **Step 2: Session Validation**
174
+ - Ensure session has implementation artifacts (check `.summaries/` or `.task/` directory)
175
+ - Extract session creation timestamp from `workflow-session.json`
176
+ - Use timestamp for git log filtering: `git log --since="${sessionCreatedAt}"`
177
+
178
+ **Step 3: Changed Files Detection**
179
+ ```bash
180
+ # Get files changed since session creation
181
+ git log --since="${sessionCreatedAt}" --name-only --pretty=format: | sort -u
182
+ ```
183
+
184
+ **Step 4: Output Directory Setup**
185
+ - Output directory: `.workflow/active/${sessionId}/.review/`
186
+ - Create directory structure:
187
+ ```bash
188
+ mkdir -p ${sessionDir}/.review/{dimensions,iterations,reports}
189
+ ```
190
+
191
+ **Step 5: Initialize Review State**
192
+ - State initialization: Create `review-state.json` with metadata, dimensions, max_iterations (merged metadata + state)
193
+ - Progress tracking: Create `review-progress.json` for progress tracking
194
+
195
+ **Step 6: TodoWrite Initialization**
196
+ - Set up progress tracking with hierarchical structure
197
+ - Mark Phase 1 completed, Phase 2 in_progress
198
+
199
+ **Phase 2: Parallel Review Coordination**
200
+ - Launch 7 @cli-explore-agent instances simultaneously (Deep Scan mode)
201
+ - Pass dimension-specific context (template, timeout, custom focus)
202
+ - Monitor completion via review-progress.json updates
203
+ - TodoWrite updates: Mark dimensions as completed
204
+ - CLI tool fallback: Gemini → Qwen → Codex (on error/timeout)
205
+
206
+ **Phase 3: Aggregation**
207
+ - Load all dimension JSON files from dimensions/
208
+ - Calculate severity distribution: Count by critical/high/medium/low
209
+ - Identify cross-cutting concerns: Files in 3+ dimensions
210
+ - Select deep-dive findings: Critical + high in critical files (max 5)
211
+ - Decision logic: Iterate if critical > 0 OR high > 5 OR critical files exist
212
+ - Update review-state.json with aggregation results
213
+
214
+ **Phase 4: Iteration Control**
215
+ - Check iteration count < max_iterations (default 3)
216
+ - Launch deep-dive agents for selected findings
217
+ - Collect remediation plans and re-assessed severities
218
+ - Update severity distribution based on re-assessments
219
+ - Record iteration in review-state.json
220
+ - Loop back to aggregation if still have critical/high findings
221
+
222
+ **Phase 5: Completion**
223
+ - Finalize review-progress.json with completion statistics
224
+ - Update review-state.json with completion_time and phase=complete
225
+ - TodoWrite completion: Mark all tasks done
226
+
227
+
228
+
229
+ ### Session File Structure
230
+
231
+ ```
232
+ .workflow/active/WFS-{session-id}/.review/
233
+ ├── review-state.json # Orchestrator state machine (includes metadata)
234
+ ├── review-progress.json # Real-time progress for dashboard
235
+ ├── dimensions/ # Per-dimension results
236
+ │ ├── security.json
237
+ │ ├── architecture.json
238
+ │ ├── quality.json
239
+ │ ├── action-items.json
240
+ │ ├── performance.json
241
+ │ ├── maintainability.json
242
+ │ └── best-practices.json
243
+ ├── iterations/ # Deep-dive results
244
+ │ ├── iteration-1-finding-{uuid}.json
245
+ │ └── iteration-2-finding-{uuid}.json
246
+ └── reports/ # Human-readable reports
247
+ ├── security-analysis.md
248
+ ├── security-cli-output.txt
249
+ ├── deep-dive-1-{uuid}.md
250
+ └── ...
251
+ ```
252
+
253
+ **Session Context**:
254
+ ```
255
+ .workflow/active/WFS-{session-id}/
256
+ ├── workflow-session.json
257
+ ├── IMPL_PLAN.md
258
+ ├── TODO_LIST.md
259
+ ├── .task/
260
+ ├── .summaries/
261
+ └── .review/ # Review results (this command)
262
+ └── (structure above)
263
+ ```
264
+
265
+ ### Review State JSON
266
+
267
+ **Purpose**: Unified state machine and metadata (merged from metadata + state)
268
+
269
+ ```json
270
+ {
271
+ "session_id": "WFS-payment-integration",
272
+ "review_id": "review-20250125-143022",
273
+ "review_type": "session",
274
+ "metadata": {
275
+ "created_at": "2025-01-25T14:30:22Z",
276
+ "git_changes": {
277
+ "commit_range": "abc123..def456",
278
+ "files_changed": 15,
279
+ "insertions": 342,
280
+ "deletions": 128
281
+ },
282
+ "dimensions": ["security", "architecture", "quality", "action-items", "performance", "maintainability", "best-practices"],
283
+ "max_iterations": 3
284
+ },
285
+ "phase": "parallel|aggregate|iterate|complete",
286
+ "current_iteration": 1,
287
+ "dimensions_reviewed": ["security", "architecture", "quality", "action-items", "performance", "maintainability", "best-practices"],
288
+ "selected_strategy": "comprehensive",
289
+ "next_action": "execute_parallel_reviews|aggregate_findings|execute_deep_dive|generate_final_report|complete",
290
+ "severity_distribution": {
291
+ "critical": 2,
292
+ "high": 5,
293
+ "medium": 12,
294
+ "low": 8
295
+ },
296
+ "critical_files": [
297
+ {
298
+ "file": "src/payment/processor.ts",
299
+ "finding_count": 5,
300
+ "dimensions": ["security", "architecture", "quality"]
301
+ }
302
+ ],
303
+ "iterations": [
304
+ {
305
+ "iteration": 1,
306
+ "findings_analyzed": ["uuid-1", "uuid-2"],
307
+ "findings_resolved": 1,
308
+ "findings_escalated": 1,
309
+ "severity_change": {
310
+ "before": {"critical": 2, "high": 5, "medium": 12, "low": 8},
311
+ "after": {"critical": 1, "high": 6, "medium": 12, "low": 8}
312
+ },
313
+ "timestamp": "2025-01-25T14:30:00Z"
314
+ }
315
+ ],
316
+ "completion_criteria": {
317
+ "target": "no_critical_findings_and_high_under_5",
318
+ "current_status": "in_progress",
319
+ "estimated_completion": "2 iterations remaining"
320
+ }
321
+ }
322
+ ```
323
+
324
+ **Field Descriptions**:
325
+ - `phase`: Current execution phase (state machine pointer)
326
+ - `current_iteration`: Iteration counter (used for max check)
327
+ - `next_action`: Next step orchestrator should execute
328
+ - `severity_distribution`: Aggregated counts across all dimensions
329
+ - `critical_files`: Files appearing in 3+ dimensions with metadata
330
+ - `iterations[]`: Historical log for trend analysis
331
+
332
+ ### Review Progress JSON
333
+
334
+ **Purpose**: Real-time dashboard updates via polling
335
+
336
+ ```json
337
+ {
338
+ "review_id": "review-20250125-143022",
339
+ "last_update": "2025-01-25T14:35:10Z",
340
+ "phase": "parallel|aggregate|iterate|complete",
341
+ "current_iteration": 1,
342
+ "progress": {
343
+ "parallel_review": {
344
+ "total_dimensions": 7,
345
+ "completed": 5,
346
+ "in_progress": 2,
347
+ "percent_complete": 71
348
+ },
349
+ "deep_dive": {
350
+ "total_findings": 6,
351
+ "analyzed": 2,
352
+ "in_progress": 1,
353
+ "percent_complete": 33
354
+ }
355
+ },
356
+ "agent_status": [
357
+ {
358
+ "agent_type": "review-agent",
359
+ "dimension": "security",
360
+ "status": "completed",
361
+ "started_at": "2025-01-25T14:30:00Z",
362
+ "completed_at": "2025-01-25T15:15:00Z",
363
+ "duration_ms": 2700000
364
+ },
365
+ {
366
+ "agent_type": "deep-dive-agent",
367
+ "finding_id": "sec-001-uuid",
368
+ "status": "in_progress",
369
+ "started_at": "2025-01-25T14:32:00Z"
370
+ }
371
+ ],
372
+ "estimated_completion": "2025-01-25T16:00:00Z"
373
+ }
374
+ ```
375
+
376
+ ### Agent Output Schemas
377
+
378
+ **Agent-produced JSON files follow standardized schemas**:
379
+
380
+ 1. **Dimension Results** (cli-explore-agent output from parallel reviews)
381
+ - Schema: `~/.ccw/workflows/cli-templates/schemas/review-dimension-results-schema.json`
382
+ - Output: `.review-cycle/dimensions/{dimension}.json`
383
+ - Contains: findings array, summary statistics, cross_references
384
+
385
+ 2. **Deep-Dive Results** (cli-explore-agent output from iterations)
386
+ - Schema: `~/.ccw/workflows/cli-templates/schemas/review-deep-dive-results-schema.json`
387
+ - Output: `.review-cycle/iterations/iteration-{N}-finding-{uuid}.json`
388
+ - Contains: root_cause, remediation_plan, impact_assessment, reassessed_severity
389
+
390
+ ### Agent Invocation Template
391
+
392
+ **Review Agent** (parallel execution, 7 instances):
393
+
394
+ ```javascript
395
+ Task(
396
+ subagent_type="cli-explore-agent",
397
+ run_in_background=false,
398
+ description=`Execute ${dimension} review analysis via Deep Scan`,
399
+ prompt=`
400
+ ## Task Objective
401
+ Conduct comprehensive ${dimension} code exploration and analysis using Deep Scan mode (Bash + Gemini dual-source strategy) for completed implementation in session ${sessionId}
402
+
403
+ ## Analysis Mode Selection
404
+ Use **Deep Scan mode** for this review:
405
+ - Phase 1: Bash structural scan for standard patterns (classes, functions, imports)
406
+ - Phase 2: Gemini semantic analysis for design intent, non-standard patterns, ${dimension}-specific concerns
407
+ - Phase 3: Synthesis with attribution (bash-discovered vs gemini-discovered findings)
408
+
409
+ ## MANDATORY FIRST STEPS (Execute by Agent)
410
+ **You (cli-explore-agent) MUST execute these steps in order:**
411
+ 1. Read session metadata: ${sessionMetadataPath}
412
+ 2. Read completed task summaries: bash(find ${summariesDir} -name "IMPL-*.md" -type f)
413
+ 3. Get changed files: bash(cd ${workflowDir} && git log --since="${sessionCreatedAt}" --name-only --pretty=format: | sort -u)
414
+ 4. Read review state: ${reviewStateJsonPath}
415
+ 5. Execute: ccw tool exec json_builder '{"cmd":"info","schema":"review-dim"}' (get output schema summary)
416
+ 6. Read: .workflow/project-tech.json (technology stack and architecture context)
417
+ 7. Read: .workflow/specs/*.md (user-defined constraints and conventions to validate against)
418
+
419
+ ## Session Context
420
+ - Session ID: ${sessionId}
421
+ - Review Dimension: ${dimension}
422
+ - Review ID: ${reviewId}
423
+ - Implementation Phase: Complete (all tests passing)
424
+ - Output Directory: ${outputDir}
425
+
426
+ ## CLI Configuration
427
+ - Tool Priority: gemini → qwen → codex (fallback chain)
428
+ - Template: ~/.ccw/workflows/cli-templates/prompts/analysis/${dimensionTemplate}
429
+ - Custom Focus: ${customFocus || 'Standard dimension analysis'}
430
+ - Timeout: ${timeout}ms
431
+ - Mode: analysis (READ-ONLY)
432
+
433
+ ## Expected Deliverables
434
+
435
+ **Schema Reference**: Schema obtained in MANDATORY FIRST STEPS step 5, follow schema exactly
436
+
437
+ 1. Dimension Results JSON: ${outputDir}/dimensions/${dimension}.json
438
+
439
+ **⚠️ CRITICAL JSON STRUCTURE REQUIREMENTS**:
440
+
441
+ Root structure MUST be array: \`[{ ... }]\` NOT \`{ ... }\`
442
+
443
+ Required top-level fields:
444
+ - dimension, review_id, analysis_timestamp (NOT timestamp/analyzed_at)
445
+ - cli_tool_used (gemini|qwen|codex), model, analysis_duration_ms
446
+ - summary (FLAT structure), findings, cross_references
447
+
448
+ Summary MUST be FLAT (NOT nested by_severity):
449
+ \`{ "total_findings": N, "critical": N, "high": N, "medium": N, "low": N, "files_analyzed": N, "lines_reviewed": N }\`
450
+
451
+ Finding required fields:
452
+ - id: format \`{dim}-{seq}-{uuid8}\` e.g., \`sec-001-a1b2c3d4\` (lowercase)
453
+ - severity: lowercase only (critical|high|medium|low)
454
+ - snippet (NOT code_snippet), impact (NOT exploit_scenario)
455
+ - metadata, iteration (0), status (pending_remediation), cross_references
456
+
457
+ 2. Analysis Report: ${outputDir}/reports/${dimension}-analysis.md
458
+ - Human-readable summary with recommendations
459
+ - Grouped by severity: critical → high → medium → low
460
+ - Include file:line references for all findings
461
+
462
+ 3. CLI Output Log: ${outputDir}/reports/${dimension}-cli-output.txt
463
+ - Raw CLI tool output for debugging
464
+ - Include full analysis text
465
+
466
+ ## Dimension-Specific Guidance
467
+ ${getDimensionGuidance(dimension)}
468
+
469
+ ## Success Criteria
470
+ - [ ] Schema obtained via json_builder info
471
+ - [ ] All changed files analyzed for ${dimension} concerns
472
+ - [ ] All findings include file:line references with code snippets
473
+ - [ ] Severity assessment follows established criteria (see reference)
474
+ - [ ] Recommendations are actionable with code examples
475
+ - [ ] JSON output follows schema exactly
476
+ - [ ] Report is comprehensive and well-organized
477
+ `
478
+ )
479
+ ```
480
+
481
+ **Deep-Dive Agent** (iteration execution):
482
+
483
+ ```javascript
484
+ Task(
485
+ subagent_type="cli-explore-agent",
486
+ run_in_background=false,
487
+ description=`Deep-dive analysis for critical finding: ${findingTitle} via Dependency Map + Deep Scan`,
488
+ prompt=`
489
+ ## Task Objective
490
+ Perform focused root cause analysis using Dependency Map mode (for impact analysis) + Deep Scan mode (for semantic understanding) to generate comprehensive remediation plan for critical ${dimension} issue
491
+
492
+ ## Analysis Mode Selection
493
+ Use **Dependency Map mode** first to understand dependencies:
494
+ - Build dependency graph around ${file} to identify affected components
495
+ - Detect circular dependencies or tight coupling related to this finding
496
+ - Calculate change risk scores for remediation impact
497
+
498
+ Then apply **Deep Scan mode** for semantic analysis:
499
+ - Understand design intent and architectural context
500
+ - Identify non-standard patterns or implicit dependencies
501
+ - Extract remediation insights from code structure
502
+
503
+ ## Finding Context
504
+ - Finding ID: ${findingId}
505
+ - Original Dimension: ${dimension}
506
+ - Title: ${findingTitle}
507
+ - File: ${file}:${line}
508
+ - Severity: ${severity}
509
+ - Category: ${category}
510
+ - Original Description: ${description}
511
+ - Iteration: ${iteration}
512
+
513
+ ## MANDATORY FIRST STEPS (Execute by Agent)
514
+ **You (cli-explore-agent) MUST execute these steps in order:**
515
+ 1. Read original finding: ${dimensionJsonPath}
516
+ 2. Read affected file: ${file}
517
+ 3. Identify related code: bash(grep -r "import.*${basename(file)}" ${workflowDir}/src --include="*.ts")
518
+ 4. Read test files: bash(find ${workflowDir}/tests -name "*${basename(file, '.ts')}*" -type f)
519
+ 5. Execute: ccw tool exec json_builder '{"cmd":"info","schema":"review-deep"}' (get output schema summary)
520
+ 6. Read: .workflow/project-tech.json (technology stack and architecture context)
521
+ 7. Read: .workflow/specs/*.md (user-defined constraints for remediation compliance)
522
+
523
+ ## CLI Configuration
524
+ - Tool Priority: gemini → qwen → codex
525
+ - Template: ~/.ccw/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt
526
+ - Timeout: 2400000ms (40 minutes)
527
+ - Mode: analysis (READ-ONLY)
528
+
529
+ ## Expected Deliverables
530
+
531
+ **Schema Reference**: Schema obtained in MANDATORY FIRST STEPS step 5, follow schema exactly
532
+
533
+ 1. Deep-Dive Results JSON: ${outputDir}/iterations/iteration-${iteration}-finding-${findingId}.json
534
+
535
+ **⚠️ CRITICAL JSON STRUCTURE REQUIREMENTS**:
536
+
537
+ Root structure MUST be array: \`[{ ... }]\` NOT \`{ ... }\`
538
+
539
+ Required top-level fields:
540
+ - finding_id, dimension, iteration, analysis_timestamp
541
+ - cli_tool_used, model, analysis_duration_ms
542
+ - original_finding, root_cause, remediation_plan
543
+ - impact_assessment, reassessed_severity, confidence_score, cross_references
544
+
545
+ All nested objects must follow schema exactly - read schema for field names
546
+
547
+ 2. Analysis Report: ${outputDir}/reports/deep-dive-${iteration}-${findingId}.md
548
+ - Detailed root cause analysis
549
+ - Step-by-step remediation plan
550
+ - Impact assessment and rollback strategy
551
+
552
+ ## Success Criteria
553
+ - [ ] Schema obtained via json_builder info
554
+ - [ ] Root cause clearly identified with supporting evidence
555
+ - [ ] Remediation plan is step-by-step actionable with exact file:line references
556
+ - [ ] Each step includes specific commands and validation tests
557
+ - [ ] Impact fully assessed (files, tests, breaking changes, dependencies)
558
+ - [ ] Severity re-evaluation justified with evidence
559
+ - [ ] Confidence score accurately reflects certainty of analysis
560
+ - [ ] JSON output follows schema exactly
561
+ - [ ] References include project-specific and external documentation
562
+ `
563
+ )
564
+ ```
565
+
566
+ ### Dimension Guidance Reference
567
+
568
+ ```javascript
569
+ function getDimensionGuidance(dimension) {
570
+ const guidance = {
571
+ security: `
572
+ Focus Areas:
573
+ - Input validation and sanitization
574
+ - Authentication and authorization mechanisms
575
+ - Data encryption (at-rest and in-transit)
576
+ - SQL/NoSQL injection vulnerabilities
577
+ - XSS, CSRF, and other web vulnerabilities
578
+ - Sensitive data exposure
579
+ - Access control and privilege escalation
580
+
581
+ Severity Criteria:
582
+ - Critical: Authentication bypass, SQL injection, RCE, sensitive data exposure
583
+ - High: Missing authorization checks, weak encryption, exposed secrets
584
+ - Medium: Missing input validation, insecure defaults, weak password policies
585
+ - Low: Security headers missing, verbose error messages, outdated dependencies
586
+ `,
587
+ architecture: `
588
+ Focus Areas:
589
+ - Layering and separation of concerns
590
+ - Coupling and cohesion
591
+ - Design pattern adherence
592
+ - Dependency management
593
+ - Scalability and extensibility
594
+ - Module boundaries
595
+ - API design consistency
596
+
597
+ Severity Criteria:
598
+ - Critical: Circular dependencies, god objects, tight coupling across layers
599
+ - High: Violated architectural principles, scalability bottlenecks
600
+ - Medium: Missing abstractions, inconsistent patterns, suboptimal design
601
+ - Low: Minor coupling issues, documentation gaps, naming inconsistencies
602
+ `,
603
+ quality: `
604
+ Focus Areas:
605
+ - Code duplication
606
+ - Complexity (cyclomatic, cognitive)
607
+ - Naming conventions
608
+ - Error handling patterns
609
+ - Code readability
610
+ - Comment quality
611
+ - Dead code
612
+
613
+ Severity Criteria:
614
+ - Critical: Severe complexity (CC > 20), massive duplication (>50 lines)
615
+ - High: High complexity (CC > 10), significant duplication, poor error handling
616
+ - Medium: Moderate complexity (CC > 5), naming issues, code smells
617
+ - Low: Minor duplication, documentation gaps, cosmetic issues
618
+ `,
619
+ 'action-items': `
620
+ Focus Areas:
621
+ - Requirements coverage verification
622
+ - Acceptance criteria met
623
+ - Documentation completeness
624
+ - Deployment readiness
625
+ - Missing functionality
626
+ - Test coverage gaps
627
+ - Configuration management
628
+
629
+ Severity Criteria:
630
+ - Critical: Core requirements not met, deployment blockers
631
+ - High: Significant functionality missing, acceptance criteria not met
632
+ - Medium: Minor requirements gaps, documentation incomplete
633
+ - Low: Nice-to-have features missing, minor documentation gaps
634
+ `,
635
+ performance: `
636
+ Focus Areas:
637
+ - N+1 query problems
638
+ - Inefficient algorithms (O(n²) where O(n log n) possible)
639
+ - Memory leaks
640
+ - Blocking operations on main thread
641
+ - Missing caching opportunities
642
+ - Resource usage (CPU, memory, network)
643
+ - Database query optimization
644
+
645
+ Severity Criteria:
646
+ - Critical: Memory leaks, O(n²) in hot path, blocking main thread
647
+ - High: N+1 queries, missing indexes, inefficient algorithms
648
+ - Medium: Suboptimal caching, unnecessary computations, lazy loading issues
649
+ - Low: Minor optimization opportunities, redundant operations
650
+ `,
651
+ maintainability: `
652
+ Focus Areas:
653
+ - Technical debt indicators
654
+ - Magic numbers and hardcoded values
655
+ - Long methods (>50 lines)
656
+ - Large classes (>500 lines)
657
+ - Dead code and commented code
658
+ - Code documentation
659
+ - Test coverage
660
+
661
+ Severity Criteria:
662
+ - Critical: Massive methods (>200 lines), severe technical debt blocking changes
663
+ - High: Large methods (>100 lines), significant dead code, undocumented complex logic
664
+ - Medium: Magic numbers, moderate technical debt, missing tests
665
+ - Low: Minor refactoring opportunities, cosmetic improvements
666
+ `,
667
+ 'best-practices': `
668
+ Focus Areas:
669
+ - Framework conventions adherence
670
+ - Language idioms
671
+ - Anti-patterns
672
+ - Deprecated API usage
673
+ - Coding standards compliance
674
+ - Error handling patterns
675
+ - Logging and monitoring
676
+
677
+ Severity Criteria:
678
+ - Critical: Severe anti-patterns, deprecated APIs with security risks
679
+ - High: Major convention violations, poor error handling, missing logging
680
+ - Medium: Minor anti-patterns, style inconsistencies, suboptimal patterns
681
+ - Low: Cosmetic style issues, minor convention deviations
682
+ `
683
+ };
684
+
685
+ return guidance[dimension] || 'Standard code review analysis';
686
+ }
687
+ ```
688
+
689
+ ### Completion Conditions
690
+
691
+ **Full Success**:
692
+ - All dimensions reviewed
693
+ - Critical findings = 0
694
+ - High findings ≤ 5
695
+ - Action: Generate final report, mark phase=complete
696
+
697
+ **Partial Success**:
698
+ - All dimensions reviewed
699
+ - Max iterations reached
700
+ - Still have critical/high findings
701
+ - Action: Generate report with warnings, recommend follow-up
702
+
703
+ ### Error Handling
704
+
705
+ **Phase-Level Error Matrix**:
706
+
707
+ | Phase | Error | Blocking? | Action |
708
+ |-------|-------|-----------|--------|
709
+ | Phase 1 | Session not found | Yes | Error and exit |
710
+ | Phase 1 | No completed tasks | Yes | Error and exit |
711
+ | Phase 1 | No changed files | Yes | Error and exit |
712
+ | Phase 2 | Single dimension fails | No | Log warning, continue other dimensions |
713
+ | Phase 2 | All dimensions fail | Yes | Error and exit |
714
+ | Phase 3 | Missing dimension JSON | No | Skip in aggregation, log warning |
715
+ | Phase 4 | Deep-dive agent fails | No | Skip finding, continue others |
716
+ | Phase 4 | Max iterations reached | No | Generate partial report |
717
+
718
+ **CLI Fallback Chain**: Gemini → Qwen → Codex → degraded mode
719
+
720
+ **Fallback Triggers**:
721
+ 1. HTTP 429, 5xx errors, connection timeout
722
+ 2. Invalid JSON output (parse error, missing required fields)
723
+ 3. Low confidence score < 0.4
724
+ 4. Analysis too brief (< 100 words in report)
725
+
726
+ **Fallback Behavior**:
727
+ - On trigger: Retry with next tool in chain
728
+ - After Codex fails: Enter degraded mode (skip analysis, log error)
729
+ - Degraded mode: Continue workflow with available results
730
+
731
+ ### TodoWrite Structure
732
+
733
+ ```javascript
734
+ TodoWrite({
735
+ todos: [
736
+ { content: "Phase 1: Discovery & Initialization", status: "completed", activeForm: "Initializing" },
737
+ { content: "Phase 2: Parallel Reviews (7 dimensions)", status: "in_progress", activeForm: "Reviewing" },
738
+ { content: " → Security review", status: "in_progress", activeForm: "Analyzing security" },
739
+ // ... other dimensions as sub-items
740
+ { content: "Phase 3: Aggregation", status: "pending", activeForm: "Aggregating" },
741
+ { content: "Phase 4: Deep-dive", status: "pending", activeForm: "Deep-diving" },
742
+ { content: "Phase 5: Completion", status: "pending", activeForm: "Completing" }
743
+ ]
744
+ });
745
+ ```
746
+
747
+ ## Best Practices
748
+
749
+ 1. **Default Settings Work**: 7 dimensions + 3 iterations sufficient for most cases
750
+ 2. **Parallel Execution**: ~60 minutes for full initial review (7 dimensions)
751
+ 3. **Trust Aggregation Logic**: Auto-selection based on proven heuristics
752
+ 4. **Monitor Logs**: Check reports/ directory for CLI analysis insights
753
+
754
+ ## Related Commands
755
+
756
+ ### View Review Progress
757
+ Use `ccw view` to open the review dashboard in browser:
758
+
759
+ ```bash
760
+ ccw view
761
+ ```
762
+
763
+ ### Automated Fix Workflow
764
+ After completing a review, use the generated findings JSON for automated fixing:
765
+
766
+ ```bash
767
+ # Step 1: Complete review (this command)
768
+ /workflow:review-session-cycle
769
+
770
+ # Step 2: Run automated fixes using dimension findings
771
+ /workflow:review-cycle-fix .workflow/active/WFS-{session-id}/.review/
772
+ ```
773
+
774
+ See `review-cycle` skill (fix phase) for automated fixing with smart grouping, parallel execution, and test verification.
775
+