#!/usr/bin/env node /** * Trigger Word Checker Hook * * Detects "ff" and "ffs" code words in user prompts and provides * immediate instruction to Claude on how to handle them. * * This runs on EVERY user message to ensure triggers are never missed. */ const input = JSON.parse(process.argv[2] || '{}'); const userMessage = input.text || ''; // Normalize: trim whitespace, lowercase for matching const normalized = userMessage.trim().toLowerCase(); // Check for "ffs" trigger (exact match or standalone word) if (normalized === 'ffs' || /\bffs\b/.test(normalized)) { console.log('\x1b[33m⚠️ CODE WORD DETECTED: "ffs"\x1b[0m'); console.log('\x1b[36mClaude MUST run: node scripts/framework-stats.js\x1b[0m'); console.log('\x1b[36mSee inst_082 and CLAUDE.md lines 66-88\x1b[0m'); process.exit(0); } // Check for "ff" prefix trigger if (normalized.startsWith('ff ')) { console.log('\x1b[33m⚠️ CODE WORD DETECTED: "ff"\x1b[0m'); console.log('\x1b[36mClaude MUST run: node scripts/framework-audit-response.js --prompt "..." --type "boundary_question"\x1b[0m'); console.log('\x1b[36mSee inst_078 and CLAUDE.md lines 48-64\x1b[0m'); process.exit(0); } // No trigger words found - continue normally process.exit(0);