claude-code-workflow 6.3.38 → 6.3.39

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 (46) hide show
  1. package/.codex/agents/ccw-loop-b-complete.md +227 -0
  2. package/.codex/agents/ccw-loop-b-debug.md +172 -0
  3. package/.codex/agents/ccw-loop-b-develop.md +147 -0
  4. package/.codex/agents/ccw-loop-b-init.md +82 -0
  5. package/.codex/agents/ccw-loop-b-validate.md +204 -0
  6. package/.codex/agents/ccw-loop-executor.md +4 -4
  7. package/.codex/prompts/clean.md +409 -0
  8. package/.codex/skills/ccw-loop/README.md +3 -3
  9. package/.codex/skills/ccw-loop/SKILL.md +16 -16
  10. package/.codex/skills/ccw-loop/phases/actions/action-complete.md +4 -4
  11. package/.codex/skills/ccw-loop/phases/actions/action-debug.md +3 -3
  12. package/.codex/skills/ccw-loop/phases/actions/action-develop.md +5 -5
  13. package/.codex/skills/ccw-loop/phases/actions/action-init.md +5 -5
  14. package/.codex/skills/ccw-loop/phases/actions/action-menu.md +2 -2
  15. package/.codex/skills/ccw-loop/phases/actions/action-validate.md +5 -5
  16. package/.codex/skills/ccw-loop/phases/orchestrator.md +6 -6
  17. package/.codex/skills/ccw-loop/phases/state-schema.md +11 -11
  18. package/.codex/skills/ccw-loop-b/README.md +260 -61
  19. package/.codex/skills/ccw-loop-b/SKILL.md +4 -4
  20. package/.codex/skills/ccw-loop-b/phases/orchestrator.md +2 -2
  21. package/.codex/skills/ccw-loop-b/phases/state-schema.md +3 -3
  22. package/.codex/skills/ccw-loop-b/specs/action-catalog.md +383 -0
  23. package/.codex/skills/parallel-dev-cycle/README.md +382 -0
  24. package/.codex/skills/parallel-dev-cycle/SKILL.md +512 -0
  25. package/.codex/skills/parallel-dev-cycle/phases/agents/code-developer.md +242 -0
  26. package/.codex/skills/parallel-dev-cycle/phases/agents/exploration-planner.md +285 -0
  27. package/.codex/skills/parallel-dev-cycle/phases/agents/requirements-analyst.md +285 -0
  28. package/.codex/skills/parallel-dev-cycle/phases/agents/validation-archivist.md +381 -0
  29. package/.codex/skills/parallel-dev-cycle/phases/orchestrator.md +696 -0
  30. package/.codex/skills/parallel-dev-cycle/phases/state-schema.md +436 -0
  31. package/.codex/skills/parallel-dev-cycle/specs/communication-optimization.md +423 -0
  32. package/.codex/skills/parallel-dev-cycle/specs/coordination-protocol.md +391 -0
  33. package/.codex/skills/parallel-dev-cycle/specs/versioning-strategy.md +330 -0
  34. package/ccw/dist/commands/install.js +1 -1
  35. package/ccw/dist/commands/install.js.map +1 -1
  36. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  37. package/ccw/dist/tools/claude-cli-tools.js +4 -3
  38. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  39. package/ccw/dist/tools/cli-config-manager.d.ts +1 -0
  40. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  41. package/ccw/dist/tools/cli-config-manager.js +2 -1
  42. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  43. package/ccw/src/commands/install.ts +1 -1
  44. package/ccw/src/tools/claude-cli-tools.ts +4 -3
  45. package/ccw/src/tools/cli-config-manager.ts +3 -1
  46. package/package.json +1 -1
@@ -1,102 +1,301 @@
1
- # CCW Loop-B (Hybrid Orchestrator Pattern)
1
+ # CCW Loop-B: Hybrid Orchestrator Pattern
2
2
 
3
- 协调器 + 专用 worker 的迭代开发工作流。
3
+ Iterative development workflow using coordinator + specialized workers architecture.
4
4
 
5
5
  ## Overview
6
6
 
7
- CCW Loop-B 采用混合模式设计:
8
- - **Coordinator**: 状态管理、worker 调度、结果汇聚
9
- - **Workers**: 专注各自领域(develop/debug/validate
7
+ CCW Loop-B implements a flexible orchestration pattern:
8
+ - **Coordinator**: Main agent managing state, user interaction, worker scheduling
9
+ - **Workers**: Specialized agents (init, develop, debug, validate, complete)
10
+ - **Modes**: Interactive / Auto / Parallel execution
10
11
 
11
- ## Installation
12
+ ## Architecture
12
13
 
13
14
  ```
14
- .codex/skills/ccw-loop-b/
15
- +-- SKILL.md # Main skill definition
16
- +-- README.md # This file
17
- +-- phases/
18
- | +-- orchestrator.md # Coordinator logic
19
- | +-- state-schema.md # State structure
20
- +-- specs/
21
- +-- action-catalog.md # Action catalog
22
-
23
- .codex/agents/
24
- +-- ccw-loop-b-init.md # Init worker
25
- +-- ccw-loop-b-develop.md # Develop worker
26
- +-- ccw-loop-b-debug.md # Debug worker
27
- +-- ccw-loop-b-validate.md # Validate worker
28
- +-- ccw-loop-b-complete.md # Complete worker
15
+ Coordinator (Main Agent)
16
+ |
17
+ +-- Spawns Workers
18
+ | - ccw-loop-b-init.md
19
+ | - ccw-loop-b-develop.md
20
+ | - ccw-loop-b-debug.md
21
+ | - ccw-loop-b-validate.md
22
+ | - ccw-loop-b-complete.md
23
+ |
24
+ +-- Batch Wait (parallel mode)
25
+ +-- Sequential Wait (auto/interactive)
26
+ +-- State Management
27
+ +-- User Interaction
29
28
  ```
30
29
 
30
+ ## Subagent API
31
+
32
+ Core APIs for worker orchestration:
33
+
34
+ | API | 作用 |
35
+ |-----|------|
36
+ | `spawn_agent({ message })` | 创建 worker,返回 `agent_id` |
37
+ | `wait({ ids, timeout_ms })` | 等待结果(唯一取结果入口) |
38
+ | `send_input({ id, message })` | 继续交互 |
39
+ | `close_agent({ id })` | 关闭回收 |
40
+
41
+ **可用模式**: 单 agent 深度交互 / 多 agent 并行 / 混合模式
42
+
31
43
  ## Execution Modes
32
44
 
33
- | Mode | Description | Use Case |
34
- |------|-------------|----------|
35
- | `interactive` | 用户选择 action | 复杂任务,需要人工决策 |
36
- | `auto` | 自动顺序执行 | 标准开发流程 |
37
- | `parallel` | 并行多维度分析 | 需要快速全面评估 |
45
+ ### Interactive Mode (default)
38
46
 
39
- ## Usage
47
+ Coordinator displays menu, user selects action, spawns corresponding worker.
40
48
 
41
49
  ```bash
42
- # Interactive (default)
43
50
  /ccw-loop-b TASK="Implement feature X"
51
+ ```
44
52
 
45
- # Auto mode
53
+ **Flow**:
54
+ 1. Init: Parse task, create breakdown
55
+ 2. Menu: Show options to user
56
+ 3. User selects action (develop/debug/validate)
57
+ 4. Spawn worker for selected action
58
+ 5. Wait for result
59
+ 6. Display result, back to menu
60
+ 7. Repeat until complete
61
+
62
+ ### Auto Mode
63
+
64
+ Automated sequential execution following predefined workflow.
65
+
66
+ ```bash
46
67
  /ccw-loop-b --mode=auto TASK="Fix bug Y"
68
+ ```
69
+
70
+ **Flow**:
71
+ 1. Init → 2. Develop → 3. Validate → 4. Complete
72
+
73
+ If issues found: loop back to Debug → Develop → Validate
74
+
75
+ ### Parallel Mode
76
+
77
+ Spawn multiple workers simultaneously, batch wait for results.
47
78
 
48
- # Parallel analysis
79
+ ```bash
49
80
  /ccw-loop-b --mode=parallel TASK="Analyze module Z"
81
+ ```
82
+
83
+ **Flow**:
84
+ 1. Init: Create analysis plan
85
+ 2. Spawn workers in parallel: [develop, debug, validate]
86
+ 3. Batch wait: `wait({ ids: [w1, w2, w3] })`
87
+ 4. Merge results
88
+ 5. Coordinator decides next action
89
+ 6. Complete
50
90
 
51
- # Resume
52
- /ccw-loop-b --loop-id=loop-b-xxx
91
+ ## Session Structure
92
+
93
+ ```
94
+ .workflow/.loop/
95
+ +-- {loopId}.json # Master state
96
+ +-- {loopId}.workers/ # Worker outputs
97
+ | +-- init.output.json
98
+ | +-- develop.output.json
99
+ | +-- debug.output.json
100
+ | +-- validate.output.json
101
+ | +-- complete.output.json
102
+ +-- {loopId}.progress/ # Human-readable logs
103
+ +-- develop.md
104
+ +-- debug.md
105
+ +-- validate.md
106
+ +-- summary.md
53
107
  ```
54
108
 
55
- ## Session Files
109
+ ## Worker Responsibilities
56
110
 
111
+ | Worker | Role | Specialization |
112
+ |--------|------|----------------|
113
+ | **init** | Session initialization | Task parsing, breakdown, planning |
114
+ | **develop** | Code implementation | File operations, pattern matching, incremental development |
115
+ | **debug** | Problem diagnosis | Root cause analysis, hypothesis testing, fix recommendations |
116
+ | **validate** | Testing & verification | Test execution, coverage analysis, quality gates |
117
+ | **complete** | Session finalization | Summary generation, commit preparation, cleanup |
118
+
119
+ ## Usage Examples
120
+
121
+ ### Example 1: Simple Feature Implementation
122
+
123
+ ```bash
124
+ /ccw-loop-b TASK="Add user logout function"
57
125
  ```
58
- .loop/
59
- +-- {loopId}.json # Master state
60
- +-- {loopId}.workers/ # Worker outputs (JSON)
61
- +-- {loopId}.progress/ # Human-readable progress (MD)
126
+
127
+ **Auto flow**:
128
+ - Init: Parse requirements
129
+ - Develop: Implement logout in `src/auth.ts`
130
+ - Validate: Run tests
131
+ - Complete: Generate commit message
132
+
133
+ ### Example 2: Bug Investigation
134
+
135
+ ```bash
136
+ /ccw-loop-b TASK="Fix memory leak in WebSocket handler"
62
137
  ```
63
138
 
64
- ## Core Pattern
139
+ **Interactive flow**:
140
+ 1. Init: Parse issue
141
+ 2. User selects "debug" → Spawn debug worker
142
+ 3. Debug: Root cause analysis → recommends fix
143
+ 4. User selects "develop" → Apply fix
144
+ 5. User selects "validate" → Verify fix works
145
+ 6. User selects "complete" → Generate summary
65
146
 
66
- ### Coordinator + Worker
147
+ ### Example 3: Comprehensive Analysis
67
148
 
68
- ```javascript
69
- // Coordinator spawns specialized worker
70
- const worker = spawn_agent({ message: buildWorkerPrompt(action) })
149
+ ```bash
150
+ /ccw-loop-b --mode=parallel TASK="Analyze payment module for improvements"
151
+ ```
71
152
 
72
- // Wait for completion
73
- const result = wait({ ids: [worker], timeout_ms: 600000 })
153
+ **Parallel flow**:
154
+ - Spawn [develop, debug, validate] workers simultaneously
155
+ - Develop: Analyze code quality and patterns
156
+ - Debug: Identify potential issues
157
+ - Validate: Check test coverage
158
+ - Wait for all three to complete
159
+ - Merge findings into comprehensive report
74
160
 
75
- // Process result
76
- const output = result.status[worker].completed
77
- updateState(output)
161
+ ### Example 4: Resume Existing Loop
78
162
 
79
- // Cleanup
80
- close_agent({ id: worker })
163
+ ```bash
164
+ /ccw-loop-b --loop-id=loop-b-20260122-abc123
81
165
  ```
82
166
 
83
- ### Batch Wait (Parallel Mode)
167
+ Continues from previous state, respects status (running/paused).
168
+
169
+ ## Key Features
170
+
171
+ ### 1. Worker Specialization
172
+
173
+ Each worker focuses on one domain:
174
+ - **No overlap**: Clear boundaries between workers
175
+ - **Reusable**: Same worker for different tasks
176
+ - **Composable**: Combine workers for complex workflows
177
+
178
+ ### 2. Flexible Coordination
179
+
180
+ Coordinator adapts to mode:
181
+ - **Interactive**: Menu-driven, user controls flow
182
+ - **Auto**: Predetermined sequence
183
+ - **Parallel**: Concurrent execution with batch wait
184
+
185
+ ### 3. State Management
186
+
187
+ Unified state at `.workflow/.loop/{loopId}.json`:
188
+ - **API compatible**: Works with CCW API
189
+ - **Extension fields**: Skill-specific data in `skill_state`
190
+ - **Worker outputs**: Structured JSON for each action
191
+
192
+ ### 4. Progress Tracking
193
+
194
+ Human-readable logs:
195
+ - **Per-worker progress**: `{action}.md` files
196
+ - **Summary**: Consolidated achievements
197
+ - **Commit-ready**: Formatted commit messages
198
+
199
+ ## Best Practices
200
+
201
+ 1. **Start with Init**: Always initialize before execution
202
+ 2. **Use appropriate mode**:
203
+ - Interactive: Complex tasks needing user decisions
204
+ - Auto: Well-defined workflows
205
+ - Parallel: Independent analysis tasks
206
+ 3. **Clean up workers**: `close_agent()` after each worker completes
207
+ 4. **Batch wait wisely**: Use in parallel mode for efficiency
208
+ 5. **Track progress**: Document in progress files
209
+ 6. **Validate often**: After each develop phase
210
+
211
+ ## Implementation Patterns
212
+
213
+ ### Pattern 1: Single Worker Deep Interaction
214
+
215
+ ```javascript
216
+ const workerId = spawn_agent({ message: workerPrompt })
217
+ const result1 = wait({ ids: [workerId] })
218
+
219
+ // Continue with same worker
220
+ send_input({ id: workerId, message: "Continue with next task" })
221
+ const result2 = wait({ ids: [workerId] })
222
+
223
+ close_agent({ id: workerId })
224
+ ```
225
+
226
+ ### Pattern 2: Multi-Worker Parallel
84
227
 
85
228
  ```javascript
86
- // Spawn multiple workers
87
- const workers = [
88
- spawn_agent({ message: developPrompt }),
89
- spawn_agent({ message: debugPrompt }),
90
- spawn_agent({ message: validatePrompt })
91
- ]
229
+ const workers = {
230
+ develop: spawn_agent({ message: developPrompt }),
231
+ debug: spawn_agent({ message: debugPrompt }),
232
+ validate: spawn_agent({ message: validatePrompt })
233
+ }
92
234
 
93
235
  // Batch wait
94
- const results = wait({ ids: workers, timeout_ms: 900000 })
236
+ const results = wait({ ids: Object.values(workers), timeout_ms: 900000 })
95
237
 
96
- // Merge results
97
- const merged = mergeOutputs(results)
238
+ // Process all results
239
+ Object.values(workers).forEach(id => close_agent({ id }))
98
240
  ```
99
241
 
100
- ## License
242
+ ### Pattern 3: Sequential Worker Chain
243
+
244
+ ```javascript
245
+ const actions = ['init', 'develop', 'validate', 'complete']
246
+
247
+ for (const action of actions) {
248
+ const workerId = spawn_agent({ message: buildPrompt(action) })
249
+ const result = wait({ ids: [workerId] })
250
+
251
+ updateState(action, result)
252
+ close_agent({ id: workerId })
253
+ }
254
+ ```
255
+
256
+ ## Error Handling
257
+
258
+ | Error | Recovery |
259
+ |-------|----------|
260
+ | Worker timeout | `send_input` request convergence |
261
+ | Worker fails | Log error, coordinator decides retry strategy |
262
+ | Partial results | Use completed workers, mark incomplete |
263
+ | State corruption | Rebuild from progress files |
264
+
265
+ ## File Structure
266
+
267
+ ```
268
+ .codex/skills/ccw-loop-b/
269
+ +-- SKILL.md # Entry point
270
+ +-- README.md # This file
271
+ +-- phases/
272
+ | +-- state-schema.md # State structure definition
273
+ +-- specs/
274
+ +-- action-catalog.md # Action reference
275
+
276
+ .codex/agents/
277
+ +-- ccw-loop-b-init.md # Worker: Init
278
+ +-- ccw-loop-b-develop.md # Worker: Develop
279
+ +-- ccw-loop-b-debug.md # Worker: Debug
280
+ +-- ccw-loop-b-validate.md # Worker: Validate
281
+ +-- ccw-loop-b-complete.md # Worker: Complete
282
+ ```
283
+
284
+ ## Comparison: ccw-loop vs ccw-loop-b
285
+
286
+ | Aspect | ccw-loop | ccw-loop-b |
287
+ |--------|----------|------------|
288
+ | Pattern | Single agent, multi-phase | Coordinator + workers |
289
+ | Worker model | Single agent handles all | Specialized workers per action |
290
+ | Parallelization | Sequential only | Supports parallel mode |
291
+ | Flexibility | Fixed sequence | Mode-based (interactive/auto/parallel) |
292
+ | Best for | Simple linear workflows | Complex tasks needing specialization |
293
+
294
+ ## Contributing
101
295
 
102
- MIT
296
+ To add new workers:
297
+ 1. Create worker role file in `.codex/agents/`
298
+ 2. Define clear responsibilities
299
+ 3. Update `action-catalog.md`
300
+ 4. Add worker to coordinator spawn logic
301
+ 5. Test integration with existing workers
@@ -61,7 +61,7 @@ Coordinator -> spawn [develop, debug, validate] in parallel -> wait({ ids: all }
61
61
  ## Session Structure
62
62
 
63
63
  ```
64
- .loop/
64
+ .workflow/.loop/
65
65
  +-- {loopId}.json # Master state
66
66
  +-- {loopId}.workers/ # Worker outputs
67
67
  | +-- develop.output.json
@@ -242,9 +242,9 @@ function buildWorkerPrompt(action, loopId, state) {
242
242
 
243
243
  - **Loop ID**: ${loopId}
244
244
  - **Action**: ${action}
245
- - **State File**: .loop/${loopId}.json
246
- - **Output File**: .loop/${loopId}.workers/${action}.output.json
247
- - **Progress File**: .loop/${loopId}.progress/${action}.md
245
+ - **State File**: .workflow/.loop/${loopId}.json
246
+ - **Output File**: .workflow/.loop/${loopId}.workers/${action}.output.json
247
+ - **Progress File**: .workflow/.loop/${loopId}.progress/${action}.md
248
248
 
249
249
  ## CURRENT STATE
250
250
 
@@ -14,7 +14,7 @@ Read state -> Select mode -> Spawn workers -> Wait results -> Merge -> Update st
14
14
 
15
15
  ```javascript
16
16
  function readState(loopId) {
17
- const stateFile = `.loop/${loopId}.json`
17
+ const stateFile = `.workflow/.loop/${loopId}.json`
18
18
  return fs.existsSync(stateFile)
19
19
  ? JSON.parse(Read(stateFile))
20
20
  : null
@@ -252,6 +252,6 @@ function parseWorkerResult(output) {
252
252
  ## Best Practices
253
253
 
254
254
  1. **Worker 生命周期**: spawn → wait → close,不保留 worker
255
- 2. **结果持久化**: Worker 输出写入 `.loop/{loopId}.workers/`
255
+ 2. **结果持久化**: Worker 输出写入 `.workflow/.loop/{loopId}.workers/`
256
256
  3. **状态同步**: 每次 worker 完成后更新 state
257
257
  4. **超时处理**: send_input 请求收敛,再超时则跳过
@@ -56,7 +56,7 @@
56
56
 
57
57
  ## Worker Output Structure
58
58
 
59
- Each worker writes to `.loop/{loopId}.workers/{action}.output.json`:
59
+ Each worker writes to `.workflow/.loop/{loopId}.workers/{action}.output.json`:
60
60
 
61
61
  ```json
62
62
  {
@@ -81,7 +81,7 @@ Each worker writes to `.loop/{loopId}.workers/{action}.output.json`:
81
81
 
82
82
  ## Progress File Structure
83
83
 
84
- Human-readable progress in `.loop/{loopId}.progress/{action}.md`:
84
+ Human-readable progress in `.workflow/.loop/{loopId}.progress/{action}.md`:
85
85
 
86
86
  ```markdown
87
87
  # Develop Progress
@@ -165,7 +165,7 @@ When `mode === 'parallel'`:
165
165
  ## Directory Structure
166
166
 
167
167
  ```
168
- .loop/
168
+ .workflow/.loop/
169
169
  +-- loop-b-20260122-abc123.json # Master state
170
170
  +-- loop-b-20260122-abc123.workers/
171
171
  | +-- init.output.json