Module 5

The Memory System

Claude Code can remember your preferences, your project rules, and your personal context — across every conversation. Set it up once, and Claude gets smarter every time you use it.

📖 12 min 🌱 Intermediate ✎ 2 exercises
Clawd

The Problem with Starting Over

Without memory, every Claude Code conversation starts from zero. Claude doesn’t know your name, your coding preferences, your project’s rules, or the decisions you’ve made in the past. You end up repeating yourself:

  • “Use TypeScript, not JavaScript”
  • “Our app uses Tailwind CSS for styling”
  • “Always write tests for new functions”
  • “My timezone is Eastern”

Typing these reminders every session gets old fast. That’s where the memory system comes in — a way to teach Claude things once and have it remember them forever.

🔑 Key Concept

Claude Code’s memory works through files, not magic. There’s no hidden database. Claude reads specific Markdown files at the start of every session to load your preferences and project context. You can read, edit, and version-control these files like any other document.

CLAUDE.md: Your Project’s Instruction Manual

The most important file in the memory system is called CLAUDE.md. It lives in the root of your project folder, and Claude reads it automatically at the start of every conversation.

Think of CLAUDE.md as a sticky note on top of a filing cabinet: “Here’s how we do things around here.”

Here’s what a simple CLAUDE.md looks like:

CLAUDE.md
# Project Instructions This is a personal portfolio site built with HTML, CSS, and JavaScript. ## Rules - Always use semantic HTML elements - Use CSS variables for colors (defined in :root) - Mobile-first responsive design - Keep all code in a single HTML file for simplicity ## Style - Color palette: navy (#1a1a2e), gold (#e2b659), white (#fafafa) - Font: Inter for body, Playfair Display for headings - Rounded corners (8px) on all cards and buttons

Now every time you start a Claude Code session in this project, Claude already knows the color palette, the font choices, and the rules — without you saying a word.

Auto-Generate with /init

You don’t have to write CLAUDE.md from scratch. Claude can analyze your project and generate one for you. Just type:

Terminal

> /init

Analyzing your project structure… Reading package.json, config files, and source code… Created CLAUDE.md with project instructions Review the file and edit anything that needs correction.

The /init command scans your project — the file structure, dependencies, configuration files, existing code patterns — and generates a CLAUDE.md that captures the essentials. It’s not perfect, but it’s a great starting point.

generate your project instructions automatically
/init

After running /init, open the generated CLAUDE.md and review it. Add anything Claude missed. Remove anything wrong. This file is yours — you control what Claude remembers.

Clawd
Pro Tip

Run /init every time you start a new project. It takes 10 seconds and saves you from repeating yourself in every conversation. Think of it as introducing yourself to a new coworker — do it once, and they remember.

What to Include vs What to Skip

Your CLAUDE.md should include the things you’d tell a new team member on their first day. Here’s a guide:

Include:

  • What the project does (one sentence)
  • Tech stack and main dependencies
  • Coding style rules (formatting, naming conventions)
  • Project-specific commands (how to run tests, start the server, deploy)
  • Important decisions (“We use REST, not GraphQL” or “All dates are stored in UTC”)
  • File organization patterns (“Pages go in src/pages, components in src/components”)

Skip:

  • Obvious things (“JavaScript is a programming language”)
  • Information that changes frequently (specific data, user counts, etc.)
  • Secrets, API keys, or passwords (never put these in any file that could be shared)
⚠ Heads Up

Never put passwords, API keys, or secrets in CLAUDE.md. This file often gets committed to Git and could end up on GitHub where anyone can see it. Use environment variables (a .env file) for sensitive information.

Auto Memory: Claude Learns from You

Beyond CLAUDE.md, Claude Code has a built-in auto memory feature. When you correct Claude during a conversation, it remembers the correction for next time.

For example:

Terminal

> Build a signup form

Here’s a signup form using JavaScript…

> I always want you to use TypeScript, not JavaScript

Got it! I’ll remember to use TypeScript going forward. Saved to memory: Always use TypeScript, not JavaScript

Next time you start a new conversation, Claude already knows you prefer TypeScript. You don’t need to say it again. The memory accumulates over time — the more you use Claude Code, the better it knows your preferences.

🔑 Key Concept

Auto memory is like training a new assistant. The first week, you correct them a lot. By the second month, they just know how you like things done. Claude Code works the same way — every correction makes future sessions smoother.

Your Personal CLAUDE.md

There’s a difference between project-level memory and personal memory:

  • Project CLAUDE.md (./CLAUDE.md) — Lives in a specific project folder. Contains rules for that project. Shared with anyone who works on the project.
  • Personal CLAUDE.md (~/.claude/CLAUDE.md) — Lives in your home directory. Contains your personal preferences. Applies to every project, on every session.

Your personal CLAUDE.md is where you put things like:

~/.claude/CLAUDE.md
# Personal Preferences ## Communication - Be concise and direct - Skip unnecessary praise or filler ## Coding Style - Always use TypeScript over JavaScript - Prefer functional components in React - Write tests for all new functions ## Personal Info - Name: Jane Smith - Timezone: Eastern (America/New_York) - Email: jane@example.com

These preferences follow you everywhere. Whether you’re working on a portfolio site or a business dashboard, Claude will use TypeScript, write tests, and keep its responses concise.

Clawd
Pro Tip

Your personal CLAUDE.md is private to your machine. It never gets committed to Git or shared with anyone. Put your real preferences there — Claude is the only one who reads it.

The Persistent Memory System

For power users, you can build a full memory system with multiple files. Instead of putting everything in one CLAUDE.md, you split it into organized files:

  • decisions.md — Architecture choices and past decisions (“We chose PostgreSQL over MySQL because…”)
  • preferences.md — Hard rules and workflow preferences (“Always run tests before committing”)
  • people.md — Contacts and collaborators (“Designer: Sarah, sarah@design.co”)
  • user.md — Your identity, accounts, and personal info

Your CLAUDE.md then references these files, telling Claude to read them at the start of each session. It’s like giving Claude a filing system instead of a single sticky note.

Here’s the exciting part — you can ask Claude to build this entire system for you:

build a full memory system in one prompt
Build a persistent memory system for me. Create a folder at ~/.claude/memory/ with these files: user.md (my identity and accounts), preferences.md (my workflow rules), decisions.md (architecture choices), and people.md (contacts). Then update my ~/.claude/CLAUDE.md to read these files at the start of every session and update them at the end.

Claude will create the folder structure, write template files, and wire everything together. From that point forward, every session starts by loading your full context and ends by saving anything new.

teach Claude something once
Remember this: I prefer dark themes on all projects, I use 2-space indentation, and my deploy command is 'npm run deploy'. Save this to my preferences.
review what Claude remembers about you
Show me everything you currently know about my preferences and personal context. List out all the memory files and what's in them.
🔑 Key Concept

The memory system is just Markdown files. There’s no database, no cloud service, no complex setup. It’s files on your computer that Claude reads and writes. You can open them in any text editor, back them up, or share them. It’s the simplest possible approach — and it works beautifully.

Clawd
Pro Tip

Start simple. You don’t need the full multi-file memory system on day one. Just create a project-level CLAUDE.md with a few rules. Add your personal CLAUDE.md when you notice yourself repeating preferences. Build the full system when you’re ready for it.


Try It Yourself

✎ Exercise 1

Create Your First CLAUDE.md

  1. Open Claude Code in any project folder
  2. Type /init and press Enter — let Claude analyze your project
  3. Open the generated CLAUDE.md file and read through it
  4. Add at least 3 personal rules. For example:
    • “Use descriptive variable names, never single letters”
    • “Add comments explaining why, not what”
    • “Always include a loading state for async operations”
  5. Start a new Claude Code session in the same folder and notice how Claude follows your rules without being told
✎ Exercise 2

Build Your Personal Memory System

  1. Start Claude Code from any folder
  2. Send this prompt: “Create a personal CLAUDE.md at ~/.claude/CLAUDE.md with my basic preferences. I like concise responses, dark themes, and clean code. My name is [your name] and my timezone is [your timezone].”
  3. Verify it was created: ask Claude “Read my personal CLAUDE.md and show me what’s in it”
  4. Now test it — navigate to a different project folder, start a new Claude Code session, and ask Claude: “What do you know about my preferences?”
  5. Claude should know your name, timezone, and style preferences even though you never mentioned them in this session — that’s the memory system working
Clawd

Ready for Module 6?

Skills is up next.

Continue →