claude-code-workflow 6.3.26 → 6.3.28
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.
- package/.claude/CLAUDE.md +7 -1
- package/.claude/agents/action-planning-agent.md +1 -0
- package/.claude/agents/cli-discuss-agent.md +391 -0
- package/.claude/agents/cli-execution-agent.md +2 -0
- package/.claude/agents/cli-explore-agent.md +2 -1
- package/.claude/agents/cli-lite-planning-agent.md +1 -0
- package/.claude/agents/cli-planning-agent.md +1 -0
- package/.claude/agents/code-developer.md +1 -0
- package/.claude/agents/conceptual-planning-agent.md +2 -0
- package/.claude/agents/context-search-agent.md +1 -0
- package/.claude/agents/debug-explore-agent.md +2 -0
- package/.claude/agents/doc-generator.md +1 -0
- package/.claude/agents/issue-plan-agent.md +2 -1
- package/.claude/agents/issue-queue-agent.md +2 -1
- package/.claude/agents/memory-bridge.md +2 -0
- package/.claude/agents/test-context-search-agent.md +2 -0
- package/.claude/agents/test-fix-agent.md +1 -0
- package/.claude/agents/ui-design-agent.md +2 -0
- package/.claude/agents/universal-executor.md +1 -0
- package/.claude/commands/issue/execute.md +141 -163
- package/.claude/commands/workflow/lite-lite-lite.md +798 -0
- package/.claude/commands/workflow/multi-cli-plan.md +510 -0
- package/.claude/skills/ccw/SKILL.md +262 -372
- package/.claude/skills/ccw/command.json +547 -0
- package/.claude/skills/ccw-help/SKILL.md +46 -107
- package/.claude/skills/ccw-help/command.json +511 -0
- package/.claude/skills/skill-tuning/SKILL.md +303 -0
- package/.claude/skills/skill-tuning/phases/actions/action-abort.md +164 -0
- package/.claude/skills/skill-tuning/phases/actions/action-analyze-requirements.md +406 -0
- package/.claude/skills/skill-tuning/phases/actions/action-apply-fix.md +206 -0
- package/.claude/skills/skill-tuning/phases/actions/action-complete.md +195 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-agent.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-context.md +243 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-dataflow.md +318 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-docs.md +299 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-memory.md +269 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-token-consumption.md +200 -0
- package/.claude/skills/skill-tuning/phases/actions/action-gemini-analysis.md +322 -0
- package/.claude/skills/skill-tuning/phases/actions/action-generate-report.md +228 -0
- package/.claude/skills/skill-tuning/phases/actions/action-init.md +149 -0
- package/.claude/skills/skill-tuning/phases/actions/action-propose-fixes.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-verify.md +222 -0
- package/.claude/skills/skill-tuning/phases/orchestrator.md +377 -0
- package/.claude/skills/skill-tuning/phases/state-schema.md +378 -0
- package/.claude/skills/skill-tuning/specs/category-mappings.json +284 -0
- package/.claude/skills/skill-tuning/specs/dimension-mapping.md +212 -0
- package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +318 -0
- package/.claude/skills/skill-tuning/specs/quality-gates.md +263 -0
- package/.claude/skills/skill-tuning/specs/skill-authoring-principles.md +189 -0
- package/.claude/skills/skill-tuning/specs/tuning-strategies.md +1537 -0
- package/.claude/skills/skill-tuning/templates/diagnosis-report.md +153 -0
- package/.claude/skills/skill-tuning/templates/fix-proposal.md +204 -0
- package/.claude/workflows/cli-templates/schemas/multi-cli-discussion-schema.json +421 -0
- package/.claude/workflows/cli-tools-usage.md +0 -41
- package/ccw/dist/core/auth/csrf-middleware.d.ts.map +1 -1
- package/ccw/dist/core/auth/csrf-middleware.js +3 -1
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
- package/ccw/dist/core/data-aggregator.d.ts +2 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -1
- package/ccw/dist/core/data-aggregator.js +5 -2
- package/ccw/dist/core/data-aggregator.js.map +1 -1
- package/ccw/dist/core/lite-scanner.d.ts +2 -1
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner.js +295 -6
- package/ccw/dist/core/lite-scanner.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +5 -5
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/session-routes.js +166 -48
- package/ccw/dist/core/routes/session-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +87 -0
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.js +2 -2
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/scripts/IMPLEMENTATION-SUMMARY.md +226 -0
- package/ccw/scripts/QUICK-REFERENCE.md +135 -0
- package/ccw/scripts/README-memory-embedder.md +157 -0
- package/ccw/scripts/__pycache__/memory_embedder.cpython-313.pyc +0 -0
- package/ccw/scripts/__pycache__/test_memory_embedder.cpython-313-pytest-8.4.2.pyc +0 -0
- package/ccw/scripts/memory-embedder-example.ts +184 -0
- package/ccw/scripts/memory_embedder.py +428 -0
- package/ccw/scripts/test_memory_embedder.py +245 -0
- package/ccw/src/core/auth/csrf-middleware.ts +3 -1
- package/ccw/src/core/data-aggregator.ts +7 -2
- package/ccw/src/core/lite-scanner.ts +440 -6
- package/ccw/src/core/routes/codexlens/config-handlers.ts +12 -9
- package/ccw/src/core/routes/session-routes.ts +201 -48
- package/ccw/src/core/routes/system-routes.ts +102 -0
- package/ccw/src/core/server.ts +2 -2
- package/ccw/src/templates/dashboard-css/01-base.css +8 -0
- package/ccw/src/templates/dashboard-css/02-session.css +81 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +2442 -0
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +157 -0
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +23 -0
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +38 -4
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +38 -13
- package/ccw/src/templates/dashboard-js/components/navigation.js +24 -4
- package/ccw/src/templates/dashboard-js/i18n.js +194 -6
- package/ccw/src/templates/dashboard-js/views/api-settings.js +32 -0
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +44 -3
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +303 -31
- package/ccw/src/templates/dashboard-js/views/history.js +44 -6
- package/ccw/src/templates/dashboard-js/views/home.js +1 -0
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +54 -7
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +1817 -4
- package/ccw/src/templates/dashboard.html +5 -0
- package/package.json +2 -1
- package/.claude/skills/ccw/index/command-capabilities.json +0 -127
- package/.claude/skills/ccw/index/intent-rules.json +0 -136
- package/.claude/skills/ccw/index/workflow-chains.json +0 -451
- package/.claude/skills/ccw/phases/actions/bugfix.md +0 -218
- package/.claude/skills/ccw/phases/actions/coupled.md +0 -194
- package/.claude/skills/ccw/phases/actions/docs.md +0 -93
- package/.claude/skills/ccw/phases/actions/full.md +0 -154
- package/.claude/skills/ccw/phases/actions/issue.md +0 -201
- package/.claude/skills/ccw/phases/actions/rapid.md +0 -104
- package/.claude/skills/ccw/phases/actions/review-fix.md +0 -84
- package/.claude/skills/ccw/phases/actions/tdd.md +0 -66
- package/.claude/skills/ccw/phases/actions/ui.md +0 -79
- package/.claude/skills/ccw/phases/orchestrator.md +0 -435
- package/.claude/skills/ccw/specs/intent-classification.md +0 -336
- package/.claude/skills/ccw-help/index/all-agents.json +0 -82
- package/.claude/skills/ccw-help/index/all-commands.json +0 -882
- package/.claude/skills/ccw-help/index/by-category.json +0 -914
- package/.claude/skills/ccw-help/index/by-use-case.json +0 -896
- package/.claude/skills/ccw-help/index/command-relationships.json +0 -160
- package/.claude/skills/ccw-help/index/essential-commands.json +0 -112
|
@@ -0,0 +1,510 @@
|
|
|
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
|
+
# Resume session
|
|
22
|
+
/workflow:lite-execute --session=MCP-xxx
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Context Source**: ACE semantic search + Multi-CLI analysis
|
|
26
|
+
**Output Directory**: `.workflow/.multi-cli-plan/{session-id}/`
|
|
27
|
+
**Default Max Rounds**: 3 (convergence may complete earlier)
|
|
28
|
+
**CLI Tools**: @cli-discuss-agent (analysis), @cli-lite-planning-agent (plan generation)
|
|
29
|
+
|
|
30
|
+
## What & Why
|
|
31
|
+
|
|
32
|
+
### Core Concept
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
**Process**:
|
|
37
|
+
- **Phase 1**: ACE semantic search gathers codebase context
|
|
38
|
+
- **Phase 2**: cli-discuss-agent orchestrates Gemini/Codex/Claude for cross-verified analysis
|
|
39
|
+
- **Phase 3-5**: User decision → Plan generation → Execution handoff
|
|
40
|
+
|
|
41
|
+
**vs Single-CLI Planning**:
|
|
42
|
+
- **Single**: One model perspective, potential blind spots
|
|
43
|
+
- **Multi-CLI**: Cross-verification catches inconsistencies, builds consensus on solutions
|
|
44
|
+
|
|
45
|
+
### Value Proposition
|
|
46
|
+
|
|
47
|
+
1. **Multi-Perspective Analysis**: Gemini + Codex + Claude analyze from different angles
|
|
48
|
+
2. **Cross-Verification**: Identify agreements/disagreements, build confidence
|
|
49
|
+
3. **User-Driven Decisions**: Every round ends with user decision point
|
|
50
|
+
4. **Iterative Convergence**: Progressive refinement until consensus reached
|
|
51
|
+
|
|
52
|
+
### Orchestrator Boundary (CRITICAL)
|
|
53
|
+
|
|
54
|
+
- **ONLY command** for multi-CLI collaborative planning
|
|
55
|
+
- Manages: Session state, user decisions, agent delegation, phase transitions
|
|
56
|
+
- Delegates: CLI execution to @cli-discuss-agent, plan generation to @cli-lite-planning-agent
|
|
57
|
+
|
|
58
|
+
### Execution Flow
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Phase 1: Context Gathering
|
|
62
|
+
└─ ACE semantic search, extract keywords, build context package
|
|
63
|
+
|
|
64
|
+
Phase 2: Multi-CLI Discussion (Iterative, via @cli-discuss-agent)
|
|
65
|
+
├─ Round N: Agent executes Gemini + Codex + Claude
|
|
66
|
+
├─ Cross-verify findings, synthesize solutions
|
|
67
|
+
├─ Write synthesis.json to rounds/{N}/
|
|
68
|
+
└─ Loop until convergence or max rounds
|
|
69
|
+
|
|
70
|
+
Phase 3: Present Options
|
|
71
|
+
└─ Display solutions with trade-offs from agent output
|
|
72
|
+
|
|
73
|
+
Phase 4: User Decision
|
|
74
|
+
├─ Approve solution → Phase 5
|
|
75
|
+
├─ Need clarification → Return to Phase 2
|
|
76
|
+
└─ Change direction → Reset with feedback
|
|
77
|
+
|
|
78
|
+
Phase 5: Plan Generation (via @cli-lite-planning-agent)
|
|
79
|
+
├─ Generate IMPL_PLAN.md + plan.json
|
|
80
|
+
└─ Hand off to /workflow:lite-execute
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Agent Roles
|
|
84
|
+
|
|
85
|
+
| Agent | Responsibility |
|
|
86
|
+
|-------|---------------|
|
|
87
|
+
| **Orchestrator** | Session management, ACE context, user decisions, phase transitions |
|
|
88
|
+
| **@cli-discuss-agent** | Multi-CLI execution (Gemini/Codex/Claude), cross-verification, solution synthesis, synthesis.json output |
|
|
89
|
+
| **@cli-lite-planning-agent** | Task decomposition, IMPL_PLAN.md + plan.json generation |
|
|
90
|
+
|
|
91
|
+
## Core Responsibilities
|
|
92
|
+
|
|
93
|
+
### Phase 1: Context Gathering
|
|
94
|
+
|
|
95
|
+
**Session Initialization**:
|
|
96
|
+
```javascript
|
|
97
|
+
const sessionId = `MCP-${taskSlug}-${date}`
|
|
98
|
+
const sessionFolder = `.workflow/.multi-cli-plan/${sessionId}`
|
|
99
|
+
Bash(`mkdir -p ${sessionFolder}/rounds`)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**ACE Context Queries**:
|
|
103
|
+
```javascript
|
|
104
|
+
const aceQueries = [
|
|
105
|
+
`Project architecture related to ${keywords}`,
|
|
106
|
+
`Existing implementations of ${keywords[0]}`,
|
|
107
|
+
`Code patterns for ${keywords} features`,
|
|
108
|
+
`Integration points for ${keywords[0]}`
|
|
109
|
+
]
|
|
110
|
+
// Execute via mcp__ace-tool__search_context
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Context Package** (passed to agent):
|
|
114
|
+
- `relevant_files[]` - Files identified by ACE
|
|
115
|
+
- `detected_patterns[]` - Code patterns found
|
|
116
|
+
- `architecture_insights` - Structure understanding
|
|
117
|
+
|
|
118
|
+
### Phase 2: Agent Delegation
|
|
119
|
+
|
|
120
|
+
**Core Principle**: Orchestrator only delegates and reads output - NO direct CLI execution.
|
|
121
|
+
|
|
122
|
+
**Agent Invocation**:
|
|
123
|
+
```javascript
|
|
124
|
+
Task({
|
|
125
|
+
subagent_type: "cli-discuss-agent",
|
|
126
|
+
run_in_background: false,
|
|
127
|
+
description: `Discussion round ${currentRound}`,
|
|
128
|
+
prompt: `
|
|
129
|
+
## Input Context
|
|
130
|
+
- task_description: ${taskDescription}
|
|
131
|
+
- round_number: ${currentRound}
|
|
132
|
+
- session: { id: "${sessionId}", folder: "${sessionFolder}" }
|
|
133
|
+
- ace_context: ${JSON.stringify(contextPackageage)}
|
|
134
|
+
- previous_rounds: ${JSON.stringify(analysisResults)}
|
|
135
|
+
- user_feedback: ${userFeedback || 'None'}
|
|
136
|
+
- cli_config: { tools: ["gemini", "codex"], mode: "parallel", fallback_chain: ["gemini", "codex", "claude"] }
|
|
137
|
+
|
|
138
|
+
## Execution Process
|
|
139
|
+
1. Parse input context (handle JSON strings)
|
|
140
|
+
2. Check if ACE supplementary search needed
|
|
141
|
+
3. Build CLI prompts with context
|
|
142
|
+
4. Execute CLIs (parallel or serial per cli_config.mode)
|
|
143
|
+
5. Parse CLI outputs, handle failures with fallback
|
|
144
|
+
6. Perform cross-verification between CLI results
|
|
145
|
+
7. Synthesize solutions, calculate scores
|
|
146
|
+
8. Calculate convergence, generate clarification questions
|
|
147
|
+
9. Write synthesis.json
|
|
148
|
+
|
|
149
|
+
## Output
|
|
150
|
+
Write: ${sessionFolder}/rounds/${currentRound}/synthesis.json
|
|
151
|
+
|
|
152
|
+
## Completion Checklist
|
|
153
|
+
- [ ] All configured CLI tools executed (or fallback triggered)
|
|
154
|
+
- [ ] Cross-verification completed with agreements/disagreements
|
|
155
|
+
- [ ] 2-3 solutions generated with file:line references
|
|
156
|
+
- [ ] Convergence score calculated (0.0-1.0)
|
|
157
|
+
- [ ] synthesis.json written with all Primary Fields
|
|
158
|
+
`
|
|
159
|
+
})
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Read Agent Output**:
|
|
163
|
+
```javascript
|
|
164
|
+
const synthesis = JSON.parse(Read(`${sessionFolder}/rounds/${round}/synthesis.json`))
|
|
165
|
+
// Access top-level fields: solutions, convergence, cross_verification, clarification_questions
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Convergence Decision**:
|
|
169
|
+
```javascript
|
|
170
|
+
if (synthesis.convergence.recommendation === 'converged') {
|
|
171
|
+
// Proceed to Phase 3
|
|
172
|
+
} else if (synthesis.convergence.recommendation === 'user_input_needed') {
|
|
173
|
+
// Collect user feedback, return to Phase 2
|
|
174
|
+
} else {
|
|
175
|
+
// Continue to next round if new_insights && round < maxRounds
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Phase 3: Present Options
|
|
180
|
+
|
|
181
|
+
**Display from Agent Output** (no processing):
|
|
182
|
+
```javascript
|
|
183
|
+
console.log(`
|
|
184
|
+
## Solution Options
|
|
185
|
+
|
|
186
|
+
${synthesis.solutions.map((s, i) => `
|
|
187
|
+
**Option ${i+1}: ${s.name}**
|
|
188
|
+
Source: ${s.source_cli.join(' + ')}
|
|
189
|
+
Effort: ${s.effort} | Risk: ${s.risk}
|
|
190
|
+
|
|
191
|
+
Pros: ${s.pros.join(', ')}
|
|
192
|
+
Cons: ${s.cons.join(', ')}
|
|
193
|
+
|
|
194
|
+
Files: ${s.affected_files.slice(0,3).map(f => `${f.file}:${f.line}`).join(', ')}
|
|
195
|
+
`).join('\n')}
|
|
196
|
+
|
|
197
|
+
## Cross-Verification
|
|
198
|
+
Agreements: ${synthesis.cross_verification.agreements.length}
|
|
199
|
+
Disagreements: ${synthesis.cross_verification.disagreements.length}
|
|
200
|
+
`)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Phase 4: User Decision
|
|
204
|
+
|
|
205
|
+
**Decision Options**:
|
|
206
|
+
```javascript
|
|
207
|
+
AskUserQuestion({
|
|
208
|
+
questions: [{
|
|
209
|
+
question: "Which solution approach?",
|
|
210
|
+
header: "Solution",
|
|
211
|
+
options: solutions.map((s, i) => ({
|
|
212
|
+
label: `Option ${i+1}: ${s.name}`,
|
|
213
|
+
description: `${s.effort} effort, ${s.risk} risk`
|
|
214
|
+
})).concat([
|
|
215
|
+
{ label: "Need More Analysis", description: "Return to Phase 2" }
|
|
216
|
+
])
|
|
217
|
+
}]
|
|
218
|
+
})
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Routing**:
|
|
222
|
+
- Approve → Phase 5
|
|
223
|
+
- Need More Analysis → Phase 2 with feedback
|
|
224
|
+
- Add constraints → Collect details, then Phase 5
|
|
225
|
+
|
|
226
|
+
### Phase 5: Plan Generation
|
|
227
|
+
|
|
228
|
+
**Step 1: Build Context-Package** (Orchestrator responsibility):
|
|
229
|
+
```javascript
|
|
230
|
+
// Extract key information from user decision and synthesis
|
|
231
|
+
const contextPackage = {
|
|
232
|
+
// Core solution details
|
|
233
|
+
solution: {
|
|
234
|
+
name: selectedSolution.name,
|
|
235
|
+
source_cli: selectedSolution.source_cli,
|
|
236
|
+
feasibility: selectedSolution.feasibility,
|
|
237
|
+
effort: selectedSolution.effort,
|
|
238
|
+
risk: selectedSolution.risk,
|
|
239
|
+
summary: selectedSolution.summary
|
|
240
|
+
},
|
|
241
|
+
// Implementation plan (tasks, flow, milestones)
|
|
242
|
+
implementation_plan: selectedSolution.implementation_plan,
|
|
243
|
+
// Dependencies
|
|
244
|
+
dependencies: selectedSolution.dependencies || { internal: [], external: [] },
|
|
245
|
+
// Technical concerns
|
|
246
|
+
technical_concerns: selectedSolution.technical_concerns || [],
|
|
247
|
+
// Consensus from cross-verification
|
|
248
|
+
consensus: {
|
|
249
|
+
agreements: synthesis.cross_verification.agreements,
|
|
250
|
+
resolved_conflicts: synthesis.cross_verification.resolution
|
|
251
|
+
},
|
|
252
|
+
// User constraints (from Phase 4 feedback)
|
|
253
|
+
constraints: userConstraints || [],
|
|
254
|
+
// Task context
|
|
255
|
+
task_description: taskDescription,
|
|
256
|
+
session_id: sessionId
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Write context-package for traceability
|
|
260
|
+
Write(`${sessionFolder}/context-package.json`, JSON.stringify(contextPackage, null, 2))
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Context-Package Schema**:
|
|
264
|
+
|
|
265
|
+
| Field | Type | Description |
|
|
266
|
+
|-------|------|-------------|
|
|
267
|
+
| `solution` | object | User-selected solution from synthesis |
|
|
268
|
+
| `solution.name` | string | Solution identifier |
|
|
269
|
+
| `solution.feasibility` | number | Viability score (0-1) |
|
|
270
|
+
| `solution.summary` | string | Brief analysis summary |
|
|
271
|
+
| `implementation_plan` | object | Task breakdown with flow and dependencies |
|
|
272
|
+
| `implementation_plan.approach` | string | High-level technical strategy |
|
|
273
|
+
| `implementation_plan.tasks[]` | array | Discrete tasks with id, name, depends_on, files |
|
|
274
|
+
| `implementation_plan.execution_flow` | string | Task sequence (e.g., "T1 → T2 → T3") |
|
|
275
|
+
| `implementation_plan.milestones` | string[] | Key checkpoints |
|
|
276
|
+
| `dependencies` | object | Module and package dependencies |
|
|
277
|
+
| `technical_concerns` | string[] | Risks and blockers |
|
|
278
|
+
| `consensus` | object | Cross-verified agreements from multi-CLI |
|
|
279
|
+
| `constraints` | string[] | User-specified constraints from Phase 4 |
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
{
|
|
283
|
+
"solution": {
|
|
284
|
+
"name": "Strategy Pattern Refactoring",
|
|
285
|
+
"source_cli": ["gemini", "codex"],
|
|
286
|
+
"feasibility": 0.88,
|
|
287
|
+
"effort": "medium",
|
|
288
|
+
"risk": "low",
|
|
289
|
+
"summary": "Extract payment gateway interface, implement strategy pattern for multi-gateway support"
|
|
290
|
+
},
|
|
291
|
+
"implementation_plan": {
|
|
292
|
+
"approach": "Define interface → Create concrete strategies → Implement factory → Migrate existing code",
|
|
293
|
+
"tasks": [
|
|
294
|
+
{"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"},
|
|
295
|
+
{"id": "T2", "name": "Implement StripeGateway", "depends_on": ["T1"], "files": [{"file": "src/payment/stripe.ts", "line": 1, "action": "create"}], "key_point": "Wrap existing logic"},
|
|
296
|
+
{"id": "T3", "name": "Create GatewayFactory", "depends_on": ["T1"], "files": [{"file": "src/payment/factory.ts", "line": 1, "action": "create"}], "key_point": null},
|
|
297
|
+
{"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"}
|
|
298
|
+
],
|
|
299
|
+
"execution_flow": "T1 → (T2 | T3) → T4",
|
|
300
|
+
"milestones": ["Interface defined", "Gateway implementations complete", "Migration done"]
|
|
301
|
+
},
|
|
302
|
+
"dependencies": {
|
|
303
|
+
"internal": ["@/lib/payment-gateway", "@/types/payment"],
|
|
304
|
+
"external": ["stripe@^14.0.0"]
|
|
305
|
+
},
|
|
306
|
+
"technical_concerns": ["Existing tests must pass", "No breaking API changes"],
|
|
307
|
+
"consensus": {
|
|
308
|
+
"agreements": ["Use strategy pattern", "Keep existing API"],
|
|
309
|
+
"resolved_conflicts": "Factory over DI for simpler integration"
|
|
310
|
+
},
|
|
311
|
+
"constraints": ["backward compatible", "no breaking changes to PaymentResult type"],
|
|
312
|
+
"task_description": "Refactor payment processing for multi-gateway support",
|
|
313
|
+
"session_id": "MCP-payment-refactor-2026-01-14"
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Step 2: Invoke Planning Agent**:
|
|
318
|
+
```javascript
|
|
319
|
+
Task({
|
|
320
|
+
subagent_type: "cli-lite-planning-agent",
|
|
321
|
+
run_in_background: false,
|
|
322
|
+
description: "Generate implementation plan",
|
|
323
|
+
prompt: `
|
|
324
|
+
## Schema Reference
|
|
325
|
+
Execute: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json
|
|
326
|
+
|
|
327
|
+
## Context-Package (from orchestrator)
|
|
328
|
+
${JSON.stringify(contextPackage, null, 2)}
|
|
329
|
+
|
|
330
|
+
## Execution Process
|
|
331
|
+
1. Read plan-json-schema.json for output structure
|
|
332
|
+
2. Read project-tech.json and project-guidelines.json
|
|
333
|
+
3. Parse context-package fields:
|
|
334
|
+
- solution: name, feasibility, summary
|
|
335
|
+
- implementation_plan: tasks[], execution_flow, milestones
|
|
336
|
+
- dependencies: internal[], external[]
|
|
337
|
+
- technical_concerns: risks/blockers
|
|
338
|
+
- consensus: agreements, resolved_conflicts
|
|
339
|
+
- constraints: user requirements
|
|
340
|
+
4. Use implementation_plan.tasks[] as task foundation
|
|
341
|
+
5. Preserve task dependencies (depends_on) and execution_flow
|
|
342
|
+
6. Expand tasks with detailed acceptance criteria
|
|
343
|
+
7. Generate IMPL_PLAN.md documenting milestones and key_points
|
|
344
|
+
8. Generate plan.json following schema exactly
|
|
345
|
+
|
|
346
|
+
## Output
|
|
347
|
+
- ${sessionFolder}/IMPL_PLAN.md
|
|
348
|
+
- ${sessionFolder}/plan.json
|
|
349
|
+
|
|
350
|
+
## Completion Checklist
|
|
351
|
+
- [ ] IMPL_PLAN.md documents approach, milestones, technical_concerns
|
|
352
|
+
- [ ] plan.json preserves task dependencies from implementation_plan
|
|
353
|
+
- [ ] Task execution order follows execution_flow
|
|
354
|
+
- [ ] Key_points reflected in task descriptions
|
|
355
|
+
- [ ] User constraints applied to implementation
|
|
356
|
+
- [ ] Acceptance criteria are testable
|
|
357
|
+
`
|
|
358
|
+
})
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Hand off to Execution**:
|
|
362
|
+
```javascript
|
|
363
|
+
if (userConfirms) {
|
|
364
|
+
SlashCommand("/workflow:lite-execute --in-memory")
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## Output File Structure
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
.workflow/.multi-cli-plan/{MCP-task-slug-YYYY-MM-DD}/
|
|
372
|
+
├── session-state.json # Session tracking (orchestrator)
|
|
373
|
+
├── rounds/
|
|
374
|
+
│ ├── 1/synthesis.json # Round 1 analysis (cli-discuss-agent)
|
|
375
|
+
│ ├── 2/synthesis.json # Round 2 analysis (cli-discuss-agent)
|
|
376
|
+
│ └── .../
|
|
377
|
+
├── context-package.json # Extracted context for planning (orchestrator)
|
|
378
|
+
├── IMPL_PLAN.md # Documentation (cli-lite-planning-agent)
|
|
379
|
+
└── plan.json # Structured plan (cli-lite-planning-agent)
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**File Producers**:
|
|
383
|
+
|
|
384
|
+
| File | Producer | Content |
|
|
385
|
+
|------|----------|---------|
|
|
386
|
+
| `session-state.json` | Orchestrator | Session metadata, rounds, decisions |
|
|
387
|
+
| `rounds/*/synthesis.json` | cli-discuss-agent | Solutions, convergence, cross-verification |
|
|
388
|
+
| `context-package.json` | Orchestrator | Extracted solution, dependencies, consensus for planning |
|
|
389
|
+
| `IMPL_PLAN.md` | cli-lite-planning-agent | Human-readable plan |
|
|
390
|
+
| `plan.json` | cli-lite-planning-agent | Structured tasks for execution |
|
|
391
|
+
|
|
392
|
+
## synthesis.json Schema
|
|
393
|
+
|
|
394
|
+
```json
|
|
395
|
+
{
|
|
396
|
+
"round": 1,
|
|
397
|
+
"solutions": [{
|
|
398
|
+
"name": "Solution Name",
|
|
399
|
+
"source_cli": ["gemini", "codex"],
|
|
400
|
+
"feasibility": 0.85,
|
|
401
|
+
"effort": "low|medium|high",
|
|
402
|
+
"risk": "low|medium|high",
|
|
403
|
+
"summary": "Brief analysis summary",
|
|
404
|
+
"implementation_plan": {
|
|
405
|
+
"approach": "High-level technical approach",
|
|
406
|
+
"tasks": [
|
|
407
|
+
{"id": "T1", "name": "Task", "depends_on": [], "files": [], "key_point": "..."}
|
|
408
|
+
],
|
|
409
|
+
"execution_flow": "T1 → T2 → T3",
|
|
410
|
+
"milestones": ["Checkpoint 1", "Checkpoint 2"]
|
|
411
|
+
},
|
|
412
|
+
"dependencies": {"internal": [], "external": []},
|
|
413
|
+
"technical_concerns": ["Risk 1", "Blocker 2"]
|
|
414
|
+
}],
|
|
415
|
+
"convergence": {
|
|
416
|
+
"score": 0.85,
|
|
417
|
+
"new_insights": false,
|
|
418
|
+
"recommendation": "converged|continue|user_input_needed"
|
|
419
|
+
},
|
|
420
|
+
"cross_verification": {
|
|
421
|
+
"agreements": [],
|
|
422
|
+
"disagreements": [],
|
|
423
|
+
"resolution": "..."
|
|
424
|
+
},
|
|
425
|
+
"clarification_questions": []
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
**Key Planning Fields**:
|
|
430
|
+
|
|
431
|
+
| Field | Purpose |
|
|
432
|
+
|-------|---------|
|
|
433
|
+
| `feasibility` | Viability score (0-1) |
|
|
434
|
+
| `implementation_plan.tasks[]` | Discrete tasks with dependencies |
|
|
435
|
+
| `implementation_plan.execution_flow` | Task sequence visualization |
|
|
436
|
+
| `implementation_plan.milestones` | Key checkpoints |
|
|
437
|
+
| `technical_concerns` | Risks and blockers |
|
|
438
|
+
|
|
439
|
+
**Note**: Solutions ranked by internal scoring (array order = priority)
|
|
440
|
+
|
|
441
|
+
## TodoWrite Structure
|
|
442
|
+
|
|
443
|
+
**Initialization**:
|
|
444
|
+
```javascript
|
|
445
|
+
TodoWrite({ todos: [
|
|
446
|
+
{ content: "Phase 1: Context Gathering", status: "in_progress", activeForm: "Gathering context" },
|
|
447
|
+
{ content: "Phase 2: Multi-CLI Discussion", status: "pending", activeForm: "Running discussion" },
|
|
448
|
+
{ content: "Phase 3: Present Options", status: "pending", activeForm: "Presenting options" },
|
|
449
|
+
{ content: "Phase 4: User Decision", status: "pending", activeForm: "Awaiting decision" },
|
|
450
|
+
{ content: "Phase 5: Plan Generation", status: "pending", activeForm: "Generating plan" }
|
|
451
|
+
]})
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**During Discussion Rounds**:
|
|
455
|
+
```javascript
|
|
456
|
+
TodoWrite({ todos: [
|
|
457
|
+
{ content: "Phase 1: Context Gathering", status: "completed", activeForm: "Gathering context" },
|
|
458
|
+
{ content: "Phase 2: Multi-CLI Discussion", status: "in_progress", activeForm: "Running discussion" },
|
|
459
|
+
{ content: " → Round 1: Initial analysis", status: "completed", activeForm: "Analyzing" },
|
|
460
|
+
{ content: " → Round 2: Deep verification", status: "in_progress", activeForm: "Verifying" },
|
|
461
|
+
{ content: "Phase 3: Present Options", status: "pending", activeForm: "Presenting options" },
|
|
462
|
+
// ...
|
|
463
|
+
]})
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
## Error Handling
|
|
467
|
+
|
|
468
|
+
| Error | Resolution |
|
|
469
|
+
|-------|------------|
|
|
470
|
+
| ACE search fails | Fall back to Glob/Grep for file discovery |
|
|
471
|
+
| Agent fails | Retry once, then present partial results |
|
|
472
|
+
| CLI timeout (in agent) | Agent uses fallback: gemini → codex → claude |
|
|
473
|
+
| No convergence | Present best options, flag uncertainty |
|
|
474
|
+
| synthesis.json parse error | Request agent retry |
|
|
475
|
+
| User cancels | Save session for later resumption |
|
|
476
|
+
|
|
477
|
+
## Configuration
|
|
478
|
+
|
|
479
|
+
| Flag | Default | Description |
|
|
480
|
+
|------|---------|-------------|
|
|
481
|
+
| `--max-rounds` | 3 | Maximum discussion rounds |
|
|
482
|
+
| `--tools` | gemini,codex | CLI tools for analysis |
|
|
483
|
+
| `--mode` | parallel | Execution mode: parallel or serial |
|
|
484
|
+
| `--auto-execute` | false | Auto-execute after approval |
|
|
485
|
+
|
|
486
|
+
## Best Practices
|
|
487
|
+
|
|
488
|
+
1. **Be Specific**: Detailed task descriptions improve ACE context quality
|
|
489
|
+
2. **Provide Feedback**: Use clarification rounds to refine requirements
|
|
490
|
+
3. **Trust Cross-Verification**: Multi-CLI consensus indicates high confidence
|
|
491
|
+
4. **Review Trade-offs**: Consider pros/cons before selecting solution
|
|
492
|
+
5. **Check synthesis.json**: Review agent output for detailed analysis
|
|
493
|
+
6. **Iterate When Needed**: Don't hesitate to request more analysis
|
|
494
|
+
|
|
495
|
+
## Related Commands
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
# Resume saved session
|
|
499
|
+
/workflow:lite-execute --session=MCP-xxx
|
|
500
|
+
|
|
501
|
+
# Simpler single-round planning
|
|
502
|
+
/workflow:lite-plan "task description"
|
|
503
|
+
|
|
504
|
+
# Issue-driven discovery
|
|
505
|
+
/issue:discover-by-prompt "find issues"
|
|
506
|
+
|
|
507
|
+
# View session files
|
|
508
|
+
cat .workflow/.multi-cli-plan/{session-id}/IMPL_PLAN.md
|
|
509
|
+
cat .workflow/.multi-cli-plan/{session-id}/rounds/1/synthesis.json
|
|
510
|
+
```
|