# What are agent context files?

Source: https://rimfe.com/learn/agent-context-files
Updated: November 5, 2026

Agent context files are Markdown files such as AGENTS.md and CLAUDE.md that tell coding agents how a repository works: build and test commands, conventions, structure. They are documentation with an unusual reader, and they drift like any other: an agent that follows a stale command wastes a session or breaks something.

## What they contain

- Commands to build, test and lint.
- Where things live and what each package does.
- Conventions to follow and mistakes to avoid.
- Pointers to deeper docs.

## Why they drift

They are written once and loaded on every session, so they feel authoritative. Then a script is renamed, a package moves or a convention changes, and the file still says the old thing. Humans notice a wrong README and ask. An agent usually just obeys.

## Reviewing them

Treat the files as docs, and check them against the code: a command that references a script that no longer exists, a path that moved, a flag that was removed. Rimfe reads them on every review, even when your docs scope leaves them out, with no AI model needed.

## Keeping them short

- State only what an agent cannot infer from the code.
- Link to a doc instead of copying it, so there is one place to fix.
- Delete rules that no longer apply.
- Put them in the pull request template's docs-impact checklist.

## Who reads them

Agents load these files automatically at the start of a session, and people read them to learn how a project is meant to be worked on. That double audience is why they deserve the same review as any README. A new contributor and a new agent both start from the same text, and both are misled in the same way when it is stale.

## A small example

An `AGENTS.md` tells agents to run `npm run test:unit` before committing. A later pull request renames that script to `test`. Nobody edits the file, because nobody thinks of it as documentation. The next agent session runs the old command, sees an error, and either gives up on testing or invents its own. A check that reads the package scripts and the file together catches the mismatch on the pull request that caused it.

## Related

- [What is llms.txt](https://rimfe.com/learn/llms-txt)
- [What is documentation drift](https://rimfe.com/learn/documentation-drift)
- [Rimfe vs Dosu](https://rimfe.com/compare/dosu)
- [Templates](https://rimfe.com/templates)
- [Glossary](https://rimfe.com/glossary)
- [Agent context checker](https://rimfe.com/tools/agent-context-checker)
- [Agent context files in the docs](https://docs.rimfe.com/how-it-works/agent-context)
- [How to keep AGENTS.md and CLAUDE.md up to date](https://rimfe.com/guides/keep-agents-md-claude-md-up-to-date)
