An agent without context is a contractor who has never seen the building. It will write correct-looking code that violates every convention you have.

The AGENTS.md pattern

Keep one markdown file at the repo root with:

  • What the project is — two sentences.
  • Commands — how to build, test, lint, run.
  • Conventions — naming, folder structure, error handling style.
  • Forbidden moves — the mistakes the agent keeps making.

Most modern coding agents read this file automatically. Where they don’t, paste it into the first message.

Rules that stick

Short, imperative lines beat long explanations. “Use named exports only” works; a paragraph about module philosophy doesn’t. If a rule needs more than one sentence, split it.

Keep it alive

When the agent breaks a convention, don’t just fix the output — add a line to the file. The context file is a cache of every correction you have ever made. After a month, the agent stops repeating your history.