🤖 The Modern AI Developer · Letting AI Actually Do Things: AI IDEs & Tooling

What Is CLAUDE.md? Project Memory for AI Coding Agents

Project-level long-term memory / convention file

一句话先懂 · TL;DR

How a CLAUDE.md convention file gives your AI coding agent long-term project memory: what to write in it, what to leave out, and why it ends repeat explaining.

The Pain: Explaining from Scratch Every Time

Ever notice that every new session you have to tell the Agent again: "we indent with two spaces," "commit messages in Chinese"…? Annoying, right?

🔆It's like re-explaining the company rules to a new intern every single day. Better to just post a "Read Me First" on the wall.

The Fix: Put a Project Convention File in the Repo

Put a convention file in the project root (e.g. Claude Code's CLAUDE.md, or Cursor's .cursor/rules/ rule files—the older form was .cursorrules, now migrated) and write the project's fixed rules into it. AI tools that support this convention read it automatically before each job, so you don't have to repeat yourself.

# 项目规矩
- 缩进用 2 个空格
- 提交信息用中文
- 不要直接改 main 分支
- 改完先跑 `npm test`
💡Distill the things you'd otherwise say every time into it, and this file becomes the project's long-term memory.

What to Write, What Not To

Good to write: stable rules—code style, directory conventions, commit conventions, common commands.

Not good to write: one-off temporary requests (just say those directly), and details that will change soon.

⚠️Don't turn it into a junk drawer. The longer it gets, the more it triggers the "long context derailment" from the last unit—pick what's stable and frequently used.

自测 · 学完检查一下

想真正动手做题、记进度、攒连胜?到互动课里练。

What pain point does a project convention file (like CLAUDE.md) mainly solve?

答案:Sparing you from re-explaining the project's rules every new session

Distill the fixed rules into a file the Agent reads automatically, so you don't have to repeat them over and over.

Judge: without a convention file, a project's fixed rules often have to be re-explained in every new session.

答案:True

It's this very pain point of repeated labor that gave rise to writing the rules into a file.

Which is best suited to go into a project convention file?

答案:"This project uniformly indents with 2 spaces and uses Chinese commit messages"

Only stable, repeatedly-applicable rules are worth putting in the convention file; a one-off request can just be said on the spot.

Judge: one-off temporary requests should also all be stuffed into the convention file—the more the better.

答案:False

Temporary requests can just be said on the spot; the more bloated the file, the more it triggers long-context derailment—keep only stable rules.

The key property of a convention file is: the Agent ___ it before every job, so you don't have to repeat yourself.

答案:auto-reads

It's because it's auto-read every time that the rules written into it stay continuously in effect.

Judge: the longer the convention file the better—write in everything you can think of, to be safe.

答案:False

Too long dilutes the key points and triggers long-context derailment—keep it concise with stable, frequently-used content.

想边练边学,而不只是读?

到互动课里答题、记进度、攒连胜——游客即可试学,无需注册。

进入互动课程 →

Learn something new — don't miss updates

New courses, features and learning tips. Occasional emails, unsubscribe anytime.