Skip to main content

Machine-Readable Project Context: Why Your CLAUDE.md Matters More Than Your Model

· 8 min read
Tian Pan
Software Engineer

Most teams that adopt AI coding agents spend the first week arguing about which model to use. They benchmark Opus vs. Sonnet vs. GPT-4o on contrived examples, obsess over the leaderboard, and eventually pick something. Then they spend the next three months wondering why the agent keeps rebuilding the wrong abstractions, ignoring their test strategy, and repeatedly asking which package manager to use.

The model wasn't the problem. The context file was.

Every AI coding tool — Claude Code, Cursor, GitHub Copilot, Windsurf — reads a project-specific markdown file at the start of each session. These files go by different names: CLAUDE.md, .cursor/rules/, .github/copilot-instructions.md, AGENTS.md. But they share the same purpose: teaching the agent what it cannot infer from reading the code alone. The quality of this file now predicts output quality more reliably than the model behind it. Yet most teams write them once, badly, and never touch them again.

Why Every Tool Converged on the Same Pattern

The convergence wasn't planned. It emerged from the same practical constraint: AI coding agents are stateless. They have no memory between sessions. Every time you start a new conversation, the model begins from scratch — it has never seen your codebase before, doesn't know that you use Yarn not npm, and has no idea that the generated/ directory is auto-generated and should never be edited.

The context file is the workaround. Put the file in the repo root, and the tool reads it automatically before responding to anything. The agent walks in knowing your rules instead of discovering them by making mistakes.

Anthropic shipped CLAUDE.md as part of Claude Code. Cursor shipped .cursorrules, then deprecated it in favor of .cursor/rules/ — a directory of .mdc files with YAML frontmatter that scope rules to specific file patterns. GitHub Copilot uses .github/copilot-instructions.md. OpenAI released AGENTS.md in August 2025 explicitly as a cross-tool standard. By December 2025, the Linux Foundation's new Agentic AI Foundation had accepted AGENTS.md as an open standard alongside MCP, with Anthropic, OpenAI, Google, Microsoft, and AWS as co-founders.

AGENTS.md has since been adopted by over 60,000 open-source projects. Teams running multiple tools can symlink AGENTS.md to tool-specific files to avoid maintaining separate versions that drift apart.

The pattern is now infrastructure, not preference. The question isn't whether to write one — it's whether yours is any good.

What the Research Actually Says About These Files

A study from ETH Zurich produced a counterintuitive finding: context files generated by LLMs hurt agent performance. Specifically, auto-generated files reduced task success rates by 0.5–2% while increasing inference costs by 20–23%. The reason: language models generate context summaries by reading the codebase and writing up what they found. But agentic tools already do this during task execution. Auto-generated files duplicate what the agent would discover anyway, adding token overhead without adding signal.

Human-written files performed better — about 4% improvement on standard benchmarks — but still carried roughly the same 19–20% token overhead. The implication is clear: every token in your context file costs you, and it only pays off if the content is genuinely non-inferable from the code.

This is the key constraint for writing effective project context files. The question to ask for every line: "Would a competent engineer figure this out by reading the code?" If yes, delete it. If no, it belongs.

The Three Categories That Belong in a Context File

Non-inferable operational details. Build commands aren't obvious when you have a non-standard toolchain. If you use Pixi instead of pip, or Turborepo with a custom task graph, or a Makefile wrapper around a multi-step test suite — document the exact commands with full flags. Agents reference these repeatedly; putting them early in the file reduces the chance they get ignored when context grows long.

Intentional architectural decisions that look wrong. Every codebase has patterns that look like mistakes until you understand why they exist. A monolithic transaction handler that breaks every SOLID principle. A data denormalization that seems redundant until you understand the read path. A file that's intentionally excluded from the type-checker. Without an explanation, the agent will "fix" these. With one, it understands the intent and doesn't touch them.

Explicit boundaries. What should the agent never modify? Auto-generated files, lock files, vendor directories, migration files that have already run. Make these explicit. The three-tier model works well: ALWAYS safe to modify, ASK FIRST before touching, NEVER modify. Agents respect explicit constraints far better than they respect implicit conventions they have to infer.

Loading…
References:Let's stay in touch and Follow me for more thoughts and updates