How to Write AGENTS.md and Move Your Cursor Rules to Grok Build
Learning how to write AGENTS.md is the fastest way to keep your AI coding instructions working now that Cursor has become Grok Build, because it is the one rules file that both the Grok Build editor and its terminal agent read. Your old .cursor/rules files will not all behave the same across the two.
On 30 November 2026, Cursor was officially renamed Grok Build, and Engadget reported that team integrations switch from @Cursor to @Build on 7 December. We covered pricing, models and privacy this morning in Grok Build Replaces Cursor: What Developers Must Check Before Dec 7. This guide handles a quieter problem: the project rules your team spent months tuning. Grok Build’s documentation shows the desktop editor and the terminal tool load rules differently, and if you do not plan for that, your agent can quietly stop following your conventions.
In short: Put the instructions every agent session needs into a plain Markdown AGENTS.md at your repo root, with nested AGENTS.md files for subprojects. Keep only file-scoped rules as .mdc files in .cursor/rules, convert description-based rules into skills, and test in both the editor and the terminal before you commit.
Time needed: 1 to 3 hours per repository | Difficulty: Medium | Who this is for: Developers and team leads who used Cursor rules and now run Grok Build in the editor, the terminal, or both
What You Need Before You Start
- Grok Build installed (the desktop app, the terminal tool, or both), signed in to your account.
- Write access to the repository and permission to open a pull request.
- Your existing rules: the .cursor/rules folder, any legacy .cursorrules file, and a copy of your User Rules from settings.
- Team admin access if your company uses Team Rules on a Team or Enterprise plan.
- Your project’s real commands: install, build, test and lint, exactly as you run them.
Step 1: Inventory Every Rule You Have Today
Before you move anything, list what exists. Grok Build’s rules documentation (last updated 25 November 2026) names four rule types: Project Rules, User Rules, Team Rules and AGENTS.md. Each lives somewhere different:
| Rule type | Where it lives | What to export |
|---|---|---|
| Project Rules | .cursor/rules in the repo (.mdc files, subfolders allowed) | Already in git, just list them |
| User Rules | Customize, then Rules, in the app (not stored as files) | Copy the text into a scratch file |
| Team Rules | Grok dashboard, Team and Enterprise plans | Ask your admin for the current list |
| AGENTS.md | Repo root and subdirectories | Note if you already have one |
Run this in your repo to see every rule file at once:
find . -path ./node_modules -prune -o \( -name "*.mdc" -o -name ".cursorrules" -o -name "AGENTS.md" -o -name "CLAUDE.md" \) -print
For each .mdc file, write down its frontmatter: alwaysApply, globs and description. That metadata decides where the rule should go in the next step. The docs list precedence as Team Rules, then Project Rules, then User Rules, so note any conflicts you spot while reading.
Step 2: Understand Why Your .mdc Rules Need a Second Home
This is the part that catches teams out. The editor-side rules page says project rules “must use the .mdc extension” and that a plain .md file in .cursor/rules “is ignored by the rules system.” So in the desktop app, .mdc is still the format.
The terminal tool works the other way round. Grok Build’s project rules page for the terminal UI (updated 23 November 2026) says it reads AGENTS.md, AGENT.md, CLAUDE.md and CLAUDE.local.md in each directory, plus every .md file in .grok/rules/. It also reads plain .md files directly inside .cursor/rules/, but it “does not load .mdc files at all”, and frontmatter such as globs or alwaysApply is stripped rather than applied.
Put simply: a rule that only exists as an .mdc file works in the editor and is invisible to the terminal agent. A plain .md in .cursor/rules works in the terminal and is ignored by the editor. AGENTS.md is the file both sides agree on. The Grok Build editor docs state that it “supports AGENTS.md in the project root and subdirectories.”
Step 3: Decide Where Each Rule Should Go
Now sort your inventory. Use the frontmatter you noted in Step 1 and this mapping, which follows the rule behaviour described in the Grok Build docs:
| Current rule | Move it to | Why |
|---|---|---|
| alwaysApply: true | Root AGENTS.md | Loaded by both editor and terminal |
| globs only (file-scoped) | Keep as .mdc, or nested AGENTS.md in that folder | Folder-level AGENTS.md scopes to its subtree in both tools |
| description only (“Apply Intelligently”) | A skill (Step 6) | Skills load on demand when relevant |
| Manual (@-mention only) | Keep as .mdc or turn into a skill | Rarely needed every session |
| User Rules | Leave in settings, or move team-wide ones into AGENTS.md | Settings are personal; AGENTS.md is shared |
A useful test for every line: would a new engineer need this on day one, in every part of the repo? If yes, it belongs in the root AGENTS.md. If it only applies to the frontend folder, it belongs closer to that code. Cursor rules to AGENTS.md is rarely a one-to-one copy, so expect to merge and delete as you go.
Step 4: Write the Root AGENTS.md File
This is the core of how to write AGENTS.md well. According to the AGENTS.md project site, it is “a simple, open format for guiding coding agents”, which the site describes as “a README for agents”. It is plain Markdown with no required fields. Create it at the repository root.
The site recommends sections for the project overview, build and test commands, code style, testing instructions and security considerations. A practical starting template:
# AGENTS.md
## Project overview
Next.js 15 web app with a FastAPI backend in /api.
## Setup and commands
- Install: pnpm install
- Dev server: pnpm dev
- Tests: pnpm test (must pass before any commit)
- Lint: pnpm lint --fix
## Code style
- TypeScript strict mode. No `any`.
- Use named exports. One component per file.
## Testing
- Add or update tests for every changed function.
## Security
- Never commit .env files or secrets.
- Do not add new dependencies without asking.
Replace every line with your real stack and commands. Agents follow concrete instructions far better than vague ones, and the terminal docs say “short, specific instructions are followed more reliably than long ones.” Paste in the bodies of your alwaysApply rules here, rewriting them as plain bullet points.
Step 5: Add Nested AGENTS.md Files for Subprojects
Monorepos and multi-service repos need scoped instructions. The AGENTS.md site says “the closest AGENTS.md to the edited file wins; explicit user chat prompts override everything.” Grok Build’s terminal docs say “a nested AGENTS.md scopes to its subtree”, and the editor docs say nested files combine with their parents, with more specific instructions taking precedence.
So if your old .mdc rules used globs like apps/web/** or services/billing/**, create an AGENTS.md inside each of those folders instead:
apps/web/AGENTS.md # React conventions, Storybook commands
services/billing/AGENTS.md # Money handling rules, test fixtures
Keep each nested file focused on what is different about that folder. Do not repeat the root file, since the agent already has it. For rules that target file types spread across the repo (for example, every *.test.ts file), a nested AGENTS.md will not fit. Keep those as .mdc rules with globs for the editor, and add a one-line summary to the root AGENTS.md so the terminal agent still sees the gist.
Keep things lean. The editor docs advise keeping rules under 500 lines, and while the terminal loads files “in full, with no size cap”, long files dilute what matters.
Step 6: Convert Description-Based Rules Into Skills
Rules that used only a description (“use this when writing database migrations”) were always meant to load on demand. Grok Build now has a better home for those: skills. According to the skills documentation, each skill is a folder with a SKILL.md file whose frontmatter requires a name and a description.
You do not have to convert them by hand. The docs list a built-in /migrate-to-skills command that converts “Apply Intelligently” rules and slash commands into skills. Rules with alwaysApply: true or specific globs are not migrated, which is why Steps 4 and 5 come first.
Pay attention to where skills are saved. The docs list project skills in .agents/skills/ and .cursor/skills/, and user skills in ~/.agents/skills/ and ~/.cursor/skills/, and they note that ~/.agents/skills/ “is the only directory both surfaces read” at the user level. If your team uses both the editor and the terminal, prefer the .agents locations so the same skills show up everywhere.
Step 7: Check MCP Servers and Other Config
Rules rarely travel alone. If your agent relies on MCP servers for databases, ticketing or docs, confirm they still load. Grok Build’s MCP documentation (updated 28 November 2026) says the editor uses .cursor/mcp.json in the project and ~/.cursor/mcp.json globally. The terminal tool uses an [mcp_servers] section in config.toml (or grok mcp add) and also reads .cursor/mcp.json for compatibility.
Two practical checks. First, keep secrets out of the committed mcp.json and use the documented ${env:NAME} interpolation instead. Second, if you use hosted cloud agents, the docs say they do not read ~/.cursor/mcp.json, so set those servers up separately.
Also note what the docs say about imports: “Rules aren’t imported on their own.” Rules arrive through the repo, through settings, or through plugins, so the files you commit in this guide are what your teammates will get.
Step 8: Test in Both Surfaces, Then Commit
Do not assume it works. Open a fresh session in the editor and in the terminal tool, and ask the agent the same questions in both:
- “What command runs the tests in this repo?” It should answer from AGENTS.md.
- Open a file inside a nested folder and ask about that folder’s conventions. It should cite the nested file.
- Ask it to perform a task covered by one of your new skills, and check that the skill is picked up.
- Ask it to add a dependency, and confirm it respects your security section.
If the terminal agent ignores something the editor follows, that rule is probably still trapped in an .mdc file. Move the essential part into AGENTS.md. Once both pass, commit AGENTS.md, nested files, skills and any updated .mdc rules in one pull request, and delete rules you merged away. Ask teammates to remove duplicates from their personal User Rules so instructions do not conflict.
Checklist: How to Write AGENTS.md and Migrate Rules at a Glance
- List every Project, User and Team Rule plus any existing AGENTS.md.
- Remember: the editor reads .mdc, the terminal ignores .mdc, both read AGENTS.md.
- Map alwaysApply rules to AGENTS.md, glob rules to nested files or .mdc, description rules to skills.
- Write a short root AGENTS.md with overview, commands, style, testing and security.
- Add nested AGENTS.md files for folders with their own conventions.
- Run /migrate-to-skills and store shared skills under .agents/skills.
- Confirm MCP servers load from .cursor/mcp.json or config.toml.
- Test the same prompts in the editor and the terminal, then commit.
Common Mistakes to Avoid
Renaming .mdc files to .md. It feels like a quick fix for the terminal, but the editor docs say plain .md files in .cursor/rules are ignored by its rules system. You fix one surface and break the other.
Dumping every rule into one giant AGENTS.md. Long files bury the important lines. Keep the root file to what every session needs and push the rest into nested files and skills.
Relying on frontmatter in the terminal. The terminal docs say frontmatter like globs and alwaysApply is stripped, not applied. Scoping in the terminal comes from where the file sits, not from metadata.
Forgetting User Rules. They are not stored as files, so a teammate’s personal rule may be doing work nobody else knows about. Move anything team-wide into AGENTS.md.
Committing secrets in mcp.json. Use environment variable interpolation, not hard-coded tokens.
Frequently Asked Questions
Can Cursor read AGENTS.md?
Yes. The AGENTS.md site lists Cursor among supporting tools, and Grok Build’s editor docs (Cursor’s new name) say it supports AGENTS.md in the project root and subdirectories. The Grok Build terminal tool reads AGENTS.md too, which makes it the most portable place for shared instructions across both surfaces.
Can AGENTS.md be nested?
Yes. You can place AGENTS.md files in subfolders. The AGENTS.md site says the closest file to the edited file wins, and Grok Build’s docs say a nested file scopes to its subtree, with more specific instructions taking precedence over the parent. Use nesting for monorepo packages or services with their own conventions.
How long can AGENTS.md be?
There is no hard limit in the format. Grok Build’s terminal loads rule files in full with no size cap, but its editor docs advise keeping rules under 500 lines, and the terminal docs note that short, specific instructions are followed more reliably. Aim for a root file a new teammate could read in a few minutes.
Is AGENTS.md the same as CLAUDE.md?
No, they are different file names, but they serve a similar purpose. Grok Build’s terminal tool reads both AGENTS.md and CLAUDE.md in each directory. AGENTS.md is the open, tool-neutral format listed by many vendors, so it is the safer default if your team uses more than one coding agent.
What is the AGENTS.md file used for?
It gives coding agents the context a human contributor would get from onboarding: what the project is, how to build and test it, code style, and security rules. The AGENTS.md site calls it “a README for agents”. It is plain Markdown, so you can write it in any editor.
Key Takeaways
- Two surfaces, two behaviours: The Grok Build editor needs .mdc project rules, while the terminal tool ignores .mdc entirely.
- AGENTS.md is common ground: Both read it, at the root and in subfolders.
- Sort, do not copy: Always-on rules go to AGENTS.md, scoped rules to nested files, on-demand rules to skills.
- Use the built-in tools: /migrate-to-skills handles description-based rules for you.
- Test before 7 December: Run the same prompts in both surfaces and commit once they match.
Need Expert Help?
If this feels like a lot to manage alone, TecniForge can handle the heavy lifting. Our team specializes in custom software development and AI integration. If your team runs several repositories and coding agents, we can help you set up a consistent AGENTS.md, skills and MCP setup that works across tools. Get in touch with our experts.
Also read: Grok Build Replaces Cursor: What Developers Must Check Before Dec 7, our earlier coverage on why this matters today. For a broader look at keeping AI-built code portable, see our guide on how to export vibe code.
Your move: open your biggest repo today, run the find command from Step 1, and see how many of your rules the terminal agent cannot see. That number will tell you how urgent this is.
Sources
- Grok Build Docs: Rules (25 November 2026)
- Grok Build Docs: Project rules (Terminal UI) (23 November 2026)
- Grok Build Docs: Skills (23 November 2026)
- Grok Build Docs: MCP (28 November 2026)
- AGENTS.md: A simple, open format for guiding coding agents (accessed 1 December 2026)
- Engadget: Cursor has been officially Grok-ified (30 November 2026)
Discover more from TecniForge
Subscribe to get the latest posts sent to your email.