October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Organize Claude Code Reference Files So the Right Context Loads

Organize Claude Code guidance by scope: concise project rules in CLAUDE.md, specialist instructions in path-scoped rules, and accumulated learnings in auto memory.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep concise, project-wide instructions in CLAUDE.md, move specialist guidance into .claude/rules/, and scope rules to file paths when they only apply to part of a codebase. Use imports when supporting material should load from the start—not to save context—and use auto memory for Claude’s recorded learnings rather than team rules. Then check what actually loaded with /context.

Choose the file location by who needs the guidance

Claude Code supports several instruction scopes. Put shared project guidance in the repository, personal preferences in your home directory, and organization-wide policy in a managed location. Keep private preferences in a local project file that is excluded from version control.

As an Amazon Associate I earn from qualifying purchases.

Location or mechanism Best for How it is used
./CLAUDE.md or ./.claude/CLAUDE.md Stable project context shared with the team, such as architecture, conventions, build commands, and workflows Project guidance loaded with the working context
~/.claude/CLAUDE.md Your preferences that should apply across projects User-level guidance
CLAUDE.local.md Private, project-specific preferences Keep it gitignored; it exists only in the worktree where you created it
Managed policy files Organization-wide instructions administered by IT or DevOps Central policy rather than repository-specific guidance
.claude/rules/ Specialist guidance, optionally limited to matching paths Rules load unconditionally unless scoped with paths frontmatter
Auto memory Learnings and patterns Claude records, such as corrections or preferences Loaded at conversation start; the loaded portion is limited to its first 200 lines or 25KB

The official Claude Code memory documentation describes these locations and their roles. In practice, make the project file the short orientation Claude should have for nearly any task; avoid putting a long procedure there when it belongs in a narrower rule or a task-specific skill.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the root CLAUDE.md concise and universally useful

Use the root file for stable facts and instructions that matter throughout the repository: architecture, naming conventions, code conventions, common workflows, and exact build or test commands. Avoid filling it with multi-step procedures or advice relevant to only one directory; those details increase the always-loaded context without helping unrelated work.

Claude Code’s documentation recommends keeping each CLAUDE.md under 200 lines. That is product guidance, not a guarantee that every instruction will be followed. Favor explicit, verifiable directions: for example, give the actual test command instead of saying “test everything,” or state the required indentation instead of “format code properly.” As the docs put it, “The more specific and concise your instructions, the more consistently Claude follows them.” See the Claude Code best practices.

Move specialist guidance into .claude/rules/

For a larger project, put separate topics in .claude/rules/ with names that make their purpose clear. Rules can live in subdirectories. A rule without a paths field applies generally; a rule with path frontmatter applies when Claude works with matching files.

project/
├── CLAUDE.md
└── .claude/
    ├── rules/
    │   ├── testing.md
    │   ├── security.md
    │   └── api.md
    └── skills/

This is an illustrative layout, not a required structure. For example, an API rule can be scoped to API files, while a testing rule can remain general if it applies across the repository. Claude Code says scoped rules trigger when it uses Read, Write, or Edit on a matching file. Choose clear matching patterns: an overly broad path can make specialized notes load more often than intended. Use skills for task-specific procedures that do not need to sit in context all the time. See the official memory and rules guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand what imports do to context

A CLAUDE.md can pull in supporting files with an @path/to/file import. Relative paths resolve from the file containing the import; absolute paths are also supported. Imports expand into context at launch and can recursively import to a maximum depth of four hops.

That makes imports useful for keeping related material in separate files, but not for reducing context use: if every imported file loads at startup, its contents still consume context. To make guidance load only for relevant work, use path-scoped rules instead of importing everything unconditionally.

  • Escape spaces in imported paths.
  • Paths inside Markdown code spans or fenced code blocks are not evaluated as imports.
  • External imports from project-level files require an approval dialog.

These import details are covered in the official Claude Code memory documentation.

Know when nested CLAUDE.md files load

At launch, Claude Code loads CLAUDE.md and CLAUDE.local.md files from the current directory and its ancestors. Ancestor instructions appear before more specific working-directory instructions. It can also discover CLAUDE.md files in subdirectories, but those are included when Claude reads files in those directories, not automatically at launch.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This gives you a way to keep directory-specific guidance near the code it describes. Use a nested file when the context belongs to that part of the project, rather than promoting it into the root file where it would affect every session. The distinction is documented in How Claude remembers your project.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use auto memory for learnings, not authored project rules

Authored CLAUDE.md files express instructions and rules you choose to maintain. Auto memory is written by Claude for accumulated learnings and patterns, such as corrections or preferences. Both are described as loading at the start of each conversation, but auto memory loads only its first 200 lines or 25KB.

Keep deliberate, team-relevant rules in version-controlled project instructions. Review auto memory as well: a recorded preference may be useful to Claude without being a policy the whole team should inherit. Use /memory to inspect or edit memory files; use /context to see what memory files are loaded.

Check what loaded and keep it current

  1. Inspect the active context: run /context in Claude Code to check which memory files loaded.
  2. Review or edit memory: run /memory when you need to inspect or change memory files.
  3. Start a project file if needed: use /init to create a starting CLAUDE.md by analyzing the codebase, then refine it with project-specific guidance Claude could not infer.
  4. Look for outdated or contradictory instructions: the CLI reference describes /doctor prompt-audit for this purpose; it requires Claude Code v2.1.283 or later.

These commands and the audit version requirement appear in the Claude Code CLI reference and memory documentation. Since product behavior and command availability can change, check the current official docs if your installation behaves differently.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical placement decision

  • Does this rule apply to almost every task in this repository? Put the concise, stable version in the project CLAUDE.md.
  • Does it apply only to certain file types or directories? Put it in .claude/rules/ and scope it with path frontmatter.
  • Is it your personal preference or private project note? Use the user-level file or a gitignored CLAUDE.local.md, respectively.
  • Should it be available at session start even though it lives elsewhere? Import it, accepting that the imported content still uses context.
  • Is it an accumulated correction or pattern rather than an authored team rule? Review it in auto memory.
  • Is it a procedure needed only for a particular kind of task? Consider a skill instead of keeping it always loaded.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.