Drop in for a virtual coffee, Wednesdays at 5:30pm

Project memory and rules

How I think about it

It holds my personal details and the way I like to work, the things that are mine across every project, so it makes sense to keep it out of the shared repo.

For example, my conventional-commit preference lives in my user file and follows me to every project, but a teammate only gets it if it is also put in the project file.

So the diagnosis is right instruction, wrong layer, and the fix is to move it down to the project level so it travels with the repo to everyone.

Matt Cameron, in my own words

The first piece of setting AI up is giving it your project's memory and rules, the conventions, context and standards it should already know before it starts. Claude reads these from CLAUDE.md files and rules, so getting their structure right is how it builds the way your project already does.

Say it another way

Project memory is a plain file, called CLAUDE.md, where you write your project's conventions and decisions. The AI reads it before every task, so it starts already knowing the house rules, like handing a new hire the team handbook on day one rather than letting them guess.

User~/.claude, personal, every projectProject.claude/ or root, shared in the repoDirectorya subfolder, a specific partbroadspecific
The CLAUDE.md layers you will usually use, broad to specific: personal at the user level, shared at the project level, granular in a subfolder. Each layer adds detail for a narrower scope, and you keep each one modular with @import or a .claude/rules/ folder rather than one giant file.

Doing this with Claude Code: Project memory and rules

Give Claude its instructions through CLAUDE.md files and rules, laid out so the right guidance is already in place before it starts a task, and so each session is consistent.

It earns its keep in four ways: layer by scope, keep it modular, scope rules to where they apply, and check what actually loaded.

Layer it by scope. User-level for your personal preferences across every project, project-level for the shared conventions that travel in the repo, directory-level for a specific part. Each layer down is narrower and adds detail. Because user-level config lives with you and not in the repo, it has no automatic backup, so keeping it safe is on you.

Keep it modular, not one giant file. Split it into focused topic files, either pulled in with @import or kept as a .claude/rules/ folder, so each concern lives in its own file.

Scope a rule to where it applies. Give a rule a path so it only loads when Claude is working on matching files, so its context is not filled with rules that are not relevant.

Check what actually loaded. /memory shows which files are in play this session, so when behaviour is off you can tell a wrong instruction from one that simply never loaded. And if something works for you but not a teammate, the instruction is usually in your personal user file rather than the shared project one, so move it down a layer.

Part of Ways to set AI up to help.