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,436 @@
1
+ # State Schema - Parallel Dev Cycle
2
+
3
+ Unified cycle state structure for multi-agent coordination and iteration support.
4
+
5
+ ## State File Location
6
+
7
+ **Location**: `.workflow/.cycle/{cycleId}.json` (unified state, all agents access)
8
+
9
+ **Format**: JSON
10
+
11
+ ## Cycle State Interface
12
+
13
+ ```typescript
14
+ interface CycleState {
15
+ // =====================================================
16
+ // CORE METADATA
17
+ // =====================================================
18
+
19
+ cycle_id: string // Unique cycle identifier
20
+ title: string // Task title (first 100 chars)
21
+ description: string // Full task description
22
+ task_history: string[] // All task descriptions across iterations
23
+
24
+ // =====================================================
25
+ // STATUS & TIMING
26
+ // =====================================================
27
+
28
+ status: 'created' | 'running' | 'paused' | 'completed' | 'failed'
29
+ created_at: string // ISO8601 format
30
+ updated_at: string // ISO8601 format
31
+ completed_at?: string // ISO8601 format
32
+
33
+ max_iterations: number // Maximum iteration limit
34
+ current_iteration: number // Current iteration count
35
+ failure_reason?: string // If failed, why
36
+
37
+ // =====================================================
38
+ // MULTI-AGENT TRACKING
39
+ // =====================================================
40
+
41
+ agents: {
42
+ ra: AgentState // Requirements Analyst
43
+ ep: AgentState // Exploration Planner
44
+ cd: AgentState // Code Developer
45
+ vas: AgentState // Validation Archivist
46
+ }
47
+
48
+ // =====================================================
49
+ // PHASE TRACKING
50
+ // =====================================================
51
+
52
+ current_phase: 'init' | 'ra' | 'ep' | 'cd' | 'vas' | 'aggregation' | 'complete'
53
+ completed_phases: string[]
54
+ phase_errors: Array<{
55
+ phase: string
56
+ error: string
57
+ timestamp: string
58
+ }>
59
+
60
+ // =====================================================
61
+ // SHARED CONTEXT (Populated by agents)
62
+ // =====================================================
63
+
64
+ requirements?: {
65
+ version: string // e.g., "1.0.0", "1.1.0"
66
+ specification: string // Full spec from requirements.md
67
+ edge_cases: string[]
68
+ last_updated: string
69
+ }
70
+
71
+ exploration?: {
72
+ version: string
73
+ architecture_summary: string
74
+ integration_points: string[]
75
+ identified_risks: string[]
76
+ last_updated: string
77
+ }
78
+
79
+ plan?: {
80
+ version: string
81
+ tasks: PlanTask[]
82
+ total_estimated_effort: string
83
+ critical_path: string[]
84
+ last_updated: string
85
+ }
86
+
87
+ changes?: {
88
+ total_files: number
89
+ changes: ChangeLog[]
90
+ iteration_markers: Record<number, string> // Iteration timestamps
91
+ }
92
+
93
+ test_results?: {
94
+ version: string
95
+ pass_rate: number // 0-100
96
+ coverage: number // 0-100
97
+ failed_tests: string[]
98
+ total_tests: number
99
+ last_run: string
100
+ }
101
+
102
+ // =====================================================
103
+ // ITERATION TRACKING
104
+ // =====================================================
105
+
106
+ iterations: IterationRecord[]
107
+
108
+ // =====================================================
109
+ // COORDINATION DATA
110
+ // =====================================================
111
+
112
+ coordination: {
113
+ feedback_log: FeedbackEntry[]
114
+ pending_decisions: Decision[]
115
+ blockers: Blocker[]
116
+ }
117
+ }
118
+
119
+ // =====================================================
120
+ // SUPPORTING TYPES
121
+ // =====================================================
122
+
123
+ interface AgentState {
124
+ status: 'idle' | 'running' | 'waiting' | 'completed' | 'failed'
125
+ started_at?: string
126
+ completed_at?: string
127
+ output_files: string[]
128
+ last_message?: string
129
+ error?: string
130
+ iterations_completed: number
131
+ }
132
+
133
+ interface PlanTask {
134
+ id: string // e.g., "TASK-001"
135
+ description: string
136
+ effort: 'small' | 'medium' | 'large'
137
+ depends_on: string[]
138
+ status: 'pending' | 'in_progress' | 'completed' | 'blocked'
139
+ assigned_to?: string // Agent name
140
+ files: string[]
141
+ }
142
+
143
+ interface ChangeLog {
144
+ timestamp: string
145
+ file: string
146
+ action: 'create' | 'modify' | 'delete'
147
+ iteration: number
148
+ agent: string // which agent made change
149
+ description: string
150
+ }
151
+
152
+ interface IterationRecord {
153
+ number: number
154
+ extension?: string // User feedback/extension for this iteration
155
+ started_at: string
156
+ completed_at: string
157
+ agent_results: Record<string, {
158
+ status: string
159
+ files_modified: number
160
+ }>
161
+ issues_found: string[]
162
+ resolved: boolean
163
+ }
164
+
165
+ interface FeedbackEntry {
166
+ timestamp: string
167
+ source: string // Agent or 'user'
168
+ target: string // Recipient agent
169
+ content: string
170
+ type: 'requirement_update' | 'bug_report' | 'issue_fix' | 'clarification'
171
+ }
172
+
173
+ interface Decision {
174
+ id: string
175
+ description: string
176
+ options: string[]
177
+ made_by?: string
178
+ chosen_option?: string
179
+ status: 'pending' | 'made' | 'implemented'
180
+ }
181
+
182
+ interface Blocker {
183
+ id: string
184
+ description: string
185
+ reported_by: string
186
+ status: 'open' | 'resolved' | 'workaround'
187
+ resolution?: string
188
+ }
189
+ ```
190
+
191
+ ## Initial State (New Cycle)
192
+
193
+ When creating a new cycle:
194
+
195
+ ```json
196
+ {
197
+ "cycle_id": "cycle-v1-20260122T100000-abc123",
198
+ "title": "Implement OAuth authentication",
199
+ "description": "Add OAuth2 login support with Google and GitHub providers",
200
+ "task_history": [
201
+ "Implement OAuth authentication"
202
+ ],
203
+ "status": "created",
204
+ "created_at": "2026-01-22T10:00:00+08:00",
205
+ "updated_at": "2026-01-22T10:00:00+08:00",
206
+ "max_iterations": 5,
207
+ "current_iteration": 0,
208
+ "agents": {
209
+ "ra": { "status": "idle", "output_files": [], "iterations_completed": 0 },
210
+ "ep": { "status": "idle", "output_files": [], "iterations_completed": 0 },
211
+ "cd": { "status": "idle", "output_files": [], "iterations_completed": 0 },
212
+ "vas": { "status": "idle", "output_files": [], "iterations_completed": 0 }
213
+ },
214
+ "current_phase": "init",
215
+ "completed_phases": [],
216
+ "phase_errors": [],
217
+ "iterations": [],
218
+ "coordination": {
219
+ "feedback_log": [],
220
+ "pending_decisions": [],
221
+ "blockers": []
222
+ }
223
+ }
224
+ ```
225
+
226
+ ## State Transitions
227
+
228
+ ### Iteration 1: Initial Execution
229
+
230
+ ```json
231
+ {
232
+ "status": "running",
233
+ "current_iteration": 1,
234
+ "current_phase": "ra",
235
+ "agents": {
236
+ "ra": { "status": "running", "started_at": "2026-01-22T10:05:00+08:00" },
237
+ "ep": { "status": "idle" },
238
+ "cd": { "status": "idle" },
239
+ "vas": { "status": "idle" }
240
+ },
241
+ "requirements": {
242
+ "version": "1.0.0",
243
+ "specification": "...",
244
+ "edge_cases": ["OAuth timeout handling", "PKCE validation"],
245
+ "last_updated": "2026-01-22T10:15:00+08:00"
246
+ },
247
+ "iterations": [{
248
+ "number": 1,
249
+ "started_at": "2026-01-22T10:00:00+08:00",
250
+ "agent_results": {
251
+ "ra": { "status": "completed", "files_modified": 3 },
252
+ "ep": { "status": "completed", "files_modified": 2 },
253
+ "cd": { "status": "partial", "files_modified": 5 },
254
+ "vas": { "status": "pending", "files_modified": 0 }
255
+ }
256
+ }]
257
+ }
258
+ ```
259
+
260
+ ### After Phase Completion
261
+
262
+ ```json
263
+ {
264
+ "current_phase": "aggregation",
265
+ "completed_phases": ["ra", "ep", "cd", "vas"],
266
+ "plan": {
267
+ "version": "1.0.0",
268
+ "tasks": [
269
+ {
270
+ "id": "TASK-001",
271
+ "description": "Setup OAuth application credentials",
272
+ "effort": "small",
273
+ "status": "completed",
274
+ "files": ["src/config/oauth.ts"]
275
+ }
276
+ ]
277
+ },
278
+ "changes": {
279
+ "total_files": 12,
280
+ "iteration_markers": {
281
+ "1": "2026-01-22T10:30:00+08:00"
282
+ }
283
+ },
284
+ "test_results": {
285
+ "version": "1.0.0",
286
+ "pass_rate": 85,
287
+ "coverage": 78,
288
+ "failed_tests": ["test: OAuth timeout retry"],
289
+ "total_tests": 20
290
+ }
291
+ }
292
+ ```
293
+
294
+ ### Iteration 2: User Extension
295
+
296
+ User provides feedback: "Also add multi-factor authentication"
297
+
298
+ ```json
299
+ {
300
+ "status": "running",
301
+ "current_iteration": 2,
302
+ "task_history": [
303
+ "Implement OAuth authentication",
304
+ "Also add multi-factor authentication"
305
+ ],
306
+ "description": "Add OAuth2 login support with Google and GitHub providers\n\n--- ITERATION 2 ---\nAlso add multi-factor authentication",
307
+ "agents": {
308
+ "ra": { "status": "running", "iterations_completed": 1 },
309
+ "ep": { "status": "idle", "iterations_completed": 1 },
310
+ "cd": { "status": "idle", "iterations_completed": 1 },
311
+ "vas": { "status": "idle", "iterations_completed": 1 }
312
+ },
313
+ "requirements": {
314
+ "version": "1.1.0",
315
+ "specification": "...",
316
+ "last_updated": "2026-01-22T11:00:00+08:00"
317
+ },
318
+ "iterations": [
319
+ { "number": 1, "completed_at": "..." },
320
+ {
321
+ "number": 2,
322
+ "extension": "Also add multi-factor authentication",
323
+ "started_at": "2026-01-22T10:45:00+08:00",
324
+ "agent_results": {}
325
+ }
326
+ ],
327
+ "coordination": {
328
+ "feedback_log": [{
329
+ "timestamp": "2026-01-22T10:45:00+08:00",
330
+ "source": "user",
331
+ "target": "ra",
332
+ "content": "Add multi-factor authentication to requirements",
333
+ "type": "requirement_update"
334
+ }]
335
+ }
336
+ }
337
+ ```
338
+
339
+ ## Version Tracking
340
+
341
+ Each component tracks its version:
342
+
343
+ - **Requirements**: `1.0.0` → `1.1.0` → `1.2.0` (each iteration)
344
+ - **Plan**: `1.0.0` → `1.1.0` (updated based on requirements)
345
+ - **Code**: Changes appended with iteration markers
346
+ - **Tests**: Results tracked per iteration
347
+
348
+ ## File Sync Protocol
349
+
350
+ State changes trigger file writes:
351
+
352
+ | State Change | File Sync |
353
+ |--------------|-----------|
354
+ | `requirements` updated | `.progress/ra/requirements.md` + version bump |
355
+ | `plan` updated | `.progress/ep/plan.json` + version bump |
356
+ | `changes` appended | `.progress/cd/code-changes.log` + iteration marker |
357
+ | `test_results` updated | `.progress/vas/test-results.json` + version bump |
358
+ | Full iteration done | `.progress/coordination/timeline.md` appended |
359
+
360
+ ## Control Signal Checking
361
+
362
+ Agents check status before each action:
363
+
364
+ ```javascript
365
+ function checkControlSignals(cycleId) {
366
+ const state = JSON.parse(Read(`.workflow/.cycle/${cycleId}.json`))
367
+
368
+ if (state.status === 'paused') {
369
+ return { continue: false, action: 'pause' }
370
+ }
371
+ if (state.status === 'failed') {
372
+ return { continue: false, action: 'stop' }
373
+ }
374
+ if (state.status === 'running') {
375
+ return { continue: true, action: 'continue' }
376
+ }
377
+
378
+ return { continue: false, action: 'unknown' }
379
+ }
380
+ ```
381
+
382
+ ## State Persistence
383
+
384
+ ### Write Operations
385
+
386
+ After each agent completes or phase transitions:
387
+
388
+ ```javascript
389
+ Write(
390
+ `.workflow/.cycle/${cycleId}.json`,
391
+ JSON.stringify(state, null, 2)
392
+ )
393
+ ```
394
+
395
+ ### Read Operations
396
+
397
+ Agents always read fresh state before executing:
398
+
399
+ ```javascript
400
+ const currentState = JSON.parse(
401
+ Read(`.workflow/.cycle/${cycleId}.json`)
402
+ )
403
+ ```
404
+
405
+ ## State Rebuild (Recovery)
406
+
407
+ If master state corrupted, rebuild from markdown files:
408
+
409
+ ```javascript
410
+ function rebuildState(cycleId) {
411
+ const progressDir = `.workflow/.cycle/${cycleId}.progress`
412
+
413
+ // Read markdown files
414
+ const raMarkdown = Read(`${progressDir}/ra/requirements.md`)
415
+ const epMarkdown = Read(`${progressDir}/ep/plan.json`)
416
+ const cdChanges = Read(`${progressDir}/cd/code-changes.log`)
417
+ const vasResults = Read(`${progressDir}/vas/test-results.json`)
418
+
419
+ // Reconstruct state from files
420
+ return {
421
+ requirements: parseMarkdown(raMarkdown),
422
+ plan: JSON.parse(epMarkdown),
423
+ changes: parseNDJSON(cdChanges),
424
+ test_results: JSON.parse(vasResults)
425
+ }
426
+ }
427
+ ```
428
+
429
+ ## Best Practices
430
+
431
+ 1. **Immutable Reads**: Never modify state during read
432
+ 2. **Version Bumps**: Increment version on each iteration
433
+ 3. **Timestamp Accuracy**: Use UTC+8 consistently
434
+ 4. **Append-Only Logs**: Never delete history
435
+ 5. **Atomic Writes**: Write complete state, not partial updates
436
+ 6. **Coordination Tracking**: Log all inter-agent communication