CONCEPT Capture a rule without leaving the session
You don't have to stop and hand-edit a file every time you want Claude to remember something. Two in-session mechanisms let you capture and manage memory on the fly:
- The
#quick-add shortcut — begin your input with#and the text that follows is captured as a memory. Claude prompts you for which memory file to store it in (project CLAUDE.md, user CLAUDE.md, local, etc.), then writes it for you. - The
/memorycommand — opens the memory manager: it lists every CLAUDE.md, CLAUDE.local.md, and rules file loaded in the current session, lets you toggle auto memory on/off, links to the auto-memory folder, and opens any file in your editor for editing.
# is for capturing a new memory fast; /memory is for
reviewing and editing what's already loaded. Use /memory first when debugging — if a file
isn't listed there, Claude can't see it.CONCEPT Natural-language capture & where things land
You can also just ask in plain language. Saying "always use pnpm, not npm" or "remember the API
tests need a local Redis instance" makes Claude save it to auto memory (the notes Claude
keeps for itself, stored under ~/.claude/projects/<project>/memory/). To land something in
CLAUDE.md specifically, be explicit — say "add this to CLAUDE.md" — or edit the file
yourself via /memory.
| You do… | Goes to… | Best for |
|---|---|---|
# + text, then pick a file | The CLAUDE.md scope you choose | A rule you want to persist as an instruction |
| "add this to CLAUDE.md" | CLAUDE.md | Standing team/project instruction |
| "remember that…" (plain ask) | Auto memory (MEMORY.md + topic files) |
A learning/preference Claude should recall |
/memory | Opens files to edit directly | Review, fix, or delete memory |
# / "add to CLAUDE.md" write
instructions you author. Auto memory is written by Claude from your
corrections. Both load at session start, but only MEMORY.md is truncated (first 200 lines / 25KB);
CLAUDE.md loads in full.DIAGRAM Capture and manage mid-session
~/.claude/projects/<project>/memory/"] START --> MGR["/memory"] MGR --> LIST["Lists loaded CLAUDE.md / .local / rules
toggle auto memory · open in editor"] classDef ok fill:#d4edda,stroke:#28a745,color:#155724; classDef alt fill:#e2e3f3,stroke:#6c63ff,color:#2a2a6a; class WRITE ok; class AUTO alt; class LIST alt;
CODE Using # and /memory at the prompt
Both are typed straight into the Claude Code input.
# Quick-add: start the line with # — Claude asks which file to save it to # Always run `make lint` before committing # Open the memory manager to review / edit loaded files /memory # Natural-language capture → lands in AUTO memory, not CLAUDE.md remember that the integration tests need a local Redis instance # Force it into CLAUDE.md instead by being explicit add this to CLAUDE.md: use pnpm, never npm
/memory first to confirm the file is
actually loaded in this session. A rule Claude can't see is a location problem, not an adherence problem.TRADE-OFFS Quick-add (#) vs. hand-editing the file
✅ # quick-add
- Zero context switch — capture the moment you notice
- Prompts you to pick the right scope
- Great for one-liners you'd otherwise forget
⚠️ Editing via /memory / an editor
- Full control over structure & placement
- Needed to reorganize, group, or remove stale rules
- Slower — you leave the flow of the task
EXAM TRAPS
# runs a shell comment / does nothing." → In
Claude Code, a leading # is the quick-add memory shortcut; Claude asks which memory file to
save the text to./memory only shows the project CLAUDE.md." → It lists all
loaded memory for the session — CLAUDE.md, CLAUDE.local.md, and rules files — plus the auto-memory toggle./memory.# and auto memory are the same feature." → # writes an
instruction you author into a CLAUDE.md; auto memory is written by Claude and stored under
~/.claude/projects/<project>/memory/.PRACTICE
Q1 · You type # then "prefer pnpm over npm". What happens?
It's captured as a memory and Claude prompts you to choose which memory file (project, user, local, …) to save it to, then writes it there.
Q2 · Claude keeps ignoring a rule you added last week. First diagnostic step?
Run /memory to confirm the file is actually loaded this session. If it
isn't listed, it's in a location that doesn't load for your cwd — fix placement before touching wording.
Q3 · How do you make sure a captured rule lands in CLAUDE.md, not auto memory?
Be explicit: use # and pick a CLAUDE.md scope, say "add this to CLAUDE.md," or edit
the file directly via /memory. A plain "remember…" goes to auto memory instead.