AI for Automation
🧠 Auto Memory — How Claude Remembers You

Step 17 / 22

🧠 Auto Memory — How Claude Remembers You

Automatic memory that persists across sessions

Auto Memory = A System Where Claude Learns on Its Own

What’s it like when a new hire joins your team? On day one, you have to explain everything — where the printer is, what the report format looks like. But after a month? They just know. Without being told, they get the report format right and know how to book meeting rooms.

Claude Code’s Auto Memory works the same way. At first, it knows nothing about your project. But the more you work together, the more it “remembers” your project. Build commands, file structure, even common mistakes you make.

New HireClaude Code (Auto Memory)
Day 1: Has to ask about everythingFirst conversation: Starts by analyzing project structure
Week 1: Learns basic work patternsA few sessions: Remembers build/run methods
Month 1: Works independentlyContinued use: Matches coding style
Takes notes in a notebookSaves project info in MEMORY.md
Refers to the company handbookAutomatically references CLAUDE.md

One-line summary

Auto Memory = A system where Claude Code learns on its own as you work together. You no longer need to repeat the same explanations.

How Does It Remember?

Auto Memory’s mechanism is really simple. When Claude Code discovers something during your conversation that seems “useful to know later,” it automatically takes notes. Like a colleague jotting things down on sticky notes.

How Memories Are Created

1
You work with Claude Code

Code, edit files, build — just work as usual

2
Claude spots important info

Detects patterns like "this project uses npm run build"

3
Asks for your confirmation

"Can I remember this?" — only saves with your permission

4
Saves to MEMORY.md

If approved, records it in the project memory file

5
Auto-references in future sessions

Even in new conversations, it already knows what it learned before

The most important step is #3. Claude Code doesn’t memorize things on its own — it always asks “Can I remember this?” and waits for your approval. This prevents unwanted information from being stored.

If you approve

The content is added to the MEMORY.md file. From the next conversation, Claude Code already knows this info. No need to ask “What was the build command?” again.

If you decline

Nothing is saved. That information is only used in the current conversation and forgotten in the next session.

Without Memory, conversations are forgotten

By default, Claude Code forgets everything when a conversation ends. Every new conversation starts from scratch, re-analyzing “what does this project do?” Auto Memory solves this — what it learned carries forward to future conversations.

Auto Memory = AI’s Work Notes

The more you work together, the better it understands your project

What Does It Remember?

Auto Memory stores roughly 6 types of information. All things that are “useful to know next time.”

🛠

Build & Run Commands

Remembers how to run the project:npm run build, python manage.py runserver, etc. No need to ask “How do I build?” again.

📁

File & Folder Structure

Remembers things like “UI components are under src/components/” and “api/ folder is the backend.”

🔧

Resolved Issues & Errors

Remembers troubleshooting experience like “Port 3000 conflicts often happen in this project” and “TypeScript strict mode means no any types.”

🎨

Coding Style & Rules

Remembers your project’s coding style: “function names in camelCase,” “components use arrow functions,” etc.

🔐

Environment & Config

Remembers environment setup info like “API keys are in the .env file” and “Deployment is via Vercel.”

📖

Things You Explicitly Told It

Information you explicitly shared, like “This project has an English UI” or “Always use Jest for tests.”

What It Actually Looks Like

For example, after 3 days of working with Claude Code, your Memory might contain something like this:

Example MEMORY.md
# Project Memory

## Project Structure
- Next.js 14 App Router + Tailwind CSS + TypeScript
- Components: src/components/
- API routes: src/app/api/
- Deployment: Vercel (auto-deploy on git push)

## Build & Run
- Dev server: npm run dev (port 3000)
- Build: npm run build
- Lint: npm run lint

## Coding Style
- Components: export default function style (no arrow functions)
- CSS: Tailwind only (no inline styles)
- State management: zustand

## Resolved Issues
- Hydration error: occurs when "use client" is missing
- Image optimization: must use next/image
- Environment variables: store in .env.local, use NEXT_PUBLIC_ prefix

With this in MEMORY.md, the next time you start a new conversation, Claude Code immediately knows that this project uses Next.js 14 with Tailwind, runs with npm run dev, etc.

Efficiency improves as memory accumulates

After the first 1-2 sessions, Memory is nearly empty. But after a week or a month, it becomes an expert on your project. It even starts automatically avoiding patterns that cause errors.

Where Is the Memory File Stored?

The file Auto Memory saves is just a plain text file. Not hidden somewhere mysterious — it’s stored as MEMORY.md in a specific folder on your computer. You can open it, read it, and even edit it yourself.

2 Types of Memory

1. Global Memory

Applies to all projects. Great for personal preferences like “respond in English” or “commit messages in conventional format.”

Location
# Windows
~/.claude/MEMORY.md

# Mac/Linux
~/.claude/MEMORY.md

2. Project Memory

Applies to that specific project only. Stores project-specific info like build commands, file structure, and coding style.

Location
# Windows
~/.claude/projects/<path-hash>/memory/MEMORY.md

# Mac/Linux
~/.claude/projects/<path-hash>/memory/MEMORY.md

The <path-hash> part is an auto-generated folder name based on your project path. No need to navigate there manually — just ask Claude Code to “show me the memory file.”

Checking the Memory File Directly

Say this to Claude Code
Show me everything you remember about this project.

This makes Claude Code display the current project’s MEMORY.md contents. It reads the global memory too.

You can also open the file directly
# Open global memory
cat ~/.claude/MEMORY.md

# Or open with a text editor / VS Code
code ~/.claude/MEMORY.md

MEMORY.md vs CLAUDE.md

They look similar but are different files.MEMORY.md is a notepad that Claude Code writes automatically.CLAUDE.md is a project manual that you write yourself. We’ll cover CLAUDE.md in detail in the next chapter.

MEMORY.mdCLAUDE.md
AuthorClaude Code (automatic)Human (manual)
ContentThings learned while workingProject description, rules
Location~/.claude/ (hidden folder)Project root (committed with code)
PurposePersonal notepadGuide book for the whole team
EditingMostly by Claude + manual edits OKEdited by humans
SharingOnly on your computerShareable with team via Git

Managing Memories Manually

Auto Memory is automatic, but you can also control it manually. You can tell it “remember this” or “forget that.”

Teaching It

Explicitly telling Claude Code to “remember this” saves it to MEMORY.md immediately. Useful for important rules or common mistakes.

Project Rules

In this project, component filenames use PascalCase.
Remember this.

Personal Preferences

I want commit messages in English.
Always use "feat:", "fix:", "chore:" prefixes.
Save this to global memory.

Preventing Repeated Mistakes

In this project, Image components must use next/image.
Using HTML img tags causes build failures.
Remember this.

Making It Forget

If wrong information was remembered, or a rule is no longer valid, just say “forget that.”

Delete Specific Memory

Delete the memory about "port 3000 conflict."
The port configuration has changed.

Correct Wrong Memory

The memory says "deployment is Netlify" but
we've switched to Vercel.
Update the memory.

Editing MEMORY.md Directly

MEMORY.md is a plain text (Markdown) file. You can open and edit it with any text editor or VS Code. Changes are picked up the next time Claude Code reads it.

Direct editing is also fine
# Open with a text editor or VS Code
code ~/.claude/MEMORY.md

# Or ask Claude Code
Show me the memory file. I want to make some edits.

Caution when editing directly

When editing MEMORY.md yourself, maintain proper Markdown formatting. If headings (##) or list (-) formats break, Claude Code may not parse the content correctly. For major restructuring, it’s safer to ask Claude Code to do it.

Try It Yourself

You need to try it hands-on to get it. Follow these exercises in order.

Exercise 1: Check Current Memory

Open Claude Code and check what it currently remembers.

Say this to Claude Code
Show me everything you remember about this project.

If this is your first time, it may say “No memories stored yet.” Move on to exercise 2 to create some.

Exercise 2: Intentionally Store a Memory

Teach Claude Code important project info.

Say this to Claude Code
Remember this about the project:
- This is a learning/experimental project
- Build command: npm run build
- Test command: npm test
- Not deployed yet

When Claude Code asks “Should I remember this?”, approve it. It’ll be saved to MEMORY.md.

Exercise 3: Verify Memory Persists

Start a new conversation and check if memory carries over.

In the new conversation, say
How do I build this project?

If it knows “npm run build” without being told again, success!

Exercise 4: Edit a Memory

Try modifying or deleting stored information.

Say this to Claude Code
Change the "Not deployed yet" part in memory
to "Deployment: Vercel (auto on git push)."

Verification Checklist

Don’t worry if the exercises don’t work perfectly. Auto Memory builds naturally over days of working together. No need to force “remember this” repeatedly — just work normally and it learns on its own.

Tips + Precautions

Practical tips for effective use of Auto Memory.

1. There’s a 200-line limit

MEMORY.md has a 200-line limit. If it exceeds 200 lines, older content may be trimmed. For truly important rules, it’s safer to record them in CLAUDE.md (next chapter).

2. Wrong memories can happen

Sometimes Claude Code remembers incorrect info — like memorizing a temporary setting as a permanent rule. Get in the habit of checking with “show me the memory” occasionally.

3. Distinguish global vs project memory

Rules that apply everywhere (like “respond in English”) go in global memory. Project-specific things (like “TypeScript strict mode”) go in project memory. Say “save this to global memory” to differentiate.

4. Clean up periodically

About once a month, say “show me the memory and clean it up.” Claude Code will organize outdated, duplicate, and invalid rules automatically.

Memory cleanup command
Show me the memory file.
Clean up outdated info and duplicates,
and reorganize neatly by category.

5. Don’t store sensitive information

Don’t save passwords, API keys, or personal info in Memory. MEMORY.md is a plain text file that others could see. Keep auth info in .env files separately.

6. Split into topic-specific files

When memory exceeds 200 lines, split detailed content into separate files. Keep MEMORY.md as an index (table of contents), and store details in separate .md files in the same memory folder.

Split memory structure example
~/.claude/projects/my-project/memory/
  MEMORY.md           # Index + key info only (under 200 lines)
  deployment.md       # Detailed deployment records
  troubleshooting.md  # Resolved error list
  api-notes.md        # API integration info
SituationWhat to Do
Want to teach a project rule"Remember this"
Found a wrong memory"Forget this" or "Update this"
Memory is fullSplit by topic into separate .md files
Worried important rules might disappearRecord separately in CLAUDE.md (next chapter)
Need to store sensitive infoUse .env files, NOT Memory

Auto Memory = An AI Colleague That Grows With You

The longer you work together, the better it understands your style, and it starts working without repeated explanations. In the next chapter, you’ll learn about CLAUDE.md — a project manual you write yourself.

Next chapter preview: CLAUDE.md

If Auto Memory is Claude Code’s “self-study,” CLAUDE.md is the “official textbook” you write. Use both together and Claude Code becomes the ultimate expert on your project.

References