Use LLM-prompt 'agent hooks' to verify conditions deterministically before a tool runs
Claude·medium signal
Beyond shell-command hooks, Claude Code supports agent hooks that fire a subagent (able to read files, grep, and use tools) at lifecycle events to return an allow/deny decision — e.g., a PreToolUse hook that inspects a write and blocks it if it touches secrets. Unlike instructions in a prompt, hooks execute deterministic logic that can't be hallucinated away. Use them to enforce guardrails the model is otherwise free to ignore.