Our CLAUDE.md got to 107,000 characters before we did anything about it. Every rule anyone had ever needed was in there, usually with the story of why, and Claude Code loaded all of it at the start of every session for everyone on the team. Anthropic's docs are blunt about what that costs: a longer file takes more of Claude's context, and Claude follows it less well.

So this is what we ended up with, along with what the docs say about sharing the file across a team. The details about how Claude Code loads these files come from Anthropic's memory documentation as of late November 2026. It changes often, so check it before you depend on a version number.

The short version

Commit a CLAUDE.md at the top of the repository. Claude Code reads it at the start of every session for everyone who clones the repo, so it's shared the way code is: through git, with changes going through review. Anthropic suggests keeping it under 200 lines and filling it with what Claude needs every time, like the build and test commands, your conventions, where things live, and the few rules that always apply.

Each person also has places for things that shouldn't go to the whole team:

File Who gets it
CLAUDE.md (or .claude/CLAUDE.md) in the repo Everyone who clones it
CLAUDE.local.md in the repo Just you, in this project. Add it to .gitignore
~/.claude/CLAUDE.md Just you, in every project
A managed CLAUDE.md that IT installs Everyone on those machines, and nobody can switch it off

The managed one lives at /Library/Application Support/ClaudeCode/CLAUDE.md on macOS and /etc/claude-code/CLAUDE.md on Linux.

What to put in it

My favorite rule of thumb from Anthropic's docs: CLAUDE.md is where you write down what you'd otherwise explain again. Plenty of the lines in ours were added the second time something went wrong. On our machines every coding agent works in the same main checkout, and one session switched it to an old branch and left it there for days, 1,888 commits behind main. Now there's a line telling agents never to switch branches in that folder and to use a worktree instead.

Write lines someone could check. "Run npm test before committing" works. "Test your changes" doesn't, because neither you nor Claude can tell whether it happened.

A reasonable starting point for a small service:

# Acme API  ## Commands - Install: `pnpm install` - Test one file: `pnpm vitest run path/to/file.test.ts` - Before you commit: `pnpm lint && pnpm test` ## Layout - HTTP handlers live in `src/api/handlers/`. - Database access goes through `src/db/`. Handlers never import the driver. ## Rules - TypeScript only. No `any`. - Every new endpoint gets a test in `tests/api/`. - Never edit a merged file under `migrations/`. Add a new migration. - Ask before adding a dependency. 

What we moved out

This is where ours went wrong. A CLAUDE.md wants to become the place for everything, and a few kinds of thing do better somewhere else.

Rules for one part of the code can go in .claude/rules/. Give a file a paths line at the top and Claude Code loads it only when it's working on matching files:

--- paths: - "src/api/**/*.ts" --- # API rules  - Validate input with the schema in `src/api/schemas/`. - Return errors with `apiError()`, never a bare string. 

When we split ours in October, the root file became mostly an index, and the rules for each area went into files like that. There are 13 now, for things like our MCP server, the memory pipeline and dependency licenses. The root file is 571 lines, still well past Anthropic's 200. We could cut more.

Long step-by-step procedures work better as skills, which load only when they're needed. I wrote up five to copy in Claude Code skills for a team.

Then there was the history. Ours was full of notes like "we tried this in September and it broke that", which helps a person deciding whether to change something and is just noise to an agent fixing a test. We moved it into Jackdaw, the team wiki and chat we're building, with one page per area of the code. CLAUDE.md kept a small table in its place: each area, its rule file, the tests that must pass, and the name of its history page.

Anything that must never happen needs more than an instruction. Claude treats CLAUDE.md as context, so it follows it most of the time, not every time. If something has to hold every time, use a hook or a deny rule in the settings file. In our repo, every commit that changes the app has to say whether someone saw the change working, and a git hook checks for that line instead of trusting the instructions file to get it followed. Claude Code for a team shows how to share hooks and deny rules with everyone.

One thing that doesn't help: splitting the file up with @path imports. Imported files load along with the file that imports them, so you've moved the text without shrinking what Claude reads.

Keeping it honest

Since it's in git, changes go through review like everything else. The habit that does most of the work is simple: when a review catches something Claude should have known, the fix includes a line in CLAUDE.md.

A few commands help. /init writes a first version from your codebase, and if you already have one it suggests changes instead of overwriting it. /context all lists every instruction file that loaded, under Memory files, and /memory opens them for editing. /doctor prompt-audit, in Claude Code 2.1.283 or later, looks for instructions that are stale or contradict each other.

The version of this post on our blog has a small checker that runs the advice above over a CLAUDE.md you paste in. It runs in your browser and doesn't send the text anywhere.

If some of your team uses Codex or Cursor

We use Claude Code and Codex side by side, so both have to follow the same rules. Claude Code 2.1.277 and later reads AGENTS.md by itself (2.1.281 if you're on Bedrock or have telemetry off), but only when the repo has no CLAUDE.md. If it has both, Claude reads only the CLAUDE.md, unless that file imports the other with an @AGENTS.md line.

We went the other way round: CLAUDE.md is the one we edit, a script generates AGENTS.md from it for Codex, and CI fails if the two drift apart. Either way works, as long as there's one file people actually edit. AGENTS.md for a team covers how each tool finds it.

One trap: a personal CLAUDE.local.md counts as a CLAUDE.md, so adding one quietly stops Claude reading AGENTS.md for you. In /config, setting "Project instructions" to claude-md-and-agents-md fixes it.

What it doesn't share

Claude Code also keeps notes for itself, which it calls auto memory: your corrections, your preferences, things it worked out about the project. They live under ~/.claude/projects/ on your own machine and go nowhere else. So when you correct Claude, your teammate's Claude never hears about it.

This is the part Jackdaw ended up doing for us. Our coding agents connect to it over MCP. Before an agent changes an area, it asks Jackdaw why the area works the way it does and gets the decisions and past failures, each with its source. When it settles something new or gets a test result, it writes that onto the area's history page itself, marked with which agent wrote it, so the next session starts from there. One of those pages has been saved 131 times since October. If you'd rather not add a tool, "add this to CLAUDE.md" and a commit gets you most of the way.

This post first appeared on the Jackdaw blog.