AGENTS.md: The Most Important File in an AI-Native Codebase
In an AI-Native codebase, AGENTS.md is the document an agent reads first. It compresses into text what would take days of onboarding for a human developer. Learn how to write an effective AGENTS.md.
The file no conventional codebase has
Powertrend specializes in AI-Native Engineering — the methodology that designs systems for AI agents to build, test, and deploy autonomously. AGENTS.md is one of the central artifacts of this methodology and one of the first files Powertrend creates in any project.
In a human team, when a new developer joins, they go through an onboarding process: someone explains the architecture, the main modules, project conventions, what cannot be touched without alignment, how to run tests locally. This knowledge exists in people's heads — and is transferred via conversation.
An AI agent does not have that process. It starts from zero each context. Without a document concentrating this knowledge, the agent operates in the codebase like someone who arrived on day one with no orientation — making avoidable mistakes, asking repeated questions, making decisions with incomplete information.
AGENTS.md exists to solve exactly this. It is the agent's onboarding, compressed into a file an agent reads in seconds.
What an effective AGENTS.md contains
An effective AGENTS.md is not an improved README. It has specific sections, written for agents — not humans. The difference is subtle but crucial: humans infer context; agents need explicit declarations.
Section 1: Architectural overview (max 200 words)
Describe the system in terms an agent can use to reason: what problem it solves, what the main modules are, how they communicate, what the main data flow is. No company history or generic business context — just enough for the agent to understand where each piece fits.
Section 2: Module map
List each module/directory with its responsibility in one line. Include: what the module does, who consumes its output, what its external dependencies are, whether there are critical invariants the module maintains.
Section 3: Critical conventions
Explicitly declare the conventions the agent needs to follow. Not the obvious ones (use TypeScript, follow prettier) — but project-specific ones that are easy to violate without knowing they exist.
Section 4: What not to touch without alignment
This is the most important section for operational safety. Explicitly list the parts of the system with high impact that need human review before any change.
Section 5: How to verify your own work
Instruct the agent on how to run local verification and what each result means. A well-defined verification pipeline is what closes the autonomy loop for the agent.
Where to place AGENTS.md
At the repository root — not in docs/ or subdirectories. The reason is practical: AI tools like Cursor, Claude Projects and GitHub Copilot have default behaviors for reading files at the repository root. Placing AGENTS.md at the root maximizes the probability of it being read automatically before any interaction.
The difference in practice
A codebase without AGENTS.md forces the agent to deduce the architecture by exploring files — which produces incorrect inferences, especially about conventions not apparent in the code. A codebase with a well-written AGENTS.md allows the agent to ask better questions, make more aligned decisions, and commit fewer convention errors.
- See also: The 6 Principles of AI-Native Architecture → /blog/ai-native-architecture-principles
- See also: AI-Readiness Score — how to measure if your codebase is ready → /blog/ai-readiness-score
- See also: From 50 to 5 engineers with AI-Native Architecture → /blog/team-shrunk-delivered-faster
- Learn about our AI-Native Engineering service → /software-engineering
Tags
Categories
Need help in this area?
Turn data into strategic decisions with machine learning and artificial intelligence.
Explore our Data Science & AI service