# Claude Code memory: the CLAUDE.md hierarchy and /memory

> Claude Code concatenates CLAUDE.md from managed policy, your home dir, the project, then CLAUDE.local.md. Inspect it with /memory and @path imports.

- Canonical: https://guides-ai.com/guides/claude-code-memory-hierarchy/
- Plate 03.12 · Topic: Claude Code commands (https://guides-ai.com/topics/commands/)
- Published: 21 Oct 2026 · 3 min read
- Source site: guides-ai — https://guides-ai.com/

Every Claude Code session loads several `CLAUDE.md` files and concatenates them into context —
they don't override each other. The load order tells you which instruction Claude reads last, and
`/memory` shows what's in play. This is about how the files combine; for writing one well, see
[set up a CLAUDE.md](/guides/create-claude-md-project-memory/).

## 1. Know the load order

Claude loads these broadest to most specific, so each appears in context after the one before:

```text
1. Managed policy  (Linux/WSL: /etc/claude-code/CLAUDE.md)
2. User            (~/.claude/CLAUDE.md)
3. Project         (./CLAUDE.md or ./.claude/CLAUDE.md)
4. Local           (./CLAUDE.local.md, gitignored)
```

What it does: managed policy loads first and can't be excluded by individual settings. Its path
is `C:\Program Files\ClaudeCode\CLAUDE.md` (Windows) or
`/Library/Application Support/ClaudeCode/CLAUDE.md` (macOS).

## 2. It's concatenation, not override

All files are joined from the top of the directory tree down to your working directory, and
within a folder `CLAUDE.local.md` is appended after `CLAUDE.md`. Nothing wins outright: if a user
rule and a project rule contradict, Claude may follow either, so keep them consistent.

## 3. View and edit with /memory

```text
/memory
```

What it does: lists your `CLAUDE.md` and `CLAUDE.local.md` locations across user and project
scopes, opens any one in your editor (creating it if missing), and toggles auto memory. To
confirm what actually loaded this session, run `/context` and read the **Memory files** list.

## 4. Pull in files with @path imports

```text
See @README for an overview and @docs/style.md for conventions.
```

What it does: `@path` expands another file into context at launch. Paths are relative to the
importing file, and imports can nest up to four hops deep. An import that resolves outside your
working directory prompts for approval the first time.

## 5. Where AGENTS.md fits

Claude reads a repo's [`AGENTS.md`](/guides/agents-md-file/) as project instructions only when no
`CLAUDE.md` or `CLAUDE.local.md` sits in your working directory or above it. When both exist,
`CLAUDE.md` wins, so an `@AGENTS.md` import inside a `CLAUDE.md` loads both. The
[glossary](/glossary/#claude-md) has the short version.

## If it fails

- **A file isn't being followed:** run `/context`; if it's missing from **Memory files**, Claude
  can't see it. A subdirectory `CLAUDE.md` loads on demand, not at launch.
- **AGENTS.md ignored:** a `CLAUDE.md` or `CLAUDE.local.md` on the path takes over. Remove it, or
  set **Project instructions** to `claude-md-and-agents-md` in `/config`.
- **External import won't load:** you declined the external-import approval, so it stays disabled
  for the project until you re-approve it.

Source: [How Claude remembers your project](https://code.claude.com/docs/en/memory).
