Setting Up Claude Code Project Memory Using CLAUDE.md
Claude Code automatically loads a CLAUDE.md file from your project root to inject persistent, version-controlled standards into every session, ensuring consistent AI assistance across your entire team.
Claude Code can maintain project-wide context across sessions through a dedicated memory file. According to the luongnv89/claude-howto repository, placing a CLAUDE.md file in your project root creates a shared knowledge base that survives restarts and aligns Claude with your team's specific coding standards, architecture decisions, and deployment workflows.
How CLAUDE.md Memory Works
When you start a Claude Code session, the engine automatically discovers and loads your project memory through a four-stage process:
- Discovery – Claude Code walks up the directory tree from your current working directory searching for a file named
CLAUDE.md. - Parsing – The file is read as plain Markdown; YAML frontmatter is ignored, but headings and bullet lists are preserved verbatim.
- Prompt Injection – The content is appended to Claude Code’s system prompt under the "Project Memory" section, treating the text as immutable knowledge.
- Runtime Access – You can reference the loaded memory with the
/memorycommand, while sub-agents and skills automatically respect these rules (for example, thecode-reviewskill enforces line-length limits defined in the file).
Because CLAUDE.md lives in version control, standards can be reviewed in pull requests and updated alongside code changes.
Setting Up Your CLAUDE.md File
Copy the Template from claude-howto
The luongnv89/claude-howto repository provides a comprehensive template covering enterprise concerns such as coding style, Git workflow, testing thresholds, and API standards. Copy it into your project root:
# From the root of the cloned claude-howto repository
cp 02-memory/project-CLAUDE.md /path/to/your/project/CLAUDE.md
The source template is located at [02-memory/project-CLAUDE.md](https://github.com/luongnv89/claude-howto/blob/main/02-memory/project-CLAUDE.md).
Verify the Memory Load
After placing the file, open a Claude Code session in your project directory and run:
/memory
Claude should respond with a summary of the loaded project memory:
Project Memory loaded:
- Tech stack: Node.js, PostgreSQL, React 18, Docker
- Code style: Prettier, ESLint (airbnb), 2-space indent, max 100 chars
- Git workflow: feature/… / fix/… branches, conventional commits, PR reviews required
Working with Project Memory in Sessions
Automatic Enforcement in Skills
Skills automatically detect and enforce rules defined in your memory file. For example, the code-review skill located at 03-skills/code-review/ will check line lengths against the Maximum line length: 100 characters rule without additional configuration:
/skill run code-review path/to/file.js
Claude will cite the project memory when flagging violations, ensuring reviews align with your documented standards.
Hot-Reloading Memory Without Restart
Edit CLAUDE.md to add new rules (such as API versioning policies), then apply changes immediately using:
/reload-memory
This command forces Claude to re-parse the updated file and incorporate the changes into the current session without requiring a restart.
Types of Memory Files
The claude-howto repository demonstrates three memory scopes:
- Project Memory – The root
CLAUDE.mdfile containing global standards for the entire repository. - Directory-Specific Memory – Files like [
02-memory/directory-api-CLAUDE.md](https://github.com/luongnv89/claude-howto/blob/main/02-memory/directory-api-CLAUDE.md) that provide context for specific subsystems (e.g., API-layer rules). - Personal Memory – [
02-memory/personal-CLAUDE.md](https://github.com/luongnv89/claude-howto/blob/main/02-memory/personal-CLAUDE.md) for individual developer preferences that override project defaults.
Additionally, sub-agents such as the one defined in [04-subagents/code-reviewer.md](https://github.com/luongnv89/claude-howto/blob/main/04-subagents/code-reviewer.md) automatically inherit project memory to perform deeper, context-aware reviews.
Summary
- Place
CLAUDE.mdin your project root for automatic discovery and loading. - Content injects into the system prompt under the "Project Memory" section.
- Use
/memoryto verify loaded content and/reload-memoryto update without restarting. - Skills like
code-reviewautomatically enforce rules defined in the memory file. - Version control the file to share consistent standards across all team members.
Frequently Asked Questions
Where should I place the CLAUDE.md file?
Place the file at the root of your repository. Claude Code walks up the directory tree from your current working directory until it finds CLAUDE.md, so it can also reside in any parent directory of your current session.
Does Claude Code support multiple memory files?
Yes. You can use a root CLAUDE.md for global project standards, directory-specific files like 02-memory/directory-api-CLAUDE.md for subsystem rules, and personal memory files to override defaults on individual machines.
How do I check if my memory file is loaded correctly?
Run the /memory command in your Claude Code terminal or VS Code extension. Claude will display a summary of all loaded project memory sections, confirming successful parsing.
Will changes to CLAUDE.md take effect immediately?
No. After editing the file, you must run /reload-memory to incorporate changes into an active session, or simply restart Claude Code to load the updated version automatically.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →