SpyBara
Go Premium

Documentation 2026-07-27 21:02 UTC to 2026-07-28 23:57 UTC

4 files changed +60 −60. View all changes and history on the product overview
2026
Wed 29 07:01 Tue 28 23:57 Mon 27 21:02 Sun 26 19:02 Sat 25 21:59 Fri 24 23:01 Thu 23 23:57 Wed 22 23:59 Tue 21 23:00 Mon 20 23:01 Sat 18 16:02 Fri 17 22:57 Thu 16 22:59 Wed 15 22:00 Tue 14 23:01 Mon 13 23:57 Sat 11 19:03 Fri 10 17:00 Thu 9 23:58 Wed 8 16:02 Tue 7 16:02 Mon 6 23:57 Sat 4 03:01 Fri 3 23:00 Thu 2 23:59 Wed 1 21:01
Details

20 background: 'var(--ce-surface)',20 background: 'var(--ce-surface)',

21 border: '0.5px solid var(--ce-border-subtle)'21 border: '0.5px solid var(--ce-border-subtle)'

22 }}>{children}</code>, []);22 }}>{children}</code>, []);

23 const commandsNote = useMemo(() => <>Commands and skills are now the same mechanism. For new workflows, use <A href="/en/skills">skills/</A> instead: same <C>/name</C> invocation, plus you can bundle supporting files.</>, []);23 const commandsNote = useMemo(() => <>Commands and skills are now the same mechanism. For new workflows, use <A href="/docs/en/skills">skills/</A> instead: same <C>/name</C> invocation, plus you can bundle supporting files.</>, []);

24 const FILE_TREE = useMemo(() => ({24 const FILE_TREE = useMemo(() => ({

25 project: {25 project: {

26 label: 'your-project/',26 label: 'your-project/',


34 oneLiner: 'Project instructions Claude reads every session',34 oneLiner: 'Project instructions Claude reads every session',

35 when: 'Loaded into context at the start of every session',35 when: 'Loaded into context at the start of every session',

36 description: 'Project-specific instructions that shape how Claude works in this repository. Put your conventions, common commands, and architectural context here so Claude operates with the same assumptions your team does.',36 description: 'Project-specific instructions that shape how Claude works in this repository. Put your conventions, common commands, and architectural context here so Claude operates with the same assumptions your team does.',

37 tips: ['Target under 200 lines. Longer files still load in full but may reduce adherence', <>CLAUDE.md loads into every session. If something only matters for specific tasks, move it to a <A href="/en/skills">skill</A> or a path-scoped <A href="/en/memory#organize-rules-with-claude/rules/">rule</A> so it loads only when needed</>, 'List the commands you run most, like build, test, and format, so Claude knows them without you spelling them out each time', <>Run <C>/memory</C> to open and edit CLAUDE.md from within a session</>, <>Also works at <C>.claude/CLAUDE.md</C> if you prefer to keep the project root clean</>],37 tips: ['Target under 200 lines. Longer files still load in full but may reduce adherence', <>CLAUDE.md loads into every session. If something only matters for specific tasks, move it to a <A href="/docs/en/skills">skill</A> or a path-scoped <A href="/docs/en/memory#organize-rules-with-claude/rules/">rule</A> so it loads only when needed</>, 'List the commands you run most, like build, test, and format, so Claude knows them without you spelling them out each time', <>Run <C>/memory</C> to open and edit CLAUDE.md from within a session</>, <>Also works at <C>.claude/CLAUDE.md</C> if you prefer to keep the project root clean</>],

38 exampleIntro: 'This example is for a TypeScript and React project. It lists the build and test commands, the framework conventions Claude should follow, and project-specific rules like export style and file layout.',38 exampleIntro: 'This example is for a TypeScript and React project. It lists the build and test commands, the framework conventions Claude should follow, and project-specific rules like export style and file layout.',

39 example: `# Project conventions39 example: `# Project conventions

40 40 


60 color: '#9B7BC4',60 color: '#9B7BC4',

61 badge: 'committed',61 badge: 'committed',

62 oneLiner: 'Project-scoped MCP servers, shared with your team',62 oneLiner: 'Project-scoped MCP servers, shared with your team',

63 when: <>Servers connect when the session begins. Tool schemas are deferred by default and load on demand via <A href="/en/mcp#scale-with-mcp-tool-search">tool search</A></>,63 when: <>Servers connect when the session begins. Tool schemas are deferred by default and load on demand via <A href="/docs/en/mcp#scale-with-mcp-tool-search">tool search</A></>,

64 description: <>Configures Model Context Protocol (MCP) servers that give Claude access to external tools: databases, APIs, browsers, and more. This file holds the project-scoped servers your whole team uses. Personal servers you want to keep to yourself go in <C>~/.claude.json</C> instead.</>,64 description: <>Configures Model Context Protocol (MCP) servers that give Claude access to external tools: databases, APIs, browsers, and more. This file holds the project-scoped servers your whole team uses. Personal servers you want to keep to yourself go in <C>~/.claude.json</C> instead.</>,

65 tips: [<>Use environment variable references for secrets: <C>{'${NOTION_TOKEN}'}</C></>, <>Lives at the project root, not inside <C>.claude/</C></>, <>For servers only you need, run <C>claude mcp add --scope user</C>. This writes to <C>~/.claude.json</C> instead of <C>.mcp.json</C></>],65 tips: [<>Use environment variable references for secrets: <C>{'${NOTION_TOKEN}'}</C></>, <>Lives at the project root, not inside <C>.claude/</C></>, <>For servers only you need, run <C>claude mcp add --scope user</C>. This writes to <C>~/.claude.json</C> instead of <C>.mcp.json</C></>],

66 exampleIntro: <>This example configures the Notion MCP server so Claude can read and update pages in your workspace. The <C>{'${NOTION_TOKEN}'}</C> reference is read from your shell environment when Claude Code starts the server, so the token never lands in the file.</>,66 exampleIntro: <>This example configures the Notion MCP server so Claude can read and update pages in your workspace. The <C>{'${NOTION_TOKEN}'}</C> reference is read from your shell environment when Claude Code starts the server, so the token never lands in the file.</>,


86 oneLiner: 'Gitignored files to copy into new worktrees',86 oneLiner: 'Gitignored files to copy into new worktrees',

87 when: <>Read when Claude creates a git worktree via <C>--worktree</C>, the <C>EnterWorktree</C> tool, or subagent <C>isolation: worktree</C></>,87 when: <>Read when Claude creates a git worktree via <C>--worktree</C>, the <C>EnterWorktree</C> tool, or subagent <C>isolation: worktree</C></>,

88 description: <>Lists gitignored files to copy from your main repository into each new worktree. Worktrees are fresh checkouts, so untracked files like <C>.env</C> are missing by default. Patterns here use <C>.gitignore</C> syntax. Only files that match a pattern and are also gitignored get copied, so tracked files are never duplicated.</>,88 description: <>Lists gitignored files to copy from your main repository into each new worktree. Worktrees are fresh checkouts, so untracked files like <C>.env</C> are missing by default. Patterns here use <C>.gitignore</C> syntax. Only files that match a pattern and are also gitignored get copied, so tracked files are never duplicated.</>,

89 tips: [<>Lives at the project root, not inside <C>.claude/</C></>, <>Git-only: if you configure a <A href="/en/hooks#worktreecreate">WorktreeCreate hook</A> for a different VCS, this file is not read. Copy files inside your hook script instead</>, <>Also applies to parallel sessions in the <A href="/en/desktop#work-in-parallel-with-sessions">desktop app</A></>],89 tips: [<>Lives at the project root, not inside <C>.claude/</C></>, <>Git-only: if you configure a <A href="/docs/en/hooks#worktreecreate">WorktreeCreate hook</A> for a different VCS, this file is not read. Copy files inside your hook script instead</>, <>Also applies to parallel sessions in the <A href="/docs/en/desktop#work-in-parallel-with-sessions">desktop app</A></>],

90 exampleIntro: 'This example copies your local environment files and a secrets config into every worktree Claude creates. Comments start with # and blank lines are ignored, same as .gitignore.',90 exampleIntro: 'This example copies your local environment files and a secrets config into every worktree Claude creates. Comments start with # and blank lines are ignored, same as .gitignore.',

91 example: `# Local environment91 example: `# Local environment

92.env92.env


102 icon: 'folder',102 icon: 'folder',

103 color: 'var(--ce-accent)',103 color: 'var(--ce-accent)',

104 oneLiner: 'Project-level configuration, rules, and extensions',104 oneLiner: 'Project-level configuration, rules, and extensions',

105 description: 'Everything Claude Code reads that is specific to this project. If you use git, commit most files here so your team shares them; a few, like settings.local.json, are automatically gitignored. Each file badge shows which.',105 description: 'Everything Claude Code reads that is specific to this project. If you use git, commit most files here so your team shares them; a few, like settings.local.json, are gitignored when Claude Code saves settings to them. Each file badge shows which.',

106 children: [{106 children: [{

107 id: 'settings-json',107 id: 'settings-json',

108 label: 'settings.json',108 label: 'settings.json',


113 oneLiner: 'Permissions, hooks, and configuration',113 oneLiner: 'Permissions, hooks, and configuration',

114 when: <>Overrides global <C>~/.claude/settings.json</C>. Local settings, CLI flags, and managed settings override this</>,114 when: <>Overrides global <C>~/.claude/settings.json</C>. Local settings, CLI flags, and managed settings override this</>,

115 description: 'Settings that Claude Code applies directly. Permissions control which commands and tools Claude can use; hooks run your scripts at specific points in a session. Unlike CLAUDE.md, which Claude reads as guidance, these are enforced whether Claude follows them or not.',115 description: 'Settings that Claude Code applies directly. Permissions control which commands and tools Claude can use; hooks run your scripts at specific points in a session. Unlike CLAUDE.md, which Claude reads as guidance, these are enforced whether Claude follows them or not.',

116 contains: [<><A href="/en/permissions">permissions</A>: allow, deny, or prompt before Claude uses specific tools or commands</>, <><A href="/en/hooks">hooks</A>: run your own scripts on events like before a tool call or after a file edit</>, <><A href="/en/statusline">statusLine</A>: customize the line shown at the bottom while Claude works</>, <><A href="/en/settings#available-settings">model</A>: pick a default model for this project</>, <><A href="/en/settings#environment-variables">env</A>: environment variables set in every session</>, <><A href="/en/output-styles">outputStyle</A>: select a custom system-prompt style from output-styles/</>],116 contains: [<><A href="/docs/en/permissions">permissions</A>: allow, deny, or prompt before Claude uses specific tools or commands</>, <><A href="/docs/en/hooks">hooks</A>: run your own scripts on events like before a tool call or after a file edit</>, <><A href="/docs/en/statusline">statusLine</A>: customize the line shown at the bottom while Claude works</>, <><A href="/docs/en/settings#available-settings">model</A>: pick a default model for this project</>, <><A href="/docs/en/settings#environment-variables">env</A>: environment variables set in every session</>, <><A href="/docs/en/output-styles">outputStyle</A>: select a custom system-prompt style from output-styles/</>],

117 tips: [<>Bash permission patterns support wildcards: <C>Bash(npm test *)</C> matches any command starting with <C>npm test</C></>, <>Array settings like <C>permissions.allow</C> combine across all scopes; scalar settings like <C>model</C> use the most specific value</>],117 tips: [<>Bash permission patterns support wildcards: <C>Bash(npm test *)</C> matches any command starting with <C>npm test</C></>, <>Array settings like <C>permissions.allow</C> combine across all scopes; scalar settings like <C>model</C> use the most specific value</>],

118 exampleIntro: <>This example allows <C>npm test</C> and <C>npm run</C> commands without prompting, blocks <C>rm -rf</C>, and runs Prettier on files after Claude edits or writes them.</>,118 exampleIntro: <>This example allows <C>npm test</C> and <C>npm run</C> commands without prompting, blocks <C>rm -rf</C>, and runs Prettier on files after Claude edits or writes them.</>,

119 example: `{119 example: `{


146 badge: 'gitignored',146 badge: 'gitignored',

147 oneLiner: 'Your personal settings overrides for this project',147 oneLiner: 'Your personal settings overrides for this project',

148 when: 'Highest of the user-editable settings files; CLI flags and managed settings still take precedence',148 when: 'Highest of the user-editable settings files; CLI flags and managed settings still take precedence',

149 description: 'Personal settings that take precedence over the project defaults. Same JSON format as settings.json, but not committed. Use this when you need different permissions or defaults than the team config.',149 description: 'Personal settings that take precedence over the project defaults. Same JSON format as settings.json, gitignored when Claude Code saves a setting to it. Use this when you need different permissions or defaults than the team config.',

150 tips: [<>Same schema as settings.json. Array settings like <C>permissions.allow</C> combine across scopes; scalar settings like <C>model</C> use the local value</>, <>Claude Code adds this file to <C>~/.config/git/ignore</C> the first time it writes one. If you use a custom <C>core.excludesFile</C>, add the pattern there too. To share the ignore rule with your team, also add it to the project <C>.gitignore</C></>],150 tips: [<>Same schema as settings.json. Array settings like <C>permissions.allow</C> combine across scopes; scalar settings like <C>model</C> use the local value</>, <>When Claude Code saves a setting to this file in a repository that doesn't already ignore it, it adds <C>**/.claude/settings.local.json</C> to your global git excludes file: <C>core.excludesFile</C> from your global git config when it's set to an absolute or <C>~</C>-prefixed path, otherwise <C>$XDG_CONFIG_HOME/git/ignore</C>, or <C>~/.config/git/ignore</C>. To share the ignore rule with your team, also add it to the project <C>.gitignore</C></>],

151 exampleIntro: 'This example adds Docker permissions on top of whatever the team settings.json allows.',151 exampleIntro: 'This example adds Docker permissions on top of whatever the team settings.json allows.',

152 example: `{152 example: `{

153 "permissions": {153 "permissions": {


165 color: '#9B7BC4',165 color: '#9B7BC4',

166 oneLiner: 'Topic-scoped instructions, optionally gated by file paths',166 oneLiner: 'Topic-scoped instructions, optionally gated by file paths',

167 when: <>Rules without <C>paths:</C> load at session start. Rules with <C>paths:</C> load when a matching file enters context</>,167 when: <>Rules without <C>paths:</C> load at session start. Rules with <C>paths:</C> load when a matching file enters context</>,

168 description: [<>Project instructions split into topic files that can load conditionally based on file paths. A rule without <C>paths:</C> frontmatter loads at session start like CLAUDE.md; a rule with <C>paths:</C> loads only when Claude reads a matching file.</>, <>Like CLAUDE.md, rules are guidance Claude reads, not configuration Claude Code enforces. For guaranteed behavior use <A href="/en/hooks">hooks</A> or <A href="/en/permissions">permissions</A>.</>],168 description: [<>Project instructions split into topic files that can load conditionally based on file paths. A rule without <C>paths:</C> frontmatter loads at session start like CLAUDE.md; a rule with <C>paths:</C> loads only when Claude reads a matching file.</>, <>Like CLAUDE.md, rules are guidance Claude reads, not configuration Claude Code enforces. For guaranteed behavior use <A href="/docs/en/hooks">hooks</A> or <A href="/docs/en/permissions">permissions</A>.</>],

169 tips: [<>Use <C>paths:</C> frontmatter with globs to scope rules to directories or file types</>, <>Subdirectories work: <C>.claude/rules/frontend/react.md</C> is discovered automatically</>, 'When CLAUDE.md approaches 200 lines, start splitting into rules'],169 tips: [<>Use <C>paths:</C> frontmatter with globs to scope rules to directories or file types</>, <>Subdirectories work: <C>.claude/rules/frontend/react.md</C> is discovered automatically</>, 'When CLAUDE.md approaches 200 lines, start splitting into rules'],

170 docsLink: '/en/memory#organize-rules-with-claude/rules/',170 docsLink: '/en/memory#organize-rules-with-claude/rules/',

171 children: [{171 children: [{


369 color: '#C46686',369 color: '#C46686',

370 oneLiner: 'Dynamic workflow scripts that orchestrate many subagents',370 oneLiner: 'Dynamic workflow scripts that orchestrate many subagents',

371 when: 'Loaded at startup; each file becomes a /<name> command',371 when: 'Loaded at startup; each file becomes a /<name> command',

372 description: <>Each <C>.js</C> file is a <A href="/en/workflows">dynamic workflow</A>: a script the runtime executes to spawn and coordinate many subagents. Workflows are written by Claude and saved here from <C>/workflows</C> rather than authored from scratch.</>,372 description: <>Each <C>.js</C> file is a <A href="/docs/en/workflows">dynamic workflow</A>: a script the runtime executes to spawn and coordinate many subagents. Workflows are written by Claude and saved here from <C>/workflows</C> rather than authored from scratch.</>,

373 tips: [<>Save a run from <C>/workflows</C> with <C>s</C> to create one of these</>, <>A project workflow takes precedence over a personal one in <C>~/.claude/workflows/</C> with the same name</>],373 tips: [<>Save a run from <C>/workflows</C> with <C>s</C> to create one of these</>, <>A project workflow takes precedence over a personal one in <C>~/.claude/workflows/</C> with the same name</>],

374 docsLink: '/en/workflows'374 docsLink: '/en/workflows'

375 }, {375 }, {


382 autogen: true,382 autogen: true,

383 oneLiner: 'Subagent persistent memory, separate from your main session auto memory',383 oneLiner: 'Subagent persistent memory, separate from your main session auto memory',

384 when: 'First 200 lines (capped at 25KB) of MEMORY.md loaded into the subagent system prompt when it runs',384 when: 'First 200 lines (capped at 25KB) of MEMORY.md loaded into the subagent system prompt when it runs',

385 description: <>Subagents with <C>memory: project</C> in their frontmatter get a dedicated memory directory here. This is distinct from your <A href="/en/memory#auto-memory">main session auto memory</A> at <C>~/.claude/projects/</C>: each subagent reads and writes its own MEMORY.md, not yours.</>,385 description: <>Subagents with <C>memory: project</C> in their frontmatter get a dedicated memory directory here. This is distinct from your <A href="/docs/en/memory#auto-memory">main session auto memory</A> at <C>~/.claude/projects/</C>: each subagent reads and writes its own MEMORY.md, not yours.</>,

386 tips: [<>Only created for subagents that set the <C>memory:</C> frontmatter field</>, <>This directory holds project-scoped subagent memory, meant to be shared with your team. To keep memory out of version control use <C>memory: local</C>, which writes to <C>.claude/agent-memory-local/</C> instead. For cross-project memory use <C>memory: user</C>, which writes to <C>~/.claude/agent-memory/</C></>, <>The main session auto memory is a different feature; see <C>~/.claude/projects/</C> in the Global tab</>],386 tips: [<>Only created for subagents that set the <C>memory:</C> frontmatter field</>, <>This directory holds project-scoped subagent memory, meant to be shared with your team. To keep memory out of version control use <C>memory: local</C>, which writes to <C>.claude/agent-memory-local/</C> instead. For cross-project memory use <C>memory: user</C>, which writes to <C>~/.claude/agent-memory/</C></>, <>The main session auto memory is a different feature; see <C>~/.claude/projects/</C> in the Global tab</>],

387 docsLink: '/en/sub-agents#enable-persistent-memory',387 docsLink: '/en/sub-agents#enable-persistent-memory',

388 children: [{388 children: [{


402 autogen: true,402 autogen: true,

403 oneLiner: 'The subagent writes and maintains this file automatically',403 oneLiner: 'The subagent writes and maintains this file automatically',

404 when: 'Loaded into the subagent system prompt when the subagent starts',404 when: 'Loaded into the subagent system prompt when the subagent starts',

405 description: <>Works the same as your <A href="/en/memory#auto-memory">main auto memory</A>: the subagent creates and updates this file itself. You do not write it. The subagent reads it at the start of each task and writes back what it learns.</>,405 description: <>Works the same as your <A href="/docs/en/memory#auto-memory">main auto memory</A>: the subagent creates and updates this file itself. You do not write it. The subagent reads it at the start of each task and writes back what it learns.</>,

406 example: `# code-reviewer memory406 example: `# code-reviewer memory

407 407 

408## Patterns seen408## Patterns seen


1432 1432 

1433Claude Code 从您的项目目录和主目录中的 `~/.claude` 读取指令、设置、skills、subagents 和内存。将项目文件提交到 git 以与您的团队共享;`~/.claude` 中的文件是个人配置,适用于您的所有项目。1433Claude Code 从您的项目目录和主目录中的 `~/.claude` 读取指令、设置、skills、subagents 和内存。将项目文件提交到 git 以与您的团队共享;`~/.claude` 中的文件是个人配置,适用于您的所有项目。

1434 1434 

1435在 Windows 上,`~/.claude` 解析为 `%USERPROFILE%\.claude`。如果您设置了 [`CLAUDE_CONFIG_DIR`](/zh-CN/env-vars),此页面上的每个 `~/.claude` 路径都将位于该目录下。1435在 Windows 上,`~/.claude` 解析为 `%USERPROFILE%\.claude`。如果您设置了 [`CLAUDE_CONFIG_DIR`](/docs/zh-CN/env-vars),此页面上的每个 `~/.claude` 路径都将位于该目录下。

1436 1436 

1437大多数用户只编辑 `CLAUDE.md` 和 `settings.json`。目录的其余部分是可选的:根据需要添加 skills、rules 或 subagents。1437大多数用户只编辑 `CLAUDE.md` 和 `settings.json`。目录的其余部分是可选的:根据需要添加 skills、rules 或 subagents。

1438 1438 


1452 1452 

1453| 文件 | 位置 | 用途 |1453| 文件 | 位置 | 用途 |

1454| ----------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |1454| ----------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

1455| `managed-settings.json` | 系统级别,因操作系统而异 | 企业强制执行的设置,您无法覆盖。请参阅[服务器管理的设置](/zh-CN/server-managed-settings)。 |1455| `managed-settings.json` | 系统级别,因操作系统而异 | 企业强制执行的设置,您无法覆盖。请参阅[服务器管理的设置](/docs/zh-CN/server-managed-settings)。 |

1456| `CLAUDE.local.md` | 项目根目录 | 您对此项目的私人偏好,与 CLAUDE.md 一起加载。手动创建它并将其添加到 `.gitignore`。 |1456| `CLAUDE.local.md` | 项目根目录 | 您对此项目的私人偏好,与 CLAUDE.md 一起加载。手动创建它并将其添加到 `.gitignore`。 |

1457| 已安装的 plugins | `~/.claude/plugins` | 克隆的市场、已安装的 plugin 版本和每个 plugin 的数据,由 `claude plugin` 命令管理。孤立版本在 plugin 更新或卸载后 7 天被删除。请参阅 [plugin 缓存](/zh-CN/plugins-reference#plugin-caching-and-file-resolution)。 |1457| 已安装的 plugins | `~/.claude/plugins` | 克隆的市场、已安装的 plugin 版本和每个 plugin 的数据,由 `claude plugin` 命令管理。孤立版本在 plugin 更新或卸载后 7 天被删除。请参阅 [plugin 缓存](/docs/zh-CN/plugins-reference#plugin-caching-and-file-resolution)。 |

1458 1458 

1459`~/.claude` 还保存 Claude Code 在您工作时写入的数据:记录、提示历史、文件快照、缓存和日志。请参阅下面的[应用数据](#application-data)。1459`~/.claude` 还保存 Claude Code 在您工作时写入的数据:记录、提示历史、文件快照、缓存和日志。请参阅下面的[应用数据](#application-data)。

1460 1460 


1466 1466 

1467| 您想要 | 编辑 | 范围 | 参考 |1467| 您想要 | 编辑 | 范围 | 参考 |

1468| :-------------------- | :-------------------------------------- | :---- | :------------------------------------------------------ |1468| :-------------------- | :-------------------------------------- | :---- | :------------------------------------------------------ |

1469| 为 Claude 提供项目上下文和约定 | `CLAUDE.md` | 项目或全局 | [Memory](/zh-CN/memory) |1469| 为 Claude 提供项目上下文和约定 | `CLAUDE.md` | 项目或全局 | [Memory](/docs/zh-CN/memory) |

1470| 允许或阻止特定工具调用 | `settings.json` `permissions` 或 `hooks` | 项目或全局 | [Permissions](/zh-CN/permissions)、[Hooks](/zh-CN/hooks) |1470| 允许或阻止特定工具调用 | `settings.json` `permissions` 或 `hooks` | 项目或全局 | [Permissions](/docs/zh-CN/permissions)、[Hooks](/docs/zh-CN/hooks) |

1471| 在工具调用前后运行脚本 | `settings.json` `hooks` | 项目或全局 | [Hooks](/zh-CN/hooks) |1471| 在工具调用前后运行脚本 | `settings.json` `hooks` | 项目或全局 | [Hooks](/docs/zh-CN/hooks) |

1472| 为会话设置环境变量 | `settings.json` `env` | 项目或全局 | [Settings](/zh-CN/settings#available-settings) |1472| 为会话设置环境变量 | `settings.json` `env` | 项目或全局 | [Settings](/docs/zh-CN/settings#available-settings) |

1473| 将个人覆盖保留在 git 之外 | `settings.local.json` | 仅项目 | [Settings scopes](/zh-CN/settings#settings-files) |1473| 将个人覆盖保留在 git 之外 | `settings.local.json` | 仅项目 | [Settings scopes](/docs/zh-CN/settings#settings-files) |

1474| 添加使用 `/name` 调用的提示或功能 | `skills/<name>/SKILL.md` | 项目或全局 | [Skills](/zh-CN/skills) |1474| 添加使用 `/name` 调用的提示或功能 | `skills/<name>/SKILL.md` | 项目或全局 | [Skills](/docs/zh-CN/skills) |

1475| 定义具有自己工具的专门 subagent | `agents/*.md` | 项目或全局 | [Subagents](/zh-CN/sub-agents) |1475| 定义具有自己工具的专门 subagent | `agents/*.md` | 项目或全局 | [Subagents](/docs/zh-CN/sub-agents) |

1476| 通过脚本编排许多 subagent | `workflows/*.js` | 项目或全局 | [Dynamic workflows](/zh-CN/workflows) |1476| 通过脚本编排许多 subagent | `workflows/*.js` | 项目或全局 | [Dynamic workflows](/docs/zh-CN/workflows) |

1477| 通过 MCP 连接外部工具 | `.mcp.json` | 仅项目 | [MCP](/zh-CN/mcp) |1477| 通过 MCP 连接外部工具 | `.mcp.json` | 仅项目 | [MCP](/docs/zh-CN/mcp) |

1478| 更改 Claude 格式化响应的方式 | `output-styles/*.md` | 项目或全局 | [Output styles](/zh-CN/output-styles) |1478| 更改 Claude 格式化响应的方式 | `output-styles/*.md` | 项目或全局 | [Output styles](/docs/zh-CN/output-styles) |

1479 1479 

1480<h2 id="file-reference">1480<h2 id="file-reference">

1481 文件参考1481 文件参考


1486<Note>1486<Note>

1487 有几件事可以覆盖您在这些文件中放入的内容:1487 有几件事可以覆盖您在这些文件中放入的内容:

1488 1488 

1489 * 您的组织部署的[托管设置](/zh-CN/server-managed-settings)优先于所有内容1489 * 您的组织部署的[托管设置](/docs/zh-CN/server-managed-settings)优先于所有内容

1490 * CLI 标志(如 `--permission-mode` 或 `--settings`)在该会话中覆盖 `settings.json`1490 * CLI 标志(如 `--permission-mode` 或 `--settings`)在该会话中覆盖 `settings.json`

1491 * 某些环境变量优先于其等效设置,但这会有所不同:检查[环境变量参考](/zh-CN/env-vars)以了解每个变量1491 * 某些环境变量优先于其等效设置,但这会有所不同:检查[环境变量参考](/docs/zh-CN/env-vars)以了解每个变量

1492 1492 

1493 请参阅[设置优先级](/zh-CN/settings#settings-precedence)以了解完整顺序。1493 请参阅[设置优先级](/docs/zh-CN/settings#settings-precedence)以了解完整顺序。

1494</Note>1494</Note>

1495 1495 

1496单击文件名以在上面的浏览器中打开该节点。1496单击文件名以在上面的浏览器中打开该节点。

1497 1497 

1498| 文件 | 范围 | 提交 | 作用 | 参考 |1498| 文件 | 范围 | 提交 | 作用 | 参考 |

1499| --------------------------------------------------- | ----- | -- | ------------------------------------------------------------ | ------------------------------------------------------------------ |1499| --------------------------------------------------- | ----- | -- | ------------------------------------------------------------ | ------------------------------------------------------------------ |

1500| [`CLAUDE.md`](#ce-claude-md) | 项目和全局 | ✓ | 每个会话加载的指令 | [内存](/zh-CN/memory) |1500| [`CLAUDE.md`](#ce-claude-md) | 项目和全局 | ✓ | 每个会话加载的指令 | [内存](/docs/zh-CN/memory) |

1501| [`rules/*.md`](#ce-rules) | 项目和全局 | ✓ | 主题范围的指令,可选择路径门控 | [Rules](/zh-CN/memory#organize-rules-with-claude/rules/) |1501| [`rules/*.md`](#ce-rules) | 项目和全局 | ✓ | 主题范围的指令,可选择路径门控 | [Rules](/docs/zh-CN/memory#organize-rules-with-claude/rules/) |

1502| [`settings.json`](#ce-settings-json) | 项目和全局 | ✓ | 权限、hooks、环境变量、模型默认值 | [设置](/zh-CN/settings) |1502| [`settings.json`](#ce-settings-json) | 项目和全局 | ✓ | 权限、hooks、环境变量、模型默认值 | [设置](/docs/zh-CN/settings) |

1503| [`settings.local.json`](#ce-settings-local-json) | 仅项目 | | 您的个人覆盖,自动 gitignored | [设置范围](/zh-CN/settings#settings-files) |1503| [`settings.local.json`](#ce-settings-local-json) | 仅项目 | | 您的个人覆盖,自动 gitignored | [设置范围](/docs/zh-CN/settings#settings-files) |

1504| [`.mcp.json`](#ce-mcp-json) | 仅项目 | ✓ | 团队共享的 MCP 服务器 | [MCP 范围](/zh-CN/mcp#mcp-installation-scopes) |1504| [`.mcp.json`](#ce-mcp-json) | 仅项目 | ✓ | 团队共享的 MCP 服务器 | [MCP 范围](/docs/zh-CN/mcp#mcp-installation-scopes) |

1505| [`.worktreeinclude`](#ce-worktreeinclude) | 仅项目 | ✓ | Gitignored 文件以复制到新的 worktrees | [Worktrees](/zh-CN/worktrees#copy-gitignored-files-into-worktrees) |1505| [`.worktreeinclude`](#ce-worktreeinclude) | 仅项目 | ✓ | Gitignored 文件以复制到新的 worktrees | [Worktrees](/docs/zh-CN/worktrees#copy-gitignored-files-into-worktrees) |

1506| [`skills/<name>/SKILL.md`](#ce-skills) | 项目和全局 | ✓ | 可重用的提示,使用 `/name` 调用或自动调用 | [Skills](/zh-CN/skills) |1506| [`skills/<name>/SKILL.md`](#ce-skills) | 项目和全局 | ✓ | 可重用的提示,使用 `/name` 调用或自动调用 | [Skills](/docs/zh-CN/skills) |

1507| [`commands/*.md`](#ce-commands) | 项目和全局 | ✓ | 单文件提示;与 skills 相同的机制 | [Skills](/zh-CN/skills) |1507| [`commands/*.md`](#ce-commands) | 项目和全局 | ✓ | 单文件提示;与 skills 相同的机制 | [Skills](/docs/zh-CN/skills) |

1508| [`output-styles/*.md`](#ce-output-styles) | 项目和全局 | ✓ | 自定义系统提示部分 | [输出样式](/zh-CN/output-styles) |1508| [`output-styles/*.md`](#ce-output-styles) | 项目和全局 | ✓ | 自定义系统提示部分 | [输出样式](/docs/zh-CN/output-styles) |

1509| [`agents/*.md`](#ce-agents) | 项目和全局 | ✓ | Subagent 定义及其自己的提示和工具 | [Subagents](/zh-CN/sub-agents) |1509| [`agents/*.md`](#ce-agents) | 项目和全局 | ✓ | Subagent 定义及其自己的提示和工具 | [Subagents](/docs/zh-CN/sub-agents) |

1510| [`workflows/*.js`](#ce-workflows) | 项目和全局 | ✓ | 由 Claude 编写并从 `/workflows` 保存的动态工作流脚本;每个文件都成为一个 `/<name>` 命令 | [动态工作流](/zh-CN/workflows) |1510| [`workflows/*.js`](#ce-workflows) | 项目和全局 | ✓ | 由 Claude 编写并从 `/workflows` 保存的动态工作流脚本;每个文件都成为一个 `/<name>` 命令 | [动态工作流](/docs/zh-CN/workflows) |

1511| [`agent-memory/<name>/`](#ce-agent-memory) | 项目和全局 | ✓ | Subagents 的持久内存 | [持久内存](/zh-CN/sub-agents#enable-persistent-memory) |1511| [`agent-memory/<name>/`](#ce-agent-memory) | 项目和全局 | ✓ | Subagents 的持久内存 | [持久内存](/docs/zh-CN/sub-agents#enable-persistent-memory) |

1512| [`~/.claude.json`](#ce-claude-json) | 仅全局 | | 应用状态、OAuth、UI 切换、个人 MCP 服务器 | [全局配置](/zh-CN/settings#global-config-settings) |1512| [`~/.claude.json`](#ce-claude-json) | 仅全局 | | 应用状态、OAuth、UI 切换、个人 MCP 服务器 | [全局配置](/docs/zh-CN/settings#global-config-settings) |

1513| [`projects/<project>/memory/`](#ce-global-projects) | 仅全局 | | 自动内存:Claude 在会话间对自己的笔记 | [自动内存](/zh-CN/memory#auto-memory) |1513| [`projects/<project>/memory/`](#ce-global-projects) | 仅全局 | | 自动内存:Claude 在会话间对自己的笔记 | [自动内存](/docs/zh-CN/memory#auto-memory) |

1514| [`keybindings.json`](#ce-keybindings) | 仅全局 | | 自定义快捷键 | [快捷键](/zh-CN/keybindings) |1514| [`keybindings.json`](#ce-keybindings) | 仅全局 | | 自定义快捷键 | [快捷键](/docs/zh-CN/keybindings) |

1515| [`themes/*.json`](#ce-themes) | 仅全局 | | 自定义颜色主题 | [自定义主题](/zh-CN/terminal-config#create-a-custom-theme) |1515| [`themes/*.json`](#ce-themes) | 仅全局 | | 自定义颜色主题 | [自定义主题](/docs/zh-CN/terminal-config#create-a-custom-theme) |

1516 1516 

1517<h2 id="troubleshoot-configuration">1517<h2 id="troubleshoot-configuration">

1518 排查配置问题1518 排查配置问题

1519</h2>1519</h2>

1520 1520 

1521如果设置、hook 或文件未生效,请参阅[调试您的配置](/zh-CN/debug-your-config)以获取检查命令和症状优先查找表。1521如果设置、hook 或文件未生效,请参阅[调试您的配置](/docs/zh-CN/debug-your-config)以获取检查命令和症状优先查找表。

1522 1522 

1523<h2 id="application-data">1523<h2 id="application-data">

1524 应用数据1524 应用数据


1530 自动清理1530 自动清理

1531</h3>1531</h3>

1532 1532 

1533下面路径中的文件在启动时被删除,一旦它们的年龄超过 [`cleanupPeriodDays`](/zh-CN/settings#available-settings)。默认值为 30 天。1533下面路径中的文件在启动时被删除,一旦它们的年龄超过 [`cleanupPeriodDays`](/docs/zh-CN/settings#available-settings)。默认值为 30 天。

1534 1534 

1535| `~/.claude/` 下的路径 | 内容 |1535| `~/.claude/` 下的路径 | 内容 |

1536| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |1536| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |

1537| `projects/<project>/<session>.jsonl` | 完整的对话记录:每条消息、工具调用和工具结果 |1537| `projects/<project>/<session>.jsonl` | 完整的对话记录:每条消息、工具调用和工具结果 |

1538| `projects/<project>/<session>/subagents/` | [Subagent](/zh-CN/sub-agents) 对话记录,当父会话记录过期时被删除 |1538| `projects/<project>/<session>/subagents/` | [Subagent](/docs/zh-CN/sub-agents) 对话记录,当父会话记录过期时被删除 |

1539| `projects/<project>/<session>/tool-results/` | 大型工具输出溢出到单独的文件 |1539| `projects/<project>/<session>/tool-results/` | 大型工具输出溢出到单独的文件 |

1540| `file-history/<session>/` | Claude 更改的文件的编辑前快照,用于 [checkpoint 恢复](/zh-CN/checkpointing)。保存最近 100 个 checkpoint 的快照;没有保留 checkpoint 引用的快照文件被删除,除了每个文件的第一个快照 |1540| `file-history/<session>/` | Claude 更改的文件的编辑前快照,用于 [checkpoint 恢复](/docs/zh-CN/checkpointing)。保存最近 100 个 checkpoint 的快照;没有保留 checkpoint 引用的快照文件被删除,除了每个文件的第一个快照 |

1541| `plans/` | 在 [Plan Mode](/zh-CN/permission-modes#analyze-before-you-edit-with-plan-mode) 期间写入的计划文件 |1541| `plans/` | 在 [Plan Mode](/docs/zh-CN/permission-modes#analyze-before-you-edit-with-plan-mode) 期间写入的计划文件 |

1542| `debug/` | 每个会话的调试日志,仅在您使用 `--debug` 启动或运行 `/debug` 时写入 |1542| `debug/` | 每个会话的调试日志,仅在您使用 `--debug` 启动或运行 `/debug` 时写入 |

1543| `paste-cache/`、`image-cache/` | 大型粘贴和附加图像的内容 |1543| `paste-cache/`、`image-cache/` | 大型粘贴和附加图像的内容 |

1544| `session-env/` | 每个会话的环境元数据 |1544| `session-env/` | 每个会话的环境元数据 |

1545| `tasks/` | 由 Task 工具写入的每个会话的任务列表 |1545| `tasks/` | 由 Task 工具写入的每个会话的任务列表 |

1546| `shell-snapshots/` | 在启动时捕获的别名、函数和 shell 选项,由 [Bash 工具](/zh-CN/tools-reference#bash-tool-behavior) 应用于每个命令。在正常退出时删除。扫描清理任何在崩溃后留下的内容。 |1546| `shell-snapshots/` | 在启动时捕获的别名、函数和 shell 选项,由 [Bash 工具](/docs/zh-CN/tools-reference#bash-tool-behavior) 应用于每个命令。在正常退出时删除。扫描清理任何在崩溃后留下的内容。 |

1547| `backups/` | 在配置迁移前获取的 `~/.claude.json` 的时间戳副本 |1547| `backups/` | 在配置迁移前获取的 `~/.claude.json` 的时间戳副本 |

1548| `feedback-bundles/` | 由 `/feedback` 在第三方提供商上或当未配置 Anthropic 凭证时写入的编辑后的记录存档,用于发送到您的 Anthropic 账户团队 |1548| `feedback-bundles/` | 由 `/feedback` 在第三方提供商上或当未配置 Anthropic 凭证时写入的编辑后的记录存档,用于发送到您的 Anthropic 账户团队 |

1549| `todos/`、`statsig/`、`logs/` | 来自旧版本的旧版目录。不再写入。扫描删除其内容,然后删除空目录。 |1549| `todos/`、`statsig/`、`logs/` | 来自旧版本的旧版目录。不再写入。扫描删除其内容,然后删除空目录。 |


1558| ---------------------- | ---------------------------------------------------------------------------------- |1558| ---------------------- | ---------------------------------------------------------------------------------- |

1559| `history.jsonl` | 您输入的每个提示,带有时间戳和项目路径。用于向上箭头回忆。 |1559| `history.jsonl` | 您输入的每个提示,带有时间戳和项目路径。用于向上箭头回忆。 |

1560| `stats-cache.json` | 由 `/usage` 显示的聚合令牌和成本计数 |1560| `stats-cache.json` | 由 `/usage` 显示的聚合令牌和成本计数 |

1561| `remote-settings.json` | [服务器管理的设置](/zh-CN/server-managed-settings)的缓存副本,用于您的组织。仅在您的组织配置了这些设置时才存在。在每次启动时刷新。 |1561| `remote-settings.json` | [服务器管理的设置](/docs/zh-CN/server-managed-settings)的缓存副本,用于您的组织。仅在您的组织配置了这些设置时才存在。在每次启动时刷新。 |

1562 1562 

1563其他小缓存和锁定文件根据您使用的功能而出现,可以安全删除。1563其他小缓存和锁定文件根据您使用的功能而出现,可以安全删除。

1564 1564 


1569记录和历史在静止时未加密。操作系统文件权限是唯一的保护。如果工具读取 `.env` 文件或命令打印凭证,该值将写入 `projects/<project>/<session>.jsonl`。要减少暴露:1569记录和历史在静止时未加密。操作系统文件权限是唯一的保护。如果工具读取 `.env` 文件或命令打印凭证,该值将写入 `projects/<project>/<session>.jsonl`。要减少暴露:

1570 1570 

1571* 降低 `cleanupPeriodDays` 以缩短记录的保留时间1571* 降低 `cleanupPeriodDays` 以缩短记录的保留时间

1572* 设置 [`CLAUDE_CODE_SKIP_PROMPT_HISTORY`](/zh-CN/env-vars) 环境变量以跳过在任何模式下写入记录和提示历史。在非交互模式下,您可以改为在 `-p` 旁边传递 `--no-session-persistence`,或在 Agent SDK 中设置 `persistSession: false`。1572* 设置 [`CLAUDE_CODE_SKIP_PROMPT_HISTORY`](/docs/zh-CN/env-vars) 环境变量以跳过在任何模式下写入记录和提示历史。在非交互模式下,您可以改为在 `-p` 旁边传递 `--no-session-persistence`,或在 Agent SDK 中设置 `persistSession: false`。

1573* 使用 [权限规则](/zh-CN/permissions) 拒绝读取凭证文件1573* 使用 [权限规则](/docs/zh-CN/permissions) 拒绝读取凭证文件

1574 1574 

1575<h3 id="clear-local-data">1575<h3 id="clear-local-data">

1576 清除本地数据1576 清除本地数据


1627 相关资源1627 相关资源

1628</h2>1628</h2>

1629 1629 

1630* [管理 Claude 的内存](/zh-CN/memory):编写和组织 CLAUDE.md、rules 和自动内存1630* [管理 Claude 的内存](/docs/zh-CN/memory):编写和组织 CLAUDE.md、rules 和自动内存

1631* [配置设置](/zh-CN/settings):设置权限、hooks、环境变量和模型默认值1631* [配置设置](/docs/zh-CN/settings):设置权限、hooks、环境变量和模型默认值

1632* [创建 skills](/zh-CN/skills):构建可重用的提示和工作流1632* [创建 skills](/docs/zh-CN/skills):构建可重用的提示和工作流

1633* [配置 subagents](/zh-CN/sub-agents):定义具有自己上下文的专门代理1633* [配置 subagents](/docs/zh-CN/sub-agents):定义具有自己上下文的专门代理

hooks.md +1 −1

Details

39| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |39| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |

40| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |40| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |

41| `PreToolUse` | Before a tool call executes. Can block it |41| `PreToolUse` | Before a tool call executes. Can block it |

42| `PermissionRequest` | When a permission dialog appears |42| `PermissionRequest` | When a tool call needs a permission decision |

43| `PermissionDenied` | When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call |43| `PermissionDenied` | When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call |

44| `PostToolUse` | After a tool call succeeds |44| `PostToolUse` | After a tool call succeeds |

45| `PostToolUseFailure` | After a tool call fails |45| `PostToolUseFailure` | After a tool call fails |

hooks-guide.md +1 −1

Details

465| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |465| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |

466| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |466| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |

467| `PreToolUse` | Before a tool call executes. Can block it |467| `PreToolUse` | Before a tool call executes. Can block it |

468| `PermissionRequest` | When a permission dialog appears |468| `PermissionRequest` | When a tool call needs a permission decision |

469| `PermissionDenied` | When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call |469| `PermissionDenied` | When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call |

470| `PostToolUse` | After a tool call succeeds |470| `PostToolUse` | After a tool call succeeds |

471| `PostToolUseFailure` | After a tool call fails |471| `PostToolUseFailure` | After a tool call fails |

Details

125| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |125| `UserPromptSubmit` | When you submit a prompt, before Claude processes it |

126| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |126| `UserPromptExpansion` | When a user-typed command expands into a prompt, before it reaches Claude. Can block the expansion |

127| `PreToolUse` | Before a tool call executes. Can block it |127| `PreToolUse` | Before a tool call executes. Can block it |

128| `PermissionRequest` | When a permission dialog appears |128| `PermissionRequest` | When a tool call needs a permission decision |

129| `PermissionDenied` | When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call |129| `PermissionDenied` | When a tool call is denied by the auto mode classifier. Return `{retry: true}` to tell the model it may retry the denied tool call |

130| `PostToolUse` | After a tool call succeeds |130| `PostToolUse` | After a tool call succeeds |

131| `PostToolUseFailure` | After a tool call fails |131| `PostToolUseFailure` | After a tool call fails |