agents-md

AGENTS.md project structure: writing the repo map agents use to navigate

A project-structure section in AGENTS.md is a short map of where things live: the top-level folders, which ones are apps, packages, and docs, and any naming or ownership rules an agent can't work out from the tree alone. AGENTS.md is plain Markdown with no required heading — you can use any headings you like. The map is guidance an agent reads. It doesn't enforce your layout. In a monorepo, keep the root map high-level and put a nested AGENTS.md in each package for its local map. Agents read the nearest file in the tree, so the closest one takes precedence.

Who this is for

Your agents keep creating files in the wrong package, looking for shared code in the wrong place, or editing generated output, and your AGENTS.md says nothing about how the repo is laid out.

What the map should list

Put in the mapWhy the agent needs itLeave out
Top-level folders and what each holdsSo it starts in the right placeA full file-by-file tree
Which folders are apps, packages, docsSo new code lands in the right kind of folderFolders it never needs to touch
Where shared code and types liveSo it reuses instead of duplicatingImplementation detail inside each module
Generated or vendored foldersSo it doesn't hand-edit outputBuild internals
Naming rules the tree doesn't showSo new files match existing onesStyle rules covered elsewhere in the file
Pointers to nested AGENTS.md filesSo it knows local maps existA copy of each local map

A sample section

markdown
## Project structure
- `apps/web/` — Next.js site. Pages in `app/`, components in `components/`.
- `apps/api/` — API server. Has its own AGENTS.md.
- `packages/ui/` — shared React components. Add new shared components here, not in apps.
- `packages/types/` — shared TypeScript types.
- `docs/` — human docs. Don't edit unless asked.
- `dist/`, `generated/` — build output. Never hand-edit.
- Naming: kebab-case file names; tests sit next to the file as `*.test.ts`.

The heading is your choice. "Project structure," "Project overview," and "Repo map" all work, because the agent reads the text, not a schema.

Nested AGENTS.md in a monorepo

Keep the root map to the top level: which apps and packages exist and what each is for. Inside each package, add an AGENTS.md that maps that package's own folders and rules. When an agent works in `apps/api/`, the nearest file is the one it follows, and on a conflict the closest file wins. Your direct instructions in chat still override both. The inheritance map shows how nested files combine.

Pitfalls

  • A full tree dump. Pasting `tree` output goes stale fast and buries the parts that matter. List folders and their purpose.
  • Treating the map as a guard. AGENTS.md doesn't block edits to `generated/`. If a folder must never change, say so plainly and check it in review.
  • Duplicating local maps at the root. Two copies drift apart. Point to the nested file instead.
  • Writing for humans. Onboarding history belongs in README.md (see AGENTS.md vs README). The map should say what an agent needs to navigate.
  • Forgetting to update it. When you move or add a top-level folder, update the map in the same change.

How to check it

  1. Read each path in the map and confirm it still exists.
  2. Ask an agent where a new shared component should go, and confirm it names the folder from your map.
  3. In a monorepo, open a session inside one package and confirm the agent follows that package's AGENTS.md.
  4. Ask it to change a file in a generated folder and confirm it points to your "never hand-edit" line.

For the wider question of what belongs in the file and how Cursor, Claude Code, and Codex use it, see the AGENTS.md guide for Cursor, Claude Code, and Codex. For the PR block that often sits next to this map, see AGENTS.md PR and commit instructions.

Where ShipKits fits

The Operator Pack ($47) is markdown seats + skills + install.sh — not a hosted app, not a chatbot. Seven named seats, three skills, an ops playbook and a token-cost playbook. Done means a file, PR, or URL. Its AGENTS.md templates include a project-structure section, a nested-file pattern for monorepos, and placeholders for build, test, and PR instructions. Soft path: start at /free. Cheat Sheet for the skim checklist mindset.

Soft next step

Write a ten-line project-structure section for your repo and check every path in it today. Soft ladder: /free, then the Operator Pack ($47). Related: AGENTS.md vs README, AGENTS.md guide, PR and commit instructions.

FAQ

Should AGENTS.md include a project structure section?+

Yes, if agents need a map of the repo. The agents.md site lists project overview among the popular things to cover, alongside build and test commands.

What goes in an AGENTS.md project overview?+

Where packages, apps, and docs live, plus any naming or ownership rules agents can't infer from the tree. Keep it short enough that it stays accurate as the repo changes.

Does AGENTS.md enforce how my repo is laid out?+

No. It's Markdown instructions agents read. It doesn't validate paths, block wrong folders, or change the filesystem.

Are section headings in AGENTS.md required?+

No. The agents.md FAQ says there are no required fields and you can use any headings; the agent parses the text you provide.

How do nested AGENTS.md files help in a monorepo?+

Put another AGENTS.md in each package for its local map. Agents read the nearest file in the tree, and the closest one takes precedence.

How is the structure block different from README.md?+

README.md is for humans browsing the repo. AGENTS.md is a dedicated place for agent instructions, so the structure block should say what an agent needs to navigate, not what a human needs to onboard.

Get the free starter

Value first, then a kit when you are ready. No fake urgency. Start with Harness Desk Starter at /free.