{"slug": "keeping-agents-md-claude-md-and-cursor-rules-in-sync", "title": "Keeping AGENTS.md, CLAUDE.md, and Cursor Rules in Sync", "summary": "A developer documented how coding agents load repository instruction files, showing that Codex applies a 32 KiB cumulative cap across the entire AGENTS.md directory chain, Claude Code expands @path imports in full at session start, and Cursor loads .mdc rules conditionally via globs. The writeup recommends treating AGENTS.md as the single source of truth, importing it from CLAUDE.md, and pushing situational workflows into glob-scoped rules or SKILL.md files to avoid silent truncation and token bloat.", "body_md": "If you run Claude Code in the terminal while someone else opens the same repository in Cursor or Codex, instruction files drift apart fast.\n\nCopy-pasting a 400-line style guide into every tool's config file doesn't just double your maintenance. Depending on the client, it can silently truncate nested package rules or add thousands of static tokens to every turn.\n\nHere is how each instruction format actually loads, three traps worth avoiding, and a minimal layout that keeps one source of truth.\n\n`AGENTS.md`` CLAUDE.md``@AGENTS.md` import plus Claude-only notes`.cursor/rules/*.mdc`` globs` rules that shouldn't load globally`SKILL.md`\n| File | Read by | Loading behavior & budget | \n|---|---|---|\n| `AGENTS.md` | Codex, Cursor, Windsurf, Cline | Loaded along directory chain ( `root` ->`cwd` );`32 KiB` cumulative cap in Codex | \n| `CLAUDE.md` | Claude Code | Loaded in full at session start ( `@path` imports expand immediately) | \n| `.cursor/rules/*.mdc` | Cursor ( `v0.45+` ) | Loaded conditionally when active files match YAML `globs` | \n| `SKILL.md` | Claude Code, Codex, Goose | Progressive disclosure: only `name` +`description` (~50 tokens) load until triggered | \n\nOpenAI Codex walks from `~/.codex/AGENTS.md` to your repo root `AGENTS.md` and down to your current working directory.\n\nBy default, `project_doc_max_bytes` is `32,768` bytes (`32 KiB`) across that **entire chain**, not per file. If your root `AGENTS.md` is a 28 KiB architecture essay, a package-specific `packages/api/AGENTS.md` deeper in the tree gets truncated or dropped without a loud warning.\n\nKeeping root `AGENTS.md` under ~150 lines of concrete build, lint, and test commands leaves plenty of room for subdirectory overrides.\n\n`@path` imports in A common assumption in Claude Code is that splitting a large `CLAUDE.md` into imports like this keeps the context window lean:\n\n```\n@docs/architecture.md\n@docs/coding-standards.md\n```\n\nIt helps human readability, but it does **not** defer loading. Claude Code expands `@path` imports into the session context at launch.\n\nIf a rule only applies to database migrations or API routes, put it in path-scoped rules (`.claude/rules/*.md` or `.cursor/rules/*.mdc`) or an on-demand `SKILL.md` instead of importing it into root `CLAUDE.md`.\n\nAgent Skills validate YAML frontmatter strictly:\n\n`name`: 1–64 characters, lowercase alphanumeric and single hyphens only (`^[a-z0-9]+(-[a-z0-9]+)*$`), and it `db-check/SKILL.md` -> `name: db-check`)` description`: 1–1,024 characters stating both If `name` has uppercase letters, underscores, or doesn't match the folder name, the agent skips it silently.\n\nInstead of hand-editing the same rules in three places:\n\n```\n# Project Instructions\n\n@AGENTS.md\n\n## Claude Code Notes\n- Run `/clear` between unrelated tasks to avoid re-caching long threads.\n```\n\n`CLAUDE.local.md` (gitignored).`src/components/**/*.tsx`).\nMost instruction drift comes from treating `AGENTS.md` and `CLAUDE.md` as separate documents. Pick `AGENTS.md` as the base, import it from `CLAUDE.md`, and push situational workflows out to skills or glob-scoped rules.\n\nIf you want to check byte budgets or generate the boilerplate files side by side, there's a [small browser-based linter and converter](https://findaitier.com/agents-md-vs-claude-md/) and a set of [MIT starter templates on GitHub](https://github.com/BeyenAI/agents-md-claude-md-templates).\n\n**Related:** [Why Your MCP Config Works in Cursor but Not in VS Code](https://dev.to/beyenai/mcp-config-schema-differences-in-2026-claude-code-mcpservers-vs-vs-code-vscodemcpjson-1pg6)\n\nHow are you organizing repo instructions when teammates use different coding agents?", "url": "https://wpnews.pro/news/keeping-agents-md-claude-md-and-cursor-rules-in-sync", "canonical_source": "https://dev.to/beyenai/keeping-agentsmd-claudemd-and-cursor-rules-in-sync-5fbo", "published_at": "2026-11-27 02:03:27+00:00", "updated_at": "2026-11-27 02:14:06.194311+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models"], "entities": ["Claude Code", "Cursor", "OpenAI Codex", "Windsurf", "Cline", "Goose"], "also_reported_by": [], "takeaway": "Keep root AGENTS.md under ~150 lines because Codex's 32 KiB project_doc_max_bytes cap spans the whole directory chain, and import AGENTS.md from CLAUDE.md rather than duplicating rules, since @path imports expand fully at session start.", "recommendation": {"advice": "Consolidate repo instructions into one AGENTS.md under ~150 lines, import it from CLAUDE.md, and move path-specific rules into glob-scoped .mdc or SKILL.md files to stay under Codex's 32 KiB chain cap.", "playbook": "coding-agents", "playbook_url": "https://wpnews.pro/playbooks/coding-agents"}, "alternates": {"html": "https://wpnews.pro/news/keeping-agents-md-claude-md-and-cursor-rules-in-sync", "markdown": "https://wpnews.pro/news/keeping-agents-md-claude-md-and-cursor-rules-in-sync.md", "text": "https://wpnews.pro/news/keeping-agents-md-claude-md-and-cursor-rules-in-sync.txt", "jsonld": "https://wpnews.pro/news/keeping-agents-md-claude-md-and-cursor-rules-in-sync.jsonld"}}