Type: docs Makes the version stamps, Compatible Models footers and locale README badges say only what has been checked. Every claim below was checked against `https://code.claude.com/docs/en/<page>.md` or the raw changelog (2.1.303–2.1.322), not written from memory. ## Part A: English footers at 2.1.310 / 2.1.302 Each file's behavioural claims were checked against every changelog entry after its stamp, up to 2.1.322, and against the current docs. A stamp moves only when every claim checks out. | File | Claims checked | Fixes | Sources | New stamp | |---|---|---|---|---| | `INDEX.md` | ~75: AGENTS.md rule (v2.1.277); skill/agent/MCP install paths; `/mcp__github__list_prs`; 5 hook types, 33 events, task-tool model note; `--plugin-dir`; checkpoint menu (6 options); `/workflows`, ultracode (v2.1.284), size guideline; 6 permission modes; `/loop` and the cron tools; Chrome; Remote Control; `SendMessage`/`ListAgents`/`notify_when_idle`; CLI flags | 1. Workflow size: medium aims for fewer than 10 agents only since v2.1.271 (15 before), and the default is small on a Pro plan. 2. dontAsk: file reads inside the working directories also run, as do *most* calls a `permissions.allow` rule or a `PreToolUse` hook approves (neither can approve critical-path `rm`/`rmdir` or network-path reads), and an installed mod can approve some calls. No version is given: the changelog doesn't say when a mod's `tool.check` allow arrived (it is already referenced in 2.1.290, 2.1.292 and 2.1.299). 3. `SendMessage` also reaches sessions on other machines and in the cloud, from a session connected to Remote Control with a claude.ai sign-in; a cloud session can't answer with `SendMessage`. The L383 use-case column now says the same. 4. The `--model` list adds the Fable models. 5. Plan mode: "Read-only analysis" → researches and proposes, runs shell commands to explore, edits blocked until the plan is approved. | [workflows#set-a-size-guideline](https://code.claude.com/docs/en/workflows#set-a-size-guideline) ("The default is `medium`, or `small` when you're signed in on a Pro plan with Claude Code v2.1.271 or later"); CL 2.1.219 ("aim for fewer than 15 agents"), CL 2.1.271 ("lowered the medium size guideline from 15 to 10 agents"); [permission-modes](https://code.claude.com/docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode) ("a mod you installed can still approve some of those calls"; "Claude still runs … file reads inside your working directories and read-only Bash commands"; "It also denies the built-in `AskUserQuestion` tool even if your allow rules match it"; "An allow rule or `PreToolUse` hook can't approve these: Recognized `rm` and `rmdir` critical-path removals … Reads from a network path"); CL 2.1.292 ("Fixed a plugin's `tool.check` hook answering allow running a tool…"), CL 2.1.299 ("…that a `PreToolUse` hook or a mod's `tool.check` hook allowed"); [permission-modes#analyze-before-you-edit-with-plan-mode](https://code.claude.com/docs/en/permission-modes#analyze-before-you-edit-with-plan-mode) ("Claude reads files, runs shell commands to explore, and writes a plan, but does not edit your source. Except in interactive terminal sessions with bypass permissions available, edits stay blocked until you approve the plan."); [cross-session-messaging](https://code.claude.com/docs/en/cross-session-messaging) ("reach your sessions on other machines or in the cloud"; "from a session that is connected to Remote Control, which needs a claude.ai sign-in"; "A cloud session … can't use `SendMessage` to answer a message from another machine"); model-config. The "device card" line checked out against [whats-new/2026-w34](https://code.claude.com/docs/en/whats-new/2026-w34). | **2.1.322** | | `LEARNING-ROADMAP.md` | 33 hook events / 5 types; 6 built-in subagents (Explore, Plan, General-purpose, claude, statusline-setup, claude-code-guide); 60+ commands (commands page has 121 rows); `/design` (v2.1.265); `/plan`, `/rewind`, `/loop 5m`, `/schedule`; 6 permission modes (Manual since v2.1.200); Alt+T; skill `effort`/`shell`; plugin `workflows`/`channels`/`dependencies`; agent-teams env var; `claude mcp add --transport http`; `-r`, `--max-turns`, `--output-format json`; all 17 source links resolve | 1. Remote Control: "generally available" → "out of research preview", the docs' own wording. 2. Extended thinking (L368, Exercise 3, checklist): Opus 5.5, Sonnet 5.5, Haiku 5.5 and the Fable models always use extended thinking, so the exercise uses `/effort` and scopes Alt+T / Option+T to models that allow turning thinking off. 3. Exercise 4: checkpoints are automatic and unnamed, so step 1 no longer creates a named "Clean state" checkpoint and step 5 says which one to `/rewind` to. | [whats-new/2026-w34](https://code.claude.com/docs/en/whats-new/2026-w34): "Any machine running `claude remote-control` now shows up as a device card at the top of the Code tab in the Claude app. Remote Control is also out of research preview."; [interactive-mode](https://code.claude.com/docs/en/interactive-mode): Alt+T "Has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which always use extended thinking."; [model-config](https://code.claude.com/docs/en/model-config): "the effort level is the primary control for how much thinking happens"; [checkpointing](https://code.claude.com/docs/en/checkpointing): "Every prompt you send that starts a turn creates a new checkpoint" | **2.1.322** | | `resources.md` | Adaptive reasoning on Opus 4.7+, Sonnet 5+, Haiku 5.5 and the Fable models; permission modes; 33 hook events; `/loop` and cron; 7 memory tiers; Chrome; keybinding chords; Code Review; Monitor (2.1.98); `/goal` and `claude agents` (2.1.139); `--json` (2.1.145); all links | none needed | model-config, hooks, memory, agent-view, changelog | **stays 2.1.310**: L253 gives `/run`, `/verify`, `/run-skill-generator` as "(v2.1.145+)". Neither the changelog, the v2.1.145 release notes, the skills/commands docs nor the what's-new pages for weeks 19–22 give a version. | | `03-skills/claude-md/SKILL.md` | `name`/`description` frontmatter, `$ARGUMENTS`; CLAUDE.md locations and loading; "under 200 lines"; AGENTS.md gates (v2.1.277, v2.1.281), blocking files, `/config` Project instructions values and default; `@AGENTS.md`/symlink fallback; `.claude/agents/` | L196: the list of cases where AGENTS.md isn't read now includes a disabled built-in plugin, and limits the upgrade case to "in some cases" after upgrading from v2.1.276 or earlier | [memory#when-agents-md-support-is-unavailable](https://code.claude.com/docs/en/memory#when-agents-md-support-is-unavailable): "You used `/plugin` to disable the built-in plugin that reads `AGENTS.md`"; "In some cases, it's your first session after you upgrade from v2.1.276 or earlier" | **stays 2.1.302**: no primary source states L24 ("~150-200 instructions", "system prompt already uses ~50") or L214 (the system reminder says CLAUDE.md "may or may not be relevant") | | `07-plugins/devops-automation/README.md` | `--plugin-dir` install; commands; agents; hooks; MCP; workflow; source URLs (all 200) | none: the stale claims need a design decision (below) | [plugins/components](https://code.claude.com/docs/en/plugins/components): "Save a command at `commands/<file>.md` and it becomes `/<plugin>:<file>`"; [plugins-reference](https://code.claude.com/docs/en/plugins-reference) standard layout: "Hooks \| `hooks/hooks.json`", "MCP servers \| `.mcp.json`" | **stays 2.1.302**: bare `/deploy`, `/rollback`, `/status` (`/status` is also a built-in), `/incident`; `hooks/*.js` are never registered (no `hooks/hooks.json`); `mcp/kubernetes-config.json` never loads (no `.mcp.json` or `mcpServers`) | | `07-plugins/documentation/README.md` | same | none | same | **stays 2.1.302**: bare command names; `mcp/github-docs-config.json` never loads, so the `GITHUB_TOKEN` setup has no effect | | `07-plugins/pr-review/README.md` | same | none | same | **stays 2.1.302**: bare command names; `hooks/pre-review.js` is not registered; `mcp/github-config.json` never loads | No changelog entry from 2.1.303 to 2.1.322 touched the plugin READMEs or SKILL.md. Their problems predate the stamps, and #209 already listed the hook/MCP files that never load. **Locale copies:** the same factual fixes went into every locale with the same sentence. That's dontAsk and plan mode in all six INDEX files; workflow size in fa and ko; `SendMessage` and the use-case column in fa and ko; the `--model` list in fa and ko; "generally available" in fa and ko LEARNING-ROADMAP; the extended-thinking exercise/checklist and the checkpoint exercise in all six LEARNING-ROADMAP copies; the AGENTS.md cases in all six SKILL.md copies. Locale stamps were not bumped. INDEX and LEARNING-ROADMAP stay at 2.1.310 in every locale, and the SKILL.md copies keep their footers. ## Part B: Compatible Models footers The new list is **Claude Fable 5.2, Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, Claude Opus 5, Claude Sonnet 5.5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 5.5, Claude Haiku 4.5**. It is used on root docs and module pages alike, and it's the README FAQ's list, so the footers and the FAQ no longer disagree. Why one list for both file types: STYLE_GUIDE's footer rule ("List all compatible models") applies to both. A shorter "current models only" list on module pages would break that rule. Justification from [model-config](https://code.claude.com/docs/en/model-config): - **Current models:** "| Anthropic API | Opus 5.5 | Sonnet 5.5 | Haiku 5.5 |"; "the `fable` alias resolves to Fable 5 in Claude apps gateway sessions and to Fable 5.2 everywhere else"; "Fable 5.2 requires Claude Code v2.1.321 or later". - **Older models still in use:** - "**Fable 5.1 or Fable 5**: select it by model ID." - "| Claude Platform on AWS | Opus 5.5 | Sonnet 4.6 | Haiku 4.5 |". - "biology-flagged requests re-run on Opus 5, and cybersecurity-flagged requests re-run on Opus 4.8". - "**Sonnet 5.5**: cybersecurity-flagged requests re-run on Sonnet 5." - **None are retired.** The [models overview](https://platform.claude.com/docs/en/about-claude/models/overview) that model-config links marks only Opus 4.1, Opus 4 and Sonnet 4 as "retired". All eleven listed models appear there without that mark. Scope: 336 lines in 331 files. The changed lines are the `**Compatible Models**` lines (92, some of them in locale files) and every localized label (`호환 모델`, `مدلهای سازگار`, `Các Mô Hình Tương Thích`, `Сумісні моделі`, `対応モデル`, `互換モデル`, `兼容模型`), plus the italic `*対応:…*` / `*Для …*` / `*适用于 …*` lines in the ja/uk/zh concepts guides. Labels, separators (`, ` `、` `، `) and locale stamps are unchanged. The README FAQ lines and the 05-mcp `tool_reference` note are not footers and were left alone. The footer lines of `CHANGELOG.md`, `fa/CHANGELOG.md` and `ko/CHANGELOG.md` also carry the new list; only the footer line changed, not the entries. ## Part C: locale README badges Real state: the newest version that most (more than half) of the locale's ten module READMEs carry or exceed, backed by the sync commit that brought them there. A badge is marked **(partial)** when one or more of the locale's module READMEs has no version footer (never synced since its first translation), or when the locale is a condensed translation. A module synced to an older version than the badge doesn't make it partial on its own; the majority rule above already covers that. Only zh meets the rule (02-memory and 05-mcp have no footer, and #247 calls zh condensed). | Locale | Old badge / "latest" | Evidence | New | |---|---|---|---| | ja | 2.1.119 (badge, "latest", FAQ) | module footers: 3×2.1.322, 5×2.1.316, 1×2.1.310, 1×2.1.302; 8/10 ≥ 2.1.316 (#230); #247 carried only the sections ja has | **2.1.316** (Oct 2026) | | uk | 2.1.112 (FAQ line; no badge) | 3×2.1.322, 4×2.1.316, 1×2.1.310, 2×2.1.302; 7/10 ≥ 2.1.316 (#230) | **2.1.316** (Oct 2026) | | zh | 2.1.112 (badge, "latest", FAQ) | 2.1.316, 2.1.310 ×2, 2.1.302 ×2, 2.1.300 ×2, 2.1.278; 02 and 05 have no footer (untouched since the first translation); 7/10 ≥ 2.1.300 (#193); #247 was "condensed", model lists only | **2.1.300 (partial)** (Oct 2026): the badge, "latest" and FAQ lines say zh is condensed and that 02-memory and 05-mcp haven't been synced since the April 2026 translation | | ko | 2.1.310 | 5×2.1.322, 5×2.1.310; #228 synced ko to 2.1.310, and #247 says 2.1.316 "was not backfilled" | **2.1.310** (unchanged) | | fa | 2.1.310 | 5×2.1.322, 5×2.1.316; #241 "syncs the translation from v2.1.310 to v2.1.316"; #247 carried only the 2.1.322 P1 changes | **2.1.316** (Oct 2026) | | vi | none (README has no badge or version line) | 4×2.1.322, 6×2.1.316 | no change | Months come from the docs changelog: 2.1.300 was released October 14, 2026 and 2.1.316 October 31, 2026. The README *footers* in fa/ja/ko/uk/zh stay at 2.1.322: #247 checked those files themselves, while the badge describes the whole locale. ## Deliberately left - **Stamps not bumped:** `resources.md` (2.1.310), `03-skills/claude-md/SKILL.md` and the three plugin READMEs (2.1.302), for the reasons in the Part A table. - **Example plugins:** the fix is a design choice between wiring up `hooks/hooks.json` / `.mcp.json` and rewording the READMEs, and renaming commands to `/<plugin>:<name>` touches seven languages plus `07-plugins/README.md` (bare `/review-pr`). It needs a follow-up issue. - **Same unverifiable version elsewhere:** `03-skills/README.md` also said `/run-skill-generator` is v2.1.145+. Handled by #262, now merged into this branch from `main`. - **Older `--model` lists:** ja/uk/vi/zh INDEX have pre-5.x lists (e.g. "Sonnet 4.6, Opus 4.7, Haiku 4.5"). That isn't the English sentence, so it belongs to a locale sync. ## Follow-ups - **LEARNING-ROADMAP `/effort` line (review r3 N13):** line 368 can read as if `/effort` applies only to the models that always use extended thinking; per model-config's effort table it also works on Opus 5, Sonnet 5 and Opus 4.8. Not wrong; clarify in the next pass. - **Compatible Models scope (review S3):** Opus 4.6 is Microsoft Foundry's current `opus`, and Sonnet 4.5 is the current `sonnet` on Bedrock, Google Cloud's Agent Platform and Foundry (deprecated, retiring Nov 30, 2026), per model-config's alias table. Both are still in use, so either add them to the FAQ and every footer (Sonnet 4.5 marked deprecated), or define the list's scope in STYLE_GUIDE (e.g. the models the aliases resolve to on the Anthropic API plus older models in active use) and cite the deprecations table. - **Model order (review N8):** the list puts Opus 4.8 after Sonnet 4.6. Grouping by family (Fable, Opus 5.5/5/4.8, Sonnet, Haiku) would read better; the order is shared by STYLE_GUIDE, the FAQ and every footer, so change it everywhere at once. - **Example plugins:** the follow-up issue proposed above. ## Validation - `SKIP=mermaid,vietnamese-mermaid,japanese-mermaid,korean-mermaid,persian-mermaid pre-commit run --files <338 changed files>`: every hook passes, including link-check (246 URLs per language). The Mermaid hooks can't install here (`language: node must have package.json or additional_dependencies`, the same failure #247 reported). `python scripts/check_mermaid.py --strict` was run directly instead: Pele 1.6.0 rendered all 416 blocks. - `python scripts/check_cross_references.py`: all valid (674 files). - Review fix round 1 (18 files): the same `pre-commit run --files` passes every hook (Mermaid hooks skipped as above; no Mermaid block was touched), and the cross-reference check is still valid after merging `main`. - Review fix round 2 (14 files: the extended-thinking wording in all 7 LEARNING-ROADMAP files, the dontAsk line in all 7 INDEX files): `pre-commit run --files` passes every hook (Mermaid hooks skipped; no Mermaid block touched), and the cross-reference check is valid (674 files) after merging `main` again (#257). - Pre-push secret scan: it flagged `06-hooks/README.md:1683` (en, fa, vi), a false positive. The `sk-…{20,}` pattern matches the docs anchor `hooks#pretooluse-ask-decisions-in-auto-mode`, which has been on `main` since11b2ae3(en),c2f92c8(fa) and8de1820(vi), and is not on a line this PR changes. The PR's added lines have no secret-pattern matches. Closes #256
51 KiB
Memory Guide
Memory enables Claude to retain context across sessions and conversations. It exists in two forms: automatic synthesis in claude.ai, and filesystem-based CLAUDE.md in Claude Code.
Overview
Memory in Claude Code provides persistent context that carries across multiple sessions and conversations. Unlike temporary context windows, memory files allow you to:
- Share project standards across your team
- Store personal development preferences
- Maintain directory-specific rules and configurations
- Import external documentation
- Version control memory as part of your project
The memory system operates at multiple levels, from global personal preferences down to specific subdirectories, allowing for fine-grained control over what Claude remembers and how it applies that knowledge.
Memory Commands Quick Reference
| Command | Purpose | Usage | When to Use |
|---|---|---|---|
/init |
Initialize project memory | /init |
Starting new project, first-time CLAUDE.md setup |
/memory |
Edit memory files in editor | /memory |
Extensive updates, reorganization, reviewing content |
# prefix |
— | Use /memory or ask conversationally instead |
|
@path/to/file |
Import external content | @README.md or @docs/api.md |
Referencing existing documentation in CLAUDE.md |
Quick Start: Initializing Memory
The /init Command
The /init command is the fastest way to set up project memory in Claude Code. It initializes a CLAUDE.md file with foundational project documentation.
Usage:
/init
What it does:
- Creates a new CLAUDE.md file in your project (typically at
./CLAUDE.mdor./.claude/CLAUDE.md) - Establishes project conventions and guidelines
- Sets up the foundation for context persistence across sessions
- Provides a template structure for documenting your project standards
Enhanced interactive mode: Set CLAUDE_CODE_NEW_INIT=1 to enable a multi-phase interactive flow that walks you through project setup step by step:
CLAUDE_CODE_NEW_INIT=1 claude
/init
When to use /init:
- Starting a new project with Claude Code
- Establishing team coding standards and conventions
- Creating documentation about your codebase structure
- Setting up memory hierarchy for collaborative development
Example workflow:
# In your project directory
/init
# Claude creates CLAUDE.md with structure like:
# Project Configuration
## Project Overview
- Name: Your Project
- Tech Stack: [Your technologies]
- Team Size: [Number of developers]
## Development Standards
- Code style preferences
- Testing requirements
- Git workflow conventions
Quick Memory Updates
Note
: The
#shortcut for inline memory was discontinued. Use/memoryto edit memory files directly, or ask Claude conversationally to remember something (e.g., "remember that we always use TypeScript strict mode").
The recommended ways to add information to memory are:
Option 1: Use /memory command
/memory
Opens your memory files in your system editor for direct editing.
Option 2: Ask conversationally
Remember that we always use TypeScript strict mode in this project.
Please add to memory: prefer async/await over promise chains.
Asking Claude to remember something saves it to auto memory. To change CLAUDE.md instead, say "add this to CLAUDE.md", or edit the file yourself with /memory.
Historical reference (no longer functional):
The # prefix shortcut previously allowed adding rules inline:
# Always use TypeScript strict mode in this project ← no longer works
If you relied on this pattern, switch to the /memory command or conversational requests.
The /memory Command
The /memory command provides direct access to edit your CLAUDE.md memory files within Claude Code sessions. It opens your memory files in your system editor for comprehensive editing. When the file opens in a GUI editor, the session no longer blocks while the file stays open, so you can keep working in parallel (v2.1.216); terminal editors like Vim still take over the terminal until you exit.
Usage:
/memory
What it does:
- Opens your memory files in your system's default editor
- Allows you to make extensive additions, modifications, and reorganizations
- Provides direct access to all memory files in the hierarchy
- Enables you to manage persistent context across sessions
When to use /memory:
- Reviewing existing memory content
- Making extensive updates to project standards
- Reorganizing memory structure
- Adding detailed documentation or guidelines
- Maintaining and updating memory as your project evolves
Comparison: /memory vs /init
| Aspect | /memory |
/init |
|---|---|---|
| Purpose | Edit existing memory files | Initialize new CLAUDE.md |
| When to use | Update/modify project context | Begin new projects |
| Action | Opens editor for changes | Generates starter template |
| Workflow | Ongoing maintenance | One-time setup |
Example workflow:
# Open memory for editing
/memory
# Claude presents options:
# 1. Managed Policy Memory
# 2. Project Memory (./CLAUDE.md)
# 3. User Memory (~/.claude/CLAUDE.md)
# 4. Local Project Memory
# Choose option 2 (Project Memory)
# Your default editor opens with ./CLAUDE.md content
# Make changes, save, and close editor
# Claude automatically reloads the updated memory
Using Memory Imports:
CLAUDE.md files support the @path/to/file syntax to include external content:
# Project Documentation
See @README.md for project overview
See @package.json for available npm commands
See @docs/architecture.md for system design
# Import from home directory using absolute path
@~/.claude/my-project-instructions.md
Import features:
- Both relative and absolute paths are supported (e.g.,
@docs/api.mdor@~/.claude/my-project-instructions.md) - Recursive imports are supported with a maximum depth of 4 hops
- First-time imports from external locations trigger an approval dialog for security
- Import directives are not evaluated inside markdown code spans or code blocks (so documenting them in examples is safe)
- Helps avoid duplication by referencing existing documentation
- Automatically includes referenced content in Claude's context
Memory Architecture
Memory in Claude Code follows a hierarchical system where different scopes serve different purposes. Unlike Claude Web/Desktop's 24-hour synthesis cycle (see Memory in Claude Web/Desktop below), Claude Code has two memory systems that both load at the start of every session and update continuously, not on a timer:
graph TB
A["Session Start"]
B["CLAUDE.md Files<br/>(you write)"]
C["Auto Memory<br/>(Claude writes)"]
D["Claude Session"]
E["Your Correction /<br/>Preference"]
B -->|loaded in full| A
C -->|MEMORY.md loaded| A
A --> D
D -->|"Remember that..."| E
E -->|writes during session| C
D -->|"add this to CLAUDE.md"| B
Memory Hierarchy in Claude Code
Claude Code has two complementary memory systems, both loaded at the start of every conversation: CLAUDE.md files (instructions you write) and auto memory (notes Claude writes itself). CLAUDE.md files are concatenated into context rather than overriding each other — this is not a strict precedence chain where a higher tier replaces a lower one. .claude/rules/*.md files are a separate, related mechanism for topic- or path-scoped instructions.
CLAUDE.md file locations, in load order (broadest scope to most specific):
| Scope | Location | Purpose |
|---|---|---|
| Managed policy | macOS: /Library/Application Support/ClaudeCode/CLAUDE.mdLinux/WSL: /etc/claude-code/CLAUDE.mdWindows: C:\Program Files\ClaudeCode\CLAUDE.md |
Organization-wide instructions managed by IT/DevOps. Managed CLAUDE.md loads first and can't be skipped with claudeMdExcludes, but a session started with CLAUDE.md loading turned off doesn't load it either — enforce hard rules with managed permissions.deny. |
| User instructions | ~/.claude/CLAUDE.md |
Personal preferences for all projects |
| Project instructions | ./CLAUDE.md or ./.claude/CLAUDE.md |
Team-shared instructions, version controlled. Since v2.1.277, ./AGENTS.md loads at this same tier instead, when no CLAUDE.md or CLAUDE.local.md exists at or above the working directory — controlled by Project instructions in /config |
| Local instructions | ./CLAUDE.local.md |
Personal project-specific preferences; add to .gitignore |
Within the directory tree, Claude Code walks up from your working directory: foo/CLAUDE.md loads before foo/bar/CLAUDE.md if you launch from foo/bar/, so instructions closer to where you launched are read last — not "highest priority" in an override sense, just most recent in context. Within each directory, CLAUDE.local.md is appended after CLAUDE.md. CLAUDE.md and CLAUDE.local.md files in subdirectories under your working directory load on demand, when Claude reads files in those subdirectories, rather than at launch. Since v2.1.309, an on-demand file over a per-file size limit loads only its start, ending with a note telling Claude to Read the rest. This covers subdirectory CLAUDE.md/CLAUDE.local.md and their @ imports, rules in a subdirectory's .claude/rules/, and path-scoped rules in .claude/rules/ or ~/.claude/rules/. The limit is 40,000 characters with a 200K context window. With a 1M window it is 200,000 characters on Opus 4.6 and Sonnet 4.6, and 150,000 on later models. Check a file with wc -m path/to/CLAUDE.md.
Organizations can also put managed CLAUDE.md content directly inside managed-settings.json via the claudeMd key, instead of deploying a separate file. This is honored only in managed/policy settings — setting claudeMd in user or project settings has no effect.
.claude/rules/*.md — modular, topic-specific instructions, optionally scoped to file paths via paths frontmatter. Rules without a paths field load unconditionally with the same priority as .claude/CLAUDE.md; path-scoped rules load on demand when Claude reads, writes, or edits a matching file — including viewing it with a single-file Bash read such as cat, head, tail, sed -n, or grep (Write/Edit since v2.1.288, Bash reads since v2.1.293). User-level rules (~/.claude/rules/) load before project rules. Each paths pattern is relative to the rule's base directory: for project rules, the directory that contains the rule's .claude folder; for user-level rules, the session's primary working directory. To have path-scoped rules load for files in a sibling git worktree, start Claude Code in that worktree or move the session there with /cd.
Auto memory (~/.claude/projects/<project>/memory/) is a separate system: Claude's own notes, not CLAUDE.md content, and not part of the concatenation order above. See Auto Memory below.
Note
:
CLAUDE.local.mdis fully supported and documented in the official documentation. It provides personal project-specific preferences that are not committed to version control. AddCLAUDE.local.mdto your.gitignore.
Memory Discovery Behavior:
graph TD
A["Managed Policy<br/>/Library/.../ClaudeCode/CLAUDE.md"] -->|loads first| B["User Instructions<br/>~/.claude/CLAUDE.md"]
B --> C["Project Instructions<br/>./CLAUDE.md or ./.claude/CLAUDE.md"]
C --> D["Local Instructions<br/>./CLAUDE.local.md"]
C -->|imports| H["@docs/architecture.md"]
H -->|imports| I["@docs/api-standards.md"]
style A fill:#fce4ec,stroke:#333,color:#333
style B fill:#f3e5f5,stroke:#333,color:#333
style C fill:#e1f5fe,stroke:#333,color:#333
style D fill:#e8f5e9,stroke:#333,color:#333
style H fill:#e1f5fe,stroke:#333,color:#333
style I fill:#e1f5fe,stroke:#333,color:#333
All files shown are concatenated into one context, not selected by override — later boxes appear later in context, not "instead of" earlier ones.
AGENTS.md
AGENTS.md is a cross-tool project-context file: the same category of document as CLAUDE.md, written so that several coding agents can share one set of project conventions. Since v2.1.277, Claude Code reads it directly as project instructions rather than requiring you to import it.
Default behavior (claude-md-or-agents-md):
| What the project contains | What Claude Code reads |
|---|---|
AGENTS.md, no CLAUDE.md |
AGENTS.md |
Both AGENTS.md and CLAUDE.md |
CLAUDE.md only |
A CLAUDE.md that imports AGENTS.md with @AGENTS.md |
CLAUDE.md, with the import expanded |
Which files suppress AGENTS.md. Claude Code checks the working directory and every directory above it for CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md. If it finds any of them, AGENTS.md is not read. ~/.claude/CLAUDE.md, managed CLAUDE.md, and .claude/rules/ do not count for this check and keep loading alongside whichever project file wins.
Warning
: adding a
CLAUDE.local.mdsilently stopsAGENTS.mdbeing read. If your project instructions seem to vanish after you create a local override, this is usually why.
What gets read. Every AGENTS.md and .claude/AGENTS.md at and above the working directory loads at session start; files in subdirectories load on demand, when Claude reads files there. @path imports expand the same way they do in CLAUDE.md, and claudeMdExcludes applies.
What is never read: AGENTS.local.md, AGENTS.override.md, and anything under .agents/.
Choosing the behavior. The Project instructions setting takes four values:
| Value | Effect |
|---|---|
claude-md-or-agents-md |
Default — AGENTS.md only when no CLAUDE.md file is found |
claude-md-and-agents-md |
Both are read when both exist |
claude-md |
Only CLAUDE.md files; AGENTS.md is ignored |
managed-only |
Only managed policy instructions |
Set it through /config, or in settings:
{
"pluginConfigs": {
"agents-md@builtin": {
"options": {
"instructionFiles": "claude-md-and-agents-md"
}
}
}
}
This key is honored in user and managed settings only — setting it in project or local settings has no effect.
Where direct reading is unavailable. On versions before v2.1.277 (or before v2.1.281 on Bedrock/Vertex/Foundry, behind LLM gateways, or with telemetry disabled), during the first session after upgrading, or with the built-in agents-md plugin disabled, Claude Code will not pick up AGENTS.md on its own. In those cases, import it from CLAUDE.md:
@AGENTS.md
Excluding CLAUDE.md Files with claudeMdExcludes
In large monorepos, some CLAUDE.md files may be irrelevant to your current work. The claudeMdExcludes setting lets you skip specific CLAUDE.md files so they are not loaded into context:
// In ~/.claude/settings.json or .claude/settings.json
{
"claudeMdExcludes": [
"**/packages/legacy-app/CLAUDE.md",
"**/vendors/**/CLAUDE.md"
]
}
Patterns are matched against absolute file paths using glob syntax, so start repo-relative patterns with **/. This is particularly useful for:
- Monorepos with many sub-projects, where only some are relevant
- Repositories that contain vendored or third-party CLAUDE.md files
- Reducing noise in Claude's context window by excluding stale or unrelated instructions
Settings File Hierarchy
Claude Code settings (including autoMemoryDirectory, claudeMdExcludes, and other configuration) resolve by precedence — unlike CLAUDE.md files above, settings genuinely override rather than concatenate. When the same setting appears in multiple scopes, the higher level wins:
| Level | Location | Scope |
|---|---|---|
| 1 (Highest) | Managed — managed-settings.json, plist/registry, or server-managed |
Organization-wide enforcement; cannot be overridden |
| 2 | Command line arguments | Temporary session overrides |
| 3 | .claude/settings.local.json |
Local overrides (git-ignored) |
| 4 | .claude/settings.json |
Project-level (committed to git) |
| 5 (Lowest) | ~/.claude/settings.json |
User preferences |
Managed settings also support a drop-in directory, managed-settings.d/, alongside managed-settings.json: the base file merges first, then *.json files in the drop-in directory merge on top in alphabetical order (scalars override, arrays concatenate and de-duplicate, objects deep-merge). This lets separate teams deploy independent policy fragments without editing a shared file. Note this is a settings.json mechanism, not a CLAUDE.md one — it doesn't apply to the CLAUDE.md file locations described above.
Permission rules (allow/ask/deny) behave differently from other settings: they merge across scopes instead of the higher level replacing the lower one.
Platform-specific configuration (v2.1.51+):
Settings can also be configured via:
- macOS: Property list (plist) files
- Windows: Windows Registry
These platform-native mechanisms are read alongside JSON settings files and follow the same precedence rules.
Note (v2.1.119):
/configchanges now persist to~/.claude/settings.json. Values written via/configparticipate in the normal policy/local/project precedence chain described above — they are no longer session-only. Use/configfor interactive edits and editsettings.jsonfiles directly for scripted or managed configuration.
Retention and Cleanup Settings
| Setting | Type | Default | Description |
|---|---|---|---|
cleanupPeriodDays |
integer (days) | 30 | Retention window for session transcripts and other application data under ~/.claude/, including file-history/ (checkpoint snapshots), plans/, debug/, tasks/, shell-snapshots/, and backups/. There is no ~/.claude/checkpoints/ folder. Files older than the window are pruned at startup. |
// ~/.claude/settings.json
{
"cleanupPeriodDays": 14
}
Attribution, Voice, and PR URL Settings
| Setting | Type | Description |
|---|---|---|
attribution.commit |
string | Text appended to commits Claude creates (by default, the Co-Authored-By: Claude trailer); "" hides it. Replaces the deprecated includeCoAuthoredBy flag. |
attribution.pr |
string | Text appended to pull request descriptions Claude creates; "" hides it. Replaces the deprecated includeCoAuthoredBy flag for PRs. |
attribution.sessionUrl |
boolean | Omit the claude.ai session link from commits and PRs created in web and Remote Control sessions (v2.1.183+). |
voice.enabled |
boolean | Enables push-to-talk voice dictation (/voice). Replaces the deprecated voiceEnabled flag. |
prUrlTemplate |
string | New in v2.1.119. Custom URL template for the footer PR badge; useful for GitLab, Bitbucket, or internal code-review platforms. Supports {host}, {owner}, {repo}, {number}, and {url} placeholders; GitLab merge request links stay unchanged. |
// ~/.claude/settings.json
{
"attribution": {
"commit": "",
"pr": ""
},
"voice": {
"enabled": true
},
"prUrlTemplate": "https://reviews.example.com/{owner}/{repo}/pull/{number}"
}
An empty string ("") hides that attribution; "attribution": false hides all of it (v2.1.281+).
Deprecated setting names
The following legacy setting keys still work but are deprecated. Prefer the replacements above.
| Deprecated key | Replacement | Notes |
|---|---|---|
includeCoAuthoredBy |
attribution.commit / attribution.pr |
The old single flag is split into separate commit and PR switches. Users on older installs can keep the legacy key; new projects should use the nested form. |
voiceEnabled |
voice.enabled |
Grouped under the voice namespace alongside future voice-related options. |
Modular Rules System
Create organized, path-specific rules using the .claude/rules/ directory structure. Rules can be defined at both the project level and user level:
your-project/
├── .claude/
│ ├── CLAUDE.md
│ └── rules/
│ ├── code-style.md
│ ├── testing.md
│ ├── security.md
│ └── api/ # Subdirectories supported
│ ├── conventions.md
│ └── validation.md
~/.claude/
├── CLAUDE.md
└── rules/ # User-level rules (all projects)
├── personal-style.md
└── preferred-patterns.md
Rules are discovered recursively within the rules/ directory, including any subdirectories. User-level rules at ~/.claude/rules/ are loaded before project-level rules, allowing personal defaults that projects can override.
Path-Specific Rules with YAML Frontmatter
Define rules that apply only to specific file paths:
---
paths: src/api/**/*.ts
---
# API Development Rules
- All API endpoints must include input validation
- Use Zod for schema validation
- Document all parameters and response types
- Include error handling for all operations
Glob Pattern Examples:
**/*.ts- All TypeScript filessrc/**/*- All files under src/src/**/*.{ts,tsx}- Multiple extensions{src,lib}/**/*.ts, tests/**/*.test.ts- Multiple patterns
Subdirectories and Symlinks
Rules in .claude/rules/ support two organizational features:
- Subdirectories: Rules are discovered recursively, so you can organize them into topic-based folders (e.g.,
rules/api/,rules/testing/,rules/security/) - Symlinks: Symlinks are supported for sharing rules across multiple projects. For example, you can symlink a shared rule file from a central location into each project's
.claude/rules/directory. Since v2.1.284, a rule symlinked from outside the project — or a.claudedirectory symlinked from outside — shows the same external-imports approval prompt as an@pathimport
Memory Locations Table
CLAUDE.md files and rules are concatenated into context, not selected by strict override — "Load order" below means where in context it appears, not which one wins. Auto memory is a separate mechanism with its own storage location.
| Location | Type | Load order | Shared | Access | Best For |
|---|---|---|---|---|---|
/Library/Application Support/ClaudeCode/CLAUDE.md (macOS) |
Managed Policy | 1st (loads first) | Organization | System | Company-wide policies |
/etc/claude-code/CLAUDE.md (Linux/WSL) |
Managed Policy | 1st (loads first) | Organization | System | Organization standards |
C:\Program Files\ClaudeCode\CLAUDE.md (Windows) |
Managed Policy | 1st (loads first) | Organization | System | Corporate guidelines |
~/.claude/rules/*.md |
User Rules | 2nd | Individual | Filesystem | Personal rules (all projects) |
~/.claude/CLAUDE.md |
User Memory | 3rd | Individual | Filesystem | Personal preferences (all projects) |
./.claude/rules/*.md |
Project Rules | 4th | Team | Git | Path-specific, modular rules |
./CLAUDE.md or ./.claude/CLAUDE.md |
Project Memory | 5th | Team | Git | Team standards, shared architecture |
./CLAUDE.local.md |
Project Local | 6th (loads last) | Individual | Git (ignored) | Personal project-specific preferences |
~/.claude/projects/<project>/memory/ |
Auto Memory | N/A — separate mechanism | Individual | Filesystem | Claude's automatic notes and learnings |
Memory Update Lifecycle
Here's how memory updates flow through your Claude Code sessions:
sequenceDiagram
participant User
participant Claude as Claude Code
participant Editor as File System
participant Memory as CLAUDE.md
User->>Claude: "Add async/await rule to CLAUDE.md"
Claude->>User: "Which memory file?"
User->>Claude: "Project memory"
Claude->>Editor: Open ./CLAUDE.md
Claude->>Memory: Write to ./CLAUDE.md
Memory-->>Claude: File saved
Claude->>Claude: Load updated memory
Claude-->>User: "Memory saved!"
Auto Memory
Auto memory is a persistent directory where Claude automatically saves typed notes (user, feedback, project, reference) as it works with your project. It skips anything it can derive from the codebase, such as architecture, file paths, or debugging fixes. Unlike CLAUDE.md files which you write and maintain manually, auto memory is written by Claude itself during sessions.
How Auto Memory Works
- Location:
~/.claude/projects/<project>/memory/ - Entrypoint:
MEMORY.mdserves as the main file in the auto memory directory - Topic files: Optional additional files, one per memory (e.g.,
prefers-pnpm.md,release-checklist.md) - Loading behavior: The first 200 lines of
MEMORY.md(or first 25KB, whichever comes first) are loaded into context at session start. Topic files are loaded on demand, not at startup. - Read/write: Claude reads and writes memory files during sessions as it learns your preferences, feedback, and project context
- Frontmatter: Files that begin with YAML frontmatter get a
modifiedfield — an ISO 8601 timestamp Claude Code records each time it writes the file (v2.1.214)
Auto Memory Architecture
graph TD
A["Claude Session Starts"] --> B["Load MEMORY.md<br/>(first 200 lines / 25KB)"]
B --> C["Session Active"]
C --> D["Claude learns<br/>preferences & feedback"]
D --> E{"Write to<br/>auto memory"}
E -->|General notes| F["MEMORY.md"]
E -->|Topic-specific| G["prefers-pnpm.md"]
E -->|Topic-specific| H["release-checklist.md"]
C --> I["On-demand load<br/>topic files"]
I --> C
style A fill:#e1f5fe,stroke:#333,color:#333
style B fill:#e1f5fe,stroke:#333,color:#333
style C fill:#e8f5e9,stroke:#333,color:#333
style D fill:#f3e5f5,stroke:#333,color:#333
style E fill:#fff3e0,stroke:#333,color:#333
style F fill:#fce4ec,stroke:#333,color:#333
style G fill:#fce4ec,stroke:#333,color:#333
style H fill:#fce4ec,stroke:#333,color:#333
style I fill:#f3e5f5,stroke:#333,color:#333
Auto Memory Directory Structure
~/.claude/projects/<project>/memory/
├── MEMORY.md # Entrypoint (first 200 lines / 25KB loaded at startup)
├── prefers-pnpm.md # Topic file (loaded on demand)
├── release-checklist.md # Topic file (loaded on demand)
└── team-contacts.md # Topic file (loaded on demand)
Version Requirement
Auto memory requires Claude Code v2.1.59 or later. If you are on an older version, upgrade first:
npm install -g @anthropic-ai/claude-code@latest
Note
: On npm 12, which skips Claude Code's postinstall step by default, this command ends with
Error: claude native binary not installed.Switch to the native installer or follow Fix an npm 12 install.
Turning Auto Memory On or Off
Auto memory is on by default. The autoMemoryEnabled setting (default true) controls it; when false, Claude neither reads from nor writes to the auto memory directory. You can also toggle it with /memory during a session.
{
"autoMemoryEnabled": false
}
To disable it via environment instead, set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1. Setting it to 0 forces auto memory on even when --bare mode or autoMemoryEnabled: false would otherwise disable it.
Custom Auto Memory Directory
By default, auto memory is stored in ~/.claude/projects/<project>/memory/. You can change this location using the autoMemoryDirectory setting (available since v2.1.74):
// In any settings file: user, project, local, or managed policy
{
"autoMemoryDirectory": "/path/to/custom/memory/directory"
}
Note
:
autoMemoryDirectoryis read from any settings scope: user, project, local, managed policy, or--settings. The value must be an absolute path or start with~/.
This is useful when you want to:
- Store auto memory in a shared or synced location
- Separate auto memory from the default Claude configuration directory
- Use a project-specific path outside the default hierarchy
Worktree and Repository Sharing
All worktrees and subdirectories within the same git repository share a single auto memory directory. This means switching between worktrees or working in different subdirectories of the same repo will read and write to the same memory files.
Subagent Memory
Subagents (spawned via the Agent tool) can keep their own persistent memory. The memory frontmatter field in the subagent definition picks where that memory directory lives:
memory: user # ~/.claude/agent-memory/<agent-name>/
memory: project # .claude/agent-memory/<agent-name>/ (shareable via git)
memory: local # .claude/agent-memory-local/<agent-name>/ (not checked in)
The subagent reads the first 200 lines / 25KB of that directory's MEMORY.md at startup and gets Read/Write/Edit to maintain it. It has no effect when auto memory is disabled.
Note
: Subagents can also maintain their own auto memory. See the official subagent memory documentation for details.
Controlling Auto Memory
Auto memory can be controlled via the CLAUDE_CODE_DISABLE_AUTO_MEMORY environment variable:
| Value | Behavior |
|---|---|
0 |
Force auto memory on |
1 |
Force auto memory off |
| (unset) | Default behavior (auto memory enabled) |
# Disable auto memory for a session
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 claude
# Force auto memory on explicitly
CLAUDE_CODE_DISABLE_AUTO_MEMORY=0 claude
Additional Directories with --add-dir
The --add-dir flag allows Claude Code to load CLAUDE.md files from additional directories beyond the current working directory. This is useful for monorepos or multi-project setups where context from other directories is relevant.
To enable this feature, set the environment variable:
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1
Then launch Claude Code with the flag:
claude --add-dir /path/to/other/project
Claude will load CLAUDE.md from the specified additional directory alongside the memory files from your current working directory.
Practical Examples
Example 1: Project Memory Structure
File: ./CLAUDE.md
# Project Configuration
## Project Overview
- **Name**: E-commerce Platform
- **Tech Stack**: Node.js, PostgreSQL, React 18, Docker
- **Team Size**: 5 developers
- **Deadline**: Q4 2025
## Architecture
@docs/architecture.md
@docs/api-standards.md
@docs/database-schema.md
## Development Standards
### Code Style
- Use Prettier for formatting
- Use ESLint with airbnb config
- Maximum line length: 100 characters
- Use 2-space indentation
### Naming Conventions
- **Files**: kebab-case (user-controller.js)
- **Classes**: PascalCase (UserService)
- **Functions/Variables**: camelCase (getUserById)
- **Constants**: UPPER_SNAKE_CASE (API_BASE_URL)
- **Database Tables**: snake_case (user_accounts)
### Git Workflow
- Branch names: `feature/description` or `fix/description`
- Commit messages: Follow conventional commits
- PR required before merge
- All CI/CD checks must pass
- Minimum 1 approval required
### Testing Requirements
- Minimum 80% code coverage
- All critical paths must have tests
- Use Jest for unit tests
- Use Cypress for E2E tests
- Test filenames: `*.test.ts` or `*.spec.ts`
### API Standards
- RESTful endpoints only
- JSON request/response
- Use HTTP status codes correctly
- Version API endpoints: `/api/v1/`
- Document all endpoints with examples
### Database
- Use migrations for schema changes
- Never hardcode credentials
- Use connection pooling
- Enable query logging in development
- Regular backups required
### Deployment
- Docker-based deployment
- Kubernetes orchestration
- Blue-green deployment strategy
- Automatic rollback on failure
- Database migrations run before deploy
## Common Commands
| Command | Purpose |
|---------|---------|
| `npm run dev` | Start development server |
| `npm test` | Run test suite |
| `npm run lint` | Check code style |
| `npm run build` | Build for production |
| `npm run migrate` | Run database migrations |
## Team Contacts
- Tech Lead: Sarah Chen (@sarah.chen)
- Product Manager: Mike Johnson (@mike.j)
- DevOps: Alex Kim (@alex.k)
## Known Issues & Workarounds
- PostgreSQL connection pooling limited to 20 during peak hours
- Workaround: Implement query queuing
- Safari 14 compatibility issues with async generators
- Workaround: Use Babel transpiler
## Related Projects
- Analytics Dashboard: `/projects/analytics`
- Mobile App: `/projects/mobile`
- Admin Panel: `/projects/admin`
Example 2: Directory-Specific Memory
File: ./src/api/CLAUDE.md
# API Module Standards
This file supplements root CLAUDE.md for everything in /src/api/. Memory files are
concatenated, not overridden — the root CLAUDE.md still applies, and Claude Code
loads this file on demand when it reads, writes, or edits files in this subtree.
## API-Specific Standards
### Request Validation
- Use Zod for schema validation
- Always validate input
- Return 400 with validation errors
- Include field-level error details
### Authentication
- All endpoints require JWT token
- Token in Authorization header
- Token expires after 24 hours
- Implement refresh token mechanism
### Response Format
All responses must follow this structure:
```json
{
"success": true,
"data": { /* actual data */ },
"timestamp": "2025-11-06T10:30:00Z",
"version": "1.0"
}
```
Error responses:
```json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "User message",
"details": { /* field errors */ }
},
"timestamp": "2025-11-06T10:30:00Z"
}
```
### Pagination
- Use cursor-based pagination (not offset)
- Include `hasMore` boolean
- Limit max page size to 100
- Default page size: 20
### Rate Limiting
- 1000 requests per hour for authenticated users
- 100 requests per hour for public endpoints
- Return 429 when exceeded
- Include retry-after header
### Caching
- Use Redis for session caching
- Cache duration: 5 minutes default
- Invalidate on write operations
- Tag cache keys with resource type
Example 3: Personal Memory
File: ~/.claude/CLAUDE.md
# My Development Preferences
## About Me
- **Experience Level**: 8 years full-stack development
- **Preferred Languages**: TypeScript, Python
- **Communication Style**: Direct, with examples
- **Learning Style**: Visual diagrams with code
## Code Preferences
### Error Handling
I prefer explicit error handling with try-catch blocks and meaningful error messages.
Avoid generic errors. Always log errors for debugging.
### Comments
Use comments for WHY, not WHAT. Code should be self-documenting.
Comments should explain business logic or non-obvious decisions.
### Testing
I prefer TDD (test-driven development).
Write tests first, then implementation.
Focus on behavior, not implementation details.
### Architecture
I prefer modular, loosely-coupled design.
Use dependency injection for testability.
Separate concerns (Controllers, Services, Repositories).
## Debugging Preferences
- Use console.log with prefix: `[DEBUG]`
- Include context: function name, relevant variables
- Use stack traces when available
- Always include timestamps in logs
## Communication
- Explain complex concepts with diagrams
- Show concrete examples before explaining theory
- Include before/after code snippets
- Summarize key points at the end
## Project Organization
I organize my projects as:
project/
├── src/
│ ├── api/
│ ├── services/
│ ├── models/
│ └── utils/
├── tests/
├── docs/
└── docker/
## Tooling
- **IDE**: VS Code with vim keybindings
- **Terminal**: Zsh with Oh-My-Zsh
- **Format**: Prettier (100 char line length)
- **Linter**: ESLint with airbnb config
- **Test Framework**: Jest with React Testing Library
My Test Ask Claude to save a new rule
Claude has not save the rule because I did not have any Claude.md file anywhere. Then asked Claude to confirm the location.
Example 4: Memory Update During Session
You can add new rules to CLAUDE.md during an active Claude Code session by asking Claude directly (asking it to remember something saves to auto memory instead):
User: Add this to CLAUDE.md: I prefer using React hooks instead of class components
for all new components.
Claude: I'm adding that to your memory. Which memory file should this go in?
1. Project memory (./CLAUDE.md)
2. Personal memory (~/.claude/CLAUDE.md)
User: Project memory
Claude: ✅ Memory saved!
Added to ./CLAUDE.md:
---
### Component Development
- Use functional components with React Hooks
- Prefer hooks over class components
- Custom hooks for reusable logic
- Use useCallback for event handlers
- Use useMemo for expensive computations
Or use /memory to edit memory files directly for extensive updates or reorganization.
Tips for Adding Memory
- Be specific and actionable in your rules
- Group related rules together under a section header
- Update existing sections instead of duplicating content
- Choose the appropriate memory scope (project vs. personal)
Memory Features Comparison
| Feature | Claude Web/Desktop | Claude Code (CLAUDE.md) |
|---|---|---|
| Auto-synthesis | ✅ Every 24h | ✅ Auto memory |
| Cross-project | ✅ Shared | ❌ Project-specific |
| Team access | ✅ Shared projects | ✅ Git-tracked |
| Searchable | ✅ Built-in | ✅ Through /memory |
| Editable | ✅ In-chat | ✅ Direct file edit |
| Import/Export | ✅ Yes | ✅ Copy/paste |
| Persistent | ✅ 24h+ | ✅ Indefinite |
Memory in Claude Web/Desktop
Memory Synthesis Timeline
graph LR
A["Day 1: User<br/>Conversations"] -->|24 hours| B["Day 2: Memory<br/>Synthesis"]
B -->|Automatic| C["Memory Updated<br/>Summarized"]
C -->|Loaded in| D["Day 2-N:<br/>New Conversations"]
D -->|Add to| E["Memory"]
E -->|24 hours later| F["Memory Refreshed"]
Example Memory Summary:
## Claude's Memory of User
### Professional Background
- Senior full-stack developer with 8 years experience
- Focus on TypeScript/Node.js backends and React frontends
- Active open source contributor
- Interested in AI and machine learning
### Project Context
- Currently building e-commerce platform
- Tech stack: Node.js, PostgreSQL, React 18, Docker
- Working with team of 5 developers
- Using CI/CD and blue-green deployments
### Communication Preferences
- Prefers direct, concise explanations
- Likes visual diagrams and examples
- Appreciates code snippets
- Explains business logic in comments
### Current Goals
- Improve API performance
- Increase test coverage to 90%
- Implement caching strategy
- Document architecture
Best Practices
Do's - What To Include
-
Be specific and detailed: Use clear, detailed instructions rather than vague guidance
- ✅ Good: "Use 2-space indentation for all JavaScript files"
- ❌ Avoid: "Follow best practices"
-
Keep organized: Structure memory files with clear markdown sections and headings
-
Use appropriate hierarchy levels:
- Managed policy: Company-wide policies, security standards, compliance requirements
- Project memory: Team standards, coding conventions, and decisions Claude can't read from the code (commit to git)
- User memory: Personal preferences, communication style, tooling choices
- Directory memory: Module-specific rules and overrides
-
Leverage imports: Use
@path/to/filesyntax to reference existing documentation- Supports a maximum depth of 4 hops for recursive imports
- Avoids duplication across memory files
- Example:
See @README.md for project overview
-
Document frequent commands: Include commands you use repeatedly to save time
-
Version control project memory: Commit project-level CLAUDE.md files to git for team benefit
-
Review periodically: Update memory regularly as projects evolve and requirements change
-
Provide concrete examples: Include code snippets and specific scenarios
Don'ts - What To Avoid
-
Don't store secrets: Never include API keys, passwords, tokens, or credentials
-
Don't include sensitive data: No PII, private information, or proprietary secrets
-
Don't duplicate content: Use imports (
@path) to reference existing documentation instead -
Don't describe what Claude can read itself: Skip architecture overviews and file layouts, because Claude reads the repo. Don't add IMPORTANT or ALL CAPS to a line Claude keeps missing either: shorten the file, or turn a rule that can't bend into a hook or deny rule
-
Don't be vague: Avoid generic statements like "follow best practices" or "write good code"
-
Don't make it too long: Target under 200 lines per CLAUDE.md. Longer files at launch still load in full, but adherence drops — see Keeping CLAUDE.md small below
-
Don't over-organize: Use hierarchy strategically; don't create excessive subdirectory overrides
-
Don't forget to update: Stale memory can cause confusion and outdated practices
-
Don't exceed nesting limits: Memory imports support a maximum depth of 4 hops
Keeping CLAUDE.md Small
Anthropic's current guidance is the opposite of "put everything in CLAUDE.md". The file loads into every session, so every line you add is a line that competes for attention on tasks it has nothing to do with.
Rule of thumb: keep CLAUDE.md under 200 lines. A CLAUDE.md that loads at launch still loads in full (up to 4 MiB; Claude Code skips a larger file), but instruction adherence degrades as the file grows. Subdirectory CLAUDE.md files and path-scoped rules, which load on demand, are cut at a per-file limit (v2.1.309): see Memory Hierarchy in Claude Code.
When it starts growing, move content out rather than trimming prose:
| Content | Where it belongs | Why |
|---|---|---|
| Multi-step procedures | A skill | Loads on demand, only when relevant |
| Directory- or file-type-specific rules | .claude/rules/*.md with paths: frontmatter |
Scoped by glob; loads only when you touch matching files |
| Reference material and long examples | A skill's references/ directory |
Read only when the skill needs it |
| Things Claude should remember about you | Auto memory (on by default) | Written and loaded automatically |
Note
:
@pathimports organize a large CLAUDE.md but do not save context — imported files are pulled in at load time just the same. Splitting into path-scoped rules is what actually reduces what loads.
/doctor (v2.1.206+) inspects your configuration and proposes trims when CLAUDE.md has grown past the point of usefulness.
Don't Write Verification Reminders
Older guidance encouraged lines like "always run the tests before saying you're done" or "double-check your work". On Claude Opus 5 and Fable 5 these now cause over-verification — Claude re-checks work that was already correct, burning turns and tokens.
Anthropic removed more than 80% of Claude Code's own system prompt for the Claude 5 generation with no measured regression. The same principle applies to your CLAUDE.md: prefer stating the goal and letting Claude exercise judgment over enumerating the checks it should perform.
Delete verification reminders from existing CLAUDE.md files targeting Opus 5 or Fable 5. Keep genuinely non-obvious project requirements — "integration tests need Docker running" is information, not a reminder.
Memory Management Tips
Choose the right memory level:
| Use Case | Memory Level | Rationale |
|---|---|---|
| Company security policy | Managed Policy | Applies to all projects organization-wide |
| Team code style guide | Project | Shared with team via git |
| Your preferred editor shortcuts | User | Personal preference, not shared |
| API module standards | Directory | Specific to that module only |
Quick update workflow:
- For single rules: Use
/memoryto open editor, or ask conversationally - For multiple changes: Use
/memoryto open editor - For initial setup: Use
/initto create template
Import best practices:
# Good: Reference existing docs
@README.md
@docs/architecture.md
@package.json
# Avoid: Copying content that exists elsewhere
# Instead of copying README content into CLAUDE.md, just import it
Installation Instructions
Setup Project Memory
Method 1: Using /init Command (Recommended)
The fastest way to set up project memory:
-
Navigate to your project directory:
cd /path/to/your/project -
Run the init command in Claude Code:
/init -
Claude will create and populate CLAUDE.md with a template structure
-
Customize the generated file to match your project needs
-
Commit to git:
git add CLAUDE.md git commit -m "Initialize project memory with /init"
Method 2: Manual Creation
If you prefer manual setup:
-
Create a CLAUDE.md in your project root:
cd /path/to/your/project touch CLAUDE.md -
Add project standards:
cat > CLAUDE.md << 'EOF' # Project Configuration ## Project Overview - **Name**: Your Project Name - **Tech Stack**: List your technologies - **Team Size**: Number of developers ## Development Standards - Your coding standards - Naming conventions - Testing requirements EOF -
Commit to git:
git add CLAUDE.md git commit -m "Add project memory configuration"
Setup Personal Memory
-
Create ~/.claude directory:
mkdir -p ~/.claude -
Create personal CLAUDE.md:
touch ~/.claude/CLAUDE.md -
Add your preferences:
cat > ~/.claude/CLAUDE.md << 'EOF' # My Development Preferences ## About Me - Experience Level: [Your level] - Preferred Languages: [Your languages] - Communication Style: [Your style] ## Code Preferences - [Your preferences] EOF
Setup Directory-Specific Memory
-
Create memory for specific directories:
mkdir -p /path/to/directory/.claude touch /path/to/directory/CLAUDE.md -
Add directory-specific rules:
cat > /path/to/directory/CLAUDE.md << 'EOF' # [Directory Name] Standards This file supplements root CLAUDE.md for this directory. Memory files are concatenated, not overridden — Claude Code loads this file on demand when it reads, writes, or edits files in this directory. ## [Specific Standards] EOF -
Commit to version control:
git add /path/to/directory/CLAUDE.md git commit -m "Add [directory] memory configuration"
Verify Setup
-
Check memory locations:
# Project root memory ls -la ./CLAUDE.md # Personal memory ls -la ~/.claude/CLAUDE.md -
Claude Code will automatically load these files when starting a session
-
Test with Claude Code by starting a new session in your project
Official Documentation
For the most up-to-date information, refer to the official Claude Code documentation:
- Memory Documentation - Complete memory system reference
- Slash Commands Reference - All built-in commands including
/initand/memory - CLI Reference - Command-line interface documentation
Key Technical Details from Official Docs
Memory Loading:
- CLAUDE.md files at and above the working directory, unscoped rules, and the start of
MEMORY.mdload automatically when Claude Code launches - Claude traverses upward from the current working directory to discover CLAUDE.md files
- Subtree files are discovered and loaded contextually when accessing those directories
Import Syntax:
- Use
@path/to/fileto include external content (e.g.,@~/.claude/my-project-instructions.md) - Supports both relative and absolute paths (relative paths resolve relative to the file containing the import, not the working directory)
- Recursive imports supported with a maximum depth of 4 hops
- First-time external imports trigger an approval dialog
- Not evaluated inside markdown code spans or code blocks
- Automatically includes referenced content in Claude's context
CLAUDE.md Load Order (concatenated into context, not strict override — see Memory Hierarchy in Claude Code above):
- Managed Policy (loads first)
- User-Level Rules (
~/.claude/rules/) - User Memory
- Project Rules (
.claude/rules/) - Project Memory
- Local Project Memory (loads last)
Auto Memory is a separate mechanism (~/.claude/projects/<project>/memory/), not part of this concatenation order.
Related Concepts Links
Integration Points
- MCP Protocol - Live data access alongside memory
- Slash Commands - Session-specific shortcuts
- Skills - Automated workflows with memory context
Related Claude Features
- Claude Web Memory - Automatic synthesis
- Official Memory Docs - Anthropic documentation
Last Updated: November 1, 2026 Claude Code Version: 2.1.316 Sources:
- https://code.claude.com/docs/en/memory
- https://code.claude.com/docs/en/memory#agents-md
- https://code.claude.com/docs/en/memory#when-agents-md-support-is-unavailable
- https://github.com/anthropics/claude-code/releases/tag/v2.1.284
- https://github.com/anthropics/claude-code/releases/tag/v2.1.288
- https://github.com/anthropics/claude-code/releases/tag/v2.1.293
- https://code.claude.com/docs/en/sub-agents#enable-persistent-memory
- https://code.claude.com/docs/en/settings-reference
- https://code.claude.com/docs/en/claude-directory
- https://code.claude.com/docs/en/memory#deploy-organization-wide-claude-md
- https://code.claude.com/docs/en/memory#exclude-specific-claude-md-files
- https://code.claude.com/docs/en/changelog#2-1-309
- https://code.claude.com/docs/en/memory#claude-ignores-the-end-of-my-subdirectory-claude-md
- https://code.claude.com/docs/en/memory#how-it-works
- https://code.claude.com/docs/en/memory#path-specific-rules
- https://code.claude.com/docs/en/memory#how-claude-md-files-load
- https://code.claude.com/docs/en/troubleshoot-install#fix-an-npm-12-install
- https://code.claude.com/docs/en/best-practices Compatible Models: Claude Fable 5.2, Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, Claude Opus 5, Claude Sonnet 5.5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 5.5, Claude Haiku 4.5
