D3 · Claude Code › Cluster 1 · Memory & CLAUDE.md

1.5 · Quick-Add (#) & the /memory Command

Capture memory mid-session

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:

🔑 # 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 fileThe CLAUDE.md scope you choose A rule you want to persist as an instruction
"add this to CLAUDE.md"CLAUDE.mdStanding team/project instruction
"remember that…" (plain ask)Auto memory (MEMORY.md + topic files) A learning/preference Claude should recall
/memoryOpens files to edit directlyReview, fix, or delete memory
⚠️ Don't conflate the two systems. # / "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

flowchart TD START["Mid-session insight"] --> HOW{"How do you capture it?"} HOW -->|"# + text"| PICK["Claude asks: which memory file?"] PICK --> WRITE["🟢 Written to chosen CLAUDE.md scope"] HOW -->|"'add this to CLAUDE.md'"| WRITE HOW -->|"'remember that…'"| AUTO["🔵 Saved to auto memory
~/.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
Debugging "Claude ignored my rule"? Run /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

Trap: "Starting a prompt with # 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.
Trap: "/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.
Trap: "Saying 'remember X' edits CLAUDE.md." → A plain "remember…" saves to auto memory. To target CLAUDE.md, say "add this to CLAUDE.md" or edit via /memory.
Trap: "# 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.