Making AI Coding Assistants Obey: A Practical Guide to agents.md Rule Files

Put a lean agents.md in your repo root so AI coding assistants stop guessing.
The article explains that the root cause of AI coding assistants producing code that violates project conventions is the lack of an explicit rule file, leaving the model to guess. The fix is to create agents.md in the repository root, which Codex, Cursor, and Copilot can all read. Content focuses on three things: tech stack, build and test commands, and repeatedly emphasized rules. When using Claude Code, add a one-line import in its default claude.md to reuse agents.md, keeping a single source of truth. Commit the file so the team and AI agents share the same conventions, and keep it under 200 lines for conciseness.
Why AI Coding Assistants Keep "Guessing"
The most frustrating part of using AI to write code usually isn't that it can't produce anything—it's that what it produces doesn't fit your project's conventions: wrong tech stack, mixed-up build commands, or the same rule repeated ten times that it still can't remember. According to observations from a YouTube creator in a short video, the root cause is simple: you haven't given the AI an explicit rule file, so it has no choice but to "guess."
The fix isn't complicated: put an agents.md in your repository root and write down the project's basic information and rules. Codex, Cursor, and Copilot can all read this file—essentially handing every AI assistant the same "employee handbook."

What to Put in agents.md
This file doesn't need to be a long document—just cover three categories of content:
1. Tech stack
Clearly tell the assistant what language, framework, and version constraints the project uses. This keeps it from introducing incompatible dependencies or outdated patterns on its own initiative.
2. Build and test commands
This is the part most easily overlooked and most frequently corrected. Spell out commands like npm run build, pytest, or make test so the assistant has something reliable to work from when generating scripts or verifying changes—instead of making up a new set every time.
3. Rules you keep repeating
Code style, directory conventions, prohibited APIs, commit message formats—any rule you've stated more than once in conversation should be baked into the file.

Handling Claude Code Compatibility
One detail worth noting: if you also use Claude Code, it reads claude.md by default, not agents.md. According to the original video's author, the fix is simple—add a single import line to claude.md that pulls in agents.md. No need to maintain two duplicate copies.

The benefit of this approach is a single source of truth for your rules, with tool-specific differences handled by a thin layer of adaptation.
Claude Code is a command-line AI coding tool from Anthropic that reads claude.md in the project root to obtain project context and rules. These "memory files" are loaded into the model's system prompt at runtime, influencing its generation behavior. Different AI coding tools each have their own conventional filenames (Cursor, for example, also supports .cursorrules), but the underlying idea is the same: provide the model with persistent project-level instructions. The key to cross-tool collaboration is therefore to keep the rule file as a single source of truth, then adapt to each tool's filename differences through lightweight import or reference mechanisms—avoiding duplicated maintenance of the same conventions across multiple files that gradually drift out of sync.
Commit to the Repository and Make Rules a Team Asset
Don't forget to commit once you've written it. Once the file is in version control, every team member and every connected AI agent gets the same set of rules. New colleagues no longer need to be told verbally "this is how we write things in our project," and AI assistants won't drift in behavior just because they're on a different machine.

Keep It Lean: Under 200 Lines
One hard recommendation from the original author: keep the file under 200 lines. A rule file is not an encyclopedia—the longer it gets, the more likely the model is to overlook key parts, and the higher the maintenance cost. Write only the constraints that genuinely affect output quality, and let the code itself express edge-case details.
From a practical standpoint, this limit also pushes teams to regularly clean up outdated rules—after a tech stack upgrade, old conventions left in the file can actually mislead the assistant.
Models don't treat information in a prompt with equal weight: the longer the content, the more easily instructions buried late or scattered throughout get diluted, and key constraints may be ignored. This relates to how large language models handle context windows—everything within the window participates in computation, but attention resources are limited, and redundant information crowds out the weight that should be reserved for critical rules. In practice, rule files should follow a "high signal density" principle: keep only constraints that materially change generation results, use concise bullet points rather than long explanations, and regularly prune rules that are outdated or already expressed by the code itself. 200 lines is a rule-of-thumb upper bound for easy human review and model focus—not a hard technical limit.
Why It's Worth Starting Today
The configuration cost is minimal: create a file, write a few dozen lines, commit once. The payoff is ongoing—less repetitive communication, fewer reworks of AI-generated code, and automatic propagation of team conventions. If you use AI coding assistants every day but still haven't given them a rule file, this may be the highest-ROI adjustment you can make.
Related articles

Java4Shell Vulnerability Analysis: Has Java's Memory Safety Myth Been Shattered?
Computerphile breaks down the Java4Shell vulnerability: OpenJDK's native Base64 decoder mishandles AVX-512 mask calculation, causing out-of-bounds writes and RCE. Covers root cause, Base64 padding mechanics, AI-assisted discovery debate, and fixes.

Controversial US Surveillance Law Section 702 Nears Expiration: Congress Races to Renew
FISA Section 702 surveillance authority is nearing expiration. Congress is urgently pushing reauthorization, possibly attaching it to the NDAA. This article analyzes the controversies, legislative strategy, and future outlook.

iFood Manages 15,000 Repositories with Coding Agents: An Architectural Lesson at 4 Cents per Run
How iFood scaled coding agents to 15,000 repositories with its Remote Agents Platform: REST API-driven, GPT-5.6 Luna selection, structured output acceptance, $0.04 per run, security fixes doubled.