Hacker News new | ask | show | jobs
by Schlagbohrer 4 days ago
Can anyone recommend a good AGENTS.md for use with local AI? I have mine but I keep needing to prune it and I never had a tested, open source template to start with so I don't know what I might be missing. Would love to see some tried and tested open source examples.
7 comments

If you are having a recurring issue with how you AI is developing the project, i.e. pittfalls, then you can put the right way to do it or a workaround in the AGENTS.md

This depends on both the AI model and the Project.

Other than that, most things should probably still go into documentation like README, CONTRIBUTING since a lot of process still generalizes to both humans and AI agents.

You can add a line in AGENTS that it should orient itself with those files before starting anything.

Stay on top of the "project memory" that your agent is building up. Literally prompt it to "dream about the project" so that it can prune stale entries itself and re-derive, re-summarize. I try to keep most project memory entries in traditional documentation, since it's also useful to humans. And putting it in the repo makes it useful across AI providers and accounts.

It's not well established to think about documentation this way. But documentation is instructions. Code is instructions. Code is commonly refactored and technical debt is regularly (hopefully!) reduced in a dedicated maintenance pass. Do the same for documentation.

And this is very unorthodox but: for my personal projects, I put the tickets as markdown in the repository now. They haev a fixed structure that begins with owner, status (approved, ai suggested, draft). I have tickets/todo and tickets/done. This way, tickets are not only version tracked, but also directly accessible to the agent without having to go through some API. As a bonus, it makes migrations to and from various forges very easy.

When you notice that a workflow generalizes across repositories or projects, you should move it out of AGENTS.md and into a SKILL.md

How do you manage the tickets? Are they just lists in .md files?

I have a workflow that creates a project folder, gives it a README.md, and git init's for everything. But the README.md also accumulates the TODO list which is where the tickets get put and it builds up a bit. I wonder if git has some esoteric way of doing this already that I could use...

> How do you manage the tickets? Are they just lists in .md files?

I used to do this. One folder per epic with numbered files describing the work, acceptance details ..etc.

Now I use Beads and it’s been a game changer.

I misspoke a bit.

What I do is: each user story is a markdown file.

From that, I generate tickets. Tickets are ephemeral and live only in the sprint branch. Once the branch is merged, the sprint folder and its tickets is deleted and only durable documentation survives. Tickets are mostly AI slop anyway, and are really just glorified instructions to the subagents that implement them, so why keep them. I didn't care to read them too much other than a quick LGTM glance, so I don't care to keep them around either. They have served their purpose. If I absolutely need them for posterity, they are in git history, since I don't squash sprint branches.

I find user stories (which I either author myself, or fully review and/or amend) much more valuable to keep around. They are a beacon to follow and contain some sort of vision of how things should be and how things should work on a higher level.

I find tickets too myopic. IME keeping too much of such low level planning context can really put an AI into a jail of its own accidental making.

I tried putting tickets as markdown in my personal repository, but I found I had to be very diligent about pruning them, because ai suggested "tickets" kept being read by other agents and it would bloat the way they would build other unrelated features.
Keep the project management out of the code.

If you don’t want to use an api, then centralize all your tickets in one repo, organized by project.

Start empty and only add stuff you find yourself repeating across sessions.

I think most people overdo it with the AGENTS.md files and skills - if you know that you always have a preference for style-x instead of style-y or always need to explain something specific about your project which for some reason isn't documented elsewhere (why isn't it in your readme or /docs?), then sure, add it there. But for many things you can prompt directly during the session instead of maintaining these md files.

The things in an "open source AGENTS.md template" may not apply to you at all and may end up making things worse. You need to tailor it to you. The global AGENTS.md has stuff for your personal workflow/machine/etc, and the project-specific AGENTS.md just has tweaks/instructions for that project. Use skills to avoid repeating instructions or overfilling context.
Very specific to your model and your project tbh. Everytime the model changes you need to run ablation studies to even know if what's in there still has value or should be removed.
What do you mean by ablation studies?
An ablation study is when you run an eval both with and without a component of the harness to see if it has any effect on eval performance or not. Otherwise... it's all vibes. Components of a harness are bets against the model since they arise from things the model itself can't do, so you add them in and keep adding them, and when a new model comes out actually unless you test it this way, you don't know whether the things you added in to help the previous model are good, bad or neutral under the new model.
Remove chunks & recode.
Wouldn't the best option here be to use the agent itself to generate it while the repo is still new and small?
Auditing a friends large vibed app recently, they had done exactly this. The file had turned into a many-thousand-line blob of text that was closer to just being a chat log, with random facts about the design process and excessively verbose descriptions of things that should have just been comment blocks in the code. Claude even printed an error when starting a new session, complaining about the size. So I would say definitely don't go hands-off...keep it tight, and have it contain only points that you've personally found should be there.
haha yes i find my agent often adding unnecessary stuff to the AGENTS.md and I have to tell it to "take that out, it's just a one-time thing"
That assumes the agent knows what to put in it to affect the agents own behaviour in a positive way that aligns with the users intent.
I took my initial janky `AGENTS.md`, asked it to begin authoring an `AGENTS.rfc` (expanded prose with justifications, etc which I then reviewed and rewrote in my own voice with justifications and rationales) and then condense it back down to an `AGENTS.md`.

    0.  Introduction (AGENTS.rfc)

    This file is designed for the humans working on the project, in
    collaboration with an AI agent.  Regularly ask the AI agent to
    summarize this file to your typical `AGENTS.md`, but collaborate
    with the agent and work to modify `AGENTS.rfc` when composing
    new rules or guidance.

    It is written in an RFC-style format (but slightly modernized)
    which should trigger the right type of tone and processing for
    both humans and agents.
...and here's some "answerless prompts" which you can use your big human brain to imagine the AI responses: "review agents.rfc and explain some of the benefits of it compared to only having agents.md"; "calculate prompt and context impact estimation between the RFC and the raw *.md"

Basically, the `*.rfc` has the justifications + rationales: AGENTS.md says don't mock in-repo code. The RFC explains that mocks reimplement behavior, so when real code changes, the test stays green against the stale mock — "worse than no test, because it creates false confidence."

...however the `AGENTS.md` just has the directive(s) "Don't mock in-repo code, ask before mocking, only mock external boundaries, ..."

So on every context turn the agent is getting an abbreviated (low-token) mandate "don't mock by default", but if it starts going off track I say: "Penance! Read AGENTS.rfc, contrast against your proposed code, go fix it, and then propose updates to AGENTS.rfc and AGENTS.md so you don't do it again..."

The rules decay without the "why", and maintaining the "why" gives better guidance. Good rules can take up "too much context" (especially earlier, before 1M context windows...) and most of the time our busy-bee coding assistants don't really need the rationales (unless you're collaborating to update or understand the rules that caused the incident).

Claude recommends having the rationale in the AGENTS.md as well.
In my case it's ~3-4x token burn (6kb vs 24kb) which I can _conditionally_ invoke . Maybe with huge context windows and token caching it's all "fine" nowadays, but if you think about it as an employee handbook and then the safety posters on the wall like "don't stick your fingers in the machines (b/c they'll get chopped off); always wear your PPE (or you'll get injured); ...", you can definitely tune/tone-down ("pre-compile") what gets sent to the LLM but still re-vivify the complete rationale if needed.

Again... this was really effective ~6-9 months ago, but the pace, capacity, and capabilities are increasing so quickly this is probable just another "bitter lesson" moment.

Its literally just a prompt of text.