Permissions, Hooks & Safety — Claude Code CLI
[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
Permissions, Hooks & Safety
Tiered Permission Model & .claude/settings.json
Claude Code replaces legacy CLI config flags with hierarchical JSON files: ~/.claude/settings.json (user global), .claude/settings.json (team Git-committed), and .claude/settings.local.json (git-ignored overrides). Rules follow strict Deny > Ask > Allow precedence:
| Tier | Action Types | Default Behavior |
|---|---|---|
| Read-Only | File reads, directory listings, grep searches | Auto-approved (unless matched by deny) |
| File Edit | Modifying existing files, creating new files | Prompts for confirmation unless in allow |
| Bash / Execution | Running shell commands, test suites, builds | Prompts user for explicit authorization |
| Destructive / Denied | Read(.env*), rm -rf, force push | Blocked outright by deny or strict confirmation |
Deterministic Lifecycle Hooks
Unlike advisory CLAUDE.md instructions, Hooks (PreToolUse, PostToolUse, SessionStart, UserPromptSubmit) in .claude/settings.json execute deterministic shell commands at runtime—exiting with code 2 blocks a tool call before execution.
Slash Commands in Claude Code
/help: Display available commands and shortcuts./compact: Compact conversation context to preserve token capacity./clear: Reset conversation state and clear memory buffer./settings: Interactively view and modify permissions, model, and CLI settings./cost: View token usage and cost for the current session./doctor: Verify environment health, API connectivity, and permissions./review: Perform a code review on git diffs before committing.
⌨ HANDS-ON LABConfigure .claude/settings.json Permissions & Hooks
⭐ +150 XPLegacy 'claude config' commands were replaced by hierarchical .claude/settings.json files. Inspect your project settings and define explicit permission and PreToolUse hook rules.
1Inspect your project's .claude/settings.json configuration file.
2Write a PreToolUse lifecycle hook and strict .env deny rule into .claude/settings.json.
OBJECTIVE 1 / 2 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 2
Which slash command in Claude Code compacts conversation context to save tokens?
/shrink
/compact
/compress
/trim