Nobody reviews a change to AGENTS.md the way they review a change to the payment code. It is a text file. The pull request looks harmless, it gets approved, and from that merge onward one of your AI tools reads none of your instructions. There is no error and no failing test.
Every case below is documented vendor behaviour, checked against the docs on 5 December 2026. Each comes with a few lines of shell you can put in CI today.
1. A Cursor rule saved as .md
Someone adds .cursor/rules/api-style.md. It looks like a rule. Cursor's rules docs say project rules must be .mdc files, and a plain .md file in that folder is ignored by the rules system.
bad=$(find .cursor/rules -type f ! -name '*.mdc' 2>/dev/null)
if [ -n "$bad" ]; then
echo "Cursor ignores these (must be .mdc):"; echo "$bad"; exit 1
fi2. A CLAUDE.md that switches off AGENTS.md
This one catches teams that did everything right. The repo has a good AGENTS.md. Claude Code reads it. Then a developer adds a small CLAUDE.md with two personal notes.
Claude Code reads AGENTS.md directly only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or above it. The new file wins, and the whole AGENTS.md drops out for every Claude Code user. We covered the mechanics in why your AGENTS.md still isn't loading. The fix is one line at the top of CLAUDE.md:
@AGENTS.mdAnd the check:
if [ -f AGENTS.md ] && [ -f CLAUDE.md ] && ! grep -q '^@AGENTS.md' CLAUDE.md; then
echo "CLAUDE.md does not import AGENTS.md. Claude Code will skip AGENTS.md."; exit 1
fi3. An AGENTS.md that outgrew Codex
Codex reads the AGENTS.md files from the repo root down to the folder it starts in, into one shared budget: project_doc_max_bytes, 32 KiB by default. Past that, the text is cut. Files are read root-first, so the part that goes missing is the most specific one, the file closest to the code. Details are in our post on the 32 KiB limit.
A pull request that adds forty lines to the root file can push a nested file over the edge without touching it.
total=$(find . -name AGENTS.md -not -path './node_modules/*' -exec cat {} + | wc -c)
if [ "$total" -gt 32768 ]; then
echo "AGENTS.md files total $total bytes. Codex cuts at 32768."; exit 1
fiThis sums every AGENTS.md in the repo, which is stricter than Codex itself. Codex only counts the chain for the folder it starts in. For a monorepo you would check each chain separately.
4. A Copilot instruction file that keeps growing
GitHub removed the old 4,000-character cutoff for code review in June 2026. The guidance that replaced it, in the instructions tutorial: "Limit any single instruction file to a maximum of about 1,000 lines. Beyond this, the quality of responses may deteriorate."
for f in .github/copilot-instructions.md .github/instructions/*.instructions.md; do
[ -f "$f" ] || continue
n=$(wc -l < "$f")
[ "$n" -gt 1000 ] && { echo "$f is $n lines. GitHub advises about 1,000."; exit 1; }
done
exit 05. The pull request that edits its own reviewer
This is less a breakage than a thing to know. Since 17 July 2026, Copilot code review reads custom instructions "from the head branch of the pull request instead of the base branch". A pull request that changes AGENTS.md or copilot-instructions.md is reviewed under its own new rules.
GitHub did this so teams can test instruction changes in the same pull request. It also means a change to those files deserves a human look. A simple way to force one:
git diff --name-only origin/main...HEAD | grep -E \
'(^|/)(AGENTS|CLAUDE|GEMINI)\.md$|^\.github/copilot-instructions\.md$|^\.cursor/rules/' \
&& echo "::warning::This pull request changes AI instruction files."Putting it in GitHub Actions
Save the checks as scripts/check-ai-instructions.sh and run it on every pull request:
name: AI instruction files
on: pull_request
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- run: sh scripts/check-ai-instructions.shFive short checks, no dependencies, and the three silent failures above stop being silent.
Where the home-made version runs out
These scripts cover the cases you already know about. Three things they do not handle:
- The rules change. The Copilot limit changed in June, the review branch in July, Claude Code's handling of
AGENTS.mdin September. A script written in May is checking for a world that is gone. - Old repos fail on day one. Switch a check on in a repo with existing problems and every pull request goes red, so someone switches it off. You need a way to record what is already wrong and fail only on what is new.
- One repo is not the company. A check per repo does not tell an engineering lead which of forty repos are broken for which tool.
That is what contextarch for teams is. The same idea as the scripts above, kept current against six tools' documentation: a check that fails a pull request with the reason and the fix written on the file that caused it, a baseline so old problems are reported without blocking, and one report across every repo you have. It runs inside your own CI and connects to nothing. $299 a year for one company.
If you only take one thing from this page, take check number 2. It is the most common way a careful team loses its instructions, and it is one grep.