claude-code-workflow 6.3.43 → 6.3.44

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 (77) hide show
  1. package/.claude/agents/tdd-developer.md +530 -0
  2. package/.claude/commands/issue/discover-by-prompt.md +5 -1
  3. package/.claude/commands/issue/discover.md +472 -468
  4. package/.claude/commands/issue/execute.md +580 -581
  5. package/.claude/commands/issue/new.md +417 -413
  6. package/.claude/commands/issue/plan.md +5 -1
  7. package/.claude/commands/issue/queue.md +445 -441
  8. package/.claude/commands/task/breakdown.md +207 -203
  9. package/.claude/commands/task/replan.md +440 -436
  10. package/.claude/commands/workflow/action-plan-verify.md +485 -447
  11. package/.claude/commands/workflow/brainstorm/artifacts.md +457 -453
  12. package/.claude/commands/workflow/brainstorm/auto-parallel.md +5 -1
  13. package/.claude/commands/workflow/brainstorm/synthesis.md +402 -398
  14. package/.claude/commands/workflow/clean.md +67 -35
  15. package/.claude/commands/workflow/debug-with-file.md +670 -666
  16. package/.claude/commands/workflow/debug.md +331 -327
  17. package/.claude/commands/workflow/develop-with-file.md +5 -1
  18. package/.claude/commands/workflow/execute.md +546 -498
  19. package/.claude/commands/workflow/lite-execute.md +44 -26
  20. package/.claude/commands/workflow/lite-fix.md +780 -730
  21. package/.claude/commands/workflow/lite-lite-lite.md +5 -1
  22. package/.claude/commands/workflow/lite-plan.md +87 -39
  23. package/.claude/commands/workflow/multi-cli-plan.md +572 -568
  24. package/.claude/commands/workflow/plan-verify.md +527 -0
  25. package/.claude/commands/workflow/plan.md +555 -551
  26. package/.claude/commands/workflow/replan.md +572 -515
  27. package/.claude/commands/workflow/review-fix.md +608 -610
  28. package/.claude/commands/workflow/session/complete.md +37 -14
  29. package/.claude/commands/workflow/session/solidify.md +303 -299
  30. package/.claude/commands/workflow/tdd-plan.md +630 -597
  31. package/.claude/commands/workflow/tdd-verify.md +391 -206
  32. package/.claude/commands/workflow/tools/conflict-resolution.md +24 -12
  33. package/.claude/commands/workflow/tools/task-generate-agent.md +583 -563
  34. package/.claude/commands/workflow/tools/task-generate-tdd.md +749 -517
  35. package/.claude/commands/workflow/ui-design/animation-extract.md +1154 -1150
  36. package/.claude/commands/workflow/ui-design/layout-extract.md +792 -788
  37. package/.claude/commands/workflow/ui-design/style-extract.md +777 -773
  38. package/.claude/skills/ccw/command.json +4 -4
  39. package/.claude/skills/ccw-coordinator/README.md +45 -0
  40. package/.claude/skills/ccw-coordinator/SKILL.md +320 -0
  41. package/.claude/skills/ccw-coordinator/phases/actions/action-abort.md +9 -0
  42. package/.claude/skills/ccw-coordinator/phases/actions/action-command-build.md +40 -0
  43. package/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md +124 -0
  44. package/.claude/skills/ccw-coordinator/phases/actions/action-command-selection.md +48 -0
  45. package/.claude/skills/ccw-coordinator/phases/actions/action-complete.md +25 -0
  46. package/.claude/skills/ccw-coordinator/phases/actions/action-init.md +26 -0
  47. package/.claude/skills/ccw-coordinator/phases/orchestrator.md +59 -0
  48. package/.claude/skills/ccw-coordinator/phases/state-schema.md +66 -0
  49. package/.claude/skills/ccw-coordinator/skill-config.json +66 -0
  50. package/.claude/skills/ccw-coordinator/specs/command-library.md +169 -0
  51. package/.claude/skills/ccw-coordinator/specs/specs.md +362 -0
  52. package/.claude/skills/ccw-coordinator/tools/README.md +95 -0
  53. package/.claude/skills/ccw-coordinator/tools/chain-validate.cjs +320 -0
  54. package/.claude/skills/ccw-coordinator/tools/command-registry.cjs +255 -0
  55. package/.claude/skills/ccw-help/command.json +5 -5
  56. package/.claude/skills/ccw-help/scripts/analyze_commands.py +337 -337
  57. package/.claude/workflows/cli-templates/prompts/workflow-impl-plan-template.txt +1 -1
  58. package/ccw/dist/commands/issue.d.ts +4 -0
  59. package/ccw/dist/commands/issue.d.ts.map +1 -1
  60. package/ccw/dist/commands/issue.js +73 -6
  61. package/ccw/dist/commands/issue.js.map +1 -1
  62. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  63. package/ccw/dist/core/routes/cli-routes.js +32 -28
  64. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  65. package/ccw/dist/tools/claude-cli-tools.d.ts +10 -0
  66. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  67. package/ccw/dist/tools/claude-cli-tools.js +45 -0
  68. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  69. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  70. package/ccw/dist/tools/codex-lens.js +38 -11
  71. package/ccw/dist/tools/codex-lens.js.map +1 -1
  72. package/ccw/src/commands/issue.ts +84 -6
  73. package/ccw/src/core/routes/cli-routes.ts +30 -25
  74. package/ccw/src/templates/dashboard-js/views/help.js +1 -1
  75. package/ccw/src/tools/claude-cli-tools.ts +50 -0
  76. package/ccw/src/tools/codex-lens.ts +40 -11
  77. package/package.json +1 -1
@@ -1,568 +1,572 @@
1
- ---
2
- name: workflow:multi-cli-plan
3
- description: Multi-CLI collaborative planning workflow with ACE context gathering and iterative cross-verification. Uses cli-discuss-agent for Gemini+Codex+Claude analysis to converge on optimal execution plan.
4
- argument-hint: "<task description> [--max-rounds=3] [--tools=gemini,codex] [--mode=parallel|serial]"
5
- allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Bash(*), Write(*), mcp__ace-tool__search_context(*)
6
- ---
7
-
8
- # Multi-CLI Collaborative Planning Command
9
-
10
- ## Quick Start
11
-
12
- ```bash
13
- # Basic usage
14
- /workflow:multi-cli-plan "Implement user authentication"
15
-
16
- # With options
17
- /workflow:multi-cli-plan "Add dark mode support" --max-rounds=3
18
- /workflow:multi-cli-plan "Refactor payment module" --tools=gemini,codex,claude
19
- /workflow:multi-cli-plan "Fix memory leak" --mode=serial
20
- ```
21
-
22
- **Context Source**: ACE semantic search + Multi-CLI analysis
23
- **Output Directory**: `.workflow/.multi-cli-plan/{session-id}/`
24
- **Default Max Rounds**: 3 (convergence may complete earlier)
25
- **CLI Tools**: @cli-discuss-agent (analysis), @cli-lite-planning-agent (plan generation)
26
- **Execution**: Auto-hands off to `/workflow:lite-execute --in-memory` after plan approval
27
-
28
- ## What & Why
29
-
30
- ### Core Concept
31
-
32
- Multi-CLI collaborative planning with **three-phase architecture**: ACE context gathering → Iterative multi-CLI discussion → Plan generation. Orchestrator delegates analysis to agents, only handles user decisions and session management.
33
-
34
- **Process**:
35
- - **Phase 1**: ACE semantic search gathers codebase context
36
- - **Phase 2**: cli-discuss-agent orchestrates Gemini/Codex/Claude for cross-verified analysis
37
- - **Phase 3-5**: User decision → Plan generation → Execution handoff
38
-
39
- **vs Single-CLI Planning**:
40
- - **Single**: One model perspective, potential blind spots
41
- - **Multi-CLI**: Cross-verification catches inconsistencies, builds consensus on solutions
42
-
43
- ### Value Proposition
44
-
45
- 1. **Multi-Perspective Analysis**: Gemini + Codex + Claude analyze from different angles
46
- 2. **Cross-Verification**: Identify agreements/disagreements, build confidence
47
- 3. **User-Driven Decisions**: Every round ends with user decision point
48
- 4. **Iterative Convergence**: Progressive refinement until consensus reached
49
-
50
- ### Orchestrator Boundary (CRITICAL)
51
-
52
- - **ONLY command** for multi-CLI collaborative planning
53
- - Manages: Session state, user decisions, agent delegation, phase transitions
54
- - Delegates: CLI execution to @cli-discuss-agent, plan generation to @cli-lite-planning-agent
55
-
56
- ### Execution Flow
57
-
58
- ```
59
- Phase 1: Context Gathering
60
- └─ ACE semantic search, extract keywords, build context package
61
-
62
- Phase 2: Multi-CLI Discussion (Iterative, via @cli-discuss-agent)
63
- ├─ Round N: Agent executes Gemini + Codex + Claude
64
- ├─ Cross-verify findings, synthesize solutions
65
- ├─ Write synthesis.json to rounds/{N}/
66
- └─ Loop until convergence or max rounds
67
-
68
- Phase 3: Present Options
69
- └─ Display solutions with trade-offs from agent output
70
-
71
- Phase 4: User Decision
72
- ├─ Select solution approach
73
- ├─ Select execution method (Agent/Codex/Auto)
74
- ├─ Select code review tool (Skip/Gemini/Codex/Agent)
75
- └─ Route:
76
- ├─ Approve Phase 5
77
- ├─ Need More Analysis → Return to Phase 2
78
- └─ Cancel Save session
79
-
80
- Phase 5: Plan Generation & Execution Handoff
81
- ├─ Generate plan.json (via @cli-lite-planning-agent)
82
- ├─ Build executionContext with user selections
83
- └─ Execute to /workflow:lite-execute --in-memory
84
- ```
85
-
86
- ### Agent Roles
87
-
88
- | Agent | Responsibility |
89
- |-------|---------------|
90
- | **Orchestrator** | Session management, ACE context, user decisions, phase transitions, executionContext assembly |
91
- | **@cli-discuss-agent** | Multi-CLI execution (Gemini/Codex/Claude), cross-verification, solution synthesis, synthesis.json output |
92
- | **@cli-lite-planning-agent** | Task decomposition, plan.json generation following schema |
93
-
94
- ## Core Responsibilities
95
-
96
- ### Phase 1: Context Gathering
97
-
98
- **Session Initialization**:
99
- ```javascript
100
- const sessionId = `MCP-${taskSlug}-${date}`
101
- const sessionFolder = `.workflow/.multi-cli-plan/${sessionId}`
102
- Bash(`mkdir -p ${sessionFolder}/rounds`)
103
- ```
104
-
105
- **ACE Context Queries**:
106
- ```javascript
107
- const aceQueries = [
108
- `Project architecture related to ${keywords}`,
109
- `Existing implementations of ${keywords[0]}`,
110
- `Code patterns for ${keywords} features`,
111
- `Integration points for ${keywords[0]}`
112
- ]
113
- // Execute via mcp__ace-tool__search_context
114
- ```
115
-
116
- **Context Package** (passed to agent):
117
- - `relevant_files[]` - Files identified by ACE
118
- - `detected_patterns[]` - Code patterns found
119
- - `architecture_insights` - Structure understanding
120
-
121
- ### Phase 2: Agent Delegation
122
-
123
- **Core Principle**: Orchestrator only delegates and reads output - NO direct CLI execution.
124
-
125
- **Agent Invocation**:
126
- ```javascript
127
- Task({
128
- subagent_type: "cli-discuss-agent",
129
- run_in_background: false,
130
- description: `Discussion round ${currentRound}`,
131
- prompt: `
132
- ## Input Context
133
- - task_description: ${taskDescription}
134
- - round_number: ${currentRound}
135
- - session: { id: "${sessionId}", folder: "${sessionFolder}" }
136
- - ace_context: ${JSON.stringify(contextPackageage)}
137
- - previous_rounds: ${JSON.stringify(analysisResults)}
138
- - user_feedback: ${userFeedback || 'None'}
139
- - cli_config: { tools: ["gemini", "codex"], mode: "parallel", fallback_chain: ["gemini", "codex", "claude"] }
140
-
141
- ## Execution Process
142
- 1. Parse input context (handle JSON strings)
143
- 2. Check if ACE supplementary search needed
144
- 3. Build CLI prompts with context
145
- 4. Execute CLIs (parallel or serial per cli_config.mode)
146
- 5. Parse CLI outputs, handle failures with fallback
147
- 6. Perform cross-verification between CLI results
148
- 7. Synthesize solutions, calculate scores
149
- 8. Calculate convergence, generate clarification questions
150
- 9. Write synthesis.json
151
-
152
- ## Output
153
- Write: ${sessionFolder}/rounds/${currentRound}/synthesis.json
154
-
155
- ## Completion Checklist
156
- - [ ] All configured CLI tools executed (or fallback triggered)
157
- - [ ] Cross-verification completed with agreements/disagreements
158
- - [ ] 2-3 solutions generated with file:line references
159
- - [ ] Convergence score calculated (0.0-1.0)
160
- - [ ] synthesis.json written with all Primary Fields
161
- `
162
- })
163
- ```
164
-
165
- **Read Agent Output**:
166
- ```javascript
167
- const synthesis = JSON.parse(Read(`${sessionFolder}/rounds/${round}/synthesis.json`))
168
- // Access top-level fields: solutions, convergence, cross_verification, clarification_questions
169
- ```
170
-
171
- **Convergence Decision**:
172
- ```javascript
173
- if (synthesis.convergence.recommendation === 'converged') {
174
- // Proceed to Phase 3
175
- } else if (synthesis.convergence.recommendation === 'user_input_needed') {
176
- // Collect user feedback, return to Phase 2
177
- } else {
178
- // Continue to next round if new_insights && round < maxRounds
179
- }
180
- ```
181
-
182
- ### Phase 3: Present Options
183
-
184
- **Display from Agent Output** (no processing):
185
- ```javascript
186
- console.log(`
187
- ## Solution Options
188
-
189
- ${synthesis.solutions.map((s, i) => `
190
- **Option ${i+1}: ${s.name}**
191
- Source: ${s.source_cli.join(' + ')}
192
- Effort: ${s.effort} | Risk: ${s.risk}
193
-
194
- Pros: ${s.pros.join(', ')}
195
- Cons: ${s.cons.join(', ')}
196
-
197
- Files: ${s.affected_files.slice(0,3).map(f => `${f.file}:${f.line}`).join(', ')}
198
- `).join('\n')}
199
-
200
- ## Cross-Verification
201
- Agreements: ${synthesis.cross_verification.agreements.length}
202
- Disagreements: ${synthesis.cross_verification.disagreements.length}
203
- `)
204
- ```
205
-
206
- ### Phase 4: User Decision
207
-
208
- **Decision Options**:
209
- ```javascript
210
- AskUserQuestion({
211
- questions: [
212
- {
213
- question: "Which solution approach?",
214
- header: "Solution",
215
- multiSelect: false,
216
- options: solutions.map((s, i) => ({
217
- label: `Option ${i+1}: ${s.name}`,
218
- description: `${s.effort} effort, ${s.risk} risk`
219
- })).concat([
220
- { label: "Need More Analysis", description: "Return to Phase 2" }
221
- ])
222
- },
223
- {
224
- question: "Execution method:",
225
- header: "Execution",
226
- multiSelect: false,
227
- options: [
228
- { label: "Agent", description: "@code-developer agent" },
229
- { label: "Codex", description: "codex CLI tool" },
230
- { label: "Auto", description: "Auto-select based on complexity" }
231
- ]
232
- },
233
- {
234
- question: "Code review after execution?",
235
- header: "Review",
236
- multiSelect: false,
237
- options: [
238
- { label: "Skip", description: "No review" },
239
- { label: "Gemini Review", description: "Gemini CLI tool" },
240
- { label: "Codex Review", description: "codex review --uncommitted" },
241
- { label: "Agent Review", description: "Current agent review" }
242
- ]
243
- }
244
- ]
245
- })
246
- ```
247
-
248
- **Routing**:
249
- - Approve + execution method → Phase 5
250
- - Need More Analysis → Phase 2 with feedback
251
- - Cancel → Save session for resumption
252
-
253
- ### Phase 5: Plan Generation & Execution Handoff
254
-
255
- **Step 1: Build Context-Package** (Orchestrator responsibility):
256
- ```javascript
257
- // Extract key information from user decision and synthesis
258
- const contextPackage = {
259
- // Core solution details
260
- solution: {
261
- name: selectedSolution.name,
262
- source_cli: selectedSolution.source_cli,
263
- feasibility: selectedSolution.feasibility,
264
- effort: selectedSolution.effort,
265
- risk: selectedSolution.risk,
266
- summary: selectedSolution.summary
267
- },
268
- // Implementation plan (tasks, flow, milestones)
269
- implementation_plan: selectedSolution.implementation_plan,
270
- // Dependencies
271
- dependencies: selectedSolution.dependencies || { internal: [], external: [] },
272
- // Technical concerns
273
- technical_concerns: selectedSolution.technical_concerns || [],
274
- // Consensus from cross-verification
275
- consensus: {
276
- agreements: synthesis.cross_verification.agreements,
277
- resolved_conflicts: synthesis.cross_verification.resolution
278
- },
279
- // User constraints (from Phase 4 feedback)
280
- constraints: userConstraints || [],
281
- // Task context
282
- task_description: taskDescription,
283
- session_id: sessionId
284
- }
285
-
286
- // Write context-package for traceability
287
- Write(`${sessionFolder}/context-package.json`, JSON.stringify(contextPackage, null, 2))
288
- ```
289
-
290
- **Context-Package Schema**:
291
-
292
- | Field | Type | Description |
293
- |-------|------|-------------|
294
- | `solution` | object | User-selected solution from synthesis |
295
- | `solution.name` | string | Solution identifier |
296
- | `solution.feasibility` | number | Viability score (0-1) |
297
- | `solution.summary` | string | Brief analysis summary |
298
- | `implementation_plan` | object | Task breakdown with flow and dependencies |
299
- | `implementation_plan.approach` | string | High-level technical strategy |
300
- | `implementation_plan.tasks[]` | array | Discrete tasks with id, name, depends_on, files |
301
- | `implementation_plan.execution_flow` | string | Task sequence (e.g., "T1 → T2 → T3") |
302
- | `implementation_plan.milestones` | string[] | Key checkpoints |
303
- | `dependencies` | object | Module and package dependencies |
304
- | `technical_concerns` | string[] | Risks and blockers |
305
- | `consensus` | object | Cross-verified agreements from multi-CLI |
306
- | `constraints` | string[] | User-specified constraints from Phase 4 |
307
-
308
- ```json
309
- {
310
- "solution": {
311
- "name": "Strategy Pattern Refactoring",
312
- "source_cli": ["gemini", "codex"],
313
- "feasibility": 0.88,
314
- "effort": "medium",
315
- "risk": "low",
316
- "summary": "Extract payment gateway interface, implement strategy pattern for multi-gateway support"
317
- },
318
- "implementation_plan": {
319
- "approach": "Define interface → Create concrete strategies → Implement factory → Migrate existing code",
320
- "tasks": [
321
- {"id": "T1", "name": "Define PaymentGateway interface", "depends_on": [], "files": [{"file": "src/types/payment.ts", "line": 1, "action": "create"}], "key_point": "Include all existing Stripe methods"},
322
- {"id": "T2", "name": "Implement StripeGateway", "depends_on": ["T1"], "files": [{"file": "src/payment/stripe.ts", "line": 1, "action": "create"}], "key_point": "Wrap existing logic"},
323
- {"id": "T3", "name": "Create GatewayFactory", "depends_on": ["T1"], "files": [{"file": "src/payment/factory.ts", "line": 1, "action": "create"}], "key_point": null},
324
- {"id": "T4", "name": "Migrate processor to use factory", "depends_on": ["T2", "T3"], "files": [{"file": "src/payment/processor.ts", "line": 45, "action": "modify"}], "key_point": "Backward compatible"}
325
- ],
326
- "execution_flow": "T1 (T2 | T3) T4",
327
- "milestones": ["Interface defined", "Gateway implementations complete", "Migration done"]
328
- },
329
- "dependencies": {
330
- "internal": ["@/lib/payment-gateway", "@/types/payment"],
331
- "external": ["stripe@^14.0.0"]
332
- },
333
- "technical_concerns": ["Existing tests must pass", "No breaking API changes"],
334
- "consensus": {
335
- "agreements": ["Use strategy pattern", "Keep existing API"],
336
- "resolved_conflicts": "Factory over DI for simpler integration"
337
- },
338
- "constraints": ["backward compatible", "no breaking changes to PaymentResult type"],
339
- "task_description": "Refactor payment processing for multi-gateway support",
340
- "session_id": "MCP-payment-refactor-2026-01-14"
341
- }
342
- ```
343
-
344
- **Step 2: Invoke Planning Agent**:
345
- ```javascript
346
- Task({
347
- subagent_type: "cli-lite-planning-agent",
348
- run_in_background: false,
349
- description: "Generate implementation plan",
350
- prompt: `
351
- ## Schema Reference
352
- Execute: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json
353
-
354
- ## Context-Package (from orchestrator)
355
- ${JSON.stringify(contextPackage, null, 2)}
356
-
357
- ## Execution Process
358
- 1. Read plan-json-schema.json for output structure
359
- 2. Read project-tech.json and project-guidelines.json
360
- 3. Parse context-package fields:
361
- - solution: name, feasibility, summary
362
- - implementation_plan: tasks[], execution_flow, milestones
363
- - dependencies: internal[], external[]
364
- - technical_concerns: risks/blockers
365
- - consensus: agreements, resolved_conflicts
366
- - constraints: user requirements
367
- 4. Use implementation_plan.tasks[] as task foundation
368
- 5. Preserve task dependencies (depends_on) and execution_flow
369
- 6. Expand tasks with detailed acceptance criteria
370
- 7. Generate plan.json following schema exactly
371
-
372
- ## Output
373
- - ${sessionFolder}/plan.json
374
-
375
- ## Completion Checklist
376
- - [ ] plan.json preserves task dependencies from implementation_plan
377
- - [ ] Task execution order follows execution_flow
378
- - [ ] Key_points reflected in task descriptions
379
- - [ ] User constraints applied to implementation
380
- - [ ] Acceptance criteria are testable
381
- - [ ] Schema fields match plan-json-schema.json exactly
382
- `
383
- })
384
- ```
385
-
386
- **Step 3: Build executionContext**:
387
- ```javascript
388
- // After plan.json is generated by cli-lite-planning-agent
389
- const plan = JSON.parse(Read(`${sessionFolder}/plan.json`))
390
-
391
- // Build executionContext (same structure as lite-plan)
392
- executionContext = {
393
- planObject: plan,
394
- explorationsContext: null, // Multi-CLI doesn't use exploration files
395
- explorationAngles: [], // No exploration angles
396
- explorationManifest: null, // No manifest
397
- clarificationContext: null, // Store user feedback from Phase 2 if exists
398
- executionMethod: userSelection.execution_method, // From Phase 4
399
- codeReviewTool: userSelection.code_review_tool, // From Phase 4
400
- originalUserInput: taskDescription,
401
-
402
- // Optional: Task-level executor assignments
403
- executorAssignments: null, // Could be enhanced in future
404
-
405
- session: {
406
- id: sessionId,
407
- folder: sessionFolder,
408
- artifacts: {
409
- explorations: [], // No explorations in multi-CLI workflow
410
- explorations_manifest: null,
411
- plan: `${sessionFolder}/plan.json`,
412
- synthesis_rounds: Array.from({length: currentRound}, (_, i) =>
413
- `${sessionFolder}/rounds/${i+1}/synthesis.json`
414
- ),
415
- context_package: `${sessionFolder}/context-package.json`
416
- }
417
- }
418
- }
419
- ```
420
-
421
- **Step 4: Hand off to Execution**:
422
- ```javascript
423
- // Execute to lite-execute with in-memory context
424
- SlashCommand("/workflow:lite-execute --in-memory")
425
- ```
426
-
427
- ## Output File Structure
428
-
429
- ```
430
- .workflow/.multi-cli-plan/{MCP-task-slug-YYYY-MM-DD}/
431
- ├── session-state.json # Session tracking (orchestrator)
432
- ├── rounds/
433
- │ ├── 1/synthesis.json # Round 1 analysis (cli-discuss-agent)
434
- │ ├── 2/synthesis.json # Round 2 analysis (cli-discuss-agent)
435
- │ └── .../
436
- ├── context-package.json # Extracted context for planning (orchestrator)
437
- └── plan.json # Structured plan (cli-lite-planning-agent)
438
- ```
439
-
440
- **File Producers**:
441
-
442
- | File | Producer | Content |
443
- |------|----------|---------|
444
- | `session-state.json` | Orchestrator | Session metadata, rounds, decisions |
445
- | `rounds/*/synthesis.json` | cli-discuss-agent | Solutions, convergence, cross-verification |
446
- | `context-package.json` | Orchestrator | Extracted solution, dependencies, consensus for planning |
447
- | `plan.json` | cli-lite-planning-agent | Structured tasks for lite-execute |
448
-
449
- ## synthesis.json Schema
450
-
451
- ```json
452
- {
453
- "round": 1,
454
- "solutions": [{
455
- "name": "Solution Name",
456
- "source_cli": ["gemini", "codex"],
457
- "feasibility": 0.85,
458
- "effort": "low|medium|high",
459
- "risk": "low|medium|high",
460
- "summary": "Brief analysis summary",
461
- "implementation_plan": {
462
- "approach": "High-level technical approach",
463
- "tasks": [
464
- {"id": "T1", "name": "Task", "depends_on": [], "files": [], "key_point": "..."}
465
- ],
466
- "execution_flow": "T1 T2 → T3",
467
- "milestones": ["Checkpoint 1", "Checkpoint 2"]
468
- },
469
- "dependencies": {"internal": [], "external": []},
470
- "technical_concerns": ["Risk 1", "Blocker 2"]
471
- }],
472
- "convergence": {
473
- "score": 0.85,
474
- "new_insights": false,
475
- "recommendation": "converged|continue|user_input_needed"
476
- },
477
- "cross_verification": {
478
- "agreements": [],
479
- "disagreements": [],
480
- "resolution": "..."
481
- },
482
- "clarification_questions": []
483
- }
484
- ```
485
-
486
- **Key Planning Fields**:
487
-
488
- | Field | Purpose |
489
- |-------|---------|
490
- | `feasibility` | Viability score (0-1) |
491
- | `implementation_plan.tasks[]` | Discrete tasks with dependencies |
492
- | `implementation_plan.execution_flow` | Task sequence visualization |
493
- | `implementation_plan.milestones` | Key checkpoints |
494
- | `technical_concerns` | Risks and blockers |
495
-
496
- **Note**: Solutions ranked by internal scoring (array order = priority)
497
-
498
- ## TodoWrite Structure
499
-
500
- **Initialization**:
501
- ```javascript
502
- TodoWrite({ todos: [
503
- { content: "Phase 1: Context Gathering", status: "in_progress", activeForm: "Gathering context" },
504
- { content: "Phase 2: Multi-CLI Discussion", status: "pending", activeForm: "Running discussion" },
505
- { content: "Phase 3: Present Options", status: "pending", activeForm: "Presenting options" },
506
- { content: "Phase 4: User Decision", status: "pending", activeForm: "Awaiting decision" },
507
- { content: "Phase 5: Plan Generation", status: "pending", activeForm: "Generating plan" }
508
- ]})
509
- ```
510
-
511
- **During Discussion Rounds**:
512
- ```javascript
513
- TodoWrite({ todos: [
514
- { content: "Phase 1: Context Gathering", status: "completed", activeForm: "Gathering context" },
515
- { content: "Phase 2: Multi-CLI Discussion", status: "in_progress", activeForm: "Running discussion" },
516
- { content: " → Round 1: Initial analysis", status: "completed", activeForm: "Analyzing" },
517
- { content: " → Round 2: Deep verification", status: "in_progress", activeForm: "Verifying" },
518
- { content: "Phase 3: Present Options", status: "pending", activeForm: "Presenting options" },
519
- // ...
520
- ]})
521
- ```
522
-
523
- ## Error Handling
524
-
525
- | Error | Resolution |
526
- |-------|------------|
527
- | ACE search fails | Fall back to Glob/Grep for file discovery |
528
- | Agent fails | Retry once, then present partial results |
529
- | CLI timeout (in agent) | Agent uses fallback: gemini → codex → claude |
530
- | No convergence | Present best options, flag uncertainty |
531
- | synthesis.json parse error | Request agent retry |
532
- | User cancels | Save session for later resumption |
533
-
534
- ## Configuration
535
-
536
- | Flag | Default | Description |
537
- |------|---------|-------------|
538
- | `--max-rounds` | 3 | Maximum discussion rounds |
539
- | `--tools` | gemini,codex | CLI tools for analysis |
540
- | `--mode` | parallel | Execution mode: parallel or serial |
541
- | `--auto-execute` | false | Auto-execute after approval |
542
-
543
- ## Best Practices
544
-
545
- 1. **Be Specific**: Detailed task descriptions improve ACE context quality
546
- 2. **Provide Feedback**: Use clarification rounds to refine requirements
547
- 3. **Trust Cross-Verification**: Multi-CLI consensus indicates high confidence
548
- 4. **Review Trade-offs**: Consider pros/cons before selecting solution
549
- 5. **Check synthesis.json**: Review agent output for detailed analysis
550
- 6. **Iterate When Needed**: Don't hesitate to request more analysis
551
-
552
- ## Related Commands
553
-
554
- ```bash
555
- # Simpler single-round planning
556
- /workflow:lite-plan "task description"
557
-
558
- # Issue-driven discovery
559
- /issue:discover-by-prompt "find issues"
560
-
561
- # View session files
562
- cat .workflow/.multi-cli-plan/{session-id}/plan.json
563
- cat .workflow/.multi-cli-plan/{session-id}/rounds/1/synthesis.json
564
- cat .workflow/.multi-cli-plan/{session-id}/context-package.json
565
-
566
- # Direct execution (if you have plan.json)
567
- /workflow:lite-execute plan.json
568
- ```
1
+ ---
2
+ name: workflow:multi-cli-plan
3
+ description: Multi-CLI collaborative planning workflow with ACE context gathering and iterative cross-verification. Uses cli-discuss-agent for Gemini+Codex+Claude analysis to converge on optimal execution plan.
4
+ argument-hint: "[-y|--yes] <task description> [--max-rounds=3] [--tools=gemini,codex] [--mode=parallel|serial]"
5
+ allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Bash(*), Write(*), mcp__ace-tool__search_context(*)
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-approve plan, use recommended solution and execution method (Agent, Skip review).
11
+
12
+ # Multi-CLI Collaborative Planning Command
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ # Basic usage
18
+ /workflow:multi-cli-plan "Implement user authentication"
19
+
20
+ # With options
21
+ /workflow:multi-cli-plan "Add dark mode support" --max-rounds=3
22
+ /workflow:multi-cli-plan "Refactor payment module" --tools=gemini,codex,claude
23
+ /workflow:multi-cli-plan "Fix memory leak" --mode=serial
24
+ ```
25
+
26
+ **Context Source**: ACE semantic search + Multi-CLI analysis
27
+ **Output Directory**: `.workflow/.multi-cli-plan/{session-id}/`
28
+ **Default Max Rounds**: 3 (convergence may complete earlier)
29
+ **CLI Tools**: @cli-discuss-agent (analysis), @cli-lite-planning-agent (plan generation)
30
+ **Execution**: Auto-hands off to `/workflow:lite-execute --in-memory` after plan approval
31
+
32
+ ## What & Why
33
+
34
+ ### Core Concept
35
+
36
+ Multi-CLI collaborative planning with **three-phase architecture**: ACE context gathering Iterative multi-CLI discussion → Plan generation. Orchestrator delegates analysis to agents, only handles user decisions and session management.
37
+
38
+ **Process**:
39
+ - **Phase 1**: ACE semantic search gathers codebase context
40
+ - **Phase 2**: cli-discuss-agent orchestrates Gemini/Codex/Claude for cross-verified analysis
41
+ - **Phase 3-5**: User decision Plan generation Execution handoff
42
+
43
+ **vs Single-CLI Planning**:
44
+ - **Single**: One model perspective, potential blind spots
45
+ - **Multi-CLI**: Cross-verification catches inconsistencies, builds consensus on solutions
46
+
47
+ ### Value Proposition
48
+
49
+ 1. **Multi-Perspective Analysis**: Gemini + Codex + Claude analyze from different angles
50
+ 2. **Cross-Verification**: Identify agreements/disagreements, build confidence
51
+ 3. **User-Driven Decisions**: Every round ends with user decision point
52
+ 4. **Iterative Convergence**: Progressive refinement until consensus reached
53
+
54
+ ### Orchestrator Boundary (CRITICAL)
55
+
56
+ - **ONLY command** for multi-CLI collaborative planning
57
+ - Manages: Session state, user decisions, agent delegation, phase transitions
58
+ - Delegates: CLI execution to @cli-discuss-agent, plan generation to @cli-lite-planning-agent
59
+
60
+ ### Execution Flow
61
+
62
+ ```
63
+ Phase 1: Context Gathering
64
+ └─ ACE semantic search, extract keywords, build context package
65
+
66
+ Phase 2: Multi-CLI Discussion (Iterative, via @cli-discuss-agent)
67
+ ├─ Round N: Agent executes Gemini + Codex + Claude
68
+ ├─ Cross-verify findings, synthesize solutions
69
+ ├─ Write synthesis.json to rounds/{N}/
70
+ └─ Loop until convergence or max rounds
71
+
72
+ Phase 3: Present Options
73
+ └─ Display solutions with trade-offs from agent output
74
+
75
+ Phase 4: User Decision
76
+ ├─ Select solution approach
77
+ ├─ Select execution method (Agent/Codex/Auto)
78
+ ├─ Select code review tool (Skip/Gemini/Codex/Agent)
79
+ └─ Route:
80
+ ├─ Approve Phase 5
81
+ ├─ Need More Analysis → Return to Phase 2
82
+ └─ Cancel Save session
83
+
84
+ Phase 5: Plan Generation & Execution Handoff
85
+ ├─ Generate plan.json (via @cli-lite-planning-agent)
86
+ ├─ Build executionContext with user selections
87
+ └─ Execute to /workflow:lite-execute --in-memory
88
+ ```
89
+
90
+ ### Agent Roles
91
+
92
+ | Agent | Responsibility |
93
+ |-------|---------------|
94
+ | **Orchestrator** | Session management, ACE context, user decisions, phase transitions, executionContext assembly |
95
+ | **@cli-discuss-agent** | Multi-CLI execution (Gemini/Codex/Claude), cross-verification, solution synthesis, synthesis.json output |
96
+ | **@cli-lite-planning-agent** | Task decomposition, plan.json generation following schema |
97
+
98
+ ## Core Responsibilities
99
+
100
+ ### Phase 1: Context Gathering
101
+
102
+ **Session Initialization**:
103
+ ```javascript
104
+ const sessionId = `MCP-${taskSlug}-${date}`
105
+ const sessionFolder = `.workflow/.multi-cli-plan/${sessionId}`
106
+ Bash(`mkdir -p ${sessionFolder}/rounds`)
107
+ ```
108
+
109
+ **ACE Context Queries**:
110
+ ```javascript
111
+ const aceQueries = [
112
+ `Project architecture related to ${keywords}`,
113
+ `Existing implementations of ${keywords[0]}`,
114
+ `Code patterns for ${keywords} features`,
115
+ `Integration points for ${keywords[0]}`
116
+ ]
117
+ // Execute via mcp__ace-tool__search_context
118
+ ```
119
+
120
+ **Context Package** (passed to agent):
121
+ - `relevant_files[]` - Files identified by ACE
122
+ - `detected_patterns[]` - Code patterns found
123
+ - `architecture_insights` - Structure understanding
124
+
125
+ ### Phase 2: Agent Delegation
126
+
127
+ **Core Principle**: Orchestrator only delegates and reads output - NO direct CLI execution.
128
+
129
+ **Agent Invocation**:
130
+ ```javascript
131
+ Task({
132
+ subagent_type: "cli-discuss-agent",
133
+ run_in_background: false,
134
+ description: `Discussion round ${currentRound}`,
135
+ prompt: `
136
+ ## Input Context
137
+ - task_description: ${taskDescription}
138
+ - round_number: ${currentRound}
139
+ - session: { id: "${sessionId}", folder: "${sessionFolder}" }
140
+ - ace_context: ${JSON.stringify(contextPackageage)}
141
+ - previous_rounds: ${JSON.stringify(analysisResults)}
142
+ - user_feedback: ${userFeedback || 'None'}
143
+ - cli_config: { tools: ["gemini", "codex"], mode: "parallel", fallback_chain: ["gemini", "codex", "claude"] }
144
+
145
+ ## Execution Process
146
+ 1. Parse input context (handle JSON strings)
147
+ 2. Check if ACE supplementary search needed
148
+ 3. Build CLI prompts with context
149
+ 4. Execute CLIs (parallel or serial per cli_config.mode)
150
+ 5. Parse CLI outputs, handle failures with fallback
151
+ 6. Perform cross-verification between CLI results
152
+ 7. Synthesize solutions, calculate scores
153
+ 8. Calculate convergence, generate clarification questions
154
+ 9. Write synthesis.json
155
+
156
+ ## Output
157
+ Write: ${sessionFolder}/rounds/${currentRound}/synthesis.json
158
+
159
+ ## Completion Checklist
160
+ - [ ] All configured CLI tools executed (or fallback triggered)
161
+ - [ ] Cross-verification completed with agreements/disagreements
162
+ - [ ] 2-3 solutions generated with file:line references
163
+ - [ ] Convergence score calculated (0.0-1.0)
164
+ - [ ] synthesis.json written with all Primary Fields
165
+ `
166
+ })
167
+ ```
168
+
169
+ **Read Agent Output**:
170
+ ```javascript
171
+ const synthesis = JSON.parse(Read(`${sessionFolder}/rounds/${round}/synthesis.json`))
172
+ // Access top-level fields: solutions, convergence, cross_verification, clarification_questions
173
+ ```
174
+
175
+ **Convergence Decision**:
176
+ ```javascript
177
+ if (synthesis.convergence.recommendation === 'converged') {
178
+ // Proceed to Phase 3
179
+ } else if (synthesis.convergence.recommendation === 'user_input_needed') {
180
+ // Collect user feedback, return to Phase 2
181
+ } else {
182
+ // Continue to next round if new_insights && round < maxRounds
183
+ }
184
+ ```
185
+
186
+ ### Phase 3: Present Options
187
+
188
+ **Display from Agent Output** (no processing):
189
+ ```javascript
190
+ console.log(`
191
+ ## Solution Options
192
+
193
+ ${synthesis.solutions.map((s, i) => `
194
+ **Option ${i+1}: ${s.name}**
195
+ Source: ${s.source_cli.join(' + ')}
196
+ Effort: ${s.effort} | Risk: ${s.risk}
197
+
198
+ Pros: ${s.pros.join(', ')}
199
+ Cons: ${s.cons.join(', ')}
200
+
201
+ Files: ${s.affected_files.slice(0,3).map(f => `${f.file}:${f.line}`).join(', ')}
202
+ `).join('\n')}
203
+
204
+ ## Cross-Verification
205
+ Agreements: ${synthesis.cross_verification.agreements.length}
206
+ Disagreements: ${synthesis.cross_verification.disagreements.length}
207
+ `)
208
+ ```
209
+
210
+ ### Phase 4: User Decision
211
+
212
+ **Decision Options**:
213
+ ```javascript
214
+ AskUserQuestion({
215
+ questions: [
216
+ {
217
+ question: "Which solution approach?",
218
+ header: "Solution",
219
+ multiSelect: false,
220
+ options: solutions.map((s, i) => ({
221
+ label: `Option ${i+1}: ${s.name}`,
222
+ description: `${s.effort} effort, ${s.risk} risk`
223
+ })).concat([
224
+ { label: "Need More Analysis", description: "Return to Phase 2" }
225
+ ])
226
+ },
227
+ {
228
+ question: "Execution method:",
229
+ header: "Execution",
230
+ multiSelect: false,
231
+ options: [
232
+ { label: "Agent", description: "@code-developer agent" },
233
+ { label: "Codex", description: "codex CLI tool" },
234
+ { label: "Auto", description: "Auto-select based on complexity" }
235
+ ]
236
+ },
237
+ {
238
+ question: "Code review after execution?",
239
+ header: "Review",
240
+ multiSelect: false,
241
+ options: [
242
+ { label: "Skip", description: "No review" },
243
+ { label: "Gemini Review", description: "Gemini CLI tool" },
244
+ { label: "Codex Review", description: "codex review --uncommitted" },
245
+ { label: "Agent Review", description: "Current agent review" }
246
+ ]
247
+ }
248
+ ]
249
+ })
250
+ ```
251
+
252
+ **Routing**:
253
+ - Approve + execution method Phase 5
254
+ - Need More Analysis → Phase 2 with feedback
255
+ - Cancel Save session for resumption
256
+
257
+ ### Phase 5: Plan Generation & Execution Handoff
258
+
259
+ **Step 1: Build Context-Package** (Orchestrator responsibility):
260
+ ```javascript
261
+ // Extract key information from user decision and synthesis
262
+ const contextPackage = {
263
+ // Core solution details
264
+ solution: {
265
+ name: selectedSolution.name,
266
+ source_cli: selectedSolution.source_cli,
267
+ feasibility: selectedSolution.feasibility,
268
+ effort: selectedSolution.effort,
269
+ risk: selectedSolution.risk,
270
+ summary: selectedSolution.summary
271
+ },
272
+ // Implementation plan (tasks, flow, milestones)
273
+ implementation_plan: selectedSolution.implementation_plan,
274
+ // Dependencies
275
+ dependencies: selectedSolution.dependencies || { internal: [], external: [] },
276
+ // Technical concerns
277
+ technical_concerns: selectedSolution.technical_concerns || [],
278
+ // Consensus from cross-verification
279
+ consensus: {
280
+ agreements: synthesis.cross_verification.agreements,
281
+ resolved_conflicts: synthesis.cross_verification.resolution
282
+ },
283
+ // User constraints (from Phase 4 feedback)
284
+ constraints: userConstraints || [],
285
+ // Task context
286
+ task_description: taskDescription,
287
+ session_id: sessionId
288
+ }
289
+
290
+ // Write context-package for traceability
291
+ Write(`${sessionFolder}/context-package.json`, JSON.stringify(contextPackage, null, 2))
292
+ ```
293
+
294
+ **Context-Package Schema**:
295
+
296
+ | Field | Type | Description |
297
+ |-------|------|-------------|
298
+ | `solution` | object | User-selected solution from synthesis |
299
+ | `solution.name` | string | Solution identifier |
300
+ | `solution.feasibility` | number | Viability score (0-1) |
301
+ | `solution.summary` | string | Brief analysis summary |
302
+ | `implementation_plan` | object | Task breakdown with flow and dependencies |
303
+ | `implementation_plan.approach` | string | High-level technical strategy |
304
+ | `implementation_plan.tasks[]` | array | Discrete tasks with id, name, depends_on, files |
305
+ | `implementation_plan.execution_flow` | string | Task sequence (e.g., "T1 → T2 → T3") |
306
+ | `implementation_plan.milestones` | string[] | Key checkpoints |
307
+ | `dependencies` | object | Module and package dependencies |
308
+ | `technical_concerns` | string[] | Risks and blockers |
309
+ | `consensus` | object | Cross-verified agreements from multi-CLI |
310
+ | `constraints` | string[] | User-specified constraints from Phase 4 |
311
+
312
+ ```json
313
+ {
314
+ "solution": {
315
+ "name": "Strategy Pattern Refactoring",
316
+ "source_cli": ["gemini", "codex"],
317
+ "feasibility": 0.88,
318
+ "effort": "medium",
319
+ "risk": "low",
320
+ "summary": "Extract payment gateway interface, implement strategy pattern for multi-gateway support"
321
+ },
322
+ "implementation_plan": {
323
+ "approach": "Define interface Create concrete strategies Implement factory Migrate existing code",
324
+ "tasks": [
325
+ {"id": "T1", "name": "Define PaymentGateway interface", "depends_on": [], "files": [{"file": "src/types/payment.ts", "line": 1, "action": "create"}], "key_point": "Include all existing Stripe methods"},
326
+ {"id": "T2", "name": "Implement StripeGateway", "depends_on": ["T1"], "files": [{"file": "src/payment/stripe.ts", "line": 1, "action": "create"}], "key_point": "Wrap existing logic"},
327
+ {"id": "T3", "name": "Create GatewayFactory", "depends_on": ["T1"], "files": [{"file": "src/payment/factory.ts", "line": 1, "action": "create"}], "key_point": null},
328
+ {"id": "T4", "name": "Migrate processor to use factory", "depends_on": ["T2", "T3"], "files": [{"file": "src/payment/processor.ts", "line": 45, "action": "modify"}], "key_point": "Backward compatible"}
329
+ ],
330
+ "execution_flow": "T1 → (T2 | T3) → T4",
331
+ "milestones": ["Interface defined", "Gateway implementations complete", "Migration done"]
332
+ },
333
+ "dependencies": {
334
+ "internal": ["@/lib/payment-gateway", "@/types/payment"],
335
+ "external": ["stripe@^14.0.0"]
336
+ },
337
+ "technical_concerns": ["Existing tests must pass", "No breaking API changes"],
338
+ "consensus": {
339
+ "agreements": ["Use strategy pattern", "Keep existing API"],
340
+ "resolved_conflicts": "Factory over DI for simpler integration"
341
+ },
342
+ "constraints": ["backward compatible", "no breaking changes to PaymentResult type"],
343
+ "task_description": "Refactor payment processing for multi-gateway support",
344
+ "session_id": "MCP-payment-refactor-2026-01-14"
345
+ }
346
+ ```
347
+
348
+ **Step 2: Invoke Planning Agent**:
349
+ ```javascript
350
+ Task({
351
+ subagent_type: "cli-lite-planning-agent",
352
+ run_in_background: false,
353
+ description: "Generate implementation plan",
354
+ prompt: `
355
+ ## Schema Reference
356
+ Execute: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json
357
+
358
+ ## Context-Package (from orchestrator)
359
+ ${JSON.stringify(contextPackage, null, 2)}
360
+
361
+ ## Execution Process
362
+ 1. Read plan-json-schema.json for output structure
363
+ 2. Read project-tech.json and project-guidelines.json
364
+ 3. Parse context-package fields:
365
+ - solution: name, feasibility, summary
366
+ - implementation_plan: tasks[], execution_flow, milestones
367
+ - dependencies: internal[], external[]
368
+ - technical_concerns: risks/blockers
369
+ - consensus: agreements, resolved_conflicts
370
+ - constraints: user requirements
371
+ 4. Use implementation_plan.tasks[] as task foundation
372
+ 5. Preserve task dependencies (depends_on) and execution_flow
373
+ 6. Expand tasks with detailed acceptance criteria
374
+ 7. Generate plan.json following schema exactly
375
+
376
+ ## Output
377
+ - ${sessionFolder}/plan.json
378
+
379
+ ## Completion Checklist
380
+ - [ ] plan.json preserves task dependencies from implementation_plan
381
+ - [ ] Task execution order follows execution_flow
382
+ - [ ] Key_points reflected in task descriptions
383
+ - [ ] User constraints applied to implementation
384
+ - [ ] Acceptance criteria are testable
385
+ - [ ] Schema fields match plan-json-schema.json exactly
386
+ `
387
+ })
388
+ ```
389
+
390
+ **Step 3: Build executionContext**:
391
+ ```javascript
392
+ // After plan.json is generated by cli-lite-planning-agent
393
+ const plan = JSON.parse(Read(`${sessionFolder}/plan.json`))
394
+
395
+ // Build executionContext (same structure as lite-plan)
396
+ executionContext = {
397
+ planObject: plan,
398
+ explorationsContext: null, // Multi-CLI doesn't use exploration files
399
+ explorationAngles: [], // No exploration angles
400
+ explorationManifest: null, // No manifest
401
+ clarificationContext: null, // Store user feedback from Phase 2 if exists
402
+ executionMethod: userSelection.execution_method, // From Phase 4
403
+ codeReviewTool: userSelection.code_review_tool, // From Phase 4
404
+ originalUserInput: taskDescription,
405
+
406
+ // Optional: Task-level executor assignments
407
+ executorAssignments: null, // Could be enhanced in future
408
+
409
+ session: {
410
+ id: sessionId,
411
+ folder: sessionFolder,
412
+ artifacts: {
413
+ explorations: [], // No explorations in multi-CLI workflow
414
+ explorations_manifest: null,
415
+ plan: `${sessionFolder}/plan.json`,
416
+ synthesis_rounds: Array.from({length: currentRound}, (_, i) =>
417
+ `${sessionFolder}/rounds/${i+1}/synthesis.json`
418
+ ),
419
+ context_package: `${sessionFolder}/context-package.json`
420
+ }
421
+ }
422
+ }
423
+ ```
424
+
425
+ **Step 4: Hand off to Execution**:
426
+ ```javascript
427
+ // Execute to lite-execute with in-memory context
428
+ SlashCommand("/workflow:lite-execute --in-memory")
429
+ ```
430
+
431
+ ## Output File Structure
432
+
433
+ ```
434
+ .workflow/.multi-cli-plan/{MCP-task-slug-YYYY-MM-DD}/
435
+ ├── session-state.json # Session tracking (orchestrator)
436
+ ├── rounds/
437
+ │ ├── 1/synthesis.json # Round 1 analysis (cli-discuss-agent)
438
+ │ ├── 2/synthesis.json # Round 2 analysis (cli-discuss-agent)
439
+ │ └── .../
440
+ ├── context-package.json # Extracted context for planning (orchestrator)
441
+ └── plan.json # Structured plan (cli-lite-planning-agent)
442
+ ```
443
+
444
+ **File Producers**:
445
+
446
+ | File | Producer | Content |
447
+ |------|----------|---------|
448
+ | `session-state.json` | Orchestrator | Session metadata, rounds, decisions |
449
+ | `rounds/*/synthesis.json` | cli-discuss-agent | Solutions, convergence, cross-verification |
450
+ | `context-package.json` | Orchestrator | Extracted solution, dependencies, consensus for planning |
451
+ | `plan.json` | cli-lite-planning-agent | Structured tasks for lite-execute |
452
+
453
+ ## synthesis.json Schema
454
+
455
+ ```json
456
+ {
457
+ "round": 1,
458
+ "solutions": [{
459
+ "name": "Solution Name",
460
+ "source_cli": ["gemini", "codex"],
461
+ "feasibility": 0.85,
462
+ "effort": "low|medium|high",
463
+ "risk": "low|medium|high",
464
+ "summary": "Brief analysis summary",
465
+ "implementation_plan": {
466
+ "approach": "High-level technical approach",
467
+ "tasks": [
468
+ {"id": "T1", "name": "Task", "depends_on": [], "files": [], "key_point": "..."}
469
+ ],
470
+ "execution_flow": "T1 T2 → T3",
471
+ "milestones": ["Checkpoint 1", "Checkpoint 2"]
472
+ },
473
+ "dependencies": {"internal": [], "external": []},
474
+ "technical_concerns": ["Risk 1", "Blocker 2"]
475
+ }],
476
+ "convergence": {
477
+ "score": 0.85,
478
+ "new_insights": false,
479
+ "recommendation": "converged|continue|user_input_needed"
480
+ },
481
+ "cross_verification": {
482
+ "agreements": [],
483
+ "disagreements": [],
484
+ "resolution": "..."
485
+ },
486
+ "clarification_questions": []
487
+ }
488
+ ```
489
+
490
+ **Key Planning Fields**:
491
+
492
+ | Field | Purpose |
493
+ |-------|---------|
494
+ | `feasibility` | Viability score (0-1) |
495
+ | `implementation_plan.tasks[]` | Discrete tasks with dependencies |
496
+ | `implementation_plan.execution_flow` | Task sequence visualization |
497
+ | `implementation_plan.milestones` | Key checkpoints |
498
+ | `technical_concerns` | Risks and blockers |
499
+
500
+ **Note**: Solutions ranked by internal scoring (array order = priority)
501
+
502
+ ## TodoWrite Structure
503
+
504
+ **Initialization**:
505
+ ```javascript
506
+ TodoWrite({ todos: [
507
+ { content: "Phase 1: Context Gathering", status: "in_progress", activeForm: "Gathering context" },
508
+ { content: "Phase 2: Multi-CLI Discussion", status: "pending", activeForm: "Running discussion" },
509
+ { content: "Phase 3: Present Options", status: "pending", activeForm: "Presenting options" },
510
+ { content: "Phase 4: User Decision", status: "pending", activeForm: "Awaiting decision" },
511
+ { content: "Phase 5: Plan Generation", status: "pending", activeForm: "Generating plan" }
512
+ ]})
513
+ ```
514
+
515
+ **During Discussion Rounds**:
516
+ ```javascript
517
+ TodoWrite({ todos: [
518
+ { content: "Phase 1: Context Gathering", status: "completed", activeForm: "Gathering context" },
519
+ { content: "Phase 2: Multi-CLI Discussion", status: "in_progress", activeForm: "Running discussion" },
520
+ { content: " → Round 1: Initial analysis", status: "completed", activeForm: "Analyzing" },
521
+ { content: " → Round 2: Deep verification", status: "in_progress", activeForm: "Verifying" },
522
+ { content: "Phase 3: Present Options", status: "pending", activeForm: "Presenting options" },
523
+ // ...
524
+ ]})
525
+ ```
526
+
527
+ ## Error Handling
528
+
529
+ | Error | Resolution |
530
+ |-------|------------|
531
+ | ACE search fails | Fall back to Glob/Grep for file discovery |
532
+ | Agent fails | Retry once, then present partial results |
533
+ | CLI timeout (in agent) | Agent uses fallback: gemini → codex → claude |
534
+ | No convergence | Present best options, flag uncertainty |
535
+ | synthesis.json parse error | Request agent retry |
536
+ | User cancels | Save session for later resumption |
537
+
538
+ ## Configuration
539
+
540
+ | Flag | Default | Description |
541
+ |------|---------|-------------|
542
+ | `--max-rounds` | 3 | Maximum discussion rounds |
543
+ | `--tools` | gemini,codex | CLI tools for analysis |
544
+ | `--mode` | parallel | Execution mode: parallel or serial |
545
+ | `--auto-execute` | false | Auto-execute after approval |
546
+
547
+ ## Best Practices
548
+
549
+ 1. **Be Specific**: Detailed task descriptions improve ACE context quality
550
+ 2. **Provide Feedback**: Use clarification rounds to refine requirements
551
+ 3. **Trust Cross-Verification**: Multi-CLI consensus indicates high confidence
552
+ 4. **Review Trade-offs**: Consider pros/cons before selecting solution
553
+ 5. **Check synthesis.json**: Review agent output for detailed analysis
554
+ 6. **Iterate When Needed**: Don't hesitate to request more analysis
555
+
556
+ ## Related Commands
557
+
558
+ ```bash
559
+ # Simpler single-round planning
560
+ /workflow:lite-plan "task description"
561
+
562
+ # Issue-driven discovery
563
+ /issue:discover-by-prompt "find issues"
564
+
565
+ # View session files
566
+ cat .workflow/.multi-cli-plan/{session-id}/plan.json
567
+ cat .workflow/.multi-cli-plan/{session-id}/rounds/1/synthesis.json
568
+ cat .workflow/.multi-cli-plan/{session-id}/context-package.json
569
+
570
+ # Direct execution (if you have plan.json)
571
+ /workflow:lite-execute plan.json
572
+ ```