Adding to CLAUDE.md in Claude Code, what # really does, /memory, and the @ import syntax
You typed # expecting it to append to CLAUDE.md and nothing happened. What the docs say, the three documented ways to add to CLAUDE.md, and splitting a long file with @ imports.
Contents
You saw a tip somewhere that typing # at the start of the Claude Code prompt appends what you type to CLAUDE.md. You tried it, and nothing happened. This article explains what the official documentation actually says, and then covers the @ import syntax for the day your CLAUDE.md gets too long to keep in one file.
Here is the short answer. As of October 10, 2026, the official documentation contains no description of # as a special input. The documented ways to add to CLAUDE.md during a session are the /memory command, asking Claude in plain language, and auto memory.
KEY POINT
What you will learn
- How
#is treated in the current docs, and which pages were checked - The three documented ways to add content to
CLAUDE.md - Why "remember this" does not end up in
CLAUDE.md - How
@pathimports work, and what they do not do
The docs list five input prefixes, and # is not one of them
The interactive mode reference has a "Quick commands" table listing characters that carry special meaning in the prompt. These are the five entries.
| Input | Meaning | What it does |
|---|---|---|
/ (at start) | Command or skill | Opens the list of built-in commands and skills |
! (at start) | Shell mode | Runs a command directly and adds its output to the session |
@ | File path mention | Triggers file path autocomplete and pulls the file into context |
: | Emoji shortcode | Inserts an emoji from a :name: shortcode |
? (on empty input) | Help panel | Toggles the keyboard shortcut help panel |
There is no # row. The commands reference, the memory page, and the best practices page were checked as well, and none of them describes # as an append shortcut.
Whether it ever existed is not something we can confirm
Whether # worked in an earlier version, or whether the tip confuses Claude Code with another product, could not be confirmed in the official documentation. This article sticks to the verifiable fact that the current docs do not mention it. If it happens to work in your installation, treat that as behavior specific to your version.
Three documented ways to add to CLAUDE.md
1. Open the file with /memory
Running /memory in a session lists your memory file locations, including CLAUDE.md and CLAUDE.local.md, and includes entries for files that do not exist yet. Selecting a row opens it in your editor, creating it first if needed.
/memory
GUI editors such as VS Code open the file in a separate window, so you can keep using the session while it is open. Terminal editors such as Vim take over the terminal until you exit.
2. Ask Claude in plain language
This takes the fewest keystrokes. The documentation says that to add instructions to CLAUDE.md, you should ask Claude directly, like "add this to CLAUDE.md", or edit the file yourself via /memory.
Add the rule we just agreed on to CLAUDE.md: run tests with pnpm test, not npm test.
CLAUDE.md is an ordinary Markdown file, so Claude appends to it with its edit tool. Name the section you want it under if placement matters to you.
3. Let auto memory handle it
Auto memory is the mechanism by which Claude writes notes for itself. It is on by default, and files live in ~/.claude/projects/<project>/memory/, with a MEMORY.md index plus one file per topic.
Why "remember this" never lands in CLAUDE.md
This is the part that trips people up. When you ask Claude to remember something, such as "always use pnpm, not npm", that note goes into auto memory, not CLAUDE.md. That is why the file looks unchanged afterwards.
| CLAUDE.md | Auto memory | |
|---|---|---|
| Who writes it | You | Claude |
| What it holds | Instructions and rules | Learnings and patterns |
| Scope | Project, user, or org | Per repository, machine-local |
| Loaded into | Every session | Every session (first 200 lines or 25KB of MEMORY.md) |
Rules your team needs go in CLAUDE.md and get committed to version control. Auto memory is machine-local and is not shared across machines or cloud environments, so a shared convention parked there only ever helps you. See Turn off Claude Code auto memory or move it for the settings that control it.
Splitting a long CLAUDE.md with @ imports
Keep adding and the file grows. Rather than maintaining one long file, you can write @ followed by a path and Claude Code pulls that file in as part of CLAUDE.md. One line such as @docs/coding-style.md is enough.
# Project overview
Next.js admin dashboard.
## Conventions
@docs/coding-style.md
## Architecture
@docs/architecture.md
| Form | Meaning |
|---|---|
@docs/style.md | Relative to the directory containing CLAUDE.md |
@/absolute/path/rules.md | Absolute path |
@~/.claude/personal.md | Relative to your home directory |
Four things to know:
- Recursion: an imported file may import others, but depth is limited, so stay within two or three levels
- Code is ignored:
`@example.com`or an@inside a fenced block is not treated as an import, which keeps email addresses from being picked up - Missing paths are silent: nothing errors; the file simply is not loaded. Check the Memory files list in
/context - No token savings: imported content is sent every session just like the rest. Splitting changes how you manage the text, not how much is loaded
Splitting does not shrink context
Imports are for maintainability; the total loaded is the same. If different directories need different information, put a CLAUDE.md in each subdirectory instead, so it loads only while Claude works there (Where Claude Code reads CLAUDE.md from).
A layout that splits conventions by kind:
repo/
├── CLAUDE.md
└── docs/
└── ai/
├── commands.md # build, test and lint commands
├── conventions.md # coding conventions
└── forbidden.md # places not to touch
# CLAUDE.md
@docs/ai/commands.md
@docs/ai/conventions.md
@docs/ai/forbidden.md
## How to work
- For changes touching three or more files, present the plan first
If you also use Codex, you can make AGENTS.md the single source and build CLAUDE.md from the one line @AGENTS.md (CLAUDE.md, AGENTS.md and GEMINI.md compared). For rules that are yours alone, prefer the untracked CLAUDE.local.md over @~/.claude/personal.md, because the import line itself would be committed.
Check that what you added is actually loaded
Appending to a file does not guarantee the session loads it. The command that shows you is /context, not /memory.
/context
Look for the Memory files list in the output. If your file, or a file it imports, is not there, Claude cannot see it. To check whether the file is in a location that gets loaded, see Where Claude Code reads CLAUDE.md from.
If you have no CLAUDE.md yet, /init generates a first draft from your project structure. See What Claude Code's /init puts in CLAUDE.md, and what to change afterwards, and the hub article How to write CLAUDE.md for what belongs in it.
Summary
- The current official documentation does not describe
#as a shortcut for appending toCLAUDE.md; the documented prefixes are/,!,@,:, and? - To append mid-session, open the file with
/memoryor ask Claude to "add this to CLAUDE.md" - Asking Claude to "remember this" writes to auto memory, which stays machine-local
- A long file can be split with
@docs/style.mdimports; relative, absolute and~paths work, code blocks are ignored, and the token count does not shrink - Confirm the result with
/contextand check the Memory files list
FAQ
- What happens when I type # at the start of the prompt in Claude Code?
- The current official documentation does not describe # as a special input. The documented prefixes are / for commands, ! for shell mode, @ for file references, : for emoji shortcodes, and ? for the help panel.
- How do I append one line to CLAUDE.md mid-session?
- Run /memory and pick the file to open it in your editor, or ask Claude directly with something like "add this to CLAUDE.md". Both are documented.
- Where does Claude store things I ask it to remember?
- In auto memory at ~/.claude/projects/<project>/memory/, not in CLAUDE.md. Say explicitly that you want it in CLAUDE.md if that is where it belongs.
- Can an imported file import other files?
- Yes, but recursion depth is limited, so keep it to two or three levels. An @ inside a code block or inline code is not treated as an import.
Primary sources
This article was drafted by AI from official documentation and reviewed by the site operator before publishing. Found a mistake? Let us know via the contact page.