SpyBara
Go Premium

Documentation 2026-02-27 21:05 UTC to 2026-02-28 21:01 UTC

16 files changed +377 −220. View all changes and history on the product overview
2026
Sat 28 21:01 Fri 27 21:05 Thu 26 21:08 Wed 25 03:47 Tue 24 21:08 Mon 23 21:13 Sat 21 18:03 Fri 20 21:03 Thu 19 21:06 Wed 18 03:48 Tue 17 21:08 Mon 16 21:05 Sat 14 03:44 Fri 13 21:09 Thu 12 00:06 Wed 11 21:10 Tue 10 21:13 Mon 9 15:17 Sat 7 21:05 Fri 6 21:06 Thu 5 21:06 Wed 4 21:07 Tue 3 21:08 Sun 1 21:03
Details

93The `--agents` flag accepts a JSON object that defines one or more custom subagents. Each subagent requires a unique name (as the key) and a definition object with the following fields:93The `--agents` flag accepts a JSON object that defines one or more custom subagents. Each subagent requires a unique name (as the key) and a definition object with the following fields:

94 94 

95| Field | Required | Description |95| Field | Required | Description |

96| :---------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |96| :---------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

97| `description` | Yes | Natural language description of when the subagent should be invoked |97| `description` | Yes | Natural language description of when the subagent should be invoked |

98| `prompt` | Yes | The system prompt that guides the subagent's behavior |98| `prompt` | Yes | The system prompt that guides the subagent's behavior |

99| `tools` | No | Array of specific tools the subagent can use, for example `["Read", "Edit", "Bash"]`. If omitted, inherits all tools. Supports [`Task(agent_type)`](/en/sub-agents#restrict-which-subagents-can-be-spawned) syntax |99| `tools` | No | Array of specific tools the subagent can use, for example `["Read", "Edit", "Bash"]`. If omitted, inherits all tools. Supports [`Agent(agent_type)`](/en/sub-agents#restrict-which-subagents-can-be-spawned) syntax |

100| `disallowedTools` | No | Array of tool names to explicitly deny for this subagent |100| `disallowedTools` | No | Array of tool names to explicitly deny for this subagent |

101| `model` | No | Model alias to use: `sonnet`, `opus`, `haiku`, or `inherit`. If omitted, defaults to `inherit` |101| `model` | No | Model alias to use: `sonnet`, `opus`, `haiku`, or `inherit`. If omitted, defaults to `inherit` |

102| `skills` | No | Array of [skill](/en/skills) names to preload into the subagent's context |102| `skills` | No | Array of [skill](/en/skills) names to preload into the subagent's context |

Details

81 81 

82 **Put it in a skill** if it's reference material Claude needs sometimes (API docs, style guides) or a workflow you trigger with `/<name>` (deploy, review, release).82 **Put it in a skill** if it's reference material Claude needs sometimes (API docs, style guides) or a workflow you trigger with `/<name>` (deploy, review, release).

83 83 

84 **Rule of thumb:** Keep CLAUDE.md under \~500 lines. If it's growing, move reference content to skills.84 **Rule of thumb:** Keep CLAUDE.md under 200 lines. If it's growing, move reference content to skills or split into [`.claude/rules/`](/en/memory#organize-rules-with-clauderules) files.

85 </Tab>

86 

87 <Tab title="CLAUDE.md vs Rules vs Skills">

88 All three store instructions, but they load differently:

89 

90 | Aspect | CLAUDE.md | `.claude/rules/` | Skill |

91 | ------------ | ----------------------------------- | -------------------------------------------------- | ---------------------------------------- |

92 | **Loads** | Every session | Every session, or when matching files are opened | On demand, when invoked or relevant |

93 | **Scope** | Whole project | Can be scoped to file paths | Task-specific |

94 | **Best for** | Core conventions and build commands | Language-specific or directory-specific guidelines | Reference material, repeatable workflows |

95 

96 **Use CLAUDE.md** for instructions every session needs: build commands, test conventions, project architecture.

97 

98 **Use rules** to keep CLAUDE.md focused. Rules with [`paths` frontmatter](/en/memory#path-specific-rules) only load when Claude works with matching files, saving context.

99 

100 **Use skills** for content Claude only needs sometimes, like API documentation or a deployment checklist you trigger with `/<name>`.

85 </Tab>101 </Tab>

86 102 

87 <Tab title="Subagent vs Agent team">103 <Tab title="Subagent vs Agent team">


132 148 

133Features can be defined at multiple levels: user-wide, per-project, via plugins, or through managed policies. You can also nest CLAUDE.md files in subdirectories or place skills in specific packages of a monorepo. When the same feature exists at multiple levels, here's how they layer:149Features can be defined at multiple levels: user-wide, per-project, via plugins, or through managed policies. You can also nest CLAUDE.md files in subdirectories or place skills in specific packages of a monorepo. When the same feature exists at multiple levels, here's how they layer:

134 150 

135* **CLAUDE.md files** are additive: all levels contribute content to Claude's context simultaneously. Files from your working directory and above load at launch; subdirectories load as you work in them. When instructions conflict, Claude uses judgment to reconcile them, with more specific instructions typically taking precedence. See [how Claude looks up memories](/en/memory#how-claude-looks-up-memories).151* **CLAUDE.md files** are additive: all levels contribute content to Claude's context simultaneously. Files from your working directory and above load at launch; subdirectories load as you work in them. When instructions conflict, Claude uses judgment to reconcile them, with more specific instructions typically taking precedence. See [how CLAUDE.md files load](/en/memory#how-claudemd-files-load).

136* **Skills and subagents** override by name: when the same name exists at multiple levels, one definition wins based on priority (managed > user > project for skills; managed > CLI flag > project > user > plugin for subagents). Plugin skills are [namespaced](/en/plugins#add-skills-to-your-plugin) to avoid conflicts. See [skill discovery](/en/skills#where-skills-live) and [subagent scope](/en/sub-agents#choose-the-subagent-scope).152* **Skills and subagents** override by name: when the same name exists at multiple levels, one definition wins based on priority (managed > user > project for skills; managed > CLI flag > project > user > plugin for subagents). Plugin skills are [namespaced](/en/plugins#add-skills-to-your-plugin) to avoid conflicts. See [skill discovery](/en/skills#where-skills-live) and [subagent scope](/en/sub-agents#choose-the-subagent-scope).

137* **MCP servers** override by name: local > project > user. See [MCP scope](/en/mcp#scope-hierarchy-and-precedence).153* **MCP servers** override by name: local > project > user. See [MCP scope](/en/mcp#scope-hierarchy-and-precedence).

138* **Hooks** merge: all registered hooks fire for their matching events regardless of source. See [hooks](/en/hooks).154* **Hooks** merge: all registered hooks fire for their matching events regardless of source. See [hooks](/en/hooks).


180 196 

181 **What loads:** Full content of all CLAUDE.md files (managed, user, and project levels).197 **What loads:** Full content of all CLAUDE.md files (managed, user, and project levels).

182 198 

183 **Inheritance:** Claude reads CLAUDE.md files from your working directory up to the root, and discovers nested ones in subdirectories as it accesses those files. See [How Claude looks up memories](/en/memory#how-claude-looks-up-memories) for details.199 **Inheritance:** Claude reads CLAUDE.md files from your working directory up to the root, and discovers nested ones in subdirectories as it accesses those files. See [How CLAUDE.md files load](/en/memory#how-claudemd-files-load) for details.

184 200 

185 <Tip>Keep CLAUDE.md under \~500 lines. Move reference material to skills, which load on-demand.</Tip>201 <Tip>Keep CLAUDE.md under \~500 lines. Move reference material to skills, which load on-demand.</Tip>

186 </Tab>202 </Tab>

hooks.md +5 −5

Details

768 768 

769### PreToolUse769### PreToolUse

770 770 

771Runs after Claude creates tool parameters and before processing the tool call. Matches on tool name: `Bash`, `Edit`, `Write`, `Read`, `Glob`, `Grep`, `Task`, `WebFetch`, `WebSearch`, and any [MCP tool names](#match-mcp-tools).771Runs after Claude creates tool parameters and before processing the tool call. Matches on tool name: `Bash`, `Edit`, `Write`, `Read`, `Glob`, `Grep`, `Agent`, `WebFetch`, `WebSearch`, and any [MCP tool names](#match-mcp-tools).

772 772 

773Use [PreToolUse decision control](#pretooluse-decision-control) to allow, deny, or ask for permission to use the tool.773Use [PreToolUse decision control](#pretooluse-decision-control) to allow, deny, or ask for permission to use the tool.

774 774 


858| `allowed_domains` | array | `["docs.example.com"]` | Optional: only include results from these domains |858| `allowed_domains` | array | `["docs.example.com"]` | Optional: only include results from these domains |

859| `blocked_domains` | array | `["spam.example.com"]` | Optional: exclude results from these domains |859| `blocked_domains` | array | `["spam.example.com"]` | Optional: exclude results from these domains |

860 860 

861##### Task861##### Agent

862 862 

863Spawns a [subagent](/en/sub-agents).863Spawns a [subagent](/en/sub-agents).

864 864 


1113 1113 

1114### SubagentStart1114### SubagentStart

1115 1115 

1116Runs when a Claude Code subagent is spawned via the Task tool. Supports matchers to filter by agent type name (built-in agents like `Bash`, `Explore`, `Plan`, or custom agent names from `.claude/agents/`).1116Runs when a Claude Code subagent is spawned via the Agent tool. Supports matchers to filter by agent type name (built-in agents like `Bash`, `Explore`, `Plan`, or custom agent names from `.claude/agents/`).

1117 1117 

1118#### SubagentStart input1118#### SubagentStart input

1119 1119 


1517 1517 

1518## Prompt-based hooks1518## Prompt-based hooks

1519 1519 

1520In addition to Bash command hooks (`type: "command"`), Claude Code supports prompt-based hooks (`type: "prompt"`) that use an LLM to evaluate whether to allow or block an action, and agent hooks (`type: "agent"`) that spawn an agentic verifier with tool access. Not all events support every hook type.1520In addition to command and HTTP hooks, Claude Code supports prompt-based hooks (`type: "prompt"`) that use an LLM to evaluate whether to allow or block an action, and agent hooks (`type: "agent"`) that spawn an agentic verifier with tool access. Not all events support every hook type.

1521 1521 

1522Events that support all three hook types (`command`, `prompt`, and `agent`):1522Events that support all four hook types (`command`, `http`, `prompt`, and `agent`):

1523 1523 

1524* `PermissionRequest`1524* `PermissionRequest`

1525* `PostToolUse`1525* `PostToolUse`

hooks-guide.md +45 −2

Details

313| `PreCompact` | Before context compaction |313| `PreCompact` | Before context compaction |

314| `SessionEnd` | When a session terminates |314| `SessionEnd` | When a session terminates |

315 315 

316Each hook has a `type` that determines how it runs. Most hooks use `"type": "command"`, which runs a shell command. Two other options use a Claude model to make decisions: `"type": "prompt"` for single-turn evaluation and `"type": "agent"` for multi-turn verification with tool access. See [Prompt-based hooks](#prompt-based-hooks) and [Agent-based hooks](#agent-based-hooks) for details.316Each hook has a `type` that determines how it runs. Most hooks use `"type": "command"`, which runs a shell command. Three other types are available:

317 

318* `"type": "http"`: POST event data to a URL. See [HTTP hooks](#http-hooks).

319* `"type": "prompt"`: single-turn LLM evaluation. See [Prompt-based hooks](#prompt-based-hooks).

320* `"type": "agent"`: multi-turn verification with tool access. See [Agent-based hooks](#agent-based-hooks).

317 321 

318### Read input and return output322### Read input and return output

319 323 


576 580 

577For full configuration options, see [Agent-based hooks](/en/hooks#agent-based-hooks) in the reference.581For full configuration options, see [Agent-based hooks](/en/hooks#agent-based-hooks) in the reference.

578 582 

583## HTTP hooks

584 

585Use `type: "http"` hooks to POST event data to an HTTP endpoint instead of running a shell command. The endpoint receives the same JSON that a command hook would receive on stdin, and returns results through the HTTP response body using the same JSON format.

586 

587HTTP hooks are useful when you want a web server, cloud function, or external service to handle hook logic: for example, a shared audit service that logs tool use events across a team.

588 

589This example posts every tool use to a local logging service:

590 

591```json theme={null}

592{

593 "hooks": {

594 "PostToolUse": [

595 {

596 "hooks": [

597 {

598 "type": "http",

599 "url": "http://localhost:8080/hooks/tool-use",

600 "headers": {

601 "Authorization": "Bearer $MY_TOKEN"

602 },

603 "allowedEnvVars": ["MY_TOKEN"]

604 }

605 ]

606 }

607 ]

608 }

609}

610```

611 

612The endpoint should return a JSON response body using the same [output format](/en/hooks#json-output) as command hooks. To block a tool call, return a 2xx response with the appropriate `hookSpecificOutput` fields. HTTP status codes alone cannot block actions.

613 

614Header values support environment variable interpolation using `$VAR_NAME` or `${VAR_NAME}` syntax. Only variables listed in the `allowedEnvVars` array are resolved; all other `$VAR` references remain empty.

615 

616<Note>

617 HTTP hooks must be configured by editing your settings JSON directly. The `/hooks` interactive menu only supports adding command hooks.

618</Note>

619 

620For full configuration options and response handling, see [HTTP hooks](/en/hooks#http-hook-fields) in the reference.

621 

579## Limitations and troubleshooting622## Limitations and troubleshooting

580 623 

581### Limitations624### Limitations

582 625 

583* Hooks communicate through stdout, stderr, and exit codes only. They cannot trigger slash commands or tool calls directly.626* Command hooks communicate through stdout, stderr, and exit codes only. They cannot trigger slash commands or tool calls directly. HTTP hooks communicate through the response body instead.

584* Hook timeout is 10 minutes by default, configurable per hook with the `timeout` field (in seconds).627* Hook timeout is 10 minutes by default, configurable per hook with the `timeout` field (in seconds).

585* `PostToolUse` hooks cannot undo actions since the tool has already executed.628* `PostToolUse` hooks cannot undo actions since the tool has already executed.

586* `PermissionRequest` hooks do not fire in [non-interactive mode](/en/headless) (`-p`). Use `PreToolUse` hooks for automated permission decisions.629* `PermissionRequest` hooks do not fire in [non-interactive mode](/en/headless) (`-p`). Use `PreToolUse` hooks for automated permission decisions.

Details

61 61 

62## What Claude can access62## What Claude can access

63 63 

64This guide focuses on the terminal. Claude Code also runs in [VS Code](/en/vs-code), [JetBrains IDEs](/en/jetbrains), and other environments.

65 

64When you run `claude` in a directory, Claude Code gains access to:66When you run `claude` in a directory, Claude Code gains access to:

65 67 

66* **Your project.** Files in your directory and subdirectories, plus files elsewhere with your permission.68* **Your project.** Files in your directory and subdirectories, plus files elsewhere with your permission.

67* **Your terminal.** Any command you could run: build tools, git, package managers, system utilities, scripts. If you can do it from the command line, Claude can too.69* **Your terminal.** Any command you could run: build tools, git, package managers, system utilities, scripts. If you can do it from the command line, Claude can too.

68* **Your git state.** Current branch, uncommitted changes, and recent commit history.70* **Your git state.** Current branch, uncommitted changes, and recent commit history.

69* **Your [CLAUDE.md](/en/memory).** A markdown file where you store project-specific instructions, conventions, and context that Claude should know every session.71* **Your [CLAUDE.md](/en/memory).** A markdown file where you store project-specific instructions, conventions, and context that Claude should know every session.

72* **[Auto memory](/en/memory#auto-memory).** Learnings Claude saves automatically as you work, like project patterns and your preferences. The first 200 lines of MEMORY.md are loaded at the start of each session.

70* **Extensions you configure.** [MCP servers](/en/mcp) for external services, [skills](/en/skills) for workflows, [subagents](/en/sub-agents) for delegated work, and [Claude in Chrome](/en/chrome) for browser interaction.73* **Extensions you configure.** [MCP servers](/en/mcp) for external services, [skills](/en/skills) for workflows, [subagents](/en/sub-agents) for delegated work, and [Claude in Chrome](/en/chrome) for browser interaction.

71 74 

72Because Claude sees your whole project, it can work across it. When you ask Claude to "fix the authentication bug," it searches for relevant files, reads multiple files to understand context, makes coordinated edits across them, runs tests to verify the fix, and commits the changes if you ask. This is different from inline code assistants that only see the current file.75Because Claude sees your whole project, it can work across it. When you ask Claude to "fix the authentication bug," it searches for relevant files, reads multiple files to understand context, makes coordinated edits across them, runs tests to verify the fix, and commits the changes if you ask. This is different from inline code assistants that only see the current file.

Details

91To create your own commands you can invoke with `/`, see [skills](/en/skills).91To create your own commands you can invoke with `/`, see [skills](/en/skills).

92 92 

93| Command | Purpose |93| Command | Purpose |

94| :------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |94| :------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

95| `/clear` | Clear conversation history |95| `/clear` | Clear conversation history |

96| `/compact [instructions]` | Compact conversation with optional focus instructions |96| `/compact [instructions]` | Compact conversation with optional focus instructions |

97| `/config` | Open the Settings interface (Config tab) |97| `/config` | Open the Settings interface (Config tab) |


114| `/stats` | Visualize daily usage, session history, streaks, and model preferences |114| `/stats` | Visualize daily usage, session history, streaks, and model preferences |

115| `/status` | Open the Settings interface (Status tab) showing version, model, account, and connectivity |115| `/status` | Open the Settings interface (Status tab) showing version, model, account, and connectivity |

116| `/statusline` | Set up Claude Code's status line UI |116| `/statusline` | Set up Claude Code's status line UI |

117| `/copy` | Copy the last response to clipboard. When code blocks are present, shows an interactive picker to select individual code blocks or the full response |117| `/copy` | Copy the last response to clipboard. When code blocks are present, shows an interactive picker to select individual code blocks or the full response. Select **Always copy full response** in the picker to skip it in future sessions; revert by setting `copyFullResponse` to `false` in `/config` |

118| `/tasks` | List and manage background tasks |118| `/tasks` | List and manage background tasks |

119| `/teleport` | Resume a remote session from claude.ai (subscribers only) |119| `/teleport` | Resume a remote session from claude.ai (subscribers only) |

120| `/desktop` | Hand off the current CLI session to the Claude Code Desktop app (macOS and Windows only) |120| `/desktop` | Hand off the current CLI session to the Claude Code Desktop app (macOS and Windows only) |

mcp.md +8 −1

Details

614 614 

615 * Authentication tokens are stored securely and refreshed automatically615 * Authentication tokens are stored securely and refreshed automatically

616 * Use "Clear authentication" in the `/mcp` menu to revoke access616 * Use "Clear authentication" in the `/mcp` menu to revoke access

617 * If your browser doesn't open automatically, copy the provided URL617 * If your browser doesn't open automatically, copy the provided URL and open it manually

618 * If the browser redirect fails with a connection error after authenticating, paste the full callback URL from your browser's address bar into the URL prompt that appears in Claude Code

618 * OAuth authentication works with HTTP servers619 * OAuth authentication works with HTTP servers

619</Tip>620</Tip>

620 621 


773 </Step>774 </Step>

774</Steps>775</Steps>

775 776 

777To disable claude.ai MCP servers in Claude Code, set the `ENABLE_CLAUDEAI_MCP_SERVERS` environment variable to `false`:

778 

779```bash theme={null}

780ENABLE_CLAUDEAI_MCP_SERVERS=false claude

781```

782 

776## Use Claude Code as an MCP server783## Use Claude Code as an MCP server

777 784 

778You can use Claude Code itself as an MCP server that other applications can connect to:785You can use Claude Code itself as an MCP server that other applications can connect to:

memory.md +198 −170

Details

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.3> Use this file to discover all available pages before exploring further.

4 4 

5# Manage Claude's memory5# How Claude remembers your project

6 6 

7> Learn how to manage Claude Code's memory across sessions with different memory locations and best practices.7> Give Claude persistent instructions with CLAUDE.md files, and let Claude accumulate learnings automatically with auto memory.

8 8 

9Claude Code has two kinds of memory that persist across sessions:9Each Claude Code session begins with a fresh context window. Two mechanisms carry knowledge across sessions:

10 10 

11* **Auto memory**: Claude automatically saves useful context like project patterns, key commands, and your preferences. This persists across sessions.11* **CLAUDE.md files**: instructions you write to give Claude persistent context

12* **CLAUDE.md files**: Markdown files you write and maintain with instructions, rules, and preferences for Claude to follow.12* **Auto memory**: notes Claude writes itself based on your corrections and preferences

13 13 

14Both are loaded into Claude's context at the start of every session, though auto memory loads only the first 200 lines of its main file.14This page covers how to:

15 15 

16## Determine memory type16* [Write and organize CLAUDE.md files](#claudemd-files)

17* [Scope rules to specific file types](#organize-rules-with-clauderules) with `.claude/rules/`

18* [Configure auto memory](#auto-memory) so Claude takes notes automatically

19* [Troubleshoot](#troubleshoot-memory-issues) when instructions aren't being followed

17 20 

18Claude Code offers several memory locations in a hierarchical structure, each serving a different purpose:21## CLAUDE.md vs auto memory

19 22 

20| Memory Type | Location | Purpose | Use Case Examples | Shared With |23Claude Code has two complementary memory systems. Both are loaded at the start of every conversation. Claude treats them as context, not enforced configuration. The more specific and concise your instructions, the more consistently Claude follows them.

21| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |

22| **Managed policy** | • macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`<br />• Linux: `/etc/claude-code/CLAUDE.md`<br />• Windows: `C:\Program Files\ClaudeCode\CLAUDE.md` | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |

23| **Project memory** | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |

24| **Project rules** | `./.claude/rules/*.md` | Modular, topic-specific project instructions | Language-specific guidelines, testing conventions, API standards | Team members via source control |

25| **User memory** | `~/.claude/CLAUDE.md` | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |

26| **Project memory (local)** | `./CLAUDE.local.md` | Personal project-specific preferences | Your sandbox URLs, preferred test data | Just you (current project) |

27| **Auto memory** | `~/.claude/projects/<project>/memory/` | Claude's automatic notes and learnings | Project patterns, debugging insights, architecture notes | Just you (per project) |

28 24 

29CLAUDE.md files in the directory hierarchy above the working directory are loaded in full at launch. CLAUDE.md files in child directories load on demand when Claude reads files in those directories. Auto memory loads only the first 200 lines of `MEMORY.md`. More specific instructions take precedence over broader ones.25| | CLAUDE.md files | Auto memory |

26| :------------------- | :------------------------------------------------ | :--------------------------------------------------------------- |

27| **Who writes it** | You | Claude |

28| **What it contains** | Instructions and rules | Learnings and patterns |

29| **Scope** | Project, user, or org | Per working tree |

30| **Loaded into** | Every session | Every session (first 200 lines) |

31| **Use for** | Coding standards, workflows, project architecture | Build commands, debugging insights, preferences Claude discovers |

30 32 

31<Note>33Use CLAUDE.md files when you want to guide Claude's behavior. Auto memory lets Claude learn from your corrections without manual effort.

32 CLAUDE.local.md files are automatically added to .gitignore, making them ideal for private project-specific preferences that shouldn't be checked into version control.

33</Note>

34 

35## Auto memory

36 34 

37Auto memory is a persistent directory where Claude records learnings, patterns, and insights as it works. Unlike CLAUDE.md files that contain instructions you write for Claude, auto memory contains notes Claude writes for itself based on what it discovers during sessions.35Subagents can also maintain their own auto memory. See [subagent configuration](/en/sub-agents#enable-persistent-memory) for details.

38 36 

39<Note>37## CLAUDE.md files

40 Auto memory is enabled by default. To toggle it on or off, use `/memory` and select the auto-memory toggle.

41</Note>

42 38 

43### What Claude remembers39CLAUDE.md files are markdown files that give Claude persistent instructions for a project, your personal workflow, or your entire organization. You write these files in plain text; Claude reads them at the start of every session.

44 40 

45As Claude works, it may save things like:41### Choose where to put CLAUDE.md files

46 42 

47* Project patterns: build commands, test conventions, code style preferences43CLAUDE.md files can live in several locations, each with a different scope. More specific locations take precedence over broader ones.

48* Debugging insights: solutions to tricky problems, common error causes

49* Architecture notes: key files, module relationships, important abstractions

50* Your preferences: communication style, workflow habits, tool choices

51 44 

52### Where auto memory is stored45| Scope | Location | Purpose | Use case examples | Shared with |

46| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |

47| **Managed policy** | • macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`<br />• Linux and WSL: `/etc/claude-code/CLAUDE.md`<br />• Windows: `C:\Program Files\ClaudeCode\CLAUDE.md` | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |

48| **Project instructions** | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |

49| **User instructions** | `~/.claude/CLAUDE.md` | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |

50| **Local instructions** | `./CLAUDE.local.md` | Personal project-specific preferences, not checked into git | Your sandbox URLs, preferred test data | Just you (current project) |

53 51 

54Each project gets its own memory directory at `~/.claude/projects/<project>/memory/`. The `<project>` path is derived from the git repository root, so all subdirectories within the same repo share one auto memory directory. Git worktrees get separate memory directories. Outside a git repo, the working directory is used instead.52CLAUDE.md files in the directory hierarchy above the working directory are loaded in full at launch. CLAUDE.md files in subdirectories load on demand when Claude reads files in those directories. See [How CLAUDE.md files load](#how-claudemd-files-load) for the full resolution order.

55 

56The directory contains a `MEMORY.md` entrypoint and optional topic files:

57 

58```text theme={null}

59~/.claude/projects/<project>/memory/

60├── MEMORY.md # Concise index, loaded into every session

61├── debugging.md # Detailed notes on debugging patterns

62├── api-conventions.md # API design decisions

63└── ... # Any other topic files Claude creates

64```

65 53 

66`MEMORY.md` acts as an index of the memory directory. Claude reads and writes files in this directory throughout your session, using `MEMORY.md` to keep track of what's stored where.54For large projects, you can break instructions into topic-specific files using [project rules](#organize-rules-with-clauderules). Rules let you scope instructions to specific file types or subdirectories.

67 55 

68### How it works56### Set up a project CLAUDE.md

69 57 

70* The first 200 lines of `MEMORY.md` are loaded into Claude's system prompt at the start of every session. Content beyond 200 lines is not loaded automatically, and Claude is instructed to keep it concise by moving detailed notes into separate topic files.58A project CLAUDE.md can be stored in either `./CLAUDE.md` or `./.claude/CLAUDE.md`. Create this file and add instructions that apply to anyone working on the project: build and test commands, coding standards, architectural decisions, naming conventions, and common workflows. These instructions are shared with your team through version control, so focus on project-level standards rather than personal preferences.

71* Topic files like `debugging.md` or `patterns.md` are not loaded at startup. Claude reads them on demand using its standard file tools when it needs the information.

72* Claude reads and writes memory files during your session, so you'll see memory updates happen as you work.

73 59 

74### Manage auto memory60<Tip>

61 Run `/init` to generate a starting CLAUDE.md automatically. Claude analyzes your codebase and creates a file with build commands, test instructions, and project conventions it discovers. If a CLAUDE.md already exists, `/init` suggests improvements rather than overwriting it. Refine from there with instructions Claude wouldn't discover on its own.

62</Tip>

75 63 

76Auto memory files are markdown files you can edit at any time. Use `/memory` to open the file selector, which includes your auto memory entrypoint alongside your CLAUDE.md files. The `/memory` selector also includes an auto-memory toggle to turn the feature on or off.64### Write effective instructions

77 65 

78To ask Claude to save something specific, tell it directly: "remember that we use pnpm, not npm" or "save to memory that the API tests require a local Redis instance".66CLAUDE.md files are loaded into the context window at the start of every session, consuming tokens alongside your conversation. Because they're context rather than enforced configuration, how you write instructions affects how reliably Claude follows them. Specific, concise, well-structured instructions work best.

79 67 

80You can also control auto memory through settings or environment variables.68**Size**: target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence. If your instructions are growing large, split them using [imports](#import-additional-files) or [`.claude/rules/`](#organize-rules-with-clauderules) files.

81 69 

82Disable auto memory for all projects by adding `autoMemoryEnabled` to your user settings:70**Structure**: use markdown headers and bullets to group related instructions. Claude scans structure the same way readers do: organized sections are easier to follow than dense paragraphs.

83 71 

84```json theme={null}72**Specificity**: write instructions that are concrete enough to verify. For example:

85// ~/.claude/settings.json

86{ "autoMemoryEnabled": false }

87```

88 73 

89Disable auto memory for a single project by adding `autoMemoryEnabled` to the project settings:74* "Use 2-space indentation" instead of "Format code properly"

75* "Run `npm test` before committing" instead of "Test your changes"

76* "API handlers live in `src/api/handlers/`" instead of "Keep files organized"

90 77 

91```json theme={null}78**Consistency**: if two rules contradict each other, Claude may pick one arbitrarily. Review your CLAUDE.md files, nested CLAUDE.md files in subdirectories, and [`.claude/rules/`](#organize-rules-with-clauderules) periodically to remove outdated or conflicting instructions. In monorepos, use [`claudeMdExcludes`](#exclude-specific-claudemd-files) to skip CLAUDE.md files from other teams that aren't relevant to your work.

92// .claude/settings.json

93{ "autoMemoryEnabled": false }

94```

95 79 

96Override all other settings with the `CLAUDE_CODE_DISABLE_AUTO_MEMORY` environment variable. This takes precedence over both the `/memory` toggle and `settings.json`, making it useful for CI or managed environments:80### Import additional files

97 81 

98```bash theme={null}82CLAUDE.md files can import additional files using `@path/to/import` syntax. Imported files are expanded and loaded into context at launch alongside the CLAUDE.md that references them.

99export CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 # Force off

100export CLAUDE_CODE_DISABLE_AUTO_MEMORY=0 # Force on

101```

102 83 

103## CLAUDE.md imports84Both relative and absolute paths are allowed. Relative paths resolve relative to the file containing the import, not the working directory. Imported files can recursively import other files, with a maximum depth of five hops.

104 85 

105CLAUDE.md files can import additional files using `@path/to/import` syntax. The following example imports 3 files:86To pull in a README, package.json, and a workflow guide, reference them with `@` syntax anywhere in your CLAUDE.md:

106 87 

107```88```text theme={null}

108See @README for project overview and @package.json for available npm commands for this project.89See @README for project overview and @package.json for available npm commands for this project.

109 90 

110# Additional Instructions91# Additional Instructions

111- git workflow @docs/git-instructions.md92- git workflow @docs/git-instructions.md

112```93```

113 94 

114Both relative and absolute paths are allowed. Relative paths resolve relative to the file containing the import, not the working directory. For private per-project preferences that shouldn't be checked into version control, prefer `CLAUDE.local.md`: it is automatically loaded and added to `.gitignore`.95For private per-project preferences that shouldn't be checked into version control, use `CLAUDE.local.md`: it is automatically loaded and added to `.gitignore`.

115 96 

116If you work across multiple git worktrees, `CLAUDE.local.md` only exists in one. Use a home-directory import instead so all worktrees share the same personal instructions:97If you work across multiple git worktrees, `CLAUDE.local.md` only exists in one. Use a home-directory import instead so all worktrees share the same personal instructions:

117 98 

118```99```text theme={null}

119# Individual Preferences100# Individual Preferences

120- @~/.claude/my-project-instructions.md101- @~/.claude/my-project-instructions.md

121```102```

122 103 

123<Warning>104<Warning>

124 The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the specific files. Approve to load them; decline to skip them. This is a one-time decision per project: once declined, the dialog does not resurface and the imports remain disabled.105 The first time Claude Code encounters external imports in a project, it shows an approval dialog listing the files. If you decline, the imports stay disabled and the dialog does not appear again.

125</Warning>106</Warning>

126 107 

127To avoid potential collisions, imports are not evaluated inside markdown code spans and code blocks.108For a more structured approach to organizing instructions, see [`.claude/rules/`](#organize-rules-with-clauderules).

128 109 

129```110### How CLAUDE.md files load

130This code span will not be treated as an import: `@anthropic-ai/claude-code`

131```

132 111 

133Imported files can recursively import additional files, with a max-depth of 5 hops. You can see what memory files are loaded by running `/memory` command.112Claude Code reads CLAUDE.md files by walking up the directory tree from your current working directory, checking each directory along the way for CLAUDE.md and CLAUDE.local.md files. This means if you run Claude Code in `foo/bar/`, it loads instructions from both `foo/bar/CLAUDE.md` and `foo/CLAUDE.md`.

134 113 

135## How Claude looks up memories114Claude also discovers CLAUDE.md files in subdirectories under your current working directory. Instead of loading them at launch, they are included when Claude reads files in those subdirectories.

136 115 

137Claude Code reads memories recursively: starting in the cwd, Claude Code recurses up to (but not including) the root directory */* and reads any CLAUDE.md or CLAUDE.local.md files it finds. This is especially convenient when working in large repositories where you run Claude Code in *foo/bar/*, and have memories in both *foo/CLAUDE.md* and *foo/bar/CLAUDE.md*.116If you work in a large monorepo where other teams' CLAUDE.md files get picked up, use [`claudeMdExcludes`](#exclude-specific-claudemd-files) to skip them.

138 117 

139Claude will also discover CLAUDE.md nested in subtrees under your current working directory. Instead of loading them at launch, they are only included when Claude reads files in those subtrees.118#### Load from additional directories

140 

141### Load memory from additional directories

142 119 

143The `--add-dir` flag gives Claude access to additional directories outside your main working directory. By default, CLAUDE.md files from these directories are not loaded.120The `--add-dir` flag gives Claude access to additional directories outside your main working directory. By default, CLAUDE.md files from these directories are not loaded.

144 121 

145To also load memory files (CLAUDE.md, .claude/CLAUDE.md, and .claude/rules/\*.md) from additional directories, set the `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD` environment variable:122To also load CLAUDE.md files from additional directories, including `CLAUDE.md`, `.claude/CLAUDE.md`, and `.claude/rules/*.md`, set the `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD` environment variable:

146 123 

147```bash theme={null}124```bash theme={null}

148CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude --add-dir ../shared-config125CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude --add-dir ../shared-config

149```126```

150 127 

151## Directly edit memories with `/memory`128### Organize rules with `.claude/rules/`

152 

153Use the `/memory` command during a session to open any memory file in your system editor for more extensive additions or organization.

154 129 

155## Set up project memory130For larger projects, you can organize instructions into multiple files using the `.claude/rules/` directory. This keeps instructions modular and easier for teams to maintain. Rules can also be [scoped to specific file paths](#path-specific-rules), so they only load into context when Claude works with matching files, reducing noise and saving context space.

156 131 

157Suppose you want to set up a CLAUDE.md file to store important project information, conventions, and frequently used commands. Project memory can be stored in either `./CLAUDE.md` or `./.claude/CLAUDE.md`.132<Note>

158 133 Rules load into context every session or when matching files are opened. For task-specific instructions that don't need to be in context all the time, use [skills](/en/skills) instead, which only load when you invoke them or when Claude determines they're relevant to your prompt.

159Bootstrap a CLAUDE.md for your codebase with the following command:134</Note>

160 

161```

162> /init

163```

164 

165<Tip>

166 Tips:

167 

168 * Include frequently used commands (build, test, lint) to avoid repeated searches

169 * Document code style preferences and naming conventions

170 * Add important architectural patterns specific to your project

171 * CLAUDE.md memories can be used for both instructions shared with your team and for your individual preferences.

172</Tip>

173 

174## Modular rules with `.claude/rules/`

175 

176For larger projects, you can organize instructions into multiple files using the `.claude/rules/` directory. This allows teams to maintain focused, well-organized rule files instead of one large CLAUDE.md.

177 135 

178### Basic structure136#### Set up rules

179 137 

180Place markdown files in your project's `.claude/rules/` directory:138Place markdown files in your project's `.claude/rules/` directory. Each file should cover one topic, with a descriptive filename like `testing.md` or `api-design.md`. All `.md` files are discovered recursively, so you can organize rules into subdirectories like `frontend/` or `backend/`:

181 139 

182```140```text theme={null}

183your-project/141your-project/

184├── .claude/142├── .claude/

185│ ├── CLAUDE.md # Main project instructions143│ ├── CLAUDE.md # Main project instructions


189│ └── security.md # Security requirements147│ └── security.md # Security requirements

190```148```

191 149 

192All `.md` files in `.claude/rules/` are automatically loaded as project memory, with the same priority as `.claude/CLAUDE.md`.150Rules without [`paths` frontmatter](#path-specific-rules) are loaded at launch with the same priority as `.claude/CLAUDE.md`.

193 151 

194### Path-specific rules152#### Path-specific rules

195 153 

196Rules can be scoped to specific files using YAML frontmatter with the `paths` field. These conditional rules only apply when Claude is working with files matching the specified patterns.154Rules can be scoped to specific files using YAML frontmatter with the `paths` field. These conditional rules only apply when Claude is working with files matching the specified patterns.

197 155 


208- Include OpenAPI documentation comments166- Include OpenAPI documentation comments

209```167```

210 168 

211Rules without a `paths` field are loaded unconditionally and apply to all files.169Rules without a `paths` field are loaded unconditionally and apply to all files. Path-scoped rules trigger when Claude reads files matching the pattern, not on every tool use.

212 

213### Glob patterns

214 170 

215The `paths` field supports standard glob patterns:171Use glob patterns in the `paths` field to match files by extension, directory, or any combination:

216 172 

217| Pattern | Matches |173| Pattern | Matches |

218| ---------------------- | ---------------------------------------- |174| ---------------------- | ---------------------------------------- |


221| `*.md` | Markdown files in the project root |177| `*.md` | Markdown files in the project root |

222| `src/components/*.tsx` | React components in a specific directory |178| `src/components/*.tsx` | React components in a specific directory |

223 179 

224You can specify multiple patterns:180You can specify multiple patterns and use brace expansion to match multiple extensions in one pattern:

225 181 

226```markdown theme={null}182```markdown theme={null}

227---183---

228paths:184paths:

229 - "src/**/*.ts"185 - "src/**/*.{ts,tsx}"

230 - "lib/**/*.ts"186 - "lib/**/*.ts"

231 - "tests/**/*.test.ts"187 - "tests/**/*.test.ts"

232---188---

233```189```

234 190 

235Brace expansion is supported for matching multiple extensions or directories:191#### Share rules across projects with symlinks

236 192 

237```markdown theme={null}193The `.claude/rules/` directory supports symlinks, so you can maintain a shared set of rules and link them into multiple projects. Symlinks are resolved and loaded normally, and circular symlinks are detected and handled gracefully.

238paths:

239 - "src/**/*.{ts,tsx}"

240 - "{src,lib}/**/*.ts"

241 194 

242# TypeScript/React Rules195This example links both a shared directory and an individual file:

243```

244 196 

245This expands `src/**/*.{ts,tsx}` to match both `.ts` and `.tsx` files.197```bash theme={null}

198ln -s ~/shared-claude-rules .claude/rules/shared

199ln -s ~/company-standards/security.md .claude/rules/security.md

200```

246 201 

247### Subdirectories202#### User-level rules

248 203 

249Rules can be organized into subdirectories for better structure:204Personal rules in `~/.claude/rules/` apply to every project on your machine. Use them for preferences that aren't project-specific:

250 205 

251```206```text theme={null}

252.claude/rules/207~/.claude/rules/

253├── frontend/208├── preferences.md # Your personal coding preferences

254│ ├── react.md209── workflows.md # Your preferred workflows

255│ └── styles.md

256├── backend/

257│ ├── api.md

258│ └── database.md

259└── general.md

260```210```

261 211 

262All `.md` files are discovered recursively.212User-level rules are loaded before project rules, giving project rules higher priority.

263 213 

264### Symlinks214### Manage CLAUDE.md for large teams

265 215 

266The `.claude/rules/` directory supports symlinks, allowing you to share common rules across multiple projects:216For organizations deploying Claude Code across teams, you can centralize instructions and control which CLAUDE.md files are loaded.

267 217 

268```bash theme={null}218#### Deploy organization-wide CLAUDE.md

269# Symlink a shared rules directory

270ln -s ~/shared-claude-rules .claude/rules/shared

271 219 

272# Symlink individual rule files220Organizations can deploy a centrally managed CLAUDE.md that applies to all users on a machine. This file cannot be excluded by individual settings.

273ln -s ~/company-standards/security.md .claude/rules/security.md221 

222<Steps>

223 <Step title="Create the file at the managed policy location">

224 * macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`

225 * Linux and WSL: `/etc/claude-code/CLAUDE.md`

226 * Windows: `C:\Program Files\ClaudeCode\CLAUDE.md`

227 </Step>

228 

229 <Step title="Deploy with your configuration management system">

230 Use MDM, Group Policy, Ansible, or similar tools to distribute the file across developer machines. See [managed settings](/en/permissions#managed-settings) for other organization-wide configuration options.

231 </Step>

232</Steps>

233 

234#### Exclude specific CLAUDE.md files

235 

236In large monorepos, ancestor CLAUDE.md files may contain instructions that aren't relevant to your work. The `claudeMdExcludes` setting lets you skip specific files by path or glob pattern.

237 

238This example excludes a top-level CLAUDE.md and a rules directory from a parent folder. Add it to `.claude/settings.local.json` so the exclusion stays local to your machine:

239 

240```json theme={null}

241{

242 "claudeMdExcludes": [

243 "**/monorepo/CLAUDE.md",

244 "/home/user/monorepo/other-team/.claude/rules/**"

245 ]

246}

274```247```

275 248 

276Symlinks are resolved and their contents are loaded normally. Circular symlinks are detected and handled gracefully.249Patterns are matched against absolute file paths using glob syntax. You can configure `claudeMdExcludes` at any [settings layer](/en/settings#settings-files): user, project, local, or managed policy. Arrays merge across layers.

250 

251Managed policy CLAUDE.md files cannot be excluded. This ensures organization-wide instructions always apply regardless of individual settings.

252 

253## Auto memory

254 

255Auto memory lets Claude accumulate knowledge across sessions without you writing anything. Claude saves notes for itself as it works: build commands, debugging insights, architecture notes, code style preferences, and workflow habits. Claude doesn't save something every session. It decides what's worth remembering based on whether the information would be useful in a future conversation.

277 256 

278### User-level rules257### Enable or disable auto memory

279 258 

280You can create personal rules that apply to all your projects in `~/.claude/rules/`:259Auto memory is on by default. To toggle it, open `/memory` in a session and use the auto memory toggle, or set `autoMemoryEnabled` in your project settings:

281 260 

261```json theme={null}

262{

263 "autoMemoryEnabled": false

264}

282```265```

283~/.claude/rules/266 

284├── preferences.md # Your personal coding preferences267To disable auto memory via environment variable, set `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1`.

285└── workflows.md # Your preferred workflows268 

269### Storage location

270 

271Each project gets its own memory directory at `~/.claude/projects/<project>/memory/`. The `<project>` path is derived from the git repository, so all worktrees and subdirectories within the same repo share one auto memory directory. Outside a git repo, the project root is used instead.

272 

273The directory contains a `MEMORY.md` entrypoint and optional topic files:

274 

275```text theme={null}

276~/.claude/projects/<project>/memory/

277├── MEMORY.md # Concise index, loaded into every session

278├── debugging.md # Detailed notes on debugging patterns

279├── api-conventions.md # API design decisions

280└── ... # Any other topic files Claude creates

286```281```

287 282 

288User-level rules are loaded before project rules, giving project rules higher priority.283`MEMORY.md` acts as an index of the memory directory. Claude reads and writes files in this directory throughout your session, using `MEMORY.md` to keep track of what's stored where.

289 284 

290<Tip>285Auto memory is machine-local. All worktrees and subdirectories within the same git repository share one auto memory directory. Files are not shared across machines or cloud environments.

291 Best practices for `.claude/rules/`:

292 286 

293 * **Keep rules focused**: Each file should cover one topic (e.g., `testing.md`, `api-design.md`)287### How it works

294 * **Use descriptive filenames**: The filename should indicate what the rules cover288 

295 * **Use conditional rules sparingly**: Only add `paths` frontmatter when rules truly apply to specific file types289The first 200 lines of `MEMORY.md` are loaded at the start of every conversation. Content beyond line 200 is not loaded at session start. Claude keeps `MEMORY.md` concise by moving detailed notes into separate topic files.

296 * **Organize with subdirectories**: Group related rules (e.g., `frontend/`, `backend/`)290 

297</Tip>291This 200-line limit applies only to `MEMORY.md`. CLAUDE.md files are loaded in full regardless of length, though shorter files produce better adherence.

292 

293Topic files like `debugging.md` or `patterns.md` are not loaded at startup. Claude reads them on demand using its standard file tools when it needs the information.

294 

295Claude reads and writes memory files during your session. When you see "Writing memory" or "Recalled memory" in the Claude Code interface, Claude is actively updating or reading from `~/.claude/projects/<project>/memory/`.

296 

297### Audit and edit your memory

298 

299Auto memory files are plain markdown you can edit or delete at any time. Run [`/memory`](#view-and-edit-with-memory) to browse and open memory files from within a session.

300 

301## View and edit with `/memory`

302 

303The `/memory` command lists all CLAUDE.md and rules files loaded in your current session, lets you toggle auto memory on or off, and provides a link to open the auto memory folder. Select any file to open it in your editor.

304 

305When you ask Claude to remember something, like "always use pnpm, not npm" or "remember that the API tests require a local Redis instance," Claude saves it to auto memory. To add instructions to CLAUDE.md instead, ask Claude directly, like "add this to CLAUDE.md," or edit the file yourself via `/memory`.

306 

307## Troubleshoot memory issues

308 

309These are the most common issues with CLAUDE.md and auto memory, along with steps to debug them.

310 

311### Claude isn't following my CLAUDE.md

312 

313CLAUDE.md is context, not enforcement. Claude reads it and tries to follow it, but there's no guarantee of strict compliance, especially for vague or conflicting instructions.

314 

315To debug:

316 

317* Run `/memory` to verify your CLAUDE.md files are being loaded. If a file isn't listed, Claude can't see it.

318* Check that the relevant CLAUDE.md is in a location that gets loaded for your session (see [Choose where to put CLAUDE.md files](#choose-where-to-put-claudemd-files)).

319* Make instructions more specific. "Use 2-space indentation" works better than "format code nicely."

320* Look for conflicting instructions across CLAUDE.md files. If two files give different guidance for the same behavior, Claude may pick one arbitrarily.

321 

322### I don't know what auto memory saved

323 

324Run `/memory` and select the auto memory folder to browse what Claude has saved. Everything is plain markdown you can read, edit, or delete.

298 325 

299## Organization-level memory management326### My CLAUDE.md is too large

300 327 

301Organizations can deploy centrally managed CLAUDE.md files that apply to all users.328Files over 200 lines consume more context and may reduce adherence. Move detailed content into separate files referenced with `@path` imports (see [Import additional files](#import-additional-files)), or split your instructions across `.claude/rules/` files.

302 329 

303To set up organization-level memory management:330### Instructions seem lost after `/compact`

304 331 

3051. Create the managed memory file at the **Managed policy** location shown in the [memory types table above](#determine-memory-type).332CLAUDE.md fully survives compaction. After `/compact`, Claude re-reads your CLAUDE.md from disk and re-injects it fresh into the session. If an instruction disappeared after compaction, it was given only in conversation, not written to CLAUDE.md. Add it to CLAUDE.md to make it persist across sessions.

306 333 

3072. Deploy via your configuration management system (MDM, Group Policy, Ansible, etc.) to ensure consistent distribution across all developer machines.334See [Write effective instructions](#write-effective-instructions) for guidance on size, structure, and specificity.

308 335 

309## Memory best practices336## Related resources

310 337 

311* **Be specific**: "Use 2-space indentation" is better than "Format code properly".338* [Skills](/en/skills): package repeatable workflows that load on demand

312* **Use structure to organize**: Format each individual memory as a bullet point and group related memories under descriptive markdown headings.339* [Settings](/en/settings): configure Claude Code behavior with settings files

313* **Review periodically**: Update memories as your project evolves to ensure Claude is always using the most up to date information and context.340* [Manage sessions](/en/sessions): manage context, resume conversations, and run parallel sessions

341* [Subagent memory](/en/sub-agents#enable-persistent-memory): let subagents maintain their own auto memory

overview.md +3 −2

Details

156 </Accordion>156 </Accordion>

157 157 

158 <Accordion title="Customize with instructions, skills, and hooks" icon="sliders">158 <Accordion title="Customize with instructions, skills, and hooks" icon="sliders">

159 [`CLAUDE.md`](/en/claude-md) is a markdown file you add to your project root that Claude Code reads at the start of every session. Use it to set coding standards, architecture decisions, preferred libraries, and review checklists.159 [`CLAUDE.md`](/en/memory) is a markdown file you add to your project root that Claude Code reads at the start of every session. Use it to set coding standards, architecture decisions, preferred libraries, and review checklists. Claude also builds [auto memory](/en/memory#auto-memory) as it works, saving learnings like build commands and debugging insights across sessions without you writing anything.

160 160 

161 Create [custom slash commands](/en/skills) to package repeatable workflows your team can share, like `/review-pr` or `/deploy-staging`.161 Create [custom slash commands](/en/skills) to package repeatable workflows your team can share, like `/review-pr` or `/deploy-staging`.

162 162 


216Once you've installed Claude Code, these guides help you go deeper.216Once you've installed Claude Code, these guides help you go deeper.

217 217 

218* [Quickstart](/en/quickstart): walk through your first real task, from exploring a codebase to committing a fix218* [Quickstart](/en/quickstart): walk through your first real task, from exploring a codebase to committing a fix

219* Level up with [best practices](/en/best-practices) and [common workflows](/en/common-workflows)219* [Store instructions and memories](/en/memory): give Claude persistent instructions with CLAUDE.md files and auto memory

220* [Common workflows](/en/common-workflows) and [best practices](/en/best-practices): patterns for getting the most out of Claude Code

220* [Settings](/en/settings): customize Claude Code for your workflow221* [Settings](/en/settings): customize Claude Code for your workflow

221* [Troubleshooting](/en/troubleshooting): solutions for common issues222* [Troubleshooting](/en/troubleshooting): solutions for common issues

222* [code.claude.com](https://code.claude.com/): demos, pricing, and product details223* [code.claude.com](https://code.claude.com/): demos, pricing, and product details

permissions.md +6 −6

Details

167* `mcp__puppeteer__*` wildcard syntax that also matches all tools from the `puppeteer` server167* `mcp__puppeteer__*` wildcard syntax that also matches all tools from the `puppeteer` server

168* `mcp__puppeteer__puppeteer_navigate` matches the `puppeteer_navigate` tool provided by the `puppeteer` server168* `mcp__puppeteer__puppeteer_navigate` matches the `puppeteer_navigate` tool provided by the `puppeteer` server

169 169 

170### Task (subagents)170### Agent (subagents)

171 171 

172Use `Task(AgentName)` rules to control which [subagents](/en/sub-agents) Claude can use:172Use `Agent(AgentName)` rules to control which [subagents](/en/sub-agents) Claude can use:

173 173 

174* `Task(Explore)` matches the Explore subagent174* `Agent(Explore)` matches the Explore subagent

175* `Task(Plan)` matches the Plan subagent175* `Agent(Plan)` matches the Plan subagent

176* `Task(my-custom-agent)` matches a custom subagent named `my-custom-agent`176* `Agent(my-custom-agent)` matches a custom subagent named `my-custom-agent`

177 177 

178Add these rules to the `deny` array in your settings or use the `--disallowedTools` CLI flag to disable specific agents. To disable the Explore agent:178Add these rules to the `deny` array in your settings or use the `--disallowedTools` CLI flag to disable specific agents. To disable the Explore agent:

179 179 

180```json theme={null}180```json theme={null}

181{181{

182 "permissions": {182 "permissions": {

183 "deny": ["Task(Explore)"]183 "deny": ["Agent(Explore)"]

184 }184 }

185}185}

186```186```

Details

7> Continue a local Claude Code session from your phone, tablet, or any browser using Remote Control. Works with claude.ai/code and the Claude mobile app.7> Continue a local Claude Code session from your phone, tablet, or any browser using Remote Control. Works with claude.ai/code and the Claude mobile app.

8 8 

9<Note>9<Note>

10 Remote Control is available as a research preview on Max plans and will be rolling out to Pro plans soon. It is not available on Team or Enterprise plans.10 Remote Control is available as a research preview on Max and Pro plans. It is not available on Team or Enterprise plans.

11</Note>11</Note>

12 12 

13Remote Control connects [claude.ai/code](https://claude.ai/code) or the Claude app for [iOS](https://apps.apple.com/us/app/claude-by-anthropic/id6473753684) and [Android](https://play.google.com/store/apps/details?id=com.anthropic.claude) to a Claude Code session running on your machine. Start a task at your desk, then pick it up from your phone on the couch or a browser on another computer.13Remote Control connects [claude.ai/code](https://claude.ai/code) or the Claude app for [iOS](https://apps.apple.com/us/app/claude-by-anthropic/id6473753684) and [Android](https://play.google.com/store/apps/details?id=com.anthropic.claude) to a Claude Code session running on your machine. Start a task at your desk, then pick it up from your phone on the couch or a browser on another computer.

sandboxing.md +37 −1

Details

42* **Blocked access**: Cannot modify files outside the current working directory without explicit permission42* **Blocked access**: Cannot modify files outside the current working directory without explicit permission

43* **Configurable**: Define custom allowed and denied paths through settings43* **Configurable**: Define custom allowed and denied paths through settings

44 44 

45You can grant write access to additional paths using `sandbox.filesystem.allowWrite` in your settings. These restrictions are enforced at the OS level (Seatbelt on macOS, bubblewrap on Linux), so they apply to all subprocess commands, including tools like `kubectl`, `terraform`, and `npm`, not just Claude's file tools.

46 

45### Network isolation47### Network isolation

46 48 

47Network access is controlled through a proxy server running outside the sandbox:49Network access is controlled through a proxy server running outside the sandbox:


113 115 

114Customize sandbox behavior through your `settings.json` file. See [Settings](/en/settings#sandbox-settings) for complete configuration reference.116Customize sandbox behavior through your `settings.json` file. See [Settings](/en/settings#sandbox-settings) for complete configuration reference.

115 117 

118#### Granting subprocess write access to specific paths

119 

120By default, sandboxed commands can only write to the current working directory. If subprocess commands like `kubectl`, `terraform`, or `npm` need to write outside the project directory, use `sandbox.filesystem.allowWrite` to grant access to specific paths:

121 

122```json theme={null}

123{

124 "sandbox": {

125 "enabled": true,

126 "filesystem": {

127 "allowWrite": ["~/.kube", "//tmp/build"]

128 }

129 }

130}

131```

132 

133These paths are enforced at the OS level, so all commands running inside the sandbox, including their child processes, respect them. This is the recommended approach when a tool needs write access to a specific location, rather than excluding the tool from the sandbox entirely with `excludedCommands`.

134 

135When `allowWrite` (or `denyWrite`/`denyRead`) is defined in multiple [settings scopes](/en/settings#settings-precedence), the arrays are **merged**, meaning paths from every scope are combined, not replaced. For example, if managed settings allow writes to `//opt/company-tools` and a user adds `~/.kube` in their personal settings, both paths are included in the final sandbox configuration. This means users and projects can extend the list without duplicating or overriding paths set by higher-priority scopes.

136 

137Path prefixes control how paths are resolved:

138 

139| Prefix | Meaning | Example |

140| :---------------- | :------------------------------------------ | :------------------------------------- |

141| `//` | Absolute path from filesystem root | `//tmp/build` becomes `/tmp/build` |

142| `~/` | Relative to home directory | `~/.kube` becomes `$HOME/.kube` |

143| `/` | Relative to the settings file's directory | `/build` becomes `$SETTINGS_DIR/build` |

144| `./` or no prefix | Relative path (resolved by sandbox runtime) | `./output` |

145 

146You can also deny write or read access using `sandbox.filesystem.denyWrite` and `sandbox.filesystem.denyRead`. These are merged with any paths from `Edit(...)` and `Read(...)` permission rules.

147 

116<Tip>148<Tip>

117 Not all commands are compatible with sandboxing out of the box. Some notes that may help you make the most out of the sandbox:149 Not all commands are compatible with sandboxing out of the box. Some notes that may help you make the most out of the sandbox:

118 150 


191* **Permissions** control which tools Claude Code can use and are evaluated before any tool runs. They apply to all tools: Bash, Read, Edit, WebFetch, MCP, and others.223* **Permissions** control which tools Claude Code can use and are evaluated before any tool runs. They apply to all tools: Bash, Read, Edit, WebFetch, MCP, and others.

192* **Sandboxing** provides OS-level enforcement that restricts what Bash commands can access at the filesystem and network level. It applies only to Bash commands and their child processes.224* **Sandboxing** provides OS-level enforcement that restricts what Bash commands can access at the filesystem and network level. It applies only to Bash commands and their child processes.

193 225 

194Filesystem and network restrictions are configured through permission rules, not sandbox settings:226Filesystem and network restrictions are configured through both sandbox settings and permission rules:

195 227 

228* Use `sandbox.filesystem.allowWrite` to grant subprocess write access to paths outside the working directory

229* Use `sandbox.filesystem.denyWrite` and `sandbox.filesystem.denyRead` to block subprocess access to specific paths

196* Use `Read` and `Edit` deny rules to block access to specific files or directories230* Use `Read` and `Edit` deny rules to block access to specific files or directories

197* Use `WebFetch` allow/deny rules to control domain access231* Use `WebFetch` allow/deny rules to control domain access

198* Use sandbox `allowedDomains` to control which domains Bash commands can reach232* Use sandbox `allowedDomains` to control which domains Bash commands can reach

199 233 

234Paths from both `sandbox.filesystem` settings and permission rules are merged together into the final sandbox configuration.

235 

200This [repository](https://github.com/anthropics/claude-code/tree/main/examples/settings) includes starter settings configurations for common deployment scenarios, including sandbox-specific examples. Use these as starting points and adjust them to fit your needs.236This [repository](https://github.com/anthropics/claude-code/tree/main/examples/settings) includes starter settings configurations for common deployment scenarios, including sandbox-specific examples. Use these as starting points and adjust them to fit your needs.

201 237 

202## Advanced usage238## Advanced usage

settings.md +28 −15

Details

212| `Read(./.env)` | Matches reading the `.env` file |212| `Read(./.env)` | Matches reading the `.env` file |

213| `WebFetch(domain:example.com)` | Matches fetch requests to example.com |213| `WebFetch(domain:example.com)` | Matches fetch requests to example.com |

214 214 

215For the complete rule syntax reference, including wildcard behavior, tool-specific patterns for Read, Edit, WebFetch, MCP, and Task rules, and security limitations of Bash patterns, see [Permission rule syntax](/en/permissions#permission-rule-syntax).215For the complete rule syntax reference, including wildcard behavior, tool-specific patterns for Read, Edit, WebFetch, MCP, and Agent rules, and security limitations of Bash patterns, see [Permission rule syntax](/en/permissions#permission-rule-syntax).

216 216 

217### Sandbox settings217### Sandbox settings

218 218 

219Configure advanced sandboxing behavior. Sandboxing isolates bash commands from your filesystem and network. See [Sandboxing](/en/sandboxing) for details.219Configure advanced sandboxing behavior. Sandboxing isolates bash commands from your filesystem and network. See [Sandboxing](/en/sandboxing) for details.

220 220 

221**Filesystem and network restrictions** are configured via Read, Edit, and WebFetch permission rules, not via these sandbox settings.

222 

223| Keys | Description | Example |221| Keys | Description | Example |

224| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------ |222| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------ |

225| `enabled` | Enable bash sandboxing (macOS, Linux, and WSL2). Default: false | `true` |223| `enabled` | Enable bash sandboxing (macOS, Linux, and WSL2). Default: false | `true` |

226| `autoAllowBashIfSandboxed` | Auto-approve bash commands when sandboxed. Default: true | `true` |224| `autoAllowBashIfSandboxed` | Auto-approve bash commands when sandboxed. Default: true | `true` |

227| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |225| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |

228| `allowUnsandboxedCommands` | Allow commands to run outside the sandbox via the `dangerouslyDisableSandbox` parameter. When set to `false`, the `dangerouslyDisableSandbox` escape hatch is completely disabled and all commands must run sandboxed (or be in `excludedCommands`). Useful for enterprise policies that require strict sandboxing. Default: true | `false` |226| `allowUnsandboxedCommands` | Allow commands to run outside the sandbox via the `dangerouslyDisableSandbox` parameter. When set to `false`, the `dangerouslyDisableSandbox` escape hatch is completely disabled and all commands must run sandboxed (or be in `excludedCommands`). Useful for enterprise policies that require strict sandboxing. Default: true | `false` |

227| `filesystem.allowWrite` | Additional paths where sandboxed commands can write. Arrays are merged across all settings scopes: user, project, and managed paths are combined, not replaced. Also merged with paths from `Edit(...)` allow permission rules. See [path prefixes](#sandbox-path-prefixes) below. | `["//tmp/build", "~/.kube"]` |

228| `filesystem.denyWrite` | Paths where sandboxed commands cannot write. Arrays are merged across all settings scopes. Also merged with paths from `Edit(...)` deny permission rules. | `["//etc", "//usr/local/bin"]` |

229| `filesystem.denyRead` | Paths where sandboxed commands cannot read. Arrays are merged across all settings scopes. Also merged with paths from `Read(...)` deny permission rules. | `["~/.aws/credentials"]` |

229| `network.allowUnixSockets` | Unix socket paths accessible in sandbox (for SSH agents, etc.) | `["~/.ssh/agent-socket"]` |230| `network.allowUnixSockets` | Unix socket paths accessible in sandbox (for SSH agents, etc.) | `["~/.ssh/agent-socket"]` |

230| `network.allowAllUnixSockets` | Allow all Unix socket connections in sandbox. Default: false | `true` |231| `network.allowAllUnixSockets` | Allow all Unix socket connections in sandbox. Default: false | `true` |

231| `network.allowLocalBinding` | Allow binding to localhost ports (macOS only). Default: false | `true` |232| `network.allowLocalBinding` | Allow binding to localhost ports (macOS only). Default: false | `true` |


235| `network.socksProxyPort` | SOCKS5 proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8081` |236| `network.socksProxyPort` | SOCKS5 proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8081` |

236| `enableWeakerNestedSandbox` | Enable weaker sandbox for unprivileged Docker environments (Linux and WSL2 only). **Reduces security.** Default: false | `true` |237| `enableWeakerNestedSandbox` | Enable weaker sandbox for unprivileged Docker environments (Linux and WSL2 only). **Reduces security.** Default: false | `true` |

237 238 

239#### Sandbox path prefixes

240 

241Paths in `filesystem.allowWrite`, `filesystem.denyWrite`, and `filesystem.denyRead` support these prefixes:

242 

243| Prefix | Meaning | Example |

244| :---------------- | :------------------------------------------ | :------------------------------------- |

245| `//` | Absolute path from filesystem root | `//tmp/build` becomes `/tmp/build` |

246| `~/` | Relative to home directory | `~/.kube` becomes `$HOME/.kube` |

247| `/` | Relative to the settings file's directory | `/build` becomes `$SETTINGS_DIR/build` |

248| `./` or no prefix | Relative path (resolved by sandbox runtime) | `./output` |

249 

238**Configuration example:**250**Configuration example:**

239 251 

240```json theme={null}252```json theme={null}


243 "enabled": true,255 "enabled": true,

244 "autoAllowBashIfSandboxed": true,256 "autoAllowBashIfSandboxed": true,

245 "excludedCommands": ["docker"],257 "excludedCommands": ["docker"],

258 "filesystem": {

259 "allowWrite": ["//tmp/build", "~/.kube"],

260 "denyRead": ["~/.aws/credentials"]

261 },

246 "network": {262 "network": {

247 "allowedDomains": ["github.com", "*.npmjs.org", "registry.yarnpkg.com"],263 "allowedDomains": ["github.com", "*.npmjs.org", "registry.yarnpkg.com"],

248 "allowUnixSockets": [264 "allowUnixSockets": [


250 ],266 ],

251 "allowLocalBinding": true267 "allowLocalBinding": true

252 }268 }

253 },

254 "permissions": {

255 "deny": [

256 "Read(.envrc)",

257 "Read(~/.aws/**)"

258 ]

259 }269 }

260}270}

261```271```

262 272 

263**Filesystem and network restrictions** use standard permission rules:273**Filesystem and network restrictions** can be configured in two ways that are merged together:

264 274 

265* Use `Read` deny rules to block Claude from reading specific files or directories275* **`sandbox.filesystem` settings** (shown above): Control paths at the OS-level sandbox boundary. These restrictions apply to all subprocess commands (e.g., `kubectl`, `terraform`, `npm`), not just Claude's file tools.

266* Use `Edit` allow rules to let Claude write to directories beyond the current working directory276* **Permission rules**: Use `Edit` allow/deny rules to control Claude's file tool access, `Read` deny rules to block reads, and `WebFetch` allow/deny rules to control network domains. Paths from these rules are also merged into the sandbox configuration.

267* Use `Edit` deny rules to block writes to specific paths

268* Use `WebFetch` allow/deny rules to control which network domains Claude can access

269 277 

270### Attribution settings278### Attribution settings

271 279 


397 405 

398For example, if your user settings allow `Bash(npm run *)` but a project's shared settings deny it, the project setting takes precedence and the command is blocked.406For example, if your user settings allow `Bash(npm run *)` but a project's shared settings deny it, the project setting takes precedence and the command is blocked.

399 407 

408<Note>

409 **Array settings merge across scopes.** When the same array-valued setting (such as `sandbox.filesystem.allowWrite` or `permissions.allow`) appears in multiple scopes, the arrays are **concatenated and deduplicated**, not replaced. This means lower-priority scopes can add entries without overriding those set by higher-priority scopes, and vice versa. For example, if managed settings set `allowWrite` to `["//opt/company-tools"]` and a user adds `["~/.kube"]`, both paths are included in the final configuration.

410</Note>

411 

400### Verify active settings412### Verify active settings

401 413 

402Run `/status` inside Claude Code to see which settings sources are active and where they come from. The output shows each configuration layer (managed, user, project) along with its origin, such as `Enterprise managed settings (remote)`, `Enterprise managed settings (plist)`, `Enterprise managed settings (HKLM)`, or `Enterprise managed settings (file)`. If a settings file contains errors, `/status` reports the issue so you can fix it.414Run `/status` inside Claude Code to see which settings sources are active and where they come from. The output shows each configuration layer (managed, user, project) along with its origin, such as `Enterprise managed settings (remote)`, `Enterprise managed settings (plist)`, `Enterprise managed settings (HKLM)`, or `Enterprise managed settings (file)`. If a settings file contains errors, `/status` reports the issue so you can fix it.


843| `DISABLE_PROMPT_CACHING_OPUS` | Set to `1` to disable prompt caching for Opus models | |855| `DISABLE_PROMPT_CACHING_OPUS` | Set to `1` to disable prompt caching for Opus models | |

844| `DISABLE_PROMPT_CACHING_SONNET` | Set to `1` to disable prompt caching for Sonnet models | |856| `DISABLE_PROMPT_CACHING_SONNET` | Set to `1` to disable prompt caching for Sonnet models | |

845| `DISABLE_TELEMETRY` | Set to `1` to opt out of Statsig telemetry (note that Statsig events do not include user data like code, file paths, or bash commands) | |857| `DISABLE_TELEMETRY` | Set to `1` to opt out of Statsig telemetry (note that Statsig events do not include user data like code, file paths, or bash commands) | |

858| `ENABLE_CLAUDEAI_MCP_SERVERS` | Set to `false` to disable [claude.ai MCP servers](/en/mcp#use-mcp-servers-from-claudeai) in Claude Code. Enabled by default for logged-in users | |

846| `ENABLE_TOOL_SEARCH` | Controls [MCP tool search](/en/mcp#scale-with-mcp-tool-search). Values: `auto` (default, enables at 10% context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `true` (always on), `false` (disabled) | |859| `ENABLE_TOOL_SEARCH` | Controls [MCP tool search](/en/mcp#scale-with-mcp-tool-search). Values: `auto` (default, enables at 10% context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `true` (always on), `false` (disabled) | |

847| `FORCE_AUTOUPDATE_PLUGINS` | Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` | |860| `FORCE_AUTOUPDATE_PLUGINS` | Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` | |

848| `HTTP_PROXY` | Specify HTTP proxy server for network connections | |861| `HTTP_PROXY` | Specify HTTP proxy server for network connections | |


881| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |894| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |

882| **Read** | Reads the contents of files | No |895| **Read** | Reads the contents of files | No |

883| **Skill** | Executes a [skill](/en/skills#control-who-invokes-a-skill) within the main conversation | Yes |896| **Skill** | Executes a [skill](/en/skills#control-who-invokes-a-skill) within the main conversation | Yes |

884| **Task** | Runs a sub-agent to handle complex, multi-step tasks | No |897| **Agent** | Runs a sub-agent to handle complex, multi-step tasks | No |

885| **TaskCreate** | Creates a new task in the task list | No |898| **TaskCreate** | Creates a new task in the task list | No |

886| **TaskGet** | Retrieves full details for a specific task | No |899| **TaskGet** | Retrieves full details for a specific task | No |

887| **TaskList** | Lists all tasks with their current status | No |900| **TaskList** | Lists all tasks with their current status | No |

skills.md +9 −1

Details

16 16 

17Claude Code skills follow the [Agent Skills](https://agentskills.io) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like [invocation control](#control-who-invokes-a-skill), [subagent execution](#run-skills-in-a-subagent), and [dynamic context injection](#inject-dynamic-context).17Claude Code skills follow the [Agent Skills](https://agentskills.io) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like [invocation control](#control-who-invokes-a-skill), [subagent execution](#run-skills-in-a-subagent), and [dynamic context injection](#inject-dynamic-context).

18 18 

19## Bundled skills

20 

21Claude Code ships with two built-in skills available in every session:

22 

23* **`/simplify`**: reviews your recently changed files for code reuse, quality, and efficiency issues, then fixes them. Run it after implementing a feature or bug fix to clean up your work. It spawns three review agents in parallel (code reuse, code quality, efficiency), aggregates their findings, and applies fixes. Pass optional text to focus on specific concerns: `/simplify focus on memory efficiency`.

24 

25* **`/batch <instruction>`**: orchestrates large-scale changes across a codebase in parallel. Provide a description of the change and `/batch` researches the codebase, decomposes the work into 5 to 30 independent units, and presents a plan for your approval. Once approved, it spawns one background agent per unit, each in an isolated [git worktree](/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees). Each agent implements its unit, runs tests, and opens a pull request. Requires a git repository. Example: `/batch migrate src/ from Solid to React`.

26 

19## Getting started27## Getting started

20 28 

21### Create your first skill29### Create your first skill


112Skills defined in `.claude/skills/` within directories added via `--add-dir` are loaded automatically and picked up by live change detection, so you can edit them during a session without restarting.120Skills defined in `.claude/skills/` within directories added via `--add-dir` are loaded automatically and picked up by live change detection, so you can edit them during a session without restarting.

113 121 

114<Note>122<Note>

115 CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load memory from additional directories](/en/memory#load-memory-from-additional-directories).123 CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](/en/memory#load-from-additional-directories).

116</Note>124</Note>

117 125 

118## Configure skills126## Configure skills

sub-agents.md +10 −8

Details

251 251 

252#### Restrict which subagents can be spawned252#### Restrict which subagents can be spawned

253 253 

254When an agent runs as the main thread with `claude --agent`, it can spawn subagents using the Task tool. To restrict which subagent types it can spawn, use `Task(agent_type)` syntax in the `tools` field:254When an agent runs as the main thread with `claude --agent`, it can spawn subagents using the Agent tool. To restrict which subagent types it can spawn, use `Agent(agent_type)` syntax in the `tools` field.

255 

256<Note>In version 2.1.63, the Task tool was renamed to Agent. Existing `Task(...)` references in settings and agent definitions still work as aliases.</Note>

255 257 

256```yaml theme={null}258```yaml theme={null}

257---259---

258name: coordinator260name: coordinator

259description: Coordinates work across specialized agents261description: Coordinates work across specialized agents

260tools: Task(worker, researcher), Read, Bash262tools: Agent(worker, researcher), Read, Bash

261---263---

262```264```

263 265 

264This is an allowlist: only the `worker` and `researcher` subagents can be spawned. If the agent tries to spawn any other type, the request fails and the agent sees only the allowed types in its prompt. To block specific agents while allowing all others, use [`permissions.deny`](#disable-specific-subagents) instead.266This is an allowlist: only the `worker` and `researcher` subagents can be spawned. If the agent tries to spawn any other type, the request fails and the agent sees only the allowed types in its prompt. To block specific agents while allowing all others, use [`permissions.deny`](#disable-specific-subagents) instead.

265 267 

266To allow spawning any subagent without restrictions, use `Task` without parentheses:268To allow spawning any subagent without restrictions, use `Agent` without parentheses:

267 269 

268```yaml theme={null}270```yaml theme={null}

269tools: Task, Read, Bash271tools: Agent, Read, Bash

270```272```

271 273 

272If `Task` is omitted from the `tools` list entirely, the agent cannot spawn any subagents. This restriction only applies to agents running as the main thread with `claude --agent`. Subagents cannot spawn other subagents, so `Task(agent_type)` has no effect in subagent definitions.274If `Agent` is omitted from the `tools` list entirely, the agent cannot spawn any subagents. This restriction only applies to agents running as the main thread with `claude --agent`. Subagents cannot spawn other subagents, so `Agent(agent_type)` has no effect in subagent definitions.

273 275 

274#### Permission modes276#### Permission modes

275 277 


396 398 

397#### Disable specific subagents399#### Disable specific subagents

398 400 

399You can prevent Claude from using specific subagents by adding them to the `deny` array in your [settings](/en/settings#permission-settings). Use the format `Task(subagent-name)` where `subagent-name` matches the subagent's name field.401You can prevent Claude from using specific subagents by adding them to the `deny` array in your [settings](/en/settings#permission-settings). Use the format `Agent(subagent-name)` where `subagent-name` matches the subagent's name field.

400 402 

401```json theme={null}403```json theme={null}

402{404{

403 "permissions": {405 "permissions": {

404 "deny": ["Task(Explore)", "Task(my-custom-agent)"]406 "deny": ["Agent(Explore)", "Agent(my-custom-agent)"]

405 }407 }

406}408}

407```409```


409This works for both built-in and custom subagents. You can also use the `--disallowedTools` CLI flag:411This works for both built-in and custom subagents. You can also use the `--disallowedTools` CLI flag:

410 412 

411```bash theme={null}413```bash theme={null}

412claude --disallowedTools "Task(Explore)"414claude --disallowedTools "Agent(Explore)"

413```415```

414 416 

415See [Permissions documentation](/en/permissions#tool-specific-permission-rules) for more details on permission rules.417See [Permissions documentation](/en/permissions#tool-specific-permission-rules) for more details on permission rules.

vs-code.md +1 −1

Details

106 106 

107### Resume past conversations107### Resume past conversations

108 108 

109Click the dropdown at the top of the Claude Code panel to access your conversation history. You can search by keyword or browse by time (Today, Yesterday, Last 7 days, etc.). Click any conversation to resume it with the full message history. For more on resuming sessions, see [Common workflows](/en/common-workflows#resume-previous-conversations).109Click the dropdown at the top of the Claude Code panel to access your conversation history. You can search by keyword or browse by time (Today, Yesterday, Last 7 days, etc.). Click any conversation to resume it with the full message history. Hover over a session to reveal rename and remove actions: rename to give it a descriptive title, or remove to delete it from the list. For more on resuming sessions, see [Common workflows](/en/common-workflows#resume-previous-conversations).

110 110 

111### Resume remote sessions from Claude.ai111### Resume remote sessions from Claude.ai

112 112