Back to Resources
Cross-Agent Diagnostics: Codex CLI, Antigravity, Windsurf & CursorLast Updated: Published December 5, 2026

Why AI Coding Agents Ignore Your Rules File: Token Caps, Truncation, and Silent Drops

When an AI coding agent ignores your rules file without raising an error, it almost always hit a silent byte ceiling, character cap, or frontmatter filter. OpenAI Codex CLI stops at 32 KiB, Google Antigravity truncates files at 24,000 bytes, Windsurf caps rules at 12,000 characters, Cursor drops plain .md rules, and Claude Code trims oversized subfiles and post-compaction skills.

Byte Cap Triage
Frontmatter Check
Modular Sync

Codex, Antigravity, Windsurf, or Cursor silently ignoring rules? Fix 32 KiB byte caps, 24 KB truncation, invalid frontmatter, and /compact drops.

Why Do AI Coding Agents Silently Ignore Rules Files Without Throwing an Error?

AI coding agents silently ignore rules files because every major runtime enforces hard startup caps, strict filename filters, or YAML schema validation and drops excess instructions rather than crashing your session. Across OpenAI Codex CLI, Google Antigravity, Windsurf Cascade, Cursor IDE, and Claude Code, the loader either halts directory concatenation at a byte boundary or skips files whose extension or frontmatter fails validation.

Use the symptom-to-cause triage matrix below to isolate which runtime guardrail intercepted your rules file before editing another prompt:

Coding AgentObserved SymptomRoot CauseImmediate Fix
OpenAI Codex CLIRoot AGENTS.md works, but nested service rules vanish silentlyCombined ~/.codex + repo chain hit project_doc_max_bytes (32 KiB / 32,768 B default)Trim root AGENTS.md under 8 KB, move workflows to ~/.codex/skills, or raise project_doc_max_bytes
Google Antigravity.agents/rules/*.md is never loaded or cuts off mid-ruleMissing/invalid snake_case trigger frontmatter, nested subfolder without rules.json, or >24,000 B after @[label](path)Add trigger: always_on|model_decision|glob|manual, flatten folders, and split files under 24 KB
Windsurf CascadeWorkspace rule stops applying partway through the checklistIndividual .windsurf/rules/*.md file exceeds the 12,000-character limitSplit oversized rules into focused <=12,000-char files with glob or model_decision triggers
Cursor IDERule file exists in .cursor/rules/ but Composer ignores itSaved as plain .md instead of .mdc, missing globs/alwaysApply frontmatter, or rule >500 linesRename to .mdc, declare globs or alwaysApply: false, and keep files under 500 lines
Claude CodeRules work early in chat, then vanish after /compact or on subdirsSubdirectory CLAUDE.md/rules truncated past per-file limit, >4 MiB file skipped, or 1% skill listing overflowKeep CLAUDE.md under 200 lines, move domain rules to .claude/rules/ with paths:, and audit /doctor

Hard Byte, Character, and Token Thresholds Across Five Coding Agents

Every coding agent enforces a different numeric boundary on rule loading, so a monolithic instruction file that works in Cursor can silently truncate in OpenAI Codex CLI, Google Antigravity, or Windsurf Cascade. Verifying the exact ceiling in each official specification eliminates guesswork when debugging missing guidelines across tools.

  • OpenAI Codex CLI (32 KiB combined cap): Codex CLI reads ~/.codex/AGENTS.override.md or AGENTS.md and walks from Git root to the current working directory. Per the OpenAI Codex AGENTS.md guide, "Codex skips empty files and stops adding files once the combined size reaches the limit defined by project_doc_max_bytes (32 KiB by default)." When root AGENTS.md hits 32,768 bytes, nested microservice overrides are silently omitted (see our Codex CLI AGENTS.md override and 32 KiB cap guide).
  • Google Antigravity (24,000-byte per-file & 20,000-token budget): According to the Google Antigravity Rules documentation, "Antigravity truncates any single rule file that exceeds 24,000 bytes (after expanding @[label](path) includes)." Global and always_on rules also share a 20,000-token aggregate budget, nested folders inside .agents/rules/ are ignored unless registered in .agents/rules.json, and camelCase keys like alwaysOn silently discard the rule.
  • Windsurf Cascade (12,000-character per-file cap): As documented in the Windsurf Cascade Memories & Rules reference, "Rules files are limited to 12000 characters each." Directives pasted past character 12,000 inside .windsurf/rules/*.md are dropped from active context.
  • Cursor IDE (.mdc requirement & 500-line ceiling): Per the Cursor Rules documentation, modular project rules must end in .mdc—a plain .md file inside .cursor/rules/ is ignored because it lacks YAML frontmatter (description, globs, alwaysApply)—and Cursor advises keeping every rule under 500 lines.
  • Claude Code (200-line guidance, 4 MiB hard skip, 1% skill listing & /compact): According to the Claude Code Memory documentation, "When a subdirectory CLAUDE.md or a rules file that loads on demand is over a per-file size limit, Claude receives only the start of it." Claude Code skips any memory file over 4 MiB, caps MEMORY.md auto-loads at 200 lines or 25 KB, and on the Claude Code Skills page enforces a 1% context window skill-listing budget plus a 25,000-token compaction budget (5,000 tokens per skill), dropping older skills after /compact.

How Can You Diagnose Truncated or Discarded Rules Files in Under 30 Seconds?

Run a single POSIX shell audit across your repository and home directories to measure exact byte sizes, character counts, line counts, file extensions, and YAML trigger keys before touching rule wording. Catching a 33,100-byte AGENTS.md chain or an unrecognized alwaysOn key in .agents/rules/ takes seconds and separates truncation bugs from multi-agent instruction precedence conflicts.

Save and execute check-rules-caps.sh from your repository root to flag every silent-drop condition across OpenAI Codex CLI, Google Antigravity, Windsurf Cascade, Cursor IDE, and Claude Code:

#!/usr/bin/env bash
set -euo pipefail

echo "=== 1. Codex CLI AGENTS.md Chain (32,768 B cap) ==="
codex_bytes=0
for f in "${CODEX_HOME:-$HOME/.codex}/AGENTS.override.md" "${CODEX_HOME:-$HOME/.codex}/AGENTS.md" AGENTS.override.md AGENTS.md; do
  [ -s "$f" ] || continue
  b=$(wc -c < "$f" | tr -d ' ')
  codex_bytes=$((codex_bytes + b))
  printf "  %6d B  %s\n" "$b" "$f"
done
[ "$codex_bytes" -gt 32768 ] && echo "  [FAIL] Codex chain ($codex_bytes B) exceeds 32,768 B default!"

echo "=== 2. Antigravity Rules (24,000 B cap & valid snake_case trigger) ==="
for f in .agents/rules/*.md ~/.gemini/config/rules/*.md; do
  [ -f "$f" ] || continue
  b=$(wc -c < "$f" | tr -d ' ')
  [ "$b" -gt 24000 ] && echo "  [TRUNCATED] $f is $b B (>24,000 B; check @[label](path) includes too)"
  grep -qE '^trigger:[[:space:]]*(always_on|model_decision|glob|manual)[[:space:]]*$' "$f" ||     echo "  [IGNORED]   $f missing valid snake_case trigger frontmatter"
done

echo "=== 3. Windsurf Rules (12,000 char cap) ==="
for f in .windsurf/rules/*.md; do
  [ -f "$f" ] || continue
  c=$(wc -m < "$f" | tr -d ' ')
  [ "$c" -gt 12000 ] && echo "  [TRUNCATED] $f is $c chars (>12,000 limit)"
done

echo "=== 4. Cursor Rules (.mdc extension & 500-line ceiling) ==="
for f in .cursor/rules/*.md; do
  [ -f "$f" ] && echo "  [IGNORED]   $f uses .md instead of .mdc"
done
for f in .cursor/rules/*.mdc; do
  [ -f "$f" ] || continue
  l=$(wc -l < "$f" | tr -d ' ')
  [ "$l" -gt 500 ] && echo "  [BLOATED]   $f has $l lines (>500-line Cursor recommendation)"
done

echo "=== 5. Claude Code Root & Subdir CLAUDE.md (200-line target) ==="
find . -maxdepth 4 -name "CLAUDE.md" -not -path "*/node_modules/*" | while read -r f; do
  l=$(wc -l < "$f" | tr -d ' ')
  [ "$l" -gt 200 ] && echo "  [WARN]      $f has $l lines (>200 lines risks tail truncation or drift)"
done

Notice one subtle trap in Google Antigravity: a 4 KB rule file containing three @[schema](docs/api.md) includes can silently cross 24,000 bytes after expansion. Always sum the byte size of included targets alongside the parent rule file.

The Sprawl Moment: When a 28 KB Rules File Quietly Cuts Off Before Your Guardrails

Over six months on a polyglot monorepo, a backend engineer keeps appending database migration rules, GraphQL lint notes, and Terraform conventions to the bottom of a shared root AGENTS.md and a global Antigravity rule file that pulls in an architecture doc via @[arch](docs/architecture.md). By December, the root chain crosses 34 KB on their work laptop and the expanded Antigravity rule hits 26,400 bytes—just enough to leave the final 40 lines of production rollback and PII-redaction guardrails outside the cutoff. When the engineer spins up a hotfix in Codex CLI on a secondary MacBook, the agent passes every early style rule, silently misses the truncated bottom section, and writes an unindexed migration with raw error logging straight into a pull request.

How Do You Fix Silent Rule Drops Without Losing Cross-Tool Context?

Fix silent rule drops permanently by keeping root files under 1,500 tokens of universal invariants, scoping domain checklists by file glob or path, and moving multi-step workflows into lazy-loaded SKILL.md modules. Splitting rules by activation boundary ensures OpenAI Codex CLI, Google Antigravity, Windsurf Cascade, Cursor IDE, and Claude Code load only what the current task requires instead of silently clipping the tail of a 30 KB monolith.

  1. Cap root files at build, test, and security invariants: Keep AGENTS.md, GEMINI.md, and root CLAUDE.md under 150–200 lines (roughly 6–8 KB) so Codex CLI never exhausts its 32 KiB project_doc_max_bytes budget before reading nested microservice overrides.
  2. Scope domain rules with valid native frontmatter: Move language-specific rules into .cursor/rules/*.mdc (with globs), .windsurf/rules/*.md (under 12,000 characters), .agents/rules/*.md (flat folder, snake_case trigger: glob or model_decision), or .claude/rules/*.md (with paths:).
  3. Move procedural runbooks into progressive SKILL.md folders: Multi-step code reviews, release checklists, and incident workflows belong in ~/.claude/skills/ or ~/.codex/skills/ where only the short YAML description loads at startup. See our guide on eliminating token context overhead in agent skills to measure startup savings.
  4. Centralize cross-tool sync instead of maintaining five copies: When you trim a rule in Cursor, that fix should update Codex, Antigravity, and Claude Code automatically so one stale machine never re-introduces a 30 KB bloat regression.

Prompttly is a skill manager for AI agents — one library for your skills and prompts that syncs into Claude Code, Codex, ChatGPT, and Claude and is one hotkey away on your Mac, so your setup follows you across every machine, repo, and tool.

Prompttly's two-way sync on Mac writes modular SKILL.md directories directly to ~/.claude/skills and ~/.codex/skills while letting you trigger situational prompts in under 200ms from the macOS hotkey palette—so one-off checklists consume zero rule-budget bytes at session start. You can build lean headers right now with the free Custom Instructions Generator or Claude Skill Creator, review Google Antigravity rules and workspace scopes, or explore the full library on the Prompttly resources hub.

What Do Engineers Ask Most When AI Coding Agents Ignore Rules?

Most silent rule failures come down to cumulative byte caps, hidden filename rules, or context compaction dropping everything except root files. These four answers cover the diagnostic edge cases engineers hit most often across multi-agent stacks.

Why does an AI coding agent ignore the bottom half of my rules file?

AI coding agents silently truncate rules files that exceed per-file or cumulative startup limits. Google Antigravity truncates any rule file past 24,000 bytes after expanding @[label](path) includes, OpenAI Codex CLI stops appending AGENTS.md files at 32 KiB (32,768 bytes), Windsurf caps each rule at 12,000 characters, and Claude Code delivers only the start of oversized subdirectory CLAUDE.md files.

Why does Cursor ignore plain .md files inside .cursor/rules/?

Cursor requires modular rules inside .cursor/rules/ to use the .mdc extension with YAML frontmatter defining description, globs, and alwaysApply. Plain .md files inside .cursor/rules/ are ignored by Cursor because they lack that metadata header, even though AGENTS.md at the repository root is still parsed as plain Markdown.

Why do rules disappear halfway through a long Claude Code or Codex session?

During long sessions, context compaction summarizes older turns. In Claude Code, only root CLAUDE.md is re-read from disk after /compact; conversational instructions vanish, nested rules reload only on demand, and re-attached skills share a 25,000-token cap (5,000 tokens per skill), dropping older invoked skills first.

How do I keep rules from hitting size caps across multiple coding agents?

Keep root files (AGENTS.md, GEMINI.md, CLAUDE.md) under 1,500 tokens for repo-wide build and safety invariants, move task checklists into lazy-loaded SKILL.md packages or glob-scoped rules, and use Prompttly to store and sync one canonical library across Codex, Claude Code, Cursor, and Antigravity.

Keep rules lean and synced across every coding agent

Stop hitting 32 KiB Codex cutoffs or silent Antigravity truncation. Prompttly syncs modular skills and scoped rules across Codex CLI, Claude Code, Cursor, and ChatGPT—plus a sub-200ms Mac hotkey palette for situational prompts.