Playbook · Claude Code

CLAUDE.md, Done Right

CLAUDE.md is the first thing Claude Code reads. Get it right and the agent starts every session already knowing your project. Get it wrong and it drifts into noise.

CLAUDE.md is the single highest-leverage file in a Claude Code repo — it's loaded automatically at the top of every session, so whatever's in it shapes everything the agent does. This is how to write one that stays useful, and what to do when a whole team shares it.

What it is

A plain Markdown file Claude Code reads at session start. There's no schema — it's instructions in prose. The agent treats it as always-true context, so it's the right place for the facts you'd otherwise re-explain on every task: how to build, how to test, the code style, the shape of the repo.

Where it goes

  • Repo root — project-wide context the whole team shares. This is the important one.
  • ~/.claude/CLAUDE.md — your personal, global preferences across all projects.
  • Subdirectory CLAUDE.md — folder-specific rules that only apply in that part of the tree.

What belongs in it (keep it tight)

The best CLAUDE.md is short and stable. Every line is read on every task, so noise has a real cost. Include:

  • Commands first. Install, build, test, lint. The agent should never guess these.
  • Conventions, not history. "Use 2-space indent, single quotes" belongs here. "We switched off X last quarter because…" does not.
  • Repo layout. Where things live, so the agent navigates instead of searching.
  • Hard rules. The handful of things that are always true (never edit generated files, always run the formatter, etc.).

If it's longer than a screen, the durable parts probably belong somewhere shared — read on.

The team problem: drift

Here's where CLAUDE.md alone stops scaling. One developer's file captures their context perfectly. Five developers produce five slightly different files, and the agent gives different answers depending on whose machine it's running on. Worse, a CLAUDE.md can't express why a decision was made or who owns a part of the codebase — it's a flat config file, not a knowledge base.

The fix isn't a bigger CLAUDE.md. It's keeping CLAUDE.md minimal and moving the durable knowledge — decisions, ownership, the reasoning behind conventions — into one shared, owned, versioned source that every agent reads.

This is what First-Tree adds.

First-Tree is an open-source platform for engineering teams running humans and agents side by side. Its memory pillar gives your team a context tree: a Git repo where decisions and ownership live in Markdown nodes that every Claude Code agent reads — wired in with a SessionStart hook. CLAUDE.md stays tight and per-repo; the tree holds the shared knowledge that would otherwise drift across everyone's local file. One source of truth instead of N copies — and because the same platform also lets agents coordinate in shared chat threads and pick up work straight from your GitHub issues and PRs, that context reaches them right where the work happens.

Why CLAUDE.md doesn't scale across repos

Drift across developers is one wall. The other shows up the moment your team works in more than one repo. A CLAUDE.md lives inside a single repository, so by design it can't carry a decision that spans services — when you're losing context across 15+ repos, there's no file that every agent in every repo reads. You end up copy-pasting the same conventions into a dozen CLAUDE.md files, and the moment one changes, the rest are stale.

The instinct to "just give one agent all the repos" hits the context window wall fast, and it still doesn't tell the agent why a cross-cutting decision was made or who owns it. Scaling context across repositories is a different problem than keeping one file tidy — it needs a source of truth that lives outside any single repo and that every agent, in every repo, can read.

That's exactly what a shared context tree for agent teams is for: cross-repo decisions and ownership in one owned, reviewed Git repo, with a thin pointer-style CLAUDE.md left in each repository. CLAUDE.md stays per-repo and tight; the durable, cross-cutting knowledge lives once, above all of them.

Anti-patterns

  • The dumping ground. Every decision pasted in until no one (and no agent) reads to the bottom. Move history and rationale out.
  • Per-developer drift. Five uncommitted CLAUDE.md files. Commit the shared one; centralize the durable parts.
  • Stale commands. The build command changed but CLAUDE.md didn't. Treat it like code — keep it current or it actively misleads.

A tight CLAUDE.md plus a shared context tree is the setup behind Claude Code best practices for teams — and it's the memory underneath an orchestration platform where agents also coordinate in chat and pick work off your GitHub issues and PRs, the foundation of running AI agent teams that stay coherent.

FAQ

Common questions.

What is a CLAUDE.md file?

CLAUDE.md is a Markdown file Claude Code reads automatically at the start of every session in a repo. It's where you put the project context the agent should always know — build and test commands, code style, repo layout, and the rules that are always true.

Where do I put CLAUDE.md?

At the repo root for project-wide context. Claude Code also reads a personal ~/.claude/CLAUDE.md for your global preferences, and nested CLAUDE.md files in subdirectories for folder-specific rules. Root-level is where team context belongs.

What should go in CLAUDE.md vs somewhere else?

Keep CLAUDE.md tight: stable, local facts (commands, conventions, layout). Put cross-cutting, evolving knowledge — why a decision was made, who owns what, how domains relate — in a shared context layer the whole team reads. CLAUDE.md is per-repo config; it shouldn't become a history dump.

How do teams keep CLAUDE.md from drifting?

A single developer's CLAUDE.md is fine. Five developers produce five drifting copies and the agent answers inconsistently. The fix is to keep CLAUDE.md minimal and move the durable decisions into one owned, versioned source every agent reads — see the section on shared context below.

Get Started

Run your agents on First-Tree.

First-Tree is the open-source platform where your team and its AI agents work together — agents chat in shared threads, GitHub becomes the work queue, and a context tree gives every agent the same memory. Start in your repo in one command.