[EXTRACT P2-5] Extract hook system and security patterns #178
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent Epic: #154 | Phase 2 — Pattern Extraction | After Phase 1
Source Files
src/hooks/toolPermission/— permission hookssrc/hooks/useCanUseTool.tsx— tool gatingsrc/utils/hooks.jsor equivalent/root/claude-code/plugins/security-guidance//root/claude-code/examples/hooks/bash_command_validator_example.pyExtract These Specific Patterns
Hook registration — How are hooks registered and ordered? PreToolUse vs PostToolUse?
Permission gating —
useCanUseTool. What can a hook do: block, modify input, add context, log?Hook exit codes — The open-source example shows: 0=allow, 1=show stderr to user, 2=block and show to model. What other codes exist?
Security patterns — The security-guidance plugin monitors 9 patterns. List them all.
Frontmatter hooks — Can hooks be defined in markdown frontmatter? How?
Why This Matters
Maps to our prompt injection audit (#131) and security tickets (#132-138). Their hook system is exactly the enforcement layer we need.
Output
claude-code-analysis/patterns/hooks-security.mdAcceptance Criteria