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
@@ -1,189 +1,683 @@
1
1
  ---
2
- description: Execute tasks sequentially from plan.json file
3
- argument-hint: FILE=<path>
2
+ description: Execute tasks based on in-memory plan, prompt description, or file content (Codex Subagent Version)
3
+ argument-hint: "[--in-memory] [\"task description\"|file-path]"
4
4
  ---
5
5
 
6
- # Workflow Lite-Execute (Codex Version)
6
+ # Workflow Lite-Execute Command (Codex Subagent Version)
7
7
 
8
- ## Core Principle
8
+ ## Overview
9
9
 
10
- **Serial Execution**: Execute tasks ONE BY ONE in order. Complete current task fully before moving to next. Continue until ALL tasks complete.
10
+ Flexible task execution command with **optimized Codex subagent orchestration**. Supports three input modes: in-memory plan (from lite-plan), direct prompt description, or file content.
11
11
 
12
- ## Input
12
+ **Core Optimizations:**
13
+ - **Batch Parallel Execution**: `spawn_agent × N → wait({ ids: [...] })` for independent tasks
14
+ - **Context Preservation**: Primary executor retained for follow-ups via `send_input()`
15
+ - **Unified Prompt Builder**: Same template for both Agent and CLI executors
16
+ - **Explicit Lifecycle**: `spawn_agent → wait → [send_input] → close_agent`
13
17
 
14
- Read plan file at `$FILE` path (e.g., `.workflow/.lite-plan/session-id/plan.json`)
18
+ **Core capabilities:**
19
+ - Multi-mode input (in-memory plan, prompt description, or file path)
20
+ - Execution orchestration via Codex subagents with full context
21
+ - Live progress tracking via TodoWrite at batch level
22
+ - Optional code review with selected tool (Gemini, Codex, or custom)
23
+ - Context continuity across multiple executions
24
+ - Intelligent format detection (Enhanced Task JSON vs plain text)
15
25
 
16
- ## Autonomous Execution Loop
26
+ ## Usage
17
27
 
18
- ```
19
- WHILE tasks remain:
20
- 1. Read plan.json → Get task list
21
- 2. Find FIRST task with status != "completed"
22
- 3. IF task.depends_on exists:
23
- - Check all dependencies completed
24
- - IF not met → Skip, find next eligible task
25
- 4. Execute current task fully
26
- 5. Mark task completed in plan.json
27
- 6. Output progress: "[X/N] Task completed: {title}"
28
- 7. CONTINUE to next task (DO NOT STOP)
29
-
30
- WHEN all tasks completed:
31
- Output final summary
28
+ ### Command Syntax
29
+ ```bash
30
+ /workflow:lite-execute [FLAGS] <INPUT>
31
+
32
+ # Flags
33
+ --in-memory Use plan from memory (called by lite-plan)
34
+
35
+ # Arguments
36
+ <input> Task description string, or path to file (required)
32
37
  ```
33
38
 
34
- ## Step-by-Step Execution
39
+ ## Input Modes
35
40
 
36
- ### Step 1: Load Plan
41
+ ### Mode 1: In-Memory Plan
37
42
 
38
- ```bash
39
- cat $FILE
43
+ **Trigger**: Called by lite-plan after Phase 4 approval with `--in-memory` flag
44
+
45
+ **Input Source**: `executionContext` global variable set by lite-plan
46
+
47
+ **Behavior**:
48
+ - Skip execution method selection (already set by lite-plan)
49
+ - Directly proceed to execution with full context
50
+ - All planning artifacts available (exploration, clarifications, plan)
51
+
52
+ ### Mode 2: Prompt Description
53
+
54
+ **Trigger**: User calls with task description string
55
+
56
+ **Input**: Simple task description (e.g., "Add unit tests for auth module")
57
+
58
+ **Behavior**:
59
+ - Store prompt as `originalUserInput`
60
+ - Create simple execution plan from prompt
61
+ - AskUserQuestion: Select execution method (Agent/Codex/Auto)
62
+ - AskUserQuestion: Select code review tool (Skip/Gemini/Codex/Other)
63
+ - Proceed to execution with `originalUserInput` included
64
+
65
+ ### Mode 3: File Content
66
+
67
+ **Trigger**: User calls with file path
68
+
69
+ **Input**: Path to file containing task description or plan.json
70
+
71
+ **Behavior**:
72
+ - Read file and detect format (plan.json vs plain text)
73
+ - If plan.json: Use `planObject` directly
74
+ - If plain text: Treat as prompt (same as Mode 2)
75
+
76
+ ## Execution Process
77
+
78
+ ```
79
+ Input Parsing:
80
+ └─ Decision (mode detection):
81
+ ├─ --in-memory flag → Mode 1: Load executionContext → Skip user selection
82
+ ├─ Ends with .md/.json/.txt → Mode 3: Read file → Detect format
83
+ │ ├─ Valid plan.json → Use planObject → User selects method + review
84
+ │ └─ Not plan.json → Treat as prompt → User selects method + review
85
+ └─ Other → Mode 2: Prompt description → User selects method + review
86
+
87
+ Execution (Codex Subagent Pattern):
88
+ ├─ Step 1: Initialize result tracking (previousExecutionResults = [])
89
+ ├─ Step 2: Task grouping & batch creation
90
+ │ ├─ Extract explicit depends_on (no inference)
91
+ │ ├─ Group: independent tasks → single parallel batch
92
+ │ └─ Group: dependent tasks → sequential phases
93
+ ├─ Step 3: Launch execution (spawn_agent × N → wait → close)
94
+ │ ├─ Phase 1: All independent tasks (spawn_agent × N → batch wait)
95
+ │ └─ Phase 2+: Dependent tasks (sequential spawn_agent → wait → close)
96
+ ├─ Step 4: Track progress (TodoWrite updates per batch)
97
+ └─ Step 5: Code review (if codeReviewTool ≠ "Skip")
98
+
99
+ Output:
100
+ └─ Execution complete with results in previousExecutionResults[]
40
101
  ```
41
102
 
42
- Parse JSON, extract:
43
- - `summary`: Overall goal
44
- - `tasks[]`: Task list with status
103
+ ## Implementation
104
+
105
+ ### Step 1: Initialize Execution Tracking
106
+
107
+ ```javascript
108
+ // Initialize result tracking
109
+ previousExecutionResults = []
110
+
111
+ // In-Memory Mode: Echo execution strategy
112
+ if (executionContext) {
113
+ console.log(`
114
+ ## Execution Strategy (from lite-plan)
115
+
116
+ - **Method**: ${executionContext.executionMethod}
117
+ - **Review**: ${executionContext.codeReviewTool}
118
+ - **Tasks**: ${executionContext.planObject.tasks.length}
119
+ - **Complexity**: ${executionContext.planObject.complexity}
120
+ ${executionContext.executorAssignments ? `- **Assignments**: ${JSON.stringify(executionContext.executorAssignments)}` : ''}
121
+ `)
122
+ }
123
+ ```
45
124
 
46
- ### Step 2: Find Next Task
125
+ ### Step 2: Task Grouping & Batch Creation
47
126
 
48
127
  ```javascript
49
- // Find first non-completed task with met dependencies
50
- for (task of tasks) {
51
- if (task.status === "completed") continue
52
- if (task.depends_on?.every(dep => getTask(dep).status === "completed")) {
53
- return task // Execute this one
128
+ // Use explicit depends_on from plan.json (no inference)
129
+ function extractDependencies(tasks) {
130
+ const taskIdToIndex = {}
131
+ tasks.forEach((t, i) => { taskIdToIndex[t.id] = i })
132
+
133
+ return tasks.map((task, i) => {
134
+ const deps = (task.depends_on || [])
135
+ .map(depId => taskIdToIndex[depId])
136
+ .filter(idx => idx !== undefined && idx < i)
137
+ return { ...task, taskIndex: i, dependencies: deps }
138
+ })
139
+ }
140
+
141
+ // Group into batches: maximize parallel execution
142
+ function createExecutionBatches(tasks, executionMethod) {
143
+ const tasksWithDeps = extractDependencies(tasks)
144
+ const processed = new Set()
145
+ const batches = []
146
+
147
+ // Phase 1: All independent tasks → single parallel batch
148
+ const independentTasks = tasksWithDeps.filter(t => t.dependencies.length === 0)
149
+ if (independentTasks.length > 0) {
150
+ independentTasks.forEach(t => processed.add(t.taskIndex))
151
+ batches.push({
152
+ method: executionMethod,
153
+ executionType: "parallel",
154
+ groupId: "P1",
155
+ taskSummary: independentTasks.map(t => t.title).join(' | '),
156
+ tasks: independentTasks
157
+ })
54
158
  }
159
+
160
+ // Phase 2+: Dependent tasks → sequential batches
161
+ let remaining = tasksWithDeps.filter(t => !processed.has(t.taskIndex))
162
+
163
+ while (remaining.length > 0) {
164
+ const ready = remaining.filter(t =>
165
+ t.dependencies.every(d => processed.has(d))
166
+ )
167
+
168
+ if (ready.length === 0) {
169
+ console.warn('Circular dependency detected, forcing remaining tasks')
170
+ ready.push(...remaining)
171
+ }
172
+
173
+ ready.forEach(t => processed.add(t.taskIndex))
174
+ batches.push({
175
+ method: executionMethod,
176
+ executionType: ready.length > 1 ? "parallel" : "sequential",
177
+ groupId: `P${batches.length + 1}`,
178
+ taskSummary: ready.map(t => t.title).join(' | '),
179
+ tasks: ready
180
+ })
181
+
182
+ remaining = remaining.filter(t => !processed.has(t.taskIndex))
183
+ }
184
+
185
+ return batches
55
186
  }
56
- return null // All done
187
+
188
+ const executionBatches = createExecutionBatches(planObject.tasks, executionMethod)
189
+
190
+ TodoWrite({
191
+ todos: executionBatches.map(b => ({
192
+ content: `${b.executionType === "parallel" ? "⚡" : "→"} [${b.groupId}] (${b.tasks.length} tasks)`,
193
+ status: "pending",
194
+ activeForm: `Executing ${b.groupId}`
195
+ }))
196
+ })
57
197
  ```
58
198
 
59
- ### Step 3: Execute Task
199
+ ### Step 3: Launch Execution (Codex Subagent Pattern)
60
200
 
61
- For current task, perform:
201
+ #### Executor Resolution
62
202
 
63
- ```markdown
64
- ## Executing: [task.title]
203
+ ```javascript
204
+ // Get executor for task (task-level > global)
205
+ function getTaskExecutor(task) {
206
+ const assignments = executionContext?.executorAssignments || {}
207
+ if (assignments[task.id]) {
208
+ return assignments[task.id].executor // 'gemini' | 'codex' | 'agent'
209
+ }
210
+ // Fallback: global executionMethod mapping
211
+ const method = executionContext?.executionMethod || 'Auto'
212
+ if (method === 'Agent') return 'agent'
213
+ if (method === 'Codex') return 'codex'
214
+ // Auto: based on complexity
215
+ return planObject.complexity === 'Low' ? 'agent' : 'codex'
216
+ }
217
+ ```
218
+
219
+ #### Unified Task Prompt Builder
220
+
221
+ ```javascript
222
+ function buildExecutionPrompt(batch) {
223
+ const formatTask = (t) => `
224
+ ## ${t.title}
65
225
 
66
- **Scope**: `[task.scope]` (module/feature level)
67
- **Action**: [task.action]
226
+ **Scope**: \`${t.scope}\` | **Action**: ${t.action}
68
227
 
69
228
  ### Modification Points
70
- For each point in task.modification_points:
71
- - **File**: [point.file]
72
- - **Target**: [point.target] (function/class/line range)
73
- - **Change**: [point.change]
74
-
75
- ### Implementation
76
- [Follow task.implementation steps]
77
-
78
- ### Reference Pattern
79
- - Pattern: [task.reference.pattern]
80
- - Files: [task.reference.files]
81
- - Examples: [task.reference.examples]
82
-
83
- ### Acceptance Criteria
84
- - [ ] [criterion 1]
85
- - [ ] [criterion 2]
229
+ ${t.modification_points.map(p => `- **${p.file}** → \`${p.target}\`: ${p.change}`).join('\n')}
230
+
231
+ ${t.rationale ? `
232
+ ### Why this approach
233
+ ${t.rationale.chosen_approach}
234
+ ${t.rationale.decision_factors?.length > 0 ? `\nKey factors: ${t.rationale.decision_factors.join(', ')}` : ''}
235
+ ` : ''}
236
+
237
+ ### How to do it
238
+ ${t.description}
239
+
240
+ ${t.implementation.map(step => `- ${step}`).join('\n')}
241
+
242
+ ### Reference
243
+ - Pattern: ${t.reference?.pattern || 'N/A'}
244
+ - Files: ${t.reference?.files?.join(', ') || 'N/A'}
245
+
246
+ ### Done when
247
+ ${t.acceptance.map(c => `- [ ] ${c}`).join('\n')}`
248
+
249
+ const sections = []
250
+
251
+ if (originalUserInput) sections.push(`## Goal\n${originalUserInput}`)
252
+
253
+ sections.push(`## Tasks\n${batch.tasks.map(formatTask).join('\n\n---\n')}`)
254
+
255
+ // Context
256
+ const context = []
257
+ if (previousExecutionResults.length > 0) {
258
+ context.push(`### Previous Work\n${previousExecutionResults.map(r => `- ${r.tasksSummary}: ${r.status}`).join('\n')}`)
259
+ }
260
+ if (clarificationContext) {
261
+ context.push(`### Clarifications\n${Object.entries(clarificationContext).map(([q, a]) => `- ${q}: ${a}`).join('\n')}`)
262
+ }
263
+ context.push(`### Project Guidelines\n@.workflow/project-guidelines.json`)
264
+ if (context.length > 0) sections.push(`## Context\n${context.join('\n\n')}`)
265
+
266
+ sections.push(`Complete each task according to its "Done when" checklist.`)
267
+
268
+ return sections.join('\n\n')
269
+ }
86
270
  ```
87
271
 
88
- **Execute all modification points. Verify all acceptance criteria.**
272
+ #### Parallel Batch Execution (Codex Pattern)
89
273
 
90
- ### Step 4: Mark Completed
274
+ ```javascript
275
+ // ==================== CODEX SUBAGENT PATTERN ====================
276
+
277
+ async function executeBatch(batch) {
278
+ const executor = getTaskExecutor(batch.tasks[0])
279
+
280
+ if (executor === 'agent') {
281
+ return executeWithAgent(batch)
282
+ } else {
283
+ return executeWithCLI(batch, executor)
284
+ }
285
+ }
91
286
 
92
- Update task status in plan.json:
93
- ```json
94
- {
95
- "id": "task-id",
96
- "status": "completed" // Change from "pending"
287
+ // Option A: Agent Execution (spawn_agent pattern)
288
+ async function executeWithAgent(batch) {
289
+ // Step 1: Spawn agents for parallel execution (role file read by agent itself)
290
+ const executionAgents = batch.tasks.map((task, index) => {
291
+ return spawn_agent({
292
+ message: `
293
+ ## TASK ASSIGNMENT
294
+
295
+ ### Execution Context
296
+ - **Batch ID**: ${batch.groupId}
297
+ - **Task Index**: ${index + 1} of ${batch.tasks.length}
298
+ - **Execution Type**: ${batch.executionType}
299
+
300
+ ### Task Content
301
+ ${buildExecutionPrompt({ ...batch, tasks: [task] })}
302
+
303
+ ### MANDATORY FIRST STEPS (Agent Execute)
304
+ 1. **Read role definition**: ~/.codex/agents/code-developer.md (MUST read first)
305
+ 2. Read: .workflow/project-tech.json (technology context)
306
+ 3. Read: .workflow/project-guidelines.json (constraints)
307
+ 4. Understand existing patterns before modifying
308
+
309
+ ### Quality Standards
310
+ - Follow existing code patterns
311
+ - Maintain backward compatibility
312
+ - No unnecessary changes beyond scope
313
+
314
+ ### Deliverables
315
+ - Implement task according to "Done when" checklist
316
+ - Return: Brief completion summary with files modified
317
+ `
318
+ })
319
+ })
320
+
321
+ // Step 3: Batch wait for all agents
322
+ const results = wait({
323
+ ids: executionAgents,
324
+ timeout_ms: 900000 // 15 minutes per batch
325
+ })
326
+
327
+ // Step 4: Collect results
328
+ const batchResult = {
329
+ executionId: `[${batch.groupId}]`,
330
+ status: results.timed_out ? 'partial' : 'completed',
331
+ tasksSummary: batch.taskSummary,
332
+ completionSummary: '',
333
+ keyOutputs: '',
334
+ notes: ''
335
+ }
336
+
337
+ executionAgents.forEach((agentId, index) => {
338
+ if (results.status[agentId].completed) {
339
+ batchResult.completionSummary += `Task ${index + 1}: ${results.status[agentId].completed}\n`
340
+ }
341
+ })
342
+
343
+ // Step 5: Cleanup all agents
344
+ executionAgents.forEach(id => close_agent({ id }))
345
+
346
+ return batchResult
347
+ }
348
+
349
+ // Option B: CLI Execution (ccw cli)
350
+ async function executeWithCLI(batch, executor) {
351
+ const sessionId = executionContext?.session?.id || 'standalone'
352
+ const fixedExecutionId = `${sessionId}-${batch.groupId}`
353
+
354
+ const cli_command = `ccw cli -p "${buildExecutionPrompt(batch)}" --tool ${executor} --mode write --id ${fixedExecutionId}`
355
+
356
+ // Execute in background
357
+ Bash({
358
+ command: cli_command,
359
+ run_in_background: true
360
+ })
361
+
362
+ // STOP HERE - CLI executes in background, task hook will notify on completion
363
+ return {
364
+ executionId: `[${batch.groupId}]`,
365
+ status: 'in_progress',
366
+ tasksSummary: batch.taskSummary,
367
+ fixedCliId: fixedExecutionId
368
+ }
97
369
  }
98
370
  ```
99
371
 
100
- ### Step 5: Continue
372
+ #### Execution Flow
101
373
 
102
- **DO NOT STOP. Immediately proceed to Step 2 to find next task.**
374
+ ```javascript
375
+ // ==================== MAIN EXECUTION FLOW ====================
376
+
377
+ const parallelBatches = executionBatches.filter(b => b.executionType === "parallel")
378
+ const sequentialBatches = executionBatches.filter(b => b.executionType === "sequential")
379
+
380
+ // Phase 1: Launch all parallel batches (Codex batch wait advantage)
381
+ if (parallelBatches.length > 0) {
382
+ TodoWrite({
383
+ todos: executionBatches.map(b => ({
384
+ status: b.executionType === "parallel" ? "in_progress" : "pending"
385
+ }))
386
+ })
387
+
388
+ // Spawn all parallel batch agents at once (role file read by agent itself)
389
+ const allParallelAgents = []
390
+ const batchToAgents = new Map()
391
+
392
+ for (const batch of parallelBatches) {
393
+ const executor = getTaskExecutor(batch.tasks[0])
394
+
395
+ if (executor === 'agent') {
396
+ const agents = batch.tasks.map((task, index) => spawn_agent({
397
+ message: `
398
+ ## TASK: ${task.title}
399
+ ${buildExecutionPrompt({ ...batch, tasks: [task] })}
400
+
401
+ ### MANDATORY FIRST STEPS (Agent Execute)
402
+ 1. **Read role definition**: ~/.codex/agents/code-developer.md (MUST read first)
403
+ 2. Read: .workflow/project-tech.json
404
+ 3. Read: .workflow/project-guidelines.json
405
+ `
406
+ }))
407
+
408
+ allParallelAgents.push(...agents)
409
+ batchToAgents.set(batch.groupId, agents)
410
+ }
411
+ }
412
+
413
+ // Single batch wait for ALL parallel agents (KEY CODEX ADVANTAGE)
414
+ if (allParallelAgents.length > 0) {
415
+ const parallelResults = wait({
416
+ ids: allParallelAgents,
417
+ timeout_ms: 900000
418
+ })
419
+
420
+ // Collect results per batch
421
+ for (const batch of parallelBatches) {
422
+ const agents = batchToAgents.get(batch.groupId) || []
423
+ const batchResult = {
424
+ executionId: `[${batch.groupId}]`,
425
+ status: 'completed',
426
+ tasksSummary: batch.taskSummary,
427
+ completionSummary: agents.map((id, i) =>
428
+ parallelResults.status[id]?.completed || 'incomplete'
429
+ ).join('\n')
430
+ }
431
+ previousExecutionResults.push(batchResult)
432
+ }
433
+
434
+ // Cleanup all parallel agents
435
+ allParallelAgents.forEach(id => close_agent({ id }))
436
+ }
437
+
438
+ TodoWrite({
439
+ todos: executionBatches.map(b => ({
440
+ status: parallelBatches.includes(b) ? "completed" : "pending"
441
+ }))
442
+ })
443
+ }
103
444
 
104
- Output progress:
445
+ // Phase 2: Execute sequential batches one by one
446
+ for (const batch of sequentialBatches) {
447
+ TodoWrite({
448
+ todos: executionBatches.map(b => ({
449
+ status: b === batch ? "in_progress" : (processed.has(b) ? "completed" : "pending")
450
+ }))
451
+ })
452
+
453
+ const result = await executeBatch(batch)
454
+ previousExecutionResults.push(result)
455
+
456
+ TodoWrite({
457
+ todos: executionBatches.map(b => ({
458
+ status: "completed" /* or "pending" for remaining */
459
+ }))
460
+ })
461
+ }
105
462
  ```
106
- ✓ [2/5] Completed: [task.title]
107
- Next: [next_task.title]
463
+
464
+ ### Step 4: Progress Tracking
465
+
466
+ Progress tracked at batch level. Icons: ⚡ (parallel), → (sequential)
467
+
468
+ ### Step 5: Code Review (Optional)
469
+
470
+ **Skip Condition**: Only run if `codeReviewTool ≠ "Skip"`
471
+
472
+ ```javascript
473
+ // ==================== CODE REVIEW (CODEX PATTERN) ====================
474
+
475
+ if (codeReviewTool !== 'Skip') {
476
+ console.log(`
477
+ ## Code Review
478
+
479
+ Starting ${codeReviewTool} review...
480
+ `)
481
+
482
+ const reviewPrompt = `
483
+ PURPOSE: Code review for implemented changes against plan acceptance criteria
484
+ TASK: • Verify plan acceptance criteria • Check verification requirements • Analyze code quality • Identify issues
485
+ MODE: analysis
486
+ CONTEXT: @**/* @${executionContext.session.artifacts.plan} | Memory: Review lite-execute changes
487
+ EXPECTED: Quality assessment with: acceptance verification, issue identification, recommendations
488
+ CONSTRAINTS: Focus on plan acceptance criteria | analysis=READ-ONLY
489
+ `
490
+
491
+ if (codeReviewTool === 'Agent Review') {
492
+ // Spawn review agent (role file read by agent itself)
493
+ const reviewAgent = spawn_agent({
494
+ message: `
495
+ ## TASK: Code Review
496
+
497
+ ${reviewPrompt}
498
+
499
+ ### MANDATORY FIRST STEPS (Agent Execute)
500
+ 1. **Read role definition**: ~/.codex/agents/code-developer.md (MUST read first)
501
+ 2. Read plan artifact: ${executionContext.session.artifacts.plan}
502
+ ${executionContext.session.artifacts.explorations?.map(e => `3. Read exploration: ${e.path}`).join('\n') || ''}
503
+
504
+ ### Review Focus
505
+ 1. Verify each acceptance criterion from plan.tasks[].acceptance
506
+ 2. Check verification requirements (unit_tests, success_metrics)
507
+ 3. Validate plan adherence and risk mitigations
508
+ 4. Identify any issues or improvements needed
509
+
510
+ ### Output Format
511
+ Summary: [overall assessment]
512
+ Acceptance: [criterion 1: ✓/✗, criterion 2: ✓/✗, ...]
513
+ Issues: [list of issues if any]
514
+ Recommendations: [suggestions]
515
+ `
516
+ })
517
+
518
+ const reviewResult = wait({
519
+ ids: [reviewAgent],
520
+ timeout_ms: 600000
521
+ })
522
+
523
+ console.log(`
524
+ ### Review Complete
525
+
526
+ ${reviewResult.status[reviewAgent].completed}
527
+ `)
528
+
529
+ close_agent({ id: reviewAgent })
530
+
531
+ } else if (codeReviewTool === 'Gemini Review') {
532
+ // CLI-based review
533
+ Bash({
534
+ command: `ccw cli -p "${reviewPrompt}" --tool gemini --mode analysis`,
535
+ run_in_background: true
536
+ })
537
+ // Wait for hook callback
538
+
539
+ } else if (codeReviewTool === 'Codex Review') {
540
+ // Git-aware review
541
+ Bash({
542
+ command: `ccw cli --tool codex --mode review --uncommitted`,
543
+ run_in_background: true
544
+ })
545
+ // Wait for hook callback
546
+ }
547
+ }
108
548
  ```
109
549
 
110
- ## Task Format Reference
550
+ ### Step 6: Update Development Index
111
551
 
112
- ```json
113
- {
114
- "id": "T1",
115
- "title": "Implement auth validation",
116
- "scope": "src/auth/",
117
- "action": "Create|Update|Implement|Refactor|Add|Delete|Configure|Test|Fix",
118
- "description": "What to implement (1-2 sentences)",
119
- "modification_points": [
120
- {
121
- "file": "src/auth/validator.ts",
122
- "target": "validateToken:45-60",
123
- "change": "Add expiry check"
124
- },
125
- {
126
- "file": "src/auth/middleware.ts",
127
- "target": "authMiddleware",
128
- "change": "Call new validator"
129
- }
130
- ],
131
- "implementation": ["step 1", "step 2", "...max 7 steps"],
132
- "reference": {
133
- "pattern": "pattern name",
134
- "files": ["example1.ts"],
135
- "examples": "specific guidance"
136
- },
137
- "acceptance": ["criterion 1", "criterion 2"],
138
- "depends_on": ["T0"],
139
- "status": "pending|completed"
552
+ ```javascript
553
+ // After all executions complete
554
+ const projectJsonPath = '.workflow/project-tech.json'
555
+ if (fileExists(projectJsonPath)) {
556
+ const projectJson = JSON.parse(Read(projectJsonPath))
557
+
558
+ if (!projectJson.development_index) {
559
+ projectJson.development_index = { feature: [], enhancement: [], bugfix: [], refactor: [], docs: [] }
560
+ }
561
+
562
+ function detectCategory(text) {
563
+ text = text.toLowerCase()
564
+ if (/\b(fix|bug|error|issue|crash)\b/.test(text)) return 'bugfix'
565
+ if (/\b(refactor|cleanup|reorganize)\b/.test(text)) return 'refactor'
566
+ if (/\b(doc|readme|comment)\b/.test(text)) return 'docs'
567
+ if (/\b(add|new|create|implement)\b/.test(text)) return 'feature'
568
+ return 'enhancement'
569
+ }
570
+
571
+ const category = detectCategory(`${planObject.summary} ${planObject.approach}`)
572
+ const entry = {
573
+ title: planObject.summary.slice(0, 60),
574
+ date: new Date().toISOString().split('T')[0],
575
+ description: planObject.approach.slice(0, 100),
576
+ status: previousExecutionResults.every(r => r.status === 'completed') ? 'completed' : 'partial',
577
+ session_id: executionContext?.session?.id || null
578
+ }
579
+
580
+ projectJson.development_index[category].push(entry)
581
+ Write(projectJsonPath, JSON.stringify(projectJson, null, 2))
582
+
583
+ console.log(`✓ Development index: [${category}] ${entry.title}`)
140
584
  }
141
585
  ```
142
586
 
143
- **Key Fields**:
144
- - `scope`: Module/feature level path (prefer over single file)
145
- - `modification_points[]`: All files to modify with precise targets
146
- - `target`: Function/class/line range (e.g., `validateToken:45-60`)
587
+ ---
147
588
 
148
- ## Execution Rules
589
+ ## Codex vs Claude Comparison (for this workflow)
149
590
 
150
- 1. **Never stop mid-workflow** - Continue until all tasks complete
151
- 2. **One task at a time** - Fully complete before moving on
152
- 3. **Respect dependencies** - Skip blocked tasks, return later
153
- 4. **Update status immediately** - Mark completed right after finishing
154
- 5. **Self-verify** - Check acceptance criteria before marking done
591
+ | Aspect | Claude Code Task | Codex Subagent |
592
+ |--------|------------------|----------------|
593
+ | **Creation** | `Task({ subagent_type, prompt })` | `spawn_agent({ message: task })` |
594
+ | **Role Loading** | Auto via `subagent_type` | Agent reads `~/.codex/agents/*.md` in MANDATORY FIRST STEPS |
595
+ | **Parallel Wait** | Multiple `Task()` calls | **Batch `wait({ ids: [...] })`** |
596
+ | **Result Retrieval** | Sync return or `TaskOutput` | `wait({ ids }).status[id].completed` |
597
+ | **Follow-up** | `resume` parameter | `send_input({ id, message })` |
598
+ | **Cleanup** | Automatic | **Explicit `close_agent({ id })`** |
155
599
 
156
- ## Final Summary
600
+ **Codex Advantages for lite-execute**:
601
+ - True parallel execution with batch `wait` for all independent tasks
602
+ - Single wait call for multiple agents (reduced orchestration overhead)
603
+ - Fine-grained lifecycle control for complex task graphs
157
604
 
158
- When ALL tasks completed:
605
+ ---
159
606
 
160
- ```markdown
161
- ## Execution Complete
607
+ ## Data Structures
162
608
 
163
- **Plan**: $FILE
164
- **Total Tasks**: N
165
- **All Completed**: Yes
609
+ ### executionContext (Input - Mode 1)
166
610
 
167
- ### Results
168
- | # | Task | Status |
169
- |---|------|--------|
170
- | 1 | [title] | ✓ |
171
- | 2 | [title] | ✓ |
611
+ ```javascript
612
+ {
613
+ planObject: {
614
+ summary: string,
615
+ approach: string,
616
+ tasks: [...],
617
+ estimated_time: string,
618
+ recommended_execution: string,
619
+ complexity: string
620
+ },
621
+ clarificationContext: {...} | null,
622
+ executionMethod: "Agent" | "Codex" | "Auto",
623
+ codeReviewTool: "Skip" | "Gemini Review" | "Codex Review" | string,
624
+ originalUserInput: string,
625
+ executorAssignments: {
626
+ [taskId]: { executor: "gemini" | "codex" | "agent", reason: string }
627
+ },
628
+ session: {
629
+ id: string,
630
+ folder: string,
631
+ artifacts: {
632
+ explorations: [{angle, path}],
633
+ plan: string
634
+ }
635
+ }
636
+ }
637
+ ```
172
638
 
173
- ### Files Modified
174
- - `path/file1.ts`
175
- - `path/file2.ts`
639
+ ### executionResult (Output)
176
640
 
177
- ### Summary
178
- [Brief description of what was accomplished]
641
+ ```javascript
642
+ {
643
+ executionId: string, // e.g., "[P1]", "[S1]"
644
+ status: "completed" | "partial" | "failed",
645
+ tasksSummary: string,
646
+ completionSummary: string,
647
+ keyOutputs: string,
648
+ notes: string,
649
+ fixedCliId: string | null // For CLI resume capability
650
+ }
179
651
  ```
180
652
 
653
+ ---
654
+
181
655
  ## Error Handling
182
656
 
183
- | Situation | Action |
184
- |-----------|--------|
185
- | File not found | Error and stop |
186
- | Task blocked (deps not met) | Skip, try next task |
187
- | All remaining tasks blocked | Report circular dependency |
188
- | Task execution error | Report error, mark failed, continue to next |
189
- | Acceptance criteria not met | Retry or report, then continue |
657
+ | Error | Resolution |
658
+ |-------|------------|
659
+ | spawn_agent failure | Fallback to CLI execution |
660
+ | wait() timeout | Use completed results, log partial status |
661
+ | Agent crash | Collect partial output, offer retry |
662
+ | CLI execution failure | Use fixed ID for resume |
663
+ | Circular dependency | Force remaining tasks with warning |
664
+ | Missing executionContext | Error: "No execution context found" |
665
+
666
+ ---
667
+
668
+ ## Best Practices
669
+
670
+ **Codex-Specific**:
671
+ - Pass role file path in MANDATORY FIRST STEPS (agent reads itself)
672
+ - Use batch `wait({ ids: [...] })` for parallel tasks
673
+ - Delay `close_agent` until all interactions complete
674
+ - Track `fixedCliId` for resume capability
675
+
676
+ **General**:
677
+ - Task Grouping: Based on explicit depends_on only
678
+ - Execution: All independent tasks launch via single batch wait
679
+ - Progress: TodoWrite at batch level (⚡ parallel, → sequential)
680
+
681
+ ---
682
+
683
+ **Now execute the lite-execute workflow**