# How to pin an AI agent to its approved plan

DevFeed: [How to pin an AI agent to its approved plan](<https://devfeed.tech/articles/how-to-pin-an-ai-agent-to-its-approved-plan-131127.md>)

Original publisher: [Read original article](<https://nirmata.com/2026/11/13/pinning-an-agent-to-its-approved-plan-task-allowlisting/>)

Author: Ritesh Patel

Published: 2026-11-13T03:00:21.126505Z

Content type: tutorial

Language: en

Sources: [Nirmata](<https://devfeed.tech/sources/nirmata.md>)

Topics: [AI Agent](<https://devfeed.tech/topics/ai-agent.md>), [Claude Code](<https://devfeed.tech/topics/claude-code.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [ai-coding](<https://devfeed.tech/tags/ai-coding.md>), [ai-coding-agent](<https://devfeed.tech/tags/ai-coding-agent.md>), [ai-governance](<https://devfeed.tech/tags/ai-governance.md>), [allowed](<https://devfeed.tech/tags/allowed.md>), [allows](<https://devfeed.tech/tags/allows.md>), [argument](<https://devfeed.tech/tags/argument.md>), [arguments](<https://devfeed.tech/tags/arguments.md>), [audit](<https://devfeed.tech/tags/audit.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [code](<https://devfeed.tech/tags/code.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [pin](<https://devfeed.tech/tags/pin.md>), [plan](<https://devfeed.tech/tags/plan.md>), [pretooluse-hook](<https://devfeed.tech/tags/pretooluse-hook.md>), [security](<https://devfeed.tech/tags/security.md>), [tool](<https://devfeed.tech/tags/tool.md>)

## AI overview

Pinning an approved plan in Claude Code requires translating its permitted actions into exact allow rules, explicitly denying excluded calls, running execution in `dontAsk` mode, and using a `PreToolUse` hook to compare call arguments with the plan. The excerpt reports a Claude Code 2.1.321 test where a deny rule blocked `git push` despite the hook allowing it, and the hook blocked an allowed command missing from the plan. Deny rules take precedence over hook approvals; hooks can add blocks but should not be the sole hard limit because timeouts do not block calls by themselves. An allowlist bounds executable tool calls but cannot detect reasoning drift, so the article recommends retaining an audit trail. Project rules require accepting workspace trust, and `dontAsk` can deny MCP or connector tools requiring user interaction even when allowed.

## Source excerpt

Pin an AI agent to its approved plan by allowlisting exact tool calls, denying the rest and checking arguments in a PreToolUse hook. Claude Code steps included.