Dev finds 'ask' hook lets AI skip prerequisites; 'deny' enforces them correctly
A developer building a self-steering progressive disclosure system discovered a subtle but critical mistake in how Claude Code's PreToolUse hooks work. They had used a 'permissionDecision: ask' hook to force their AI agent to read a design document before editing governed code, but the agent bypassed the prerequisite every time. The problem was that 'ask' only surfaces the tool call for human approval — approving it lets the action run without the agent completing any prior step. Switching to 'deny' with an explanatory reason forces the agent to halt, complete the prerequisite, and retry, which is the intended gate behavior. The developer cautioned that a 'deny' condition must be clearable by the agent's own actions, or it will permanently block progress.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in