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,423 @@
1
+ # Agent Communication Optimization
2
+
3
+ 优化 agent 通信机制:使用简短的产出文件引用而不是内容传递。
4
+
5
+ ## 背景
6
+
7
+ 在多 agent 系统中,传递完整的文件内容会导致:
8
+ - 消息体积过大
9
+ - 上下文使用量增加
10
+ - 通信效率低下
11
+ - 容易引入上下文断层
12
+
13
+ **优化方案**: 使用文件路径引用,让 agent 自动读取需要的文件。
14
+
15
+ ## 优化原则
16
+
17
+ ### 原则 1: 文件引用而非内容传递
18
+
19
+ ❌ **错误做法**(传递内容):
20
+ ```javascript
21
+ send_input({
22
+ id: agents.cd,
23
+ message: `
24
+ Requirements:
25
+ ${requirements_content} // 完整内容 - 浪费空间
26
+
27
+ Plan:
28
+ ${plan_json} // 完整 JSON - 重复信息
29
+ `
30
+ })
31
+ ```
32
+
33
+ ✅ **正确做法**(引用文件):
34
+ ```javascript
35
+ send_input({
36
+ id: agents.cd,
37
+ message: `
38
+ ## Feedback from Validation
39
+
40
+ Test failures found. Review these outputs:
41
+
42
+ ## Reference
43
+ - Requirements: .workflow/.cycle/${cycleId}.progress/ra/requirements.md (v1.0.0)
44
+ - Plan: .workflow/.cycle/${cycleId}.progress/ep/plan.json (v1.0.0)
45
+ - Test Results: .workflow/.cycle/${cycleId}.progress/vas/test-results.json
46
+
47
+ ## Issues Found
48
+ ${summary_of_issues} // 只传递摘要
49
+
50
+ ## Actions Required
51
+ 1. Fix OAuth token refresh (test line 45)
52
+ 2. Update implementation.md with fixes
53
+ `
54
+ })
55
+ ```
56
+
57
+ ### 原则 2: 摘要而非全文
58
+
59
+ ❌ **错误**:
60
+ ```javascript
61
+ // 传递所有文件内容
62
+ RA输出: "requirements.md (2000 lines) + edge-cases.md (1000 lines) + changes.log (500 lines)"
63
+
64
+ EP读取: 全文解析所有内容(浪费token)
65
+ ```
66
+
67
+ ✅ **正确**:
68
+ ```javascript
69
+ // 只传递关键摘要
70
+ RA输出:
71
+ - 10个功能需求
72
+ - 5个非功能需求
73
+ - 8个边界场景
74
+ - 文件路径用于完整查看
75
+
76
+ EP读取: 读取摘要 + 需要时查看完整文件(高效)
77
+ ```
78
+
79
+ ### 原则 3: 文件版本跟踪
80
+
81
+ 每个引用必须包含版本:
82
+
83
+ ```javascript
84
+ send_input({
85
+ id: agents.cd,
86
+ message: `
87
+ Requirements: .workflow/.cycle/${cycleId}.progress/ra/requirements.md (v1.1.0)
88
+ ^^^^^^^ 版本号
89
+
90
+ Plan: .workflow/.cycle/${cycleId}.progress/ep/plan.json (v1.0.0)
91
+ ^^^^^^^ 版本号
92
+ `
93
+ })
94
+ ```
95
+
96
+ **好处**:
97
+ - 避免使用过期信息
98
+ - 自动检测版本不匹配
99
+ - 支持多版本迭代
100
+
101
+ ## 实现模式
102
+
103
+ ### Pattern 1: 通知 + 引用
104
+
105
+ Agent 向其他 agent 通知输出,而非传递内容:
106
+
107
+ ```javascript
108
+ // RA 输出摘要
109
+ const raSummary = {
110
+ requirements_count: 10,
111
+ edge_cases_count: 8,
112
+ version: "1.0.0",
113
+ output_file: ".workflow/.cycle/${cycleId}.progress/ra/requirements.md",
114
+ key_requirements: [
115
+ "FR-001: OAuth authentication",
116
+ "FR-002: Multi-provider support",
117
+ "..." // 只列出标题,不传递完整内容
118
+ ]
119
+ }
120
+
121
+ // 更新状态,让其他 agent 读取
122
+ state.requirements = {
123
+ version: raSummary.version,
124
+ output_file: raSummary.output_file,
125
+ summary: raSummary.key_requirements
126
+ }
127
+
128
+ // EP agent 从状态读取
129
+ const requiredDetails = state.requirements
130
+ const outputFile = requiredDetails.output_file
131
+ const requirements = JSON.parse(Read(outputFile)) // EP 自己读取完整文件
132
+ ```
133
+
134
+ ### Pattern 2: 反馈通知
135
+
136
+ Orchestrator 发送反馈时只传递摘要和行号:
137
+
138
+ ```javascript
139
+ // ❌ 错误:传递完整测试结果
140
+ send_input({
141
+ id: agents.cd,
142
+ message: `
143
+ Test Results:
144
+ ${entire_test_results_json} // 完整 JSON - 太大
145
+ `
146
+ })
147
+
148
+ // ✅ 正确:引用文件 + 问题摘要
149
+ send_input({
150
+ id: agents.cd,
151
+ message: `
152
+ ## Test Failures
153
+
154
+ Full results: .workflow/.cycle/${cycleId}.progress/vas/test-results.json (v1.0.0)
155
+
156
+ ## Quick Summary
157
+ - Failed: oauth-refresh (line 45, expected token refresh)
158
+ - Failed: concurrent-login (line 78, race condition)
159
+
160
+ ## Fix Instructions
161
+ 1. Review test cases at referenced lines
162
+ 2. Fix implementation
163
+ 3. Re-run tests
164
+ 4. Update implementation.md
165
+
166
+ Reference previous file paths if you need full details.
167
+ `
168
+ })
169
+ ```
170
+
171
+ ### Pattern 3: 依赖链路
172
+
173
+ Agent 通过文件引用获取依赖:
174
+
175
+ ```javascript
176
+ // EP agent: 从状态读取 RA 输出路径
177
+ const raOutputPath = state.requirements?.output_file
178
+ if (raOutputPath && exists(raOutputPath)) {
179
+ const requirements = Read(raOutputPath)
180
+ // 使用 requirements 生成计划
181
+ }
182
+
183
+ // CD agent: 从状态读取 EP 输出路径
184
+ const epPlanPath = state.plan?.output_file
185
+ if (epPlanPath && exists(epPlanPath)) {
186
+ const plan = JSON.parse(Read(epPlanPath))
187
+ // 根据 plan 实现功能
188
+ }
189
+
190
+ // VAS agent: 从状态读取 CD 输出路径
191
+ const cdChangesPath = state.changes?.output_file
192
+ if (cdChangesPath && exists(cdChangesPath)) {
193
+ const changes = readNDJSON(cdChangesPath)
194
+ // 根据 changes 生成测试
195
+ }
196
+ ```
197
+
198
+ ## 状态文件引用结构
199
+
200
+ 优化后的状态文件应该包含文件路径而不是内容:
201
+
202
+ ```json
203
+ {
204
+ "cycle_id": "cycle-v1-20260122-abc123",
205
+
206
+ "requirements": {
207
+ "version": "1.0.0",
208
+ "output_files": {
209
+ "specification": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/ra/requirements.md",
210
+ "edge_cases": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/ra/edge-cases.md",
211
+ "changes_log": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/ra/changes.log"
212
+ },
213
+ "summary": {
214
+ "functional_requirements": 10,
215
+ "edge_cases": 8,
216
+ "constraints": 5
217
+ }
218
+ },
219
+
220
+ "exploration": {
221
+ "version": "1.0.0",
222
+ "output_files": {
223
+ "exploration": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/ep/exploration.md",
224
+ "architecture": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/ep/architecture.md"
225
+ },
226
+ "summary": {
227
+ "key_components": ["Auth Module", "User Service"],
228
+ "integration_points": 5,
229
+ "identified_risks": 3
230
+ }
231
+ },
232
+
233
+ "plan": {
234
+ "version": "1.0.0",
235
+ "output_file": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/ep/plan.json",
236
+ "summary": {
237
+ "total_tasks": 8,
238
+ "critical_path": ["TASK-001", "TASK-003", "TASK-004"],
239
+ "estimated_hours": 16
240
+ }
241
+ },
242
+
243
+ "implementation": {
244
+ "version": "1.0.0",
245
+ "output_files": {
246
+ "progress": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/cd/implementation.md",
247
+ "changes": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/cd/code-changes.log",
248
+ "issues": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/cd/issues.md"
249
+ },
250
+ "summary": {
251
+ "tasks_completed": 3,
252
+ "files_modified": 5,
253
+ "blockers": 0
254
+ }
255
+ },
256
+
257
+ "validation": {
258
+ "version": "1.0.0",
259
+ "output_files": {
260
+ "validation": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/vas/validation.md",
261
+ "test_results": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/vas/test-results.json",
262
+ "coverage": ".workflow/.cycle/cycle-v1-20260122-abc123.progress/vas/coverage.md"
263
+ },
264
+ "summary": {
265
+ "pass_rate": 92,
266
+ "coverage": 87,
267
+ "failures": 4
268
+ }
269
+ }
270
+ }
271
+ ```
272
+
273
+ ## Agent 通信模板优化
274
+
275
+ ### 优化前: 完整内容传递
276
+
277
+ ```javascript
278
+ send_input({
279
+ id: agents.cd,
280
+ message: `
281
+ ## Requirements (Complete Content)
282
+
283
+ ${fs.readFileSync(requirementsFile, 'utf8')} // 2000+ lines
284
+
285
+ ## Plan (Complete JSON)
286
+
287
+ ${fs.readFileSync(planFile, 'utf8')} // 1000+ lines
288
+
289
+ ## Test Results (Complete)
290
+
291
+ ${fs.readFileSync(testResultsFile, 'utf8')} // 500+ lines
292
+
293
+ ## Your Task
294
+
295
+ Fix the implementation...
296
+ ` // 总消息体: 4000+ 行
297
+ })
298
+ ```
299
+
300
+ ### 优化后: 文件引用 + 摘要
301
+
302
+ ```javascript
303
+ send_input({
304
+ id: agents.cd,
305
+ message: `
306
+ ## Test Failures - Action Required
307
+
308
+ Full Test Report: .workflow/.cycle/${cycleId}.progress/vas/test-results.json (v1.0.0)
309
+
310
+ ## Summary of Failures
311
+ - oauth-refresh: Expected token refresh, got error (test line 45)
312
+ - concurrent-login: Race condition in session writes (test line 78)
313
+
314
+ ## Implementation Reference
315
+ - Current Code: .workflow/.cycle/${cycleId}.progress/cd/implementation.md (v1.0.0)
316
+ - Code Changes: .workflow/.cycle/${cycleId}.progress/cd/code-changes.log (v1.0.0)
317
+
318
+ ## Action Required
319
+ 1. Review failing tests in referenced test results file
320
+ 2. Fix root causes (race condition, token handling)
321
+ 3. Update implementation.md with fixes
322
+ 4. Re-run tests
323
+
324
+ ## Context
325
+ - Requirement: .workflow/.cycle/${cycleId}.progress/ra/requirements.md (v1.0.0)
326
+ - Plan: .workflow/.cycle/${cycleId}.progress/ep/plan.json (v1.0.0)
327
+
328
+ Output PHASE_RESULT when complete.
329
+ ` // 总消息体: <500 行,高效传递
330
+ })
331
+ ```
332
+
333
+ ## 版本控制最佳实践
334
+
335
+ ### 版本不匹配检测
336
+
337
+ ```javascript
338
+ function validateVersionConsistency(state) {
339
+ const versions = {
340
+ ra: state.requirements?.version,
341
+ ep: state.plan?.version,
342
+ cd: state.implementation?.version,
343
+ vas: state.validation?.version
344
+ }
345
+
346
+ // 检查版本一致性
347
+ const allVersions = Object.values(versions).filter(v => v)
348
+ const unique = new Set(allVersions)
349
+
350
+ if (unique.size > 1) {
351
+ console.warn('Version mismatch detected:')
352
+ console.warn(versions)
353
+ // 返回版本差异,让 orchestrator 决定是否继续
354
+ }
355
+
356
+ return unique.size === 1
357
+ }
358
+ ```
359
+
360
+ ### 文件存在性检查
361
+
362
+ ```javascript
363
+ function validateReferences(state, cycleId) {
364
+ const checks = []
365
+
366
+ // 检查所有引用的文件是否存在
367
+ for (const [agent, data] of Object.entries(state)) {
368
+ if (data?.output_files) {
369
+ for (const [name, path] of Object.entries(data.output_files)) {
370
+ if (!fs.existsSync(path)) {
371
+ checks.push({
372
+ agent: agent,
373
+ file: name,
374
+ path: path,
375
+ status: 'missing'
376
+ })
377
+ }
378
+ }
379
+ }
380
+ }
381
+
382
+ return checks
383
+ }
384
+ ```
385
+
386
+ ## 好处总结
387
+
388
+ | 方面 | 改进 |
389
+ |------|------|
390
+ | 消息体积 | 减少 80-90% |
391
+ | Token 使用 | 减少 60-70% |
392
+ | 读取速度 | 无需解析冗余内容 |
393
+ | 版本控制 | 清晰的版本跟踪 |
394
+ | 上下文清晰 | 不会混淆版本 |
395
+ | 可维护性 | 文件变更不需要修改消息 |
396
+
397
+ ## 迁移建议
398
+
399
+ ### 第一步: 更新状态结构
400
+
401
+ ```json
402
+ // 从这样:
403
+ "requirements": "完整内容"
404
+
405
+ // 改为这样:
406
+ "requirements": {
407
+ "version": "1.0.0",
408
+ "output_file": "path/to/file",
409
+ "summary": {...}
410
+ }
411
+ ```
412
+
413
+ ### 第二步: 更新通信模板
414
+
415
+ 所有 `send_input` 消息改为引用路径。
416
+
417
+ ### 第三步: Agent 自动读取
418
+
419
+ Agent 从引用路径自动读取所需文件。
420
+
421
+ ### 第四步: 测试版本检测
422
+
423
+ 确保版本不匹配时有警告。