Do agents.md files help coding agents?

5 hours ago (twitter.com)

https://xcancel.com/rasbt/status/2063649136323252397

https://arxiv.org/abs/2602.11988

Yes. In my case (and I guess everyones usecase is subjective) my system prompt states to read the AGENT.md file when possible.

On a new project I usually set up the context of the model (language to use, reason of the product/prototype, etc.) and then I tell the LLM to write a AGENT.md, STATE.md and ROADMAP.md. I don't tell the LLM what's in there because the model has it's own directive and flavor what should be in these files. The models already know the purpose of these files by themself! On a new session, I let the agent read the markdown files in order to continue with the work. Before a session ends, I let the LLM update the markdown files. Maybe one word of caution: don't switch models - it's like putting another person on a working station and ask them to continue the work of others.

Easy setup, really good outcome!

yes, they do. I think people overindex on this paper, I remember when it came out we had a lot of discussion in my company about it. But its clear to see they do at least change the agent's behavior, and things like telling it "always use xyz version of java, use gradle to build the project, use this command to run the tests" are really important instead of letting it fumble about trying to find the right thing every time you ask it anything

I think the problem some people fall into, and especially LLM authored ones (which is where they see the documents not helping here) is instead describing the code, or the structure of the code. Which I don't think helps much - the agent can already see you have 4 modules called a b c and d, and can read the readmes inside of them just fine if it has questions.

One more marginal thing I find helpful but im less sure has positive impact is describing the right terminology for the agent so it can be smarter at communicating with the developer. Things like different names for the product, products it interfaces with, resource names in infra, terms from the customer and product team. I don't think it helps the agent code (much) but it does help communication if it knows what we mean when we speak (and naming things is, as we know, one of the hard problems in CS)

Overall, most of my agents.md now are a list of useful bash commands for working and testing with the project & tests. (heres how to spin up docker services, heres how to update the libraries, heres how to run a command against the local db, heres how to insert a document to be run etc)

and then at the end a terminology blob, which I find myself referencing too.

  • Yeah. It's very easy to give a definitive "yes", if you've ever worked with coding agents in any capacity. I use them in much the same way as you, there are a bunch of things that would be nice for the agent to know, specifically for me, the project, or how I would like it to run as an example: git or coding review loops ( i use roborev ). Asking the agent to do these things every time, is very time consuming.

    • Maybe read the paper... It says that the only thing that are helpful is indeed what you describe here: basic commands and context about running / working on the project, rather than information about the business or technological aspects of the project itself.

Agents.md is just a prompt pre-pend. This is like asking "do prompts help coding agents".

  • But that is an open question. For example some smaller, local-friendly LLMs (Gemma, Qwen) clearly do better without a long system prompt. Faster ad just no worse at code. Both seem eminently capable of writing high quality, eloquent code without being specifically prompted to, both need little instruction on tool calling. The consensus is leading us towards very long system prompts, agent files, stuffing with skills, when it might be cargo-culting (again).

    A culture of really long preambles certainly benefits cloud AI companies though!

[dupe] https://news.ycombinator.com/item?id=47034087

Paper was discussed here 4 months ago, and the linked tweet on this post doesn't add any insights and completely misses the huge caveats that come with the found result: the main benefits of using AGENTS.md files are inherently opposed to the characteristics of _median_ "public github project that has an AGENTS.md file".

  • Yeah it was a good discussion. I'm definitely on the side of "a well written agents.md is very good for the agent". The file should not be static. The agents.md from a year ago is not the right agents.md for today. Many of them are overly long, overly instructive, and include a lot of unccessary code bits.

    I think it's useful for people using agent harness to regularly evaluate your skills, agent rules, and memory implementation to ensure there's no conflict across them all. Also, best to rely as little as possible on the agent to write its own agents.md.

    It can be be tedious, but that's why agentic coding can still be considered a "skill".

    • > "a well written agents.md is very good for the agent"

      while even a mildly bad agents.md can be _very_ bad for the agent. they rot very quickly which is why human curation is essential.

      same with memory - a lot of the self-learning tools that are becoming popular now degrade agents over time - which is why you end up being able to run an eval with no context and it performs better

      > but that's why agentic coding can still be considered a "skill".

      yes - far too many cases of throwing a kitchen sink of prompts, skills, tools etc. thinking the llm will sort it out. you need to constantly prune, eval, tweak, observe, update etc. in a loop

The tweet misses the conclusion from the paper that handcrafted AGENTS.md might help. To me its no surprise that 100% vibed AGENTS.md are unproductive. Not reviewing your design docs is probably even worse than not reviewing your code? I've seen some AI-generated agents.md which were just plain wrong. No surprise agents perform worse after reading those.

I use AGENTS.md to make sure my agents loop effectively (tests, quality, etc). Not to describe the code / architecture.

  • > To me its no surprise that 100% vibed AGENTS.md are unproductive.

    To me it is! I thought if an AGENTS.md is researched with much effort once, next time reading the brief conclusion would save on effort and time and cost. Would have seemed logical to me. Like a glossary, looking up a manual, getting briefed before starting.

    But I accept the research findings, and I have even had bad experiences with an outdated AGENTS.md derailing the agent.

    So now I'm trying to keep to the basics, e.g. just a sentence or two saying "use bun instead of npm" only because I've had to manually prompt that too many times.

    It's remarkable how good agents are at exploring, and at treating relatively sparse code reads and get a good picture nevertheless.

  • Don't describe the code / architecture in AGENTS.md - BUT tell the agent where the documentation for both can be found for each module etc.

    This way it can refer to the docs only when relevant instead of dragging around the full knowledge of the front-end structure while it's working on the backend.

The amount of cargo-culting around AI tooling and practices is so weird to me.

Why not just try and see? The fast feedback loop allow testing all kind of weird theories in a matter of 30m-1h during normal working sessions, most results are obvious

  • >Why not just try and see?

    There is a difference between trying something and performing a test whose results are meant to be representative of most setups. A lot of people (in tech surprisingly) who see themselves as practitioners of applied science, apply flawed methodologies and try to generalise the results.

    Just because testing is fast, it does not mean that it is free or cheap. Plus time is money and verifying every LLM setup every koolaid dev is proclaiming on bluesky could easily be a full time job.

Not enough on its own you'd need artifacts to store contexts/TOC/lists

I think shorter the better.

also a strange finding from my own experiences: specific empirical formats seem to yield much better results. For example people often say "get this done to 100%" but I say "get this to 88.47%".

You putting “you’re an expert jerk off master” in agents.md is the same as shaman burning a bone to predict a future.

If adding something to the context doesn't help, it's only proves you're not adding the right stuff.

I'm adding pointers to specification documents, and it saves me from the /new dumb coding agent that sees your code base for the first time and knows nothing about architecture, concepts, code organisation, etc...

I'm using no cookie cutter directives though (except maybe "do not attempt to deploy, we're using CI CD to deploy" to avoid an automatic "wrangler deploy" to Cloudflare)

As the author notes in the end, it would be really interesting to do these again on more recent models. I wonder if the no context file being cheaper still stands. But then how much does the harness influence the results. It can be frustrating trying to gauge what’s influencing what and if something suddenly starts working against you.

Yes

  • The referenced paper says No.

    • The paper actually says: "We find that all context files consistently increase the number of steps required to complete tasks. LLM-generated context files have a marginal negative effect on task success rates, while developer-written ones provide a marginal performance gain."

      "Overall, our results suggest that context files have only marginal effect on agent behavior, and are likely only desirable when manually written."

    • You are absolutely right, thank you for pushing back. Upon further examination, I've confirmed that the referenced paper says no.

      /s

      1 reply →

From my tests agents.md does NOT work with copilot. I have a custom languge and copilot thinks its Rust.

  • This is relevant to my interests, did you maybe test which models handle custom languages best? It also seems like a good proxy for them being able to stick to important instructions and not being carried away with things that are lookalikes.