5. Permissions and settings

15 cards

Review this deck
All cards in this deck

Mode `default` (Manual)

Asks for permission the first time each file-editing or command-running tool is used.

Mode `acceptEdits`

Auto-accepts file edits and common filesystem commands in the working directory; other commands and network still ask.

Mode `plan`

Only reads and runs read-only commands to explore, no source edits; used for planning.

Mode `auto`

A background classifier checks actions on your behalf; requires an eligible account and model.

Mode `dontAsk`

Auto-denies everything that would otherwise ask; only runs what is allowed; suits locked-down CI.

Mode `bypassPermissions`

Skips almost every prompt, including writes to protected paths; only use in a disposable container or VM.

Changing mode during a session

Shift+Tab cycles; at startup use `--permission-mode <mode>`; set a lasting default with `permissions.defaultMode`.

Permission rule evaluation order

deny → ask → allow; the first matching rule decides, specificity does not change the order, allow does not punch holes in deny.

`Bash(git *)` vs `Bash(git log *)`

The first allows every git command including `push --force`; put `*` after the subcommand to narrow it.

Space before `*` in Bash rules

`Bash(git diff *)` matches `git diff main`; `Bash(git diff*)` also matches `git diff-index`.

Scope of a `Read` deny rule

Covers file tools and recognized file commands like `cat`, `head`; does not cover scripts that open files themselves; OS-level blocking needs sandboxing.

`.claudeignore`

Has no effect; convert its contents into `Read` deny rules.

4 settings files

`~/.claude/settings.json` (user), `.claude/settings.json` (shared, committed), `.claude/settings.local.json` (personal, not committed), managed (organization).

Settings precedence

Managed → command line `--settings` → project local → shared project → user; lists like `permissions.allow` are merged.

Workspace trust

`permissions.allow` in a repo's settings only takes effect after you trust the folder; deny and ask apply immediately.

5. Permissions and settings – Flashcards – Claude | Học Dev