Chapter 8. Project Memory and Settings
Required Read this to follow this stage.One-line summary: Rules you're tired of repeating every time go in
CLAUDE.md. Rules that must be followed become deny rules insettings.json.
The screens in this chapter are the results of running Claude Code 2.1.318 on Linux on November 6, 2026.
As you saw in Chapter 6, a new session doesn't know past conversations. So you end up saying "write the meeting notes as a table" again every time. In this chapter, you write that down in a file.
What to Write in CLAUDE.md
CLAUDE.md is a set of lasting instructions that you write. If you put it in a project folder, it's loaded whenever you start claude in that folder.[1] Think of it as a work memo you give to a new coworker.
The rule for what to write is simple. Write only what Claude can't figure out by reading the files.[2] For example: the language for answers, the sections of the meeting notes, and the folder to save results in.
There are also things not to write.
- A description of the folder structure. Claude reads it for itself.[2:1]
- Procedures with several steps. These fit better as skills (files where you write down a procedure and call it by name) in Chapter 9.[3]
- Passwords or login credentials
Aim for under 200 lines per file.[1:1] You don't need to pile on capital letters or "MUST!!" either. Piling on emphasis actually makes it easy for the rule to be over-applied.[2:2]
Weaker example: Organize the meeting notes really!! neatly and well!!
Better example: Write meeting notes with only three sections: decisions, to-dos, next meeting.You can check whether the better example was followed or not. There's no way to check "neatly."
Quick check
Which is the best thing to write in `CLAUDE.md`?
Making and Checking CLAUDE.md
Here are the practice rules (view as a file: ch8-CLAUDE.md.txt). Leave with /exit and move to the practice folder in the terminal. On Mac and Linux, paste the whole block below. It also creates the notes folder.
mkdir notes
cat > CLAUDE.md <<'EOF'
# Corner Cafe memo organizing rules
- Write answers in Korean.
- Write meeting notes with only three sections: decisions, to-dos, next meeting.
- Write to-dos as a table. The columns are owner, to-do, deadline.
- Don't make up anything that isn't in the memo.
- Save organized files in the notes folder.
EOFAfter pasting, if it hasn't run yet, press Enter once more. If nothing appears, it worked. Use ls to check that CLAUDE.md and notes were created.
On Windows PowerShell, after mkdir notes, open Notepad with notepad CLAUDE.md. Leave out the line starting with cat and the EOF line, and enter only what's between them. If it asks whether to create a new file, click Yes, then save with Ctrl + S and close. We did not test this method.
Check in the terminal whether a new session knows the rules. This time, use claude -p. With -p, no conversation window opens. It prints just the answer to one question in the terminal and finishes right away. It's handy for a quick check. Details are covered in Chapter 10.
claude -p "What are the meeting notes rules for this folder? Answer in three lines."1. Meeting notes use only three sections: decisions, to-dos, next meeting, and nothing that isn't in the memo is made up.
2. To-dos are written as a table with owner, to-do, and deadline columns.
3. Answers are written in Korean, and organized files are saved in the notes folder.It answered with rules that were never mentioned in the conversation. That means the file was loaded. Your own habits for every project go in ~/.claude/CLAUDE.md.[1:2]
For this exercise, just write CLAUDE.md yourself. There's also an /init command that makes a draft automatically, but we won't use it now.
When do I use /init? (click to expand)
/init is a command that automatically makes a draft CLAUDE.md. But it analyzes code and writes down the build commands, testing methods, and project conventions it finds.[4] Our memo folder has none of those, so writing it yourself is easier. This guide didn't run it either. Try it later when you work on a code project.
Quick check
You want to make a `CLAUDE.md` in a folder that has only meeting notes. Which way does this guide recommend?
/memory and Auto Memory
Type /memory inside a session and a list of instruction files appears.[5]
❯ Auto-memory true
❯ Project instructions Checked in at ./CLAUDE.md
User instructions Saved in ~/.claude/CLAUDE.md
Open auto-memory folderAuto memory on the first line is notes Claude writes on its own based on your corrections and preferences. You write CLAUDE.md; Claude writes auto memory. It's on by default in local sessions.[5:1]
It's saved per project in the ~/.claude/projects/<project>/memory/ folder. These are ordinary Markdown files, so you can edit or delete them anytime. To turn it off, use the toggle inside /memory.[5:2]
If you say "remember this," it saves it to auto memory.[5:3] But if it's a rule that must always be followed in this folder, write it directly in CLAUDE.md. Since you wrote it, it's clear what's written there.
Quick check
Which is the correct difference between auto memory and `CLAUDE.md`?
Three Locations for settings.json
settings.json is the settings file that changes how Claude Code behaves.[6] Its contents are written in JSON format. JSON is text that writes field names and values in a fixed shape. The deny rule you made in Chapter 7 is in here. There are three places to put it.[6:1]
| File | Applies to |
|---|---|
~/.claude/settings.json | All projects on my computer |
.claude/settings.json | Everyone working in this folder |
.claude/settings.local.json | Only me, only in this project |
If the same setting is in several places, the one with the narrower scope in the table wins.[6:2][7] For example, if the files in the first and third rows set it differently, the third row (only me, only in this project) wins.
Deny rules are the exception. A tool denied at any level can't be allowed by another level.[8]
- When you save, most changes apply even to a running session without a restart.[6:3]
- You can see which files were loaded on the Setting sources line of
/status.[6:4] - Trailing commas and comments aren't allowed.[9] If something doesn't take effect after you edit by hand, check the commas first.
Wrong example: { "deny": ["Read(./secret/**)"], }
Right example: { "deny": ["Read(./secret/**)"] }The wrong example has a comma left after the ].
Quick check
You want settings that apply only to you, and only in this project. Which file is right?
The .claude Folder Structure
Claude Code reads instructions, settings, and memory from the project folder and from ~/.claude in your home folder.[10] Folders whose names start with a dot are normally hidden. You can see them with ls -a (ls -Force in PowerShell).
~/hello-ai-practice/terminal/ This project
├── CLAUDE.md Shared instructions
├── CLAUDE.local.md Instructions just for me
└── .claude/
├── settings.json Shared settings
├── settings.local.json Settings just for me
├── skills/ This project's skills
└── agents/ This project's subagents
~/.claude/ All my projects
├── CLAUDE.md, settings.json Personal instructions and settings
├── skills/, agents/ Personal skills and subagents
└── projects/ Conversation history and auto memoryYou'll learn skills/ and agents/ in Chapter 9. A skill is a task manual you call by name, and a subagent is a helper that takes on side jobs separately. For now, just know these folders exist.
You don't need to memorize it all. Most of the time, you only edit CLAUDE.md and settings.json.[10:1]
Quick check
The `.claude` folder looks complicated. What will you mostly edit at first?
Rules in Words vs. Enforced Rules
This is the most important section in this chapter. The two lines below look similar, but their power is different.
Written in CLAUDE.md: Don't read the secret folder.
Written in settings.json: "deny": ["Read(./secret/**)"]Words in CLAUDE.md affect what Claude tries to do. But they can't change what Claude Code allows. Permission rules are enforced by the Claude Code program, not by the model.[8:1] In company terms, CLAUDE.md is a work guide, and permission rules are the lock on the door.
So put the truly important things in deny rules.[2:3] Try dividing them like this.
- Things you can just fix if they go wrong (tone, format) go in
CLAUDE.md. - Things that would be a problem if they went wrong (reading secret files) go in deny rules.
- Things that must happen every time go in hooks (commands Claude Code runs automatically at set moments) in Chapter 11.[11]
Quick check
How is writing "don't read the secret folder" in `CLAUDE.md` different from making a deny rule?
Try It Yourself
- In the terminal, create the
CLAUDE.mdandnotesfolder above, and ask about the rules withclaude -p. - Start
claudeand ask, "@inbox/meeting-2026-10-27-weekly.txt Organize this memo into meeting notes." You didn't say to use a table, but does a table appear? Was the file saved innotes? - Open
/memoryand/status, and close them with Esc. - Leave with
/exitand find the.claudefolder in the terminal withls -a(ls -Forcein PowerShell).
Ask yourself: Did the new session follow the rules? Are any of my rules a problem if left only in words?
Summary
- In
CLAUDE.md, write only what Claude can't learn by reading, in a way you can check. /initis meant for code folders. For a memo folder, writing it yourself is easier.- Claude writes auto memory, and you view it and turn it off in
/memory. settings.jsonhas three locations, and the narrower scope wins. A deny wins from any location.- Rules in words change what's attempted; permission rules change what's allowed.
Glossary
| Term | One-line meaning |
|---|---|
| CLAUDE.md | A file of lasting instructions you write |
| Auto memory | Notes Claude writes on its own |
| settings.json | A settings file that changes behavior |
Finished this chapter?
Progress is saved only in this browser. See your progress on the full table of contents.
Next chapter: Chapter 9. Skills and Extensions
References (11)
Claude Code official docs, "How Claude remembers your project". "CLAUDE.md files: instructions you write to give Claude persistent context." / "Claude Code loads
CLAUDE.mdandCLAUDE.local.mdfrom your current working directory and every directory above it." / "target under 200 lines per CLAUDE.md file." / "Personal preferences for all projects" code.claude.com (checked on 2026-11-06) ↩︎Claude Code official docs, "Best practices for Claude Code". "Only write down what Claude can't find by reading the repo, or what it would otherwise spend time rediscovering every session." / "Claude reads the repo itself. Only write down what isn't in there." / "Current ones follow a plainly worded line, and piling on emphasis mostly makes Claude over-apply the rule." / "anything that matters belongs in a deny rule." code.claude.com (checked on 2026-11-06) ↩︎
Claude Code official docs, "Extend Claude with skills". "Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact." code.claude.com (checked on 2026-11-06) ↩︎
Claude Code official docs, "How Claude remembers your project". "Run
/initto generate a starting CLAUDE.md automatically." / "Claude analyzes your codebase and creates a file with build commands, test instructions, and project conventions it discovers." code.claude.com (checked on 2026-11-06) ↩︎Claude Code official docs, "How Claude remembers your project". "The
/memorycommand lists your CLAUDE.md, CLAUDE.local.md, and other memory file locations across user and project scopes." / "Auto memory: notes Claude writes itself based on your corrections and preferences" / "Auto memory is on by default in local sessions." / "Each project gets its own memory directory at~/.claude/projects/<project>/memory/." / "Auto memory files are plain markdown you can edit or delete at any time." / "To toggle it, open/memoryin a session and use the auto memory toggle" / "Claude saves it to auto memory." code.claude.com (checked on 2026-11-06) ↩︎Claude Code official docs, "Settings files and precedence". "Settings are the JSON keys that change how Claude Code behaves" / "You, in every project on this machine" / "Everyone working in the folder that contains it. In a git repository, commit it so teammates get it" / "You, in this one project only." / "When the same key appears in more than one place, Claude Code uses the value from the highest level that sets it." / "Settings precedence, highest first: managed settings, command line, project local, shared project, user." / "Claude Code watches your settings files and reloads them when they change, so it applies most edits to the running session without a restart" / "Run
/statusinside Claude Code to see which settings sources are active." code.claude.com (checked on 2026-11-06) ↩︎On a work computer, settings set by an administrator (managed settings) come before these three. The basis is "Settings precedence, highest first: managed settings, command line, project local, shared project, user." in the same document. code.claude.com (checked on 2026-11-06) ↩︎
Claude Code official docs, "Configure permissions". "If a tool is denied at any level, no other level can allow it." / "Instructions in your prompt or
CLAUDE.mdshape what Claude tries to do, but they don't change what Claude Code allows." / "Permission rules are enforced by Claude Code, not by the model." code.claude.com (checked on 2026-11-06) ↩︎Claude Code official docs, "Automate actions with hooks". "Verify your JSON is valid: trailing commas and comments aren't allowed" code.claude.com (checked on 2026-11-06) ↩︎
Claude Code official docs, "Explore the .claude directory". "Claude Code reads instructions, settings, skills, subagents, and memory from your project directory and from
~/.claudein your home directory." / "Most users only editCLAUDE.mdandsettings.json." code.claude.com (checked on 2026-11-06) ↩︎Claude Code official docs, "Output styles". "For something that has to happen every time, such as formatting after each edit or blocking a command, use a hook." code.claude.com (checked on 2026-11-06) ↩︎