claude-flow 3.63.4 → 3.63.6
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/proven-config.json +1 -1
- package/.claude/skills/hooks-automation/SKILL.md +121 -151
- package/.claude-plugin/marketplace.json +3 -3
- package/README.md +1 -1
- package/package.json +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/status.js +2 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +5 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +1 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/http-fetch-tools.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/http-fetch-tools.js +95 -9
- package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +1 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +3 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +3 -1
- package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +46 -46
- package/v3/@claude-flow/cli/dist/src/mods/claude-installs.js +108 -3
- package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +144 -144
- package/v3/@claude-flow/cli/package.json +3 -2
|
@@ -50,13 +50,13 @@ This creates:
|
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
# Pre-task hook (auto-spawns agents)
|
|
53
|
-
npx claude-flow
|
|
53
|
+
npx claude-flow hooks pre-task --description "Implement authentication"
|
|
54
54
|
|
|
55
55
|
# Post-edit hook (auto-formats and stores in memory)
|
|
56
|
-
npx claude-flow
|
|
56
|
+
npx claude-flow hooks post-edit --file "src/auth.js" --memory-key "auth/login"
|
|
57
57
|
|
|
58
58
|
# Session end hook (saves state and metrics)
|
|
59
|
-
npx claude-flow
|
|
59
|
+
npx claude-flow hooks session-end --session-id "dev-session" --export-metrics
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
---
|
|
@@ -71,7 +71,7 @@ Hooks that execute BEFORE operations to prepare and validate:
|
|
|
71
71
|
|
|
72
72
|
**pre-edit** - Validate and assign agents before file modifications
|
|
73
73
|
```bash
|
|
74
|
-
npx claude-flow
|
|
74
|
+
npx claude-flow hooks pre-edit [options]
|
|
75
75
|
|
|
76
76
|
Options:
|
|
77
77
|
--file, -f <path> File path to be edited
|
|
@@ -81,9 +81,9 @@ Options:
|
|
|
81
81
|
--backup-file Create backup before editing
|
|
82
82
|
|
|
83
83
|
Examples:
|
|
84
|
-
npx claude-flow
|
|
85
|
-
npx claude-flow
|
|
86
|
-
npx claude-flow
|
|
84
|
+
npx claude-flow hooks pre-edit --file "src/auth/login.js"
|
|
85
|
+
npx claude-flow hooks pre-edit -f "config/db.js" --validate-syntax
|
|
86
|
+
npx claude-flow hooks pre-edit -f "production.env" --backup-file --check-conflicts
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
**Features:**
|
|
@@ -94,7 +94,7 @@ Examples:
|
|
|
94
94
|
|
|
95
95
|
**pre-bash** - Check command safety and resource requirements
|
|
96
96
|
```bash
|
|
97
|
-
npx claude-flow
|
|
97
|
+
npx claude-flow hooks pre-bash --command <cmd>
|
|
98
98
|
|
|
99
99
|
Options:
|
|
100
100
|
--command, -c <cmd> Command to validate
|
|
@@ -103,8 +103,8 @@ Options:
|
|
|
103
103
|
--require-confirmation Request user confirmation for risky commands
|
|
104
104
|
|
|
105
105
|
Examples:
|
|
106
|
-
npx claude-flow
|
|
107
|
-
npx claude-flow
|
|
106
|
+
npx claude-flow hooks pre-bash -c "rm -rf /tmp/cache"
|
|
107
|
+
npx claude-flow hooks pre-bash --command "docker build ." --estimate-resources
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
**Features:**
|
|
@@ -115,7 +115,7 @@ Examples:
|
|
|
115
115
|
|
|
116
116
|
**pre-task** - Auto-spawn agents and prepare for complex tasks
|
|
117
117
|
```bash
|
|
118
|
-
npx claude-flow
|
|
118
|
+
npx claude-flow hooks pre-task [options]
|
|
119
119
|
|
|
120
120
|
Options:
|
|
121
121
|
--description, -d <text> Task description for context
|
|
@@ -125,9 +125,9 @@ Options:
|
|
|
125
125
|
--estimate-complexity Analyze task complexity
|
|
126
126
|
|
|
127
127
|
Examples:
|
|
128
|
-
npx claude-flow
|
|
129
|
-
npx claude-flow
|
|
130
|
-
npx claude-flow
|
|
128
|
+
npx claude-flow hooks pre-task --description "Implement user authentication"
|
|
129
|
+
npx claude-flow hooks pre-task -d "Continue API dev" --load-memory
|
|
130
|
+
npx claude-flow hooks pre-task -d "Refactor codebase" --optimize-topology
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
**Features:**
|
|
@@ -138,7 +138,7 @@ Examples:
|
|
|
138
138
|
|
|
139
139
|
**pre-search** - Prepare and optimize search operations
|
|
140
140
|
```bash
|
|
141
|
-
npx claude-flow
|
|
141
|
+
npx claude-flow hooks pre-search --query <query>
|
|
142
142
|
|
|
143
143
|
Options:
|
|
144
144
|
--query, -q <text> Search query
|
|
@@ -146,7 +146,7 @@ Options:
|
|
|
146
146
|
--optimize-query Optimize search pattern
|
|
147
147
|
|
|
148
148
|
Examples:
|
|
149
|
-
npx claude-flow
|
|
149
|
+
npx claude-flow hooks pre-search -q "authentication middleware"
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
**Features:**
|
|
@@ -160,7 +160,7 @@ Hooks that execute AFTER operations to process and learn:
|
|
|
160
160
|
|
|
161
161
|
**post-edit** - Auto-format, validate, and update memory
|
|
162
162
|
```bash
|
|
163
|
-
npx claude-flow
|
|
163
|
+
npx claude-flow hooks post-edit [options]
|
|
164
164
|
|
|
165
165
|
Options:
|
|
166
166
|
--file, -f <path> File path that was edited
|
|
@@ -170,9 +170,9 @@ Options:
|
|
|
170
170
|
--validate-output Validate edited file
|
|
171
171
|
|
|
172
172
|
Examples:
|
|
173
|
-
npx claude-flow
|
|
174
|
-
npx claude-flow
|
|
175
|
-
npx claude-flow
|
|
173
|
+
npx claude-flow hooks post-edit --file "src/components/Button.jsx"
|
|
174
|
+
npx claude-flow hooks post-edit -f "api/auth.js" --memory-key "auth/login"
|
|
175
|
+
npx claude-flow hooks post-edit -f "utils/helpers.ts" --train-patterns
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
**Features:**
|
|
@@ -183,7 +183,7 @@ Examples:
|
|
|
183
183
|
|
|
184
184
|
**post-bash** - Log execution and update metrics
|
|
185
185
|
```bash
|
|
186
|
-
npx claude-flow
|
|
186
|
+
npx claude-flow hooks post-bash --command <cmd>
|
|
187
187
|
|
|
188
188
|
Options:
|
|
189
189
|
--command, -c <cmd> Command that was executed
|
|
@@ -192,7 +192,7 @@ Options:
|
|
|
192
192
|
--store-result Store result in memory
|
|
193
193
|
|
|
194
194
|
Examples:
|
|
195
|
-
npx claude-flow
|
|
195
|
+
npx claude-flow hooks post-bash -c "npm test" --update-metrics
|
|
196
196
|
```
|
|
197
197
|
|
|
198
198
|
**Features:**
|
|
@@ -203,7 +203,7 @@ Examples:
|
|
|
203
203
|
|
|
204
204
|
**post-task** - Performance analysis and decision storage
|
|
205
205
|
```bash
|
|
206
|
-
npx claude-flow
|
|
206
|
+
npx claude-flow hooks post-task [options]
|
|
207
207
|
|
|
208
208
|
Options:
|
|
209
209
|
--task-id, -t <id> Task identifier for tracking
|
|
@@ -213,9 +213,9 @@ Options:
|
|
|
213
213
|
--generate-report Create task completion report
|
|
214
214
|
|
|
215
215
|
Examples:
|
|
216
|
-
npx claude-flow
|
|
217
|
-
npx claude-flow
|
|
218
|
-
npx claude-flow
|
|
216
|
+
npx claude-flow hooks post-task --task-id "auth-implementation"
|
|
217
|
+
npx claude-flow hooks post-task -t "api-refactor" --analyze-performance
|
|
218
|
+
npx claude-flow hooks post-task -t "bug-fix-123" --store-decisions
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
**Features:**
|
|
@@ -226,7 +226,7 @@ Examples:
|
|
|
226
226
|
|
|
227
227
|
**post-search** - Cache results and improve patterns
|
|
228
228
|
```bash
|
|
229
|
-
npx claude-flow
|
|
229
|
+
npx claude-flow hooks post-search --query <query> --results <path>
|
|
230
230
|
|
|
231
231
|
Options:
|
|
232
232
|
--query, -q <text> Original search query
|
|
@@ -235,7 +235,7 @@ Options:
|
|
|
235
235
|
--train-patterns Improve search patterns
|
|
236
236
|
|
|
237
237
|
Examples:
|
|
238
|
-
npx claude-flow
|
|
238
|
+
npx claude-flow hooks post-search -q "auth" -r "results.json" --train-patterns
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
**Features:**
|
|
@@ -249,7 +249,7 @@ Hooks that coordinate with MCP swarm tools:
|
|
|
249
249
|
|
|
250
250
|
**mcp-initialized** - Persist swarm configuration
|
|
251
251
|
```bash
|
|
252
|
-
npx claude-flow
|
|
252
|
+
npx claude-flow hooks mcp-initialized --swarm-id <id>
|
|
253
253
|
|
|
254
254
|
Features:
|
|
255
255
|
- Save swarm topology and configuration
|
|
@@ -259,7 +259,7 @@ Features:
|
|
|
259
259
|
|
|
260
260
|
**agent-spawned** - Update agent roster and memory
|
|
261
261
|
```bash
|
|
262
|
-
npx claude-flow
|
|
262
|
+
npx claude-flow hooks agent-spawned --agent-id <id> --type <type>
|
|
263
263
|
|
|
264
264
|
Features:
|
|
265
265
|
- Register agent in coordination memory
|
|
@@ -269,7 +269,7 @@ Features:
|
|
|
269
269
|
|
|
270
270
|
**task-orchestrated** - Monitor task progress
|
|
271
271
|
```bash
|
|
272
|
-
npx claude-flow
|
|
272
|
+
npx claude-flow hooks task-orchestrated --task-id <id>
|
|
273
273
|
|
|
274
274
|
Features:
|
|
275
275
|
- Track task progress through memory
|
|
@@ -279,7 +279,7 @@ Features:
|
|
|
279
279
|
|
|
280
280
|
**neural-trained** - Save pattern improvements
|
|
281
281
|
```bash
|
|
282
|
-
npx claude-flow
|
|
282
|
+
npx claude-flow hooks neural-trained --pattern <name>
|
|
283
283
|
|
|
284
284
|
Features:
|
|
285
285
|
- Export trained neural patterns
|
|
@@ -309,7 +309,7 @@ Features:
|
|
|
309
309
|
|
|
310
310
|
**memory-sync** - Synchronize memory across swarm agents
|
|
311
311
|
```bash
|
|
312
|
-
npx claude-flow
|
|
312
|
+
npx claude-flow hooks memory-sync --namespace <ns>
|
|
313
313
|
|
|
314
314
|
Features:
|
|
315
315
|
- Sync memory state across agents
|
|
@@ -322,7 +322,7 @@ Features:
|
|
|
322
322
|
|
|
323
323
|
**session-start** - Initialize new session
|
|
324
324
|
```bash
|
|
325
|
-
npx claude-flow
|
|
325
|
+
npx claude-flow hooks session-start --session-id <id>
|
|
326
326
|
|
|
327
327
|
Options:
|
|
328
328
|
--session-id, -s <id> Session identifier
|
|
@@ -338,7 +338,7 @@ Features:
|
|
|
338
338
|
|
|
339
339
|
**session-restore** - Load previous session state
|
|
340
340
|
```bash
|
|
341
|
-
npx claude-flow
|
|
341
|
+
npx claude-flow hooks session-restore --session-id <id>
|
|
342
342
|
|
|
343
343
|
Options:
|
|
344
344
|
--session-id, -s <id> Session to restore
|
|
@@ -346,8 +346,8 @@ Options:
|
|
|
346
346
|
--restore-agents Restore agent configurations
|
|
347
347
|
|
|
348
348
|
Examples:
|
|
349
|
-
npx claude-flow
|
|
350
|
-
npx claude-flow
|
|
349
|
+
npx claude-flow hooks session-restore --session-id "swarm-20241019"
|
|
350
|
+
npx claude-flow hooks session-restore -s "feature-auth" --restore-memory
|
|
351
351
|
```
|
|
352
352
|
|
|
353
353
|
**Features:**
|
|
@@ -358,7 +358,7 @@ Examples:
|
|
|
358
358
|
|
|
359
359
|
**session-end** - Cleanup and persist session state
|
|
360
360
|
```bash
|
|
361
|
-
npx claude-flow
|
|
361
|
+
npx claude-flow hooks session-end [options]
|
|
362
362
|
|
|
363
363
|
Options:
|
|
364
364
|
--session-id, -s <id> Session identifier to end
|
|
@@ -368,9 +368,9 @@ Options:
|
|
|
368
368
|
--cleanup-temp Remove temporary files
|
|
369
369
|
|
|
370
370
|
Examples:
|
|
371
|
-
npx claude-flow
|
|
372
|
-
npx claude-flow
|
|
373
|
-
npx claude-flow
|
|
371
|
+
npx claude-flow hooks session-end --session-id "dev-session-2024"
|
|
372
|
+
npx claude-flow hooks session-end -s "feature-auth" --export-metrics --generate-summary
|
|
373
|
+
npx claude-flow hooks session-end -s "quick-fix" --cleanup-temp
|
|
374
374
|
```
|
|
375
375
|
|
|
376
376
|
**Features:**
|
|
@@ -381,7 +381,7 @@ Examples:
|
|
|
381
381
|
|
|
382
382
|
**notify** - Custom notifications with swarm status
|
|
383
383
|
```bash
|
|
384
|
-
npx claude-flow
|
|
384
|
+
npx claude-flow hooks notify --message <msg>
|
|
385
385
|
|
|
386
386
|
Options:
|
|
387
387
|
--message, -m <text> Notification message
|
|
@@ -390,8 +390,8 @@ Options:
|
|
|
390
390
|
--broadcast Send to all agents
|
|
391
391
|
|
|
392
392
|
Examples:
|
|
393
|
-
npx claude-flow
|
|
394
|
-
npx claude-flow
|
|
393
|
+
npx claude-flow hooks notify -m "Task completed" --level info
|
|
394
|
+
npx claude-flow hooks notify -m "Critical error" --level error --broadcast
|
|
395
395
|
```
|
|
396
396
|
|
|
397
397
|
**Features:**
|
|
@@ -414,14 +414,14 @@ Edit `.claude/settings.json` to configure hooks:
|
|
|
414
414
|
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
415
415
|
"hooks": [{
|
|
416
416
|
"type": "command",
|
|
417
|
-
"command": "npx claude-flow
|
|
417
|
+
"command": "npx claude-flow hooks pre-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/current'"
|
|
418
418
|
}]
|
|
419
419
|
},
|
|
420
420
|
{
|
|
421
421
|
"matcher": "^Bash$",
|
|
422
422
|
"hooks": [{
|
|
423
423
|
"type": "command",
|
|
424
|
-
"command": "npx claude-flow
|
|
424
|
+
"command": "npx claude-flow hooks pre-bash --command '${tool.params.command}'"
|
|
425
425
|
}]
|
|
426
426
|
}
|
|
427
427
|
],
|
|
@@ -430,14 +430,14 @@ Edit `.claude/settings.json` to configure hooks:
|
|
|
430
430
|
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
431
431
|
"hooks": [{
|
|
432
432
|
"type": "command",
|
|
433
|
-
"command": "npx claude-flow
|
|
433
|
+
"command": "npx claude-flow hooks post-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/complete' --auto-format --train-patterns"
|
|
434
434
|
}]
|
|
435
435
|
},
|
|
436
436
|
{
|
|
437
437
|
"matcher": "^Bash$",
|
|
438
438
|
"hooks": [{
|
|
439
439
|
"type": "command",
|
|
440
|
-
"command": "npx claude-flow
|
|
440
|
+
"command": "npx claude-flow hooks post-bash --command '${tool.params.command}' --update-metrics"
|
|
441
441
|
}]
|
|
442
442
|
}
|
|
443
443
|
]
|
|
@@ -462,7 +462,7 @@ Complete hook configuration with all features:
|
|
|
462
462
|
"hooks": [
|
|
463
463
|
{
|
|
464
464
|
"type": "command",
|
|
465
|
-
"command": "npx claude-flow
|
|
465
|
+
"command": "npx claude-flow hooks pre-edit --file '${tool.params.file_path}' --auto-assign-agent --validate-syntax",
|
|
466
466
|
"timeout": 3000,
|
|
467
467
|
"continueOnError": true
|
|
468
468
|
}
|
|
@@ -473,7 +473,7 @@ Complete hook configuration with all features:
|
|
|
473
473
|
"hooks": [
|
|
474
474
|
{
|
|
475
475
|
"type": "command",
|
|
476
|
-
"command": "npx claude-flow
|
|
476
|
+
"command": "npx claude-flow hooks pre-task --description '${tool.params.task}' --auto-spawn-agents --load-memory",
|
|
477
477
|
"async": true
|
|
478
478
|
}
|
|
479
479
|
]
|
|
@@ -483,7 +483,7 @@ Complete hook configuration with all features:
|
|
|
483
483
|
"hooks": [
|
|
484
484
|
{
|
|
485
485
|
"type": "command",
|
|
486
|
-
"command": "npx claude-flow
|
|
486
|
+
"command": "npx claude-flow hooks pre-search --query '${tool.params.pattern}' --check-cache"
|
|
487
487
|
}
|
|
488
488
|
]
|
|
489
489
|
}
|
|
@@ -495,7 +495,7 @@ Complete hook configuration with all features:
|
|
|
495
495
|
"hooks": [
|
|
496
496
|
{
|
|
497
497
|
"type": "command",
|
|
498
|
-
"command": "npx claude-flow
|
|
498
|
+
"command": "npx claude-flow hooks post-edit --file '${tool.params.file_path}' --memory-key 'edits/${tool.params.file_path}' --auto-format --train-patterns",
|
|
499
499
|
"async": true
|
|
500
500
|
}
|
|
501
501
|
]
|
|
@@ -505,7 +505,7 @@ Complete hook configuration with all features:
|
|
|
505
505
|
"hooks": [
|
|
506
506
|
{
|
|
507
507
|
"type": "command",
|
|
508
|
-
"command": "npx claude-flow
|
|
508
|
+
"command": "npx claude-flow hooks post-task --task-id '${result.task_id}' --analyze-performance --store-decisions --export-learnings",
|
|
509
509
|
"async": true
|
|
510
510
|
}
|
|
511
511
|
]
|
|
@@ -515,7 +515,7 @@ Complete hook configuration with all features:
|
|
|
515
515
|
"hooks": [
|
|
516
516
|
{
|
|
517
517
|
"type": "command",
|
|
518
|
-
"command": "npx claude-flow
|
|
518
|
+
"command": "npx claude-flow hooks post-search --query '${tool.params.pattern}' --cache-results --train-patterns"
|
|
519
519
|
}
|
|
520
520
|
]
|
|
521
521
|
}
|
|
@@ -526,7 +526,7 @@ Complete hook configuration with all features:
|
|
|
526
526
|
"hooks": [
|
|
527
527
|
{
|
|
528
528
|
"type": "command",
|
|
529
|
-
"command": "npx claude-flow
|
|
529
|
+
"command": "npx claude-flow hooks session-start --session-id '${session.id}' --load-context"
|
|
530
530
|
}
|
|
531
531
|
]
|
|
532
532
|
}
|
|
@@ -537,7 +537,7 @@ Complete hook configuration with all features:
|
|
|
537
537
|
"hooks": [
|
|
538
538
|
{
|
|
539
539
|
"type": "command",
|
|
540
|
-
"command": "npx claude-flow
|
|
540
|
+
"command": "npx claude-flow hooks session-end --session-id '${session.id}' --export-metrics --generate-summary --cleanup-temp"
|
|
541
541
|
}
|
|
542
542
|
]
|
|
543
543
|
}
|
|
@@ -559,7 +559,7 @@ Add protection for sensitive files:
|
|
|
559
559
|
"hooks": [
|
|
560
560
|
{
|
|
561
561
|
"type": "command",
|
|
562
|
-
"command": "npx claude-flow
|
|
562
|
+
"command": "npx claude-flow hooks check-protected --file '${tool.params.file_path}'"
|
|
563
563
|
}
|
|
564
564
|
]
|
|
565
565
|
}
|
|
@@ -595,27 +595,18 @@ Run tests after file modifications:
|
|
|
595
595
|
|
|
596
596
|
Hooks automatically integrate with MCP tools for coordination:
|
|
597
597
|
|
|
598
|
-
#### Pre-Task Hook with Agent
|
|
598
|
+
#### Pre-Task Hook with Agent Suggestions
|
|
599
599
|
|
|
600
600
|
```javascript
|
|
601
601
|
// Hook command
|
|
602
|
-
npx claude-flow
|
|
603
|
-
|
|
604
|
-
// Internally calls MCP
|
|
605
|
-
mcp__claude-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
mcp__claude-flow__memory_usage {
|
|
611
|
-
action: "store",
|
|
612
|
-
key: "swarm/task/api-build/context",
|
|
613
|
-
namespace: "coordination",
|
|
614
|
-
value: JSON.stringify({
|
|
615
|
-
description: "Build REST API",
|
|
616
|
-
agents: ["backend-dev"],
|
|
617
|
-
started: Date.now()
|
|
618
|
-
})
|
|
602
|
+
npx claude-flow hooks pre-task --description "Build REST API"
|
|
603
|
+
|
|
604
|
+
// Internally calls this MCP tool:
|
|
605
|
+
mcp__claude-flow__hooks_pre-task {
|
|
606
|
+
taskId: "<generated by the CLI>",
|
|
607
|
+
description: "Build REST API",
|
|
608
|
+
autoSpawn: false,
|
|
609
|
+
timestamp: Date.now()
|
|
619
610
|
}
|
|
620
611
|
```
|
|
621
612
|
|
|
@@ -623,25 +614,13 @@ mcp__claude-flow__memory_usage {
|
|
|
623
614
|
|
|
624
615
|
```javascript
|
|
625
616
|
// Hook command
|
|
626
|
-
npx claude-flow
|
|
627
|
-
|
|
628
|
-
// Internally calls MCP tools:
|
|
629
|
-
mcp__claude-flow__memory_usage {
|
|
630
|
-
action: "store",
|
|
631
|
-
key: "swarm/edits/api/auth.js",
|
|
632
|
-
namespace: "coordination",
|
|
633
|
-
value: JSON.stringify({
|
|
634
|
-
file: "api/auth.js",
|
|
635
|
-
timestamp: Date.now(),
|
|
636
|
-
changes: { added: 45, removed: 12 },
|
|
637
|
-
formatted: true,
|
|
638
|
-
linted: true
|
|
639
|
-
})
|
|
640
|
-
}
|
|
617
|
+
npx claude-flow hooks post-edit --file "api/auth.js"
|
|
641
618
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
619
|
+
// Internally calls this MCP tool:
|
|
620
|
+
mcp__claude-flow__hooks_post-edit {
|
|
621
|
+
filePath: "api/auth.js",
|
|
622
|
+
success: true,
|
|
623
|
+
timestamp: Date.now()
|
|
645
624
|
}
|
|
646
625
|
```
|
|
647
626
|
|
|
@@ -649,18 +628,13 @@ mcp__claude-flow__neural_train {
|
|
|
649
628
|
|
|
650
629
|
```javascript
|
|
651
630
|
// Hook command
|
|
652
|
-
npx claude-flow
|
|
631
|
+
npx claude-flow hooks session-end --save-state
|
|
653
632
|
|
|
654
|
-
// Internally calls MCP
|
|
655
|
-
mcp__claude-
|
|
656
|
-
|
|
633
|
+
// Internally calls this MCP tool, which saves the session state, stops the worker daemon and returns a summary:
|
|
634
|
+
mcp__claude-flow__hooks_session-end {
|
|
635
|
+
saveState: true,
|
|
636
|
+
timestamp: Date.now()
|
|
657
637
|
}
|
|
658
|
-
|
|
659
|
-
mcp__claude-flow__swarm_status {
|
|
660
|
-
swarmId: "current"
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
// Generates metrics and summary
|
|
664
638
|
```
|
|
665
639
|
|
|
666
640
|
### Memory Coordination Protocol
|
|
@@ -671,8 +645,7 @@ All hooks follow a standardized memory coordination pattern:
|
|
|
671
645
|
|
|
672
646
|
**Phase 1: STATUS** - Hook starts
|
|
673
647
|
```javascript
|
|
674
|
-
mcp__claude-
|
|
675
|
-
action: "store",
|
|
648
|
+
mcp__claude-flow__memory_store {
|
|
676
649
|
key: "swarm/hooks/pre-edit/status",
|
|
677
650
|
namespace: "coordination",
|
|
678
651
|
value: JSON.stringify({
|
|
@@ -686,8 +659,7 @@ mcp__claude-flow__memory_usage {
|
|
|
686
659
|
|
|
687
660
|
**Phase 2: PROGRESS** - Hook processes
|
|
688
661
|
```javascript
|
|
689
|
-
mcp__claude-
|
|
690
|
-
action: "store",
|
|
662
|
+
mcp__claude-flow__memory_store {
|
|
691
663
|
key: "swarm/hooks/pre-edit/progress",
|
|
692
664
|
namespace: "coordination",
|
|
693
665
|
value: JSON.stringify({
|
|
@@ -700,8 +672,7 @@ mcp__claude-flow__memory_usage {
|
|
|
700
672
|
|
|
701
673
|
**Phase 3: COMPLETE** - Hook finishes
|
|
702
674
|
```javascript
|
|
703
|
-
mcp__claude-
|
|
704
|
-
action: "store",
|
|
675
|
+
mcp__claude-flow__memory_store {
|
|
705
676
|
key: "swarm/hooks/pre-edit/complete",
|
|
706
677
|
namespace: "coordination",
|
|
707
678
|
value: JSON.stringify({
|
|
@@ -776,7 +747,7 @@ FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
|
|
776
747
|
|
|
777
748
|
for FILE in $FILES; do
|
|
778
749
|
# Run pre-edit hook for validation
|
|
779
|
-
npx claude-flow
|
|
750
|
+
npx claude-flow hooks pre-edit --file "$FILE" --validate-syntax
|
|
780
751
|
|
|
781
752
|
if [ $? -ne 0 ]; then
|
|
782
753
|
echo "Validation failed for $FILE"
|
|
@@ -784,7 +755,7 @@ for FILE in $FILES; do
|
|
|
784
755
|
fi
|
|
785
756
|
|
|
786
757
|
# Run post-edit hook for formatting
|
|
787
|
-
npx claude-flow
|
|
758
|
+
npx claude-flow hooks post-edit --file "$FILE" --auto-format
|
|
788
759
|
done
|
|
789
760
|
|
|
790
761
|
# Run tests
|
|
@@ -803,7 +774,7 @@ exit $?
|
|
|
803
774
|
COMMIT_HASH=$(git rev-parse HEAD)
|
|
804
775
|
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
805
776
|
|
|
806
|
-
npx claude-flow
|
|
777
|
+
npx claude-flow hooks notify \
|
|
807
778
|
--message "Commit completed: $COMMIT_MSG" \
|
|
808
779
|
--level info \
|
|
809
780
|
--swarm-status
|
|
@@ -820,7 +791,7 @@ npx claude-flow hook notify \
|
|
|
820
791
|
npm run test:all
|
|
821
792
|
|
|
822
793
|
# Run quality checks
|
|
823
|
-
npx claude-flow
|
|
794
|
+
npx claude-flow hooks session-end \
|
|
824
795
|
--generate-report \
|
|
825
796
|
--export-metrics
|
|
826
797
|
|
|
@@ -844,13 +815,13 @@ How agents use hooks for coordination:
|
|
|
844
815
|
```bash
|
|
845
816
|
# Agent 1: Backend Developer
|
|
846
817
|
# STEP 1: Pre-task preparation
|
|
847
|
-
npx claude-flow
|
|
818
|
+
npx claude-flow hooks pre-task \
|
|
848
819
|
--description "Implement user authentication API" \
|
|
849
820
|
--auto-spawn-agents \
|
|
850
821
|
--load-memory
|
|
851
822
|
|
|
852
823
|
# STEP 2: Work begins - pre-edit validation
|
|
853
|
-
npx claude-flow
|
|
824
|
+
npx claude-flow hooks pre-edit \
|
|
854
825
|
--file "api/auth.js" \
|
|
855
826
|
--auto-assign-agent \
|
|
856
827
|
--validate-syntax
|
|
@@ -859,20 +830,20 @@ npx claude-flow hook pre-edit \
|
|
|
859
830
|
# ... code changes ...
|
|
860
831
|
|
|
861
832
|
# STEP 4: Post-edit processing
|
|
862
|
-
npx claude-flow
|
|
833
|
+
npx claude-flow hooks post-edit \
|
|
863
834
|
--file "api/auth.js" \
|
|
864
835
|
--memory-key "swarm/backend/auth-api" \
|
|
865
836
|
--auto-format \
|
|
866
837
|
--train-patterns
|
|
867
838
|
|
|
868
839
|
# STEP 5: Notify coordination system
|
|
869
|
-
npx claude-flow
|
|
840
|
+
npx claude-flow hooks notify \
|
|
870
841
|
--message "Auth API implementation complete" \
|
|
871
842
|
--swarm-status \
|
|
872
843
|
--broadcast
|
|
873
844
|
|
|
874
845
|
# STEP 6: Task completion
|
|
875
|
-
npx claude-flow
|
|
846
|
+
npx claude-flow hooks post-task \
|
|
876
847
|
--task-id "auth-api" \
|
|
877
848
|
--analyze-performance \
|
|
878
849
|
--store-decisions \
|
|
@@ -882,25 +853,25 @@ npx claude-flow hook post-task \
|
|
|
882
853
|
```bash
|
|
883
854
|
# Agent 2: Test Engineer (receives notification)
|
|
884
855
|
# STEP 1: Check memory for API details
|
|
885
|
-
npx claude-flow
|
|
856
|
+
npx claude-flow hooks session-restore \
|
|
886
857
|
--session-id "swarm-current" \
|
|
887
858
|
--restore-memory
|
|
888
859
|
|
|
889
860
|
# Memory contains: swarm/backend/auth-api with implementation details
|
|
890
861
|
|
|
891
862
|
# STEP 2: Generate tests
|
|
892
|
-
npx claude-flow
|
|
863
|
+
npx claude-flow hooks pre-task \
|
|
893
864
|
--description "Write tests for auth API" \
|
|
894
865
|
--load-memory
|
|
895
866
|
|
|
896
867
|
# STEP 3: Create test file
|
|
897
|
-
npx claude-flow
|
|
868
|
+
npx claude-flow hooks post-edit \
|
|
898
869
|
--file "api/auth.test.js" \
|
|
899
870
|
--memory-key "swarm/testing/auth-api-tests" \
|
|
900
871
|
--train-patterns
|
|
901
872
|
|
|
902
873
|
# STEP 4: Share test results
|
|
903
|
-
npx claude-flow
|
|
874
|
+
npx claude-flow hooks notify \
|
|
904
875
|
--message "Auth API tests complete - 100% coverage" \
|
|
905
876
|
--broadcast
|
|
906
877
|
```
|
|
@@ -979,37 +950,37 @@ module.exports = {
|
|
|
979
950
|
|
|
980
951
|
```bash
|
|
981
952
|
# Session start - initialize coordination
|
|
982
|
-
npx claude-flow
|
|
953
|
+
npx claude-flow hooks session-start --session-id "fullstack-feature"
|
|
983
954
|
|
|
984
955
|
# Pre-task planning
|
|
985
|
-
npx claude-flow
|
|
956
|
+
npx claude-flow hooks pre-task \
|
|
986
957
|
--description "Build user profile feature - frontend + backend + tests" \
|
|
987
958
|
--auto-spawn-agents \
|
|
988
959
|
--optimize-topology
|
|
989
960
|
|
|
990
961
|
# Backend work
|
|
991
|
-
npx claude-flow
|
|
962
|
+
npx claude-flow hooks pre-edit --file "api/profile.js"
|
|
992
963
|
# ... implement backend ...
|
|
993
|
-
npx claude-flow
|
|
964
|
+
npx claude-flow hooks post-edit \
|
|
994
965
|
--file "api/profile.js" \
|
|
995
966
|
--memory-key "profile/backend" \
|
|
996
967
|
--train-patterns
|
|
997
968
|
|
|
998
969
|
# Frontend work (reads backend details from memory)
|
|
999
|
-
npx claude-flow
|
|
970
|
+
npx claude-flow hooks pre-edit --file "components/Profile.jsx"
|
|
1000
971
|
# ... implement frontend ...
|
|
1001
|
-
npx claude-flow
|
|
972
|
+
npx claude-flow hooks post-edit \
|
|
1002
973
|
--file "components/Profile.jsx" \
|
|
1003
974
|
--memory-key "profile/frontend" \
|
|
1004
975
|
--train-patterns
|
|
1005
976
|
|
|
1006
977
|
# Testing (reads both backend and frontend from memory)
|
|
1007
|
-
npx claude-flow
|
|
978
|
+
npx claude-flow hooks pre-task \
|
|
1008
979
|
--description "Test profile feature" \
|
|
1009
980
|
--load-memory
|
|
1010
981
|
|
|
1011
982
|
# Session end - export everything
|
|
1012
|
-
npx claude-flow
|
|
983
|
+
npx claude-flow hooks session-end \
|
|
1013
984
|
--session-id "fullstack-feature" \
|
|
1014
985
|
--export-metrics \
|
|
1015
986
|
--generate-summary
|
|
@@ -1019,39 +990,39 @@ npx claude-flow hook session-end \
|
|
|
1019
990
|
|
|
1020
991
|
```bash
|
|
1021
992
|
# Start debugging session
|
|
1022
|
-
npx claude-flow
|
|
993
|
+
npx claude-flow hooks session-start --session-id "debug-memory-leak"
|
|
1023
994
|
|
|
1024
995
|
# Pre-task: analyze issue
|
|
1025
|
-
npx claude-flow
|
|
996
|
+
npx claude-flow hooks pre-task \
|
|
1026
997
|
--description "Debug memory leak in event handlers" \
|
|
1027
998
|
--load-memory \
|
|
1028
999
|
--estimate-complexity
|
|
1029
1000
|
|
|
1030
1001
|
# Search for event emitters
|
|
1031
|
-
npx claude-flow
|
|
1002
|
+
npx claude-flow hooks pre-search --query "EventEmitter"
|
|
1032
1003
|
# ... search executes ...
|
|
1033
|
-
npx claude-flow
|
|
1004
|
+
npx claude-flow hooks post-search \
|
|
1034
1005
|
--query "EventEmitter" \
|
|
1035
1006
|
--cache-results
|
|
1036
1007
|
|
|
1037
1008
|
# Fix the issue
|
|
1038
|
-
npx claude-flow
|
|
1009
|
+
npx claude-flow hooks pre-edit \
|
|
1039
1010
|
--file "services/events.js" \
|
|
1040
1011
|
--backup-file
|
|
1041
1012
|
# ... fix code ...
|
|
1042
|
-
npx claude-flow
|
|
1013
|
+
npx claude-flow hooks post-edit \
|
|
1043
1014
|
--file "services/events.js" \
|
|
1044
1015
|
--memory-key "debug/memory-leak-fix" \
|
|
1045
1016
|
--validate-output
|
|
1046
1017
|
|
|
1047
1018
|
# Verify fix
|
|
1048
|
-
npx claude-flow
|
|
1019
|
+
npx claude-flow hooks post-task \
|
|
1049
1020
|
--task-id "memory-leak-fix" \
|
|
1050
1021
|
--analyze-performance \
|
|
1051
1022
|
--generate-report
|
|
1052
1023
|
|
|
1053
1024
|
# End session
|
|
1054
|
-
npx claude-flow
|
|
1025
|
+
npx claude-flow hooks session-end \
|
|
1055
1026
|
--session-id "debug-memory-leak" \
|
|
1056
1027
|
--export-metrics
|
|
1057
1028
|
```
|
|
@@ -1060,27 +1031,27 @@ npx claude-flow hook session-end \
|
|
|
1060
1031
|
|
|
1061
1032
|
```bash
|
|
1062
1033
|
# Initialize swarm for refactoring
|
|
1063
|
-
npx claude-flow
|
|
1034
|
+
npx claude-flow hooks pre-task \
|
|
1064
1035
|
--description "Refactor legacy codebase to modern patterns" \
|
|
1065
1036
|
--auto-spawn-agents \
|
|
1066
1037
|
--optimize-topology
|
|
1067
1038
|
|
|
1068
1039
|
# Agent 1: Code Analyzer
|
|
1069
|
-
npx claude-flow
|
|
1040
|
+
npx claude-flow hooks pre-task --description "Analyze code complexity"
|
|
1070
1041
|
# ... analysis ...
|
|
1071
|
-
npx claude-flow
|
|
1042
|
+
npx claude-flow hooks post-task \
|
|
1072
1043
|
--task-id "analysis" \
|
|
1073
1044
|
--store-decisions
|
|
1074
1045
|
|
|
1075
1046
|
# Agent 2: Refactoring (reads analysis from memory)
|
|
1076
|
-
npx claude-flow
|
|
1047
|
+
npx claude-flow hooks session-restore \
|
|
1077
1048
|
--session-id "swarm-refactor" \
|
|
1078
1049
|
--restore-memory
|
|
1079
1050
|
|
|
1080
1051
|
for file in src/**/*.js; do
|
|
1081
|
-
npx claude-flow
|
|
1052
|
+
npx claude-flow hooks pre-edit --file "$file" --backup-file
|
|
1082
1053
|
# ... refactor ...
|
|
1083
|
-
npx claude-flow
|
|
1054
|
+
npx claude-flow hooks post-edit \
|
|
1084
1055
|
--file "$file" \
|
|
1085
1056
|
--memory-key "refactor/$file" \
|
|
1086
1057
|
--auto-format \
|
|
@@ -1088,12 +1059,12 @@ for file in src/**/*.js; do
|
|
|
1088
1059
|
done
|
|
1089
1060
|
|
|
1090
1061
|
# Agent 3: Testing (reads refactored code from memory)
|
|
1091
|
-
npx claude-flow
|
|
1062
|
+
npx claude-flow hooks pre-task \
|
|
1092
1063
|
--description "Generate tests for refactored code" \
|
|
1093
1064
|
--load-memory
|
|
1094
1065
|
|
|
1095
1066
|
# Broadcast completion
|
|
1096
|
-
npx claude-flow
|
|
1067
|
+
npx claude-flow hooks notify \
|
|
1097
1068
|
--message "Refactoring complete - all tests passing" \
|
|
1098
1069
|
--broadcast
|
|
1099
1070
|
```
|
|
@@ -1117,13 +1088,13 @@ Enable debug mode for troubleshooting:
|
|
|
1117
1088
|
export CLAUDE_FLOW_DEBUG=true
|
|
1118
1089
|
|
|
1119
1090
|
# Test specific hook with verbose output
|
|
1120
|
-
npx claude-flow
|
|
1091
|
+
npx claude-flow hooks pre-edit --file "test.js" --debug
|
|
1121
1092
|
|
|
1122
1093
|
# Check hook execution logs
|
|
1123
1094
|
cat .claude-flow/logs/hooks-$(date +%Y-%m-%d).log
|
|
1124
1095
|
|
|
1125
1096
|
# Validate configuration
|
|
1126
|
-
npx claude-flow
|
|
1097
|
+
npx claude-flow hooks validate-config
|
|
1127
1098
|
```
|
|
1128
1099
|
|
|
1129
1100
|
### Benefits
|
|
@@ -1184,9 +1155,8 @@ npx claude-flow hook validate-config
|
|
|
1184
1155
|
### Related Commands
|
|
1185
1156
|
|
|
1186
1157
|
- `npx claude-flow init --hooks` - Initialize hooks system
|
|
1187
|
-
- `npx claude-flow
|
|
1188
|
-
- `npx claude-flow
|
|
1189
|
-
- `npx claude-flow memory usage` - Manage memory
|
|
1158
|
+
- `npx claude-flow hooks list` - List available hooks
|
|
1159
|
+
- `npx claude-flow memory stats` - Show memory statistics
|
|
1190
1160
|
- `npx claude-flow agent spawn` - Spawn agents
|
|
1191
1161
|
- `npx claude-flow swarm init` - Initialize swarm
|
|
1192
1162
|
|