Build Up Claude's Memory Over Time with CLAUDE.md
Claude Code's memory lives in plain text files — your global ~/.claude/CLAUDE.md and each project's .claude/CLAUDE.md. When you want Claude to remember something permanently, you write it there.
The fastest way to add a memory mid-session is the # prefix:
# remember that I prefer Pest over PHPUnit for all tests
# remember that we use conventional commits in this project
# always run tests before marking any task as complete
Each line is added to your user-level memory file immediately.
For project-specific preferences, ask Claude to write directly to CLAUDE.md:
Add a rule to CLAUDE.md: always use the service layer for business logic —
controllers should only handle HTTP.
Over time, your CLAUDE.md files accumulate exactly how you like to work — your test framework preferences, naming conventions, commit message format, when to ask vs when to proceed. Claude loads these at the start of every session, so you stop re-explaining the same things.
The global file is the right place for universal preferences:
## My Preferences
- I'm a senior developer — skip basic explanations
- Use conventional commits (feat:, fix:, chore:)
- Prefer composition over inheritance
- Always write tests for new functionality
Project-level CLAUDE.md is for project-specific rules that would be noise elsewhere.
The most valuable CLAUDE.md is the one that has grown through real corrections — every mistake you fix and capture makes every future session sharper.
Log in to leave a comment.
The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.
The language setting makes Claude respond in your preferred language by default, across every session and project.
The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.