claude-code-workflow 6.3.37 → 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 (173) hide show
  1. package/.claude/commands/workflow/lite-execute.md +2 -0
  2. package/.codex/agents/action-planning-agent.md +885 -0
  3. package/.codex/agents/ccw-loop-b-complete.md +227 -0
  4. package/.codex/agents/ccw-loop-b-debug.md +172 -0
  5. package/.codex/agents/ccw-loop-b-develop.md +147 -0
  6. package/.codex/agents/ccw-loop-b-init.md +82 -0
  7. package/.codex/agents/ccw-loop-b-validate.md +204 -0
  8. package/.codex/agents/ccw-loop-executor.md +260 -0
  9. package/.codex/agents/cli-discuss-agent.md +391 -0
  10. package/.codex/agents/cli-execution-agent.md +333 -0
  11. package/.codex/agents/cli-explore-agent.md +186 -0
  12. package/.codex/agents/cli-lite-planning-agent.md +736 -0
  13. package/.codex/agents/cli-planning-agent.md +562 -0
  14. package/.codex/agents/code-developer.md +408 -0
  15. package/.codex/agents/conceptual-planning-agent.md +321 -0
  16. package/.codex/agents/context-search-agent.md +585 -0
  17. package/.codex/agents/debug-explore-agent.md +436 -0
  18. package/.codex/agents/doc-generator.md +334 -0
  19. package/.codex/agents/issue-plan-agent.md +417 -0
  20. package/.codex/agents/issue-queue-agent.md +311 -0
  21. package/.codex/agents/memory-bridge.md +96 -0
  22. package/.codex/agents/test-context-search-agent.md +402 -0
  23. package/.codex/agents/test-fix-agent.md +359 -0
  24. package/.codex/agents/ui-design-agent.md +595 -0
  25. package/.codex/agents/universal-executor.md +135 -0
  26. package/.codex/prompts/clean.md +409 -0
  27. package/.codex/prompts/issue-discover-by-prompt.md +364 -0
  28. package/.codex/prompts/issue-discover.md +261 -0
  29. package/.codex/prompts/issue-execute.md +10 -0
  30. package/.codex/prompts/issue-new.md +285 -0
  31. package/.codex/prompts/issue-plan.md +161 -63
  32. package/.codex/prompts/issue-queue.md +298 -288
  33. package/.codex/prompts/lite-execute.md +627 -133
  34. package/.codex/prompts/lite-fix.md +670 -0
  35. package/.codex/prompts/lite-plan-a.md +337 -0
  36. package/.codex/prompts/lite-plan-b.md +485 -0
  37. package/.codex/prompts/{lite-plan.md → lite-plan-c.md} +601 -469
  38. package/.codex/skills/ccw-loop/README.md +171 -0
  39. package/.codex/skills/ccw-loop/SKILL.md +349 -0
  40. package/.codex/skills/ccw-loop/phases/actions/action-complete.md +269 -0
  41. package/.codex/skills/ccw-loop/phases/actions/action-debug.md +286 -0
  42. package/.codex/skills/ccw-loop/phases/actions/action-develop.md +183 -0
  43. package/.codex/skills/ccw-loop/phases/actions/action-init.md +164 -0
  44. package/.codex/skills/ccw-loop/phases/actions/action-menu.md +205 -0
  45. package/.codex/skills/ccw-loop/phases/actions/action-validate.md +250 -0
  46. package/.codex/skills/ccw-loop/phases/orchestrator.md +416 -0
  47. package/.codex/skills/ccw-loop/phases/state-schema.md +388 -0
  48. package/.codex/skills/ccw-loop/specs/action-catalog.md +182 -0
  49. package/.codex/skills/ccw-loop-b/README.md +301 -0
  50. package/.codex/skills/ccw-loop-b/SKILL.md +322 -0
  51. package/.codex/skills/ccw-loop-b/phases/orchestrator.md +257 -0
  52. package/.codex/skills/ccw-loop-b/phases/state-schema.md +181 -0
  53. package/.codex/skills/ccw-loop-b/specs/action-catalog.md +383 -0
  54. package/.codex/skills/parallel-dev-cycle/README.md +382 -0
  55. package/.codex/skills/parallel-dev-cycle/SKILL.md +512 -0
  56. package/.codex/skills/parallel-dev-cycle/phases/agents/code-developer.md +242 -0
  57. package/.codex/skills/parallel-dev-cycle/phases/agents/exploration-planner.md +285 -0
  58. package/.codex/skills/parallel-dev-cycle/phases/agents/requirements-analyst.md +285 -0
  59. package/.codex/skills/parallel-dev-cycle/phases/agents/validation-archivist.md +381 -0
  60. package/.codex/skills/parallel-dev-cycle/phases/orchestrator.md +696 -0
  61. package/.codex/skills/parallel-dev-cycle/phases/state-schema.md +436 -0
  62. package/.codex/skills/parallel-dev-cycle/specs/communication-optimization.md +423 -0
  63. package/.codex/skills/parallel-dev-cycle/specs/coordination-protocol.md +391 -0
  64. package/.codex/skills/parallel-dev-cycle/specs/versioning-strategy.md +330 -0
  65. package/ccw/dist/cli.d.ts.map +1 -1
  66. package/ccw/dist/cli.js +4 -0
  67. package/ccw/dist/cli.js.map +1 -1
  68. package/ccw/dist/commands/install.d.ts.map +1 -1
  69. package/ccw/dist/commands/install.js +39 -8
  70. package/ccw/dist/commands/install.js.map +1 -1
  71. package/ccw/dist/commands/issue.d.ts +3 -0
  72. package/ccw/dist/commands/issue.d.ts.map +1 -1
  73. package/ccw/dist/commands/issue.js +107 -0
  74. package/ccw/dist/commands/issue.js.map +1 -1
  75. package/ccw/dist/commands/upgrade.js +1 -1
  76. package/ccw/dist/commands/upgrade.js.map +1 -1
  77. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  78. package/ccw/dist/config/litellm-api-config-manager.js +3 -2
  79. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  80. package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -1
  81. package/ccw/dist/core/memory-embedder-bridge.js +2 -5
  82. package/ccw/dist/core/memory-embedder-bridge.js.map +1 -1
  83. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  84. package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
  85. package/ccw/dist/core/routes/codexlens/config-handlers.js +7 -6
  86. package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
  87. package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -1
  88. package/ccw/dist/core/routes/codexlens/semantic-handlers.js +2 -2
  89. package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -1
  90. package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -1
  91. package/ccw/dist/core/routes/graph-routes.js +17 -2
  92. package/ccw/dist/core/routes/graph-routes.js.map +1 -1
  93. package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
  94. package/ccw/dist/core/routes/issue-routes.js +280 -33
  95. package/ccw/dist/core/routes/issue-routes.js.map +1 -1
  96. package/ccw/dist/core/routes/loop-v2-routes.d.ts +9 -0
  97. package/ccw/dist/core/routes/loop-v2-routes.d.ts.map +1 -1
  98. package/ccw/dist/core/routes/loop-v2-routes.js +56 -4
  99. package/ccw/dist/core/routes/loop-v2-routes.js.map +1 -1
  100. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  101. package/ccw/dist/core/routes/system-routes.js +3 -2
  102. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  103. package/ccw/dist/core/server.d.ts.map +1 -1
  104. package/ccw/dist/core/server.js +5 -3
  105. package/ccw/dist/core/server.js.map +1 -1
  106. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  107. package/ccw/dist/tools/claude-cli-tools.js +4 -3
  108. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  109. package/ccw/dist/tools/cli-config-manager.d.ts +1 -0
  110. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  111. package/ccw/dist/tools/cli-config-manager.js +2 -1
  112. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  113. package/ccw/dist/tools/codex-lens-lsp.d.ts.map +1 -1
  114. package/ccw/dist/tools/codex-lens-lsp.js +2 -5
  115. package/ccw/dist/tools/codex-lens-lsp.js.map +1 -1
  116. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  117. package/ccw/dist/tools/codex-lens.js +22 -32
  118. package/ccw/dist/tools/codex-lens.js.map +1 -1
  119. package/ccw/dist/tools/litellm-client.d.ts +6 -0
  120. package/ccw/dist/tools/litellm-client.d.ts.map +1 -1
  121. package/ccw/dist/tools/litellm-client.js +15 -2
  122. package/ccw/dist/tools/litellm-client.js.map +1 -1
  123. package/ccw/dist/tools/loop-task-manager.d.ts +13 -2
  124. package/ccw/dist/tools/loop-task-manager.d.ts.map +1 -1
  125. package/ccw/dist/tools/loop-task-manager.js.map +1 -1
  126. package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -1
  127. package/ccw/dist/tools/native-session-discovery.js +35 -7
  128. package/ccw/dist/tools/native-session-discovery.js.map +1 -1
  129. package/ccw/dist/utils/codexlens-path.d.ts +36 -0
  130. package/ccw/dist/utils/codexlens-path.d.ts.map +1 -0
  131. package/ccw/dist/utils/codexlens-path.js +56 -0
  132. package/ccw/dist/utils/codexlens-path.js.map +1 -0
  133. package/ccw/dist/utils/uv-manager.d.ts.map +1 -1
  134. package/ccw/dist/utils/uv-manager.js +3 -2
  135. package/ccw/dist/utils/uv-manager.js.map +1 -1
  136. package/ccw/src/cli.ts +4 -0
  137. package/ccw/src/commands/install.ts +51 -8
  138. package/ccw/src/commands/issue.ts +119 -0
  139. package/ccw/src/commands/upgrade.ts +1 -1
  140. package/ccw/src/config/litellm-api-config-manager.ts +3 -2
  141. package/ccw/src/core/memory-embedder-bridge.ts +2 -6
  142. package/ccw/src/core/routes/cli-routes.ts +1 -1
  143. package/ccw/src/core/routes/codexlens/config-handlers.ts +7 -6
  144. package/ccw/src/core/routes/codexlens/semantic-handlers.ts +2 -2
  145. package/ccw/src/core/routes/graph-routes.ts +18 -2
  146. package/ccw/src/core/routes/issue-routes.ts +308 -33
  147. package/ccw/src/core/routes/loop-v2-routes.ts +64 -6
  148. package/ccw/src/core/routes/system-routes.ts +3 -2
  149. package/ccw/src/core/server.ts +6 -3
  150. package/ccw/src/templates/dashboard-css/02-session.css +2 -0
  151. package/ccw/src/templates/dashboard-css/04-lite-tasks.css +103 -1
  152. package/ccw/src/templates/dashboard-css/32-issue-manager.css +32 -0
  153. package/ccw/src/templates/dashboard-js/components/cli-history.js +48 -48
  154. package/ccw/src/templates/dashboard-js/components/navigation.js +6 -0
  155. package/ccw/src/templates/dashboard-js/components/notifications.js +6 -0
  156. package/ccw/src/templates/dashboard-js/components/version-check.js +38 -0
  157. package/ccw/src/templates/dashboard-js/i18n.js +126 -0
  158. package/ccw/src/templates/dashboard-js/state.js +2 -0
  159. package/ccw/src/templates/dashboard-js/views/cli-manager.js +1 -1
  160. package/ccw/src/templates/dashboard-js/views/issue-manager.js +183 -1
  161. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +55 -11
  162. package/ccw/src/templates/dashboard-js/views/loop-monitor.js +112 -11
  163. package/ccw/src/templates/dashboard.html +48 -2
  164. package/ccw/src/tools/claude-cli-tools.ts +4 -3
  165. package/ccw/src/tools/cli-config-manager.ts +3 -1
  166. package/ccw/src/tools/codex-lens-lsp.ts +2 -5
  167. package/ccw/src/tools/codex-lens.ts +27 -38
  168. package/ccw/src/tools/litellm-client.ts +16 -2
  169. package/ccw/src/tools/loop-task-manager.ts +13 -2
  170. package/ccw/src/tools/native-session-discovery.ts +38 -7
  171. package/ccw/src/utils/codexlens-path.ts +60 -0
  172. package/ccw/src/utils/uv-manager.ts +3 -2
  173. package/package.json +1 -1
@@ -0,0 +1,391 @@
1
+ # Coordination Protocol - Multi-Agent Communication
2
+
3
+ Inter-agent communication protocols and patterns for parallel-dev-cycle skill.
4
+
5
+ ## Overview
6
+
7
+ The coordination protocol enables four parallel agents (RA, EP, CD, VAS) to communicate efficiently while maintaining clear responsibilities and avoiding conflicts.
8
+
9
+ ## Communication Channels
10
+
11
+ ### 1. Shared State File (Primary)
12
+
13
+ **Location**: `.workflow/.cycle/{cycleId}.json`
14
+
15
+ All agents read from and write to the unified state file:
16
+
17
+ ```javascript
18
+ // Every agent: Read fresh state at action start
19
+ const state = JSON.parse(Read(`.workflow/.cycle/${cycleId}.json`))
20
+
21
+ // Every agent: Write updated state at action end
22
+ Write(`.workflow/.cycle/${cycleId}.json`, JSON.stringify(state, null, 2))
23
+ ```
24
+
25
+ **Protocol**:
26
+ - Read-Update-Write pattern (no lock needed, orchestrator serializes)
27
+ - Timestamp all updates with ISO8601 format
28
+ - Never delete existing data, only append
29
+
30
+ ### 2. Progress Markdown Files (Async Log)
31
+
32
+ **Location**: `.workflow/.cycle/{cycleId}.progress/{agent}/`
33
+
34
+ Each agent writes progress to dedicated markdown files:
35
+
36
+ | Agent | Files |
37
+ |-------|-------|
38
+ | RA | requirements.md, edge-cases.md, changes.log |
39
+ | EP | exploration.md, architecture.md, plan.json |
40
+ | CD | implementation.md, code-changes.log, issues.md |
41
+ | VAS | validation.md, test-results.json, coverage.md, summary.md |
42
+
43
+ **Protocol**:
44
+ - Append-only pattern (no overwrites)
45
+ - Version each document independently
46
+ - Include timestamp on each update
47
+ - Maintain backward compatibility
48
+
49
+ ### 3. Orchestrator send_input (Synchronous)
50
+
51
+ **When**: Orchestrator needs to send feedback or corrections
52
+
53
+ ```javascript
54
+ // Example: CD agent receives test failure feedback
55
+ send_input({
56
+ id: agents.cd,
57
+ message: `
58
+ ## FEEDBACK FROM VALIDATION
59
+
60
+ Test failures detected: ${failures}
61
+
62
+ ## REQUIRED ACTION
63
+
64
+ Fix the following:
65
+ ${actionItems}
66
+
67
+ ## NEXT STEP
68
+ Update implementation.md with fixes, then re-run tests.
69
+ Output PHASE_RESULT when complete.
70
+ `
71
+ })
72
+ ```
73
+
74
+ **Protocol**:
75
+ - Only orchestrator initiates send_input
76
+ - Clear action items and expected output
77
+ - Single message per iteration (no rapid-fire sends)
78
+
79
+ ### 4. Coordination Log
80
+
81
+ **Location**: `.workflow/.cycle/{cycleId}.progress/coordination/`
82
+
83
+ Centralized log for inter-agent decisions and communication:
84
+
85
+ **feedback.md**:
86
+ ```markdown
87
+ # Feedback & Coordination Log - Version X.Y.Z
88
+
89
+ ## Timeline
90
+ - [10:00:00] Orchestrator: Created cycle
91
+ - [10:05:00] RA: Requirements analysis started
92
+ - [10:10:00] RA: Requirements completed, v1.0.0
93
+ - [10:10:01] EP: Starting exploration (depends on RA output)
94
+ - [10:15:00] EP: Architecture designed, plan.json v1.0.0
95
+ - [10:15:01] CD: Starting implementation (depends on EP plan)
96
+ - [10:30:00] CD: Implementation progressing, found blocker
97
+ - [10:31:00] RA: Clarified requirement after CD blocker
98
+ - [10:31:01] CD: Continuing with clarification
99
+ - [10:40:00] CD: Implementation complete
100
+ - [10:40:01] VAS: Starting validation
101
+ - [10:45:00] VAS: Testing complete, found failures
102
+ - [10:45:01] Orchestrator: Sending feedback to CD
103
+ - [10:46:00] CD: Fixed issues
104
+ - [10:50:00] VAS: Re-validation, all passing
105
+ - [10:50:01] Orchestrator: Cycle complete
106
+
107
+ ## Decision Records
108
+ - [10:31:00] RA Clarification: OAuth optional vs required?
109
+ - Decision: Optional (can use password)
110
+ - Rationale: More flexible for users
111
+ - Impact: Affects FR-003 implementation
112
+
113
+ ## Blockers & Resolutions
114
+ - [10:30:00] Blocker: Database migration for existing users
115
+ - Reported by: CD
116
+ - Resolution: Set oauth_id = null for existing users
117
+ - Status: Resolved
118
+
119
+ ## Cross-Agent Dependencies
120
+ - EP depends on: RA requirements (v1.0.0)
121
+ - CD depends on: EP plan (v1.0.0)
122
+ - VAS depends on: CD code changes
123
+ ```
124
+
125
+ ## Message Formats
126
+
127
+ ### Agent Status Update
128
+
129
+ Each agent updates state with its status:
130
+
131
+ ```json
132
+ {
133
+ "agents": {
134
+ "ra": {
135
+ "status": "completed",
136
+ "started_at": "2026-01-22T10:05:00+08:00",
137
+ "completed_at": "2026-01-22T10:15:00+08:00",
138
+ "output_files": [
139
+ ".workflow/.cycle/cycle-xxx.progress/ra/requirements.md",
140
+ ".workflow/.cycle/cycle-xxx.progress/ra/edge-cases.md",
141
+ ".workflow/.cycle/cycle-xxx.progress/ra/changes.log"
142
+ ],
143
+ "iterations_completed": 1
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### Feedback Message Format
150
+
151
+ When orchestrator sends feedback via send_input:
152
+
153
+ ```text
154
+ ## FEEDBACK FROM [Agent Name]
155
+
156
+ [Summary of findings or issues]
157
+
158
+ ## REFERENCED OUTPUT
159
+ File: [path to agent output]
160
+ Version: [X.Y.Z]
161
+
162
+ ## REQUIRED ACTION
163
+
164
+ 1. [Action 1 with specific details]
165
+ 2. [Action 2 with specific details]
166
+
167
+ ## SUCCESS CRITERIA
168
+
169
+ - [ ] Item 1
170
+ - [ ] Item 2
171
+
172
+ ## NEXT STEP
173
+ [What agent should do next]
174
+ Output PHASE_RESULT when complete.
175
+
176
+ ## CONTEXT
177
+
178
+ Previous iteration: [N]
179
+ Current iteration: [N+1]
180
+ ```
181
+
182
+ ### Phase Result Format
183
+
184
+ Every agent outputs PHASE_RESULT:
185
+
186
+ ```text
187
+ PHASE_RESULT:
188
+ - phase: [ra|ep|cd|vas]
189
+ - status: success | failed | partial
190
+ - files_written: [list of files]
191
+ - summary: [one-line summary]
192
+ - [agent-specific fields]
193
+ - issues: [list of issues if any]
194
+
195
+ PHASE_DETAILS:
196
+ [Additional details or metrics]
197
+ ```
198
+
199
+ ## Dependency Resolution
200
+
201
+ ### Build Order (Default)
202
+
203
+ ```
204
+ RA (Requirements) → EP (Planning) → CD (Development) → VAS (Validation)
205
+ ↓ ↓ ↓ ↓
206
+ Block EP Block CD Block VAS Block completion
207
+ ```
208
+
209
+ ### Parallel Opportunities
210
+
211
+ Some phases can run in parallel:
212
+
213
+ ```
214
+ RA + FrontendCode (independent)
215
+ EP + RA (not blocking)
216
+ CD.Task1 + CD.Task2 (if no dependencies)
217
+ ```
218
+
219
+ ### Dependency Tracking
220
+
221
+ State file tracks dependencies:
222
+
223
+ ```json
224
+ {
225
+ "agents": {
226
+ "ep": {
227
+ "depends_on": ["ra"],
228
+ "ready": true, // RA completed
229
+ "can_start": true
230
+ },
231
+ "cd": {
232
+ "depends_on": ["ep"],
233
+ "ready": true, // EP completed
234
+ "can_start": true
235
+ },
236
+ "vas": {
237
+ "depends_on": ["cd"],
238
+ "ready": false, // CD not yet complete
239
+ "can_start": false
240
+ }
241
+ }
242
+ }
243
+ ```
244
+
245
+ ## Iteration Flow with Communication
246
+
247
+ ### Iteration 1: Initial Execution
248
+
249
+ ```
250
+ Time Agent Action State Update
251
+ ──────────────────────────────────────────────────────
252
+ 10:00 Init Create cycle status: running
253
+ 10:05 RA Start analysis agents.ra.status: running
254
+ 10:10 RA Complete (v1.0.0) agents.ra.status: completed
255
+ 10:10 EP Start planning agents.ep.status: running
256
+ (depends on RA completion)
257
+ 10:15 EP Complete (v1.0.0) agents.ep.status: completed
258
+ 10:15 CD Start development agents.cd.status: running
259
+ (depends on EP completion)
260
+ 10:30 CD Found blocker coordination.blockers.add()
261
+ 10:31 RA Clarify blocker requirements.v1.1.0 created
262
+ 10:35 CD Continue (with fix) agents.cd.status: running
263
+ 10:40 CD Complete agents.cd.status: completed
264
+ 10:40 VAS Start validation agents.vas.status: running
265
+ (depends on CD completion)
266
+ 10:45 VAS Tests failing coordination.feedback_log.add()
267
+ 10:45 Orch Send feedback agents.cd.message: "Fix these tests"
268
+ 10:46 CD Resume (send_input) agents.cd.status: running
269
+ 10:48 CD Fix complete agents.cd.status: completed
270
+ 10:50 VAS Re-validate agents.vas.status: running
271
+ 10:55 VAS All pass agents.vas.status: completed
272
+ 11:00 Orch Complete cycle status: completed
273
+ ```
274
+
275
+ ## Conflict Resolution
276
+
277
+ ### Conflict Type 1: Unclear Requirement
278
+
279
+ **Scenario**: CD needs clarification on FR-X
280
+
281
+ **Resolution Flow**:
282
+ 1. CD reports blocker in issues.md
283
+ 2. Orchestrator extracts blocker
284
+ 3. Orchestrator sends message to RA
285
+ 4. RA updates requirements with clarification
286
+ 5. RA outputs new requirements.md (v1.1.0)
287
+ 6. Orchestrator sends message to CD with clarification
288
+ 7. CD resumes and continues
289
+
290
+ ### Conflict Type 2: Test Failure
291
+
292
+ **Scenario**: VAS finds test failures
293
+
294
+ **Resolution Flow**:
295
+ 1. VAS reports failures in validation.md
296
+ 2. VAS outputs test-results.json with details
297
+ 3. Orchestrator extracts failure details
298
+ 4. Orchestrator categorizes failures
299
+ 5. If blocker: Orchestrator sends to CD/RA for fixes
300
+ 6. CD/RA fix and report completion
301
+ 7. Orchestrator sends CD/VAS to retry
302
+ 8. VAS re-validates
303
+
304
+ ### Conflict Type 3: Plan Mismatch
305
+
306
+ **Scenario**: CD realizes plan tasks are incomplete
307
+
308
+ **Resolution Flow**:
309
+ 1. CD reports in issues.md
310
+ 2. Orchestrator extracts issue
311
+ 3. Orchestrator sends to EP to revise plan
312
+ 4. EP updates plan.json (v1.1.0)
313
+ 5. EP adds new tasks or dependencies
314
+ 6. Orchestrator sends to CD with updated plan
315
+ 7. CD implements remaining tasks
316
+
317
+ ## Escalation Path
318
+
319
+ For issues that block resolution:
320
+
321
+ ```
322
+ Agent Issue
323
+
324
+ Agent reports blocker
325
+
326
+ Orchestrator analyzes
327
+
328
+ Can fix automatically?
329
+ ├─ Yes: send_input to agent with fix
330
+ └─ No: Escalate to user
331
+
332
+ User provides guidance
333
+
334
+ Orchestrator applies guidance
335
+
336
+ Resume agents
337
+ ```
338
+
339
+ ## Communication Best Practices
340
+
341
+ 1. **Clear Timestamps**: All events timestamped ISO8601 format
342
+ 2. **Structured Messages**: Use consistent format for feedback
343
+ 3. **Version Tracking**: Always include version numbers
344
+ 4. **Audit Trail**: Maintain complete log of decisions
345
+ 5. **No Direct Agent Communication**: All communication via orchestrator
346
+ 6. **Document Decisions**: Record why decisions were made
347
+ 7. **Append-Only Logs**: Never delete history
348
+
349
+ ## State Consistency Rules
350
+
351
+ 1. **Single Writer Per Field**: Only one agent updates each field
352
+ - RA writes: requirements, edge_cases
353
+ - EP writes: exploration, plan
354
+ - CD writes: changes, implementation
355
+ - VAS writes: test_results, summary
356
+
357
+ 2. **Read-Write Serialization**: Orchestrator ensures no conflicts
358
+
359
+ 3. **Version Synchronization**: All versions increment together
360
+ - v1.0.0 → v1.1.0 (all docs updated)
361
+
362
+ 4. **Timestamp Consistency**: All timestamps in state file UTC+8
363
+
364
+ ## Monitoring & Debugging
365
+
366
+ ### State Inspection
367
+
368
+ ```javascript
369
+ // Check agent status
370
+ const state = JSON.parse(Read(`.workflow/.cycle/${cycleId}.json`))
371
+ console.log(state.agents) // See status of all agents
372
+
373
+ // Check for blockers
374
+ console.log(state.coordination.blockers)
375
+
376
+ // Check feedback history
377
+ console.log(state.coordination.feedback_log)
378
+ ```
379
+
380
+ ### Log Analysis
381
+
382
+ ```bash
383
+ # Check RA progress
384
+ tail .workflow/.cycle/cycle-xxx.progress/ra/changes.log
385
+
386
+ # Check CD changes
387
+ grep "TASK-001" .workflow/.cycle/cycle-xxx.progress/cd/code-changes.log
388
+
389
+ # Check coordination timeline
390
+ tail -50 .workflow/.cycle/cycle-xxx.progress/coordination/feedback.md
391
+ ```
@@ -0,0 +1,330 @@
1
+ # Document Versioning Strategy
2
+
3
+ 文档版本管理策略:重新创建 vs 增量更新
4
+
5
+ ## 推荐方案:重新创建 + 归档历史
6
+
7
+ 每次迭代,**完全重写**主文档,旧版本自动归档到 `history/` 目录。
8
+
9
+ ### 文件结构
10
+
11
+ ```
12
+ .workflow/.cycle/cycle-v1-20260122-abc123.progress/
13
+ ├── ra/
14
+ │ ├── requirements.md # v1.2.0 (当前版本,重新创建)
15
+ │ ├── edge-cases.md # v1.2.0 (当前版本,重新创建)
16
+ │ ├── changes.log # NDJSON 完整变更历史(append-only)
17
+ │ └── history/
18
+ │ ├── requirements-v1.0.0.md (归档)
19
+ │ ├── requirements-v1.1.0.md (归档)
20
+ │ ├── edge-cases-v1.0.0.md (归档)
21
+ │ └── edge-cases-v1.1.0.md (归档)
22
+ ├── ep/
23
+ │ ├── exploration.md # v1.2.0 (当前)
24
+ │ ├── architecture.md # v1.2.0 (当前)
25
+ │ ├── plan.json # v1.2.0 (当前)
26
+ │ └── history/
27
+ │ ├── plan-v1.0.0.json
28
+ │ └── plan-v1.1.0.json
29
+ ├── cd/
30
+ │ ├── implementation.md # v1.2.0 (当前)
31
+ │ ├── code-changes.log # NDJSON 完整历史
32
+ │ ├── issues.md # 当前未解决问题
33
+ │ └── history/
34
+ │ ├── implementation-v1.0.0.md
35
+ │ └── implementation-v1.1.0.md
36
+ └── vas/
37
+ ├── validation.md # v1.2.0 (当前)
38
+ ├── test-results.json # v1.2.0 (当前)
39
+ ├── summary.md # v1.2.0 (当前)
40
+ └── history/
41
+ ├── validation-v1.0.0.md
42
+ └── test-results-v1.0.0.json
43
+ ```
44
+
45
+ ## 文档模板优化
46
+
47
+ ### Requirements.md (重新创建版本)
48
+
49
+ ```markdown
50
+ # Requirements Specification - v1.2.0
51
+
52
+ ## Document Metadata
53
+ | Field | Value |
54
+ |-------|-------|
55
+ | Version | 1.2.0 |
56
+ | Previous | 1.1.0 (Added Google OAuth) |
57
+ | Changes | Added MFA, GitHub provider |
58
+ | Date | 2026-01-23T10:00:00+08:00 |
59
+ | Cycle | cycle-v1-20260122-abc123 |
60
+ | Iteration | 3 |
61
+
62
+ ---
63
+
64
+ ## Functional Requirements
65
+
66
+ ### FR-001: OAuth Authentication
67
+ **Description**: Users can log in using OAuth providers.
68
+
69
+ **Supported Providers**: Google, GitHub
70
+
71
+ **Priority**: High
72
+
73
+ **Status**: ✓ Implemented (v1.0.0), Enhanced (v1.1.0, v1.2.0)
74
+
75
+ **Success Criteria**:
76
+ - User can click provider button
77
+ - Redirect to provider
78
+ - Return with valid token
79
+ - Session created
80
+
81
+ ---
82
+
83
+ ### FR-002: Multi-Provider Support
84
+ **Description**: System supports multiple OAuth providers simultaneously.
85
+
86
+ **Providers**:
87
+ - Google (v1.1.0)
88
+ - GitHub (v1.2.0)
89
+
90
+ **Priority**: High
91
+
92
+ **Status**: ✓ Implemented
93
+
94
+ ---
95
+
96
+ ### FR-003: Multi-Factor Authentication
97
+ **Description**: Optional MFA for enhanced security.
98
+
99
+ **Method**: TOTP (Time-based One-Time Password)
100
+
101
+ **Priority**: Medium
102
+
103
+ **Status**: 🆕 New in v1.2.0
104
+
105
+ **Success Criteria**:
106
+ - User can enable MFA in settings
107
+ - TOTP QR code generated
108
+ - Verification on login
109
+
110
+ ---
111
+
112
+ ## Non-Functional Requirements
113
+
114
+ ### NFR-001: Performance
115
+ Response time < 500ms for all OAuth flows.
116
+
117
+ **Status**: ✓ Met (v1.0.0)
118
+
119
+ ---
120
+
121
+ ## Edge Cases
122
+
123
+ ### EC-001: OAuth Provider Timeout
124
+ **Scenario**: Provider doesn't respond in 5 seconds
125
+
126
+ **Expected**: Display error, offer retry
127
+
128
+ **Status**: ✓ Handled
129
+
130
+ ---
131
+
132
+ ### EC-002: Invalid MFA Code (NEW v1.2.0)
133
+ **Scenario**: User enters incorrect TOTP code
134
+
135
+ **Expected**: Display error, max 3 attempts, lock after
136
+
137
+ **Status**: 🔄 To be implemented
138
+
139
+ ---
140
+
141
+ ## Constraints
142
+ - Must use existing JWT session management
143
+ - No new database servers
144
+ - Compatible with existing user table
145
+
146
+ ---
147
+
148
+ ## Assumptions
149
+ - Users have access to authenticator app for MFA
150
+ - OAuth providers are always available
151
+
152
+ ---
153
+
154
+ ## Version History Summary
155
+
156
+ | Version | Date | Summary |
157
+ |---------|------|---------|
158
+ | 1.0.0 | 2026-01-22 | Initial OAuth login (Google only implicit) |
159
+ | 1.1.0 | 2026-01-22 | + Explicit Google OAuth support |
160
+ | 1.2.0 | 2026-01-23 | + GitHub provider, + MFA (current) |
161
+
162
+ **Detailed History**: See `history/` directory and `changes.log`
163
+ ```
164
+
165
+ ### Changes.log (NDJSON - 完整历史)
166
+
167
+ ```jsonl
168
+ {"timestamp":"2026-01-22T10:00:00+08:00","iteration":1,"version":"1.0.0","action":"create","type":"requirement","id":"FR-001","description":"Initial OAuth requirement"}
169
+ {"timestamp":"2026-01-22T10:05:00+08:00","iteration":1,"version":"1.0.0","action":"create","type":"requirement","id":"NFR-001","description":"Performance requirement"}
170
+ {"timestamp":"2026-01-22T11:00:00+08:00","iteration":2,"version":"1.1.0","action":"update","type":"requirement","id":"FR-001","description":"Clarified Google OAuth support"}
171
+ {"timestamp":"2026-01-22T11:05:00+08:00","iteration":2,"version":"1.1.0","action":"create","type":"requirement","id":"FR-002","description":"Multi-provider support"}
172
+ {"timestamp":"2026-01-23T10:00:00+08:00","iteration":3,"version":"1.2.0","action":"create","type":"requirement","id":"FR-003","description":"MFA requirement"}
173
+ {"timestamp":"2026-01-23T10:05:00+08:00","iteration":3,"version":"1.2.0","action":"update","type":"requirement","id":"FR-002","description":"Added GitHub provider"}
174
+ ```
175
+
176
+ ## 实现流程
177
+
178
+ ### Agent 工作流(RA 为例)
179
+
180
+ ```javascript
181
+ // ==================== RA Agent 迭代流程 ====================
182
+
183
+ // 读取当前状态
184
+ const state = JSON.parse(Read(`.workflow/.cycle/${cycleId}.json`))
185
+ const currentVersion = state.requirements?.version || "0.0.0"
186
+ const iteration = state.current_iteration
187
+
188
+ // 如果是迭代(已有旧版本)
189
+ if (currentVersion !== "0.0.0") {
190
+ // 1. 归档旧版本
191
+ const oldFile = `.workflow/.cycle/${cycleId}.progress/ra/requirements.md`
192
+ const archiveFile = `.workflow/.cycle/${cycleId}.progress/ra/history/requirements-v${currentVersion}.md`
193
+
194
+ Copy(oldFile, archiveFile) // 归档
195
+
196
+ // 2. 读取旧版本(可选,用于理解上下文)
197
+ const oldRequirements = Read(oldFile)
198
+
199
+ // 3. 读取变更历史
200
+ const changesLog = readNDJSON(`.workflow/.cycle/${cycleId}.progress/ra/changes.log`)
201
+ }
202
+
203
+ // 4. 生成新版本号
204
+ const newVersion = bumpVersion(currentVersion, 'minor') // 1.1.0 -> 1.2.0
205
+
206
+ // 5. 生成新文档(完全重写)
207
+ const newRequirements = generateRequirements({
208
+ version: newVersion,
209
+ previousVersion: currentVersion,
210
+ previousSummary: "Added Google OAuth support",
211
+ currentChanges: "Added MFA and GitHub provider",
212
+ iteration: iteration,
213
+ taskDescription: state.description,
214
+ changesLog: changesLog // 用于理解历史
215
+ })
216
+
217
+ // 6. 写入新文档(覆盖旧的)
218
+ Write(`.workflow/.cycle/${cycleId}.progress/ra/requirements.md`, newRequirements)
219
+
220
+ // 7. 追加变更到 changes.log
221
+ appendNDJSON(`.workflow/.cycle/${cycleId}.progress/ra/changes.log`, {
222
+ timestamp: getUtc8ISOString(),
223
+ iteration: iteration,
224
+ version: newVersion,
225
+ action: "create",
226
+ type: "requirement",
227
+ id: "FR-003",
228
+ description: "Added MFA requirement"
229
+ })
230
+
231
+ // 8. 更新状态
232
+ state.requirements = {
233
+ version: newVersion,
234
+ output_file: `.workflow/.cycle/${cycleId}.progress/ra/requirements.md`,
235
+ summary: {
236
+ functional_requirements: 3,
237
+ edge_cases: 2,
238
+ constraints: 3
239
+ }
240
+ }
241
+
242
+ Write(`.workflow/.cycle/${cycleId}.json`, JSON.stringify(state, null, 2))
243
+ ```
244
+
245
+ ## 优势对比
246
+
247
+ | 方面 | 增量更新 | 重新创建 + 归档 |
248
+ |------|----------|----------------|
249
+ | **文档简洁性** | ❌ 越来越长 | ✅ 始终简洁 |
250
+ | **Agent 解析** | ❌ 需要解析历史 | ✅ 只看当前版本 |
251
+ | **维护复杂度** | ❌ 高(版本标记) | ✅ 低(直接重写) |
252
+ | **文件大小** | ❌ 膨胀 | ✅ 固定 |
253
+ | **历史追溯** | ✅ 在主文档 | ✅ 在 history/ + changes.log |
254
+ | **人类可读** | ❌ 需要跳过历史 | ✅ 直接看当前 |
255
+ | **Token 使用** | ❌ 多(读取完整历史) | ✅ 少(只读当前) |
256
+
257
+ ## 归档策略
258
+
259
+ ### 自动归档触发时机
260
+
261
+ ```javascript
262
+ function shouldArchive(currentVersion, state) {
263
+ // 每次版本更新时归档
264
+ return currentVersion !== state.requirements?.version
265
+ }
266
+
267
+ function archiveOldVersion(cycleId, agent, filename, currentVersion) {
268
+ const currentFile = `.workflow/.cycle/${cycleId}.progress/${agent}/${filename}`
269
+ const archiveDir = `.workflow/.cycle/${cycleId}.progress/${agent}/history`
270
+ const archiveFile = `${archiveDir}/${filename.replace('.', `-v${currentVersion}.`)}`
271
+
272
+ // 确保归档目录存在
273
+ mkdir -p ${archiveDir}
274
+
275
+ // 复制(不是移动,保持当前文件直到新版本写入)
276
+ Copy(currentFile, archiveFile)
277
+
278
+ console.log(`Archived ${filename} v${currentVersion} to history/`)
279
+ }
280
+ ```
281
+
282
+ ### 清理策略(可选)
283
+
284
+ 保留最近 N 个版本,删除更老的归档:
285
+
286
+ ```javascript
287
+ function cleanupArchives(cycleId, agent, keepVersions = 3) {
288
+ const historyDir = `.workflow/.cycle/${cycleId}.progress/${agent}/history`
289
+ const archives = listFiles(historyDir)
290
+
291
+ // 按版本号排序
292
+ archives.sort((a, b) => compareVersions(extractVersion(a), extractVersion(b)))
293
+
294
+ // 删除最老的版本(保留最近 N 个)
295
+ if (archives.length > keepVersions) {
296
+ const toDelete = archives.slice(0, archives.length - keepVersions)
297
+ toDelete.forEach(file => Delete(`${historyDir}/${file}`))
298
+ }
299
+ }
300
+ ```
301
+
302
+ ## Changes.log 的重要性
303
+
304
+ 虽然主文档重新创建,但 **changes.log (NDJSON) 永久保留完整历史**:
305
+
306
+ ```bash
307
+ # 查看所有变更
308
+ cat .workflow/.cycle/cycle-xxx.progress/ra/changes.log | jq .
309
+
310
+ # 查看某个需求的历史
311
+ cat .workflow/.cycle/cycle-xxx.progress/ra/changes.log | jq 'select(.id=="FR-001")'
312
+
313
+ # 按迭代查看变更
314
+ cat .workflow/.cycle/cycle-xxx.progress/ra/changes.log | jq 'select(.iteration==2)'
315
+ ```
316
+
317
+ 这样:
318
+ - **主文档**: 清晰简洁(当前状态)
319
+ - **Changes.log**: 完整追溯(所有历史)
320
+ - **History/**: 快照备份(按需查看)
321
+
322
+ ## 推荐实施
323
+
324
+ 1. ✅ 采用"重新创建"策略
325
+ 2. ✅ 主文档只保留"上一版本简要说明"
326
+ 3. ✅ 自动归档到 `history/` 目录
327
+ 4. ✅ Changes.log (NDJSON) 保留完整历史
328
+ 5. ✅ 可选:保留最近 3-5 个历史版本
329
+
330
+ 这样既保持了文档简洁(Agent 友好),又保留了完整历史(审计友好)。