Learning resourcesReviewed · Anthropic

Explore the .claude directory (Claude Code documentation)

This is a documentation page for people who configure Claude Code, the AI coding assistant. It maps configuration files and documents application-data paths in a project's .claude folder and in ~/.claude, including what the tool stores on your disk. Its main catch is that it is an index and reference: the full detail for each feature sits on linked pages, and the page's interactive file explorer is not part of the captured text. It lists what each file does, whether to commit it, how settings are overridden, which frontmatter fields each file type accepts, what session data is kept in plaintext, how long it is kept, and how to delete it.

Researched 15 Nov 2026

In short.

This is a reference page from the Claude Code documentation for developers and teams who configure Claude Code, the AI coding assistant. It explains where Claude Code reads its instructions, settings, skills, subagents and memory, and what it writes to disk. Its main catch is that it is a map: details live on linked pages that were not read, and the interactive explorer's per-file examples are not in the captured text. The page covers the project .claude directory and the personal ~/.claude directory. It includes a table for choosing the right file for a change (for example CLAUDE.md for project context, settings.json for permissions, hooks and environment variables, skills/<name>/SKILL.md for /name prompts, agents/*.md for subagents, .mcp.json for MCP servers). It also has a 16-row file reference with scope and commit guidance, a frontmatter field table, and a long section on application data. That section covers plaintext transcripts, the cleanupPeriodDays retention default of 30 days, files kept until deleted, state files to keep, and the claude purge command. Nothing was executed or tested: this report describes what the page says, not how the software behaves.

Researched and written by an AI model and checked by a second AI model. How it works

Covered: the complete text of the single selected page at [https://code.claude.com/docs/en/claude-directory.md] as captured on 2026-11-15, including its tables, notes, examples and the purge walkthrough. Excluded: every linked page (memory, settings, permissions, hooks, skills, subagents, workflows, MCP, plugins, costs, managed settings, debug and others). The page's interactive file explorer, which shows per-file purpose, load timing and examples, is not in the captured text and was not assessed. No licence, pricing or publication date appears on the page, so those are unknown. Nothing was executed or tested, so all behaviour described is the documentation's own claim.

The overview

What this resource is

The resource is one documentation page titled 'Explore the .claude directory', served from the Claude Code documentation site at [https://code.claude.com/docs/en/claude-directory.md]. Its own description says it covers where Claude Code reads CLAUDE.md, settings.json, hooks, skills, commands, subagents, workflows, rules and auto memory, both in a project's .claude directory and in ~/.claude in the home directory.

It is a learning and reference page about a feature, not a tool you install. The page begins with a short index note pointing to the full documentation index at [https://code.claude.com/docs/llms.txt]. The page does not name an author, a publication date or a page version.

Overall assessment

On the evidence, this is a substantive and specific reference. It answers the practical question of which file to edit for which kind of customisation. It also documents something many users miss: Claude Code writes plaintext transcripts, history and file snapshots under ~/.claude, with stated retention rules and a deletion command.

Its strengths are concrete tables, named paths, named settings and environment variables, and version-gated notes (for example v2.1.229, v2.1.248, v2.1.274, v2.1.288). Its weakness is scope: it is a map, so each topic points to another page for full detail. The interactive explorer that is meant to show each file's purpose, load time and example is not reproduced in the captured text, so those examples could not be assessed. I did not run Claude Code, so none of the documented behaviour was verified.

Who it is for

Beginners who have started using Claude Code and want to know where its configuration lives will find a plain starting point. The page says most users only edit CLAUDE.md and settings.json and that the rest of the directory is optional, to be added as needed.

Experienced developers and team leads get the detail they need for shared setups: which files to commit to git, which are personal (settings.local.json, CLAUDE.local.md, ~/.claude.json), how managed settings and command-line flags override file settings, and which frontmatter fields each file type accepts. Security-minded users and administrators get the data-retention and plaintext-storage sections. The page assumes you already use or plan to use Claude Code; it does not explain what Claude Code is.

What it covers

Configuration map. A 'Choose the right file' table lists ten goals with the file to edit, the scope (project, global or both) and a reference link. Examples: allow or block tool calls (settings.json permissions or hooks), set session environment variables (settings.json env), keep personal overrides out of git (settings.local.json), add a /name prompt (skills/<name>/SKILL.md), define a subagent (agents/*.md), orchestrate subagents from a script (workflows/*.js), connect MCP tools (.mcp.json), change response formatting (output-styles/*.md).

File reference. A 16-row table covers CLAUDE.md, rules/*.md, settings.json, settings.local.json, .mcp.json, .worktreeinclude, skills, commands, output-styles, agents, workflows, agent-memory, ~/.claude.json, projects/<project>/memory/, keybindings.json and themes/*.json, each with scope, whether to commit it, and what it does. A separate table lists files not in the explorer: managed-settings.json, CLAUDE.local.md, AGENTS.md and installed plugins under ~/.claude/plugins.

Frontmatter fields. A table lists the YAML frontmatter fields accepted by skills, command files, subagents, output styles and rules. For example, rules accept only paths, and skills accept fields such as name, description, allowed-tools, model, context, hooks, paths and shell.

Application data. Tables list what is written under ~/.claude, what is cleaned up automatically, what is kept until you delete it, and which state files to keep. The page also describes the per-session scratchpad directory and the claude purge command.

Using it

Requirements

The page assumes you have Claude Code installed and use it in a project directory. It gives no installation steps, supported-platform list or minimum version for the product overall. It does mention Windows path handling (~/.claude resolves to %USERPROFILE%\.claude) and the CLAUDE_CONFIG_DIR variable, which moves every ~/.claude path to another directory.

Several features are version-gated in the text: a marketplace command source for plugins needs Claude Code v2.1.229 or later; desktopSessionCleanupPeriodDays needs v2.1.248 or later; the project-state command was called claude project purge before v2.1.288; auto memory was handled differently before v2.1.228; later versions than v2.1.274 store pasted images outside ~/.claude. The scratchpad needs a claude.ai sign-in rather than an API key, the Anthropic API rather than Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry, and enableArtifact not set to false. Beyond that, no account type or plan requirements are stated.

How it works

The page describes a layered, file-based configuration model. Claude Code reads instructions, settings, skills, subagents and memory from the project directory and from ~/.claude. Project files can be committed so a team shares them; files in ~/.claude are personal and apply to all projects.

Precedence is described in a note: managed settings deployed by an organisation take precedence over every settings file and --settings value, apart from narrow exceptions; command-line flags such as --permission-mode or --settings override settings.json for that session; some environment variables take precedence over their equivalent setting, and this varies by variable. The full order is on a linked settings-precedence page that was not read.

For stored data, Claude Code writes session transcripts to projects/<project>/<session>.jsonl, subagent transcripts, large tool outputs, pre-edit file snapshots for checkpoint restore, plan files, debug logs and more. A retention sweep deletes files older than cleanupPeriodDays (default 30, minimum 1; 0 fails validation) when it can safely determine the retention period. Some paths follow their own rules. The sweep does not delete auto memory files; it removes a project's memory directory only if that directory has been empty for the whole retention period. Files in sessions/ are not part of the age-based sweep: each is removed when its session exits, and crash leftovers are cleared on the next launch.

Transcripts of sessions you started or most recently continued in Claude Desktop or Cowork are kept at any age by default. You can give them an age limit with desktopSessionCleanupPeriodDays, which needs Claude Code v2.1.248 or later; earlier versions delete them after cleanupPeriodDays. They instead follow cleanupPeriodDays in cases such as when managed settings set cleanupPeriodDays or when the HIPAA configuration applies to your sessions. The sweep is skipped in bare mode (claude -p with --bare) or when it is paused because the retention period cannot be determined.

Setup and use

There is nothing to install: the page is read, not run. To use it, find your goal in the 'Choose the right file' table, then open the linked reference page. The page says to create CLAUDE.local.md manually and add it to .gitignore, and that settings.local.json is gitignored when Claude Code saves a setting to it.

For clean-up, the page gives claude purge with a project path, plus --dry-run to preview, --yes to skip confirmation, --all to purge every project, and -i to step through items one at a time. If you omit the path, an interactive project list appears. For troubleshooting, it points to a separate page, Debug your configuration [https://code.claude.com/docs/en/debug-your-config.md]. That page was not read.

Worked example from the page

The page includes a purge walkthrough, using ~/work/my-repo as a placeholder. Running claude purge ~/work/my-repo --dry-run prints a plan without deleting anything. The sample output lists three items: the directory ~/.claude/projects/-home-user-work-my-repo (transcripts and memory), the project entry in ~/.claude.json (trust, history, MCP servers), and a filter on ~/.claude/history.jsonl that would remove 12 prompts typed in that project. It also warns that shell-snapshots/ is not project-scoped and that backups/ may still hold the project entry in old .claude.json snapshots.

Running claude purge ~/work/my-repo without --dry-run prints the same plan and asks 'Delete 3 item(s) ... This cannot be undone. [y/N]'. This example is quoted from the documentation; I did not run it.

Assessment & evidence

Limitations and risks

Coverage gaps. The page is an index. Hooks, permissions, memory, skills, subagents, workflows, MCP and settings precedence are only summarised and linked. The interactive tree ('Click files in the tree to see what each one does, when it loads, and an example') is not in the captured text, so per-file load timing and examples are not covered here.

Privacy risk documented by the page itself. Transcripts and history are plaintext and not encrypted at rest; OS file permissions are the only protection. If a tool reads a .env file or a command prints a credential, the value is written to the session transcript. Transcripts can also contain the system prompt, tool definitions, request parameters and loaded instruction files such as CLAUDE.md. The page lists mitigations: shorter cleanupPeriodDays, desktopSessionCleanupPeriodDays, the CLAUDE_CODE_SKIP_PROMPT_HISTORY environment variable, --no-session-persistence with -p, persistSession: false in the TypeScript Agent SDK (the Python SDK has no equivalent), and permission rules that deny reads of credential files.

Deletion cautions. claude purge does not remove images and scratchpads stored in the temp directory, shell-snapshots/, backups/, or .heapsnapshot files from /heapdump, which contain the full conversation and any credentials the process held. The page warns not to delete ~/.claude.json, ~/.claude/settings.json or ~/.claude/plugins/, and lists .credentials.json, agent-memory/, jobs/ and daemon/ as state files to keep.

Verification limit. Nothing was run, so I cannot confirm the page matches current software behaviour.

Why this assessment

The assessment rests on reading the full captured page. The page gives named files, scopes, commit guidance, field names, setting names, default values, version gates and a worked command example, which is enough to describe what it covers with confidence. It is a guide that teaches a feature, so it is classed as a learning resource, not as a skill, plugin or agent definition.

The page also surfaces trade-offs, not only features: shared versus personal files, override order, and convenience (resume, rewind, checkpoint restore, prompt recall) against plaintext retention. I weighted those trade-offs because they affect whether a team can safely adopt Claude Code on a codebase containing secrets. Statements about how Claude Code behaves are the page's claims and are reported as such.

Alternatives and related material

The page itself lists related Claude Code pages: Manage Claude's memory [https://code.claude.com/docs/en/memory.md], Configure settings [https://code.claude.com/docs/en/settings.md], Create skills [https://code.claude.com/docs/en/skills.md] and Configure subagents [https://code.claude.com/docs/en/sub-agents.md]. Those are the places to go for depth. They were not read, so I cannot compare their quality.

The page notes that AGENTS.md, a project-instructions file written for AI coding agents generally, can be read by Claude Code in place of CLAUDE.md. That is relevant if your repository already serves several coding agents. No third-party alternative guides are named in the evidence, and none were assessed.

Evidence base

The only evidence is the single captured copy of the page at [https://code.claude.com/docs/en/claude-directory.md] (about 32.9 kilobytes of text, evidence_7da128eb-742a-4b9f-a301-fc863b8ee764). Every claim in this report comes from that text. Links inside the page were not followed. No code, commands or configuration were executed, and no independent source was consulted.

Strongly supported by the text: the file and directory names, scopes, the commit column, the frontmatter field lists, the cleanupPeriodDays default and minimum, the purge options and example output, the plaintext warning and the version notes. Not established by the text: product pricing, licensing, the page's publication date, and behaviour in practice.

Access & freshness

Costs

The page states no price for itself or for Claude Code. What it costs to use Claude Code (subscription, API usage or other plans) is unknown from this evidence and was not assessed. The page mentions a costs page only in passing, as the place to learn about the /insights usage report, and that page was not read.

The page does describe local resource effects: transcripts, snapshots, caches and logs build up under ~/.claude until the retention sweep or the user removes them. It gives no overall disk-usage estimate. It does state some retention counts, which are not absolute storage caps. Claude Code keeps the five newest ~/.claude.json backups, plus a copy of any version it could not parse. Past the age cutoff, the last copy that holds your configuration is deleted too, and if the current file parses, holds your configuration and is under 8 MiB, a fresh copy of it is left. File snapshots are held for the 100 most recent checkpoints. Snapshot files that no retained checkpoint references are deleted, except each file's first snapshot. The feedback draft queue holds at most 10 drafts, and the oldest is deleted to make room.

Rights and reuse

The captured page contains no licence statement, copyright notice or reuse terms. Whether the documentation text may be copied, redistributed or adapted is therefore unknown from this evidence. Treat the page as something to read and link to, not to republish.

The page also does not state any licence for Claude Code itself. The page describes user-authored configuration files but does not establish ownership or reuse rights for those files or generated session data.

Freshness

The captured copy was taken on 2026-11-15. The page shows no publication or last-updated date. Its newest version reference is v2.1.288 (the point at which claude project purge became claude purge), so the text reflects at least that release. Other version notes: v2.1.274 and earlier for image-cache, v2.1.248 for desktopSessionCleanupPeriodDays, v2.1.229 for the plugin command source, v2.1.228 for auto memory sweep behaviour.

Because the page describes a fast-changing product, details such as the list of paths under ~/.claude, frontmatter fields and retention rules may change. Check the live page and your installed Claude Code version before relying on a specific path or field name.

Suggested next steps

If you are new to Claude Code, start with CLAUDE.md and settings.json, as the page suggests, and add skills, rules or subagents only when needed. Decide early which files are shared (committed) and which stay personal (settings.local.json, CLAUDE.local.md, ~/.claude.json).

If you work with secrets or regulated code, read the Application data and Plaintext storage sections before adopting Claude Code. Consider a shorter cleanupPeriodDays, permission rules that deny reads of credential files, and the transcript-skipping options the page lists. Preview any deletion with claude purge <path> --dry-run first. Confirm all of this against your installed version, since this review did not run the software.

Evidence for this report

selected-page.txtselected · checked 2026-11-15