Home › Claude Code lesson 2: CLAUDE.md memory
Claude Code lesson 2: CLAUDE.md memory
Each session starts fresh. CLAUDE.md files (which you write) and auto memory (notes Claude writes from your corrections) carry knowledge from one session to the next.
Step by step
- Create a CLAUDE.md file in your project with coding standards, test commands and how the project is laid out.
- Keep instructions short and specific; Anthropic says that makes Claude follow them more consistently.
- If the repository already has an AGENTS.md, Claude Code can read it instead.
- Put rules for particular file types in .claude/rules/.
- Let auto memory save your corrections and preferences, and review it from time to time.
Try it: examples
- CLAUDE.md example
# Project rules - Run npm test before calling a task done. - Use TypeScript strict mode. - Never edit files in /migrations.
Good to know
- CLAUDE.md and auto memory are treated as context, not enforced settings. To block an action no matter what, use a PreToolUse hook.
- Auto memory loads its first 200 lines or 25KB into every session.
- CLAUDE.md can be set at project, user or organisation level.
Sources (official pages, read Nov 8, 2026)
Written from Anthropic's official documentation and product pages; we don't run hands-on tests. Features and limits vary by plan and country.