/memory slash command opens a file selector that lets you choose and edit a CLAUDE.md memory file in your configured editor. Memory files give Claude persistent instructions that are automatically included at the start of every session.
The editor is determined by the
$VISUAL environment variable, then
$EDITOR. If neither is set, a platform default is used.How memory works
Claude Code loads memory from several locations in order. Each file’s content is prepended to the system prompt before the session starts.| Priority | Location | Scope |
|---|---|---|
| 1 | Managed memory (e.g. /etc/claude-code/CLAUDE.md) | All users on the system |
| 2 | ~/.claude/CLAUDE.md | Your user account — all projects |
| 3 | CLAUDE.md in the project root | Project — checked into git |
| 4 | .claude/CLAUDE.md in the project root | Project — checked into git |
| 5 | .claude/rules/*.md in the project root | Project — per-rule files |
--add-dir are scanned for CLAUDE.md files using the same rules.
Selecting a memory file
When you run/memory, a dialog presents the available memory files. Select one to open it in your editor. If the file does not yet exist it is created automatically.
Example memory file
CLAUDE.md
Excluding memory files
Files can be excluded via theclaudeMdExcludes setting if you want Claude to ignore specific CLAUDE.md files in certain paths.
The /memory command inside a session
Run /memory at any time during an interactive session to edit memory files without restarting. Changes take effect the next time a new session is started.