What this unit solvesEarlier units covered
CLAUDE.md, rules, skills, subagents, hooks, and plugins each in depth, but you need one complete reference: every file and folder in .claude/, what it does, when it loads, and whether to commit it. This unit is that reference. It maps project-level .claude/ and user-level ~/.claude/ item by item, threads each entry back to its deep-dive unit, and fully covers five topics that have no dedicated unit: output-styles, keybindings, themes, workflows, and agent-memory. The authoritative source is the official interactive directory page [1].Learning objectives
- State the purpose, load timing, and commit status of every file and folder under
.claude/. - Distinguish the files that live in the project root (
CLAUDE.md,.mcp.json,.worktreeinclude) from those inside.claude/. - Configure output-styles, keybindings, and themes, and identify where workflows and agent-memory are stored.
- Map any file to its deep-dive unit and know where to look for details.
1. Three location families
.claude-related files are spread across three places. Pinning this boundary first keeps everything below from sliding out of position:
| Family | Location | Commit to VCS | Visible to |
|---|---|---|---|
| Project root | repo root directory (CLAUDE.md, .mcp.json, .worktreeinclude) | mostly committed | team |
Project .claude/ | .claude/ inside the repo | mostly committed; *.local.* gitignored | team (personal overrides excepted) |
| User layer | ~/.claude/ (Windows: %USERPROFILE%\.claude\) and ~/.claude.json | not committed (machine-local) | only you |
CLAUDE.md and .mcp.json as files inside .claude/. They live in the project root, not in .claude/ [1].
2. Project root (not inside .claude/)
(repo root)
CLAUDE.md · loaded in full at every session start; primary project instructions file
CLAUDE.local.md · gitignored; personal private settings (sandbox URLs, local test data)
.mcp.json · connected at session start; project-level MCP servers, shared with the team
.worktreeinclude · at git worktree creation; lists gitignored files to copy from the main repo
| File | Commit | When loaded | Purpose | Deep read |
|---|---|---|---|---|
CLAUDE.md | committed | full load at every session start | project instructions (conventions, common commands, architecture context); can also be placed at .claude/CLAUDE.md | 04-1 |
CLAUDE.local.md | gitignored | every session start | personal private settings for this project | 04-1 |
.mcp.json | committed | connected at session start; tool schemas lazy-loaded by default | project-level MCP servers, team-shared; personal MCP goes in ~/.claude.json | 04-9 |
.worktreeinclude | committed | at git worktree creation | lists gitignored files (e.g. .env) to copy into a new worktree; uses .gitignore syntax | official worktrees page [1] |
3. Project-level .claude/
.claude
settings.json · shared config: permissions / hooks / model / env / statusLine / outputStyle
settings.local.json · gitignored; personal overrides, same schema; arrays merge across layers, scalars take nearest layer
rules
*.md · topic rules; without paths: frontmatter loads like CLAUDE.md; with paths: loads only when matching glob is read
skills
<name>
commands
output-styles
agents
workflows
agent-memory
| File / folder | Commit | Purpose | Deep read |
|---|---|---|---|
settings.json | committed | permissions, hooks, model, env, statusLine, outputStyle, and more; enforced settings (unlike CLAUDE.md, which is only context) | 02-3 |
settings.local.json | gitignored | personal overrides; same schema as settings.json; array-type settings merge across layers, scalars take the nearest layer | 02-3 |
rules/*.md | committed | topic rule files; without paths: frontmatter, loaded at session start like CLAUDE.md; with paths:, loaded only when Claude reads a file matching the glob | 04-2 |
skills/<name>/SKILL.md | committed | skill invokable via /<name> or auto-triggered by Claude based on description; directory can include references/ and scripts/ | 04-4 |
commands/<name>.md | committed | legacy single-file slash command; same mechanism as skills; new workflows should prefer skills/; skill wins on name conflict | 04-3 |
output-styles/ | committed | project-shared output styles (see Section 5.1); personal styles go in ~/.claude/output-styles/ | this unit, Section 5.1 |
agents/*.md | committed | subagent definitions (each has isolated context, tool set, optional model override) | 04-5 |
workflows/*.js | committed | dynamic workflow scripts, generated by saving a /workflows run; each .js becomes a /<name> command; project layer overrides personal layer | this unit, Section 5.4 |
agent-memory/<agent>/MEMORY.md | committed | project-scoped persistent memory for a subagent (memory: project frontmatter); separate from the main session’s auto-memory | this unit, Section 5.5 |
Different from main session auto-memory
.claude/agent-memory/ is a subagent’s own memory, entirely separate from your main session’s auto-memory (stored at ~/.claude/projects/<repo>/memory/). A subagent using memory: local writes to .claude/agent-memory-local/ (gitignored); memory: user writes to ~/.claude/agent-memory/ (cross-project) [1].4. User-level ~/.claude/ and ~/.claude.json
~
.claude.json · app state / UI preferences / OAuth session / personal MCP; managed via /config, not hand-edited
.claude
CLAUDE.md · personal cross-project instructions; loaded alongside project CLAUDE.md; project layer wins on conflict
settings.json · default for all projects; overridden by project-level keys
keybindings.json · custom keyboard shortcuts (see Section 5.2; requires v2.1.18+)
themes
rules
skills
commands
output-styles
agents
workflows
agent-memory
projects
| File / folder | Purpose | Deep read |
|---|---|---|
~/.claude.json | app state, UI preferences, OAuth session, per-project trust decisions, personal MCP servers; managed mostly via /config, not hand-edited. Note: IDE-switching flags (e.g. autoConnectIde) and permissions approved during a session are stored in different locations (the latter goes into .claude/settings.local.json) | 02-4 |
~/.claude/CLAUDE.md | personal cross-project instructions, loaded alongside the project CLAUDE.md; project layer wins on conflict | 04-1 |
~/.claude/settings.json | default applied to all projects; overridden by project-layer keys of the same name | 02-3 |
~/.claude/keybindings.json | custom keyboard shortcuts (see Section 5.2) | this unit, Section 5.2 |
~/.claude/themes/ | custom color themes (see Section 5.3) | this unit, Section 5.3 |
~/.claude/rules/ skills/ commands/ output-styles/ agents/ workflows/ | same as project-layer counterparts but apply to all projects | respective deep-dive units |
~/.claude/agent-memory/ | subagent cross-project memory for memory: user | 04-5 |
~/.claude/projects/<repo>/memory/MEMORY.md | main session auto-memory (v2.1.59+; first 200 lines or 25 KB loaded at session start) | 04-1 |
5. Five topics without dedicated units
Sections 2 through 4 map every entry to a deep-dive unit. The five items below have no dedicated unit; this section covers them to an actionable level.5.1 output-styles: rewriting the system prompt for a different mode
An output style is a block of text appended to the system prompt. By default it replaces the built-in software-engineering task instructions, making it possible to repurpose Claude Code for non-coding work (teaching, review mode) [2].- Four built-in styles:
Default,Proactive,Explanatory,Learning. - Custom styles: place at
~/.claude/output-styles/<name>.md(personal) or.claude/output-styles/(project-shared). Frontmatter fields:name,description,keep-coding-instructions(defaults tofalse; set totrueto keep the built-in task instructions),force-for-plugin(plugin-specific). - To activate: use
/configto select an output style, or set theoutputStylekey insettings.json. The system prompt is locked at session start for caching purposes — a change requires/clearor a new session before it takes effect.
A teaching-mode output style
5.2 keybindings: custom shortcuts
~/.claude/keybindings.json rebinds keys in the interactive CLI (requires v2.1.18+) [3].
- Format:
{ "bindings": [{ "context": "Chat", "bindings": { "ctrl+e": "chat:externalEditor", "ctrl+u": null } }] }. Setting a value tonullremoves the binding. Chords (sequential keypresses separated by a space) are supported. - Context types include
Global,Chat,Autocomplete,Settings, and others; a binding is scoped to its declared interface area. - Reserved keys that cannot be rebound:
Ctrl+C,Ctrl+D,Ctrl+M,Caps Lock. - Use
/keybindingsto create or open the file (with schema attached);/doctorreports binding conflicts. Changes are auto-detected and hot-reloaded.
5.3 themes: custom colors
~/.claude/themes/<name>.json defines a theme as a built-in base preset plus a set of overrides color values [1]. Create one interactively with /theme or write the JSON directly. After selecting a custom theme the preference is stored as custom:<slug>. Themes are read at session start and hot-reloaded.
5.4 workflows: dynamic multi-agent scripts
.claude/workflows/<name>.js (project) or ~/.claude/workflows/ (personal) are JavaScript scripts that run in the background at runtime to generate and coordinate tens to hundreds of subagents. Requires Claude Code v2.1.154+ [1, 4]. These files are not hand-written; they are generated by running /workflows and pressing s to save (the built-in /deep-research is a ready-made example). Each .js becomes a /<name> command; project-layer files override personal-layer files of the same name. To disable: use /config to toggle Dynamic workflows, set disableWorkflows: true in settings.json, or set the environment variable CLAUDE_CODE_DISABLE_WORKFLOWS=1 [4]. The full mechanism is covered in the official dedicated page [4]; this unit records only the storage location and the source.
5.5 agent-memory: persistent memory for subagents
A subagent only gets a dedicated memory directory whenmemory: is set in its frontmatter. The write destination depends on the scope [1]:
| frontmatter | Write location | Committed | Scope |
|---|---|---|---|
memory: project | .claude/agent-memory/<agent>/MEMORY.md | committed | team-shared |
memory: local | .claude/agent-memory-local/ | gitignored | this machine, this project |
memory: user | ~/.claude/agent-memory/ | machine-local | cross-project |
6. Tool comparison: directory equivalents in other agents
The “configuration-as-directory” pattern has counterparts in other tools (as of 2026-06; strict paths are in 02-6):| Dimension | Anthropic Claude (primary) | OpenAI Codex | Google Antigravity | GitHub Copilot CLI | Cursor (brief) |
|---|---|---|---|---|---|
| Config root | .claude/, ~/.claude/ | .codex/, ~/.codex/ (CODEX_HOME relocatable) | workspace .agents/, global ~/.gemini/, ~/.gemini/config/ | .github/, ~/.copilot/ (COPILOT_HOME) | .cursor/ |
| Project instructions | CLAUDE.md | AGENTS.md (AGENTS.override.md takes priority) | GEMINI.md / AGENTS.md, .agents/rules/ | .github/copilot-instructions.md, AGENTS.md | .cursor/rules/*.mdc, AGENTS.md |
| Behavior settings | settings.json | config.toml | GUI + ~/.gemini/antigravity-cli/settings.json | ~/.copilot/config.json | GUI (Settings) |
| Skills | .claude/skills/<n>/SKILL.md | .agents/skills/<n>/SKILL.md | workspace .agents/skills/; global IDE ~/.gemini/config/skills/, CLI ~/.gemini/antigravity-cli/skills/ | ~/.copilot/skills/, .github/skills/ | (no native skill) |
| Subagents | .claude/agents/*.md | ~/.codex/agents/*.toml, .codex/agents/*.toml | .agents/ primary | ~/.copilot/agents/*.agent.md, .github/agents/ | (none) |
| Hooks | settings.json hooks block | ~/.codex/hooks.json, config.toml [hooks] | hooks.json (in .agents/ or ~/.gemini/config/) | ~/.copilot/hooks/, .github/hooks/ | (none) |
| MCP | .mcp.json, ~/.claude.json | config.toml [mcp_servers.<id>] | ~/.gemini/config/mcp_config.json | ~/.copilot/mcp-config.json, .mcp.json | .cursor/mcp.json |
7. Hands-on: audit your .claude/
List what you have
Run
ls -la .claude/ and ls -la ~/.claude/ in a project you use regularly. Compare against Sections 3 and 4 and note which items you already have and which you have not yet used.Check your .gitignore
For each file present, ask: should this be committed?
settings.local.json, CLAUDE.local.md, and agent-memory-local/ must be in .gitignore. Missing entries push personal settings to your team.Try one personalization feature
Pick one personalization area you have not used: run
/theme to create a theme, or /keybindings to bind a frequently used key, then confirm hot-reload works.8. Common pitfalls
Self-check
The bar for passing this unit
- Given any filename under
.claude/, can you state its purpose, when it loads, whether to commit it, and which unit covers it in depth? - Can you name the three files that live in the project root rather than inside
.claude/? - Do you know the config file location and the moment a change takes effect for output styles, keybindings, and themes?
- Where do the three
memory:scopes for a subagent each write to, and which one gets committed?
Sources and further reading
Factual claims are grounded in official documentation; fast-changing items are annotated as of 2026-05.- [1] Anthropic, “Explore the .claude directory” (interactive file reference listing location, load timing, commit status, and examples for each entry), Claude Code Docs. Accessed: 2026-06. [Online]. Available: https://code.claude.com/docs/zh-TW/claude-directory (as of 2026-06)
-
[2] Anthropic, “Output styles” (four built-in styles, custom frontmatter fields,
outputStylesetting, and when changes take effect), Claude Code Docs. Accessed: 2026-06. [Online]. Available: https://code.claude.com/docs/en/output-styles (as of 2026-06) -
[3] Anthropic, “Keybindings” (
~/.claude/keybindings.json, context and action fields, chords, reserved keys), Claude Code Docs. Accessed: 2026-06. [Online]. Available: https://code.claude.com/docs/en/keybindings (as of 2026-06) -
[4] Anthropic, “Orchestrate subagents at scale with dynamic workflows” (
.claude/workflows/*.jsruntime background execution, generating and coordinating tens to hundreds of subagents, saved from/workflowswiths, each file becomes/<name>, project overrides personal, requires v2.1.154+, disabled viadisableWorkflowsorCLAUDE_CODE_DISABLE_WORKFLOWS=1), Claude Code Docs. Accessed: 2026-06. [Online]. Available: https://code.claude.com/docs/en/workflows (as of 2026-06)
- Deep-dive units: 02-3 settings.json, 02-4 claude.json, 04-1 CLAUDE.md and memory, 04-2 rules, 04-3 commands, 04-4 skills, 04-5 subagents, 04-6 hooks, 04-9 MCP integration.
- Tool directory equivalents: 02-6 other tools comparison.