TL;DR — A good AGENTS.md isn't written, it's maintained — and the maintenance is where every one dies. Here's the exact discipline that keeps yours true: tie every line to a fact in the repo, verify it runs, and make it change in the same PR as the code. Six steps, one worked example, and an agent that stops guessing.

You've got an AGENTS.md — maybe you built one step by step. The problem now isn't writing it. It's that, as we covered, it goes stale the day you write it — it starts lying the moment your code moves, and your agent believes it anyway. So let's harden it. Open a repo and follow along.

Step 1 — Start from the truth, not a template

Before you write a line, list what's actually real:

cat package.json | jq .scripts # your real commands