Skip to main content
Kliff

Instruction files

The AGENTS.md and CLAUDE.md files agents read from your repositories, and how they rank against rules and project instructions.

Agents read instruction files from your repositories. Put how to build, test, and work in a repository in an AGENTS.md or CLAUDE.md, and every agent on that repository reads it before it starts.

Files agents read

At the start of each turn, an agent reads these files at the root of each repository it works on:

  • AGENTS.md
  • CLAUDE.md
  • .claude/CLAUDE.md

Each file can be up to 20,000 characters, and up to 40,000 characters are read in all.

When the agent reads a file inside a folder that has its own AGENTS.md or CLAUDE.md, it reads that folder's file too, up to 8,000 characters.

Imports

An instruction file can pull in another file with @ and a path, such as @docs/testing.md. The path is relative to the file that imports it and has to stay inside the repository. A path needs a / or a ., so a plain @name stays a mention. Imports are ignored inside code, can go up to 5 levels deep, and each file can import up to 20 others.

What wins

  • Your messages come first.
  • Rules written for you or for the repository, and the project's instructions, come next. People write these, so the agent follows them as it would your own words. When you ask for something they forbid, it points that out and asks before going ahead.
  • Instruction files are written by whoever can change the repository. The agent follows them when it works there, and when one disagrees with you or with your rules, you and your rules win.

Rules and project instructions also outrank notes and anything a file or a tool's output says.