From c3f1594acdfd49a9c095d7e90d0e51e9724628bc Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Thu, 22 Jan 2026 21:06:23 -0800 Subject: [PATCH] fix: move session-end hooks from Stop to SessionEnd Stop hook fires after every response, SessionEnd fires only when session actually terminates. This was causing session-end.sh and evaluate-session.sh to run on every response instead of at session end. Fixes issue reported by user about hooks triggering every response. --- hooks/hooks.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hooks/hooks.json b/hooks/hooks.json index b09b5bb..3cc1314 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -128,8 +128,10 @@ "command": "#!/bin/bash\n# Final check for console.logs in modified files\ninput=$(cat)\n\nif git rev-parse --git-dir > /dev/null 2>&1; then\n modified_files=$(git diff --name-only HEAD 2>/dev/null | grep -E '\\.(ts|tsx|js|jsx)$' || true)\n \n if [ -n \"$modified_files\" ]; then\n has_console=false\n while IFS= read -r file; do\n if [ -f \"$file\" ]; then\n if grep -q \"console\\.log\" \"$file\" 2>/dev/null; then\n echo \"[Hook] WARNING: console.log found in $file\" >&2\n has_console=true\n fi\n fi\n done <<< \"$modified_files\"\n \n if [ \"$has_console\" = true ]; then\n echo \"[Hook] Remove console.log statements before committing\" >&2\n fi\n fi\nfi\n\necho \"$input\"" } ], - "description": "Final audit for console.log in modified files before session ends" - }, + "description": "Check for console.log in modified files after each response" + } + ], + "SessionEnd": [ { "matcher": "*", "hooks": [