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,183 @@
1
+ # Action: DEVELOP
2
+
3
+ Execute development task and record progress to develop.md.
4
+
5
+ ## Purpose
6
+
7
+ - Execute next pending development task
8
+ - Implement code changes
9
+ - Record progress to Markdown file
10
+ - Update task status in state
11
+
12
+ ## Preconditions
13
+
14
+ - [ ] state.status === 'running'
15
+ - [ ] state.skill_state !== null
16
+ - [ ] state.skill_state.develop.tasks.some(t => t.status === 'pending')
17
+
18
+ ## Execution Steps
19
+
20
+ ### Step 1: Verify Control Signals
21
+
22
+ ```javascript
23
+ const state = JSON.parse(Read(`.workflow/.loop/${loopId}.json`))
24
+
25
+ if (state.status !== 'running') {
26
+ return {
27
+ action: 'DEVELOP',
28
+ status: 'failed',
29
+ message: `Cannot develop: status is ${state.status}`,
30
+ next_action: state.status === 'paused' ? 'PAUSED' : 'STOPPED'
31
+ }
32
+ }
33
+ ```
34
+
35
+ ### Step 2: Find Next Pending Task
36
+
37
+ ```javascript
38
+ const tasks = state.skill_state.develop.tasks
39
+ const currentTask = tasks.find(t => t.status === 'pending')
40
+
41
+ if (!currentTask) {
42
+ return {
43
+ action: 'DEVELOP',
44
+ status: 'success',
45
+ message: 'All development tasks completed',
46
+ next_action: mode === 'auto' ? 'VALIDATE' : 'MENU'
47
+ }
48
+ }
49
+
50
+ // Mark as in_progress
51
+ currentTask.status = 'in_progress'
52
+ ```
53
+
54
+ ### Step 3: Execute Development Task
55
+
56
+ ```javascript
57
+ console.log(`Executing task: ${currentTask.description}`)
58
+
59
+ // Use appropriate tools based on task type
60
+ // - ACE search_context for finding patterns
61
+ // - Read for loading files
62
+ // - Edit/Write for making changes
63
+
64
+ // Record files changed
65
+ const filesChanged = []
66
+
67
+ // Implementation logic...
68
+ ```
69
+
70
+ ### Step 4: Record Changes to Log (NDJSON)
71
+
72
+ ```javascript
73
+ const changesLogPath = `${progressDir}/changes.log`
74
+ const timestamp = getUtc8ISOString()
75
+
76
+ const changeEntry = {
77
+ timestamp: timestamp,
78
+ task_id: currentTask.id,
79
+ description: currentTask.description,
80
+ files_changed: filesChanged,
81
+ result: 'success'
82
+ }
83
+
84
+ // Append to NDJSON log
85
+ const existingLog = Read(changesLogPath) || ''
86
+ Write(changesLogPath, existingLog + JSON.stringify(changeEntry) + '\n')
87
+ ```
88
+
89
+ ### Step 5: Update Progress Document
90
+
91
+ ```javascript
92
+ const progressPath = `${progressDir}/develop.md`
93
+ const iteration = state.skill_state.develop.completed + 1
94
+
95
+ const progressEntry = `
96
+ ### Iteration ${iteration} - ${currentTask.description} (${timestamp})
97
+
98
+ #### Task Details
99
+
100
+ - **ID**: ${currentTask.id}
101
+ - **Tool**: ${currentTask.tool}
102
+ - **Mode**: ${currentTask.mode}
103
+
104
+ #### Implementation Summary
105
+
106
+ [Implementation description]
107
+
108
+ #### Files Changed
109
+
110
+ ${filesChanged.map(f => `- \`${f}\``).join('\n') || '- No files changed'}
111
+
112
+ #### Status: COMPLETED
113
+
114
+ ---
115
+
116
+ `
117
+
118
+ const existingProgress = Read(progressPath)
119
+ Write(progressPath, existingProgress + progressEntry)
120
+ ```
121
+
122
+ ### Step 6: Update State
123
+
124
+ ```javascript
125
+ currentTask.status = 'completed'
126
+ currentTask.completed_at = timestamp
127
+ currentTask.files_changed = filesChanged
128
+
129
+ state.skill_state.develop.completed += 1
130
+ state.skill_state.develop.current_task = null
131
+ state.skill_state.develop.last_progress_at = timestamp
132
+ state.skill_state.last_action = 'DEVELOP'
133
+ state.skill_state.completed_actions.push('DEVELOP')
134
+ state.updated_at = timestamp
135
+
136
+ Write(`.workflow/.loop/${loopId}.json`, JSON.stringify(state, null, 2))
137
+ ```
138
+
139
+ ## Output Format
140
+
141
+ ```
142
+ ACTION_RESULT:
143
+ - action: DEVELOP
144
+ - status: success
145
+ - message: Task completed: {task_description}
146
+ - state_updates: {
147
+ "develop.completed": {N},
148
+ "develop.last_progress_at": "{timestamp}"
149
+ }
150
+
151
+ FILES_UPDATED:
152
+ - .workflow/.loop/{loopId}.json: Task status updated
153
+ - .workflow/.loop/{loopId}.progress/develop.md: Progress entry added
154
+ - .workflow/.loop/{loopId}.progress/changes.log: Change entry added
155
+
156
+ NEXT_ACTION_NEEDED: {DEVELOP | DEBUG | VALIDATE | MENU}
157
+ ```
158
+
159
+ ## Auto Mode Next Action Selection
160
+
161
+ ```javascript
162
+ const pendingTasks = tasks.filter(t => t.status === 'pending')
163
+
164
+ if (pendingTasks.length > 0) {
165
+ return 'DEVELOP' // More tasks to do
166
+ } else {
167
+ return 'DEBUG' // All done, check for issues
168
+ }
169
+ ```
170
+
171
+ ## Error Handling
172
+
173
+ | Error Type | Recovery |
174
+ |------------|----------|
175
+ | Task execution failed | Mark task as failed, continue to next |
176
+ | File write failed | Retry once, then report error |
177
+ | All tasks done | Move to DEBUG or VALIDATE |
178
+
179
+ ## Next Actions
180
+
181
+ - More pending tasks: `DEVELOP`
182
+ - All tasks complete: `DEBUG` (auto) or `MENU` (interactive)
183
+ - Task failed: `DEVELOP` (retry) or `DEBUG` (investigate)
@@ -0,0 +1,164 @@
1
+ # Action: INIT
2
+
3
+ Initialize CCW Loop session, create directory structure and initial state.
4
+
5
+ ## Purpose
6
+
7
+ - Create session directory structure
8
+ - Initialize state file with skill_state
9
+ - Analyze task description to generate development tasks
10
+ - Prepare execution environment
11
+
12
+ ## Preconditions
13
+
14
+ - [ ] state.status === 'running'
15
+ - [ ] state.skill_state === null
16
+
17
+ ## Execution Steps
18
+
19
+ ### Step 1: Verify Control Signals
20
+
21
+ ```javascript
22
+ const state = JSON.parse(Read(`.workflow/.loop/${loopId}.json`))
23
+
24
+ if (state.status !== 'running') {
25
+ return {
26
+ action: 'INIT',
27
+ status: 'failed',
28
+ message: `Cannot init: status is ${state.status}`,
29
+ next_action: state.status === 'paused' ? 'PAUSED' : 'STOPPED'
30
+ }
31
+ }
32
+ ```
33
+
34
+ ### Step 2: Create Directory Structure
35
+
36
+ ```javascript
37
+ const progressDir = `.workflow/.loop/${loopId}.progress`
38
+
39
+ // Directories created by orchestrator, verify they exist
40
+ // mkdir -p ${progressDir}
41
+ ```
42
+
43
+ ### Step 3: Analyze Task and Generate Tasks
44
+
45
+ ```javascript
46
+ // Analyze task description
47
+ const taskDescription = state.description
48
+
49
+ // Generate 3-7 development tasks based on analysis
50
+ // Use ACE search or smart_search to find relevant patterns
51
+
52
+ const tasks = [
53
+ {
54
+ id: 'task-001',
55
+ description: 'Task description based on analysis',
56
+ tool: 'gemini',
57
+ mode: 'write',
58
+ status: 'pending',
59
+ priority: 1,
60
+ files: [],
61
+ created_at: getUtc8ISOString(),
62
+ completed_at: null
63
+ }
64
+ // ... more tasks
65
+ ]
66
+ ```
67
+
68
+ ### Step 4: Initialize Progress Document
69
+
70
+ ```javascript
71
+ const progressPath = `${progressDir}/develop.md`
72
+
73
+ const progressInitial = `# Development Progress
74
+
75
+ **Loop ID**: ${loopId}
76
+ **Task**: ${taskDescription}
77
+ **Started**: ${getUtc8ISOString()}
78
+
79
+ ---
80
+
81
+ ## Task List
82
+
83
+ ${tasks.map((t, i) => `${i + 1}. [ ] ${t.description}`).join('\n')}
84
+
85
+ ---
86
+
87
+ ## Progress Timeline
88
+
89
+ `
90
+
91
+ Write(progressPath, progressInitial)
92
+ ```
93
+
94
+ ### Step 5: Update State
95
+
96
+ ```javascript
97
+ const skillState = {
98
+ current_action: 'init',
99
+ last_action: null,
100
+ completed_actions: [],
101
+ mode: mode,
102
+
103
+ develop: {
104
+ total: tasks.length,
105
+ completed: 0,
106
+ current_task: null,
107
+ tasks: tasks,
108
+ last_progress_at: null
109
+ },
110
+
111
+ debug: {
112
+ active_bug: null,
113
+ hypotheses_count: 0,
114
+ hypotheses: [],
115
+ confirmed_hypothesis: null,
116
+ iteration: 0,
117
+ last_analysis_at: null
118
+ },
119
+
120
+ validate: {
121
+ pass_rate: 0,
122
+ coverage: 0,
123
+ test_results: [],
124
+ passed: false,
125
+ failed_tests: [],
126
+ last_run_at: null
127
+ },
128
+
129
+ errors: []
130
+ }
131
+
132
+ state.skill_state = skillState
133
+ state.updated_at = getUtc8ISOString()
134
+ Write(`.workflow/.loop/${loopId}.json`, JSON.stringify(state, null, 2))
135
+ ```
136
+
137
+ ## Output Format
138
+
139
+ ```
140
+ ACTION_RESULT:
141
+ - action: INIT
142
+ - status: success
143
+ - message: Session initialized with {N} development tasks
144
+
145
+ FILES_UPDATED:
146
+ - .workflow/.loop/{loopId}.json: skill_state initialized
147
+ - .workflow/.loop/{loopId}.progress/develop.md: Progress document created
148
+
149
+ NEXT_ACTION_NEEDED: {DEVELOP (auto) | MENU (interactive)}
150
+ ```
151
+
152
+ ## Error Handling
153
+
154
+ | Error Type | Recovery |
155
+ |------------|----------|
156
+ | Directory creation failed | Report error, stop |
157
+ | Task analysis failed | Create single generic task |
158
+ | State write failed | Retry once, then stop |
159
+
160
+ ## Next Actions
161
+
162
+ - Success (auto mode): `DEVELOP`
163
+ - Success (interactive): `MENU`
164
+ - Failed: Report error
@@ -0,0 +1,205 @@
1
+ # Action: MENU
2
+
3
+ Display interactive action menu for user selection.
4
+
5
+ ## Purpose
6
+
7
+ - Show current state summary
8
+ - Display available actions
9
+ - Wait for user selection
10
+ - Return selected action
11
+
12
+ ## Preconditions
13
+
14
+ - [ ] state.status === 'running'
15
+ - [ ] state.skill_state !== null
16
+ - [ ] mode === 'interactive'
17
+
18
+ ## Execution Steps
19
+
20
+ ### Step 1: Verify Control Signals
21
+
22
+ ```javascript
23
+ const state = JSON.parse(Read(`.workflow/.loop/${loopId}.json`))
24
+
25
+ if (state.status !== 'running') {
26
+ return {
27
+ action: 'MENU',
28
+ status: 'failed',
29
+ message: `Cannot show menu: status is ${state.status}`,
30
+ next_action: state.status === 'paused' ? 'PAUSED' : 'STOPPED'
31
+ }
32
+ }
33
+ ```
34
+
35
+ ### Step 2: Generate Status Summary
36
+
37
+ ```javascript
38
+ // Development progress
39
+ const developProgress = state.skill_state.develop.total > 0
40
+ ? `${state.skill_state.develop.completed}/${state.skill_state.develop.total} (${((state.skill_state.develop.completed / state.skill_state.develop.total) * 100).toFixed(0)}%)`
41
+ : 'Not started'
42
+
43
+ // Debug status
44
+ const debugStatus = state.skill_state.debug.confirmed_hypothesis
45
+ ? 'Root cause found'
46
+ : state.skill_state.debug.iteration > 0
47
+ ? `Iteration ${state.skill_state.debug.iteration}`
48
+ : 'Not started'
49
+
50
+ // Validation status
51
+ const validateStatus = state.skill_state.validate.passed
52
+ ? 'PASSED'
53
+ : state.skill_state.validate.test_results.length > 0
54
+ ? `FAILED (${state.skill_state.validate.failed_tests.length} failures)`
55
+ : 'Not run'
56
+ ```
57
+
58
+ ### Step 3: Display Menu
59
+
60
+ ```javascript
61
+ const menuDisplay = `
62
+ ================================================================
63
+ CCW Loop - ${loopId}
64
+ ================================================================
65
+
66
+ Task: ${state.description}
67
+ Iteration: ${state.current_iteration}
68
+
69
+ +-----------------------------------------------------+
70
+ | Phase | Status |
71
+ +-----------------------------------------------------+
72
+ | Develop | ${developProgress.padEnd(35)}|
73
+ | Debug | ${debugStatus.padEnd(35)}|
74
+ | Validate | ${validateStatus.padEnd(35)}|
75
+ +-----------------------------------------------------+
76
+
77
+ ================================================================
78
+
79
+ MENU_OPTIONS:
80
+ 1. [develop] Continue Development - ${state.skill_state.develop.total - state.skill_state.develop.completed} tasks pending
81
+ 2. [debug] Start Debugging - ${debugStatus}
82
+ 3. [validate] Run Validation - ${validateStatus}
83
+ 4. [status] View Detailed Status
84
+ 5. [complete] Complete Loop
85
+ 6. [exit] Exit (save and quit)
86
+ `
87
+
88
+ console.log(menuDisplay)
89
+ ```
90
+
91
+ ## Output Format
92
+
93
+ ```
94
+ ACTION_RESULT:
95
+ - action: MENU
96
+ - status: success
97
+ - message: ${menuDisplay}
98
+
99
+ MENU_OPTIONS:
100
+ 1. [develop] Continue Development - {N} tasks pending
101
+ 2. [debug] Start Debugging - {status}
102
+ 3. [validate] Run Validation - {status}
103
+ 4. [status] View Detailed Status
104
+ 5. [complete] Complete Loop
105
+ 6. [exit] Exit (save and quit)
106
+
107
+ NEXT_ACTION_NEEDED: WAITING_INPUT
108
+ ```
109
+
110
+ ## User Input Handling
111
+
112
+ When user provides input, orchestrator sends it back via `send_input`:
113
+
114
+ ```javascript
115
+ // User selects "develop"
116
+ send_input({
117
+ id: agent,
118
+ message: `
119
+ ## USER INPUT RECEIVED
120
+
121
+ Action selected: develop
122
+
123
+ ## EXECUTE SELECTED ACTION
124
+
125
+ Execute DEVELOP action.
126
+ `
127
+ })
128
+ ```
129
+
130
+ ## Status Detail View
131
+
132
+ If user selects "status":
133
+
134
+ ```javascript
135
+ const detailView = `
136
+ ## Detailed Status
137
+
138
+ ### Development Progress
139
+
140
+ ${Read(`${progressDir}/develop.md`)?.substring(0, 1000) || 'No progress recorded'}
141
+
142
+ ### Debug Status
143
+
144
+ ${state.skill_state.debug.hypotheses.length > 0
145
+ ? state.skill_state.debug.hypotheses.map(h => ` ${h.id}: ${h.status} - ${h.description.substring(0, 50)}...`).join('\n')
146
+ : ' No debugging started'}
147
+
148
+ ### Validation Results
149
+
150
+ ${state.skill_state.validate.test_results.length > 0
151
+ ? ` Last run: ${state.skill_state.validate.last_run_at}
152
+ Pass rate: ${state.skill_state.validate.pass_rate}%`
153
+ : ' No validation run yet'}
154
+ `
155
+
156
+ console.log(detailView)
157
+
158
+ // Return to menu
159
+ return {
160
+ action: 'MENU',
161
+ status: 'success',
162
+ message: detailView,
163
+ next_action: 'MENU' // Show menu again
164
+ }
165
+ ```
166
+
167
+ ## Exit Handling
168
+
169
+ If user selects "exit":
170
+
171
+ ```javascript
172
+ // Save current state
173
+ state.status = 'user_exit'
174
+ state.updated_at = getUtc8ISOString()
175
+ Write(`.workflow/.loop/${loopId}.json`, JSON.stringify(state, null, 2))
176
+
177
+ return {
178
+ action: 'MENU',
179
+ status: 'success',
180
+ message: 'Session saved. Use --loop-id to resume.',
181
+ next_action: 'COMPLETED'
182
+ }
183
+ ```
184
+
185
+ ## Action Mapping
186
+
187
+ | User Selection | Next Action |
188
+ |----------------|-------------|
189
+ | develop | DEVELOP |
190
+ | debug | DEBUG |
191
+ | validate | VALIDATE |
192
+ | status | MENU (after showing details) |
193
+ | complete | COMPLETE |
194
+ | exit | COMPLETED (save and exit) |
195
+
196
+ ## Error Handling
197
+
198
+ | Error Type | Recovery |
199
+ |------------|----------|
200
+ | Invalid selection | Show menu again |
201
+ | User cancels | Return to menu |
202
+
203
+ ## Next Actions
204
+
205
+ Based on user selection - forwarded via `send_input` by orchestrator.