The promise of AGENTS.md is simple: one file that makes AI agents behave. The reality is more nuanced. After three months of daily use across OpenAI Codex, Claude Code, Cursor, and OpenCode, patterns have emerged about what works, what doesn’t, and why some teams get consistent results while others fight their tools.
This post is for you if:
- You’ve tried AGENTS.md but agents still ignore your rules
- You’re deciding between AGENTS.md and skills
- You want to understand why certain patterns work
- You’re managing AGENTS.md across a team or monorepo
This is a synthesis of production usage, Vercel’s internal evaluations, and vendor documentation—distilled into actionable guidance.
New to AGENTS.md? Start with the practical guide and templates first. This post assumes you know the basics.
TL;DR
What works:
- Concise files (≤150 lines) with explicit rules
- Command references agents can copy-paste
- Progressive disclosure (link to docs, don’t paste them)
- Single canonical source with symlinks for multi-tool teams
What doesn’t:
- Long manuals agents ignore
- Conflicting rules across nested files
- Skills for basic conventions (AGENTS.md wins on adherence)
- Trying to maintain separate files per tool
Bottom line: AGENTS.md is the highest-leverage configuration you can add. Start with 10-15 lines, iterate based on agent mistakes, and resist the urge to document everything.
The Evidence
Vercel’s Evaluation
In October 2025, Vercel compared AGENTS.md against skills for internal agent workflows:
| Metric | AGENTS.md | Skills | Delta |
|---|---|---|---|
| Formatting reliability | 94% | 78% | +16% |
| Error rate (per task) | 0.3 | 0.7 | -57% |
| Setup time | 5 min | 30 min | -83% |
Why AGENTS.md won:
- No decision point — Information is present from the start, agents don’t choose whether to load it
- Consistent availability — Always in context, unlike skills that load asynchronously
- Faster to iterate — Edit a markdown file vs. redeploying skill configurations
When skills make sense: Heavy workflows that need orchestration (multi-step deploys, complex test suites). For conventions and guardrails, AGENTS.md is strictly better.
Production Usage Patterns
From teams using AI agents daily:
Pattern 1: The Minimal Viable File Most effective AGENTS.md files have 6-10 rules and 3-5 command references. Longer files see diminishing returns—agents start ignoring buried instructions.
Pattern 2: Hierarchical Loading Confusion Teams new to AGENTS.md often create conflicting rules:
- Root says “use single quotes”
apps/web/AGENTS.mdsays “use double quotes”- Result: Inconsistent output, frustrated developers
Solution: Root file has global rules, subdirectories only document what’s different.
Pattern 3: The Symlink Strategy
Teams using multiple tools (Codex + Claude Code + Cursor) maintain one AGENTS.md and symlink:
| |
This prevents drift between tool configurations.
How AGENTS.md Actually Works
AI agents load context in a specific order. Understanding this explains why some configurations work and others fail silently.
OpenAI Codex Loading Order
- Global:
~/.codex/AGENTS.md(if exists) - Root:
./AGENTS.md - Subdirectory: Nearest
AGENTS.mdto working directory - Merge: Files combine with subdirectory taking precedence
Size cap: ~64KB total. Large files get truncated.
Claude Code Loading Order
- Global:
~/.claude/CLAUDE.md(if exists) - Root:
./CLAUDE.md - Subdirectory:
CLAUDE.mdin working directory subtree - Context window: Full file loaded into every session
Critical difference: Claude Code loads the entire CLAUDE.md into context. A 500-line file consumes tokens that could be used for code analysis.
Cursor Loading Order
- Project:
.cursorrulesor.cursor/rules/*.mdc - User: Global Cursor settings
Note: Cursor recently added native AGENTS.md support. Check your version.
The File Format Reality
Three major vendors, three file names:
| Vendor | File | Status |
|---|---|---|
| OpenAI | AGENTS.md | Native, preferred |
| Anthropic | CLAUDE.md | Native, preferred |
| Cursor | .cursorrules | Native, plus AGENTS.md support |
The community is converging on AGENTS.md as the cross-tool standard (agents.md). It’s just markdown—no proprietary syntax.
Practical impact: Use AGENTS.md as your canonical source. For Claude Code specifically, either:
- Symlink
CLAUDE.md→AGENTS.md, or - Use
AGENTS.mddirectly (Claude Code reads it as fallback)
Writing Rules That Stick
Agents follow explicit, actionable rules. Vague guidance gets ignored.
❌ Vague:
| |
✅ Explicit:
| |
Why explicit wins: Agents pattern-match on specific instructions. “TypeScript strict mode” is a concrete configuration. “Clean code” requires interpretation they get wrong.
The Guardrails Pattern
Effective AGENTS.md files establish boundaries, not manuals:
| |
These are constraints agents check against. Contrast with:
| |
Agents don’t need architecture lectures—they need to know whether they can add dependencies without asking.
Common Failures (And Fixes)
Failure 1: Context Bloat
Symptom: Agents ignore instructions at the bottom of long files.
Cause: AGENTS.md over 200 lines. Agents (and underlying models) prioritize recent/early context. Buried instructions lose salience.
Fix: Move extended docs to separate files, reference them:
| |
Agents load @file references on demand.
Failure 2: Outdated Commands
Symptom: Agents run npm test but your project uses vitest.
Cause: AGENTS.md says npm test but package.json scripts changed.
Fix: Treat AGENTS.md like code. Update it when workflow changes. Add CI check:
| |
Failure 3: Secret Leakage
Symptom: API keys committed to repo because agent read them from AGENTS.md.
Cause: Including secrets in AGENTS.md for “convenience.”
Fix: Never put secrets in AGENTS.md. Use environment variables:
| |
Tool-Specific Behaviors
Claude Code: Global Configuration
Claude Code uniquely supports ~/.claude/CLAUDE.md for personal preferences across all projects:
| |
This applies to every repo you work on. Repo-specific CLAUDE.md overrides it.
OpenAI Codex: Override System
Codex supports AGENTS.override.md for temporary deviations:
| |
Useful for experimentation without changing canonical rules.
Cursor: Rules Directory
Cursor supports multiple rule files in .cursor/rules/:
.cursor/
└── rules/
├── general.mdc
├── react.mdc
└── testing.mdc
All load into context. Good for organizing complex projects, but watch for conflicts.
Multi-Language Teams
Teams working across Python, TypeScript, and documentation face a challenge: one AGENTS.md or many?
Recommendation: One root file with language-specific sections:
| |
Agents working in src/python/ see the Python section. Agents in docs/ see documentation rules.
Alternative: Language-specific subdirectories with their own AGENTS.md:
project/
├── AGENTS.md (universal rules)
├── backend/
│ ├── AGENTS.md (Python-specific)
│ └── src/
└── frontend/
├── AGENTS.md (TypeScript-specific)
└── src/
Both approaches work. The subdirectory approach scales better for large teams.
The Iteration Method
The best AGENTS.md files evolve through usage:
- Start minimal: 6-10 rules, 3-5 commands
- Use agents: Work on real tasks for 1-2 days
- Note failures: What did agents get wrong?
- Add rules: Document the fix in AGENTS.md
- Prune: Remove rules agents always follow correctly
- Repeat
Example evolution:
Day 1:
| |
Day 3: Agent adds dependency without discussion
| |
Day 7: Agent uses wrong test command for subdirectory
| |
When AGENTS.md Isn’t Enough
AGENTS.md sets conventions. It doesn’t handle:
- Complex workflows — Use skills (Codex) or subagents (Claude Code)
- External integrations — Use MCP servers
- Deterministic automation — Use traditional scripts
Decision matrix:
| Need | Use | Example |
|---|---|---|
| Code conventions | AGENTS.md | “Use TypeScript strict mode” |
| Test commands | AGENTS.md | “Run npm test” |
| Multi-step deploy | Skills | “Deploy to staging, run smoke tests, notify Slack” |
| Database queries | MCP | “Query user table via @postgres” |
| Scheduled tasks | Scripts | Cron job, CI pipeline |
Measuring Success
How do you know your AGENTS.md is working?
Quantitative:
- Agent error rate (mistakes per task)
- Time to first correct output
- Number of “please follow the rules” reminders you give
Qualitative:
- Agents propose changes that match team conventions
- Less time spent correcting agent output
- New team members understand codebase faster (via AGENTS.md)
Red flags:
- Agents consistently ignore specific rules
- You’re writing long explanations agents don’t follow
- Same mistakes repeat across sessions
Resources
Documentation:
- Practical guide with templates — Copy-paste templates for Python, TypeScript, documentation
- OpenAI Codex docs — Official spec
- Anthropic best practices — Claude Code guidance
- agents.md community — Cross-tool standardization
Tools:
- /tools/codex/ — OpenAI Codex setup guide
- /compare/codex-vs-claude-vs-cursor/ — Tool comparison
Research:
- Vercel: AGENTS.md vs Skills — Evaluation methodology and results
- Factory.ai AGENTS.md guide — Templates and patterns
Related links
- /agents/agents-md/ — Practical guide with templates
- /tools/codex/ — OpenAI Codex documentation
- /compare/codex-vs-claude-vs-cursor/ — Tool comparison
- /agents/ — AI agent ecosystem
Last reviewed: 2026-02-07 Evidence level: High (vendor documentation, published evaluations, production usage)