CertSafari
    Anthropic Claude Certified Developer – Foundations (CCDV-F)· Lessons

    Domain 3 · Lesson 10/25

    Claude Code Project Configuration: CLAUDE.md, Rules, Auto Memory and settings.json

    Claude Code Operation

    9 min read
    3.1% of exam
    3 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Place an instruction at the right CLAUDE.md scope: managed, user, project or local
    • Bootstrap a repository with /init and scope instructions to file types with .claude/rules/
    • Tell CLAUDE.md apart from auto memory, and configure or turn off auto memory
    • Choose the right settings.json scope and work out which value wins when a key is set in several places

    Key concept

    Layered persistent context — Claude Code starts every session from files on disk, not from earlier chats. You write instructions in CLAUDE.md files at different scopes, and Claude adds its own notes through auto memory. settings.json files then set what the tool is allowed to do.

    1.The CLAUDE.md hierarchy

    A CLAUDE.md file holds instructions you write, and it loads into every session. The hard part is choosing where to put it. There are four scopes. Each one answers a different question: who should this instruction reach, and should it be committed to git?

    The four CLAUDE.md scopes
    ScopeLocationShared with
    Managed policy/Library/Application Support/ClaudeCode/CLAUDE.md (macOS), /etc/claude-code/CLAUDE.md (Linux and WSL)All users in organization
    User instructions~/.claude/CLAUDE.mdJust you (all projects)
    Project instructions./CLAUDE.md or ./.claude/CLAUDE.mdTeam members via source control
    Local instructions./CLAUDE.local.mdJust you (current project)

    CLAUDE.local.md is for personal project-specific preferences, such as your sandbox URLs, and you should add it to .gitignore. The project file is what the team shares. If a repository has an AGENTS.md, Claude reads it 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-level and managed CLAUDE.md files don't count toward that rule.

    Write instructions that are specific. 'Use 2-space indentation' works better than 'Format code properly'. Keep each file under about 200 lines, and group related rules under headers. If two instructions contradict each other, Claude may follow either one. You can split a long file with @path imports, but imports don't make it cheaper: the imported files load at launch too.

    @path imports inside a CLAUDE.mdmarkdown
    See @README for project overview and @package.json for available npm commands for this project.
    
    # Additional Instructions
    - git workflow @docs/git-instructions.md

    Two built-in slash commands help when an instruction seems to be ignored. /context lists the memory files that actually loaded. /memory opens those files so you can edit them.

    Checkpoint 1 of 6· Check yourself

    You want Claude to use your personal staging URL in one repository, and you don't want teammates to see it. Where does the instruction go?

    Checkpoint 2 of 6· Exam question

    A developer wants their project's CLAUDE.md to mention the path to a git workflow guide without pulling its contents into every session's context. They write `` `@docs/git-instructions.md` `` wrapped in backticks inside a paragraph. What happens when Claude Code parses this CLAUDE.md at session start?

    Sources1

    2.Repository initialization with /init, and path-scoped rules

    In a new repository you don't need to write CLAUDE.md from scratch. Run /init and Claude explores the codebase and drafts one, covering build and test commands, a structure overview and any conventions it detects. The draft is only a starting point: review it, delete anything inaccurate, then commit it so the team shares it.

    Checkpoint 3 of 6· Put it in order

    Put the repository initialization workflow in order

    1. 1.Commit the file
    2. 2.Type /init in the project
    3. 3.Review the draft and remove anything inaccurate
    4. 4.Claude explores the codebase and drafts a CLAUDE.md

    As the project grows, some instructions only matter for part of the code. Put those in Rules: markdown files under .claude/rules/. A rule with a paths frontmatter field loads only when Claude works with files that match its glob patterns, so API conventions don't take up context while Claude edits CSS. You can also keep personal rules in ~/.claude/rules/.

    A path-scoped rule in .claude/rules/markdown
    ---
    paths:
      - "src/api/**/*.ts"
    ---
    
    # API Development Rules
    
    - All API endpoints must include input validation
    - Use the standard error response format
    - Include OpenAPI documentation comments

    Checkpoint 4 of 6· Fill the gap

    Which frontmatter field scopes this rule to matching files?

    ---
     ? :
      - "src/**/*.{ts,tsx}"
      - "lib/**/*.ts"
      - "tests/**/*.test.ts"
    ---

    Sources21

    3.Agent memory: auto memory alongside CLAUDE.md

    CLAUDE.md holds what you tell Claude. Auto memory holds what Claude learns: it writes its own notes when you correct it or confirm an approach that worked. The two systems differ in who writes them, what they hold and how much of them loads.

    CLAUDE.md compared with auto memory
    AspectCLAUDE.md filesAuto memory
    Who writes itYouClaude
    ContainsInstructions and rulesLearnings and patterns
    ScopeProject, user, or orgPer repository, shared across worktrees
    Loaded intoEvery sessionEvery session (first 200 lines or 25KB)

    Memories are stored under ~/.claude/projects/<project>/memory/. A MEMORY.md index there points to one file per memory. Each memory has a type: user (your role and preferences), feedback (corrections and confirmed approaches), project (ongoing work and decisions that the code doesn't show), or reference (where to find outside information). You control it from settings: autoMemoryDirectory moves the folder, and autoMemoryEnabled turns the feature off.

    Turning auto memory off in settingsjson
    {
      "autoMemoryEnabled": false
    }

    Checkpoint 5 of 6· Match them up

    Match each auto memory type to what it records

    Tap a term, then the definition that fits it.

    Sources1

    4.settings.json scopes and precedence

    CLAUDE.md tells Claude what to do. settings.json controls what Claude Code allows and how it is configured: permissions, hooks, plugins, environment variables and the model. Settings files have four scopes, like CLAUDE.md, but the local scope works differently in git.

    settings.json scopes
    ScopeFileUse it for
    User~/.claude/settings.jsonPersonal preferences across every project
    Shared project.claude/settings.jsonTeam permissions, hooks, plugins, env vars; commit it
    Project local.claude/settings.local.jsonPersonal overrides for one project; kept out of git
    Managedmanaged-settings.json and other managed sourcesOrganization security and compliance policy
    A shared .claude/settings.json with allow and deny permission rulesjson
    {
      "$schema": "https://json.schemastore.org/claude-code-settings.json",
      "permissions": {
        "allow": [
          "Bash(npm run lint)",
          "Bash(npm run test *)"
        ],
        "deny": [
          "Read(./.env)",
          "Read(./.env.*)"
        ]
      }
    }

    When the same key is set in more than one place, the highest scope wins. The order is managed settings, then command-line arguments, then project local, then shared project, then user. The --settings flag passes JSON for a single session and sits above all your own files. Nothing you set overrides a managed key. Claude Code creates .claude/settings.local.json itself the first time you give a standing approval on a permission prompt, and keeps it out of your commits. If ~/.claude.json can't be parsed, a -p run prints the error and exits.

    Checkpoint 6 of 6· Put it in order

    Order these sources from highest to lowest precedence for a key set in all three

    1. 1.Managed settings
    2. 2.~/.claude/settings.json
    3. 3.JSON passed with --settings

    Sources3

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Moving parts of a long CLAUDE.md into @imported files saves context.Why is that wrong?

      Imported files also load at launch. They make the file easier to organize but cost the same context. To save context, use path-scoped rules.

      Covered in The CLAUDE.md hierarchy

    2. 2.Everything auto memory has saved is loaded into each new session.Why is that wrong?

      Only the start of the memory index loads at session start: the first 200 lines or 25KB.

      Covered in Agent memory: auto memory alongside CLAUDE.md

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence.”
      ↩︎ The CLAUDE.md hierarchy
      “if two instructions contradict each other, Claude may pick one arbitrarily.”
      ↩︎ The CLAUDE.md hierarchy
      “a CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md in your working directory or any directory above it”
      ↩︎ The CLAUDE.md hierarchy
      “Run /context and check the list under Memory files to verify your CLAUDE.md and CLAUDE.local.md files loaded.”
      ↩︎ The CLAUDE.md hierarchy
      “Move instructions that matter for only part of the codebase into path-scoped rules, which load only when Claude works with matching files.”
      ↩︎ Repository initialization with /init, and path-scoped rules
      “notes Claude writes itself based on your corrections and preferences”
      ↩︎ Agent memory: auto memory alongside CLAUDE.md
      “Give Claude persistent instructions with CLAUDE.md or AGENTS.md files, and let Claude accumulate learnings automatically with auto memory.”
      ↩︎ Key concept
      “because imported files also load at launch.”
      ↩︎ Exam trap 1
      “Every session (first 200 lines or 25KB)”
      ↩︎ Exam trap 2
      “Personal project-specific preferences; add to .gitignore”
      ↩︎ Checkpoint
      “feedback: corrections you give Claude and approaches you confirm”
      ↩︎ Checkpoint
    2. 2.
      “In any project, type /init. Claude will explore the codebase and draft a CLAUDE.md for you”
      ↩︎ Repository initialization with /init, and path-scoped rules
      “Review the draft, remove anything inaccurate, and commit it.”
      ↩︎ Checkpoint
    3. 3.
      “Team permissions, hooks, plugins, and the environment variables the project needs”
      ↩︎ settings.json scopes and precedence
      “it takes a key you set here over the same key in local, project, or user settings”
      ↩︎ settings.json scopes and precedence
      “Claude Code applies it above your user, project, and local files and below managed settings.”
      ↩︎ Checkpoint

    Continue to page 2 of 2

    Running Claude Code: Skills, Subagents, Sessions, Headless and Auto Mode

    Spotted a mistake, or was something unclear? Tell us.