Your instruction file says “always use the virtual environment for Python.” The agent reads it, nods, and then calls bare python3 anyway. Sound familiar?

That’s where hooks come in. Hooks are shell commands that fire automatically at specific points in the agent’s workflow β€” before or after a tool runs, when a session starts, when it finishes. Unlike instruction files (which are advisory), a hook always runs.

Three useful examples: β€” preToolUse: block bare python3 calls that skip the venv β€” the agent gets a clear error message instead of a silent wrong environment β€” postToolUse: run your test suite after every file edit β€” Claude Code lets you target Edit|Write tools specifically with a matcher; Copilot CLI fires on all tools so your script filters by toolName β€” Stop / Notification: get a macOS desktop notification when the agent finishes or needs input β€” useful when you’ve wandered off to do something else (see: CCNotify)

Both Copilot CLI and Claude Code support hooks. The naming differs slightly, but the concept is the same: a trigger point, a shell command, done.

πŸ’‘ Try this: pick one thing your agent keeps forgetting or that you keep doing manually β€” and hook it. πŸ”— Using hooks with Copilot CLI
πŸ”— CCNotify β€” desktop notifications for Claude Code


Do you use hooks or automated checks with your coding agent?

🟒 Yes β€” I’ve automated something
🟑 Not yet, but I want to
πŸ”΄ Still doing it manually
βšͺ Didn’t know this was possible

What would you automate with a hook?