In short.
This is the official Claude Code documentation page on how Claude remembers a project across sessions, aimed at developers who use Claude Code, and its main catch is that CLAUDE.md, AGENTS.md and auto memory are loaded as context that Claude tries to follow, not as enforced configuration. Technically, the page describes two systems: instruction files you write (CLAUDE.md, CLAUDE.local.md, .claude/rules/, AGENTS.md) with defined locations, load order and size guidance, and auto memory that Claude writes itself into a per-repository directory under ~/.claude/projects/. It also documents imports, path-scoped rules, organisation-wide managed CLAUDE.md, settings keys, the /memory, /init, /context and /doctor commands, and a troubleshooting section. Many details are tied to specific Claude Code versions. The page is documentation only: nothing described here was run or tested for this report.
Researched and written by an AI model and checked by a second AI model. How it works
The scope is the single documentation page How Claude remembers your project at [https://code.claude.com/docs/en/memory.md], captured in full (55,459 bytes) on 2026-11-12. Pages it links to, such as hooks, skills, settings, sub-agents, managed settings and the command reference, are excluded, as are other folders of the documentation site. No licence text, copyright notice or separate notice file was captured with the page, so reuse rights are unknown. Nothing described in the page was executed or tested; all statements about behaviour, limits and versions are what the documentation says.
The overview
What this resource is
The resource is a single documentation page titled How Claude remembers your project, served from the Claude Code docs site at [https://code.claude.com/docs/en/memory.md]. Its own subtitle says it explains how to give Claude persistent instructions with CLAUDE.md or AGENTS.md files and how to let Claude accumulate learnings automatically with auto memory. The captured text is about 55 KB of markdown.
It is vendor documentation for Claude Code, not a code library, skill or plugin. The page itself states the starting problem: each Claude Code session begins with a fresh context window, and two mechanisms carry knowledge across sessions. The first is CLAUDE.md files, which are instructions you write. The second is auto memory, which is notes Claude writes itself from your corrections and preferences.
Overall assessment
Based on reading the captured page, this is a detailed, practical reference for anyone configuring Claude Code for a project or a team. It gives concrete file paths, load order, glob patterns, settings keys, environment variables, size limits and version cut-offs rather than general advice, and it is honest about the main limitation: CLAUDE.md content is delivered as a user message after the system prompt, so there is no guarantee of strict compliance.
Its main weakness as a learning resource is that it is a reference page, not a tutorial. It has no end-to-end walkthrough, it links out to many other pages (hooks, skills, settings, sub-agents, managed settings) that are not part of this capture, and many statements depend on a Claude Code version that the reader must check. None of the behaviour was run or tested for this report; the assessment reflects what the page says.
Who it is for
The page suits developers who already use Claude Code (or are about to) and want it to follow project conventions without re-explaining them each session. It also addresses team leads who want shared instructions committed to source control, and IT or DevOps staff who deploy an organisation-wide CLAUDE.md through MDM, Group Policy, Ansible or similar tools.
It is also relevant to teams whose repositories already carry an AGENTS.md written for other coding agents, because a large part of the page explains when Claude reads AGENTS.md and how to combine it with CLAUDE.md. A beginner can follow the core idea (write a short markdown file of rules and commands), but the monorepo, symlink, managed-policy and settings-layer sections assume comfort with git, shells and JSON settings files.
It primarily serves current or prospective Claude Code users. Its advice on writing instructions is aimed at Claude Code instruction files rather than at prompt writing in general.
What the documented features do
CLAUDE.md files: markdown files read at the start of each session. The page lists four scopes in load order from broadest to most specific: managed policy (for example /etc/claude-code/CLAUDE.md on Linux and WSL, /Library/Application Support/ClaudeCode/CLAUDE.md on macOS, C:\Program Files\ClaudeCode\CLAUDE.md on Windows), user (~/.claude/CLAUDE.md), project (./CLAUDE.md or ./.claude/CLAUDE.md) and local (./CLAUDE.local.md, meant to be gitignored). Files from the working directory and every directory above it are concatenated, not overridden; files in subdirectories load on demand when Claude reads, writes or edits something there.
Imports and comments: a line such as @path/to/file pulls another file into context, with relative paths resolved from the importing file and a maximum depth of four hops. Block-level HTML comments are stripped before injection so maintainers can leave notes at no token cost. Whether an external import (one whose path resolves outside the working directory) loads depends on which file contains it. In a project-level memory file such as a project CLAUDE.md, the first external imports Claude Code encounters trigger a one-time approval dialog, and declined imports stay disabled. Imports in user-scope files such as ~/.claude/CLAUDE.md normally load without that dialog, but in Cowork sessions on the desktop Claude Code skips user-scope imports that resolve outside the session's working directory. External imports in an AGENTS.md that Claude reads directly through the Project instructions setting load only if external imports were already approved for the project, and Claude Code does not prompt for them.
Rules: markdown files under .claude/rules/ (found recursively) can be loaded every session or scoped with a paths frontmatter field of glob patterns, so they load only when Claude touches matching files. Brace expansion is supported, with a shared budget of 1,000 expanded patterns and 4 MiB per rule's paths list. Symlinks in a project's .claude/rules/ can share rules across projects, but a link whose target is outside the working directory is treated like an external import: the linked rules wait for the project's external-import approval, and after approval only those without a paths field load. Links to network paths are not followed. User-level rules in ~/.claude/rules/ apply to every project on the machine and load without that project approval, except that Cowork sessions skip a symlinked ~/.claude/rules/ directory or rule file that points outside the working directory.
AGENTS.md: from Claude Code v2.1.277, Claude reads AGENTS.md as project instructions when no CLAUDE.md or CLAUDE.local.md exists in the working directory or above. A Project instructions setting (reachable through /config) can switch between claude-md-or-agents-md (default), claude-md-and-agents-md, claude-md and managed-only. The page also shows an @AGENTS.md import inside CLAUDE.md and a symlink alternative, and says /init and /import can migrate instructions from other tools such as Cursor rules and Copilot instructions.
Auto memory: Claude saves four kinds of notes (user, feedback, project, reference) into ~/.claude/projects/<project>/memory/, with a MEMORY.md index plus topic files. The first 200 lines or 25KB of MEMORY.md load each session; topic files are read on demand. The directory can be moved with autoMemoryDirectory, and auto memory can be turned off with the /memory toggle, the autoMemoryEnabled setting or CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
Management and diagnostics: /memory lists memory files and opens them in an editor; /context all lists loaded memory files; /init generates a starting CLAUDE.md; /doctor prompt-audit (v2.1.283 or later) reports outdated or conflicting instruction files and proposes edits without applying them until asked; claudeMdExcludes skips unwanted files in large monorepos.
Using it
Requirements
The page assumes a working Claude Code installation and a project directory. It does not state a minimum version for the basic CLAUDE.md feature, but it ties individual features to versions: AGENTS.md reading needs v2.1.277 or later (and some sessions, such as Amazon Bedrock or telemetry-disabled ones, needed v2.1.281); /doctor prompt-audit needs v2.1.283 or later; CLAUDE_CODE_PROJECT_DIR_NAME needs v2.1.234 or later; the per-file size limit on on-demand files applies from v2.1.309; the plugin ID cc-plugin-agents-md@builtin is read from v2.1.285.
Settings edits assume you can edit ~/.claude/settings.json or project settings files, and managed deployment assumes administrative access to /etc/claude-code, /Library/Application Support/ClaudeCode or C:\Program Files\ClaudeCode plus a configuration-management tool. The page does not list operating-system requirements for Claude Code itself, account or subscription requirements, or supported models beyond mentioning context-window sizes for the on-demand file limit. Those are unknown from this page.
How it works
According to the page, CLAUDE.md content is delivered as a user message after the system prompt, not as part of the system prompt. Claude reads it and tries to follow it, but the page says there is no guarantee of strict compliance, especially with vague or conflicting instructions. When two rules conflict, Claude may follow either, including a user-level rule against a project-level rule.
Loading is layered. At launch, Claude Code walks from the filesystem root down to the working directory, concatenating CLAUDE.md and CLAUDE.local.md files, with CLAUDE.local.md appended after CLAUDE.md in each directory so closer and more personal content is read last. Subdirectory files and path-scoped rules load later, when Claude uses a file tool (or a Bash read such as cat or head on a single file) on a matching location. After /compact, the project-root CLAUDE.md is re-read from disk and re-injected, while nested files and path-scoped rules reload on demand.
Auto memory works differently: Claude decides during a session whether something would help a future conversation and writes it to the memory directory. It skips what it can derive from the code and what CLAUDE.md already says. When a memory file starts with YAML frontmatter, Claude Code records a modified timestamp. After writes to MEMORY.md, Claude Code checks the 200-line and 25KB limits and prompts Claude to shorten the index if it is near or over them. Memory is machine-local and shared by all worktrees of the same git repository, so it is not shared across machines or cloud environments. Memory files are excluded from the transcript cleanup controlled by cleanupPeriodDays.
For guarantees, the page points elsewhere: a PreToolUse hook or a hook at a fixed lifecycle event for things that must always happen, and managed settings such as permissions.deny and sandbox.enabled for technical enforcement. The page states plainly that settings rules are enforced by the client whereas CLAUDE.md instructions are not a hard enforcement layer.
Setup steps the page describes
For a project CLAUDE.md, create ./CLAUDE.md or ./.claude/CLAUDE.md and put in build and test commands, coding standards, architectural decisions and naming conventions. The page suggests running /init to have Claude analyse the codebase and draft the file (it suggests improvements rather than overwriting an existing file), and setting CLAUDE_CODE_NEW_INIT=1 for an interactive multi-phase flow that can also set up skills and hooks. Confirm the file loaded by running /context all and checking the Memory files list.
For personal project preferences, create CLAUDE.local.md and add it to .gitignore. To share personal instructions across git worktrees, import a file from your home directory instead, for example a line reading @~/.claude/my-project-instructions.md.
For rules, put one-topic markdown files in .claude/rules/ and add a paths frontmatter list when they should apply only to matching files. For AGENTS.md, you can rely on the default: on v2.1.277 or later, Claude reads AGENTS.md only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or any directory above it. Your user-scope ~/.claude/CLAUDE.md, an organisation's managed CLAUDE.md and .claude/rules/ files do not count for that check, so they do not switch off the fallback and keep loading alongside AGENTS.md. Alternatively, put @AGENTS.md at the top of a CLAUDE.md, or change Project instructions in /config. For organisation-wide guidance, place a managed CLAUDE.md at the policy location or use the claudeMd key in managed-settings.json.
For auto memory, no setup is needed in local sessions because it is on by default. The page notes one documented difference: outside Claude Tag sessions, a session in a self-hosted environment runs with auto memory off by default. Use /memory to browse, edit or toggle it.
Examples taken from the page
Concrete-versus-vague instructions: the page recommends wording such as Use 2-space indentation instead of Format code properly, Run npm test before committing instead of Test your changes, and API handlers live in src/api/handlers/ instead of Keep files organized.
Path-scoped rule: a file in .claude/rules/ starting with frontmatter that lists paths: "src/api/**/*.ts", followed by a heading and bullets such as All API endpoints must include input validation and Use the standard error response format. It loads only when Claude works with matching files.
Sharing with other tools: a CLAUDE.md whose first line is @AGENTS.md, followed by a section headed Claude Code with a line such as Use plan mode for changes under src/billing/. Claude reads the imported file first, then the Claude-specific text. The page warns that a symlink (ln -s AGENTS.md CLAUDE.md) has editing limits and is a poor choice on Windows.
Managed guidance: a managed-settings.json entry with a claudeMd string such as Always run make lint before committing and Never push directly to main, with the reminder that this is behavioural guidance and that blocking actions belongs in permissions.deny.
These examples are quoted or paraphrased from the page; none of them was run for this report.
Assessment & evidence
Limitations and risks
Compliance is not guaranteed. The page says CLAUDE.md is context, not enforced configuration, and recommends hooks or managed permission rules for anything that must happen or must be blocked. Conflicting instructions across files can be resolved arbitrarily, and the page lists no priority rule that overrides one file with another.
Size and loading limits can silently cut instructions. MEMORY.md content beyond 200 lines or 25KB is not loaded at session start. A CLAUDE.md over 4 MiB is skipped entirely. On-demand files (subdirectory CLAUDE.md files and path-scoped rules) are truncated to their start, with a note telling Claude to read the rest, when they exceed 40,000 characters on a 200K context window, or 200,000 or 150,000 characters on a 1M window depending on the model.
Behaviour varies by version and session type. AGENTS.md is not read before v2.1.277, in some sessions such as those with the built-in plugin disabled, and possibly in the first session after an upgrade. InstructionsLoaded hooks do not fire for an AGENTS.md read through the setting, and additional-directory AGENTS.md files do not load. An external @path import in an AGENTS.md read through the setting loads only if external imports were already approved for the project, and Claude Code does not prompt for it. Adding a CLAUDE.local.md can stop AGENTS.md being read unless the setting is changed.
Security-relevant behaviour is noted, and it differs by file type. External imports in project-level memory files trigger a one-time approval dialog, and declined imports stay disabled. Imports in user-scope files such as ~/.claude/CLAUDE.md normally load without that dialog, except in Cowork sessions on the desktop, where Claude Code skips user-scope imports that resolve outside the session's working directory. Symlinks in a project's .claude/rules/ that point outside the working directory are treated like external imports and need project approval, whereas rules kept in ~/.claude/rules/ load without that approval (Cowork sessions skip symlinked user rules pointing outside the working directory). Network-path symlinks are not followed, and repository-supplied settings that choose an auto memory directory are subject to workspace trust rules. The page does not assess whether auto memory could store sensitive information, so that risk is not assessed here. Auto memory is not automatically shared across separate machines or cloud environments; worktrees of the same repository share its memory directory. The page does not say how well Claude chooses what to save.
The page also covers only memory; it does not describe the rest of Claude Code. Nothing here was verified by running Claude Code.
Why this is worth reading
The page is the primary source for how Claude Code treats project instructions, so it answers questions that third-party summaries can get wrong: which file wins, when a nested file loads, why AGENTS.md is ignored, and why an instruction seems forgotten after /compact. Its troubleshooting section is organised around those symptoms, with ordered checks such as looking for a CLAUDE.md on the path, checking claude --version, and confirming the Project instructions setting.
It is also candid about trade-offs, for instance that imports do not save context, that rules without paths load every session, and that a short, concrete CLAUDE.md works better than a long one. Those points help readers avoid the common mistake of stuffing every convention into one large file.
The confidence in this assessment is limited to the content of the captured page: it is one document, written by the product vendor, with no independent measurement of how well the recommendations work.
Alternatives and related options
Within the page, the alternatives to CLAUDE.md are: skills for multi-step procedures and task-specific instructions that should load only when relevant; path-scoped rules for instructions that apply to one part of a codebase; hooks for actions that must run at fixed points regardless of what Claude decides; managed settings (permissions.deny, sandbox.enabled) for enforcement; the --append-system-prompt flag for system-prompt-level instructions in scripts and automation; and subagent memory for subagents that keep their own auto memory.
The page also names other tools' instruction formats only as migration sources: Cursor rules, Copilot instructions, and, with the new init flow, AGENTS.md, Devin, Windsurf and Cline rule files. It does not compare Claude Code's memory with the memory or instruction features of other products, so any such comparison is not assessed here.
Evidence base
The report rests on one documentation page, How Claude remembers your project, at [https://code.claude.com/docs/en/memory.md], as captured on 2026-11-12.
Statements about how Claude Code behaves, including file locations, load order, limits, settings, commands and version numbers, report what that page documents. The overall assessment, the judgements about audience, strengths and weaknesses, and the suggested next steps are this report's interpretation of the page, not claims the page itself makes.
Linked pages (hooks guide, skills, settings reference, sub-agents, managed settings, commands, error pages) were not reviewed, so claims about them are limited to what the memory page says about them. No code was executed, no Claude Code session was started, and no behaviour, limit or version number was independently checked.
Access & freshness
Costs
The captured page specifies neither access charges for the documentation nor Claude Code pricing, licence fees or subscription requirements, so monetary costs remain unknown.
The page does describe a context cost. Files that load at launch, such as CLAUDE.md and CLAUDE.local.md files in the working directory and the directories above it and rules without paths frontmatter, take up context in every session. Nested CLAUDE.md files in subdirectories and path-scoped rules load on demand, only when Claude works with files in matching locations. Files pulled in with @ imports load together with the file that contains them, so imports organise content but do not reduce its context cost. Some files never load or load only in part: claudeMdExcludes patterns skip files, external imports and out-of-directory rule symlinks in project files wait for approval, a file over 4 MiB is skipped, and on-demand files over the per-file limit are cut to their start.
The page recommends staying under 200 lines per CLAUDE.md, saying longer files consume more context and reduce adherence. MEMORY.md loads only its first 200 lines or 25KB. Claude Code shows a startup and /status warning for files over the recommended length. The page does not translate this into token counts or money.
Rights and licence
The captured page text contains no licence statement, copyright notice or reuse terms. The reuse rights for the documentation text are therefore unknown from this evidence, and no licence file was captured alongside it. Readers who want to copy or redistribute the text should check the terms on the Claude Code documentation site rather than assume permission.
The configuration snippets on the page are short illustrations of file formats and settings keys. The page does not say whether they carry separate terms, so treat that as not established.
Freshness
The page carries no visible publication or last-updated date in the captured text. The most recent version number it mentions is v2.1.309 (the on-demand file size limit), and its earlier version notes include v2.1.285, v2.1.283, v2.1.281, v2.1.277, v2.1.239, v2.1.234 and v2.1.211. The page appears to be actively maintained because it documents behaviour changes by version, but how current it is relative to the latest Claude Code release is unknown.
Settings names, plugin IDs, size limits and command behaviour are the parts most likely to change. Readers should compare claude --version and the live documentation before relying on a specific limit or flag.
Suggested next steps
If you use Claude Code and have no project instructions yet, read the CLAUDE.md files, Write effective instructions and AGENTS.md sections, then try /init and review the generated file before keeping it. Keep it short, concrete and under about 200 lines, and move part-codebase guidance into rules with paths frontmatter.
Check what loaded with /context all and /memory, and confirm your Claude Code version meets the thresholds for any feature you rely on, especially AGENTS.md support. If you have both AGENTS.md and CLAUDE.md, decide between an @AGENTS.md import and the claude-md-and-agents-md setting.
For anything that must always or never happen, use hooks or permission settings rather than CLAUDE.md. Periodically review auto memory files in the memory folder for stale or sensitive content, and consider /doctor prompt-audit on supported versions to find conflicting instructions.
Before reusing the page's text elsewhere, check the licence terms on the source site, since none were captured.
