Freeive

claude-code·Published 2026.06.01·Views 1

Claude Code Keeps Forgetting? Use /memory and CLAUDE.md

Claude Code's /memory and CLAUDE.md are rule files it auto-remembers every conversation once you write them. We cover common pitfalls, how to add rules, an

Have you ever told Claude "answer in Korean," "use polite speech," "we use pnpm, not npm" — every single time? Open a new conversation and it forgets again. AI resets its memory when you close the chat window. That's exactly why CLAUDE.md exists, along with /memory for handling it. Anything you'd have to explain twice, just write it here once.

Why does it forget in a new conversation?

AI only remembers context within a single conversation. Close the chat window and open a new one (or clear it with /clear), and everything you said disappears. That's why you end up retyping "answer in Korean" every time.

The file that solves this is called CLAUDE.md. Think of it as a "new-hire work manual" you hand to Claude. What's written here is read automatically at the start of every conversation. Write it once and it holds in new conversations, and in the one you open tomorrow.

/memory is the command for handling this manual file.

No CLAUDE.md yet? How to create one

Don't worry if you don't have a CLAUDE.md file yet. You don't need to make an empty file yourself — just tell Claude this.

create a CLAUDE.md

Or, type /init in your project folder and Claude will examine the codebase and create a basic CLAUDE.md on its own. Once the file exists, fill it with rules using the methods below.

★ Common pitfall — /memory takes no arguments

Let's first address what confuses beginners the most.

/memory use polite speech

Writing a rule after /memory like this does nothing. /memory isn't a command that saves rules — it's just a "button that opens the rule file." No matter what you append, it simply opens the file list and brings it up in your editor.

So how do you add rules? There are two ways. We'll see them next.

2 ways to add rules (by difficulty)

Basics — just say it in conversation

from now on, always answer in polite speech

Ask in plain words like usual, and Claude saves it to memory on its own. It's the easiest way.

Basics — open the file list

/memory

Type /memory and it proceeds in this order.

  1. The screen shows the list of currently applied rule files (personal, project, etc.).
  2. Use the arrow keys to pick the file to edit, then press Enter.
  3. That file opens in your default editor.
  4. Write the rules there and save, and they apply from the next conversation.

Applied — pinpoint it into CLAUDE.md

add a "run npm test before committing" rule to CLAUDE.md

You can have it record directly into the rule file shared with the team.

Advanced — split rules by scope

/memory → split out just the test rules into .claude/rules/testing.md

When rules pile up, splitting them by topic and file keeps things tidy.

A real case

Commits kept going up without tests, so I wrote this one line in CLAUDE.md.

always run npm test before committing

After that, even when I opened a new session, Claude ran the tests first on its own whenever it did commit work. I no longer had to nag "tests first!" every time. One line written once kept reducing my workload over and over.

Use it like this too

  • Split by location: Put personal-preference rules in ~/.claude/CLAUDE.md (global on my PC; on Windows, C:\Users\username\.claude\CLAUDE.md), and team-shared rules in the project root's ./CLAUDE.md. The former is read by you only, the latter by all teammates. Mix up the location and you get accidents like "I thought it was my rule but it got shared with the team," so keep them distinct.
  • Grow it into a mistake-prevention note: When Claude makes the same mistake twice, tell it "write that mistake into CLAUDE.md." CLAUDE.md gradually gets smarter as your project's "living mistake-prevention note."
  • Split when rules pile up: Breaking them out by topic in .claude/rules/ like testing.md, style.md makes management easier.
  • Use hooks for rules that must be followed: CLAUDE.md is "guidance," not "enforcement." It might not be followed. For rules that absolutely must run, hooking them with /hooks (hooks — a feature that auto-runs a command at a specific moment) is the sure bet.

Tip: The shorter and more specific a rule, the better it's followed. Keeping CLAUDE.md short, under 200 lines, gives a higher hit rate.

How others use it (web cases)

Learn more: If you already use AGENTS.md, you can have the same rules read together via an @AGENTS.md import (only when needed).

Try it yourself

Follow along right now. First, say this.

from now on, answer in polite Korean

Then open a new conversation with /clear and check whether the polite speech is maintained. You can directly feel that the memory was saved.

Wrap-up

The key is one sentence. Anything you'd explain twice, write it in CLAUDE.md. AI forgetting every conversation isn't a bug — it's just how it works, and CLAUDE.md is the first step beyond that limit. Remember just one pitfall — /memory isn't a command you append rules to, it's just a button that opens the file. Add rules by saying them in conversation, or by opening the file and writing them yourself.

Based on: Claude Code v2.1.154 (2026.05)

#ClaudeCode#memory#CLAUDE.md#AICoding#VibeCoding#Developer

Comments

Comments 0

Checking sign-in status…

Loading comments…

Recent

More notes.