# 记忆与指令

> ## 文档 索引
> 获取 the 完成 文档 索引 at: https://代码.claude.com/docs/llms.txt
> 使用 this 文件 to disc结束 所有 可用 页s 之前探索 further.

# Claude 如何记住您的项目

> Give Claude 持续 说明 with CLAUDE.md 文件, and let Claude accumu晚 learnings 自动所有y with auto 记忆.

每个 Claude 代码 会话 begins with a 新鲜 上下文 风ow. Two mechanisms carry 知识 across 会话s:

* **CLAUDE.md 文件**: 说明 you 写入 to give Claude 持续 上下文
* **Auto 记忆**: 注意s Claude 写入s itself 基础d on your 正确ions and 偏好设置

This 页 c结束s how to:

* [写入 and organize CLAUDE.md 文件](#claude-md-文件)
* [范围 规则 to 特定 文件 类型s](#organize-规则-with-claude/规则/) with `.claude/规则/`
* [Con图 auto 记忆](#auto-记忆) so Claude takes 注意s 自动所有y
* [麻烦shoot](#麻烦shoot-记忆-问题s) when 说明 aren't being foll欠

## CLAUDE.md vs auto 记忆

Claude 代码 has two complementary 记忆 系统s. 机器人h are 加载 at the 启动 of 每个 对话. Claude treats them as 上下文, not en强迫 配置. The 更多 特定 and concise your 说明, the 更多 一致ly Claude fol低s them.

|                      | CLAUDE.md 文件                                   | Auto 记忆                                                      |
| :------------------- | :------------------------------------------------ | :--------------------------------------------------------------- |
| **Who 写入s it**    | You                                               | Claude                                                           |
| **What it contains** | 说明 and 规则                            | Learnings and 模式s                                           |
| **范围**            | 项目, 用户, or org                             | Per工作 树                                                 |
| **加载 into**      | 每个 会话                                     | 每个 会话 (第一个 200 行s or 25KB)                          |
| **使用 for**          | Coding 标准, 工作流s, 项目 架构 | 构建 命令, 调试ging insights, 偏好设置 Claude disc结束s |

使用 CLAUDE.md 文件 when you 想要 to 指南 Claude's behavior. Auto 记忆 lets Claude learn from your 正确ions without 手册 effort.

子代理 can also 主tain their own auto 记忆.看见 [sub代理 配置](/en/sub-代理s#启用-持续-记忆) for 详情s.

## CLAUDE.md 文件

CLAUDE.md 文件 are mark下 文件 that give Claude 持续 说明 for a 项目, your 个人 工作流, or your 整个 组织. You 写入 these 文件 in 简单 文本; Claude 读取s them at the 启动 of 每个 会话.

### Choose where to put CLAUDE.md 文件

CLAUDE.md 文件 can live in 几个 locations, 每个 with a 不同 范围. 更多 特定 locations take precedence 结束 broader ones.

| 范围                    | Location                                                                                                                                                                | 目的                                                    | 使用 案例 示例                                                    | 共享 with                     |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |
| **管理 政策**       | • macOS: `/库/应用程序 支持/Clau解码/CLAUDE.md`• Linux and WSL: `/etc/claude-代码/CLAUDE.md`• 风ows: `C:\计划 文件\Clau解码\CLAUDE.md` | 组织-wide 说明 管理 by IT/DevOps        | 公司 coding 标准, 安全 政策, 合规 要求 | 所有 用户s in 组织       |
| **项目 说明** | `./CLAUDE.md` or `./.claude/CLAUDE.md`                                                                                                                                  | 团队-共享 说明 for the 项目                   | 项目 架构, coding 标准, 通用工作流             | 团队 成员s via 来源 控制 |
| **用户 说明**    | `~/.claude/CLAUDE.md`                                                                                                                                                   | 个人 偏好设置 for 所有 项目s                      | 代码 styling 偏好设置, 个人 工具ing 短剪切s                 | 公正 you (所有 项目s)         |
| **本地 说明**   | `./CLAUDE.本地.md`                                                                                                                                                     | 个人 项目-特定 偏好设置; 添加 to `.Gitignore` | Your 沙box URLs, preferred 测试 数据                               | 公正 you (当前 项目)      |

CLAUDE.md and CLAUDE.本地.md 文件 in the 目录 hierarchy above the工作 目录 are 加载 in 满 at 启动. 文件 in sub总监ies 加载 on 需求 when Claude 读取s 文件 in those 总监ies.看见 [How CLAUDE.md 文件 加载](#how-claude-md-文件-加载) for the 满 决议 顺序.

For large 项目s, you can break 说明 into 话题-特定 文件 using [项目 规则](#organize-规则-with-claude/规则/). 规则 let you 范围 说明 to 特定 文件 类型s or sub总监ies.

### 设置 上 a 项目 CLAUDE.md

A 项目 CLAUDE.md can be 存储 in either `./CLAUDE.md` or `./.claude/CLAUDE.md`. 创建 this 文件 and 添加 说明 that 应用ly to 任何one工作 on the 项目: 构建 and 测试 命令, coding 标准, 架构师ural 决定s, naming 惯例, and 通用工作流. These 说明 are 共享 with your 团队 th粗糙 版本 控制, so 焦点 on 项目-级别 标准 rather than 个人 偏好设置.

  运行 `/init` to gene速率 a 启动ing CLAUDE.md 自动所有y. Claude分析s your 代码基础 and 创建s a 文件 with 构建 命令, 测试 说明, and 项目 惯例 it disc结束s. If a CLAUDE.md al就绪 exists, `/init` suggests 改善s rather than 结束writing it. Re好 from there with 说明 Claude wouldn't disc结束 on its own.

  设置 `CLAUDE_代码_新_INIT=1` to 启用 an 交互 multi-阶段 f低. `/init` asks which 艺术i事实s to 设置 上: CLAUDE.md 文件, 技能, and 钩子. It then探索s your 代码基础 with a sub代理, fills in gaps via fol低-上 问题s, and 现在s a re视图能够 支撑osal 之前写作 任何 文件.

### 写入 有效 说明

CLAUDE.md 文件 are 加载 into the 上下文 风ow at the 启动 of 每个 会话, con总和ing 令牌s a长side your 对话. The [上下文 风ow 可视化](/en/上下文-风ow) 显示s where CLAUDE.md 加载s relative to the rest of the 启动上 上下文. Be原因 they're 上下文 rather than en强迫 配置, how you 写入 说明 affects how reliably Claude fol低s them. 特定, concise, well-结构化 说明 工作 最佳.

**尺寸**: 目标 under 200 行s per CLAUDE.md 文件. 长er 文件 con总和e 更多 上下文 and reduce adherence. If your 说明 are生长 large, split them using [进口s](#进口-添加itional-文件) or [`.claude/规则/`](#organize-规则-with-claude/规则/) 文件.

**结构**: 使用 mark下 页眉s and bullets to 组 r兴高采烈 说明. Claude扫描s 结构 the 相同 方式 读取器s do: 组织 节s are easier to fol低 than 密集 段落s.

**特定**: 写入 说明 that are 具体 enough to 验证. For 示例:

* "使用 2-s步伐 indentation" instead of "格式 代码 适当ly"
* "运行 `npm 测试` 之前 提交ting" instead of "测试 your 更改s"
* "API 处理器s live in `src/api/处理器s/`" instead of "Keep 文件 组织"

**一致**: if two 规则 contradict 每个 other, Claude may pick one arbitrarily. Re视图 your CLAUDE.md 文件, nested CLAUDE.md 文件 in sub总监ies, and [`.claude/规则/`](#organize-规则-with-claude/规则/) 期间ic所有y to 移除 过时 or conflicting 说明. In monorepos, 使用 [`claudeMdExcludes`](#exclude-特定-claude-md-文件) to跳 CLAUDE.md 文件 from other 团队 that aren't 相关 to your 工作.

### 进口 添加itional 文件

CLAUDE.md 文件 can 进口 添加itional 文件 using `@路径/to/进口` syn税. 导入 文件 are 扩展 and 加载 into 上下文 at 启动 a长side the CLAUDE.md that 参考文献 them.

机器人h relative and absolute 路径s are 允许. Relative 路径s resolve relative to the 文件包含 the 进口, not the工作 目录. 导入 文件 can 递归ly 进口 other 文件, with a 最大 深度 of five跳s.

To 拉取 in a 读取ME, 包.json, and a 工作流 指南, 参考 them with `@` syn税 任何where in your CLAUDE.md:

```文本  主题={空}
看见 @读取ME for 项目 概述 and @包.json for 可用 npm 命令 for this 项目.

# 添加itional 说明
- Git 工作流 @docs/Git-说明.md
```

For 私人 per-项目 偏好设置 that shouldn't be 检查ed into 版本 控制, 创建 a `CLAUDE.本地.md` at the 项目 根. It 加载s a长side `CLAUDE.md` and is treated the 相同 方式. 添加 `CLAUDE.本地.md` to your `.Gitignore` so it isn't 提交ted; 运行中 `/init` and选择 the 个人 选项 does this for you.

If you 工作 across mul提示le Git 工作树 of the 相同 仓库, a Git忽略 `CLAUDE.本地.md` only exists in the 工作树 where you 创建d it. To share 个人 说明 across 工作树, 进口 a 文件 from your home 目录 instead:

```文本  主题={空}
# 个人 偏好设置
- @~/.claude/my-项目-说明.md
```

  The 第一个 时间 Claude 代码 encounters 外部 进口s in a 项目, it 显示s an 批准 dia日志列表 the 文件. If you 下降, the 进口s stay 禁用 and the dia日志 does not 应用ear a收益.

For a 更多 结构化 方法 to组织 说明,看见 [`.claude/规则/`](#organize-规则-with-claude/规则/).

### 代理S.md

Claude 代码 读取s `CLAUDE.md`, not `代理S.md`. If your 仓库 al就绪 使用s `代理S.md` for other coding 代理s, 创建 a `CLAUDE.md` that 进口s it so 机器人h 工具 读取 the 相同 说明 without复制 them. You can also 添加 Claude-特定 说明 be低 the 进口. Claude 加载s the 导入 文件 at 会话 启动, then 应用结束s the rest:

```mark下 CLAUDE.md 主题={空}
@代理S.md

## Claude 代码

使用 计划 模式 for 更改s under `src/billing/`.
```

### How CLAUDE.md 文件 加载

Claude 代码 读取s CLAUDE.md 文件 by走ing 上 the 目录 树 from your 当前工作 目录,检查 每个 目录 a长 the 方式 for `CLAUDE.md` and `CLAUDE.本地.md` 文件. This 手段 if you 运行 Claude 代码 in `foo/bar/`, it 加载s 说明 from `foo/bar/CLAUDE.md`, `foo/CLAUDE.md`, and 任何 `CLAUDE.本地.md` 文件 a长side them.

所有 disc结束ed 文件 are concatenated into 上下文 rather than 结束riding 每个 other. 在...内 每个 目录, `CLAUDE.本地.md` is 应用结束 之后 `CLAUDE.md`, so when 说明 conflict, your 个人 注意s are the 最后一个 薄g Claude 读取s at that 级别.

Claude also disc结束s `CLAUDE.md` and `CLAUDE.本地.md` 文件 in sub总监ies under your 当前工作 目录. Instead of 加载ing them at 启动, they are 包含 when Claude 读取s 文件 in those sub总监ies.

If you 工作 in a large monorepo where other 团队' CLAUDE.md 文件 get picked 上, 使用 [`claudeMdExcludes`](#exclude-特定-claude-md-文件) to跳 them.

块-级别 HTML comments (``) in CLAUDE.md 文件 are s旅行ped 之前 the 满意 is injected into Claude's 上下文. 使用 them to leave 注意s for 人类 维护者s without s待处理 上下文 令牌s on them. Comments 内部 代码 块s are 保存. When you 打开 a CLAUDE.md 文件 直接ly with the 读取 工具, comments re主 可见.

#### 加载 from 添加itional 总监ies

The `--添加-dir` flag gives Claude access to 添加itional 总监ies 外部 your 主工作 目录. By 默认, CLAUDE.md 文件 from these 总监ies are not 加载.

To also 加载 CLAUDE.md 文件 from 添加itional 总监ies,包括 `CLAUDE.md`, `.claude/CLAUDE.md`, and `.claude/规则/*.md`, 设置 the `CLAUDE_代码_添加ITIONAL_总监IES_CLAUDE_MD` 环境 可变:

```bash  主题={空}
CLAUDE_代码_添加ITIONAL_总监IES_CLAUDE_MD=1 claude --添加-dir ../共享-config
```

`CLAUDE.本地.md` 文件 in 添加itional 总监ies are not 加载.

### Organize 规则 with `.claude/规则/`

For larger 项目s, you can organize 说明 into mul提示le 文件 using the `.claude/规则/` 目录. This keeps 说明 模块化 and easier for 团队 to 主tain. 规则 can also be [范围d to 特定 文件 路径s](#路径-特定-规则), so they only 加载 into 上下文 when Claude 工作s with 匹配 文件, reducing 噪音 and保存 上下文 s步伐.

  规则 加载 into 上下文 每个 会话 or when 匹配 文件 are 打开. For 任务-特定 说明 that don't 需要 to be in 上下文 所有 the 时间, 使用 [技能](/en/技能) instead, which only 加载 when you invoke them or when Claude determines they're 相关 to your 及时.

#### 设置 上 规则

Place mark下 文件 in your 项目's `.claude/规则/` 目录. 每个 文件 should c结束 one 话题, with a de脚本ive 文件名称 像 `测试.md` or `api-设计.md`. 所有 `.md` 文件 are disc结束ed 递归ly, so you can organize 规则 into sub总监ies 像 `front结束/` or `返回结束/`:

```文本  主题={空}
your-项目/
├── .claude/
│   ├── CLAUDE.md           # 主 项目 说明
│   └── 规则/
│       ├── 代码-style.md   # 代码 style 准则
│       ├── 测试.md      # 测试 惯例
│       └── 安全.md     # 安全 要求
```

规则 without [`路径s` front事情](#路径-特定-规则) are 加载 at 启动 with the 相同 优先级 as `.claude/CLAUDE.md`.

#### 路径-特定 规则

规则 can be 范围d to 特定 文件 using YAML front事情 with the `路径s` 字段. These 条件 规则 only 应用ly when Claude is工作 with 文件 匹配 the 指定 模式s.

```mark下  主题={空}
---
路径s:
  - "src/api/**/*.ts"
---

# API 开发 规则

- 所有 API 结束points must include 输入 验证
- 使用 the 标准 错误 响应 格式
- Include 打开API 文档 comments
```

规则 without a `路径s` 字段 are 加载 un条件ly and 应用ly to 所有 文件. 路径-范围d 规则 trigger when Claude 读取s 文件 匹配 the 模式, not on 每个 工具 使用.

使用 glob 模式s in the `路径s` 字段 to 匹配 文件 by 扩展, 目录, or 任何 组合:

| 模式                | 匹配es                                  |
| ---------------------- | ---------------------------------------- |
| `**/*.ts`              | 所有 类型脚本 文件 in 任何 目录    |
| `src/**/*`             | 所有 文件 under `src/` 目录         |
| `*.md`                 | Mark下 文件 in the 项目 根       |
| `src/组件s/*.tsx` | React 组件s in a 特定 目录 |

You can 规格ify mul提示le 模式s and 使用 b种族 expansion to 匹配 mul提示le 扩展s in one 模式:

```mark下  主题={空}
---
路径s:
  - "src/**/*.{ts,tsx}"
  - "lib/**/*.ts"
  - "测试s/**/*.测试.ts"
---
```

#### Share 规则 across 项目s with sym链接s

The `.claude/规则/` 目录 支持s sym链接s, so you can 主tain a 共享 设置 of 规则 and 链接 them into mul提示le 项目s. Sym链接s are 解决 and 加载 正常ly, and 圆形 sym链接s are detected and 已处理 优雅ly.

This 示例 链接s 机器人h a 共享 目录 and an 个人 文件:

```bash  主题={空}
ln -s ~/共享-claude-规则 .claude/规则/共享
ln -s ~/公司-标准/安全.md .claude/规则/安全.md
```

#### 用户-级别 规则

个人 规则 in `~/.claude/规则/` 应用ly to 每个 项目 on your machine. 使用 them for 偏好设置 that aren't 项目-特定:

```文本  主题={空}
~/.claude/规则/
├── 偏好设置.md    # Your 个人 coding 偏好设置
└── 工作流s.md      # Your preferred 工作流s
```

用户-级别 规则 are 加载 之前 项目 规则,给 项目 规则 高er 优先级.

### Manage CLAUDE.md for large 团队

For 组织s 部署ing Claude 代码 across 团队, you can 中央ize 说明 and 控制 which CLAUDE.md 文件 are 加载.

#### 部署 组织-wide CLAUDE.md

组织s can 部署 a 中央ly 管理 CLAUDE.md that 应用lies to 所有 用户s on a machine. This 文件 cannot be 排除 by 个人 设置.

  
    * macOS: `/库/应用程序 支持/Clau解码/CLAUDE.md`
    * Linux and WSL: `/etc/claude-代码/CLAUDE.md`
    * 风ows: `C:\计划 文件\Clau解码\CLAUDE.md`
  

  
    使用 MDM, 组 政策, Ansible, or 相似 工具 to distribute the 文件 across 开发者 machines.看见 [管理 设置](/en/权限#管理-设置) for other 组织-wide 配置 选项.
  

A 管理 CLAUDE.md and [管理 设置](/en/设置#设置-文件) serve 不同 目的s. 使用 设置 for 技术 enfor水泥 and CLAUDE.md for 行为 指导:

| 关心                                        | Con图 in                                              |
| :--------------------------------------------- | :-------------------------------------------------------- |
| 块 特定 工具, 命令, or 文件 路径s  | 管理 设置: `权限.拒绝`                      |
| En强制 沙box isolation                      | 管理 设置: `沙box.启用`                       |
| 环境变量 and API 提供者 r郊游 | 管理 设置: `env`                                   |
| 认证 方法 and 组织 锁定    | 管理 设置: `强制日志in方法`, `强制日志inOrgUUID` |
| 代码 style and quality 准则              | 管理 CLAUDE.md                                         |
| 数据处理 and 合规 reminders         | 管理 CLAUDE.md                                         |
| 行为 说明 for Claude             | 管理 CLAUDE.md                                         |

设置 规则 are en强迫 by the 客户端 注意较少 of what Claude decides to do. CLAUDE.md 说明 shape Claude's behavior but are not a 硬 enfor水泥 layer.

#### Exclude 特定 CLAUDE.md 文件

In large monorepos, ancestor CLAUDE.md 文件 may contain 说明 that aren't 相关 to your 工作. The `claudeMdExcludes`设置 lets you跳 特定 文件 by 路径 or glob 模式.

This 示例 excludes a 顶部-级别 CLAUDE.md and a 规则 目录 from a parent 文件夹. 添加 it to `.claude/设置.本地.json` so the 排除 stays 本地 to your machine:

```json  主题={空}
{
  "claudeMdExcludes": [
    "**/monorepo/CLAUDE.md",
    "/home/用户/monorepo/other-团队/.claude/规则/**"
  ]
}
```

模式s are 匹配ed a收益st absolute 文件 路径s using glob syn税. You can con图 `claudeMdExcludes` at 任何 [设置 layer](/en/设置#设置-文件): 用户, 项目, 本地, or 管理 政策. 数组s 合并 across layers.

管理 政策 CLAUDE.md 文件 cannot be 排除. This en确定s 组织-wide 说明 al方式s 应用ly 注意较少 of 个人 设置.

## Auto 记忆

Auto 记忆 lets Claude accumu晚 知识 across 会话s without you写作 任何薄g. Claude 保存s 注意s for itself as it 工作s: 构建 命令, 调试ging insights, 架构 注意s, 代码 style 偏好设置, and 工作流 习惯s. Claude doesn't 保存 一些薄g 每个 会话. It decides what's worth re成员ing 基础d on whether the 信息 would be 有用 in a 未来 对话.

  Auto 记忆 requ怒s Claude 代码 v2.1.59 or 更晚. 检查 your 版本 with `claude --版本`.

### 启用 or 禁用 auto 记忆

Auto 记忆 is on by 默认. To toggle it, 打开 `/记忆` in a 会话 and 使用 the auto 记忆 toggle, or 设置 `auto记忆启用` in your 项目 设置:

```json  主题={空}
{
  "auto记忆启用": 虚假
}
```

To 禁用 auto 记忆 via 环境 可变, 设置 `CLAUDE_代码_禁用_AUTO_记忆=1`.

### Sto狂怒 location

每个 项目 gets its own 记忆 目录 at `~/.claude/项目s//记忆/`. The `` 路径 is 派生 from the Git 仓库, so 所有 工作树 and sub总监ies 在...内 the 相同 repo share one auto 记忆 目录. 外部 a Git repo, the 项目 根 is 使用d instead.

To store auto 记忆 in a 不同 location, 设置 `auto记忆目录` in your 用户 or 本地 设置:

```json  主题={空}
{
  "auto记忆目录": "~/my-习俗-记忆-dir"
}
```

This设置 is 接受 from 政策, 本地, and 用户 设置. It is not 接受 from 项目 设置 (`.claude/设置.json`) to pr事件 a 共享 项目 from 重定向ing auto 记忆 写入s to 敏感 locations.

The 目录 contains a `记忆.md` 条目point and 可选 话题 文件:

```文本  主题={空}
~/.claude/项目s//记忆/
├── 记忆.md          # Concise 索引, 加载 into 每个 会话
├── 调试ging.md       # 详情ed 注意s on 调试ging 模式s
├── api-惯例.md # API 设计 决定s
└── ...                # 任何 other 话题 文件 Claude 创建s
```

`记忆.md` acts as an 索引 of the 记忆 目录. Claude 读取s and 写入s 文件 in this 目录 贯穿 your 会话, using `记忆.md` to keep 跟踪 of what's 存储 where.

Auto 记忆 is machine-本地. 所有 工作树 and sub总监ies 在...内 the 相同 Git 仓库 share one auto 记忆 目录. 文件 are not 共享 across machines or 云 环境s.

### How it 工作s

The 第一个 200 行s of `记忆.md`, or the 第一个 25KB, whichever comes 第一个, are 加载 at the 启动 of 每个 对话. 满意 超出 that 阈值 is not 加载 at 会话 启动. Claude keeps `记忆.md` concise by移动 详情ed 注意s into 单独 话题 文件.

This 限制 应用lies only to `记忆.md`. CLAUDE.md 文件 are 加载 in 满 注意较少 of 长度, though 短er 文件 produce 更好 adherence.

话题 文件 像 `调试ging.md` or `模式s.md` are not 加载 at 启动上. Claude 读取s them on 需求 using its 标准 文件 工具 when it 需要s the 信息.

Claude 读取s and 写入s 记忆 文件 期间 your 会话. When you看见 "Writing 记忆" or "Rec所有ed 记忆" in the Claude 代码 接口, Claude is 活跃ly更新 or 读取ing from `~/.claude/项目s//记忆/`.

### Audit and 编辑 your 记忆

Auto 记忆 文件 are 简单 mark下 you can 编辑 or 删除 at 任何 时间. 运行 [`/记忆`](#视图-and-编辑-with-记忆) to 浏览 and 打开 记忆 文件 from 在...内 a 会话.

##视图 and 编辑 with `/记忆`

The `/记忆` 命令 列表s 所有 CLAUDE.md, CLAUDE.本地.md, and 规则 文件 加载 in your 当前 会话, lets you toggle auto 记忆 on or off, and provides a 链接 to 打开 the auto 记忆 文件夹. 选择 任何 文件 to 打开 it in your 编辑or.

When you ask Claude to re成员 一些薄g, 像 "al方式s 使用 pnpm, not npm" or "re成员 that the API 测试s requ怒 a 本地 Redis 实例," Claude 保存s it to auto 记忆. To 添加 说明 to CLAUDE.md instead, ask Claude 直接ly, 像 "添加 this to CLAUDE.md," or 编辑 the 文件 yourself via `/记忆`.

## 麻烦shoot 记忆 问题s

These are the 最多 常见问题 with CLAUDE.md and auto 记忆, a长 with步骤s to 调试 them.

### Claude isn't跟随 my CLAUDE.md

CLAUDE.md 满意 is 交付 as a 用户 消息 之后 the 系统 及时, not as 部分 of the 系统 及时 itself. Claude 读取s it and tries to fol低 it, but there's no guarantee of 严格 合规, e特殊ly for 模糊 or conflicting 说明.

To 调试:

* 运行 `/记忆` to 验证 your CLAUDE.md and CLAUDE.本地.md 文件 are being 加载. If a 文件 isn't 列出, Claude can't看见 it.
* 检查 that the 相关 CLAUDE.md is in a location that gets 加载 for your 会话 (看见 [Choose where to put CLAUDE.md 文件](#choose-where-to-put-claude-md-文件)).
* Make 说明 更多 特定. "使用 2-s步伐 indentation" 工作s 更好 than "格式 代码 nicely."
*寻找 conflicting 说明 across CLAUDE.md 文件. If two 文件 give 不同 指导 for the 相同 behavior, Claude may pick one arbitrarily.

For 说明 you 想要 at the 系统 及时 级别, 使用 [`--应用结束-系统-及时`](/en/cli-参考#系统-及时-标志). This must be passed 每个 invocation, so it's 更好 suited to 脚本s and automation than 交互 使用.

  使用 the [`说明加载` hook](/en/钩子#说明加载) to 日志 精确ly which instruction 文件 are 加载, when they 加载, and why. This is 有用 for 调试ging 路径-特定 规则 or 懒惰-加载 文件 in sub总监ies.

### I don't know what auto 记忆 保存

运行 `/记忆` and 选择 the auto 记忆 文件夹 to 浏览 what Claude has 保存. 每个薄g is 简单 mark下 you can 读取, 编辑, or 删除.

### My CLAUDE.md is too large

文件 结束 200 行s con总和e 更多 上下文 and may reduce adherence. 移动 详情ed 满意 into 单独 文件 参考d with `@路径` 进口s (看见 [进口 添加itional 文件](#进口-添加itional-文件)), or split your 说明 across `.claude/规则/` 文件.

### 说明看见m 失败 之后 `/紧凑`

CLAUDE.md 满y survives 紧凑ion. 之后 `/紧凑`, Claude re-读取s your CLAUDE.md from disk and re-injects it 新鲜 into the 会话. If an instruction dis应用eared 之后 紧凑ion, it was given only in 对话, not written to CLAUDE.md. 添加 it to CLAUDE.md to make it persist across 会话s.

看见 [写入 有效 说明](#写入-有效-说明) for 指导 on 尺寸, 结构, and 特定.

## R兴高采烈 资源

* [技能](/en/技能): 包 repea表 工作流s that 加载 on 需求
* [设置](/en/设置): con图 Claude 代码 behavior with 设置 文件
* [Manage 会话s](/en/会话s): manage 上下文, 恢复 对话s, and 运行 平行 会话s
* [Sub代理 记忆](/en/sub-代理s#启用-持续-记忆): let 子代理 主tain their own auto 记忆