Skip to content

P0001 agent-file-lines

Rule: An agent file stays under its line limit.

Code P0001 (stable, never reused)
Id agent-file-lines
Category agents
Source spirit_level
Fix by hand

Level per tier

Tier Level Reason
small warn agents read AGENTS.md whole every session; a long one is skimmed, not followed
small-workspace warn agents read AGENTS.md whole every session; a long one is skimmed, not followed
medium warn agents read AGENTS.md whole every session; a long one is skimmed, not followed
big warn agents read AGENTS.md whole every session; a long one is skimmed, not followed
ai deny agents read the file whole every session; a long one is skimmed, not followed
embedded off
ui off
egui off
units-strict off
units-paranoid off

Parameters

Name Type Default Meaning
files list of strings ["AGENTS.md"] the agent files, relative to the root
max-lines integer 150 lines a file may have

Why

An agent reads its rules file whole at the start of every session. Each line costs context in every session and dilutes the rules that matter. A short file is read and followed; a long one is skimmed.

AGENTS.md: 212 lines (limit 150)

How to fix

Keep the rules an agent must follow. Move explanations, layouts and how-tos into the book and link them.

Configure

[lints.agent-file-lines]
level = "deny"
files = ["AGENTS.md"]
max-lines = 150
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(agent-file-lines) <reason> (waivers); the code works there too, as in [lints.P0001].