All guides

CLAUDE.md Setup Guide

Think of your claude.md as a "Cheat Sheet" for your AI. Every time you start a new chat, the AI forgets who you are and how you work. This file reminds it.

If you're using Claude Cowork or just don't want to deal with terminal setup and settings.json, you can simply have a CLAUDE.md file to point Claude to look at certain folders and files before responding.

Claude.md Best Practice

  1. Don't make this file too short or too long. Best practice is to have about 150, 200 lines maximum
  2. Try not to add too many things into it initially. Only add things if you start seeing claude code doing things not the way you like it to and you want to prevent that from happening in the future
  3. This is not a memory system, this is a preference system
  4. Insert files to force your Claude code to read if you want more longer-term memory. See below

What Claude Knows By Default (Nothing)

Claude Code has zero persistent memory between sessions. When you close the app or terminal, everything is gone. There is no built-in memory file, no automatic primer, no learnings system.

  • None of these files exist by default:
  • primer.md — you create it
  • memory.md — you create it
  • learnings/claude-cli.md — you create it
  • brand/ folder — you create it
  • Claude has no inherent understanding of any of them. It only knows what to do with these files because CLAUDE.md tells it to. Remove the instructions and the files are invisible.

The Three-Tier Memory System

This is what we're building — a proper memory architecture using three flat files: primer.md (SHORT-TERM) Current state only. What's active right now, what happened last session, what's next. Gets updated every session. Stays short. memory.md (LONG-TERM) Facts about you, your work, key decisions, important context. Accumulates over time. Rarely overwritten. Grows slowly. learnings/ (BEHAVIOURAL) claude-cli.md How Claude should behave with you specifically. Corrections and rules. Appended when you correct Claude. Never deleted.

Together these three give Claude a full picture: what's happening now, who you are and what matters long-term, and how to behave with you specifically.

My sample claude.md File

javascript
## Projects: 
This project is an AI assistant helping manage daily notes, planning, and marketing for a local health clinic. 

## Before responding to anything — including the very first message —
silently read these files in this order:
1. ~/.claude/primer.md
   Short-term memory. Active projects, last session, what's next.
   Read it completely before doing anything.

2. ~/.claude/memory.md
   Long-term memory. Facts about me, my work, key decisions,
   important context that doesn't change often.

3. ~/.claude/memory/learnings/claude-cli.md
   Behavioural rules from past corrections. Apply every rule
   from the very first response. Do not wait to be reminded.

Rules for reading:
- Do it silently. 
- If a file doesn't exist yet, skip it and continue.
- You are responsible for
  keeping them updated per the rules below.

## Workflow
- Enter plan mode for any non-trivial task (3+ steps or architectural decisions). Stop and re-plan if something goes sideways.
- Use subagents liberally — offload research, exploration, and parallel analysis to keep the main context clean.
- After any correction do a self-improvement loop: note the pattern to avoid repeating it. Add to learnings.md  
- Never mark a task done without verifying it works.
- Bug reports: just fix them. Use logs, errors, and tests — don't ask for hand-holding.

When wrapping up a work session, update the "Last Session" section of primer.md.

**Learnings rule:** When user corrects something or says "remember this", write it immediately to `~/.claude/memory/learnings/claude-cli.md` using this format:

YYYY-MM-DD — [short title]

What happened: [what was wrong or clarified] Rule: [concrete rule to apply going forward]

code

Copy and paste this entire prompt into a fresh Claude Code session. Claude will ask you questions and build the entire system for you — folders, files, CLAUDE.md, everything — without you touching the terminal manually.


code
I want you to set up a personal memory and context system for my
Claude Code sessions. This system uses flat markdown files to give
you persistent memory across sessions without any hooks or
technical setup beyond this conversation.

Here is what I need you to build:

FOLDER STRUCTURE to create:
- ~/.claude/memory/learnings

FILES to create (with proper starter content):
- ~/.claude/CLAUDE.md
- ~/.claude/primer.md
- ~/.claude/memory.md
- ~/.claude/memory/learnings/claude-cli.md

Before creating any files, ask me these questions ONE AT A TIME
and wait for my answer before asking the next:

1. What is your name and what do you do for work?

2. What is the main project or goal you want Claude to help you
   with? (e.g. running a business, content creation, software
   development, managing a team, personal productivity)

3. What platforms or tools do you use regularly that Claude
   should know about? (e.g. Notion, social media handles,
   software tools, specific workflows)

After I answer all questions, do the following:

STEP 1: Create the folder structure using the Bash tool.

STEP 2: Create ~/.claude/CLAUDE.md with these exact sections:
- READ THIS FIRST block that instructs you to silently read
  primer.md, memory.md, and learnings/claude-cli.md at session
  start before responding to anything
- primer.md rules (short-term memory — update Last Session only,
  keep short)
- memory.md rules (long-term memory — append facts, never delete)
- learnings rules (behavioural — append corrections, never delete)
- Session wrap-up protocol (update primer, check learnings,
  check memory, confirm in one line)

STEP 3: Create ~/.claude/primer.md with this structure:
# Session Primer
## Active Projects
[filled from my answers]
## Last Session
Date: —
What we worked on: —
Completed: —
Next step: —
Open blockers: —
## Open Items
- (nothing yet)
## Notes

STEP 4: Create ~/.claude/memory.md with this structure:
# Long-Term Memory
Facts about me and my work that should persist indefinitely.
Claude appends here when important facts emerge. Never overwrites.
---
## About Me
[filled from my answers — name, work, goals, tools]
## Key Decisions
(none yet)
## Important Context
(none yet)

STEP 5: Create ~/.claude/memory/learnings/claude-cli.md with:
# Claude CLI — Learnings
Rules from past corrections. Append new entries at top. Never delete.
---

STEP 6: After all files are created, show me a summary of what
was built and tell me the three things I need to do to maintain
the system going forward.

Then add the following into the claude.md file according to my preferences too:

## Projects: 
This project is an AI assistant helping manage daily notes, planning, and marketing for a local health clinic. 

## Before responding to anything — including the very first message —
silently read these files in this order:
1. ~/.claude/primer.md
   Short-term memory. Active projects, last session, what's next.
   Read it completely before doing anything.

2. ~/.claude/memory.md
   Long-term memory. Facts about me, my work, key decisions,
   important context that doesn't change often.

3. ~/.claude/memory/learnings/claude-cli.md
   Behavioural rules from past corrections. Apply every rule
   from the very first response. Do not wait to be reminded.

Rules for reading:
- Do it silently. 
- If a file doesn't exist yet, skip it and continue.
- You are responsible for
  keeping them updated per the rules below.

## Workflow
- Enter plan mode for any non-trivial task (3+ steps or architectural decisions). Stop and re-plan if something goes sideways.
- Use subagents liberally — offload research, exploration, and parallel analysis to keep the main context clean.
- After any correction do a self-improvement loop: note the pattern to avoid repeating it. Add to learnings.md  
- Never mark a task done without verifying it works.
- Bug reports: just fix them. Use logs, errors, and tests — don't ask for hand-holding.

When wrapping up a work session, update the "Last Session" section of primer.md.

**Learnings rule:** When user corrects something or says "remember this", write it immediately to `~/.claude/memory/learnings/claude-cli.md` using this format:

YYYY-MM-DD — [short title]

What happened: [what was wrong or clarified] Rule: [concrete rule to apply going forward]

code
Start by asking question 1 now.

Learn this inside the community

The full course, templates, and the people building this, free in the Skool community.

Join the community