The File That Replaces a Thousand Prompts (Agents.md)
Stop Explaining Your Project to AI Every Single Time: The AGENTS.md Pattern
If you've been using AI-assisted development for a while, you've probably fallen into this loop: you open a new chat, start with "this project uses Next.js, TypeScript in strict mode, PostgreSQL for the database, NextAuth for authentication..." and then do the exact same thing in the next conversation. And the one after that.
It's tedious, and it's wasteful. AGENTS.md exists to fix exactly this.
What Is AGENTS.md?
Simply put: a Markdown file you place at the root of your project that tells AI tools everything they need to know before touching your code.
Before starting a task, your AI-powered editor or CLI reads this file and behaves as if it already knows the project. What the stack is, how the architecture is structured, which conventions apply — you don't have to spell these out every time.
What typically goes in it:
- A short summary of what the project does
- The technology stack
- Folder structure and architectural decisions
- Code conventions (naming, file organization, etc.)
- Basic notes on testing and deployment
One File Isn't Always Enough: The .agents/ Folder
For small projects, a single file works fine. But as the project grows, stuffing everything into one file makes it hard to read — and forces the AI to load irrelevant information every time.
A hierarchical structure handles this much better:
AGENTS.md ← General project overview
.agents/
authentication.md ← Auth system details
database.md ← Schema, migration rules
api.md ← Endpoint structure, response formats
frontend.md ← Component system, styling rules
The idea: the root file gives a high-level view of the project. When working on a specific module, the AI gets both the general context and the module-specific details. Working on authentication? AGENTS.md + .agents/authentication.md get read together — nothing else loads unnecessarily.
The benefits are concrete:
Token efficiency. Instead of manually pasting project context into every chat, the AI reads only what it needs for the task at hand.
Consistency. No more risk of explaining things differently at different times. The rules are in the file, and the same information shows up every time.
Easier onboarding. Anyone — or any AI — who's new to the project can read the files and understand what's being built and how.
Which Tools Support This?
Every major AI development tool has its own name for this convention, but the idea is the same:
| Tool | File |
|---|---|
| Claude Code | CLAUDE.md |
| OpenAI Codex CLI | AGENTS.md |
| Gemini CLI | GEMINI.md |
All of them support the hierarchical structure: they read both the file at the project root and any relevant files closer to the directory you're working in.
How to Get Started
Adding this to an existing project doesn't require much. Create an AGENTS.md file (or the equivalent for your tool) at the project root and fill in the template:
# Project Name
Short description: what it does, who uses it.
## Stack
- Framework: ...
- Language: ...
- Database: ...
## Architecture
A paragraph about the folder structure and key decisions.
## Conventions
- Naming conventions
- Import order, file organization
- Testing expectations
## Notes
Project-specific things worth remembering.
From there, you can create a .agents/ folder and add module-specific files as needed. Each file becomes more valuable when it explains not just what something is, but why it was built that way — understanding the reasoning helps the AI make better decisions, not just follow instructions mechanically.
Closing Thoughts
AGENTS.md isn't revolutionary on its own. But done right, it makes working with AI noticeably less repetitive and more focused. Depending on your project's size, starting with a single file and evolving toward a modular structure is a perfectly reasonable path.
Good documentation was always a good practice. Now it just has a slightly more tangible return on investment.