claude-code-workflow 6.3.49 → 6.3.51
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/new.md +1 -2
- package/.claude/commands/view.md +367 -0
- package/.claude/commands/workflow/unified-execute-with-file.md +807 -0
- package/.claude/skills/ccw-help/SKILL.md +72 -12
- package/.claude/skills/ccw-help/command.json +922 -520
- package/.claude/skills/ccw-help/index/all-agents.json +97 -0
- package/.claude/skills/ccw-help/index/all-commands.json +805 -0
- package/.claude/skills/ccw-help/index/by-category.json +833 -0
- package/.claude/skills/ccw-help/index/by-use-case.json +819 -0
- package/.claude/skills/ccw-help/index/command-relationships.json +160 -0
- package/.claude/skills/ccw-help/index/essential-commands.json +90 -0
- package/.claude/skills/ccw-help/scripts/auto-update.py +34 -0
- package/.claude/skills/skill-generator/SKILL.md +255 -208
- package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +238 -228
- package/.claude/skills/skill-generator/phases/02-structure-generation.md +261 -262
- package/.claude/skills/skill-generator/phases/03-phase-generation.md +976 -969
- package/.claude/skills/skill-generator/phases/04-specs-templates.md +398 -398
- package/.claude/skills/skill-generator/phases/05-validation.md +417 -417
- package/.claude/skills/skill-generator/specs/cli-integration.md +131 -131
- package/.claude/skills/skill-generator/specs/execution-modes.md +399 -396
- package/.claude/skills/skill-generator/specs/reference-docs-spec.md +271 -0
- package/.claude/skills/skill-generator/specs/scripting-integration.md +265 -265
- package/.claude/skills/skill-generator/specs/skill-requirements.md +466 -466
- package/.claude/skills/skill-generator/templates/autonomous-action.md +91 -88
- package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +89 -89
- package/.claude/skills/skill-generator/templates/code-analysis-action.md +148 -149
- package/.claude/skills/skill-generator/templates/llm-action.md +367 -367
- package/.claude/skills/skill-generator/templates/script-template.md +79 -79
- package/.claude/skills/skill-generator/templates/sequential-phase.md +129 -129
- package/.claude/skills/skill-generator/templates/skill-md.md +134 -75
- package/.codex/prompts/UNIFIED_EXECUTE_COMPARISON.md +205 -0
- package/.codex/prompts/analyze-with-file.md +5 -2
- package/.codex/prompts/brainstorm-to-cycle.md +4 -3
- package/.codex/prompts/brainstorm-with-file.md +6 -2
- package/.codex/prompts/clean.md +7 -2
- package/.codex/prompts/compact.md +5 -3
- package/.codex/prompts/debug-with-file.md +6 -2
- package/.codex/prompts/execute.md +6 -2
- package/.codex/prompts/issue-execute.md +10 -2
- package/.codex/prompts/issue-new.md +390 -285
- package/.codex/prompts/lite-execute.md +8 -7
- package/.codex/prompts/lite-fix.md +6 -2
- package/.codex/prompts/lite-plan-a.md +6 -2
- package/.codex/prompts/lite-plan-b.md +6 -2
- package/.codex/prompts/lite-plan-c.md +6 -2
- package/.codex/prompts/unified-execute-with-file.md +722 -0
- package/.codex/skills/codex-issue-plan-execute/SKILL.md +239 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-complete.md +173 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-execute.md +220 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-init.md +86 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-list.md +165 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-plan.md +170 -0
- package/.codex/skills/codex-issue-plan-execute/phases/orchestrator.md +210 -0
- package/.codex/skills/codex-issue-plan-execute/phases/state-schema.md +136 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent-system.md +136 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent.md +135 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent-system.md +107 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent.md +122 -0
- package/.codex/skills/codex-issue-plan-execute/specs/issue-handling.md +187 -0
- package/.codex/skills/codex-issue-plan-execute/specs/quality-standards.md +231 -0
- package/.codex/skills/codex-issue-plan-execute/specs/solution-schema.md +270 -0
- package/.codex/skills/codex-issue-plan-execute/specs/subagent-roles.md +268 -0
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +1 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/cli.d.ts +1 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +74 -6
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js +16 -1
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/help-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/help-routes.js +51 -1
- package/ccw/dist/core/routes/help-routes.js.map +1 -1
- package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-core.js +5 -3
- package/ccw/dist/tools/cli-executor-core.js.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.d.ts +1 -0
- package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.js +3 -1
- package/ccw/dist/tools/cli-executor-utils.js.map +1 -1
- package/ccw/src/cli.ts +1 -0
- package/ccw/src/commands/cli.ts +77 -6
- package/ccw/src/core/routes/cli-routes.ts +16 -1
- package/ccw/src/core/routes/help-routes.ts +60 -1
- package/ccw/src/templates/dashboard-js/views/help.js +423 -1
- package/ccw/src/tools/cli-executor-core.ts +6 -3
- package/ccw/src/tools/cli-executor-utils.ts +5 -2
- package/package.json +1 -1
|
@@ -1,111 +1,111 @@
|
|
|
1
1
|
# CLI Integration Specification
|
|
2
2
|
|
|
3
|
-
CCW CLI
|
|
3
|
+
CCW CLI integration specification that defines how to properly call external CLI tools within Skills.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Execution Modes
|
|
8
8
|
|
|
9
|
-
### 1.
|
|
9
|
+
### 1. Synchronous Execution (Blocking)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Suitable for scenarios that need immediate results.
|
|
12
12
|
|
|
13
13
|
```javascript
|
|
14
|
-
// Agent
|
|
14
|
+
// Agent call - synchronous
|
|
15
15
|
const result = Task({
|
|
16
16
|
subagent_type: 'universal-executor',
|
|
17
|
-
prompt: '
|
|
18
|
-
run_in_background: false //
|
|
17
|
+
prompt: 'Execute task...',
|
|
18
|
+
run_in_background: false // Key: synchronous execution
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// Result immediately available
|
|
22
22
|
console.log(result);
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
### 2.
|
|
25
|
+
### 2. Asynchronous Execution (Background)
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Suitable for long-running CLI commands.
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
|
-
// CLI
|
|
30
|
+
// CLI call - asynchronous
|
|
31
31
|
const task = Bash({
|
|
32
32
|
command: 'ccw cli -p "..." --tool gemini --mode analysis',
|
|
33
|
-
run_in_background: true //
|
|
33
|
+
run_in_background: true // Key: background execution
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
//
|
|
37
|
-
// task.task_id
|
|
36
|
+
// Returns immediately without waiting for result
|
|
37
|
+
// task.task_id available for later queries
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
42
|
-
## CCW CLI
|
|
42
|
+
## CCW CLI Call Specification
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### Basic Command Structure
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
47
|
ccw cli -p "<PROMPT>" --tool <gemini|qwen|codex> --mode <analysis|write>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
###
|
|
50
|
+
### Parameter Description
|
|
51
51
|
|
|
52
|
-
|
|
|
53
|
-
|
|
54
|
-
| `-p "<prompt>"` |
|
|
55
|
-
| `--tool <tool>` |
|
|
56
|
-
| `--mode <mode>` |
|
|
57
|
-
| `--cd <path>` | - |
|
|
58
|
-
| `--includeDirs <dirs>` | - |
|
|
59
|
-
| `--resume [id]` | - |
|
|
52
|
+
| Parameter | Required | Description |
|
|
53
|
+
|-----------|----------|-------------|
|
|
54
|
+
| `-p "<prompt>"` | Yes | Prompt text (use double quotes) |
|
|
55
|
+
| `--tool <tool>` | Yes | Tool selection: gemini, qwen, codex |
|
|
56
|
+
| `--mode <mode>` | Yes | Execution mode: analysis, write |
|
|
57
|
+
| `--cd <path>` | - | Working directory |
|
|
58
|
+
| `--includeDirs <dirs>` | - | Additional directories (comma-separated) |
|
|
59
|
+
| `--resume [id]` | - | Resume session |
|
|
60
60
|
|
|
61
|
-
###
|
|
61
|
+
### Mode Selection
|
|
62
62
|
|
|
63
63
|
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
- Analysis/Documentation tasks?
|
|
65
|
+
→ --mode analysis (read-only)
|
|
66
|
+
|
|
67
|
+
- Implementation/Modification tasks?
|
|
68
|
+
→ --mode write (read-write)
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
---
|
|
72
72
|
|
|
73
|
-
## Agent
|
|
73
|
+
## Agent Types and Selection
|
|
74
74
|
|
|
75
75
|
### universal-executor
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
General-purpose executor, the most commonly used agent type.
|
|
78
78
|
|
|
79
79
|
```javascript
|
|
80
80
|
Task({
|
|
81
81
|
subagent_type: 'universal-executor',
|
|
82
82
|
prompt: `
|
|
83
|
-
|
|
84
|
-
1.
|
|
85
|
-
2.
|
|
86
|
-
3.
|
|
83
|
+
Execute task:
|
|
84
|
+
1. Read configuration file
|
|
85
|
+
2. Analyze dependencies
|
|
86
|
+
3. Generate report to ${outputPath}
|
|
87
87
|
`,
|
|
88
88
|
run_in_background: false
|
|
89
89
|
});
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
92
|
+
**Applicable Scenarios**:
|
|
93
|
+
- Multi-step task execution
|
|
94
|
+
- File operations (read/write/edit)
|
|
95
|
+
- Tasks that require tool invocation
|
|
96
96
|
|
|
97
97
|
### Explore
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
Code exploration agent for quick codebase understanding.
|
|
100
100
|
|
|
101
101
|
```javascript
|
|
102
102
|
Task({
|
|
103
103
|
subagent_type: 'Explore',
|
|
104
104
|
prompt: `
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
105
|
+
Explore src/ directory:
|
|
106
|
+
- Identify main modules
|
|
107
|
+
- Understand directory structure
|
|
108
|
+
- Find entry points
|
|
109
109
|
|
|
110
110
|
Thoroughness: medium
|
|
111
111
|
`,
|
|
@@ -113,104 +113,104 @@ Thoroughness: medium
|
|
|
113
113
|
});
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
116
|
+
**Applicable Scenarios**:
|
|
117
|
+
- Codebase exploration
|
|
118
|
+
- File discovery
|
|
119
|
+
- Structure understanding
|
|
120
120
|
|
|
121
121
|
### cli-explore-agent
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
Deep code analysis agent.
|
|
124
124
|
|
|
125
125
|
```javascript
|
|
126
126
|
Task({
|
|
127
127
|
subagent_type: 'cli-explore-agent',
|
|
128
128
|
prompt: `
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
129
|
+
Deep analysis of src/auth/ module:
|
|
130
|
+
- Authentication flow
|
|
131
|
+
- Session management
|
|
132
|
+
- Security mechanisms
|
|
133
133
|
`,
|
|
134
134
|
run_in_background: false
|
|
135
135
|
});
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
138
|
+
**Applicable Scenarios**:
|
|
139
|
+
- Deep code understanding
|
|
140
|
+
- Design pattern identification
|
|
141
|
+
- Complex logic analysis
|
|
142
142
|
|
|
143
143
|
---
|
|
144
144
|
|
|
145
|
-
##
|
|
145
|
+
## Session Management
|
|
146
146
|
|
|
147
|
-
###
|
|
147
|
+
### Session Recovery
|
|
148
148
|
|
|
149
149
|
```javascript
|
|
150
|
-
//
|
|
150
|
+
// Save session ID
|
|
151
151
|
const session = Bash({
|
|
152
|
-
command: 'ccw cli -p "
|
|
152
|
+
command: 'ccw cli -p "Initial analysis..." --tool gemini --mode analysis',
|
|
153
153
|
run_in_background: true
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
//
|
|
156
|
+
// Resume later
|
|
157
157
|
const continuation = Bash({
|
|
158
|
-
command: `ccw cli -p "
|
|
158
|
+
command: `ccw cli -p "Continue analysis..." --tool gemini --mode analysis --resume ${session.id}`,
|
|
159
159
|
run_in_background: true
|
|
160
160
|
});
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
###
|
|
163
|
+
### Multi-Session Merge
|
|
164
164
|
|
|
165
165
|
```javascript
|
|
166
|
-
//
|
|
166
|
+
// Merge context from multiple sessions
|
|
167
167
|
const merged = Bash({
|
|
168
|
-
command: `ccw cli -p "
|
|
168
|
+
command: `ccw cli -p "Aggregate analysis..." --tool gemini --mode analysis --resume ${id1},${id2}`,
|
|
169
169
|
run_in_background: true
|
|
170
170
|
});
|
|
171
171
|
```
|
|
172
172
|
|
|
173
173
|
---
|
|
174
174
|
|
|
175
|
-
##
|
|
175
|
+
## CLI Integration Patterns in Skills
|
|
176
176
|
|
|
177
|
-
###
|
|
177
|
+
### Pattern 1: Single Call
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
Simple tasks completed in one call.
|
|
180
180
|
|
|
181
181
|
```javascript
|
|
182
|
-
// Phase
|
|
182
|
+
// Phase execution
|
|
183
183
|
async function executePhase(context) {
|
|
184
184
|
const result = Bash({
|
|
185
185
|
command: `ccw cli -p "
|
|
186
|
-
PURPOSE:
|
|
187
|
-
TASK:
|
|
186
|
+
PURPOSE: Analyze project structure
|
|
187
|
+
TASK: Identify modules, dependencies, entry points
|
|
188
188
|
MODE: analysis
|
|
189
189
|
CONTEXT: @src/**/*
|
|
190
|
-
EXPECTED: JSON
|
|
190
|
+
EXPECTED: JSON format structure report
|
|
191
191
|
" --tool gemini --mode analysis --cd ${context.projectRoot}`,
|
|
192
192
|
run_in_background: true,
|
|
193
193
|
timeout: 600000
|
|
194
194
|
});
|
|
195
195
|
|
|
196
|
-
//
|
|
196
|
+
// Wait for completion
|
|
197
197
|
return await waitForCompletion(result.task_id);
|
|
198
198
|
}
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
###
|
|
201
|
+
### Pattern 2: Chained Calls
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
Multi-step tasks where each step depends on previous results.
|
|
204
204
|
|
|
205
205
|
```javascript
|
|
206
206
|
async function executeChain(context) {
|
|
207
|
-
// Step 1:
|
|
207
|
+
// Step 1: Collect
|
|
208
208
|
const collectId = await runCLI('collect', context);
|
|
209
209
|
|
|
210
|
-
// Step 2:
|
|
210
|
+
// Step 2: Analyze (depends on Step 1)
|
|
211
211
|
const analyzeId = await runCLI('analyze', context, `--resume ${collectId}`);
|
|
212
212
|
|
|
213
|
-
// Step 3:
|
|
213
|
+
// Step 3: Generate (depends on Step 2)
|
|
214
214
|
const generateId = await runCLI('generate', context, `--resume ${analyzeId}`);
|
|
215
215
|
|
|
216
216
|
return generateId;
|
|
@@ -218,9 +218,9 @@ async function executeChain(context) {
|
|
|
218
218
|
|
|
219
219
|
async function runCLI(step, context, resumeFlag = '') {
|
|
220
220
|
const prompts = {
|
|
221
|
-
collect: 'PURPOSE:
|
|
222
|
-
analyze: 'PURPOSE:
|
|
223
|
-
generate: 'PURPOSE:
|
|
221
|
+
collect: 'PURPOSE: Collect code files...',
|
|
222
|
+
analyze: 'PURPOSE: Analyze code patterns...',
|
|
223
|
+
generate: 'PURPOSE: Generate documentation...'
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
const result = Bash({
|
|
@@ -232,9 +232,9 @@ async function runCLI(step, context, resumeFlag = '') {
|
|
|
232
232
|
}
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
###
|
|
235
|
+
### Pattern 3: Parallel Calls
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
Independent tasks executed in parallel.
|
|
238
238
|
|
|
239
239
|
```javascript
|
|
240
240
|
async function executeParallel(context) {
|
|
@@ -244,15 +244,15 @@ async function executeParallel(context) {
|
|
|
244
244
|
{ type: 'patterns', tool: 'qwen' }
|
|
245
245
|
];
|
|
246
246
|
|
|
247
|
-
//
|
|
247
|
+
// Start tasks in parallel
|
|
248
248
|
const taskIds = tasks.map(task =>
|
|
249
249
|
Bash({
|
|
250
|
-
command: `ccw cli -p "
|
|
250
|
+
command: `ccw cli -p "Analyze ${task.type}..." --tool ${task.tool} --mode analysis`,
|
|
251
251
|
run_in_background: true
|
|
252
252
|
}).task_id
|
|
253
253
|
);
|
|
254
254
|
|
|
255
|
-
//
|
|
255
|
+
// Wait for all to complete
|
|
256
256
|
const results = await Promise.all(
|
|
257
257
|
taskIds.map(id => waitForCompletion(id))
|
|
258
258
|
);
|
|
@@ -261,9 +261,9 @@ async function executeParallel(context) {
|
|
|
261
261
|
}
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
###
|
|
264
|
+
### Pattern 4: Fallback Chain
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
Automatically switch tools on failure.
|
|
267
267
|
|
|
268
268
|
```javascript
|
|
269
269
|
async function executeWithFallback(context) {
|
|
@@ -299,9 +299,9 @@ async function runWithTool(tool, context) {
|
|
|
299
299
|
|
|
300
300
|
---
|
|
301
301
|
|
|
302
|
-
##
|
|
302
|
+
## Prompt Template Integration
|
|
303
303
|
|
|
304
|
-
###
|
|
304
|
+
### Reference Protocol Templates
|
|
305
305
|
|
|
306
306
|
```bash
|
|
307
307
|
# Analysis mode - use --rule to auto-load protocol and template (appended to prompt)
|
|
@@ -315,7 +315,7 @@ CONSTRAINTS: ...
|
|
|
315
315
|
..." --tool codex --mode write --rule development-feature
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
###
|
|
318
|
+
### Dynamic Template Building
|
|
319
319
|
|
|
320
320
|
```javascript
|
|
321
321
|
function buildPrompt(config) {
|
|
@@ -334,21 +334,21 @@ CONSTRAINTS: ${constraints || ''}
|
|
|
334
334
|
|
|
335
335
|
---
|
|
336
336
|
|
|
337
|
-
##
|
|
337
|
+
## Timeout Configuration
|
|
338
338
|
|
|
339
|
-
###
|
|
339
|
+
### Recommended Timeout Values
|
|
340
340
|
|
|
341
|
-
|
|
|
342
|
-
|
|
343
|
-
|
|
|
344
|
-
|
|
|
345
|
-
|
|
|
346
|
-
|
|
|
347
|
-
|
|
|
341
|
+
| Task Type | Timeout (ms) | Description |
|
|
342
|
+
|-----------|--------------|-------------|
|
|
343
|
+
| Quick analysis | 300000 | 5 minutes |
|
|
344
|
+
| Standard analysis | 600000 | 10 minutes |
|
|
345
|
+
| Deep analysis | 1200000 | 20 minutes |
|
|
346
|
+
| Code generation | 1800000 | 30 minutes |
|
|
347
|
+
| Complex tasks | 3600000 | 60 minutes |
|
|
348
348
|
|
|
349
|
-
### Codex
|
|
349
|
+
### Special Codex Handling
|
|
350
350
|
|
|
351
|
-
Codex
|
|
351
|
+
Codex requires longer timeout (recommend 3x).
|
|
352
352
|
|
|
353
353
|
```javascript
|
|
354
354
|
const timeout = tool === 'codex' ? baseTimeout * 3 : baseTimeout;
|
|
@@ -362,17 +362,17 @@ Bash({
|
|
|
362
362
|
|
|
363
363
|
---
|
|
364
364
|
|
|
365
|
-
##
|
|
365
|
+
## Error Handling
|
|
366
366
|
|
|
367
|
-
###
|
|
367
|
+
### Common Errors
|
|
368
368
|
|
|
369
|
-
|
|
|
370
|
-
|
|
371
|
-
| ETIMEDOUT |
|
|
372
|
-
| Exit code 1 |
|
|
373
|
-
| Context overflow |
|
|
369
|
+
| Error | Cause | Handler |
|
|
370
|
+
|-------|-------|---------|
|
|
371
|
+
| ETIMEDOUT | Network timeout | Retry or switch tool |
|
|
372
|
+
| Exit code 1 | Command execution failed | Check parameters, switch tool |
|
|
373
|
+
| Context overflow | Input context too large | Reduce input scope |
|
|
374
374
|
|
|
375
|
-
###
|
|
375
|
+
### Retry Strategy
|
|
376
376
|
|
|
377
377
|
```javascript
|
|
378
378
|
async function executeWithRetry(command, maxRetries = 3) {
|
|
@@ -391,7 +391,7 @@ async function executeWithRetry(command, maxRetries = 3) {
|
|
|
391
391
|
lastError = error;
|
|
392
392
|
console.log(`Attempt ${attempt} failed: ${error.message}`);
|
|
393
393
|
|
|
394
|
-
//
|
|
394
|
+
// Exponential backoff
|
|
395
395
|
if (attempt < maxRetries) {
|
|
396
396
|
await sleep(Math.pow(2, attempt) * 1000);
|
|
397
397
|
}
|
|
@@ -404,30 +404,30 @@ async function executeWithRetry(command, maxRetries = 3) {
|
|
|
404
404
|
|
|
405
405
|
---
|
|
406
406
|
|
|
407
|
-
##
|
|
407
|
+
## Best Practices
|
|
408
408
|
|
|
409
|
-
### 1. run_in_background
|
|
409
|
+
### 1. run_in_background Rule
|
|
410
410
|
|
|
411
411
|
```
|
|
412
|
-
Agent
|
|
413
|
-
run_in_background: false →
|
|
412
|
+
Agent calls (Task):
|
|
413
|
+
run_in_background: false → Synchronous, get result immediately
|
|
414
414
|
|
|
415
|
-
CLI
|
|
416
|
-
run_in_background: true →
|
|
415
|
+
CLI calls (Bash + ccw cli):
|
|
416
|
+
run_in_background: true → Asynchronous, run in background
|
|
417
417
|
```
|
|
418
418
|
|
|
419
|
-
### 2.
|
|
419
|
+
### 2. Tool Selection
|
|
420
420
|
|
|
421
421
|
```
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
422
|
+
Analysis tasks: gemini > qwen
|
|
423
|
+
Generation tasks: codex > gemini > qwen
|
|
424
|
+
Code modification: codex > gemini
|
|
425
425
|
```
|
|
426
426
|
|
|
427
|
-
### 3.
|
|
427
|
+
### 3. Session Management
|
|
428
428
|
|
|
429
|
-
-
|
|
430
|
-
-
|
|
429
|
+
- Use `--resume` for related tasks to maintain context
|
|
430
|
+
- Do not use `--resume` for independent tasks
|
|
431
431
|
|
|
432
432
|
### 4. Prompt Specification
|
|
433
433
|
|
|
@@ -435,8 +435,8 @@ CLI 调用 (Bash + ccw cli):
|
|
|
435
435
|
- Use `--rule <template>` to auto-append protocol + template to prompt
|
|
436
436
|
- Template name format: `category-function` (e.g., `analysis-code-patterns`)
|
|
437
437
|
|
|
438
|
-
### 5.
|
|
438
|
+
### 5. Result Processing
|
|
439
439
|
|
|
440
|
-
-
|
|
441
|
-
- Brief returns:
|
|
442
|
-
- JSON
|
|
440
|
+
- Persist important results to workDir
|
|
441
|
+
- Brief returns: path + summary, avoid context overflow
|
|
442
|
+
- JSON format convenient for downstream processing
|