Configuration
CLAUDE.md, hooks, permissions, settings, cost management, and auto memory. Everything that makes Claude Code behave consistently across sessions and across your team.
CLAUDE.md in depth
CLAUDE.md is a markdown file that gives Claude persistent instructions about your project. Without it, Claude guesses your conventions anew every session. With it, Claude starts every session knowing your stack, your style, your commands, and your architectural decisions.
The loading hierarchy
CLAUDE.md files load in a specific priority order. Higher priority files override lower ones.
Level 1 overrides everything. Level 5 loads only when Claude reads files in that directory.
Most people only need two: the project-level CLAUDE.md (checked into git, shared with the team) and CLAUDE.local.md (personal, not in git).
What to put in it
| Put in CLAUDE.md | Do not put in CLAUDE.md |
|---|---|
| Commands Claude cannot guess (npm test, npm run lint) | Standard conventions Claude already follows (semicolons in JS) |
| Style rules that differ from defaults (2-space indent, ES modules) | Detailed API docs (link to them instead) |
| Architecture decisions (routes live in /src/api/, tests next to source) | Information that changes weekly (sprint priorities) |
| Common gotchas (the build requires Node 20, not 18) | Long paragraphs of explanation (bullets are better) |
| Git conventions (branch off main, imperative commit messages) | Rules Claude already gets from the code itself |
Target: under 200 lines. If your CLAUDE.md is longer, Claude starts ignoring parts of it. Ruthlessly prune.
File imports
CLAUDE.md can reference other files using @path/to/file. The referenced file is embedded into context at startup:
This keeps CLAUDE.md short while still giving Claude access to detailed reference material.
Hooks
Hooks are scripts that run at specific points in Claude Code's workflow. Unlike CLAUDE.md (which is advisory), hooks are deterministic: they guarantee that something happens every time a trigger fires.
The most useful hooks
When to use hooks vs CLAUDE.md
| Use hooks when | Use CLAUDE.md when |
|---|---|
| The action must always happen (lint after edit) | The instruction is a preference (voice, style) |
| You need to block dangerous commands (rm -rf) | You want Claude to know about conventions |
| You want to auto-approve safe operations (npm test) | You want Claude to follow a workflow |
| You need external verification (send a webhook) | You want to provide reference material |
Auto mode
Auto mode lets Claude execute actions without asking for permission, with a background safety classifier checking each action before it runs.
Auto mode requirements
- Plan: Team, Enterprise, or API only. Not available on Pro or Max.
- Model: Sonnet 4.6 or Opus 4.6 only.
- Provider: Anthropic API only (not Bedrock, Vertex, or Foundry).
- Admin: must be enabled in Claude Code admin settings.
What auto mode blocks by default
- Downloading and executing code from the internet (
curl | bash) - Sending sensitive data to external endpoints
- Production deployments and database migrations
- Mass deletion on cloud storage
- Granting IAM or repository permissions
- Force-pushing or pushing to main
- Irreversibly destroying pre-existing files
What auto mode allows by default
- Local file operations in the working directory
- Installing dependencies from lock files
- Reading .env and sending credentials to the matching API
- Read-only HTTP requests
- Pushing to the current branch or a Claude-created branch
If the classifier blocks three consecutive actions or twenty total in one session, auto mode pauses and resumes normal permission prompting.
The .claude/ directory
The .claude/ directory at your project root is where settings, rules, skills, agents, and commands live.
Cost management
Claude Code uses your Anthropic API allocation. Complex tasks use more tokens than simple chats. A few levers for keeping costs predictable:
--effort lowfor routine tasks (cheaper, faster, less thorough)--effort highor--effort maxfor hard problems (Opus 4.6 only)--max-budget-usd 5to set a hard spending limit per session in non-interactive mode--model claude-haiku-4-5for fast, cheap tasks where quality does not need to be top-tier--barefor scripted calls: skips auto-discovery of hooks, skills, plugins, and CLAUDE.md, so startup is faster and cheaper
Rule of thumb: start with Sonnet (the default) for everything. Only use Opus when Sonnet has already failed on the same task. Use Haiku for bulk scripted operations where "good enough" is the standard.
Auto memory
Claude automatically saves notes about your project to ~/.claude/projects/<project>/memory/MEMORY.md. Build commands it discovers, debugging patterns, code style preferences, workflow habits, architecture notes. The first 200 lines load at the start of every session.
This is separate from CLAUDE.md. CLAUDE.md is what you write deliberately. Auto memory is what Claude learns by working with you. Both load at startup, both persist across sessions.
If auto memory is making mistakes (saving something wrong), you can edit MEMORY.md directly or disable it with autoMemoryEnabled: false in settings.json.
Configuration is what makes Claude Code go from "it works sometimes" to "it works the way I expect, every time". Start with a CLAUDE.md. Add hooks when you notice a thing that should always happen. Graduate to auto mode when the permission prompts slow you down more than they protect you.
Next: IDE integration for VS Code and JetBrains. Or go back to the Claude Code overview.