Repository navigation
ci(docs): fail CI when root AGENTS.md exceeds 24 KiB - #208
Merged
Merged
Conversation
Harold Hunt (huntharo)
force-pushed
the
ci/agents-md-size-limit
branch
from
November 19, 2026 03:36
997e2da to
64eb1ac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a CI guard that fails when the repository-root
AGENTS.mdgrows past 24 KiB (24,576 bytes).Codex reads at most
project_doc_max_bytesof AGENTS.md (32 KiB by default) and silently drops the rest, and Claude Code loads the whole file into every thread's first turn. PwrSnap's AGENTS.md grew to 212 KB and Codex agents saw it cut off near line 760 of 3,603. 24 KiB leaves headroom for nested AGENTS.md files. PwrRoute's root AGENTS.md is 12,383 bytes, so this only adds the guard. It matches pwrdrvr/PwrAgent#3918.scripts/check-agent-instructions-size.mjs: a dependency-free Node script with an exported purecheckAgentInstructionsSize()and the 24 KiB constant. The failure message says how many bytes over the file is and how to fix it.scripts/check-agent-instructions-size.test.mjs(node:test): sweeps sizes across the boundary for several limits, checks the limit is under Codex's 32 KiB, and checks that the classifier job runs the check before classifying, withoutcontinue-on-error.AGENTS.mdand the script, then a step that runs it. Docs-only PRs pass through this job.cargo xtask lintruns the new test and the check, so Typecheck runs it too.AGENTS.md› Docs & conventions gives the limit and the command.Required checks
The "Protect main" ruleset requires
Typecheck,BuildandTest. A skipped required check counts as passing. All three jobs already use!cancelled() && (needs.changes.result != 'success' || …), andclassify-changes.test.cjscovers that. So when the size step fails Classify Changes, Typecheck still runs, repeats the check throughcargo xtask lint, and turns red. No workflowif:or ruleset change is needed.Verification (macOS, local)
actionlint .github/workflows/ci.yml: cleannode --test scripts/check-agent-instructions-size.test.mjs scripts/ci/classify-changes.test.cjs: 93/93 passnode scripts/check-agent-instructions-size.mjs:AGENTS.md is 12383 of 24576 bytes.A 24,577-byte copy fails with exit 1 and(1 over); a 24,576-byte copy passes.cargo fmt --checkandcargo check -p xtask: passcargo xtask lint(clippy, cargo-deny, notices) locally; CI's Typecheck runs it.