From 6b6fecd2ea0948315e863f4f46f22a6bbc2d4c50 Mon Sep 17 00:00:00 2001 From: rUv Date: Thu, 8 Jan 2026 03:56:38 +0000 Subject: [PATCH] Checkpoint: File edits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic checkpoint created by Claude Code - Branch: v3 - Timestamp: 2026-01-08T03:56:38Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../cli/src/init/settings-generator.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/v3/@claude-flow/cli/src/init/settings-generator.ts b/v3/@claude-flow/cli/src/init/settings-generator.ts index 8f4cdc75c1..b4c1f3f1d0 100644 --- a/v3/@claude-flow/cli/src/init/settings-generator.ts +++ b/v3/@claude-flow/cli/src/init/settings-generator.ts @@ -150,42 +150,54 @@ function generateHooksConfig(config: HooksConfig): object { // PostToolUse hooks if (config.postToolUse) { hooks.PostToolUse = [ - // File edit hooks with learning + // File edit hooks with neural pattern training { matcher: '^(Write|Edit|MultiEdit)$', hooks: [ { type: 'command', - command: 'if [ -n "$TOOL_INPUT_file_path" ]; then npx claude-flow@v3alpha hooks post-edit --file "$TOOL_INPUT_file_path" --success "${TOOL_SUCCESS:-true}" 2>/dev/null; fi; exit 0', + command: 'npx @claude-flow/cli@latest hooks post-edit --file "$TOOL_INPUT_file_path" --success "$TOOL_SUCCESS" --train-patterns 2>/dev/null || true', timeout: config.timeout, continueOnError: config.continueOnError, }, ], }, - // Bash command hooks with metrics + // Bash command hooks with metrics and exit code tracking { matcher: '^Bash$', hooks: [ { type: 'command', - command: 'if [ -n "$TOOL_INPUT_command" ]; then npx claude-flow@v3alpha hooks post-command --command "$TOOL_INPUT_command" --success "${TOOL_SUCCESS:-true}" 2>/dev/null; fi; exit 0', + command: 'npx @claude-flow/cli@latest hooks post-command --command "$TOOL_INPUT_command" --success "$TOOL_SUCCESS" --exit-code "$TOOL_EXIT_CODE" --track-metrics 2>/dev/null || true', timeout: config.timeout, continueOnError: config.continueOnError, }, ], }, - // Task completion hooks + // Task completion hooks with analysis { matcher: '^Task$', hooks: [ { type: 'command', - command: 'if [ -n "$TOOL_RESULT_agent_id" ]; then npx claude-flow@v3alpha hooks post-task --task-id "$TOOL_RESULT_agent_id" --success "${TOOL_SUCCESS:-true}" 2>/dev/null; fi; exit 0', + command: 'npx @claude-flow/cli@latest hooks post-task --agent-id "$TOOL_RESULT_agent_id" --success "$TOOL_SUCCESS" --analyze 2>/dev/null || true', timeout: config.timeout, continueOnError: config.continueOnError, }, ], }, + // Search result caching for HNSW optimization + { + matcher: '^(Grep|Glob)$', + hooks: [ + { + type: 'command', + command: 'npx @claude-flow/cli@latest hooks post-search --cache-results 2>/dev/null || true', + timeout: 2000, + continueOnError: config.continueOnError, + }, + ], + }, ]; }