Hooks as enforcement mechanism for AI behavior — use when a written rule fails repeatedly in generation flow and deterministic structural enforcement is needed. Triggers include detecting cyclic rule failure, asking about Claude Code hooks/lifecycle events (SessionStart, UserPromptSubmit, PreToolUse
Hooks as enforcement mechanism for AI behavior — use when a written rule fails repeatedly in generation flow and deterministic structural enforcement is needed. Triggers include detecting cyclic rule failure, asking about Claude Code hooks/lifecycle events (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop), or when a behavior guard needs to execute outside the AI's inference loop.