Hook Design Pattern Reference
Hook Event Types
Exit Code Conventions
Key Principle: Success is always silent. 4000 lines of pass logs cause Agent to lose task focus and start discussing test files instead of completing the task.
4 Handler Types
Selection Decision Tree:
Choosing Hooks by Failure Type
settings.json Configuration Example
Minimum Viable Hook Set (Day 1)
Top three highest ROI Hooks:
- Stop Hook — Type Checking: Ensure code is type-correct every time Agent completes
- PostToolUse Hook — Auto Formatting: Ensure consistent code style, completely silent on success
- PreToolUse Hook — Protect Sensitive Files: Prevent access to .env, secret, etc.
These three Hooks cover 80% of common quality issues and are the fastest way to establish a Harness.
