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,288 +1,298 @@
1
- ---
2
- description: Form execution queue from bound solutions (orders solutions, detects conflicts, assigns groups)
3
- argument-hint: "[--issue <id>] [--append <id>]"
4
- ---
5
-
6
- # Issue Queue (Codex Version)
7
-
8
- ## Goal
9
-
10
- Create an ordered execution queue from all bound solutions. Analyze inter-solution file conflicts, calculate semantic priorities, and assign parallel/sequential execution groups.
11
-
12
- This workflow is **ordering only** (no execution): it reads bound solutions, detects conflicts, and produces a queue file that `issue-execute.md` can consume.
13
-
14
- **Design Principle**: Queue items are **solutions**, not individual tasks. Each executor receives a complete solution with all its tasks.
15
-
16
- ## Core Guidelines
17
-
18
- **⚠️ Data Access Principle**: Issues and queue files can grow very large. To avoid context overflow:
19
-
20
- | Operation | Correct | Incorrect |
21
- |-----------|---------|-----------|
22
- | List issues (brief) | `ccw issue list --status planned --brief` | `Read('issues.jsonl')` |
23
- | List queue (brief) | `ccw issue queue --brief` | `Read('queues/*.json')` |
24
- | Read issue details | `ccw issue status <id> --json` | `Read('issues.jsonl')` |
25
- | Get next item | `ccw issue next --json` | `Read('queues/*.json')` |
26
- | Update status | `ccw issue update <id> --status ...` | Direct file edit |
27
- | Sync from queue | `ccw issue update --from-queue` | Direct file edit |
28
-
29
- **Output Options**:
30
- - `--brief`: JSON with minimal fields (id, status, counts)
31
- - `--json`: Full JSON (for detailed processing)
32
-
33
- **ALWAYS** use CLI commands for CRUD operations. **NEVER** read entire `issues.jsonl` or `queues/*.json` directly.
34
-
35
- ## Inputs
36
-
37
- - **All planned**: Default behavior → queue all issues with `planned` status and bound solutions
38
- - **Specific issue**: `--issue <id>` → queue only that issue's solution
39
- - **Append mode**: `--append <id>` append issue to active queue (don't create new)
40
-
41
- ## Output Requirements
42
-
43
- **Generate Files (EXACTLY 2):**
44
- 1. `.workflow/issues/queues/{queue-id}.json` - Full queue with solutions, conflicts, groups
45
- 2. `.workflow/issues/queues/index.json` - Update with new queue entry
46
-
47
- **Return Summary:**
48
- ```json
49
- {
50
- "queue_id": "QUE-YYYYMMDD-HHMMSS",
51
- "total_solutions": 3,
52
- "total_tasks": 12,
53
- "execution_groups": [{ "id": "P1", "type": "parallel", "count": 2 }],
54
- "conflicts_resolved": 1,
55
- "issues_queued": ["ISS-xxx", "ISS-yyy"]
56
- }
57
- ```
58
-
59
- ## Workflow
60
-
61
- ### Step 1: Generate Queue ID
62
-
63
- Generate queue ID ONCE at start, reuse throughout:
64
-
65
- ```bash
66
- # Format: QUE-YYYYMMDD-HHMMSS (UTC)
67
- QUEUE_ID="QUE-$(date -u +%Y%m%d-%H%M%S)"
68
- ```
69
-
70
- ### Step 2: Load Planned Issues
71
-
72
- Get all issues with bound solutions:
73
-
74
- ```bash
75
- ccw issue list --status planned --json
76
- ```
77
-
78
- For each issue in the result:
79
- - Extract `id`, `bound_solution_id`, `priority`
80
- - Read solution from `.workflow/issues/solutions/{issue-id}.jsonl`
81
- - Find the bound solution by matching `solution.id === bound_solution_id`
82
- - Collect `files_touched` from all tasks' `modification_points.file`
83
-
84
- Build solution list:
85
- ```json
86
- [
87
- {
88
- "issue_id": "ISS-xxx",
89
- "solution_id": "SOL-xxx",
90
- "task_count": 3,
91
- "files_touched": ["src/auth.ts", "src/utils.ts"],
92
- "priority": "medium"
93
- }
94
- ]
95
- ```
96
-
97
- ### Step 3: Detect File Conflicts
98
-
99
- Build a file solutions mapping:
100
-
101
- ```javascript
102
- fileModifications = {
103
- "src/auth.ts": ["SOL-ISS-001-1", "SOL-ISS-003-1"],
104
- "src/api.ts": ["SOL-ISS-002-1"]
105
- }
106
- ```
107
-
108
- Conflicts exist when a file has multiple solutions. For each conflict:
109
- - Record the file and involved solutions
110
- - Will be resolved in Step 4
111
-
112
- ### Step 4: Resolve Conflicts & Build DAG
113
-
114
- **Resolution Rules (in priority order):**
115
- 1. Higher issue priority first: `critical > high > medium > low`
116
- 2. Foundation solutions first: fewer dependencies
117
- 3. More tasks = higher priority: larger impact
118
-
119
- For each file conflict:
120
- - Apply resolution rules to determine order
121
- - Add dependency edge: later solution `depends_on` earlier solution
122
- - Record rationale
123
-
124
- **Semantic Priority Formula:**
125
- ```
126
- Base: critical=0.9, high=0.7, medium=0.5, low=0.3
127
- Boost: task_count>=5 +0.1, task_count>=3 → +0.05
128
- Final: clamp(base + boost, 0.0, 1.0)
129
- ```
130
-
131
- ### Step 5: Assign Execution Groups
132
-
133
- - **Parallel (P1, P2, ...)**: Solutions with NO file overlaps between them
134
- - **Sequential (S1, S2, ...)**: Solutions that share files must run in order
135
-
136
- Group assignment:
137
- 1. Start with all solutions in potential parallel group
138
- 2. For each file conflict, move later solution to sequential group
139
- 3. Assign group IDs: P1 for first parallel batch, S2 for first sequential, etc.
140
-
141
- ### Step 6: Generate Queue Files
142
-
143
- **Queue file structure** (`.workflow/issues/queues/{QUEUE_ID}.json`):
144
-
145
- ```json
146
- {
147
- "id": "QUE-20251228-120000",
148
- "status": "active",
149
- "issue_ids": ["ISS-001", "ISS-002"],
150
- "solutions": [
151
- {
152
- "item_id": "S-1",
153
- "issue_id": "ISS-001",
154
- "solution_id": "SOL-ISS-001-1",
155
- "status": "pending",
156
- "execution_order": 1,
157
- "execution_group": "P1",
158
- "depends_on": [],
159
- "semantic_priority": 0.8,
160
- "files_touched": ["src/auth.ts"],
161
- "task_count": 3
162
- }
163
- ],
164
- "conflicts": [
165
- {
166
- "type": "file_conflict",
167
- "file": "src/auth.ts",
168
- "solutions": ["S-1", "S-3"],
169
- "resolution": "sequential",
170
- "resolution_order": ["S-1", "S-3"],
171
- "rationale": "S-1 creates auth module, S-3 extends it"
172
- }
173
- ],
174
- "execution_groups": [
175
- { "id": "P1", "type": "parallel", "solutions": ["S-1", "S-2"], "solution_count": 2 },
176
- { "id": "S2", "type": "sequential", "solutions": ["S-3"], "solution_count": 1 }
177
- ]
178
- }
179
- ```
180
-
181
- **Update index** (`.workflow/issues/queues/index.json`):
182
-
183
- ```json
184
- {
185
- "active_queue_id": "QUE-20251228-120000",
186
- "active_queue_ids": ["QUE-20251228-120000"],
187
- "queues": [
188
- {
189
- "id": "QUE-20251228-120000",
190
- "status": "active",
191
- "priority": 1,
192
- "issue_ids": ["ISS-001", "ISS-002"],
193
- "total_solutions": 3,
194
- "completed_solutions": 0,
195
- "created_at": "2025-12-28T12:00:00Z"
196
- }
197
- ]
198
- }
199
- ```
200
-
201
- ## Multi-Queue Management
202
-
203
- Multiple queues can be active simultaneously. The system executes queues in priority order (lower = higher priority).
204
-
205
- **Activate multiple queues:**
206
- ```bash
207
- ccw issue queue activate QUE-001,QUE-002,QUE-003
208
- ```
209
-
210
- **Set queue priority:**
211
- ```bash
212
- ccw issue queue priority QUE-001 --priority 1
213
- ccw issue queue priority QUE-002 --priority 2
214
- ```
215
-
216
- **Execution behavior with multi-queue:**
217
- - `ccw issue next` automatically selects from active queues in priority order
218
- - Complete all items in Q1 before moving to Q2 (serialized execution)
219
- - Use `--queue QUE-xxx` to target a specific queue
220
-
221
- ### Step 7: Update Issue Statuses
222
-
223
- **MUST use CLI command** (NOT direct file operations):
224
-
225
- ```bash
226
- # Option 1: Batch update from queue (recommended)
227
- ccw issue update --from-queue # Use active queue
228
- ccw issue update --from-queue QUE-xxx # Use specific queue
229
-
230
- # Option 2: Individual issue update
231
- ccw issue update <issue-id> --status queued
232
- ```
233
-
234
- **⚠️ IMPORTANT**: Do NOT directly modify `issues.jsonl`. Always use CLI command to ensure proper validation and history tracking.
235
-
236
- ## Queue Item ID Format
237
-
238
- - Solution items: `S-1`, `S-2`, `S-3`, ...
239
- - Sequential numbering starting from 1
240
-
241
- ## Quality Checklist
242
-
243
- Before completing, verify:
244
-
245
- - [ ] Exactly 2 files generated: queue JSON + index update
246
- - [ ] Queue has valid DAG (no circular dependencies)
247
- - [ ] All file conflicts resolved with rationale
248
- - [ ] Semantic priority calculated for each solution (0.0-1.0)
249
- - [ ] Execution groups assigned (P* for parallel, S* for sequential)
250
- - [ ] Issue statuses updated to `queued`
251
- - [ ] Summary JSON returned with correct shape
252
-
253
- ## Validation Rules
254
-
255
- 1. **No cycles**: If resolution creates a cycle, abort and report
256
- 2. **Parallel safety**: Solutions in same P* group must have NO file overlaps
257
- 3. **Sequential order**: Solutions in S* group must be in correct dependency order
258
- 4. **Single queue ID**: Use the same queue ID throughout (generated in Step 1)
259
-
260
- ## Error Handling
261
-
262
- | Situation | Action |
263
- |-----------|--------|
264
- | No planned issues | Return empty queue summary |
265
- | Circular dependency detected | Abort, report cycle details |
266
- | Missing solution file | Skip issue, log warning |
267
- | Index file missing | Create new index |
268
- | Index not updated | Auto-fix: Set active_queue_id to new queue |
269
-
270
- ## Done Criteria
271
-
272
- - [ ] All planned issues with `bound_solution_id` are included
273
- - [ ] Queue JSON written to `queues/{queue-id}.json`
274
- - [ ] Index updated in `queues/index.json` with `active_queue_id`
275
- - [ ] No circular dependencies in solution DAG
276
- - [ ] Parallel groups have no file overlaps
277
- - [ ] Issue statuses updated to `queued`
278
-
279
- ## Start Execution
280
-
281
- Begin by listing planned issues:
282
-
283
- ```bash
284
- ccw issue list --status planned --json
285
- ```
286
-
287
- Then follow the workflow to generate the queue.
288
-
1
+ ---
2
+ description: Form execution queue from bound solutions using subagent for conflict analysis and ordering
3
+ argument-hint: "[--queues <n>] [--issue <id>] [--append <id>]"
4
+ ---
5
+
6
+ # Issue Queue (Codex Version)
7
+
8
+ ## Goal
9
+
10
+ Create an ordered execution queue from all bound solutions. Uses **subagent pattern** to analyze inter-solution file conflicts, calculate semantic priorities, and assign parallel/sequential execution groups.
11
+
12
+ **Design Principle**: Queue items are **solutions**, not individual tasks. Each executor receives a complete solution with all its tasks.
13
+
14
+ ## Core Guidelines
15
+
16
+ **⚠️ Data Access Principle**: Issues and queue files can grow very large. To avoid context overflow:
17
+
18
+ | Operation | Correct | Incorrect |
19
+ |-----------|---------|-----------|
20
+ | List issues (brief) | `ccw issue list --status planned --brief` | Read issues.jsonl |
21
+ | List queue (brief) | `ccw issue queue --brief` | Read queues/*.json |
22
+ | Read issue details | `ccw issue status <id> --json` | Read issues.jsonl |
23
+ | Get next item | `ccw issue next --json` | Read queues/*.json |
24
+ | Sync from queue | `ccw issue update --from-queue` | Direct file edit |
25
+
26
+ **ALWAYS** use CLI commands for CRUD operations. **NEVER** read entire `issues.jsonl` or `queues/*.json` directly.
27
+
28
+ ## Inputs
29
+
30
+ - **All planned**: Default behavior queue all issues with `planned` status and bound solutions
31
+ - **Multiple queues**: `--queues <n>` create N parallel queues
32
+ - **Specific issue**: `--issue <id>` → queue only that issue's solution
33
+ - **Append mode**: `--append <id>` append issue to active queue (don't create new)
34
+
35
+ ## Output Requirements
36
+
37
+ **Generate Files (EXACTLY 2):**
38
+ 1. `.workflow/issues/queues/{queue-id}.json` - Full queue with solutions, conflicts, groups
39
+ 2. `.workflow/issues/queues/index.json` - Update with new queue entry
40
+
41
+ **Return Summary:**
42
+ ```json
43
+ {
44
+ "queue_id": "QUE-YYYYMMDD-HHMMSS",
45
+ "total_solutions": 3,
46
+ "total_tasks": 12,
47
+ "execution_groups": [{ "id": "P1", "type": "parallel", "count": 2 }],
48
+ "conflicts_resolved": 1,
49
+ "issues_queued": ["ISS-xxx", "ISS-yyy"]
50
+ }
51
+ ```
52
+
53
+ ## Workflow
54
+
55
+ ### Step 1: Generate Queue ID and Load Solutions
56
+
57
+ ```bash
58
+ # Generate queue ID
59
+ QUEUE_ID="QUE-$(date -u +%Y%m%d-%H%M%S)"
60
+
61
+ # Load planned issues with bound solutions
62
+ ccw issue list --status planned --json
63
+ ```
64
+
65
+ For each issue, extract:
66
+ - `id`, `bound_solution_id`, `priority`
67
+ - Read solution from `.workflow/issues/solutions/{issue-id}.jsonl`
68
+ - Collect `files_touched` from all tasks' `modification_points.file`
69
+
70
+ Build solution list:
71
+ ```json
72
+ [
73
+ {
74
+ "issue_id": "ISS-xxx",
75
+ "solution_id": "SOL-xxx",
76
+ "task_count": 3,
77
+ "files_touched": ["src/auth.ts", "src/utils.ts"],
78
+ "priority": "medium"
79
+ }
80
+ ]
81
+ ```
82
+
83
+ ### Step 2: Spawn Queue Agent for Conflict Analysis
84
+
85
+ Spawn subagent to analyze conflicts and order solutions:
86
+
87
+ ```javascript
88
+ const agentId = spawn_agent({
89
+ message: `
90
+ ## TASK ASSIGNMENT
91
+
92
+ ### MANDATORY FIRST STEPS (Agent Execute)
93
+ 1. **Read role definition**: ~/.codex/agents/issue-queue-agent.md (MUST read first)
94
+ 2. Read: .workflow/project-tech.json
95
+ 3. Read: .workflow/project-guidelines.json
96
+
97
+ ---
98
+
99
+ Goal: Order ${solutions.length} solutions into execution queue with conflict resolution
100
+
101
+ Scope:
102
+ - CAN DO: Analyze file conflicts, calculate priorities, assign groups
103
+ - CANNOT DO: Execute solutions, modify code
104
+ - Queue ID: ${QUEUE_ID}
105
+
106
+ Context:
107
+ - Solutions: ${JSON.stringify(solutions, null, 2)}
108
+ - Project Root: ${process.cwd()}
109
+
110
+ Deliverables:
111
+ 1. Write queue JSON to: .workflow/issues/queues/${QUEUE_ID}.json
112
+ 2. Update index: .workflow/issues/queues/index.json
113
+ 3. Return summary JSON
114
+
115
+ Quality bar:
116
+ - No circular dependencies in DAG
117
+ - Parallel groups have NO file overlaps
118
+ - Semantic priority calculated (0.0-1.0)
119
+ - All conflicts resolved with rationale
120
+ `
121
+ })
122
+
123
+ // Wait for agent completion
124
+ const result = wait({ ids: [agentId], timeout_ms: 600000 })
125
+
126
+ // Parse result
127
+ const summary = JSON.parse(result.status[agentId].completed)
128
+
129
+ // Check for clarifications
130
+ if (summary.clarifications?.length > 0) {
131
+ // Handle high-severity conflicts requiring user input
132
+ for (const clarification of summary.clarifications) {
133
+ console.log(`Conflict: ${clarification.question}`)
134
+ console.log(`Options: ${clarification.options.join(', ')}`)
135
+ // Get user input and send back
136
+ send_input({
137
+ id: agentId,
138
+ message: `Conflict ${clarification.conflict_id} resolved: ${userChoice}`
139
+ })
140
+ wait({ ids: [agentId], timeout_ms: 300000 })
141
+ }
142
+ }
143
+
144
+ // Close agent
145
+ close_agent({ id: agentId })
146
+ ```
147
+
148
+ ### Step 3: Multi-Queue Support (if --queues > 1)
149
+
150
+ When creating multiple parallel queues:
151
+
152
+ 1. **Partition solutions** to minimize cross-queue file conflicts
153
+ 2. **Spawn N agents in parallel** (one per queue)
154
+ 3. **Wait for all agents** with batch wait
155
+
156
+ ```javascript
157
+ // Partition solutions by file overlap
158
+ const partitions = partitionSolutions(solutions, numQueues)
159
+
160
+ // Spawn agents in parallel
161
+ const agentIds = partitions.map((partition, i) =>
162
+ spawn_agent({
163
+ message: buildQueuePrompt(partition, `${QUEUE_ID}-${i+1}`, i+1, numQueues)
164
+ })
165
+ )
166
+
167
+ // Batch wait for all agents
168
+ const results = wait({ ids: agentIds, timeout_ms: 600000 })
169
+
170
+ // Collect clarifications from all agents
171
+ const allClarifications = agentIds.flatMap((id, i) =>
172
+ (results.status[id].clarifications || []).map(c => ({ ...c, queue_id: `${QUEUE_ID}-${i+1}`, agent_id: id }))
173
+ )
174
+
175
+ // Handle clarifications, then close all agents
176
+ agentIds.forEach(id => close_agent({ id }))
177
+ ```
178
+
179
+ ### Step 4: Update Issue Statuses
180
+
181
+ **MUST use CLI command:**
182
+
183
+ ```bash
184
+ # Batch update from queue (recommended)
185
+ ccw issue update --from-queue ${QUEUE_ID}
186
+
187
+ # Or individual update
188
+ ccw issue update <issue-id> --status queued
189
+ ```
190
+
191
+ ### Step 5: Active Queue Check
192
+
193
+ ```bash
194
+ ccw issue queue list --brief
195
+ ```
196
+
197
+ **Decision:**
198
+ - If no active queue: `ccw issue queue switch ${QUEUE_ID}`
199
+ - If active queue exists: Present options to user
200
+
201
+ ```
202
+ Active queue exists. Choose action:
203
+ 1. Merge into existing queue
204
+ 2. Use new queue (keep existing in history)
205
+ 3. Cancel (delete new queue)
206
+
207
+ Select (1-3):
208
+ ```
209
+
210
+ ### Step 6: Output Summary
211
+
212
+ ```markdown
213
+ ## Queue Formed: ${QUEUE_ID}
214
+
215
+ **Solutions**: 5
216
+ **Tasks**: 18
217
+ **Execution Groups**: 3
218
+
219
+ ### Execution Order
220
+ | # | Item | Issue | Tasks | Group | Files |
221
+ |---|------|-------|-------|-------|-------|
222
+ | 1 | S-1 | ISS-001 | 3 | P1 | src/auth.ts |
223
+ | 2 | S-2 | ISS-002 | 2 | P1 | src/api.ts |
224
+ | 3 | S-3 | ISS-003 | 4 | S2 | src/auth.ts |
225
+
226
+ ### Conflicts Resolved
227
+ - src/auth.ts: S-1 → S-3 (sequential, S-1 creates module)
228
+
229
+ **Next Step**: `/issue:execute --queue ${QUEUE_ID}`
230
+ ```
231
+
232
+ ## Subagent Role Reference
233
+
234
+ Queue agent uses role file at: `~/.codex/agents/issue-queue-agent.md`
235
+
236
+ Role capabilities:
237
+ - File conflict detection (5 types)
238
+ - Dependency DAG construction
239
+ - Semantic priority calculation
240
+ - Execution group assignment
241
+
242
+ ## Queue File Schema
243
+
244
+ ```json
245
+ {
246
+ "id": "QUE-20251228-120000",
247
+ "status": "active",
248
+ "issue_ids": ["ISS-001", "ISS-002"],
249
+ "solutions": [
250
+ {
251
+ "item_id": "S-1",
252
+ "issue_id": "ISS-001",
253
+ "solution_id": "SOL-ISS-001-1",
254
+ "status": "pending",
255
+ "execution_order": 1,
256
+ "execution_group": "P1",
257
+ "depends_on": [],
258
+ "semantic_priority": 0.8,
259
+ "files_touched": ["src/auth.ts"],
260
+ "task_count": 3
261
+ }
262
+ ],
263
+ "conflicts": [...],
264
+ "execution_groups": [...]
265
+ }
266
+ ```
267
+
268
+ ## Quality Checklist
269
+
270
+ Before completing, verify:
271
+
272
+ - [ ] Exactly 2 files generated: queue JSON + index update
273
+ - [ ] Queue has valid DAG (no circular dependencies)
274
+ - [ ] All file conflicts resolved with rationale
275
+ - [ ] Semantic priority calculated for each solution (0.0-1.0)
276
+ - [ ] Execution groups assigned (P* for parallel, S* for sequential)
277
+ - [ ] Issue statuses updated to `queued`
278
+ - [ ] All subagents closed after completion
279
+
280
+ ## Error Handling
281
+
282
+ | Situation | Action |
283
+ |-----------|--------|
284
+ | No planned issues | Return empty queue summary |
285
+ | Circular dependency detected | Abort, report cycle details |
286
+ | Missing solution file | Skip issue, log warning |
287
+ | Agent timeout | Retry with increased timeout |
288
+ | Clarification rejected | Abort queue formation |
289
+
290
+ ## Start Execution
291
+
292
+ Begin by listing planned issues:
293
+
294
+ ```bash
295
+ ccw issue list --status planned --json
296
+ ```
297
+
298
+ Then extract solution data and spawn queue agent.