Open Devin
Lesson 2 · Reading · 2 min

Rules: what's always true here

Start with the simplest piece of context: a rule. A rule is a constraint Devin should follow in every session, no matter the task. "Use pnpm, not npm." "Never edit files under generated/." "All API handlers return typed errors." If breaking it would get a PR sent back, it's a rule.

The most common home for rules is an AGENTS.md file in your repository. Put one at the root (or in any folder it applies to), and Devin reads it before it starts coding. Because it's a file in the repo, it branches, gets reviewed, and merges like code, and it's an open standard that other AI coding tools read too.

The AGENTS.md diff from a pull request: one added line, never use inline styles, style components through their SCSS module

Rules that aren't tied to one repository, like a team-wide commit convention, can live on the Rules tab of the Customize page instead, at the personal, organization, or enterprise level. You'll see how those levels work in the Plugins lesson.

Two habits keep rules useful:

  1. Write a rule when Devin gets something wrong. A correction you've had to make once is a correction every future session will need. Capture it as a rule and stop making it.
  2. Keep rules short. Rules load into every session, so every line costs context whether it's relevant or not. Devin automatically includes only the first 16 KiB of each AGENTS.md file. Keep the must-follow constraints near the top, and move anything that only matters sometimes into a skill, which is the next lesson.
Back to course← Previous lesson
© 2026 Cognition AI, Inc.Made with ♥ by the Cognition team