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

Checkpoint: File edits

rUv6d4895d226fa
diff --git a/.claude/helpers/hook-handler.cjs b/.claude/helpers/hook-handler.cjs
new file mode 100644
index 0000000000..860ef2f1c4
--- /dev/null
+++ b/.claude/helpers/hook-handler.cjs
@@ -0,0 +1,191 @@
+#!/usr/bin/env node
+/**
+ * Claude Flow Hook Handler (Cross-Platform)
+ * Dispatches hook events to the appropriate helper modules.
+ */
+
+const path = require('path');
+const fs = require('fs');
+
+const helpersDir = __dirname;
+
+function safeRequire(modulePath) {
+ try {
+ if (fs.existsSync(modulePath)) {
+ const origLog = console.log;
+ const origError = console.error;
+ console.log = () => {};
+ console.error = () => {};
+ try {
+ const mod = require(modulePath);
+ return mod;
+ } finally {
+ console.log = origLog;
+ console.error = origError;
+ }
+ }
+ } catch (e) {
+ // silently fail
+ }
+ return null;
+}
+
+const router = safeRequire(path.join(helpersDir, 'router.js'));
+const session = safeRequire(path.join(helpersDir, 'session.js'));
+const memory = safeRequire(path.join(helpersDir, 'memory.js'));
+const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
+
+const [,, command, ...args] = process.argv;
+const prompt = process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';
+
+const handlers = {
+ 'route': () => {
+ if (intelligence && intelligence.getContext) {
+ try {
+ const ctx = intelligence.getContext(prompt);
+ if (ctx) console.log(ctx);
+ } catch (e) { /* non-fatal */ }
+ }
+ if (router && router.routeTask) {
+ const result = router.routeTask(prompt);
+ var output = [];
+ output.push('[INFO] Routing task: ' + (prompt.substring(0, 80) || '(no prompt)'));
+ output.push('');
+ output.push('+------------------- Primary Recommendation -------------------+');
+ output.push('| Agent: ' + result.agent.padEnd(53) + '|');
+ output.push('| Confidence: ' + (result.confidence * 100).toFixed(1) + '%' + ' '.repeat(44) + '|');
+ output.push('| Reason: ' + result.reason.substring(0, 53).padEnd(53) + '|');
+ output.push('+--------------------------------------------------------------+');
+ console.log(output.join('\n'));
+ } else {
+ console.log('[INFO] Router not available, using default routing');
+ }
+ },
+
+ 'pre-bash': () => {
+ var cmd = prompt.toLowerCase();
+ var dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:'];
+ for (var i = 0; i < dangerous.length; i++) {
+ if (cmd.includes(dangerous[i])) {
+ console.error('[BLOCKED] Dangerous command detected: ' + dangerous[i]);
+ process.exit(1);
+ }
+ }
+ console.log('[OK] Command validated');
+ },
+
+ 'post-edit': () => {
+ if (session && session.metric) {
+ try { session.metric('edits'); } catch (e) { /* no active session */ }
+ }
+ if (intelligence && intelligence.recordEdit) {
+ try {
+ var file = process.env.TOOL_INPUT_file_path || args[0] || '';
+ intelligence.recordEdit(file);
+ } catch (e) { /* non-fatal */ }
+ }
+ console.log('[OK] Edit recorded');
+ },
+
+ 'session-restore': () => {
+ if (session) {
+ var existing = session.restore && session.restore();
+ if (!existing) {
+ session.start && session.start();
+ }
+ } else {
+ console.log('[OK] Session restored: session-' + Date.now());
+ }
+ if (intelligence && intelligence.init) {
+ try {
+ var result = intelligence.init();
+ if (result && result.nodes > 0) {
+ console.log('[INTELLIGENCE] Loaded ' + result.nodes + ' patterns, ' + result.edges + ' edges');
+ }
+ } catch (e) { /* non-fatal */ }
+ }
+ },
+
+ 'session-end': () => {
+ if (intelligence && intelligence.consolidate) {
+ try {
+ var result = intelligence.consolidate();
+ if (result && result.entries > 0) {
+ var msg = '[INTELLIGENCE] Consolidated: ' + result.entries + ' entries, ' + result.edges + ' edges';
+ if (result.newEntries > 0) msg += ', ' + result.newEntries + ' new';
+ msg += ', PageRank recomputed';
+ console.log(msg);
+ }
+ } catch (e) { /* non-fatal */ }
+ }
+ if (session && session.end) {
+ session.end();
+ } else {
+ console.log('[OK] Session ended');
+ }
+ },
+
+ 'pre-task': () => {
+ if (session && session.metric) {
+ try { session.metric('tasks'); } catch (e) { /* no active session */ }
+ }
+ if (router && router.routeTask && prompt) {
+ var result = router.routeTask(prompt);
+ console.log('[INFO] Task routed to: ' + result.agent + ' (confidence: ' + result.confidence + ')');
+ } else {
+ console.log('[OK] Task started');
+ }
+ },
+
+ 'post-task': () => {
+ if (intelligence && intelligence.feedback) {
+ try {
+ intelligence.feedback(true);
+ } catch (e) { /* non-fatal */ }
+ }
+ console.log('[OK] Task completed');
+ },
+
+ 'compact-manual': () => {
+ console.log('PreCompact Guidance:');
+ console.log('IMPORTANT: Review CLAUDE.md in project root for:');
+ console.log(' - Available agents and concurrent usage patterns');
+ console.log(' - Swarm coordination strategies (hierarchical, mesh, adaptive)');
+ console.log(' - Critical concurrent execution rules (1 MESSAGE = ALL OPERATIONS)');
+ console.log('Ready for compact operation');
+ },
+
+ 'compact-auto': () => {
+ console.log('Auto-Compact Guidance (Context Window Full):');
+ console.log('CRITICAL: Before compacting, ensure you understand:');
+ console.log(' - All agents available in .claude/agents/ directory');
+ console.log(' - Concurrent execution patterns from CLAUDE.md');
+ console.log(' - Swarm coordination strategies for complex tasks');
+ console.log('Apply GOLDEN RULE: Always batch operations in single messages');
+ console.log('Auto-compact proceeding with full agent context');
+ },
+
+ 'status': () => {
+ console.log('[OK] Status check');
+ },
+
+ 'stats': () => {
+ if (intelligence && intelligence.stats) {
+ intelligence.stats(args.includes('--json'));
+ } else {
+ console.log('[WARN] Intelligence module not available. Run session-restore first.');
+ }
+ },
+};
+
+if (command && handlers[command]) {
+ try {
+ handlers[command]();
+ } catch (e) {
+ console.log('[WARN] Hook ' + command + ' encountered an error: ' + e.message);
+ }
+} else if (command) {
+ console.log('[OK] Hook: ' + command);
+} else {
+ console.log('Usage: hook-handler.cjs <route|pre-bash|post-edit|session-restore|session-end|pre-task|post-task|compact-manual|compact-auto|status|stats>');
+}
diff --git a/.claude/settings.json b/.claude/settings.json
index 260163789d..4d6c7cea0a 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -107,10 +107,15 @@
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "/workspaces/claude-flow/.claude/helpers/guidance-hooks.sh pre-edit \"$TOOL_INPUT_file_path\" 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks pre-edit --file \"$TOOL_INPUT_file_path\" --intelligence true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks pre-edit --file \"$TOOL_INPUT_file_path\" --intelligence true 2>/dev/null || true"
}
]
},
@@ -120,17 +125,37 @@
{
"type": "command",
"timeout": 3000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks pre-command --command \"$TOOL_INPUT_command\""
+ "command": "/workspaces/claude-flow/.claude/helpers/guidance-hooks.sh pre-command \"$TOOL_INPUT_command\" 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks pre-command --command \"$TOOL_INPUT_command\" 2>/dev/null || true"
}
]
},
{
"matcher": "Task",
"hooks": [
+ {
+ "type": "command",
+ "timeout": 2000,
+ "command": "/workspaces/claude-flow/.claude/helpers/guidance-hooks.sh route \"$TOOL_INPUT_prompt\" 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "/workspaces/claude-flow/.claude/helpers/swarm-hooks.sh pre-task \"$TOOL_INPUT_prompt\" 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "cat | jq -r '.tool_input.prompt // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-task --description '{}' --coordinate-swarm true 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks pre-task --task-id \"task-$(date +%s)\" --description \"$TOOL_INPUT_prompt\" --intelligence true --swarm-coordinate true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks pre-task --task-id \"task-$(date +%s)\" --description \"$TOOL_INPUT_prompt\" --intelligence true --swarm-coordinate true 2>/dev/null || true"
}
]
}
@@ -139,10 +164,25 @@
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "/workspaces/claude-flow/.claude/helpers/guidance-hooks.sh post-edit \"$TOOL_INPUT_file_path\" 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-edit --file \"$TOOL_INPUT_file_path\" --success true --train-patterns true --memory-key \"edit/$TOOL_INPUT_file_path\""
+ "command": "/workspaces/claude-flow/.claude/helpers/learning-hooks.sh store \"Edit: $TOOL_INPUT_file_path\" code 0.7 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 4000,
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-edit --file \"$TOOL_INPUT_file_path\" --success true --train-patterns true --memory-key \"edit/$TOOL_INPUT_file_path\" 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 10000,
+ "command": "/workspaces/claude-flow/.claude/helpers/auto-commit.sh batch 'Checkpoint: File edits' 2>/dev/null || true"
}
]
},
@@ -152,17 +192,52 @@
{
"type": "command",
"timeout": 3000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-command --command \"$TOOL_INPUT_command\" --exit-code 0 --success true"
+ "command": "npx agentic-flow@alpha hooks post-command \"$TOOL_INPUT_command\" -c 0 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 2000,
+ "command": "/workspaces/claude-flow/.claude/helpers/swarm-monitor.sh check 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-command --command \"$TOOL_INPUT_command\" --exit-code 0 --success true 2>/dev/null || true"
}
]
},
{
"matcher": "Task",
"hooks": [
+ {
+ "type": "command",
+ "timeout": 2000,
+ "command": "npx agentic-flow@alpha hooks metrics 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "/workspaces/claude-flow/.claude/helpers/swarm-monitor.sh check 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "/workspaces/claude-flow/.claude/helpers/swarm-hooks.sh post-task \"$TOOL_INPUT_prompt\" true 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 4000,
+ "command": "/workspaces/claude-flow/.claude/helpers/checkpoint-manager.sh agent-checkpoint \"Task completed: $TOOL_INPUT_prompt\" 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "cat | jq -r '{agent: .tool_input.subagent_type, description: .tool_input.description} | @json' | xargs -I {} npx claude-flow@alpha hooks post-task --agent-data '{}' --update-swarm-status true --train-patterns true 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-task --task-id \"task-$(date +%s)\" --description \"$TOOL_INPUT_prompt\" --success true --train-patterns true --update-metrics true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-task --task-id \"task-$(date +%s)\" --description \"$TOOL_INPUT_prompt\" --success true --train-patterns true --update-metrics true 2>/dev/null || true"
}
]
}
@@ -171,10 +246,15 @@
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "npx agentic-flow@alpha hooks post-edit \"$TOOL_INPUT_file_path\" --fail 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-edit --file \"$TOOL_INPUT_file_path\" --success false --learn-from-failure true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-edit --file \"$TOOL_INPUT_file_path\" --success false --learn-from-failure true 2>/dev/null || true"
}
]
},
@@ -184,7 +264,12 @@
{
"type": "command",
"timeout": 3000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-command --command \"$TOOL_INPUT_command\" --exit-code 1 --success false --learn-from-failure true"
+ "command": "npx agentic-flow@alpha hooks post-command \"$TOOL_INPUT_command\" -c 1 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-command --command \"$TOOL_INPUT_command\" --exit-code 1 --success false --learn-from-failure true 2>/dev/null || true"
}
]
},
@@ -194,7 +279,7 @@
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-task --task-id \"task-$(date +%s)\" --description \"$TOOL_INPUT_prompt\" --success false --learn-from-failure true --retry-analysis true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks post-task --task-id \"task-$(date +%s)\" --description \"$TOOL_INPUT_prompt\" --success false --learn-from-failure true --retry-analysis true 2>/dev/null || true"
}
]
}
@@ -202,15 +287,40 @@
"SessionStart": [
{
"hooks": [
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "/workspaces/claude-flow/.claude/helpers/daemon-manager.sh start 3 5 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 8000,
+ "command": "/workspaces/claude-flow/.claude/helpers/learning-hooks.sh session-start 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "/workspaces/claude-flow/.claude/helpers/swarm-hooks.sh agents 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "/workspaces/claude-flow/.claude/helpers/guidance-hooks.sh session-context 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "npx claude-flow@alpha hooks session-start --auto-configure true --restore-context true 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 6000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks session-restore --restore-memory true --load-patterns true --intelligence true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks session-restore --restore-memory true --load-patterns true --intelligence true 2>/dev/null || true"
},
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks build-agents --topology hierarchical-mesh --max-agents 15"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks build-agents --topology hierarchical-mesh --max-agents 15 2>/dev/null || true"
}
]
}
@@ -218,15 +328,40 @@
"SessionEnd": [
{
"hooks": [
+ {
+ "type": "command",
+ "timeout": 10000,
+ "command": "/workspaces/claude-flow/.claude/helpers/learning-hooks.sh session-end 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 8000,
+ "command": "npx agentic-flow@alpha hooks metrics --json 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 6000,
+ "command": "/workspaces/claude-flow/.claude/helpers/checkpoint-manager.sh session-end \"V3 development session completed\" 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 4000,
+ "command": "/workspaces/claude-flow/.claude/helpers/update-v3-progress.sh status > /workspaces/claude-flow/.claude-flow/last-session-status.txt 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 2000,
+ "command": "/workspaces/claude-flow/.claude/helpers/daemon-manager.sh stop 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 8000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks session-end --persist-memory true --export-patterns true --generate-summary true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks session-end --persist-memory true --export-patterns true --generate-summary true 2>/dev/null || true"
},
{
"type": "command",
"timeout": 5000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks metrics --format json --output /workspaces/claude-flow/.claude-flow/v3-session-metrics.json"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks metrics --format json --output /workspaces/claude-flow/.claude-flow/v3-session-metrics.json 2>/dev/null || true"
}
]
}
@@ -234,15 +369,25 @@
"UserPromptSubmit": [
{
"hooks": [
+ {
+ "type": "command",
+ "timeout": 4000,
+ "command": "/workspaces/claude-flow/.claude/helpers/guidance-hooks.sh user-prompt \"$USER_PROMPT\" 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 5000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks route --task \"$USER_PROMPT\" --intelligence true --auto-swarm true --complexity-threshold 3"
+ "command": "npx claude-flow@alpha hooks route-task --auto-swarm true --detect-complexity true 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks route --task \"$USER_PROMPT\" --intelligence true --auto-swarm true --complexity-threshold 3 2>/dev/null || true"
},
{
"type": "command",
"timeout": 6000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks worker detect --prompt \"$USER_PROMPT\" --auto-dispatch --min-confidence 0.6"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks worker detect --prompt \"$USER_PROMPT\" --auto-dispatch --min-confidence 0.6 2>/dev/null || true"
}
]
}
@@ -251,15 +396,30 @@
{
"matcher": ".*",
"hooks": [
+ {
+ "type": "command",
+ "timeout": 8000,
+ "command": "/workspaces/claude-flow/.claude/helpers/learning-hooks.sh session-end 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "npx agentic-flow@alpha hooks metrics --json 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 5000,
+ "command": "npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true 2>/dev/null || true"
+ },
{
"type": "command",
"timeout": 6000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks session-end --persist-memory true --train-final-patterns true --export-learnings true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks session-end --persist-memory true --train-final-patterns true --export-learnings true 2>/dev/null || true"
},
{
"type": "command",
"timeout": 4000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks transfer --export-patterns /workspaces/claude-flow/.claude-flow/v3-patterns.json"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks transfer --export-patterns /workspaces/claude-flow/.claude-flow/v3-patterns.json 2>/dev/null || true"
}
]
}
@@ -270,7 +430,12 @@
{
"type": "command",
"timeout": 5000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks teammate-idle --auto-assign true --check-task-list true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks teammate-idle --auto-assign true --check-task-list true 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "npx claude-flow@alpha hooks teammate-idle --auto-assign true 2>/dev/null || true"
}
]
}
@@ -281,7 +446,12 @@
{
"type": "command",
"timeout": 5000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks task-completed --task-id \"$TASK_ID\" --train-patterns true --notify-lead true --update-metrics true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks task-completed --task-id \"$TASK_ID\" --train-patterns true --notify-lead true --update-metrics true 2>/dev/null || true"
+ },
+ {
+ "type": "command",
+ "timeout": 3000,
+ "command": "npx claude-flow@alpha hooks task-completed --train-patterns true --store-results true 2>/dev/null || true"
}
]
}
@@ -290,20 +460,28 @@
{
"matcher": "manual",
"hooks": [
+ {
+ "type": "command",
+ "command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \\\"\\\"\"); echo \"🔄 PreCompact Guidance:\"; echo \"📋 IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" • 54 available agents and concurrent usage patterns\"; echo \" • Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" • SPARC methodology workflows with batchtools optimization\"; echo \" • Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"✅ Ready for compact operation\"'"
+ },
{
"type": "command",
"timeout": 5000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks transfer --export-patterns /workspaces/claude-flow/.claude-flow/compact-patterns.json --preserve-critical true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks transfer --export-patterns /workspaces/claude-flow/.claude-flow/compact-patterns.json --preserve-critical true 2>/dev/null || true"
}
]
},
{
"matcher": "auto",
"hooks": [
+ {
+ "type": "command",
+ "command": "/bin/bash -c 'echo \"🔄 Auto-Compact Guidance (Context Window Full):\"; echo \"📋 CRITICAL: Before compacting, ensure you understand:\"; echo \" • All 54 agents available in .claude/agents/ directory\"; echo \" • Concurrent execution patterns from CLAUDE.md\"; echo \" • Batchtools optimization for 300% performance gains\"; echo \" • Swarm coordination strategies for complex tasks\"; echo \"⚡ Apply GOLDEN RULE: Always batch operations in single messages\"; echo \"✅ Auto-compact proceeding with full agent context\"'"
+ },
{
"type": "command",
"timeout": 6000,
- "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks intelligence --export-state /workspaces/claude-flow/.claude-flow/intelligence-state.json --preserve-patterns true"
+ "command": "node /workspaces/claude-flow/v3/@claude-flow/cli/bin/cli.js hooks intelligence --export-state /workspaces/claude-flow/.claude-flow/intelligence-state.json --preserve-patterns true 2>/dev/null || true"
}
]
}
diff --git a/agents/architect.yaml b/agents/architect.yaml
index 0b0d7cfb66..4ed2da255b 100644
--- a/agents/architect.yaml
+++ b/agents/architect.yaml
@@ -8,4 +8,4 @@ capabilities:
optimizations:
- context-caching
- memory-persistence
-createdAt: "2026-02-11T21:03:27.427Z"
+createdAt: "2026-02-11T22:34:36.389Z"
diff --git a/agents/coder.yaml b/agents/coder.yaml
index b232596d89..d49c4502fd 100644
--- a/agents/coder.yaml
+++ b/agents/coder.yaml
@@ -8,4 +8,4 @@ capabilities:
optimizations:
- flash-attention
- token-reduction
-createdAt: "2026-02-11T21:03:27.427Z"
+createdAt: "2026-02-11T22:34:36.389Z"
diff --git a/agents/reviewer.yaml b/agents/reviewer.yaml
index 4c4e57b25d..789a3c5001 100644
--- a/agents/reviewer.yaml
+++ b/agents/reviewer.yaml
@@ -7,4 +7,4 @@ capabilities:
- best-practices
optimizations:
- incremental-analysis
-createdAt: "2026-02-11T21:03:27.428Z"
+createdAt: "2026-02-11T22:34:36.389Z"
diff --git a/agents/security-architect.yaml b/agents/security-architect.yaml
index d833285fca..8008429f39 100644
--- a/agents/security-architect.yaml
+++ b/agents/security-architect.yaml
@@ -7,4 +7,4 @@ capabilities:
- security-review
optimizations:
- pattern-matching
-createdAt: "2026-02-11T21:03:27.427Z"
+createdAt: "2026-02-11T22:34:36.389Z"
diff --git a/agents/tester.yaml b/agents/tester.yaml
index 6e2aa0a53b..7072f8636b 100644
--- a/agents/tester.yaml
+++ b/agents/tester.yaml
@@ -7,4 +7,4 @@ capabilities:
- coverage
optimizations:
- parallel-execution
-createdAt: "2026-02-11T21:03:27.427Z"
+createdAt: "2026-02-11T22:34:36.389Z"