Claude forgets everything — on purpose
Claude Code has zero memory between sessions, by design. Yesterday's session taught it your folder structure and your conventions; today's session knows none of it. That sounds like a flaw. It's actually the deal that keeps sessions fast, private and cheap — and it comes with one big exception you control: files.
CLAUDE.md, in your project root, is the most important of those files: Claude
Code auto-loads it at the start of every session. Whatever it says is
simply known, every time, without you repeating yourself. It's the project's brain.
/init writes the first draft
Don't write it from scratch. In a session, run /init once: Claude scans the
project — folders, configs, package.json, README — and generates a first draft. That's the
easy 80%. The valuable 20% is what you do next.
Then you edit it — lean, under ~60 lines
Trim and shape the draft yourself until it covers exactly six things, briefly:
- Stack — what the project is built with, one or two lines.
- Folder map — where things live, so Claude doesn't explore to find out.
- Key file paths — the exact files that matter most ("the layout is
src/layouts/Layout.astro"). - Conventions — naming, patterns, things that must stay true ("components are PascalCase", "site stays fully static").
- Commands — how to run, build and preview.
- Standing rules — the workflow you want on every task ("read docs/TODO.md before any task; update docs/STATUS.md and commit after").
A realistic complete example — this is genuinely enough:
# MyRecipes
Static Astro site: recipe pages + search. Deployed on Cloudflare Pages.
## Stack
- Astro (latest), vanilla CSS, no client frameworks
## Folder map
- src/pages/ — file-based routes
- src/components/ — PascalCase .astro components
- src/data/recipes.ts — all recipe content lives here
## Commands
- npm run dev · npm run build · npm run preview
## Rules
- Site stays fully static — no SSR, no cookies, no trackers.
- Read docs/TODO.md before any task; update docs/STATUS.md + commit after. Why lean matters so much
Remember the context chapter: everything in
the session is re-sent with every message. CLAUDE.md is in every session
from message one — so a bloated CLAUDE.md is a tax on every single message, forever.
Sixty sharp lines beat six hundred thorough ones. If a detail only matters for one task,
it belongs in that task's prompt, not in the brain.
Quick additions with #
Mid-session, whenever you catch yourself correcting Claude on something that will be true
forever — start a line with #:
# always use pnpm, not npm
# currency is INR with Indian digit grouping (₹1,23,456)
Each one is appended to CLAUDE.md on the spot. Correct once, remembered in
every future session. Prune these occasionally so the file stays lean.
Real-world example — this website. Siazly's CLAUDE.md is about forty lines: the stack (Astro + Tailwind, fully static), a folder map, exact paths to the layout and data files, conventions ("site MUST stay static", "never add cookies or tracking"), the three npm commands, and one standing rule — read the fix queue before any task; build, check off and commit after. Every session on the site starts already knowing all of that.
Up next: CLAUDE.md holds what's always true. The other half of memory — where we left off, what's next, why we chose X — lives in three small files in docs/.