Agent rule pattern

Nested instruction files

Per-package AGENTS.md files with a clear order of precedence.

10 of 100 projects

The shape of the rule

  1. Keep shared rules at root
  2. Put detail near the code
  3. State what takes precedence
How to use it

The root file covers the whole repository; files beside the code add local rules. Projects with overlapping files state which one wins.

Keep shared rules at the root and local rules beside the code. Explain how to find the applicable files and which one wins when they conflict.

Examples from real projects

2 examples · Pinned source

A numbered precedence order

Three instruction sources are ranked in the opening lines: explicit human instructions, then the nearest nested AGENTS.md, then this file. The conflict case is answered before any rule is given.

AGENTS.mdL5–10
Source excerpt starting at line 5.
Apply all relevant instruction files. If instructions conflict, resolve them inthis order: 1. Explicit human instructions2. Nearest nested `AGENTS.md`3. This file

Route callers to the owner's guide

Scope follows the responsibility being changed, including callers outside its directory. The root links channel, plugin, agent, gateway, UI, testing, release, and security documentation.

AGENTS.mdL6–7
Source excerpt starting at line 6.
authorization boundaries still apply. Read the nearest scoped `AGENTS.md` and thematching references below, including when changing callers outside an owner's directory.

Projects using this pattern (10)

Browse in directory →
Show 2 more projects
← All agent rule patterns