Determine memory type
Claude Code offers four memory locations in a hierarchical structure, each serving a different purpose:Memory Type | Location | Purpose | Use Case Examples | Shared With |
---|---|---|---|---|
Enterprise policy | macOS: /Library/Application Support/ClaudeCode/CLAUDE.md Linux: /etc/claude-code/CLAUDE.md Windows: C:\ProgramData\ClaudeCode\CLAUDE.md | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |
Project memory | ./CLAUDE.md or ./.claude/CLAUDE.md | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |
User memory | ~/.claude/CLAUDE.md | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |
Project memory (local) | ./CLAUDE.local.md | Personal project-specific preferences | (Deprecated, see below) Your sandbox URLs, preferred test data | Just you (current project) |
CLAUDE.md imports
CLAUDE.md files can import additional files using@path/to/import
syntax. The following example imports 3 files:
/memory
command.
How Claude looks up memories
Claude Code reads memories recursively: starting in the cwd, Claude Code recurses up to (but not including) the root directory / and reads any CLAUDE.md or CLAUDE.local.md files it finds. This is especially convenient when working in large repositories where you run Claude Code in foo/bar/, and have memories in both foo/CLAUDE.md and foo/bar/CLAUDE.md. Claude will also discover CLAUDE.md nested in subtrees under your current working directory. Instead of loading them at launch, they are only included when Claude reads files in those subtrees.Quickly add memories with the #
shortcut
The fastest way to add a memory is to start your input with the #
character:
Directly edit memories with /memory
Use the /memory
slash command during a session to open any memory file in your system editor for more extensive additions or organization.
Set up project memory
Suppose you want to set up a CLAUDE.md file to store important project information, conventions, and frequently used commands. Project memory can be stored in either./CLAUDE.md
or ./.claude/CLAUDE.md
.
Bootstrap a CLAUDE.md for your codebase with the following command:
Tips:
- Include frequently used commands (build, test, lint) to avoid repeated searches
- Document code style preferences and naming conventions
- Add important architectural patterns specific to your project
- CLAUDE.md memories can be used for both instructions shared with your team and for your individual preferences.
Organization-level memory management
Enterprise organizations can deploy centrally managed CLAUDE.md files that apply to all users. To set up organization-level memory management:- Create the enterprise memory file in the appropriate location for your operating system:
- macOS:
/Library/Application Support/ClaudeCode/CLAUDE.md
- Linux/WSL:
/etc/claude-code/CLAUDE.md
- Windows:
C:\ProgramData\ClaudeCode\CLAUDE.md
- Deploy via your configuration management system (MDM, Group Policy, Ansible, etc.) to ensure consistent distribution across all developer machines.
Memory best practices
- Be specific: “Use 2-space indentation” is better than “Format code properly”.
- Use structure to organize: Format each individual memory as a bullet point and group related memories under descriptive markdown headings.
- Review periodically: Update memories as your project evolves to ensure Claude is always using the most up to date information and context.