Skip to main content

Direct answer

Run /permissions in Claude Code to view and manage permission rules. To persist them, put allow, ask, and deny in settings.json. Hooks use the same settings files and run formatting, tests, or safety checks around tool calls. Permission precedence is deny → ask → allow, so an allow rule cannot override a deny rule. These settings control local tools on your computer. BetterToken changes the model API Base URL, API Key, and routing only; it does not bypass local permissions or run hooks for you.

Choose permissions or hooks

Choose the correct scope

Put permissions, hooks, and environment variables in settings.json, not ~/.claude.json. The latter stores application state and UI settings.

Configure minimal permission rules

1

Inspect existing rules with /permissions

In Claude Code, run:
The UI shows allow, ask, and deny rules with their source files. Check for existing team or managed rules before choosing a user or project setting.
2

Add narrow rules

This project-level example allows common tests and lint, asks before every git push, and blocks .env reads:
Replace the commands with scripts that exist in your project. Do not enable bypassPermissions only to remove prompts; the official documentation limits that mode to isolated containers or VMs.
3

Verify in /permissions

Save the file and run /permissions again. Confirm each rule appears under the expected source, then trigger one allow, ask, and deny case to verify the behavior.

Add a copyable formatting hook

This example runs the project formatter after Claude Code uses Edit or Write:
If the file already has permissions, merge hooks into the same top-level JSON object. Do not create a standalone .claude/hooks.json. Run npm run format manually first to confirm it succeeds.
Command hooks run with your system user’s permissions. Use only scripts you have reviewed, and never print API Keys, tokens, .env contents, or other secrets from a hook.

Verify the hook

  1. Run /hooks in Claude Code.
  2. Open PostToolUse and confirm it lists Edit|Write and npm run format.
  3. Ask Claude to modify a test file.
  4. Check the hook output and file format, and confirm the hook ran once without errors.
Claude Code normally reloads settings changes automatically. If it does not, exit the session and restart Claude Code.

Common errors

BetterToken boundaries

BetterToken handles Claude Code model API access, model routing, balance, and usage. Claude Code still controls:
  • File read and write access
  • Bash confirmation behavior
  • When hooks run and which scripts they execute
  • Sandbox, MCP, and project rules
For 401, Base URL, or model mapping errors, see the Claude Code setup guide. For command prompts and automation, troubleshoot permissions and hooks here.

References