P0003 agent-rules-match-lints¶
Rule: Limits an agent file states are the limits the lints check.
| Code | P0003 (stable, never reused) |
| Id | agent-rules-match-lints |
| Category | agents |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | warn |
limits AGENTS.md states are the limits the lints check |
| ai | deny |
a stated limit the lints check differently teaches agents a rule the repo does not hold |
| 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 |
Why¶
A rules file that states a limit the lints check differently, or do not check at all, teaches agents a rule the repo does not hold. The text and the configuration must say the same.
The rule reads each line of files for a number with a unit, given to the nearest subject before it on the line:
| Subject | Unit | Lint and parameter |
|---|---|---|
| commit subject | chars, characters | commit-subject-length.max-chars |
| commit body | lines | commit-body-lines.max-lines |
| CHANGELOG entry | lines | changelog-entry-length.max-lines |
| CHANGELOG entry | words | changelog-entry-length.max-words |
| AGENTS.md, this file | lines | agent-file-lines.max-lines |
| sentence | words | sentence-words.max-words |
| paragraph | sentences | paragraph-sentences.max-sentences |
A limit is reported when its lint is off, or when the lint's parameter differs.
How to fix¶
Set the lint's parameter to the stated value in spirit_level.toml, or change the text to what the lint checks.
Configure¶
[lints.agent-rules-match-lints]
level = "deny"
files = ["AGENTS.md"]
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(agent-rules-match-lints) <reason> (waivers); the code works there too, as in [lints.P0003].