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,798 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow:lite-lite-lite
|
|
3
|
+
description: Ultra-lightweight multi-tool analysis and direct execution. No artifacts, auto tool selection based on task analysis, user-driven iteration via AskUser.
|
|
4
|
+
argument-hint: "<task description>"
|
|
5
|
+
allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Bash(*), mcp__ace-tool__search_context(*)
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Ultra-Lite Multi-Tool Workflow
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Basic usage
|
|
14
|
+
/workflow:lite-lite-lite "Fix the login bug"
|
|
15
|
+
|
|
16
|
+
# Complex task
|
|
17
|
+
/workflow:lite-lite-lite "Refactor payment module for multi-gateway support"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Core Philosophy**: Minimal friction, maximum velocity. No files, no artifacts - just analyze and execute.
|
|
21
|
+
|
|
22
|
+
## What & Why
|
|
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.
|
|
27
|
+
|
|
28
|
+
**vs multi-cli-plan**:
|
|
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
|
|
31
|
+
|
|
32
|
+
### Value Proposition
|
|
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
|
|
38
|
+
|
|
39
|
+
## Execution Flow
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Phase 1: Clarify Requirements
|
|
43
|
+
└─ Parse input → AskUser for missing details (if needed)
|
|
44
|
+
|
|
45
|
+
Phase 2: Auto-Select Tools
|
|
46
|
+
└─ Analyze task → Match to tool strengths → Confirm selection
|
|
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)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Phase Details
|
|
61
|
+
|
|
62
|
+
### Phase 1: Clarify Requirements
|
|
63
|
+
|
|
64
|
+
**Parse Task Description**:
|
|
65
|
+
```javascript
|
|
66
|
+
// Extract intent from user input
|
|
67
|
+
const taskDescription = $ARGUMENTS
|
|
68
|
+
|
|
69
|
+
// Check if clarification needed
|
|
70
|
+
if (taskDescription.length < 20 || isAmbiguous(taskDescription)) {
|
|
71
|
+
AskUserQuestion({
|
|
72
|
+
questions: [{
|
|
73
|
+
question: "Please provide more details: target files/modules, expected behavior, constraints?",
|
|
74
|
+
header: "Details",
|
|
75
|
+
options: [
|
|
76
|
+
{ label: "I'll provide more", description: "Add more context" },
|
|
77
|
+
{ label: "Continue analysis", description: "Let tools explore autonomously" }
|
|
78
|
+
],
|
|
79
|
+
multiSelect: false
|
|
80
|
+
}]
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Quick ACE Context** (optional, for complex tasks):
|
|
86
|
+
```javascript
|
|
87
|
+
// Only if task seems to need codebase context
|
|
88
|
+
mcp__ace-tool__search_context({
|
|
89
|
+
project_root_path: process.cwd(),
|
|
90
|
+
query: `${taskDescription} implementation patterns`
|
|
91
|
+
})
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Phase 2: Auto-Select Analysis Tools
|
|
95
|
+
|
|
96
|
+
**Tool Categories**:
|
|
97
|
+
|
|
98
|
+
| Category | Source | Execution |
|
|
99
|
+
|----------|--------|-----------|
|
|
100
|
+
| **CLI Tools** | cli-tools.json | `ccw cli -p "..." --tool <name>` |
|
|
101
|
+
| **Sub Agents** | Task tool | `Task({ subagent_type: "...", prompt: "..." })` |
|
|
102
|
+
|
|
103
|
+
**Task Analysis Dimensions**:
|
|
104
|
+
```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
|
+
const cliConfig = JSON.parse(Read("~/.claude/cli-tools.json"))
|
|
120
|
+
const cliTools = Object.entries(cliConfig.tools)
|
|
121
|
+
.filter(([_, config]) => config.enabled)
|
|
122
|
+
.map(([name, config]) => ({
|
|
123
|
+
name,
|
|
124
|
+
type: 'cli',
|
|
125
|
+
tags: config.tags || [],
|
|
126
|
+
model: config.primaryModel,
|
|
127
|
+
toolType: config.type // builtin, cli-wrapper, api-endpoint
|
|
128
|
+
}))
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Tags** (user-defined in cli-tools.json, no fixed specification):
|
|
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
|
+
```
|
|
172
|
+
|
|
173
|
+
| Agent | Strengths | canExecute |
|
|
174
|
+
|-------|-----------|------------|
|
|
175
|
+
| **code-developer** | Code implementation, test writing, incremental development | ✅ |
|
|
176
|
+
| **Explore** | Fast code exploration, file search, pattern discovery | ❌ |
|
|
177
|
+
| **cli-explore-agent** | Dual-source analysis (Bash+CLI), read-only exploration | ❌ |
|
|
178
|
+
| **cli-discuss-agent** | Multi-CLI collaboration, cross-verification, solution synthesis | ❌ |
|
|
179
|
+
| **debug-explore-agent** | Hypothesis-driven debugging, NDJSON logging, iterative verification | ❌ |
|
|
180
|
+
| **context-search-agent** | Multi-layer file discovery, dependency analysis, conflict assessment | ❌ |
|
|
181
|
+
| **test-fix-agent** | Test execution, failure diagnosis, code fixing | ✅ |
|
|
182
|
+
| **universal-executor** | General execution, multi-domain adaptation | ✅ |
|
|
183
|
+
|
|
184
|
+
**Three-Step Selection Flow** (CLI → Mode → Agent):
|
|
185
|
+
|
|
186
|
+
```javascript
|
|
187
|
+
// Step 1: Present CLI options from config (multiSelect for multi-CLI modes)
|
|
188
|
+
function getCliDescription(cli) {
|
|
189
|
+
return cli.tags.length > 0 ? cli.tags.join(', ') : cli.model || 'general'
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const cliOptions = cliTools.map(cli => ({
|
|
193
|
+
label: cli.name,
|
|
194
|
+
description: getCliDescription(cli)
|
|
195
|
+
}))
|
|
196
|
+
|
|
197
|
+
AskUserQuestion({
|
|
198
|
+
questions: [{
|
|
199
|
+
question: "Select CLI tools for analysis (select 1-3 for collaboration modes)",
|
|
200
|
+
header: "CLI Tools",
|
|
201
|
+
options: cliOptions,
|
|
202
|
+
multiSelect: true // Allow multiple selection for collaboration modes
|
|
203
|
+
}]
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
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
|
|
248
|
+
const availableModes = analysisModes.filter(m => selectedCLIs.length >= m.minCLIs)
|
|
249
|
+
|
|
250
|
+
AskUserQuestion({
|
|
251
|
+
questions: [{
|
|
252
|
+
question: "Select analysis mode",
|
|
253
|
+
header: "Mode",
|
|
254
|
+
options: availableModes.map(m => ({
|
|
255
|
+
label: m.label,
|
|
256
|
+
description: `${m.description} [${m.pattern}]`
|
|
257
|
+
})),
|
|
258
|
+
multiSelect: false
|
|
259
|
+
}]
|
|
260
|
+
})
|
|
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
|
+
|
|
270
|
+
AskUserQuestion({
|
|
271
|
+
questions: [{
|
|
272
|
+
question: "Select Sub Agent for execution",
|
|
273
|
+
header: "Agent",
|
|
274
|
+
options: agentOptions,
|
|
275
|
+
multiSelect: false
|
|
276
|
+
}]
|
|
277
|
+
})
|
|
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
|
+
|
|
292
|
+
AskUserQuestion({
|
|
293
|
+
questions: [{
|
|
294
|
+
question: "Confirm selection?",
|
|
295
|
+
header: "Confirm",
|
|
296
|
+
options: [
|
|
297
|
+
{ label: "Confirm and continue", description: `${selectedMode.label} mode with ${selectedCLIs.length} CLIs` },
|
|
298
|
+
{ label: "Re-select CLIs", description: "Choose different CLI tools" },
|
|
299
|
+
{ label: "Re-select Mode", description: "Choose different analysis mode" },
|
|
300
|
+
{ label: "Re-select Agent", description: "Choose different Sub Agent" }
|
|
301
|
+
],
|
|
302
|
+
multiSelect: false
|
|
303
|
+
}]
|
|
304
|
+
})
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Phase 3: Multi-Mode Analysis
|
|
308
|
+
|
|
309
|
+
**Mode-Specific Execution Patterns**:
|
|
310
|
+
|
|
311
|
+
#### Mode 1: Parallel (并行)
|
|
312
|
+
```javascript
|
|
313
|
+
// All CLIs run simultaneously, no resume dependency
|
|
314
|
+
async function executeParallel(clis, taskDescription) {
|
|
315
|
+
const promises = clis.map(cli => Bash({
|
|
316
|
+
command: `ccw cli -p "
|
|
317
|
+
PURPOSE: Analyze and provide solution for: ${taskDescription}
|
|
318
|
+
TASK: • Identify affected files • Analyze implementation approach • List specific changes needed
|
|
319
|
+
MODE: analysis
|
|
320
|
+
CONTEXT: @**/*
|
|
321
|
+
EXPECTED: Concise analysis with: 1) Root cause/approach 2) Files to modify 3) Key changes 4) Risks
|
|
322
|
+
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Focus on actionable insights
|
|
323
|
+
" --tool ${cli.name} --mode analysis`,
|
|
324
|
+
run_in_background: true
|
|
325
|
+
}))
|
|
326
|
+
|
|
327
|
+
return await Promise.all(promises)
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
#### Mode 2: Sequential (串联)
|
|
332
|
+
```javascript
|
|
333
|
+
// Chain analysis: each CLI builds on previous via --resume
|
|
334
|
+
async function executeSequential(clis, taskDescription) {
|
|
335
|
+
const results = []
|
|
336
|
+
let previousSessionId = null
|
|
337
|
+
|
|
338
|
+
for (const cli of clis) {
|
|
339
|
+
const resumeFlag = previousSessionId ? `--resume ${previousSessionId}` : ''
|
|
340
|
+
|
|
341
|
+
const result = await Bash({
|
|
342
|
+
command: `ccw cli -p "
|
|
343
|
+
PURPOSE: ${previousSessionId ? 'Build on previous analysis and deepen' : 'Initial analysis'}: ${taskDescription}
|
|
344
|
+
TASK: • ${previousSessionId ? 'Review previous findings • Extend analysis • Add new insights' : 'Identify affected files • Analyze implementation approach'}
|
|
345
|
+
MODE: analysis
|
|
346
|
+
CONTEXT: @**/*
|
|
347
|
+
EXPECTED: ${previousSessionId ? 'Extended analysis building on previous findings' : 'Initial analysis with root cause and approach'}
|
|
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
|
+
})
|
|
352
|
+
|
|
353
|
+
results.push(result)
|
|
354
|
+
previousSessionId = extractSessionId(result) // Extract session ID for next iteration
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return results
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
#### Mode 3: Collaborative (协同)
|
|
362
|
+
```javascript
|
|
363
|
+
// Multi-round synthesis: CLIs take turns refining analysis
|
|
364
|
+
async function executeCollaborative(clis, taskDescription, rounds = 2) {
|
|
365
|
+
const results = []
|
|
366
|
+
let previousSessionId = null
|
|
367
|
+
|
|
368
|
+
for (let round = 0; round < rounds; round++) {
|
|
369
|
+
for (const cli of clis) {
|
|
370
|
+
const resumeFlag = previousSessionId ? `--resume ${previousSessionId}` : ''
|
|
371
|
+
const roundContext = round === 0 ? 'Initial analysis' : `Round ${round + 1}: Refine and synthesize`
|
|
372
|
+
|
|
373
|
+
const result = await Bash({
|
|
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)
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return results
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### Mode 4: Debate (辩论)
|
|
395
|
+
```javascript
|
|
396
|
+
// Adversarial: CLI B challenges CLI A findings, A responds
|
|
397
|
+
async function executeDebate(clis, taskDescription) {
|
|
398
|
+
const [cliA, cliB] = clis
|
|
399
|
+
const results = []
|
|
400
|
+
|
|
401
|
+
// Step 1: CLI A proposes initial analysis
|
|
402
|
+
const proposeResult = await Bash({
|
|
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)
|
|
415
|
+
|
|
416
|
+
// Step 2: CLI B challenges the proposal
|
|
417
|
+
const challengeResult = await Bash({
|
|
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)
|
|
430
|
+
|
|
431
|
+
// Step 3: CLI A defends and refines
|
|
432
|
+
const defendResult = await Bash({
|
|
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 })
|
|
444
|
+
|
|
445
|
+
return results
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
#### Mode 5: Challenge (挑战)
|
|
450
|
+
```javascript
|
|
451
|
+
// Stress test: CLI B finds flaws/alternatives in CLI A analysis
|
|
452
|
+
async function executeChallenge(clis, taskDescription) {
|
|
453
|
+
const [cliA, cliB] = clis
|
|
454
|
+
const results = []
|
|
455
|
+
|
|
456
|
+
// Step 1: CLI A provides initial analysis
|
|
457
|
+
const analyzeResult = await Bash({
|
|
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)
|
|
470
|
+
|
|
471
|
+
// Step 2: CLI B challenges with focus on finding flaws
|
|
472
|
+
const challengeResult = await Bash({
|
|
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 })
|
|
484
|
+
|
|
485
|
+
return results
|
|
486
|
+
}
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**Mode Router**:
|
|
490
|
+
```javascript
|
|
491
|
+
async function executeAnalysis(mode, clis, taskDescription) {
|
|
492
|
+
switch (mode.name) {
|
|
493
|
+
case 'parallel':
|
|
494
|
+
return await executeParallel(clis, taskDescription)
|
|
495
|
+
case 'sequential':
|
|
496
|
+
return await executeSequential(clis, taskDescription)
|
|
497
|
+
case 'collaborative':
|
|
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)
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Execute based on selected mode
|
|
509
|
+
const analysisResults = await executeAnalysis(selectedMode, selectedCLIs, taskDescription)
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**Result Aggregation** (mode-aware):
|
|
513
|
+
```javascript
|
|
514
|
+
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
|
+
}
|
|
520
|
+
|
|
521
|
+
switch (mode.name) {
|
|
522
|
+
case 'parallel':
|
|
523
|
+
return {
|
|
524
|
+
...base,
|
|
525
|
+
findings: results.map(r => parseOutput(r)),
|
|
526
|
+
consensus: findCommonPoints(results),
|
|
527
|
+
divergences: findDifferences(results)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
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
|
+
|
|
537
|
+
case 'collaborative':
|
|
538
|
+
return {
|
|
539
|
+
...base,
|
|
540
|
+
rounds: groupByRound(results),
|
|
541
|
+
synthesis: extractSynthesis(results[results.length - 1])
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
case 'debate':
|
|
545
|
+
return {
|
|
546
|
+
...base,
|
|
547
|
+
proposal: parseOutput(results.find(r => r.phase === 'propose')?.result),
|
|
548
|
+
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
|
+
|
|
553
|
+
case 'challenge':
|
|
554
|
+
return {
|
|
555
|
+
...base,
|
|
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
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const aggregatedAnalysis = aggregateResults(selectedMode, analysisResults)
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Phase 4: User Decision
|
|
567
|
+
|
|
568
|
+
**Present Mode-Specific Summary**:
|
|
569
|
+
|
|
570
|
+
```javascript
|
|
571
|
+
function presentSummary(aggregatedAnalysis) {
|
|
572
|
+
const { mode, pattern } = aggregatedAnalysis
|
|
573
|
+
|
|
574
|
+
console.log(`
|
|
575
|
+
## Analysis Result Summary
|
|
576
|
+
|
|
577
|
+
**Mode**: ${mode} (${pattern})
|
|
578
|
+
**Tools**: ${aggregatedAnalysis.tools_used.join(' → ')}
|
|
579
|
+
`)
|
|
580
|
+
|
|
581
|
+
switch (mode) {
|
|
582
|
+
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
|
+
`)
|
|
590
|
+
break
|
|
591
|
+
|
|
592
|
+
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
|
+
`)
|
|
600
|
+
break
|
|
601
|
+
|
|
602
|
+
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
|
+
`)
|
|
612
|
+
break
|
|
613
|
+
|
|
614
|
+
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
|
+
`)
|
|
622
|
+
break
|
|
623
|
+
|
|
624
|
+
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
|
+
`)
|
|
632
|
+
break
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
presentSummary(aggregatedAnalysis)
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
**Decision Options**:
|
|
640
|
+
```javascript
|
|
641
|
+
AskUserQuestion({
|
|
642
|
+
questions: [{
|
|
643
|
+
question: "How to proceed?",
|
|
644
|
+
header: "Next Step",
|
|
645
|
+
options: [
|
|
646
|
+
{ label: "Execute directly", description: "Implement immediately based on analysis" },
|
|
647
|
+
{ label: "Refine analysis", description: "Provide more constraints, re-analyze" },
|
|
648
|
+
{ label: "Change tools", description: "Select different tool combination" },
|
|
649
|
+
{ label: "Cancel", description: "End current workflow" }
|
|
650
|
+
],
|
|
651
|
+
multiSelect: false
|
|
652
|
+
}]
|
|
653
|
+
})
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
**Routing Logic**:
|
|
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
|
|
663
|
+
|
|
664
|
+
**No Artifacts - Direct Implementation**:
|
|
665
|
+
```javascript
|
|
666
|
+
// Use the aggregated analysis directly
|
|
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)
|
|
672
|
+
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')
|
|
678
|
+
|
|
679
|
+
if (executionTool.type === 'agent') {
|
|
680
|
+
// Use Agent for execution (preferred if available)
|
|
681
|
+
Task({
|
|
682
|
+
subagent_type: executionTool.name,
|
|
683
|
+
run_in_background: false,
|
|
684
|
+
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
|
+
`
|
|
699
|
+
})
|
|
700
|
+
} else {
|
|
701
|
+
// Use CLI with write mode
|
|
702
|
+
Bash({
|
|
703
|
+
command: `ccw cli -p "
|
|
704
|
+
PURPOSE: Implement the solution based on analysis: ${taskDescription}
|
|
705
|
+
TASK: ${extractedTasks.join(' • ')}
|
|
706
|
+
MODE: write
|
|
707
|
+
CONTEXT: @${affectedFiles.join(' @')}
|
|
708
|
+
EXPECTED: Working implementation with all changes applied
|
|
709
|
+
RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) | Apply analysis findings directly
|
|
710
|
+
" --tool ${executionTool.name} --mode write`,
|
|
711
|
+
run_in_background: false
|
|
712
|
+
})
|
|
713
|
+
}
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
## TodoWrite Structure
|
|
717
|
+
|
|
718
|
+
```javascript
|
|
719
|
+
TodoWrite({ todos: [
|
|
720
|
+
{ content: "Phase 1: Clarify requirements", status: "in_progress", activeForm: "Clarifying requirements" },
|
|
721
|
+
{ content: "Phase 2: Auto-select tools", status: "pending", activeForm: "Analyzing task" },
|
|
722
|
+
{ content: "Phase 3: Mixed tool analysis", status: "pending", activeForm: "Running analysis" },
|
|
723
|
+
{ content: "Phase 4: User decision", status: "pending", activeForm: "Awaiting decision" },
|
|
724
|
+
{ content: "Phase 5: Direct execution", status: "pending", activeForm: "Executing implementation" }
|
|
725
|
+
]})
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
## Iteration Patterns
|
|
729
|
+
|
|
730
|
+
### Pattern A: Direct Path (Most Common)
|
|
731
|
+
```
|
|
732
|
+
Phase 1 → Phase 2 (auto) → Phase 3 → Phase 4 (execute) → Phase 5
|
|
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
|
+
```
|
|
744
|
+
|
|
745
|
+
## Error Handling
|
|
746
|
+
|
|
747
|
+
| Error | Resolution |
|
|
748
|
+
|-------|------------|
|
|
749
|
+
| CLI timeout | Retry with secondary model |
|
|
750
|
+
| No enabled tools | Load cli-tools.json, ask user to enable tools |
|
|
751
|
+
| Task type unclear | Default to first available CLI + code-developer |
|
|
752
|
+
| Ambiguous task | Force clarification via AskUser |
|
|
753
|
+
| Execution fails | Present error, ask user for direction |
|
|
754
|
+
|
|
755
|
+
## Analysis Modes Reference
|
|
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
|
|
766
|
+
|
|
767
|
+
| Aspect | lite-lite-lite | multi-cli-plan |
|
|
768
|
+
|--------|----------------|----------------|
|
|
769
|
+
| **Artifacts** | None | IMPL_PLAN.md, plan.json, synthesis.json |
|
|
770
|
+
| **Session** | Stateless (uses --resume for chaining) | Persistent session folder |
|
|
771
|
+
| **Tool Selection** | Multi-CLI + Agent via 3-step selection | Config-driven with fixed tools |
|
|
772
|
+
| **Analysis Modes** | 5 modes (parallel/sequential/collaborative/debate/challenge) | Fixed synthesis rounds |
|
|
773
|
+
| **CLI Collaboration** | Auto --resume chaining | Manual session management |
|
|
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
|
|
786
|
+
|
|
787
|
+
## Related Commands
|
|
788
|
+
|
|
789
|
+
```bash
|
|
790
|
+
# Full planning workflow
|
|
791
|
+
/workflow:multi-cli-plan "complex task"
|
|
792
|
+
|
|
793
|
+
# Single CLI planning
|
|
794
|
+
/workflow:lite-plan "task"
|
|
795
|
+
|
|
796
|
+
# Direct execution
|
|
797
|
+
/workflow:lite-execute --in-memory
|
|
798
|
+
```
|