Add an AGENTS.md line-budget pre-commit check to scripts/lint.py to prevent cumulative prompt context inflation
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- developer-experience, tooling
Research direction
Start with scripts/lint.py and the spec-hierarchy-sync hook in .pre-commit-config.yaml, since the proposed scripts/check_agents_budget.py should follow the same pattern as scripts/check_spec_hierarchy.py. Confirm the budget ceiling (350 lines) with a maintainer before coding. Done when python scripts/lint.py --all-files passes on the current 324-line AGENTS.md and fails with the budget error once the file exceeds the limit.
Written by the indexing model from the issue text.
Description
What happened
On PR #257, fullsend-ai-coder added 40 lines of new meta-rules to AGENTS.md, growing the file from 324 lines to 364 lines (over 2,300 words). ProtoBot's pre-commit suite and offline hook runner (python scripts/lint.py) passed without error, as did CI workflows (e.g. run 37963244752). The PR underwent 4 review rounds and 3 fix iterations before being closed unmerged by maintainer John Strunk due to token bloat ("That's a lot of tokens to add to AGENTS for a simple heading change.").
Historical analysis of AGENTS.md reveals that the file originated at 6 lines and 31 words (commit 1c05265) and has grown 65-fold over 30+ commits—primarily driven by successive retro-generated issues that added extensive meta-governance and prescriptive "Review agents must check..." instructions. AGENTS.md is injected into the system prompt of every agent dispatched in the repository (triage, code, review, fix, retro).
What could go better
ProtoBot has no deterministic gate preventing AGENTS.md from expanding indefinitely. Pre-commit hooks already validate formatting, yaml syntax, Go code, secrets, and spec hierarchy synchronization (scripts/check_spec_hierarchy.py), but line count and context budget for AGENTS.md are completely unconstrained.
If the repository maintained a line-budget check (e.g., hard cap of 350 lines or requiring consolidation for rule additions), the code agent on PR #257 would have caught the budget violation locally during pre-commit execution (python scripts/lint.py), preventing a bloated 40-line diff from being submitted and avoiding 4 review runs, 3 fix iterations, and $8.64 in wasted agent execution.
Confidence: High. ProtoBot already uses local Python scripts in scripts/ hooked into .pre-commit-config.yaml and scripts/lint.py for repository-specific invariants.
Proposed change
In redhat-et/ProtoBot:
- Create a lightweight check script
scripts/check_agents_budget.pythat:- Counts non-empty lines in
AGENTS.md. - Enforces a maximum ceiling (e.g., 350 lines;
AGENTS.mdis currently 324 lines). - Exits non-zero with a clear error message if
AGENTS.mdexceeds the budget:ERROR: AGENTS.md exceeds the 350-line budget (%d lines). Consolidate existing rules or migrate instructions to on-demand skills before adding new prose.
- Counts non-empty lines in
- Register
check_agents_budget.pyas a local hook in.pre-commit-config.yamlunderrepo: local(similar tospec-hierarchy-sync) and wire it intoscripts/lint.py. - Add
AGENTS.mdbudget verification to offline pre-commit runs so coding agents catch prompt bloat locally before committing.
Validation criteria
- Running
python scripts/lint.py --all-filespasses against the current 324-lineAGENTS.md. - Artificially adding >26 lines to
AGENTS.mdcausespython scripts/lint.pyandgit committo fail with the line-budget error. - The next 5 PRs modifying
AGENTS.mdinredhat-et/ProtoBotremain under the 350-line budget or consolidate existing sections rather than inflating prompt size.
Generated by retro agent from https://github.com/redhat-et/ProtoBot/pull/257
- Dominant language
- Go
- Stars
- 6
- Forks
- 6
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 96
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from redhat-et/ProtoBot
-
Group fullsend and agents package updates in Renovate configurationPossibly taken @JohnStrunk claimed this 1 day ago. Openenhancement feature infra ready-for-triage triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
redhat-et/ProtoBot#277 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement feature infra ready-for-triage triaged
Difficulty 3/5 1-2 days Newbie friendliness 55/100
redhat-et/ProtoBot#288 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Scope AGENTS.md specification-document sibling reading rule to avoid whole-repo doc reading on localized editsPossibly taken @cplegendre claimed this 1 day ago. Opendocumentation ready-for-triage ready-to-code
redhat-et/ProtoBot#283 · 2 comments · 2 reactions · 1 assignee ·
Maintainers usually reply within 1 day
-
Support multiple proposed change sets in selfhost_test.go to prevent fixture test failures during registered artifact updatesPossibly taken @fullsend-ai-coder claimed this 1 day ago. Openbug component:ears-manager ready-for-triage ready-to-code
Difficulty 3/5 Half a day Newbie friendliness 25/100
redhat-et/ProtoBot#282 · 3 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
Add CI and pre-commit validation for .fullsend/harness/*.yaml base URL SHA-256 integrityPossibly taken @JohnStrunk claimed this 1 day ago. Openenhancement feature infra ready-for-triage triaged
Difficulty 4/5 3-5 days Newbie friendliness 55/100
redhat-et/ProtoBot#279 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in redhat-et/ProtoBot
Similar issues
-
Say in the changelog that the text-index update cannot be rolled backPossibly taken @praetorianer777 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
praetorianer777/GoTome#275 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SAP/crossplane-provider-btp#1118 ·
Maintainers usually reply within 1 day
-
benchmark: `make setup` fails because audit-exporter builds with Go 1.25.0 while go.mod requires 1.26.0Possibly taken @xsvm claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 84/100
volcano-sh/volcano#6097 · 1 comment ·
Maintainers usually reply within 1 day
-
area/infra backlog bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
praetorianer777/Stator#417 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day