Permission modes
The active permission mode applies globally to all tool invocations for the current session.
| Mode | Behavior |
|---|---|
default | Prompts the user for each potentially destructive operation |
plan | Shows the full execution plan, asks once for batch approval |
bypassPermissions | Auto-approves all operations (for trusted environments only) |
auto | ML-based classifier automatically decides (experimental) |
Rule syntax
Permission rules use wildcard patterns to match tool invocations. Rules are evaluated in order — the first match wins.ToolName(argument-pattern), where * is a wildcard matching any sequence of characters.
Examples:
How checkPermissions() works
Rule matching
The permission handler checks the invocation against configured rules in
PermissionContext. If a matching allow rule exists, the tool proceeds automatically.User prompt (if needed)
If no rule auto-approves the action, the user is prompted via the terminal (CLI) or the IDE UI (bridge mode). The user can approve, deny, or create a persistent rule.
User prompting flow
When a tool requires approval, Claude Code presents the proposed action and waits for one of these responses:- Yes — approve this single invocation
- Yes, always — approve and add a persistent allow rule
- No — deny and report back to the model
- Edit rule — customize the pattern before saving
plan mode, all tool calls in the upcoming execution plan are shown together, and the user approves or rejects the entire batch before any tool runs.
Key files
| File | Purpose |
|---|---|
src/hooks/toolPermission/PermissionContext.ts | Holds the active permission rules and mode for a session |
src/hooks/toolPermission/handlers/ | Per-tool permission handler implementations |
src/hooks/toolPermission/permissionLogging.ts | Audit logging for all permission decisions |
src/types/permissions.ts | TypeScript types for permission rules and contexts |