agents-md
What a root AGENTS.md holds, where the rest of a repository's agent knowledge goes, and the line limits a check enforces. Use when writing, trimming or reviewing an AGENTS.md or a CLAUDE.md.
SKILL.mdskills/conventions/agents-md/SKILL.md
GitHubAGENTS.md
A root AGENTS.md holds only what almost every task in the repository needs.
When to use
- Creating an
AGENTS.mdfor a repository. - Adding a rule, a command or a note to an existing one.
- The file grew, or the size check warns.
Rules
Why it stays short
- The root file loads in full into every session and every subagent in the repository.
- Every line is paid for in every request. A line only one directory needs does not belong there.
- The baseline already applies. The file never repeats it.
What belongs in the root file
- Purpose: what the repository is, in a few lines.
- Layout: the main directories, one line each.
- Commands: the ones that verify a change and start the work, such as
task setupandtask check. - Hard constraints: what breaks if ignored, specific to this repository.
## Deviationsfrom the baseline, one line each with the reason. Seerepo-conventions.
Where the rest goes
- Knowledge tied to one directory: a nested
AGENTS.mdin that directory. - A
CLAUDE.mdnext to each nestedAGENTS.md, holding only@AGENTS.md. - A nested file loads on demand, once a file below its directory is read. Verified in one run, see ADR 0009.
- Background, history and reasons: a file under
docs/, with a one line pointer inAGENTS.md. - A decision worth keeping: an ADR. See
adr. - What the code, the config or
task --listalready shows: nowhere.
Limits
- Root
AGENTS.md: 150 lines at most. - Nested
AGENTS.md: 100 lines at most. - Over the limit means move content out, not squeeze lines together.
- Move in this order: a nested file, then
docs/, then delete.
The check
- The check is the task
lint:agents-md, defined once in the shared workflows repository. - A repository includes that shared task and runs it locally and in CI.
- It has two modes:
warnprints the files over the limit,failalso exits non zero. - The limits are inputs of the check, defaulting to 150 and 100.
- CI runs the included task with
--yesor--trusted-hosts, because a remote include needs trust. Task loads the include on every call, so everytaskcall in CI passes the flag. - Pin the include by tag and checksum. The tag and the checksum move by hand together.
- Set the mode once as a root
varsentry inTaskfile.yaml, so a local run and CI agree.
Rollout
- A repository above the limit starts in
warnmode. - Its own issue shrinks the file, then the mode turns to
fail. - A repository within the limits starts in
failmode.
Guardrails
- Root file at most 150 lines, nested files at most 100.
- No content the baseline already states.
- No content the code or
task --listshows. - Every nested
AGENTS.mdhas aCLAUDE.mdholding@AGENTS.mdnext to it. - Every
docs/page the file relies on has a one line pointer. - Never turn the check off to pass. Move the content.
References
repo-conventionsfor the required files and## Deviations.adrfor recording a decision.docs/adr/0009-agents-md-stays-short.mdin the skills repository for the limits and the probe results.