claude-code-workflow 6.3.28 → 6.3.29
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/commands/issue/execute.md +133 -18
- package/.claude/commands/workflow/debug.md +6 -0
- package/.claude/commands/workflow/execute.md +4 -0
- package/.claude/commands/workflow/lite-execute.md +4 -0
- package/.claude/commands/workflow/lite-lite-lite.md +179 -544
- package/.claude/commands/workflow/review-fix.md +4 -0
- package/.claude/commands/workflow/test-cycle-execute.md +4 -0
- package/.codex/prompts/issue-execute.md +72 -12
- package/README.md +3 -0
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner.js +56 -3
- package/ccw/dist/core/lite-scanner.js.map +1 -1
- package/ccw/dist/tools/memory-update-queue.d.ts.map +1 -1
- package/ccw/dist/tools/memory-update-queue.js +5 -11
- package/ccw/dist/tools/memory-update-queue.js.map +1 -1
- package/ccw/src/core/lite-scanner.ts +58 -3
- package/ccw/src/templates/dashboard-css/03-tasks.css +5 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +630 -1
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +30 -21
- package/ccw/src/templates/dashboard-js/i18n.js +100 -0
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +1138 -334
- package/ccw/src/tools/memory-update-queue.js +5 -11
- package/package.json +1 -1
|
@@ -10,63 +10,33 @@ allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Bash(*), mcp_
|
|
|
10
10
|
## Quick Start
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
# Basic usage
|
|
14
13
|
/workflow:lite-lite-lite "Fix the login bug"
|
|
15
|
-
|
|
16
|
-
# Complex task
|
|
17
14
|
/workflow:lite-lite-lite "Refactor payment module for multi-gateway support"
|
|
18
15
|
```
|
|
19
16
|
|
|
20
17
|
**Core Philosophy**: Minimal friction, maximum velocity. No files, no artifacts - just analyze and execute.
|
|
21
18
|
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
### Core Concept
|
|
25
|
-
|
|
26
|
-
**Zero-artifact workflow**: Clarify requirements → Auto-select tools → Mixed tool analysis → User decision → Direct execution. All state in memory, all decisions via AskUser.
|
|
19
|
+
## Overview
|
|
27
20
|
|
|
28
|
-
**
|
|
29
|
-
- **multi-cli-plan**: Full artifacts (IMPL_PLAN.md, plan.json, synthesis.json)
|
|
30
|
-
- **lite-lite-lite**: No files, direct in-memory flow, immediate execution
|
|
21
|
+
**Zero-artifact workflow**: Clarify → Select Tools → Multi-Mode Analysis → Decision → Direct Execution
|
|
31
22
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
1. **Ultra-Fast**: No file I/O overhead, no session management
|
|
35
|
-
2. **Smart Selection**: Auto-select optimal tool combination based on task
|
|
36
|
-
3. **Interactive**: Key decisions validated via AskUser
|
|
37
|
-
4. **Direct**: Analysis → Execution without intermediate artifacts
|
|
23
|
+
**vs multi-cli-plan**: No IMPL_PLAN.md, plan.json, synthesis.json - all state in memory.
|
|
38
24
|
|
|
39
25
|
## Execution Flow
|
|
40
26
|
|
|
41
27
|
```
|
|
42
|
-
Phase 1: Clarify Requirements
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Phase
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Phase 3: Mixed Tool Analysis
|
|
49
|
-
└─ Execute selected tools in parallel → Aggregate results
|
|
50
|
-
|
|
51
|
-
Phase 4: User Decision
|
|
52
|
-
├─ Present analysis summary
|
|
53
|
-
├─ AskUser: Execute / Refine / Change tools / Cancel
|
|
54
|
-
└─ Loop to Phase 3 if refinement needed
|
|
55
|
-
|
|
56
|
-
Phase 5: Direct Execution
|
|
57
|
-
└─ Execute solution directly (no plan files)
|
|
28
|
+
Phase 1: Clarify Requirements → AskUser for missing details
|
|
29
|
+
Phase 2: Select Tools (CLI → Mode → Agent) → 3-step selection
|
|
30
|
+
Phase 3: Multi-Mode Analysis → Execute with --resume chaining
|
|
31
|
+
Phase 4: User Decision → Execute / Refine / Change / Cancel
|
|
32
|
+
Phase 5: Direct Execution → No plan files, immediate implementation
|
|
58
33
|
```
|
|
59
34
|
|
|
60
|
-
## Phase
|
|
35
|
+
## Phase 1: Clarify Requirements
|
|
61
36
|
|
|
62
|
-
### Phase 1: Clarify Requirements
|
|
63
|
-
|
|
64
|
-
**Parse Task Description**:
|
|
65
37
|
```javascript
|
|
66
|
-
// Extract intent from user input
|
|
67
38
|
const taskDescription = $ARGUMENTS
|
|
68
39
|
|
|
69
|
-
// Check if clarification needed
|
|
70
40
|
if (taskDescription.length < 20 || isAmbiguous(taskDescription)) {
|
|
71
41
|
AskUserQuestion({
|
|
72
42
|
questions: [{
|
|
@@ -80,173 +50,72 @@ if (taskDescription.length < 20 || isAmbiguous(taskDescription)) {
|
|
|
80
50
|
}]
|
|
81
51
|
})
|
|
82
52
|
}
|
|
83
|
-
```
|
|
84
53
|
|
|
85
|
-
|
|
86
|
-
```javascript
|
|
87
|
-
// Only if task seems to need codebase context
|
|
54
|
+
// Optional: Quick ACE Context for complex tasks
|
|
88
55
|
mcp__ace-tool__search_context({
|
|
89
56
|
project_root_path: process.cwd(),
|
|
90
57
|
query: `${taskDescription} implementation patterns`
|
|
91
58
|
})
|
|
92
59
|
```
|
|
93
60
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
**Tool Categories**:
|
|
61
|
+
## Phase 2: Select Tools
|
|
97
62
|
|
|
98
|
-
|
|
99
|
-
|----------|--------|-----------|
|
|
100
|
-
| **CLI Tools** | cli-tools.json | `ccw cli -p "..." --tool <name>` |
|
|
101
|
-
| **Sub Agents** | Task tool | `Task({ subagent_type: "...", prompt: "..." })` |
|
|
63
|
+
### Tool Definitions
|
|
102
64
|
|
|
103
|
-
**
|
|
65
|
+
**CLI Tools** (from cli-tools.json):
|
|
104
66
|
```javascript
|
|
105
|
-
function analyzeTask(taskDescription) {
|
|
106
|
-
return {
|
|
107
|
-
complexity: detectComplexity(taskDescription), // simple, medium, complex
|
|
108
|
-
taskType: detectTaskType(taskDescription), // bugfix, feature, refactor, analysis, etc.
|
|
109
|
-
domain: detectDomain(taskDescription), // frontend, backend, fullstack
|
|
110
|
-
needsExecution: detectExecutionNeed(taskDescription) // analysis-only vs needs-write
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**CLI Tools** (dynamically loaded from cli-tools.json):
|
|
116
|
-
|
|
117
|
-
```javascript
|
|
118
|
-
// Load CLI tools from config file
|
|
119
67
|
const cliConfig = JSON.parse(Read("~/.claude/cli-tools.json"))
|
|
120
68
|
const cliTools = Object.entries(cliConfig.tools)
|
|
121
69
|
.filter(([_, config]) => config.enabled)
|
|
122
70
|
.map(([name, config]) => ({
|
|
123
|
-
name,
|
|
124
|
-
type: 'cli',
|
|
71
|
+
name, type: 'cli',
|
|
125
72
|
tags: config.tags || [],
|
|
126
73
|
model: config.primaryModel,
|
|
127
74
|
toolType: config.type // builtin, cli-wrapper, api-endpoint
|
|
128
75
|
}))
|
|
129
76
|
```
|
|
130
77
|
|
|
131
|
-
**
|
|
132
|
-
|
|
133
|
-
Tags are completely user-defined. Users can create any tags that match their workflow needs.
|
|
134
|
-
|
|
135
|
-
**Config Example** (cli-tools.json):
|
|
136
|
-
```json
|
|
137
|
-
{
|
|
138
|
-
"tools": {
|
|
139
|
-
"gemini": {
|
|
140
|
-
"enabled": true,
|
|
141
|
-
"tags": ["architecture", "reasoning", "performance"],
|
|
142
|
-
"primaryModel": "gemini-2.5-pro"
|
|
143
|
-
},
|
|
144
|
-
"codex": {
|
|
145
|
-
"enabled": true,
|
|
146
|
-
"tags": ["implementation", "fast"],
|
|
147
|
-
"primaryModel": "gpt-5.2"
|
|
148
|
-
},
|
|
149
|
-
"qwen": {
|
|
150
|
-
"enabled": true,
|
|
151
|
-
"tags": ["implementation", "chinese", "documentation"],
|
|
152
|
-
"primaryModel": "coder-model"
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**Sub Agents** (predefined, canExecute marks execution capability):
|
|
159
|
-
|
|
160
|
-
```javascript
|
|
161
|
-
const agents = [
|
|
162
|
-
{ name: 'code-developer', type: 'agent', strength: 'Code implementation, test writing', canExecute: true },
|
|
163
|
-
{ name: 'Explore', type: 'agent', strength: 'Fast code exploration', canExecute: false },
|
|
164
|
-
{ name: 'cli-explore-agent', type: 'agent', strength: 'Dual-source deep analysis', canExecute: false },
|
|
165
|
-
{ name: 'cli-discuss-agent', type: 'agent', strength: 'Multi-CLI collaborative verification', canExecute: false },
|
|
166
|
-
{ name: 'debug-explore-agent', type: 'agent', strength: 'Hypothesis-driven debugging', canExecute: false },
|
|
167
|
-
{ name: 'context-search-agent', type: 'agent', strength: 'Context collection', canExecute: false },
|
|
168
|
-
{ name: 'test-fix-agent', type: 'agent', strength: 'Test execution and fixing', canExecute: true },
|
|
169
|
-
{ name: 'universal-executor', type: 'agent', strength: 'General multi-step execution', canExecute: true }
|
|
170
|
-
]
|
|
171
|
-
```
|
|
78
|
+
**Sub Agents**:
|
|
172
79
|
|
|
173
80
|
| Agent | Strengths | canExecute |
|
|
174
81
|
|-------|-----------|------------|
|
|
175
|
-
| **code-developer** | Code implementation, test writing
|
|
176
|
-
| **Explore** | Fast code exploration,
|
|
177
|
-
| **cli-explore-agent** | Dual-source analysis (Bash+CLI)
|
|
178
|
-
| **cli-discuss-agent** | Multi-CLI collaboration, cross-verification
|
|
179
|
-
| **debug-explore-agent** | Hypothesis-driven debugging
|
|
180
|
-
| **context-search-agent** | Multi-layer file discovery, dependency analysis
|
|
82
|
+
| **code-developer** | Code implementation, test writing | ✅ |
|
|
83
|
+
| **Explore** | Fast code exploration, pattern discovery | ❌ |
|
|
84
|
+
| **cli-explore-agent** | Dual-source analysis (Bash+CLI) | ❌ |
|
|
85
|
+
| **cli-discuss-agent** | Multi-CLI collaboration, cross-verification | ❌ |
|
|
86
|
+
| **debug-explore-agent** | Hypothesis-driven debugging | ❌ |
|
|
87
|
+
| **context-search-agent** | Multi-layer file discovery, dependency analysis | ❌ |
|
|
181
88
|
| **test-fix-agent** | Test execution, failure diagnosis, code fixing | ✅ |
|
|
182
89
|
| **universal-executor** | General execution, multi-domain adaptation | ✅ |
|
|
183
90
|
|
|
184
|
-
**
|
|
91
|
+
**Analysis Modes**:
|
|
185
92
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
93
|
+
| Mode | Pattern | Use Case | minCLIs |
|
|
94
|
+
|------|---------|----------|---------|
|
|
95
|
+
| **Parallel** | `A \|\| B \|\| C → Aggregate` | Fast multi-perspective | 1+ |
|
|
96
|
+
| **Sequential** | `A → B(resume) → C(resume)` | Incremental deepening | 2+ |
|
|
97
|
+
| **Collaborative** | `A → B → A → B → Synthesize` | Multi-round refinement | 2+ |
|
|
98
|
+
| **Debate** | `A(propose) → B(challenge) → A(defend)` | Adversarial validation | 2 |
|
|
99
|
+
| **Challenge** | `A(analyze) → B(challenge)` | Find flaws and risks | 2 |
|
|
191
100
|
|
|
192
|
-
|
|
193
|
-
label: cli.name,
|
|
194
|
-
description: getCliDescription(cli)
|
|
195
|
-
}))
|
|
101
|
+
### Three-Step Selection Flow
|
|
196
102
|
|
|
103
|
+
```javascript
|
|
104
|
+
// Step 1: Select CLIs (multiSelect)
|
|
197
105
|
AskUserQuestion({
|
|
198
106
|
questions: [{
|
|
199
|
-
question: "Select CLI tools for analysis (
|
|
107
|
+
question: "Select CLI tools for analysis (1-3 for collaboration modes)",
|
|
200
108
|
header: "CLI Tools",
|
|
201
|
-
options:
|
|
202
|
-
|
|
109
|
+
options: cliTools.map(cli => ({
|
|
110
|
+
label: cli.name,
|
|
111
|
+
description: cli.tags.length > 0 ? cli.tags.join(', ') : cli.model || 'general'
|
|
112
|
+
})),
|
|
113
|
+
multiSelect: true
|
|
203
114
|
}]
|
|
204
115
|
})
|
|
205
|
-
```
|
|
206
116
|
|
|
207
|
-
|
|
208
|
-
// Step 2: Select Analysis Mode
|
|
209
|
-
const analysisModes = [
|
|
210
|
-
{
|
|
211
|
-
name: 'parallel',
|
|
212
|
-
label: 'Parallel',
|
|
213
|
-
description: 'All CLIs analyze simultaneously, aggregate results',
|
|
214
|
-
minCLIs: 1,
|
|
215
|
-
pattern: 'A || B || C → Aggregate'
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: 'sequential',
|
|
219
|
-
label: 'Sequential',
|
|
220
|
-
description: 'Chain analysis: each CLI builds on previous via --resume',
|
|
221
|
-
minCLIs: 2,
|
|
222
|
-
pattern: 'A → B(resume A) → C(resume B)'
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: 'collaborative',
|
|
226
|
-
label: 'Collaborative',
|
|
227
|
-
description: 'Multi-round synthesis: CLIs take turns refining analysis',
|
|
228
|
-
minCLIs: 2,
|
|
229
|
-
pattern: 'A → B(resume A) → A(resume B) → Synthesize'
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: 'debate',
|
|
233
|
-
label: 'Debate',
|
|
234
|
-
description: 'Adversarial: CLI B challenges CLI A findings, A responds',
|
|
235
|
-
minCLIs: 2,
|
|
236
|
-
pattern: 'A(propose) → B(challenge, resume A) → A(defend, resume B)'
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
name: 'challenge',
|
|
240
|
-
label: 'Challenge',
|
|
241
|
-
description: 'Stress test: CLI B finds flaws/alternatives in CLI A analysis',
|
|
242
|
-
minCLIs: 2,
|
|
243
|
-
pattern: 'A(analyze) → B(challenge, resume A) → Evaluate'
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
|
|
247
|
-
// Filter modes based on selected CLI count
|
|
117
|
+
// Step 2: Select Mode (filtered by CLI count)
|
|
248
118
|
const availableModes = analysisModes.filter(m => selectedCLIs.length >= m.minCLIs)
|
|
249
|
-
|
|
250
119
|
AskUserQuestion({
|
|
251
120
|
questions: [{
|
|
252
121
|
question: "Select analysis mode",
|
|
@@ -258,43 +127,24 @@ AskUserQuestion({
|
|
|
258
127
|
multiSelect: false
|
|
259
128
|
}]
|
|
260
129
|
})
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
```javascript
|
|
264
|
-
// Step 3: Present Agent options for execution
|
|
265
|
-
const agentOptions = agents.map(agent => ({
|
|
266
|
-
label: agent.name,
|
|
267
|
-
description: agent.strength
|
|
268
|
-
}))
|
|
269
130
|
|
|
131
|
+
// Step 3: Select Agent for execution
|
|
270
132
|
AskUserQuestion({
|
|
271
133
|
questions: [{
|
|
272
134
|
question: "Select Sub Agent for execution",
|
|
273
135
|
header: "Agent",
|
|
274
|
-
options:
|
|
136
|
+
options: agents.map(a => ({ label: a.name, description: a.strength })),
|
|
275
137
|
multiSelect: false
|
|
276
138
|
}]
|
|
277
139
|
})
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**Selection Summary**:
|
|
281
|
-
```javascript
|
|
282
|
-
console.log(`
|
|
283
|
-
## Selected Configuration
|
|
284
|
-
|
|
285
|
-
**CLI Tools**: ${selectedCLIs.map(c => c.name).join(' → ')}
|
|
286
|
-
**Analysis Mode**: ${selectedMode.label} - ${selectedMode.pattern}
|
|
287
|
-
**Execution Agent**: ${selectedAgent.name} - ${selectedAgent.strength}
|
|
288
|
-
|
|
289
|
-
> Mode determines how CLIs collaborate, Agent handles final execution
|
|
290
|
-
`)
|
|
291
140
|
|
|
141
|
+
// Confirm selection
|
|
292
142
|
AskUserQuestion({
|
|
293
143
|
questions: [{
|
|
294
144
|
question: "Confirm selection?",
|
|
295
145
|
header: "Confirm",
|
|
296
146
|
options: [
|
|
297
|
-
{ label: "Confirm and continue", description: `${selectedMode.label}
|
|
147
|
+
{ label: "Confirm and continue", description: `${selectedMode.label} with ${selectedCLIs.length} CLIs` },
|
|
298
148
|
{ label: "Re-select CLIs", description: "Choose different CLI tools" },
|
|
299
149
|
{ label: "Re-select Mode", description: "Choose different analysis mode" },
|
|
300
150
|
{ label: "Re-select Agent", description: "Choose different Sub Agent" }
|
|
@@ -304,409 +154,226 @@ AskUserQuestion({
|
|
|
304
154
|
})
|
|
305
155
|
```
|
|
306
156
|
|
|
307
|
-
|
|
157
|
+
## Phase 3: Multi-Mode Analysis
|
|
308
158
|
|
|
309
|
-
|
|
159
|
+
### Universal CLI Prompt Template
|
|
310
160
|
|
|
311
|
-
#### Mode 1: Parallel (并行)
|
|
312
161
|
```javascript
|
|
313
|
-
//
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
TASK: • Identify affected files • Analyze implementation approach • List specific changes needed
|
|
162
|
+
// Unified prompt builder - used by all modes
|
|
163
|
+
function buildPrompt({ purpose, tasks, expected, rules, taskDescription }) {
|
|
164
|
+
return `
|
|
165
|
+
PURPOSE: ${purpose}: ${taskDescription}
|
|
166
|
+
TASK: ${tasks.map(t => `• ${t}`).join(' ')}
|
|
319
167
|
MODE: analysis
|
|
320
168
|
CONTEXT: @**/*
|
|
321
|
-
EXPECTED:
|
|
322
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) |
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}))
|
|
169
|
+
EXPECTED: ${expected}
|
|
170
|
+
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | ${rules}
|
|
171
|
+
`
|
|
172
|
+
}
|
|
326
173
|
|
|
327
|
-
|
|
174
|
+
// Execute CLI with prompt
|
|
175
|
+
function execCLI(cli, prompt, options = {}) {
|
|
176
|
+
const { resume, background = false } = options
|
|
177
|
+
const resumeFlag = resume ? `--resume ${resume}` : ''
|
|
178
|
+
return Bash({
|
|
179
|
+
command: `ccw cli -p "${prompt}" --tool ${cli.name} --mode analysis ${resumeFlag}`,
|
|
180
|
+
run_in_background: background
|
|
181
|
+
})
|
|
328
182
|
}
|
|
329
183
|
```
|
|
330
184
|
|
|
331
|
-
|
|
185
|
+
### Prompt Presets by Role
|
|
186
|
+
|
|
187
|
+
| Role | PURPOSE | TASKS | EXPECTED | RULES |
|
|
188
|
+
|------|---------|-------|----------|-------|
|
|
189
|
+
| **initial** | Initial analysis | Identify files, Analyze approach, List changes | Root cause, files, changes, risks | Focus on actionable insights |
|
|
190
|
+
| **extend** | Build on previous | Review previous, Extend, Add insights | Extended analysis building on findings | Build incrementally, avoid repetition |
|
|
191
|
+
| **synthesize** | Refine and synthesize | Review, Identify gaps, Synthesize | Refined synthesis with new perspectives | Add value not repetition |
|
|
192
|
+
| **propose** | Propose comprehensive analysis | Analyze thoroughly, Propose solution, State assumptions | Well-reasoned proposal with trade-offs | Be clear about assumptions |
|
|
193
|
+
| **challenge** | Challenge and stress-test | Identify weaknesses, Question assumptions, Suggest alternatives | Critique with counter-arguments | Be adversarial but constructive |
|
|
194
|
+
| **defend** | Respond to challenges | Address challenges, Defend valid aspects, Propose refined solution | Refined proposal incorporating feedback | Be open to criticism, synthesize |
|
|
195
|
+
| **criticize** | Find flaws ruthlessly | Find logical flaws, Identify edge cases, Rate criticisms | Critique with severity: [CRITICAL]/[HIGH]/[MEDIUM]/[LOW] | Be ruthlessly critical |
|
|
196
|
+
|
|
332
197
|
```javascript
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
198
|
+
const PROMPTS = {
|
|
199
|
+
initial: { purpose: 'Initial analysis', tasks: ['Identify affected files', 'Analyze implementation approach', 'List specific changes'], expected: 'Root cause, files to modify, key changes, risks', rules: 'Focus on actionable insights' },
|
|
200
|
+
extend: { purpose: 'Build on previous analysis', tasks: ['Review previous findings', 'Extend analysis', 'Add new insights'], expected: 'Extended analysis building on previous', rules: 'Build incrementally, avoid repetition' },
|
|
201
|
+
synthesize: { purpose: 'Refine and synthesize', tasks: ['Review previous', 'Identify gaps', 'Add insights', 'Synthesize findings'], expected: 'Refined synthesis with new perspectives', rules: 'Build collaboratively, add value' },
|
|
202
|
+
propose: { purpose: 'Propose comprehensive analysis', tasks: ['Analyze thoroughly', 'Propose solution', 'State assumptions clearly'], expected: 'Well-reasoned proposal with trade-offs', rules: 'Be clear about assumptions' },
|
|
203
|
+
challenge: { purpose: 'Challenge and stress-test', tasks: ['Identify weaknesses', 'Question assumptions', 'Suggest alternatives', 'Highlight overlooked risks'], expected: 'Constructive critique with counter-arguments', rules: 'Be adversarial but constructive' },
|
|
204
|
+
defend: { purpose: 'Respond to challenges', tasks: ['Address each challenge', 'Defend valid aspects', 'Acknowledge valid criticisms', 'Propose refined solution'], expected: 'Refined proposal incorporating alternatives', rules: 'Be open to criticism, synthesize best ideas' },
|
|
205
|
+
criticize: { purpose: 'Stress-test and find weaknesses', tasks: ['Find logical flaws', 'Identify missed edge cases', 'Propose alternatives', 'Rate criticisms (High/Medium/Low)'], expected: 'Detailed critique with severity ratings', rules: 'Be ruthlessly critical, find every flaw' }
|
|
206
|
+
}
|
|
207
|
+
```
|
|
337
208
|
|
|
338
|
-
|
|
339
|
-
const resumeFlag = previousSessionId ? `--resume ${previousSessionId}` : ''
|
|
209
|
+
### Mode Implementations
|
|
340
210
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | ${previousSessionId ? 'Build incrementally, avoid repetition' : 'Focus on actionable insights'}
|
|
349
|
-
" --tool ${cli.name} --mode analysis ${resumeFlag}`,
|
|
350
|
-
run_in_background: false
|
|
351
|
-
})
|
|
211
|
+
```javascript
|
|
212
|
+
// Parallel: All CLIs run simultaneously
|
|
213
|
+
async function executeParallel(clis, task) {
|
|
214
|
+
return await Promise.all(clis.map(cli =>
|
|
215
|
+
execCLI(cli, buildPrompt({ ...PROMPTS.initial, taskDescription: task }), { background: true })
|
|
216
|
+
))
|
|
217
|
+
}
|
|
352
218
|
|
|
219
|
+
// Sequential: Each CLI builds on previous via --resume
|
|
220
|
+
async function executeSequential(clis, task) {
|
|
221
|
+
const results = []
|
|
222
|
+
let prevId = null
|
|
223
|
+
for (const cli of clis) {
|
|
224
|
+
const preset = prevId ? PROMPTS.extend : PROMPTS.initial
|
|
225
|
+
const result = await execCLI(cli, buildPrompt({ ...preset, taskDescription: task }), { resume: prevId })
|
|
353
226
|
results.push(result)
|
|
354
|
-
|
|
227
|
+
prevId = extractSessionId(result)
|
|
355
228
|
}
|
|
356
|
-
|
|
357
229
|
return results
|
|
358
230
|
}
|
|
359
|
-
```
|
|
360
231
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
// Multi-round synthesis: CLIs take turns refining analysis
|
|
364
|
-
async function executeCollaborative(clis, taskDescription, rounds = 2) {
|
|
232
|
+
// Collaborative: Multi-round synthesis
|
|
233
|
+
async function executeCollaborative(clis, task, rounds = 2) {
|
|
365
234
|
const results = []
|
|
366
|
-
let
|
|
367
|
-
|
|
368
|
-
for (let round = 0; round < rounds; round++) {
|
|
235
|
+
let prevId = null
|
|
236
|
+
for (let r = 0; r < rounds; r++) {
|
|
369
237
|
for (const cli of clis) {
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
command: `ccw cli -p "
|
|
375
|
-
PURPOSE: ${roundContext} for: ${taskDescription}
|
|
376
|
-
TASK: • ${round === 0 ? 'Initial analysis of the problem' : 'Review previous analysis • Identify gaps • Add complementary insights • Synthesize findings'}
|
|
377
|
-
MODE: analysis
|
|
378
|
-
CONTEXT: @**/*
|
|
379
|
-
EXPECTED: ${round === 0 ? 'Foundational analysis' : 'Refined synthesis with new perspectives'}
|
|
380
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | ${round === 0 ? 'Be thorough' : 'Build collaboratively, add value not repetition'}
|
|
381
|
-
" --tool ${cli.name} --mode analysis ${resumeFlag}`,
|
|
382
|
-
run_in_background: false
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
results.push({ cli: cli.name, round, result })
|
|
386
|
-
previousSessionId = extractSessionId(result)
|
|
238
|
+
const preset = !prevId ? PROMPTS.initial : PROMPTS.synthesize
|
|
239
|
+
const result = await execCLI(cli, buildPrompt({ ...preset, taskDescription: task }), { resume: prevId })
|
|
240
|
+
results.push({ cli: cli.name, round: r, result })
|
|
241
|
+
prevId = extractSessionId(result)
|
|
387
242
|
}
|
|
388
243
|
}
|
|
389
|
-
|
|
390
244
|
return results
|
|
391
245
|
}
|
|
392
|
-
```
|
|
393
246
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
// Adversarial: CLI B challenges CLI A findings, A responds
|
|
397
|
-
async function executeDebate(clis, taskDescription) {
|
|
247
|
+
// Debate: Propose → Challenge → Defend
|
|
248
|
+
async function executeDebate(clis, task) {
|
|
398
249
|
const [cliA, cliB] = clis
|
|
399
250
|
const results = []
|
|
400
251
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
command: `ccw cli -p "
|
|
404
|
-
PURPOSE: Propose comprehensive analysis for: ${taskDescription}
|
|
405
|
-
TASK: • Analyze problem thoroughly • Propose solution approach • Identify implementation details • State assumptions clearly
|
|
406
|
-
MODE: analysis
|
|
407
|
-
CONTEXT: @**/*
|
|
408
|
-
EXPECTED: Well-reasoned proposal with clear assumptions and trade-offs stated
|
|
409
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Be clear about assumptions and trade-offs
|
|
410
|
-
" --tool ${cliA.name} --mode analysis`,
|
|
411
|
-
run_in_background: false
|
|
412
|
-
})
|
|
413
|
-
results.push({ phase: 'propose', cli: cliA.name, result: proposeResult })
|
|
414
|
-
const proposeSessionId = extractSessionId(proposeResult)
|
|
252
|
+
const propose = await execCLI(cliA, buildPrompt({ ...PROMPTS.propose, taskDescription: task }))
|
|
253
|
+
results.push({ phase: 'propose', cli: cliA.name, result: propose })
|
|
415
254
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
command: `ccw cli -p "
|
|
419
|
-
PURPOSE: Challenge and stress-test the previous analysis for: ${taskDescription}
|
|
420
|
-
TASK: • Identify weaknesses in proposed approach • Question assumptions • Suggest alternative approaches • Highlight potential risks overlooked
|
|
421
|
-
MODE: analysis
|
|
422
|
-
CONTEXT: @**/*
|
|
423
|
-
EXPECTED: Constructive critique with specific counter-arguments and alternatives
|
|
424
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Be adversarial but constructive, focus on improving the solution
|
|
425
|
-
" --tool ${cliB.name} --mode analysis --resume ${proposeSessionId}`,
|
|
426
|
-
run_in_background: false
|
|
427
|
-
})
|
|
428
|
-
results.push({ phase: 'challenge', cli: cliB.name, result: challengeResult })
|
|
429
|
-
const challengeSessionId = extractSessionId(challengeResult)
|
|
255
|
+
const challenge = await execCLI(cliB, buildPrompt({ ...PROMPTS.challenge, taskDescription: task }), { resume: extractSessionId(propose) })
|
|
256
|
+
results.push({ phase: 'challenge', cli: cliB.name, result: challenge })
|
|
430
257
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
command: `ccw cli -p "
|
|
434
|
-
PURPOSE: Respond to challenges and refine analysis for: ${taskDescription}
|
|
435
|
-
TASK: • Address each challenge point • Defend valid aspects • Acknowledge valid criticisms • Propose refined solution incorporating feedback
|
|
436
|
-
MODE: analysis
|
|
437
|
-
CONTEXT: @**/*
|
|
438
|
-
EXPECTED: Refined proposal that addresses criticisms and incorporates valid alternatives
|
|
439
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Be open to valid criticism, synthesize best ideas
|
|
440
|
-
" --tool ${cliA.name} --mode analysis --resume ${challengeSessionId}`,
|
|
441
|
-
run_in_background: false
|
|
442
|
-
})
|
|
443
|
-
results.push({ phase: 'defend', cli: cliA.name, result: defendResult })
|
|
258
|
+
const defend = await execCLI(cliA, buildPrompt({ ...PROMPTS.defend, taskDescription: task }), { resume: extractSessionId(challenge) })
|
|
259
|
+
results.push({ phase: 'defend', cli: cliA.name, result: defend })
|
|
444
260
|
|
|
445
261
|
return results
|
|
446
262
|
}
|
|
447
|
-
```
|
|
448
263
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
// Stress test: CLI B finds flaws/alternatives in CLI A analysis
|
|
452
|
-
async function executeChallenge(clis, taskDescription) {
|
|
264
|
+
// Challenge: Analyze → Criticize
|
|
265
|
+
async function executeChallenge(clis, task) {
|
|
453
266
|
const [cliA, cliB] = clis
|
|
454
267
|
const results = []
|
|
455
268
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
command: `ccw cli -p "
|
|
459
|
-
PURPOSE: Provide comprehensive analysis for: ${taskDescription}
|
|
460
|
-
TASK: • Deep analysis of problem space • Propose implementation approach • List specific changes • Identify risks
|
|
461
|
-
MODE: analysis
|
|
462
|
-
CONTEXT: @**/*
|
|
463
|
-
EXPECTED: Thorough analysis with clear reasoning
|
|
464
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Be thorough and explicit about reasoning
|
|
465
|
-
" --tool ${cliA.name} --mode analysis`,
|
|
466
|
-
run_in_background: false
|
|
467
|
-
})
|
|
468
|
-
results.push({ phase: 'analyze', cli: cliA.name, result: analyzeResult })
|
|
469
|
-
const analyzeSessionId = extractSessionId(analyzeResult)
|
|
269
|
+
const analyze = await execCLI(cliA, buildPrompt({ ...PROMPTS.initial, taskDescription: task }))
|
|
270
|
+
results.push({ phase: 'analyze', cli: cliA.name, result: analyze })
|
|
470
271
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
command: `ccw cli -p "
|
|
474
|
-
PURPOSE: Stress-test and find weaknesses in the analysis for: ${taskDescription}
|
|
475
|
-
TASK: • Find logical flaws in reasoning • Identify missed edge cases • Propose better alternatives • Rate confidence in each criticism (High/Medium/Low)
|
|
476
|
-
MODE: analysis
|
|
477
|
-
CONTEXT: @**/*
|
|
478
|
-
EXPECTED: Detailed critique with severity ratings: [CRITICAL] [HIGH] [MEDIUM] [LOW] for each issue found
|
|
479
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Be ruthlessly critical, find every possible flaw
|
|
480
|
-
" --tool ${cliB.name} --mode analysis --resume ${analyzeSessionId}`,
|
|
481
|
-
run_in_background: false
|
|
482
|
-
})
|
|
483
|
-
results.push({ phase: 'challenge', cli: cliB.name, result: challengeResult })
|
|
272
|
+
const criticize = await execCLI(cliB, buildPrompt({ ...PROMPTS.criticize, taskDescription: task }), { resume: extractSessionId(analyze) })
|
|
273
|
+
results.push({ phase: 'challenge', cli: cliB.name, result: criticize })
|
|
484
274
|
|
|
485
275
|
return results
|
|
486
276
|
}
|
|
487
277
|
```
|
|
488
278
|
|
|
489
|
-
|
|
279
|
+
### Mode Router & Result Aggregation
|
|
280
|
+
|
|
490
281
|
```javascript
|
|
491
282
|
async function executeAnalysis(mode, clis, taskDescription) {
|
|
492
283
|
switch (mode.name) {
|
|
493
|
-
case 'parallel':
|
|
494
|
-
|
|
495
|
-
case '
|
|
496
|
-
|
|
497
|
-
case '
|
|
498
|
-
return await executeCollaborative(clis, taskDescription)
|
|
499
|
-
case 'debate':
|
|
500
|
-
return await executeDebate(clis, taskDescription)
|
|
501
|
-
case 'challenge':
|
|
502
|
-
return await executeChallenge(clis, taskDescription)
|
|
503
|
-
default:
|
|
504
|
-
return await executeParallel(clis, taskDescription)
|
|
284
|
+
case 'parallel': return await executeParallel(clis, taskDescription)
|
|
285
|
+
case 'sequential': return await executeSequential(clis, taskDescription)
|
|
286
|
+
case 'collaborative': return await executeCollaborative(clis, taskDescription)
|
|
287
|
+
case 'debate': return await executeDebate(clis, taskDescription)
|
|
288
|
+
case 'challenge': return await executeChallenge(clis, taskDescription)
|
|
505
289
|
}
|
|
506
290
|
}
|
|
507
291
|
|
|
508
|
-
// Execute based on selected mode
|
|
509
|
-
const analysisResults = await executeAnalysis(selectedMode, selectedCLIs, taskDescription)
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
**Result Aggregation** (mode-aware):
|
|
513
|
-
```javascript
|
|
514
292
|
function aggregateResults(mode, results) {
|
|
515
|
-
const base = {
|
|
516
|
-
mode: mode.name,
|
|
517
|
-
pattern: mode.pattern,
|
|
518
|
-
tools_used: results.map(r => r.cli || 'unknown')
|
|
519
|
-
}
|
|
293
|
+
const base = { mode: mode.name, pattern: mode.pattern, tools_used: results.map(r => r.cli || 'unknown') }
|
|
520
294
|
|
|
521
295
|
switch (mode.name) {
|
|
522
296
|
case 'parallel':
|
|
523
|
-
return {
|
|
524
|
-
...base,
|
|
525
|
-
findings: results.map(r => parseOutput(r)),
|
|
526
|
-
consensus: findCommonPoints(results),
|
|
527
|
-
divergences: findDifferences(results)
|
|
528
|
-
}
|
|
529
|
-
|
|
297
|
+
return { ...base, findings: results.map(parseOutput), consensus: findCommonPoints(results), divergences: findDifferences(results) }
|
|
530
298
|
case 'sequential':
|
|
531
|
-
return {
|
|
532
|
-
...base,
|
|
533
|
-
evolution: results.map((r, i) => ({ step: i + 1, analysis: parseOutput(r) })),
|
|
534
|
-
finalAnalysis: parseOutput(results[results.length - 1])
|
|
535
|
-
}
|
|
536
|
-
|
|
299
|
+
return { ...base, evolution: results.map((r, i) => ({ step: i + 1, analysis: parseOutput(r) })), finalAnalysis: parseOutput(results.at(-1)) }
|
|
537
300
|
case 'collaborative':
|
|
538
|
-
return {
|
|
539
|
-
...base,
|
|
540
|
-
rounds: groupByRound(results),
|
|
541
|
-
synthesis: extractSynthesis(results[results.length - 1])
|
|
542
|
-
}
|
|
543
|
-
|
|
301
|
+
return { ...base, rounds: groupByRound(results), synthesis: extractSynthesis(results.at(-1)) }
|
|
544
302
|
case 'debate':
|
|
545
|
-
return {
|
|
546
|
-
...base,
|
|
547
|
-
proposal: parseOutput(results.find(r => r.phase === 'propose')?.result),
|
|
303
|
+
return { ...base, proposal: parseOutput(results.find(r => r.phase === 'propose')?.result),
|
|
548
304
|
challenges: parseOutput(results.find(r => r.phase === 'challenge')?.result),
|
|
549
|
-
resolution: parseOutput(results.find(r => r.phase === 'defend')?.result),
|
|
550
|
-
confidence: calculateDebateConfidence(results)
|
|
551
|
-
}
|
|
552
|
-
|
|
305
|
+
resolution: parseOutput(results.find(r => r.phase === 'defend')?.result), confidence: calculateDebateConfidence(results) }
|
|
553
306
|
case 'challenge':
|
|
554
|
-
return {
|
|
555
|
-
|
|
556
|
-
originalAnalysis: parseOutput(results.find(r => r.phase === 'analyze')?.result),
|
|
557
|
-
critiques: parseCritiques(results.find(r => r.phase === 'challenge')?.result),
|
|
558
|
-
riskScore: calculateRiskScore(results)
|
|
559
|
-
}
|
|
307
|
+
return { ...base, originalAnalysis: parseOutput(results.find(r => r.phase === 'analyze')?.result),
|
|
308
|
+
critiques: parseCritiques(results.find(r => r.phase === 'challenge')?.result), riskScore: calculateRiskScore(results) }
|
|
560
309
|
}
|
|
561
310
|
}
|
|
562
|
-
|
|
563
|
-
const aggregatedAnalysis = aggregateResults(selectedMode, analysisResults)
|
|
564
311
|
```
|
|
565
312
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
**Present Mode-Specific Summary**:
|
|
313
|
+
## Phase 4: User Decision
|
|
569
314
|
|
|
570
315
|
```javascript
|
|
571
|
-
function presentSummary(
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
console.log(`
|
|
575
|
-
## Analysis Result Summary
|
|
316
|
+
function presentSummary(analysis) {
|
|
317
|
+
console.log(`## Analysis Result\n**Mode**: ${analysis.mode} (${analysis.pattern})\n**Tools**: ${analysis.tools_used.join(' → ')}`)
|
|
576
318
|
|
|
577
|
-
|
|
578
|
-
**Tools**: ${aggregatedAnalysis.tools_used.join(' → ')}
|
|
579
|
-
`)
|
|
580
|
-
|
|
581
|
-
switch (mode) {
|
|
319
|
+
switch (analysis.mode) {
|
|
582
320
|
case 'parallel':
|
|
583
|
-
console.log(`
|
|
584
|
-
### Consensus Points
|
|
585
|
-
${aggregatedAnalysis.consensus.map(c => `- ${c}`).join('\n')}
|
|
586
|
-
|
|
587
|
-
### Divergence Points
|
|
588
|
-
${aggregatedAnalysis.divergences.map(d => `- ${d}`).join('\n')}
|
|
589
|
-
`)
|
|
321
|
+
console.log(`### Consensus\n${analysis.consensus.map(c => `- ${c}`).join('\n')}\n### Divergences\n${analysis.divergences.map(d => `- ${d}`).join('\n')}`)
|
|
590
322
|
break
|
|
591
|
-
|
|
592
323
|
case 'sequential':
|
|
593
|
-
console.log(`
|
|
594
|
-
### Analysis Evolution
|
|
595
|
-
${aggregatedAnalysis.evolution.map(e => `**Step ${e.step}**: ${e.analysis.summary}`).join('\n')}
|
|
596
|
-
|
|
597
|
-
### Final Analysis
|
|
598
|
-
${aggregatedAnalysis.finalAnalysis.summary}
|
|
599
|
-
`)
|
|
324
|
+
console.log(`### Evolution\n${analysis.evolution.map(e => `**Step ${e.step}**: ${e.analysis.summary}`).join('\n')}\n### Final\n${analysis.finalAnalysis.summary}`)
|
|
600
325
|
break
|
|
601
|
-
|
|
602
326
|
case 'collaborative':
|
|
603
|
-
console.log(`
|
|
604
|
-
### Collaboration Rounds
|
|
605
|
-
${Object.entries(aggregatedAnalysis.rounds).map(([round, analyses]) =>
|
|
606
|
-
`**Round ${round}**: ${analyses.map(a => a.cli).join(' + ')}`
|
|
607
|
-
).join('\n')}
|
|
608
|
-
|
|
609
|
-
### Synthesized Result
|
|
610
|
-
${aggregatedAnalysis.synthesis}
|
|
611
|
-
`)
|
|
327
|
+
console.log(`### Rounds\n${Object.entries(analysis.rounds).map(([r, a]) => `**Round ${r}**: ${a.map(x => x.cli).join(' + ')}`).join('\n')}\n### Synthesis\n${analysis.synthesis}`)
|
|
612
328
|
break
|
|
613
|
-
|
|
614
329
|
case 'debate':
|
|
615
|
-
console.log(
|
|
616
|
-
### Debate Summary
|
|
617
|
-
**Proposal**: ${aggregatedAnalysis.proposal.summary}
|
|
618
|
-
**Challenges**: ${aggregatedAnalysis.challenges.points?.length || 0} points raised
|
|
619
|
-
**Resolution**: ${aggregatedAnalysis.resolution.summary}
|
|
620
|
-
**Confidence**: ${aggregatedAnalysis.confidence}%
|
|
621
|
-
`)
|
|
330
|
+
console.log(`### Debate\n**Proposal**: ${analysis.proposal.summary}\n**Challenges**: ${analysis.challenges.points?.length || 0} points\n**Resolution**: ${analysis.resolution.summary}\n**Confidence**: ${analysis.confidence}%`)
|
|
622
331
|
break
|
|
623
|
-
|
|
624
332
|
case 'challenge':
|
|
625
|
-
console.log(`
|
|
626
|
-
### Challenge Summary
|
|
627
|
-
**Original Analysis**: ${aggregatedAnalysis.originalAnalysis.summary}
|
|
628
|
-
**Critiques Found**: ${aggregatedAnalysis.critiques.length} issues
|
|
629
|
-
${aggregatedAnalysis.critiques.map(c => `- [${c.severity}] ${c.description}`).join('\n')}
|
|
630
|
-
**Risk Score**: ${aggregatedAnalysis.riskScore}/100
|
|
631
|
-
`)
|
|
333
|
+
console.log(`### Challenge\n**Original**: ${analysis.originalAnalysis.summary}\n**Critiques**: ${analysis.critiques.length} issues\n${analysis.critiques.map(c => `- [${c.severity}] ${c.description}`).join('\n')}\n**Risk Score**: ${analysis.riskScore}/100`)
|
|
632
334
|
break
|
|
633
335
|
}
|
|
634
336
|
}
|
|
635
337
|
|
|
636
|
-
presentSummary(aggregatedAnalysis)
|
|
637
|
-
```
|
|
638
|
-
|
|
639
|
-
**Decision Options**:
|
|
640
|
-
```javascript
|
|
641
338
|
AskUserQuestion({
|
|
642
339
|
questions: [{
|
|
643
340
|
question: "How to proceed?",
|
|
644
341
|
header: "Next Step",
|
|
645
342
|
options: [
|
|
646
|
-
{ label: "Execute directly", description: "Implement immediately
|
|
647
|
-
{ label: "Refine analysis", description: "
|
|
648
|
-
{ label: "Change tools", description: "
|
|
649
|
-
{ label: "Cancel", description: "End
|
|
343
|
+
{ label: "Execute directly", description: "Implement immediately" },
|
|
344
|
+
{ label: "Refine analysis", description: "Add constraints, re-analyze" },
|
|
345
|
+
{ label: "Change tools", description: "Different tool combination" },
|
|
346
|
+
{ label: "Cancel", description: "End workflow" }
|
|
650
347
|
],
|
|
651
348
|
multiSelect: false
|
|
652
349
|
}]
|
|
653
350
|
})
|
|
351
|
+
// Routing: Execute → Phase 5 | Refine → Phase 3 | Change → Phase 2 | Cancel → End
|
|
654
352
|
```
|
|
655
353
|
|
|
656
|
-
|
|
657
|
-
- **Execute directly** → Phase 5
|
|
658
|
-
- **Refine analysis** → Collect feedback, return to Phase 3
|
|
659
|
-
- **Change tools** → Return to Phase 2
|
|
660
|
-
- **Cancel** → End workflow
|
|
661
|
-
|
|
662
|
-
### Phase 5: Direct Execution
|
|
354
|
+
## Phase 5: Direct Execution
|
|
663
355
|
|
|
664
|
-
**No Artifacts - Direct Implementation**:
|
|
665
356
|
```javascript
|
|
666
|
-
//
|
|
667
|
-
// No IMPL_PLAN.md, no plan.json, no session files
|
|
668
|
-
|
|
669
|
-
console.log("Starting direct execution based on analysis...")
|
|
670
|
-
|
|
671
|
-
// Execution-capable agents (canExecute: true)
|
|
357
|
+
// No IMPL_PLAN.md, no plan.json - direct implementation
|
|
672
358
|
const executionAgents = agents.filter(a => a.canExecute)
|
|
673
|
-
|
|
674
|
-
// Select execution tool: prefer execution-capable agent, fallback to CLI
|
|
675
|
-
const executionTool = selectedTools.find(t =>
|
|
676
|
-
t.type === 'agent' && executionAgents.some(ea => ea.name === t.name)
|
|
677
|
-
) || selectedTools.find(t => t.type === 'cli')
|
|
359
|
+
const executionTool = selectedAgent.canExecute ? selectedAgent : selectedCLIs[0]
|
|
678
360
|
|
|
679
361
|
if (executionTool.type === 'agent') {
|
|
680
|
-
// Use Agent for execution (preferred if available)
|
|
681
362
|
Task({
|
|
682
363
|
subagent_type: executionTool.name,
|
|
683
364
|
run_in_background: false,
|
|
684
365
|
description: `Execute: ${taskDescription.slice(0, 30)}`,
|
|
685
|
-
prompt: `
|
|
686
|
-
## Task
|
|
687
|
-
${taskDescription}
|
|
688
|
-
|
|
689
|
-
## Analysis Results (from previous tools)
|
|
690
|
-
${JSON.stringify(aggregatedAnalysis, null, 2)}
|
|
691
|
-
|
|
692
|
-
## Instructions
|
|
693
|
-
Based on the analysis above, implement the solution:
|
|
694
|
-
1. Apply changes to identified files
|
|
695
|
-
2. Follow the recommended approach
|
|
696
|
-
3. Handle identified risks
|
|
697
|
-
4. Verify changes work correctly
|
|
698
|
-
`
|
|
366
|
+
prompt: `## Task\n${taskDescription}\n\n## Analysis Results\n${JSON.stringify(aggregatedAnalysis, null, 2)}\n\n## Instructions\n1. Apply changes to identified files\n2. Follow recommended approach\n3. Handle identified risks\n4. Verify changes work correctly`
|
|
699
367
|
})
|
|
700
368
|
} else {
|
|
701
|
-
// Use CLI with write mode
|
|
702
369
|
Bash({
|
|
703
370
|
command: `ccw cli -p "
|
|
704
|
-
PURPOSE: Implement
|
|
371
|
+
PURPOSE: Implement solution: ${taskDescription}
|
|
705
372
|
TASK: ${extractedTasks.join(' • ')}
|
|
706
373
|
MODE: write
|
|
707
374
|
CONTEXT: @${affectedFiles.join(' @')}
|
|
708
375
|
EXPECTED: Working implementation with all changes applied
|
|
709
|
-
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md)
|
|
376
|
+
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md)
|
|
710
377
|
" --tool ${executionTool.name} --mode write`,
|
|
711
378
|
run_in_background: false
|
|
712
379
|
})
|
|
@@ -718,81 +385,49 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) | Ap
|
|
|
718
385
|
```javascript
|
|
719
386
|
TodoWrite({ todos: [
|
|
720
387
|
{ content: "Phase 1: Clarify requirements", status: "in_progress", activeForm: "Clarifying requirements" },
|
|
721
|
-
{ content: "Phase 2:
|
|
722
|
-
{ content: "Phase 3:
|
|
388
|
+
{ content: "Phase 2: Select tools", status: "pending", activeForm: "Selecting tools" },
|
|
389
|
+
{ content: "Phase 3: Multi-mode analysis", status: "pending", activeForm: "Running analysis" },
|
|
723
390
|
{ content: "Phase 4: User decision", status: "pending", activeForm: "Awaiting decision" },
|
|
724
|
-
{ content: "Phase 5: Direct execution", status: "pending", activeForm: "Executing
|
|
391
|
+
{ content: "Phase 5: Direct execution", status: "pending", activeForm: "Executing" }
|
|
725
392
|
]})
|
|
726
393
|
```
|
|
727
394
|
|
|
728
395
|
## Iteration Patterns
|
|
729
396
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
Phase 1 →
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
### Pattern B: Refinement Loop
|
|
736
|
-
```
|
|
737
|
-
Phase 3 → Phase 4 (refine) → Phase 3 → Phase 4 → Phase 5
|
|
738
|
-
```
|
|
739
|
-
|
|
740
|
-
### Pattern C: Tool Adjustment
|
|
741
|
-
```
|
|
742
|
-
Phase 2 (adjust) → Phase 3 → Phase 4 → Phase 5
|
|
743
|
-
```
|
|
397
|
+
| Pattern | Flow |
|
|
398
|
+
|---------|------|
|
|
399
|
+
| **Direct** | Phase 1 → 2 → 3 → 4(execute) → 5 |
|
|
400
|
+
| **Refinement** | Phase 3 → 4(refine) → 3 → 4 → 5 |
|
|
401
|
+
| **Tool Adjust** | Phase 2(adjust) → 3 → 4 → 5 |
|
|
744
402
|
|
|
745
403
|
## Error Handling
|
|
746
404
|
|
|
747
405
|
| Error | Resolution |
|
|
748
406
|
|-------|------------|
|
|
749
407
|
| CLI timeout | Retry with secondary model |
|
|
750
|
-
| No enabled tools |
|
|
751
|
-
| Task
|
|
408
|
+
| No enabled tools | Ask user to enable tools in cli-tools.json |
|
|
409
|
+
| Task unclear | Default to first CLI + code-developer |
|
|
752
410
|
| Ambiguous task | Force clarification via AskUser |
|
|
753
411
|
| Execution fails | Present error, ask user for direction |
|
|
754
412
|
|
|
755
|
-
##
|
|
756
|
-
|
|
757
|
-
| Mode | Pattern | Use Case | CLI Count |
|
|
758
|
-
|------|---------|----------|-----------|
|
|
759
|
-
| **Parallel** | `A \|\| B \|\| C → Aggregate` | Fast multi-perspective analysis | 1+ |
|
|
760
|
-
| **Sequential** | `A → B(resume) → C(resume)` | Deep incremental analysis | 2+ |
|
|
761
|
-
| **Collaborative** | `A → B → A → B → Synthesize` | Multi-round refinement | 2+ |
|
|
762
|
-
| **Debate** | `A(propose) → B(challenge) → A(defend)` | Stress-test solutions | 2 |
|
|
763
|
-
| **Challenge** | `A(analyze) → B(challenge)` | Find flaws and risks | 2 |
|
|
764
|
-
|
|
765
|
-
## Comparison
|
|
413
|
+
## Comparison with multi-cli-plan
|
|
766
414
|
|
|
767
415
|
| Aspect | lite-lite-lite | multi-cli-plan |
|
|
768
416
|
|--------|----------------|----------------|
|
|
769
417
|
| **Artifacts** | None | IMPL_PLAN.md, plan.json, synthesis.json |
|
|
770
|
-
| **Session** | Stateless (
|
|
771
|
-
| **Tool Selection** |
|
|
772
|
-
| **Analysis Modes** | 5 modes
|
|
773
|
-
| **
|
|
774
|
-
| **Iteration** | Via AskUser | Via rounds/synthesis |
|
|
775
|
-
| **Execution** | Direct | Via lite-execute |
|
|
776
|
-
| **Best For** | Quick analysis, adversarial validation, rapid iteration | Complex multi-step implementations |
|
|
777
|
-
|
|
778
|
-
## Best Practices
|
|
779
|
-
|
|
780
|
-
1. **Be Specific**: Clear task description improves auto-selection accuracy
|
|
781
|
-
2. **Trust Auto-Selection**: Algorithm matches task type to tool strengths
|
|
782
|
-
3. **Adjust When Needed**: Use "Adjust tools" if auto-selection doesn't fit
|
|
783
|
-
4. **Trust Consensus**: When tools agree, confidence is high
|
|
784
|
-
5. **Iterate Fast**: Use refinement loop for complex requirements
|
|
785
|
-
6. **Direct is Fast**: Skip artifacts when task is straightforward
|
|
418
|
+
| **Session** | Stateless (--resume chaining) | Persistent session folder |
|
|
419
|
+
| **Tool Selection** | 3-step (CLI → Mode → Agent) | Config-driven fixed tools |
|
|
420
|
+
| **Analysis Modes** | 5 modes with --resume | Fixed synthesis rounds |
|
|
421
|
+
| **Best For** | Quick analysis, adversarial validation | Complex multi-step implementations |
|
|
786
422
|
|
|
787
|
-
##
|
|
423
|
+
## Post-Completion Expansion
|
|
788
424
|
|
|
789
|
-
|
|
790
|
-
# Full planning workflow
|
|
791
|
-
/workflow:multi-cli-plan "complex task"
|
|
425
|
+
完成后询问用户是否扩展为issue(test/enhance/refactor/doc),选中项调用 `/issue:new "{summary} - {dimension}"`
|
|
792
426
|
|
|
793
|
-
|
|
794
|
-
/workflow:lite-plan "task"
|
|
427
|
+
## Related Commands
|
|
795
428
|
|
|
796
|
-
|
|
797
|
-
/workflow:
|
|
429
|
+
```bash
|
|
430
|
+
/workflow:multi-cli-plan "complex task" # Full planning workflow
|
|
431
|
+
/workflow:lite-plan "task" # Single CLI planning
|
|
432
|
+
/workflow:lite-execute --in-memory # Direct execution
|
|
798
433
|
```
|