Permissions
Decide what an agent may attempt, outside the model: least privilege, allow, ask and deny rules, modes, and why rules are a policy rather than a boundary.
Permissions answer “may it try?”
A permission system decides whether a tool call is allowed to be attempted. It is separate from what the model wants and from what the action can reach once it runs. Claude Code’s docs draw this line: permission modes decide whether Claude asks before an action, while the sandbox and outer isolation decide what the action can reach2. See Sandboxing for the second half.
The most important property is where the check lives. Claude Code’s docs say rules are enforced by the tool itself, not by the model, and that instructions in a prompt or a CLAUDE.md file shape what Claude tries but do not change what is allowed1. Any permission you express only in a prompt is a request, not a control.
Least privilege
OWASP’s 2025 list names excessive agency, meaning too many tools, too much privilege or too much autonomy, as a risk, and expanded it for agentic designs5. The fix is the oldest idea in security: give the agent only what the task needs.
Diagram: my own.
Apply it per task and per agent, not once for the whole system. A research subagent needs read access and search. It does not need your shell (Subagents).
Allow, ask, deny
Claude Code supports three rule types: allow rules let a tool run without approval, ask rules prompt each time, and deny rules block the tool1. They are evaluated in the order deny, ask, allow, and the first match wins, so a deny rule always takes precedence1. Deny rules apply in every mode, including the mode that skips prompts2.
The Agent SDK describes a fuller flow: hooks run first and can allow, deny or continue; then deny rules, ask rules, the permission mode, allow rules, and finally a callback you provide for runtime decisions3.
Diagram: my own simplification of the flow in 3. Other tools order their checks differently.
Useful patterns, which I am drawing from those docs and from general practice:
- Default to ask, then allow narrowly. Pre-approve specific commands you have reviewed, not whole tools.
- Deny what should never happen, such as reading credential files or pushing to protected branches.
- Use hooks for dynamic policy, such as blocking a command based on its arguments (Hooks).
- Set managed, organisation-wide rules for things individuals should not override.
Rules are policy, not a wall
Rules match patterns on tool names and arguments. Shell commands can be written many ways, so a pattern rule is easy to sidestep with an equivalent command (my own caution, and a common point in third-party guides). Treat rules as a policy layer that stops accidents and obvious misuse, and put a real boundary underneath: a sandbox with filesystem and network limits4. Anthropic frames the sandbox as what lets you reduce permission prompts safely, because the dangerous operations are contained rather than merely asked about4.
Identity and credentials
Give the agent its own identity and narrow tokens, not yours. Prefer short-lived credentials, scoped per task. Keep secrets out of the model’s context, and out of the sandbox’s environment where possible (my own advice). When an agent acts through MCP servers, the same rule holds: each server should expose only the tools and scopes the task needs.
Checklist
- Permissions enforced by code, not by prompt.
- Deny list written for the worst cases.
- Allow list narrow, and reviewed when tools change.
- Risky actions set to ask (Human approval).
- A sandbox beneath the rules.
- Logs of every allowed and denied call.
Sources
- [1]Configure permissions — Anthropic, Claude Code docsPARAPHRASED
- [2]Permission modes — Anthropic, Claude Code docsPARAPHRASED
- [3]Configure permissions (Agent SDK) — Anthropic, Claude Code docsPARAPHRASED
- [4]Beyond permission prompts, making Claude Code more secure and autonomous — Anthropic Engineering · 2025PARAPHRASED
- [5]OWASP Top 10 for LLM Applications 2025 — AI Governance Library (summary of the OWASP guidance)EXCESSIVE AGENCY, AS SUMMARISED BY A THIRD PARTY