Skip to Content

CLAUDE.md and Memory

Two ways Claude Code remembers your project across sessions, so you do not repeat yourself.

CLAUDE.md

A markdown file you write. Claude Code reads it at the start of every session. It holds the rules and facts you want it to always know.

Create one quickly:

/init

This scans your project and writes a starting CLAUDE.md for you.

Example content:

CLAUDE.md
# Project Rules - Run tests with `npm test`, not `npm run test:all` - Use 2-space indentation - Never edit files in /generated — they are auto-created

Where It Can Live

FileScope
~/.claude/CLAUDE.mdAll your projects
./CLAUDE.mdThis project, shared with your team (commit it to git)
./CLAUDE.local.mdThis project, just for you (add to .gitignore)

Keep it short and specific. “Use 2-space indentation” is useful. “Write good code” is not — Claude Code cannot act on advice that vague.

Auto Memory

Claude Code also learns on its own, without you writing anything. As it works, it saves things like “this repo uses pnpm, not npm” to a memory file for that project.

  • It saves this automatically, as it works
  • View or edit it with /memory
  • It only affects this one project

CLAUDE.md is what you choose to tell it. Auto Memory is what it picks up along the way. Both load at the start of every session.

Next → Settings and Permissions

claude code claude.md, claude code memory, claude code project instructions, claude code init, claude code auto memory

Last updated on