Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(skills): use the hooks command and the real MCP tools in hooks-automation (#4538) (#4540)

Muhammad Zubair9e65711ae9d7
diff --git a/.claude/skills/hooks-automation/SKILL.md b/.claude/skills/hooks-automation/SKILL.md
index 7acce959ef..d73ec40ab7 100644
--- a/.claude/skills/hooks-automation/SKILL.md
+++ b/.claude/skills/hooks-automation/SKILL.md
@@ -50,13 +50,13 @@ This creates:
```bash
# Pre-task hook (auto-spawns agents)
-npx claude-flow hook pre-task --description "Implement authentication"
+npx claude-flow hooks pre-task --description "Implement authentication"
# Post-edit hook (auto-formats and stores in memory)
-npx claude-flow hook post-edit --file "src/auth.js" --memory-key "auth/login"
+npx claude-flow hooks post-edit --file "src/auth.js" --memory-key "auth/login"
# Session end hook (saves state and metrics)
-npx claude-flow hook session-end --session-id "dev-session" --export-metrics
+npx claude-flow hooks session-end --session-id "dev-session" --export-metrics
```
---
@@ -71,7 +71,7 @@ Hooks that execute BEFORE operations to prepare and validate:
**pre-edit** - Validate and assign agents before file modifications
```bash
-npx claude-flow hook pre-edit [options]
+npx claude-flow hooks pre-edit [options]
Options:
--file, -f <path> File path to be edited
@@ -81,9 +81,9 @@ Options:
--backup-file Create backup before editing
Examples:
- npx claude-flow hook pre-edit --file "src/auth/login.js"
- npx claude-flow hook pre-edit -f "config/db.js" --validate-syntax
- npx claude-flow hook pre-edit -f "production.env" --backup-file --check-conflicts
+ npx claude-flow hooks pre-edit --file "src/auth/login.js"
+ npx claude-flow hooks pre-edit -f "config/db.js" --validate-syntax
+ npx claude-flow hooks pre-edit -f "production.env" --backup-file --check-conflicts
```
**Features:**
@@ -94,7 +94,7 @@ Examples:
**pre-bash** - Check command safety and resource requirements
```bash
-npx claude-flow hook pre-bash --command <cmd>
+npx claude-flow hooks pre-bash --command <cmd>
Options:
--command, -c <cmd> Command to validate
@@ -103,8 +103,8 @@ Options:
--require-confirmation Request user confirmation for risky commands
Examples:
- npx claude-flow hook pre-bash -c "rm -rf /tmp/cache"
- npx claude-flow hook pre-bash --command "docker build ." --estimate-resources
+ npx claude-flow hooks pre-bash -c "rm -rf /tmp/cache"
+ npx claude-flow hooks pre-bash --command "docker build ." --estimate-resources
```
**Features:**
@@ -115,7 +115,7 @@ Examples:
**pre-task** - Auto-spawn agents and prepare for complex tasks
```bash
-npx claude-flow hook pre-task [options]
+npx claude-flow hooks pre-task [options]
Options:
--description, -d <text> Task description for context
@@ -125,9 +125,9 @@ Options:
--estimate-complexity Analyze task complexity
Examples:
- npx claude-flow hook pre-task --description "Implement user authentication"
- npx claude-flow hook pre-task -d "Continue API dev" --load-memory
- npx claude-flow hook pre-task -d "Refactor codebase" --optimize-topology
+ npx claude-flow hooks pre-task --description "Implement user authentication"
+ npx claude-flow hooks pre-task -d "Continue API dev" --load-memory
+ npx claude-flow hooks pre-task -d "Refactor codebase" --optimize-topology
```
**Features:**
@@ -138,7 +138,7 @@ Examples:
**pre-search** - Prepare and optimize search operations
```bash
-npx claude-flow hook pre-search --query <query>
+npx claude-flow hooks pre-search --query <query>
Options:
--query, -q <text> Search query
@@ -146,7 +146,7 @@ Options:
--optimize-query Optimize search pattern
Examples:
- npx claude-flow hook pre-search -q "authentication middleware"
+ npx claude-flow hooks pre-search -q "authentication middleware"
```
**Features:**
@@ -160,7 +160,7 @@ Hooks that execute AFTER operations to process and learn:
**post-edit** - Auto-format, validate, and update memory
```bash
-npx claude-flow hook post-edit [options]
+npx claude-flow hooks post-edit [options]
Options:
--file, -f <path> File path that was edited
@@ -170,9 +170,9 @@ Options:
--validate-output Validate edited file
Examples:
- npx claude-flow hook post-edit --file "src/components/Button.jsx"
- npx claude-flow hook post-edit -f "api/auth.js" --memory-key "auth/login"
- npx claude-flow hook post-edit -f "utils/helpers.ts" --train-patterns
+ npx claude-flow hooks post-edit --file "src/components/Button.jsx"
+ npx claude-flow hooks post-edit -f "api/auth.js" --memory-key "auth/login"
+ npx claude-flow hooks post-edit -f "utils/helpers.ts" --train-patterns
```
**Features:**
@@ -183,7 +183,7 @@ Examples:
**post-bash** - Log execution and update metrics
```bash
-npx claude-flow hook post-bash --command <cmd>
+npx claude-flow hooks post-bash --command <cmd>
Options:
--command, -c <cmd> Command that was executed
@@ -192,7 +192,7 @@ Options:
--store-result Store result in memory
Examples:
- npx claude-flow hook post-bash -c "npm test" --update-metrics
+ npx claude-flow hooks post-bash -c "npm test" --update-metrics
```
**Features:**
@@ -203,7 +203,7 @@ Examples:
**post-task** - Performance analysis and decision storage
```bash
-npx claude-flow hook post-task [options]
+npx claude-flow hooks post-task [options]
Options:
--task-id, -t <id> Task identifier for tracking
@@ -213,9 +213,9 @@ Options:
--generate-report Create task completion report
Examples:
- npx claude-flow hook post-task --task-id "auth-implementation"
- npx claude-flow hook post-task -t "api-refactor" --analyze-performance
- npx claude-flow hook post-task -t "bug-fix-123" --store-decisions
+ npx claude-flow hooks post-task --task-id "auth-implementation"
+ npx claude-flow hooks post-task -t "api-refactor" --analyze-performance
+ npx claude-flow hooks post-task -t "bug-fix-123" --store-decisions
```
**Features:**
@@ -226,7 +226,7 @@ Examples:
**post-search** - Cache results and improve patterns
```bash
-npx claude-flow hook post-search --query <query> --results <path>
+npx claude-flow hooks post-search --query <query> --results <path>
Options:
--query, -q <text> Original search query
@@ -235,7 +235,7 @@ Options:
--train-patterns Improve search patterns
Examples:
- npx claude-flow hook post-search -q "auth" -r "results.json" --train-patterns
+ npx claude-flow hooks post-search -q "auth" -r "results.json" --train-patterns
```
**Features:**
@@ -249,7 +249,7 @@ Hooks that coordinate with MCP swarm tools:
**mcp-initialized** - Persist swarm configuration
```bash
-npx claude-flow hook mcp-initialized --swarm-id <id>
+npx claude-flow hooks mcp-initialized --swarm-id <id>
Features:
- Save swarm topology and configuration
@@ -259,7 +259,7 @@ Features:
**agent-spawned** - Update agent roster and memory
```bash
-npx claude-flow hook agent-spawned --agent-id <id> --type <type>
+npx claude-flow hooks agent-spawned --agent-id <id> --type <type>
Features:
- Register agent in coordination memory
@@ -269,7 +269,7 @@ Features:
**task-orchestrated** - Monitor task progress
```bash
-npx claude-flow hook task-orchestrated --task-id <id>
+npx claude-flow hooks task-orchestrated --task-id <id>
Features:
- Track task progress through memory
@@ -279,7 +279,7 @@ Features:
**neural-trained** - Save pattern improvements
```bash
-npx claude-flow hook neural-trained --pattern <name>
+npx claude-flow hooks neural-trained --pattern <name>
Features:
- Export trained neural patterns
@@ -309,7 +309,7 @@ Features:
**memory-sync** - Synchronize memory across swarm agents
```bash
-npx claude-flow hook memory-sync --namespace <ns>
+npx claude-flow hooks memory-sync --namespace <ns>
Features:
- Sync memory state across agents
@@ -322,7 +322,7 @@ Features:
**session-start** - Initialize new session
```bash
-npx claude-flow hook session-start --session-id <id>
+npx claude-flow hooks session-start --session-id <id>
Options:
--session-id, -s <id> Session identifier
@@ -338,7 +338,7 @@ Features:
**session-restore** - Load previous session state
```bash
-npx claude-flow hook session-restore --session-id <id>
+npx claude-flow hooks session-restore --session-id <id>
Options:
--session-id, -s <id> Session to restore
@@ -346,8 +346,8 @@ Options:
--restore-agents Restore agent configurations
Examples:
- npx claude-flow hook session-restore --session-id "swarm-20241019"
- npx claude-flow hook session-restore -s "feature-auth" --restore-memory
+ npx claude-flow hooks session-restore --session-id "swarm-20241019"
+ npx claude-flow hooks session-restore -s "feature-auth" --restore-memory
```
**Features:**
@@ -358,7 +358,7 @@ Examples:
**session-end** - Cleanup and persist session state
```bash
-npx claude-flow hook session-end [options]
+npx claude-flow hooks session-end [options]
Options:
--session-id, -s <id> Session identifier to end
@@ -368,9 +368,9 @@ Options:
--cleanup-temp Remove temporary files
Examples:
- npx claude-flow hook session-end --session-id "dev-session-2024"
- npx claude-flow hook session-end -s "feature-auth" --export-metrics --generate-summary
- npx claude-flow hook session-end -s "quick-fix" --cleanup-temp
+ npx claude-flow hooks session-end --session-id "dev-session-2024"
+ npx claude-flow hooks session-end -s "feature-auth" --export-metrics --generate-summary
+ npx claude-flow hooks session-end -s "quick-fix" --cleanup-temp
```
**Features:**
@@ -381,7 +381,7 @@ Examples:
**notify** - Custom notifications with swarm status
```bash
-npx claude-flow hook notify --message <msg>
+npx claude-flow hooks notify --message <msg>
Options:
--message, -m <text> Notification message
@@ -390,8 +390,8 @@ Options:
--broadcast Send to all agents
Examples:
- npx claude-flow hook notify -m "Task completed" --level info
- npx claude-flow hook notify -m "Critical error" --level error --broadcast
+ npx claude-flow hooks notify -m "Task completed" --level info
+ npx claude-flow hooks notify -m "Critical error" --level error --broadcast
```
**Features:**
@@ -414,14 +414,14 @@ Edit `.claude/settings.json` to configure hooks:
"matcher": "^(Write|Edit|MultiEdit)$",
"hooks": [{
"type": "command",
- "command": "npx claude-flow hook pre-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/current'"
+ "command": "npx claude-flow hooks pre-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/current'"
}]
},
{
"matcher": "^Bash$",
"hooks": [{
"type": "command",
- "command": "npx claude-flow hook pre-bash --command '${tool.params.command}'"
+ "command": "npx claude-flow hooks pre-bash --command '${tool.params.command}'"
}]
}
],
@@ -430,14 +430,14 @@ Edit `.claude/settings.json` to configure hooks:
"matcher": "^(Write|Edit|MultiEdit)$",
"hooks": [{
"type": "command",
- "command": "npx claude-flow hook post-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/complete' --auto-format --train-patterns"
+ "command": "npx claude-flow hooks post-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/complete' --auto-format --train-patterns"
}]
},
{
"matcher": "^Bash$",
"hooks": [{
"type": "command",
- "command": "npx claude-flow hook post-bash --command '${tool.params.command}' --update-metrics"
+ "command": "npx claude-flow hooks post-bash --command '${tool.params.command}' --update-metrics"
}]
}
]
@@ -462,7 +462,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook pre-edit --file '${tool.params.file_path}' --auto-assign-agent --validate-syntax",
+ "command": "npx claude-flow hooks pre-edit --file '${tool.params.file_path}' --auto-assign-agent --validate-syntax",
"timeout": 3000,
"continueOnError": true
}
@@ -473,7 +473,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook pre-task --description '${tool.params.task}' --auto-spawn-agents --load-memory",
+ "command": "npx claude-flow hooks pre-task --description '${tool.params.task}' --auto-spawn-agents --load-memory",
"async": true
}
]
@@ -483,7 +483,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook pre-search --query '${tool.params.pattern}' --check-cache"
+ "command": "npx claude-flow hooks pre-search --query '${tool.params.pattern}' --check-cache"
}
]
}
@@ -495,7 +495,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook post-edit --file '${tool.params.file_path}' --memory-key 'edits/${tool.params.file_path}' --auto-format --train-patterns",
+ "command": "npx claude-flow hooks post-edit --file '${tool.params.file_path}' --memory-key 'edits/${tool.params.file_path}' --auto-format --train-patterns",
"async": true
}
]
@@ -505,7 +505,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook post-task --task-id '${result.task_id}' --analyze-performance --store-decisions --export-learnings",
+ "command": "npx claude-flow hooks post-task --task-id '${result.task_id}' --analyze-performance --store-decisions --export-learnings",
"async": true
}
]
@@ -515,7 +515,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook post-search --query '${tool.params.pattern}' --cache-results --train-patterns"
+ "command": "npx claude-flow hooks post-search --query '${tool.params.pattern}' --cache-results --train-patterns"
}
]
}
@@ -526,7 +526,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook session-start --session-id '${session.id}' --load-context"
+ "command": "npx claude-flow hooks session-start --session-id '${session.id}' --load-context"
}
]
}
@@ -537,7 +537,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook session-end --session-id '${session.id}' --export-metrics --generate-summary --cleanup-temp"
+ "command": "npx claude-flow hooks session-end --session-id '${session.id}' --export-metrics --generate-summary --cleanup-temp"
}
]
}
@@ -559,7 +559,7 @@ Add protection for sensitive files:
"hooks": [
{
"type": "command",
- "command": "npx claude-flow hook check-protected --file '${tool.params.file_path}'"
+ "command": "npx claude-flow hooks check-protected --file '${tool.params.file_path}'"
}
]
}
@@ -595,27 +595,18 @@ Run tests after file modifications:
Hooks automatically integrate with MCP tools for coordination:
-#### Pre-Task Hook with Agent Spawning
+#### Pre-Task Hook with Agent Suggestions
```javascript
// Hook command
-npx claude-flow hook pre-task --description "Build REST API"
-
-// Internally calls MCP tools:
-mcp__claude-flow__agent_spawn {
- type: "backend-dev",
- capabilities: ["api", "database", "testing"]
-}
-
-mcp__claude-flow__memory_usage {
- action: "store",
- key: "swarm/task/api-build/context",
- namespace: "coordination",
- value: JSON.stringify({
- description: "Build REST API",
- agents: ["backend-dev"],
- started: Date.now()
- })
+npx claude-flow hooks pre-task --description "Build REST API"
+
+// Internally calls this MCP tool:
+mcp__claude-flow__hooks_pre-task {
+ taskId: "<generated by the CLI>",
+ description: "Build REST API",
+ autoSpawn: false,
+ timestamp: Date.now()
}
```
@@ -623,25 +614,13 @@ mcp__claude-flow__memory_usage {
```javascript
// Hook command
-npx claude-flow hook post-edit --file "api/auth.js"
-
-// Internally calls MCP tools:
-mcp__claude-flow__memory_usage {
- action: "store",
- key: "swarm/edits/api/auth.js",
- namespace: "coordination",
- value: JSON.stringify({
- file: "api/auth.js",
- timestamp: Date.now(),
- changes: { added: 45, removed: 12 },
- formatted: true,
- linted: true
- })
-}
+npx claude-flow hooks post-edit --file "api/auth.js"
-mcp__claude-flow__neural_train {
- pattern_type: "coordination",
- training_data: { /* edit patterns */ }
+// Internally calls this MCP tool:
+mcp__claude-flow__hooks_post-edit {
+ filePath: "api/auth.js",
+ success: true,
+ timestamp: Date.now()
}
```
@@ -649,18 +628,13 @@ mcp__claude-flow__neural_train {
```javascript
// Hook command
-npx claude-flow hook session-end --session-id "dev-2024"
+npx claude-flow hooks session-end --save-state
-// Internally calls MCP tools:
-mcp__claude-flow__memory_persist {
- sessionId: "dev-2024"
+// Internally calls this MCP tool, which saves the session state, stops the worker daemon and returns a summary:
+mcp__claude-flow__hooks_session-end {
+ saveState: true,
+ timestamp: Date.now()
}
-
-mcp__claude-flow__swarm_status {
- swarmId: "current"
-}
-
-// Generates metrics and summary
```
### Memory Coordination Protocol
@@ -671,8 +645,7 @@ All hooks follow a standardized memory coordination pattern:
**Phase 1: STATUS** - Hook starts
```javascript
-mcp__claude-flow__memory_usage {
- action: "store",
+mcp__claude-flow__memory_store {
key: "swarm/hooks/pre-edit/status",
namespace: "coordination",
value: JSON.stringify({
@@ -686,8 +659,7 @@ mcp__claude-flow__memory_usage {
**Phase 2: PROGRESS** - Hook processes
```javascript
-mcp__claude-flow__memory_usage {
- action: "store",
+mcp__claude-flow__memory_store {
key: "swarm/hooks/pre-edit/progress",
namespace: "coordination",
value: JSON.stringify({
@@ -700,8 +672,7 @@ mcp__claude-flow__memory_usage {
**Phase 3: COMPLETE** - Hook finishes
```javascript
-mcp__claude-flow__memory_usage {
- action: "store",
+mcp__claude-flow__memory_store {
key: "swarm/hooks/pre-edit/complete",
namespace: "coordination",
value: JSON.stringify({
@@ -776,7 +747,7 @@ FILES=$(git diff --cached --name-only --diff-filter=ACM)
for FILE in $FILES; do
# Run pre-edit hook for validation
- npx claude-flow hook pre-edit --file "$FILE" --validate-syntax
+ npx claude-flow hooks pre-edit --file "$FILE" --validate-syntax
if [ $? -ne 0 ]; then
echo "Validation failed for $FILE"
@@ -784,7 +755,7 @@ for FILE in $FILES; do
fi
# Run post-edit hook for formatting
- npx claude-flow hook post-edit --file "$FILE" --auto-format
+ npx claude-flow hooks post-edit --file "$FILE" --auto-format
done
# Run tests
@@ -803,7 +774,7 @@ exit $?
COMMIT_HASH=$(git rev-parse HEAD)
COMMIT_MSG=$(git log -1 --pretty=%B)
-npx claude-flow hook notify \
+npx claude-flow hooks notify \
--message "Commit completed: $COMMIT_MSG" \
--level info \
--swarm-status
@@ -820,7 +791,7 @@ npx claude-flow hook notify \
npm run test:all
# Run quality checks
-npx claude-flow hook session-end \
+npx claude-flow hooks session-end \
--generate-report \
--export-metrics
@@ -844,13 +815,13 @@ How agents use hooks for coordination:
```bash
# Agent 1: Backend Developer
# STEP 1: Pre-task preparation
-npx claude-flow hook pre-task \
+npx claude-flow hooks pre-task \
--description "Implement user authentication API" \
--auto-spawn-agents \
--load-memory
# STEP 2: Work begins - pre-edit validation
-npx claude-flow hook pre-edit \
+npx claude-flow hooks pre-edit \
--file "api/auth.js" \
--auto-assign-agent \
--validate-syntax
@@ -859,20 +830,20 @@ npx claude-flow hook pre-edit \
# ... code changes ...
# STEP 4: Post-edit processing
-npx claude-flow hook post-edit \
+npx claude-flow hooks post-edit \
--file "api/auth.js" \
--memory-key "swarm/backend/auth-api" \
--auto-format \
--train-patterns
# STEP 5: Notify coordination system
-npx claude-flow hook notify \
+npx claude-flow hooks notify \
--message "Auth API implementation complete" \
--swarm-status \
--broadcast
# STEP 6: Task completion
-npx claude-flow hook post-task \
+npx claude-flow hooks post-task \
--task-id "auth-api" \
--analyze-performance \
--store-decisions \
@@ -882,25 +853,25 @@ npx claude-flow hook post-task \
```bash
# Agent 2: Test Engineer (receives notification)
# STEP 1: Check memory for API details
-npx claude-flow hook session-restore \
+npx claude-flow hooks session-restore \
--session-id "swarm-current" \
--restore-memory
# Memory contains: swarm/backend/auth-api with implementation details
# STEP 2: Generate tests
-npx claude-flow hook pre-task \
+npx claude-flow hooks pre-task \
--description "Write tests for auth API" \
--load-memory
# STEP 3: Create test file
-npx claude-flow hook post-edit \
+npx claude-flow hooks post-edit \
--file "api/auth.test.js" \
--memory-key "swarm/testing/auth-api-tests" \
--train-patterns
# STEP 4: Share test results
-npx claude-flow hook notify \
+npx claude-flow hooks notify \
--message "Auth API tests complete - 100% coverage" \
--broadcast
```
@@ -979,37 +950,37 @@ module.exports = {
```bash
# Session start - initialize coordination
-npx claude-flow hook session-start --session-id "fullstack-feature"
+npx claude-flow hooks session-start --session-id "fullstack-feature"
# Pre-task planning
-npx claude-flow hook pre-task \
+npx claude-flow hooks pre-task \
--description "Build user profile feature - frontend + backend + tests" \
--auto-spawn-agents \
--optimize-topology
# Backend work
-npx claude-flow hook pre-edit --file "api/profile.js"
+npx claude-flow hooks pre-edit --file "api/profile.js"
# ... implement backend ...
-npx claude-flow hook post-edit \
+npx claude-flow hooks post-edit \
--file "api/profile.js" \
--memory-key "profile/backend" \
--train-patterns
# Frontend work (reads backend details from memory)
-npx claude-flow hook pre-edit --file "components/Profile.jsx"
+npx claude-flow hooks pre-edit --file "components/Profile.jsx"
# ... implement frontend ...
-npx claude-flow hook post-edit \
+npx claude-flow hooks post-edit \
--file "components/Profile.jsx" \
--memory-key "profile/frontend" \
--train-patterns
# Testing (reads both backend and frontend from memory)
-npx claude-flow hook pre-task \
+npx claude-flow hooks pre-task \
--description "Test profile feature" \
--load-memory
# Session end - export everything
-npx claude-flow hook session-end \
+npx claude-flow hooks session-end \
--session-id "fullstack-feature" \
--export-metrics \
--generate-summary
@@ -1019,39 +990,39 @@ npx claude-flow hook session-end \
```bash
# Start debugging session
-npx claude-flow hook session-start --session-id "debug-memory-leak"
+npx claude-flow hooks session-start --session-id "debug-memory-leak"
# Pre-task: analyze issue
-npx claude-flow hook pre-task \
+npx claude-flow hooks pre-task \
--description "Debug memory leak in event handlers" \
--load-memory \
--estimate-complexity
# Search for event emitters
-npx claude-flow hook pre-search --query "EventEmitter"
+npx claude-flow hooks pre-search --query "EventEmitter"
# ... search executes ...
-npx claude-flow hook post-search \
+npx claude-flow hooks post-search \
--query "EventEmitter" \
--cache-results
# Fix the issue
-npx claude-flow hook pre-edit \
+npx claude-flow hooks pre-edit \
--file "services/events.js" \
--backup-file
# ... fix code ...
-npx claude-flow hook post-edit \
+npx claude-flow hooks post-edit \
--file "services/events.js" \
--memory-key "debug/memory-leak-fix" \
--validate-output
# Verify fix
-npx claude-flow hook post-task \
+npx claude-flow hooks post-task \
--task-id "memory-leak-fix" \
--analyze-performance \
--generate-report
# End session
-npx claude-flow hook session-end \
+npx claude-flow hooks session-end \
--session-id "debug-memory-leak" \
--export-metrics
```
@@ -1060,27 +1031,27 @@ npx claude-flow hook session-end \
```bash
# Initialize swarm for refactoring
-npx claude-flow hook pre-task \
+npx claude-flow hooks pre-task \
--description "Refactor legacy codebase to modern patterns" \
--auto-spawn-agents \
--optimize-topology
# Agent 1: Code Analyzer
-npx claude-flow hook pre-task --description "Analyze code complexity"
+npx claude-flow hooks pre-task --description "Analyze code complexity"
# ... analysis ...
-npx claude-flow hook post-task \
+npx claude-flow hooks post-task \
--task-id "analysis" \
--store-decisions
# Agent 2: Refactoring (reads analysis from memory)
-npx claude-flow hook session-restore \
+npx claude-flow hooks session-restore \
--session-id "swarm-refactor" \
--restore-memory
for file in src/**/*.js; do
- npx claude-flow hook pre-edit --file "$file" --backup-file
+ npx claude-flow hooks pre-edit --file "$file" --backup-file
# ... refactor ...
- npx claude-flow hook post-edit \
+ npx claude-flow hooks post-edit \
--file "$file" \
--memory-key "refactor/$file" \
--auto-format \
@@ -1088,12 +1059,12 @@ for file in src/**/*.js; do
done
# Agent 3: Testing (reads refactored code from memory)
-npx claude-flow hook pre-task \
+npx claude-flow hooks pre-task \
--description "Generate tests for refactored code" \
--load-memory
# Broadcast completion
-npx claude-flow hook notify \
+npx claude-flow hooks notify \
--message "Refactoring complete - all tests passing" \
--broadcast
```
@@ -1117,13 +1088,13 @@ Enable debug mode for troubleshooting:
export CLAUDE_FLOW_DEBUG=true
# Test specific hook with verbose output
-npx claude-flow hook pre-edit --file "test.js" --debug
+npx claude-flow hooks pre-edit --file "test.js" --debug
# Check hook execution logs
cat .claude-flow/logs/hooks-$(date +%Y-%m-%d).log
# Validate configuration
-npx claude-flow hook validate-config
+npx claude-flow hooks validate-config
```
### Benefits
@@ -1184,9 +1155,8 @@ npx claude-flow hook validate-config
### Related Commands
- `npx claude-flow init --hooks` - Initialize hooks system
-- `npx claude-flow hook --list` - List available hooks
-- `npx claude-flow hook --test <hook>` - Test specific hook
-- `npx claude-flow memory usage` - Manage memory
+- `npx claude-flow hooks list` - List available hooks
+- `npx claude-flow memory stats` - Show memory statistics
- `npx claude-flow agent spawn` - Spawn agents
- `npx claude-flow swarm init` - Initialize swarm
diff --git a/v3/@claude-flow/cli/.claude/skills/hooks-automation/SKILL.md b/v3/@claude-flow/cli/.claude/skills/hooks-automation/SKILL.md
index 9cd019b9ac..8f450bd632 100644
--- a/v3/@claude-flow/cli/.claude/skills/hooks-automation/SKILL.md
+++ b/v3/@claude-flow/cli/.claude/skills/hooks-automation/SKILL.md
@@ -50,13 +50,13 @@ This creates:
```bash
# Pre-task hook (auto-spawns agents)
-npx @claude-flow/cli@latest hook pre-task --description "Implement authentication"
+npx @claude-flow/cli@latest hooks pre-task --description "Implement authentication"
# Post-edit hook (auto-formats and stores in memory)
-npx @claude-flow/cli@latest hook post-edit --file "src/auth.js" --memory-key "auth/login"
+npx @claude-flow/cli@latest hooks post-edit --file "src/auth.js" --memory-key "auth/login"
# Session end hook (saves state and metrics)
-npx @claude-flow/cli@latest hook session-end --session-id "dev-session" --export-metrics
+npx @claude-flow/cli@latest hooks session-end --session-id "dev-session" --export-metrics
```
---
@@ -71,7 +71,7 @@ Hooks that execute BEFORE operations to prepare and validate:
**pre-edit** - Validate and assign agents before file modifications
```bash
-npx @claude-flow/cli@latest hook pre-edit [options]
+npx @claude-flow/cli@latest hooks pre-edit [options]
Options:
--file, -f <path> File path to be edited
@@ -81,9 +81,9 @@ Options:
--backup-file Create backup before editing
Examples:
- npx @claude-flow/cli@latest hook pre-edit --file "src/auth/login.js"
- npx @claude-flow/cli@latest hook pre-edit -f "config/db.js" --validate-syntax
- npx @claude-flow/cli@latest hook pre-edit -f "production.env" --backup-file --check-conflicts
+ npx @claude-flow/cli@latest hooks pre-edit --file "src/auth/login.js"
+ npx @claude-flow/cli@latest hooks pre-edit -f "config/db.js" --validate-syntax
+ npx @claude-flow/cli@latest hooks pre-edit -f "production.env" --backup-file --check-conflicts
```
**Features:**
@@ -94,7 +94,7 @@ Examples:
**pre-bash** - Check command safety and resource requirements
```bash
-npx @claude-flow/cli@latest hook pre-bash --command <cmd>
+npx @claude-flow/cli@latest hooks pre-bash --command <cmd>
Options:
--command, -c <cmd> Command to validate
@@ -103,8 +103,8 @@ Options:
--require-confirmation Request user confirmation for risky commands
Examples:
- npx @claude-flow/cli@latest hook pre-bash -c "rm -rf /tmp/cache"
- npx @claude-flow/cli@latest hook pre-bash --command "docker build ." --estimate-resources
+ npx @claude-flow/cli@latest hooks pre-bash -c "rm -rf /tmp/cache"
+ npx @claude-flow/cli@latest hooks pre-bash --command "docker build ." --estimate-resources
```
**Features:**
@@ -115,7 +115,7 @@ Examples:
**pre-task** - Auto-spawn agents and prepare for complex tasks
```bash
-npx @claude-flow/cli@latest hook pre-task [options]
+npx @claude-flow/cli@latest hooks pre-task [options]
Options:
--description, -d <text> Task description for context
@@ -125,9 +125,9 @@ Options:
--estimate-complexity Analyze task complexity
Examples:
- npx @claude-flow/cli@latest hook pre-task --description "Implement user authentication"
- npx @claude-flow/cli@latest hook pre-task -d "Continue API dev" --load-memory
- npx @claude-flow/cli@latest hook pre-task -d "Refactor codebase" --optimize-topology
+ npx @claude-flow/cli@latest hooks pre-task --description "Implement user authentication"
+ npx @claude-flow/cli@latest hooks pre-task -d "Continue API dev" --load-memory
+ npx @claude-flow/cli@latest hooks pre-task -d "Refactor codebase" --optimize-topology
```
**Features:**
@@ -138,7 +138,7 @@ Examples:
**pre-search** - Prepare and optimize search operations
```bash
-npx @claude-flow/cli@latest hook pre-search --query <query>
+npx @claude-flow/cli@latest hooks pre-search --query <query>
Options:
--query, -q <text> Search query
@@ -146,7 +146,7 @@ Options:
--optimize-query Optimize search pattern
Examples:
- npx @claude-flow/cli@latest hook pre-search -q "authentication middleware"
+ npx @claude-flow/cli@latest hooks pre-search -q "authentication middleware"
```
**Features:**
@@ -160,7 +160,7 @@ Hooks that execute AFTER operations to process and learn:
**post-edit** - Auto-format, validate, and update memory
```bash
-npx @claude-flow/cli@latest hook post-edit [options]
+npx @claude-flow/cli@latest hooks post-edit [options]
Options:
--file, -f <path> File path that was edited
@@ -170,9 +170,9 @@ Options:
--validate-output Validate edited file
Examples:
- npx @claude-flow/cli@latest hook post-edit --file "src/components/Button.jsx"
- npx @claude-flow/cli@latest hook post-edit -f "api/auth.js" --memory-key "auth/login"
- npx @claude-flow/cli@latest hook post-edit -f "utils/helpers.ts" --train-patterns
+ npx @claude-flow/cli@latest hooks post-edit --file "src/components/Button.jsx"
+ npx @claude-flow/cli@latest hooks post-edit -f "api/auth.js" --memory-key "auth/login"
+ npx @claude-flow/cli@latest hooks post-edit -f "utils/helpers.ts" --train-patterns
```
**Features:**
@@ -183,7 +183,7 @@ Examples:
**post-bash** - Log execution and update metrics
```bash
-npx @claude-flow/cli@latest hook post-bash --command <cmd>
+npx @claude-flow/cli@latest hooks post-bash --command <cmd>
Options:
--command, -c <cmd> Command that was executed
@@ -192,7 +192,7 @@ Options:
--store-result Store result in memory
Examples:
- npx @claude-flow/cli@latest hook post-bash -c "npm test" --update-metrics
+ npx @claude-flow/cli@latest hooks post-bash -c "npm test" --update-metrics
```
**Features:**
@@ -203,7 +203,7 @@ Examples:
**post-task** - Performance analysis and decision storage
```bash
-npx @claude-flow/cli@latest hook post-task [options]
+npx @claude-flow/cli@latest hooks post-task [options]
Options:
--task-id, -t <id> Task identifier for tracking
@@ -213,9 +213,9 @@ Options:
--generate-report Create task completion report
Examples:
- npx @claude-flow/cli@latest hook post-task --task-id "auth-implementation"
- npx @claude-flow/cli@latest hook post-task -t "api-refactor" --analyze-performance
- npx @claude-flow/cli@latest hook post-task -t "bug-fix-123" --store-decisions
+ npx @claude-flow/cli@latest hooks post-task --task-id "auth-implementation"
+ npx @claude-flow/cli@latest hooks post-task -t "api-refactor" --analyze-performance
+ npx @claude-flow/cli@latest hooks post-task -t "bug-fix-123" --store-decisions
```
**Features:**
@@ -226,7 +226,7 @@ Examples:
**post-search** - Cache results and improve patterns
```bash
-npx @claude-flow/cli@latest hook post-search --query <query> --results <path>
+npx @claude-flow/cli@latest hooks post-search --query <query> --results <path>
Options:
--query, -q <text> Original search query
@@ -235,7 +235,7 @@ Options:
--train-patterns Improve search patterns
Examples:
- npx @claude-flow/cli@latest hook post-search -q "auth" -r "results.json" --train-patterns
+ npx @claude-flow/cli@latest hooks post-search -q "auth" -r "results.json" --train-patterns
```
**Features:**
@@ -249,7 +249,7 @@ Hooks that coordinate with MCP swarm tools:
**mcp-initialized** - Persist swarm configuration
```bash
-npx @claude-flow/cli@latest hook mcp-initialized --swarm-id <id>
+npx @claude-flow/cli@latest hooks mcp-initialized --swarm-id <id>
Features:
- Save swarm topology and configuration
@@ -259,7 +259,7 @@ Features:
**agent-spawned** - Update agent roster and memory
```bash
-npx @claude-flow/cli@latest hook agent-spawned --agent-id <id> --type <type>
+npx @claude-flow/cli@latest hooks agent-spawned --agent-id <id> --type <type>
Features:
- Register agent in coordination memory
@@ -269,7 +269,7 @@ Features:
**task-orchestrated** - Monitor task progress
```bash
-npx @claude-flow/cli@latest hook task-orchestrated --task-id <id>
+npx @claude-flow/cli@latest hooks task-orchestrated --task-id <id>
Features:
- Track task progress through memory
@@ -279,7 +279,7 @@ Features:
**neural-trained** - Save pattern improvements
```bash
-npx @claude-flow/cli@latest hook neural-trained --pattern <name>
+npx @claude-flow/cli@latest hooks neural-trained --pattern <name>
Features:
- Export trained neural patterns
@@ -309,7 +309,7 @@ Features:
**memory-sync** - Synchronize memory across swarm agents
```bash
-npx @claude-flow/cli@latest hook memory-sync --namespace <ns>
+npx @claude-flow/cli@latest hooks memory-sync --namespace <ns>
Features:
- Sync memory state across agents
@@ -322,7 +322,7 @@ Features:
**session-start** - Initialize new session
```bash
-npx @claude-flow/cli@latest hook session-start --session-id <id>
+npx @claude-flow/cli@latest hooks session-start --session-id <id>
Options:
--session-id, -s <id> Session identifier
@@ -338,7 +338,7 @@ Features:
**session-restore** - Load previous session state
```bash
-npx @claude-flow/cli@latest hook session-restore --session-id <id>
+npx @claude-flow/cli@latest hooks session-restore --session-id <id>
Options:
--session-id, -s <id> Session to restore
@@ -346,8 +346,8 @@ Options:
--restore-agents Restore agent configurations
Examples:
- npx @claude-flow/cli@latest hook session-restore --session-id "swarm-20241019"
- npx @claude-flow/cli@latest hook session-restore -s "feature-auth" --restore-memory
+ npx @claude-flow/cli@latest hooks session-restore --session-id "swarm-20241019"
+ npx @claude-flow/cli@latest hooks session-restore -s "feature-auth" --restore-memory
```
**Features:**
@@ -358,7 +358,7 @@ Examples:
**session-end** - Cleanup and persist session state
```bash
-npx @claude-flow/cli@latest hook session-end [options]
+npx @claude-flow/cli@latest hooks session-end [options]
Options:
--session-id, -s <id> Session identifier to end
@@ -368,9 +368,9 @@ Options:
--cleanup-temp Remove temporary files
Examples:
- npx @claude-flow/cli@latest hook session-end --session-id "dev-session-2024"
- npx @claude-flow/cli@latest hook session-end -s "feature-auth" --export-metrics --generate-summary
- npx @claude-flow/cli@latest hook session-end -s "quick-fix" --cleanup-temp
+ npx @claude-flow/cli@latest hooks session-end --session-id "dev-session-2024"
+ npx @claude-flow/cli@latest hooks session-end -s "feature-auth" --export-metrics --generate-summary
+ npx @claude-flow/cli@latest hooks session-end -s "quick-fix" --cleanup-temp
```
**Features:**
@@ -381,7 +381,7 @@ Examples:
**notify** - Custom notifications with swarm status
```bash
-npx @claude-flow/cli@latest hook notify --message <msg>
+npx @claude-flow/cli@latest hooks notify --message <msg>
Options:
--message, -m <text> Notification message
@@ -390,8 +390,8 @@ Options:
--broadcast Send to all agents
Examples:
- npx @claude-flow/cli@latest hook notify -m "Task completed" --level info
- npx @claude-flow/cli@latest hook notify -m "Critical error" --level error --broadcast
+ npx @claude-flow/cli@latest hooks notify -m "Task completed" --level info
+ npx @claude-flow/cli@latest hooks notify -m "Critical error" --level error --broadcast
```
**Features:**
@@ -414,14 +414,14 @@ Edit `.claude/settings.json` to configure hooks:
"matcher": "^(Write|Edit|MultiEdit)$",
"hooks": [{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook pre-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/current'"
+ "command": "npx @claude-flow/cli@latest hooks pre-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/current'"
}]
},
{
"matcher": "^Bash$",
"hooks": [{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook pre-bash --command '${tool.params.command}'"
+ "command": "npx @claude-flow/cli@latest hooks pre-bash --command '${tool.params.command}'"
}]
}
],
@@ -430,14 +430,14 @@ Edit `.claude/settings.json` to configure hooks:
"matcher": "^(Write|Edit|MultiEdit)$",
"hooks": [{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook post-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/complete' --auto-format --train-patterns"
+ "command": "npx @claude-flow/cli@latest hooks post-edit --file '${tool.params.file_path}' --memory-key 'swarm/editor/complete' --auto-format --train-patterns"
}]
},
{
"matcher": "^Bash$",
"hooks": [{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook post-bash --command '${tool.params.command}' --update-metrics"
+ "command": "npx @claude-flow/cli@latest hooks post-bash --command '${tool.params.command}' --update-metrics"
}]
}
]
@@ -462,7 +462,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook pre-edit --file '${tool.params.file_path}' --auto-assign-agent --validate-syntax",
+ "command": "npx @claude-flow/cli@latest hooks pre-edit --file '${tool.params.file_path}' --auto-assign-agent --validate-syntax",
"timeout": 3000,
"continueOnError": true
}
@@ -473,7 +473,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook pre-task --description '${tool.params.task}' --auto-spawn-agents --load-memory",
+ "command": "npx @claude-flow/cli@latest hooks pre-task --description '${tool.params.task}' --auto-spawn-agents --load-memory",
"async": true
}
]
@@ -483,7 +483,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook pre-search --query '${tool.params.pattern}' --check-cache"
+ "command": "npx @claude-flow/cli@latest hooks pre-search --query '${tool.params.pattern}' --check-cache"
}
]
}
@@ -495,7 +495,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook post-edit --file '${tool.params.file_path}' --memory-key 'edits/${tool.params.file_path}' --auto-format --train-patterns",
+ "command": "npx @claude-flow/cli@latest hooks post-edit --file '${tool.params.file_path}' --memory-key 'edits/${tool.params.file_path}' --auto-format --train-patterns",
"async": true
}
]
@@ -505,7 +505,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook post-task --task-id '${result.task_id}' --analyze-performance --store-decisions --export-learnings",
+ "command": "npx @claude-flow/cli@latest hooks post-task --task-id '${result.task_id}' --analyze-performance --store-decisions --export-learnings",
"async": true
}
]
@@ -515,7 +515,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook post-search --query '${tool.params.pattern}' --cache-results --train-patterns"
+ "command": "npx @claude-flow/cli@latest hooks post-search --query '${tool.params.pattern}' --cache-results --train-patterns"
}
]
}
@@ -526,7 +526,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook session-start --session-id '${session.id}' --load-context"
+ "command": "npx @claude-flow/cli@latest hooks session-start --session-id '${session.id}' --load-context"
}
]
}
@@ -537,7 +537,7 @@ Complete hook configuration with all features:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook session-end --session-id '${session.id}' --export-metrics --generate-summary --cleanup-temp"
+ "command": "npx @claude-flow/cli@latest hooks session-end --session-id '${session.id}' --export-metrics --generate-summary --cleanup-temp"
}
]
}
@@ -559,7 +559,7 @@ Add protection for sensitive files:
"hooks": [
{
"type": "command",
- "command": "npx @claude-flow/cli@latest hook check-protected --file '${tool.params.file_path}'"
+ "command": "npx @claude-flow/cli@latest hooks check-protected --file '${tool.params.file_path}'"
}
]
}
@@ -595,27 +595,18 @@ Run tests after file modifications:
Hooks automatically integrate with MCP tools for coordination:
-#### Pre-Task Hook with Agent Spawning
+#### Pre-Task Hook with Agent Suggestions
```javascript
// Hook command
-npx @claude-flow/cli@latest hook pre-task --description "Build REST API"
-
-// Internally calls MCP tools:
-mcp__claude-flow__agent_spawn {
- type: "backend-dev",
- capabilities: ["api", "database", "testing"]
-}
-
-mcp__claude-flow__memory_usage {
- action: "store",
- key: "swarm/task/api-build/context",
- namespace: "coordination",
- value: JSON.stringify({
- description: "Build REST API",
- agents: ["backend-dev"],
- started: Date.now()
- })
+npx @claude-flow/cli@latest hooks pre-task --description "Build REST API"
+
+// Internally calls this MCP tool:
+mcp__claude-flow__hooks_pre-task {
+ taskId: "<generated by the CLI>",
+ description: "Build REST API",
+ autoSpawn: false,
+ timestamp: Date.now()
}
```
@@ -623,25 +614,13 @@ mcp__claude-flow__memory_usage {
```javascript
// Hook command
-npx @claude-flow/cli@latest hook post-edit --file "api/auth.js"
-
-// Internally calls MCP tools:
-mcp__claude-flow__memory_usage {
- action: "store",
- key: "swarm/edits/api/auth.js",
- namespace: "coordination",
- value: JSON.stringify({
- file: "api/auth.js",
- timestamp: Date.now(),
- changes: { added: 45, removed: 12 },
- formatted: true,
- linted: true
- })
-}
+npx @claude-flow/cli@latest hooks post-edit --file "api/auth.js"
-mcp__claude-flow__neural_train {
- pattern_type: "coordination",
- training_data: { /* edit patterns */ }
+// Internally calls this MCP tool:
+mcp__claude-flow__hooks_post-edit {
+ filePath: "api/auth.js",
+ success: true,
+ timestamp: Date.now()
}
```
@@ -649,18 +628,13 @@ mcp__claude-flow__neural_train {
```javascript
// Hook command
-npx @claude-flow/cli@latest hook session-end --session-id "dev-2024"
+npx @claude-flow/cli@latest hooks session-end --save-state
-// Internally calls MCP tools:
-mcp__claude-flow__memory_persist {
- sessionId: "dev-2024"
+// Internally calls this MCP tool, which saves the session state, stops the worker daemon and returns a summary:
+mcp__claude-flow__hooks_session-end {
+ saveState: true,
+ timestamp: Date.now()
}
-
-mcp__claude-flow__swarm_status {
- swarmId: "current"
-}
-
-// Generates metrics and summary
```
### Memory Coordination Protocol
@@ -671,8 +645,7 @@ All hooks follow a standardized memory coordination pattern:
**Phase 1: STATUS** - Hook starts
```javascript
-mcp__claude-flow__memory_usage {
- action: "store",
+mcp__claude-flow__memory_store {
key: "swarm/hooks/pre-edit/status",
namespace: "coordination",
value: JSON.stringify({
@@ -686,8 +659,7 @@ mcp__claude-flow__memory_usage {
**Phase 2: PROGRESS** - Hook processes
```javascript
-mcp__claude-flow__memory_usage {
- action: "store",
+mcp__claude-flow__memory_store {
key: "swarm/hooks/pre-edit/progress",
namespace: "coordination",
value: JSON.stringify({
@@ -700,8 +672,7 @@ mcp__claude-flow__memory_usage {
**Phase 3: COMPLETE** - Hook finishes
```javascript
-mcp__claude-flow__memory_usage {
- action: "store",
+mcp__claude-flow__memory_store {
key: "swarm/hooks/pre-edit/complete",
namespace: "coordination",
value: JSON.stringify({
@@ -776,7 +747,7 @@ FILES=$(git diff --cached --name-only --diff-filter=ACM)
for FILE in $FILES; do
# Run pre-edit hook for validation
- npx @claude-flow/cli@latest hook pre-edit --file "$FILE" --validate-syntax
+ npx @claude-flow/cli@latest hooks pre-edit --file "$FILE" --validate-syntax
if [ $? -ne 0 ]; then
echo "Validation failed for $FILE"
@@ -784,7 +755,7 @@ for FILE in $FILES; do
fi
# Run post-edit hook for formatting
- npx @claude-flow/cli@latest hook post-edit --file "$FILE" --auto-format
+ npx @claude-flow/cli@latest hooks post-edit --file "$FILE" --auto-format
done
# Run tests
@@ -803,7 +774,7 @@ exit $?
COMMIT_HASH=$(git rev-parse HEAD)
COMMIT_MSG=$(git log -1 --pretty=%B)
-npx @claude-flow/cli@latest hook notify \
+npx @claude-flow/cli@latest hooks notify \
--message "Commit completed: $COMMIT_MSG" \
--level info \
--swarm-status
@@ -820,7 +791,7 @@ npx @claude-flow/cli@latest hook notify \
npm run test:all
# Run quality checks
-npx @claude-flow/cli@latest hook session-end \
+npx @claude-flow/cli@latest hooks session-end \
--generate-report \
--export-metrics
@@ -844,13 +815,13 @@ How agents use hooks for coordination:
```bash
# Agent 1: Backend Developer
# STEP 1: Pre-task preparation
-npx @claude-flow/cli@latest hook pre-task \
+npx @claude-flow/cli@latest hooks pre-task \
--description "Implement user authentication API" \
--auto-spawn-agents \
--load-memory
# STEP 2: Work begins - pre-edit validation
-npx @claude-flow/cli@latest hook pre-edit \
+npx @claude-flow/cli@latest hooks pre-edit \
--file "api/auth.js" \
--auto-assign-agent \
--validate-syntax
@@ -859,20 +830,20 @@ npx @claude-flow/cli@latest hook pre-edit \
# ... code changes ...
# STEP 4: Post-edit processing
-npx @claude-flow/cli@latest hook post-edit \
+npx @claude-flow/cli@latest hooks post-edit \
--file "api/auth.js" \
--memory-key "swarm/backend/auth-api" \
--auto-format \
--train-patterns
# STEP 5: Notify coordination system
-npx @claude-flow/cli@latest hook notify \
+npx @claude-flow/cli@latest hooks notify \
--message "Auth API implementation complete" \
--swarm-status \
--broadcast
# STEP 6: Task completion
-npx @claude-flow/cli@latest hook post-task \
+npx @claude-flow/cli@latest hooks post-task \
--task-id "auth-api" \
--analyze-performance \
--store-decisions \
@@ -882,25 +853,25 @@ npx @claude-flow/cli@latest hook post-task \
```bash
# Agent 2: Test Engineer (receives notification)
# STEP 1: Check memory for API details
-npx @claude-flow/cli@latest hook session-restore \
+npx @claude-flow/cli@latest hooks session-restore \
--session-id "swarm-current" \
--restore-memory
# Memory contains: swarm/backend/auth-api with implementation details
# STEP 2: Generate tests
-npx @claude-flow/cli@latest hook pre-task \
+npx @claude-flow/cli@latest hooks pre-task \
--description "Write tests for auth API" \
--load-memory
# STEP 3: Create test file
-npx @claude-flow/cli@latest hook post-edit \
+npx @claude-flow/cli@latest hooks post-edit \
--file "api/auth.test.js" \
--memory-key "swarm/testing/auth-api-tests" \
--train-patterns
# STEP 4: Share test results
-npx @claude-flow/cli@latest hook notify \
+npx @claude-flow/cli@latest hooks notify \
--message "Auth API tests complete - 100% coverage" \
--broadcast
```
@@ -979,37 +950,37 @@ module.exports = {
```bash
# Session start - initialize coordination
-npx @claude-flow/cli@latest hook session-start --session-id "fullstack-feature"
+npx @claude-flow/cli@latest hooks session-start --session-id "fullstack-feature"
# Pre-task planning
-npx @claude-flow/cli@latest hook pre-task \
+npx @claude-flow/cli@latest hooks pre-task \
--description "Build user profile feature - frontend + backend + tests" \
--auto-spawn-agents \
--optimize-topology
# Backend work
-npx @claude-flow/cli@latest hook pre-edit --file "api/profile.js"
+npx @claude-flow/cli@latest hooks pre-edit --file "api/profile.js"
# ... implement backend ...
-npx @claude-flow/cli@latest hook post-edit \
+npx @claude-flow/cli@latest hooks post-edit \
--file "api/profile.js" \
--memory-key "profile/backend" \
--train-patterns
# Frontend work (reads backend details from memory)
-npx @claude-flow/cli@latest hook pre-edit --file "components/Profile.jsx"
+npx @claude-flow/cli@latest hooks pre-edit --file "components/Profile.jsx"
# ... implement frontend ...
-npx @claude-flow/cli@latest hook post-edit \
+npx @claude-flow/cli@latest hooks post-edit \
--file "components/Profile.jsx" \
--memory-key "profile/frontend" \
--train-patterns
# Testing (reads both backend and frontend from memory)
-npx @claude-flow/cli@latest hook pre-task \
+npx @claude-flow/cli@latest hooks pre-task \
--description "Test profile feature" \
--load-memory
# Session end - export everything
-npx @claude-flow/cli@latest hook session-end \
+npx @claude-flow/cli@latest hooks session-end \
--session-id "fullstack-feature" \
--export-metrics \
--generate-summary
@@ -1019,39 +990,39 @@ npx @claude-flow/cli@latest hook session-end \
```bash
# Start debugging session
-npx @claude-flow/cli@latest hook session-start --session-id "debug-memory-leak"
+npx @claude-flow/cli@latest hooks session-start --session-id "debug-memory-leak"
# Pre-task: analyze issue
-npx @claude-flow/cli@latest hook pre-task \
+npx @claude-flow/cli@latest hooks pre-task \
--description "Debug memory leak in event handlers" \
--load-memory \
--estimate-complexity
# Search for event emitters
-npx @claude-flow/cli@latest hook pre-search --query "EventEmitter"
+npx @claude-flow/cli@latest hooks pre-search --query "EventEmitter"
# ... search executes ...
-npx @claude-flow/cli@latest hook post-search \
+npx @claude-flow/cli@latest hooks post-search \
--query "EventEmitter" \
--cache-results
# Fix the issue
-npx @claude-flow/cli@latest hook pre-edit \
+npx @claude-flow/cli@latest hooks pre-edit \
--file "services/events.js" \
--backup-file
# ... fix code ...
-npx @claude-flow/cli@latest hook post-edit \
+npx @claude-flow/cli@latest hooks post-edit \
--file "services/events.js" \
--memory-key "debug/memory-leak-fix" \
--validate-output
# Verify fix
-npx @claude-flow/cli@latest hook post-task \
+npx @claude-flow/cli@latest hooks post-task \
--task-id "memory-leak-fix" \
--analyze-performance \
--generate-report
# End session
-npx @claude-flow/cli@latest hook session-end \
+npx @claude-flow/cli@latest hooks session-end \
--session-id "debug-memory-leak" \
--export-metrics
```
@@ -1060,27 +1031,27 @@ npx @claude-flow/cli@latest hook session-end \
```bash
# Initialize swarm for refactoring
-npx @claude-flow/cli@latest hook pre-task \
+npx @claude-flow/cli@latest hooks pre-task \
--description "Refactor legacy codebase to modern patterns" \
--auto-spawn-agents \
--optimize-topology
# Agent 1: Code Analyzer
-npx @claude-flow/cli@latest hook pre-task --description "Analyze code complexity"
+npx @claude-flow/cli@latest hooks pre-task --description "Analyze code complexity"
# ... analysis ...
-npx @claude-flow/cli@latest hook post-task \
+npx @claude-flow/cli@latest hooks post-task \
--task-id "analysis" \
--store-decisions
# Agent 2: Refactoring (reads analysis from memory)
-npx @claude-flow/cli@latest hook session-restore \
+npx @claude-flow/cli@latest hooks session-restore \
--session-id "swarm-refactor" \
--restore-memory
for file in src/**/*.js; do
- npx @claude-flow/cli@latest hook pre-edit --file "$file" --backup-file
+ npx @claude-flow/cli@latest hooks pre-edit --file "$file" --backup-file
# ... refactor ...
- npx @claude-flow/cli@latest hook post-edit \
+ npx @claude-flow/cli@latest hooks post-edit \
--file "$file" \
--memory-key "refactor/$file" \
--auto-format \
@@ -1088,12 +1059,12 @@ for file in src/**/*.js; do
done
# Agent 3: Testing (reads refactored code from memory)
-npx @claude-flow/cli@latest hook pre-task \
+npx @claude-flow/cli@latest hooks pre-task \
--description "Generate tests for refactored code" \
--load-memory
# Broadcast completion
-npx @claude-flow/cli@latest hook notify \
+npx @claude-flow/cli@latest hooks notify \
--message "Refactoring complete - all tests passing" \
--broadcast
```
@@ -1117,13 +1088,13 @@ Enable debug mode for troubleshooting:
export CLAUDE_FLOW_DEBUG=true
# Test specific hook with verbose output
-npx @claude-flow/cli@latest hook pre-edit --file "test.js" --debug
+npx @claude-flow/cli@latest hooks pre-edit --file "test.js" --debug
# Check hook execution logs
cat .claude-flow/logs/hooks-$(date +%Y-%m-%d).log
# Validate configuration
-npx @claude-flow/cli@latest hook validate-config
+npx @claude-flow/cli@latest hooks validate-config
```
### Benefits
@@ -1184,9 +1155,8 @@ npx @claude-flow/cli@latest hook validate-config
### Related Commands
- `npx @claude-flow/cli@latest init --hooks` - Initialize hooks system
-- `npx @claude-flow/cli@latest hook --list` - List available hooks
-- `npx @claude-flow/cli@latest hook --test <hook>` - Test specific hook
-- `npx @claude-flow/cli@latest memory usage` - Manage memory
+- `npx @claude-flow/cli@latest hooks list` - List available hooks
+- `npx @claude-flow/cli@latest memory stats` - Show memory statistics
- `npx @claude-flow/cli@latest agent spawn` - Spawn agents
- `npx @claude-flow/cli@latest swarm init` - Initialize swarm
diff --git a/verification/skill-mcp-tool-baseline.json b/verification/skill-mcp-tool-baseline.json
index b55ffabd33..0c5d257e4c 100644
--- a/verification/skill-mcp-tool-baseline.json
+++ b/verification/skill-mcp-tool-baseline.json
@@ -1,6 +1,6 @@
{
"_comment": "Monotone-decreasing baseline of shipped SKILL.md files that reference a ruflo MCP tool not registered by mcp-client.ts (entries are <skill path>::<tool>). Fix one, then re-run with --update-baseline to lower the floor. NEVER add entries to hide a new reference.",
- "danglingCount": 48,
+ "danglingCount": 46,
"knownDangling": [
"v3/@claude-flow/cli/.claude/skills/github-multi-repo/SKILL.md::memory_usage",
"v3/@claude-flow/cli/.claude/skills/github-multi-repo/SKILL.md::task_orchestrate",
@@ -9,8 +9,6 @@
"v3/@claude-flow/cli/.claude/skills/github-release-management/SKILL.md::swarm_monitor",
"v3/@claude-flow/cli/.claude/skills/github-release-management/SKILL.md::task_orchestrate",
"v3/@claude-flow/cli/.claude/skills/github-workflow-automation/SKILL.md::task_orchestrate",
- "v3/@claude-flow/cli/.claude/skills/hooks-automation/SKILL.md::memory_persist",
- "v3/@claude-flow/cli/.claude/skills/hooks-automation/SKILL.md::memory_usage",
"v3/@claude-flow/cli/.claude/skills/sparc-methodology/SKILL.md::bottleneck_analyze",
"v3/@claude-flow/cli/.claude/skills/sparc-methodology/SKILL.md::context_restore",
"v3/@claude-flow/cli/.claude/skills/sparc-methodology/SKILL.md::memory_persist",
@@ -51,5 +49,5 @@
"v3/@claude-flow/cli/.claude/skills/swarm-advanced/SKILL.md::trigger_setup",
"v3/@claude-flow/cli/.claude/skills/swarm-advanced/SKILL.md::usage_stats"
],
- "updatedAt": "2026-10-13T08:38:37.635Z"
+ "updatedAt": "2026-10-27T17:39:40.188Z"
}