AGENTS.md and CLAUDE.md: your AI agent's first instructions

Elias Iliopoulos2 min readΕλληνικά

AGENTS.md is the first file an AI agent reads the moment you say ‘hello’. It is a plain text file at the top of the agent’s folder, holding what you want it to know every time: who it is, who it works for and where to find things. In Claude Code the same file is called CLAUDE.md.

What the file does

You open a new session with the agent inside its folder and type ‘morning’. Before it answers, it looks through the folder and loads this file. Whatever is written there, it knows from the first word, in every session, without you saying it again.

Take an agent for accounting. The first line of its file gives it a role: ‘You are the team’s accountant.’ That alone changes a lot, because now it knows what kind of work you will ask for. Then you explain what being the accountant means at your company. You work with Renos and Katia. Renos handles payroll, Katia handles suppliers, here are their emails.

So when you write ‘send this incident to Renos’, it gets it straight away. Renos is the payroll colleague, so it drafts the message for him. It is that simple.

A small AGENTS.md for that accounting folder could look like this:

# Accounting

You are the team's accountant. Write briefly.

## Who is who
- Renos: payroll, renos@company.com
- Katia: suppliers and invoices, katia@company.com

## Where things are
- This month's receipts: receipts/
- Supplier list: suppliers.xlsx
- How we do the expense report: see the expense-report skill

## Rules
- Show me the text before you send any email.

Keep it short, like a map

The file loads in full in every session, even when half of it is irrelevant to the task at hand. That is why it works best as a map. It says who the agent is and where things live, and leaves the details in the files where they belong. The expense report instructions, for example, do not go here in full. They go in a skill, which the agent opens only when it needs it.

A long file full of outdated instructions does the opposite: it confuses the agent, and you pay for it to read that file again and again.

AGENTS.md or CLAUDE.md?

They are the same idea under two names. AGENTS.md is an open convention used by most tools, including OpenAI’s Codex, Google’s Gemini CLI and Jules, Cursor and GitHub Copilot’s coding agent. Anthropic calls it CLAUDE.md. Since September 2026, Claude Code also reads AGENTS.md when a folder has no CLAUDE.md (InfoWorld).

In practice: if you only use Claude Code, a CLAUDE.md is enough. If your team uses several tools, write an AGENTS.md and they will all find it.

Everything you write in this file has a name: context. That is the next lesson, What context is.

Next lessonWhat is context in AI, and why it lives in the agent's folder