Your agent starts every session fresh, so it repeats the same mistakes: wrong folder, wrong style, a tool you already rejected. Correcting it each time is exhausting and it never sticks. This chapter gives you the fix, a rules file the agent reads automatically, every single time.
1.4.1A rules file is your standing instructions
A rules file is a plain text file of standing instructions your agent reads at the start of every session, without being asked. It is how you beat the memory problem from the last chapter: the things that matter are in front of the agent every time, so you never re-type them.
Think of it as onboarding a new hire who arrives with amnesia each morning. The rules file is the one-page brief that makes them productive again in seconds.
1.4.2Put the non-negotiables in writing
Fill it with the decisions you never want to explain twice: the tools you build with, and where new code goes. Add your naming style, which ready-made pieces to prefer or avoid, how to save your work, and "always run the app before telling me it works."
Write them concrete, the way you would tell a person, not as vague vibes.
| Vague | Concrete rule |
|---|---|
| "write clean code" | "keep files under 300 lines, one feature per folder" |
| "be careful with passwords and keys" | "never hardcode keys, keep them out of the code" |
| "test your work" | "run the app and confirm it works before saying done" |
1.4.3Keep it short and living
A giant rules file gets skimmed and ignored, by the agent and by you. Keep it tight, only the rules that actually matter.
And keep it living. Every time you catch yourself correcting the agent on something it should have known, add that as one line. Over a few weeks the file quietly becomes the exact brief your project needs.
1.4.4Where the file lives
The rules file lives inside your project folder, next to your code. It travels with the project, so every agent that opens it reads the same rules. Each tool looks for the file under its own name and place. The simplest move is to let your agent create the right one for the tool you chose.
This prompt has your agent create its own rules file:
Do this now: paste the prompt so your agent creates the rules file, then read it and add one rule you already know you care about. Add to it every time you correct the same thing twice.