How Claude Code Uses CLAUDE.md During a Session

You’ve created a CLAUDE.md. You know it helps. But you’re not entirely sure how it helps — when Claude reads it, whether it reads all of it, and whether there are ways to write it that make it more or less effective.

Understanding the mechanics turns CLAUDE.md from “a file I set up once” into something you deliberately craft for maximum impact.

📋 TL;DR
– Claude reads your CLAUDE.md at session start and holds it in context throughout the session
– It’s treated as high-priority instruction — similar to a system prompt
– Claude reads the entire file, but content near the top tends to have a stronger effect
– CLAUDE.md doesn’t override explicit in-session instructions — it sets defaults
– The file is re-read at the start of each new session — changes take effect on the next session

This is part of our complete CLAUDE.md — The Complete Beginner’s Guide (2026). If you haven’t built your CLAUDE.md yet, start with How to Create Your First CLAUDE.md File.


What Happens When You Start a Claude Code Session

When you run claude in your terminal, Claude Code does several things before it’s ready for your first message. One of those things is scanning for CLAUDE.md files.

Here’s the sequence:

  1. Claude checks for a global CLAUDE.md in your home directory (~/CLAUDE.md). If it exists, Claude reads it.
  2. Claude checks for a project-level CLAUDE.md in your current working directory. If it exists, Claude reads it.
  3. Both files are combined into context. The global file provides the baseline; the project file layers on top.
  4. Claude is now ready. Your first message is interpreted with all that context already loaded.

You don’t see this happen. There’s no confirmation message, no “CLAUDE.md loaded” notification. It happens silently, and the effect is that Claude walks into the session already knowing your project.

A terminal showing the claude command being run in a project directory, with the Claude Code prompt appearing ready for input — the CLAUDE.md file is visible in the same directory listing


How Claude Treats CLAUDE.md Instructions

CLAUDE.md is treated as high-priority context, similar to instructions given at the start of a session. Claude takes it seriously and uses it to shape its behavior throughout the session.

But it’s not a hard-coded rule set. Claude uses CLAUDE.md to set defaults and preferences — not to lock behavior completely. A few important implications of this:

In-session instructions override CLAUDE.md. If your CLAUDE.md says “use single quotes” but you tell Claude in a message “use double quotes for this file,” Claude will use double quotes for that file. The explicit, in-session instruction takes precedence.

CLAUDE.md sets the default, not the ceiling. If your CLAUDE.md says “write TypeScript” but you’re working in a JavaScript file and ask Claude to write a quick fix, Claude will write JavaScript. Context matters, and Claude uses judgment.

CLAUDE.md doesn’t guarantee perfect compliance. Claude is a language model, not a rules engine. It follows CLAUDE.md instructions reliably, but it can be overridden, it can miss things in a complex session, and on rare occasions it may interpret an ambiguous rule differently than you intended. For critical constraints, a reminder in your message (“remember: no any in TypeScript”) can reinforce the rule.

💡 Pro Tip: Think of CLAUDE.md as a thorough briefing you’d give a new contractor. They’ll read it, take it seriously, and follow your guidelines — but they can still be given new instructions during the job, and they’ll use judgment when guidelines don’t cover a specific situation. That’s the right mental model.


How Claude Reads the File: What Matters for Effectiveness

Claude reads your entire CLAUDE.md file. It doesn’t skim or stop partway through. However, the way language models process text means some practical things about file structure affect how reliably instructions are followed.

Position Within the File

Content at the top of your CLAUDE.md has a stronger effect than content at the bottom. This is a well-documented behavior of language models — earlier context tends to have more weight on the model’s outputs than later context.

Practical implication: put your most important rules near the top. Tech stack, critical constraints, and the most important coding standards should come before detailed folder documentation or command lists.

Clarity and Specificity

Specific, concrete instructions are followed more reliably than vague ones. Claude reads “no semicolons” and knows exactly what to do. Claude reads “maintain our existing code style” and has to infer what that means.

This is the #1 factor in CLAUDE.md effectiveness — more important than position, more important than length, more important than formatting. Specific beats vague, always.

Heading Structure

Headings help Claude organize and apply rules appropriately. A ## Coding Standards heading followed by formatting rules signals that those rules are about code style. A ## Constraints heading signals that what follows are hard limits.

This means your headings aren’t just for your own readability — they provide semantic context to Claude about what each section means.


Does Claude Read CLAUDE.md for Every Message?

The CLAUDE.md content is loaded into context at session start and stays there throughout the session. It doesn’t get re-read with each message — it’s already in context.

Think of it like working memory. Once a human reads a briefing document, they don’t re-read it before every action — the information is already in their head. Claude works the same way for the duration of a session.

In very long sessions, the context window has limits. If you’re in an extremely long session with many large files already loaded, older context — including parts of your CLAUDE.md — may be pushed out to make room for more recent content. This is rare in typical sessions but worth knowing.

⚠️ Warning: This is why an extremely long CLAUDE.md can hurt performance. A 1,000-line CLAUDE.md takes up significant context space from the start of every session. In complex sessions, that leaves less room for actual code. Keep your CLAUDE.md to the essential content — see How Long Should Your CLAUDE.md Be? for guidance.


When Do Changes to CLAUDE.md Take Effect?

Changes to your CLAUDE.md take effect the next time you start a Claude Code session. The current session doesn’t pick up edits made during it.

This means:

  • If you realize mid-session that you need to add a rule, add it — but the current session won’t use it
  • You don’t need to restart for every small change; wait until your next natural session break
  • If you make a big change to your architecture or standards, start a fresh session to make sure Claude is working from the updated file

How CLAUDE.md Interacts With Your Prompts

Understanding this interaction helps you write better prompts and a better CLAUDE.md.

CLAUDE.md provides persistent context. Your prompts provide session-specific instructions.

Your CLAUDE.md says: “we use TypeScript strict mode, no any“

Your prompt says: “add a loading spinner to the UserDashboard component”

Claude combines these: it writes the loading spinner in TypeScript strict mode without any, because the CLAUDE.md rule is in context alongside your prompt instruction.

You don’t need to repeat CLAUDE.md content in your prompts. That’s the whole point — the rules are already there. A prompt like “using our TypeScript strict mode standards, add a loading spinner to the UserDashboard component” is redundant if your CLAUDE.md already covers TypeScript strict mode.

Where prompts add value over CLAUDE.md:

  • Session-specific context that doesn’t apply permanently (“I’m working on the auth flow today”)
  • One-time exceptions to your normal rules (“use double quotes for this file for consistency with the vendor code”)
  • Very specific task context that would be too detailed to live in CLAUDE.md permanently

Reading Order and Priority

When both a global and a project-level CLAUDE.md exist, Claude reads them in this order:

  1. Global CLAUDE.md (~/CLAUDE.md)
  2. Project-level CLAUDE.md (current directory)

The project-level file’s content is treated as higher priority when the two cover the same topic. So if your global CLAUDE.md says “prefer 2-space indentation” and your project CLAUDE.md says “use 4-space indentation,” Claude will use 4 spaces in that project.

This design is intentional. Personal preferences are a baseline. Project conventions override them.


How to Write CLAUDE.md for Maximum Effectiveness

Now that you understand how Claude uses the file, here are the practical implications for how to write it:

Front-load the most important rules. Tech stack first, critical constraints second. Don’t bury your “never use any” rule on line 200.

Be specific at the rule level. Don’t trust Claude to infer your preferences from vague guidance. “Named exports only” is specific. “Follow our component export conventions” is not.

Use headings semantically. ## Constraints signals hard limits. ## Preferred Patterns signals defaults. Headings give Claude context about how strictly to apply what follows.

Keep it honest. CLAUDE.md works best when it accurately describes your project. Rules that describe an aspirational standard you’re not actually following create inconsistency — Claude follows the rule in new code, but existing code doesn’t match.

Don’t repeat rules. If a rule appears twice in different sections, it wastes context and can create subtle contradictions. State each rule once in the most logical section.


Verifying That Claude Is Using Your CLAUDE.md

If you want to confirm Claude is reading your file in a given session, ask directly:


What language and framework is this project using, according to our project setup?

Or:


What are our indentation and semicolon rules?

Claude should answer using the specific information from your CLAUDE.md. If it gives generic answers, check that:

  • The file is named exactly CLAUDE.md (all caps, .md extension)
  • You’re running claude from the same directory as the file
  • The file has actual content — not just headings with empty sections

Key Takeaways

  • CLAUDE.md is read at session start** and held in context throughout — it doesn’t get re-read per message
  • It’s treated as high-priority context**, similar to a system prompt, but not as an unbreakable rule set
  • In-session instructions override CLAUDE.md defaults** — explicit beats implicit every time
  • Content near the top has stronger influence** — put your most important rules first in the file
  • Changes take effect on the next session** — edit mid-session if you want, but restart to use the update

Next Steps

Return to CLAUDE.md — The Complete Beginner’s Guide (2026) for the full picture.