Decision record

ADR 002: Agent rules live in the repo, not in prompts

Project instructions, review rules and brief templates are versioned files next to the code they govern. Prompts point at them; they never restate them.

Context

Early on, our architectural constraints lived in four places: a wiki page, people’s heads, the prompt for the code reviewer, and whatever each engineer pasted into their agent session. They drifted. The reviewer enforced a rule the agents had never been told about, and agents followed a pattern the wiki had already retired.

Decision

The constraints are written once, in the repository, as Markdown:

  • A root instructions file for agents with the business context and the handful of non-negotiables every change must respect, written as concrete rules rather than values.
  • Scoped instruction files deeper in the tree (for example, the frontend app) that add rules for that area only.
  • A review rules file derived from the same constraints, rewritten so every rule is checkable from a diff and carries a severity.

The review pipeline fetches those files at run time. Brief templates link to them instead of restating them.

Consequences

  • Agents, the automated reviewer and new engineers read the same text. Disagreements surface as diffs to one file.
  • Rule changes get reviewed. Narrowing the access-policy rule to “the endpoint, not the helpers it calls” was a two-line PR that removed a class of false positives everywhere at once.
  • The cost is discipline: when someone corrects an agent in a session, the correction has to land in the file, or it will be made again tomorrow.

All decisions