RECIPES / 05
A rule that applies to every agent
Write once that the loja-api agents answer in Portuguese and do not touch package.json without telling you, and check that Claude Code and Codex read the rule.
Updated for PrumoGrid 0.5.11
The scenario
You open different agents in loja-api and repeat the same guidance in every conversation: answer in Portuguese, do not change package.json without telling you. A project rule solves this. You write it once, and PrumoGrid delivers the text to every agent in the project through the file each CLI reads when it starts: CLAUDE.md for Claude Code, AGENTS.md for Codex.
Watch the video
Rules. A project rule written to CLAUDE.md, what the agent receives and proof that it follows the rule. Captions and transcript ↗
Step by step
Write the rule
- Select
loja-apiand open Tools → Rules and roles…. - Under For this project, click + New rule.
Type:
Always answer in Brazilian Portuguese. Do not change package.json without telling me first.- Check Applies to: every agent in project loja-api.
- Click Save and deliver. In Flow, the counter now shows Rules for this project · 1.
Allow writing in the project
The rule reaches the agent through a block PrumoGrid writes to the folder's CLAUDE.md or AGENTS.md. The first time it needs to write in that folder, it asks for permission: when you create the first stage or, if an agent is already open in the project, right when you save the rule. With no agent open, it goes like this:
- Click + New stage and type:
Which rules of this project should you follow? Answer in one line. - Click Create stage. Write guidance to CLAUDE.md? appears.
- Use See what will be written: it is a block between two markers, and the rest of the file stays as it is.
- Click Allow in this project. The permission applies to this folder, and PrumoGrid does not ask again.
- Claude Code answers by citing the two instructions, which it read from the file.
Check what the agent gets
- In Rules and roles…, open See what the agent reads. The preview shows everything the agent gets and where each section comes from. It only has content when an agent terminal is open in the project.
- In a PowerShell in
loja-api, rungit status --short:
?? .terminal-grid/
?? CLAUDE.mdThe rule is stored in the repository, in .terminal-grid\regras.json, and the screen marks it in the repository. If you commit these files, anyone who clones the project gets the same rule.
Choose the right scope
| Where to create it | Who gets it | Example |
|---|---|---|
| For this project | Every agent in this project | "Do not change package.json without telling me first." |
| For every project | Every agent in every project, on your computer only | "Explain the plan before changing more than three files." |
| By role or CLI type | Only whoever is in a role (reviewer, for example) or only one CLI type | "Cite file and line for each finding", for the reviewer |
A rule is what always applies. What is specific to a task ("fix the validation of the name field") goes in the stage instruction.
Tips
- Write short instructions that can be checked. "Answer in Portuguese" works better than "be clear".
- Prefer one rule with two related instructions over two nearly identical rules; the counter and the preview are easier to read.
- Before versioning, read the
git diffofCLAUDE.md: only what is between the markers changes on later writes. - To take rules to another computer without Git, use Export… and Import… in Rules and roles. Review the content before importing.
Limitations
- The agent reads the file when the conversation starts. A rule saved while the conversation is already open may need a new conversation to take effect.
- With Never write in this project, the agent stops getting the rules and the verification through the file. The card shows writing off and the link How to turn back on. See Rules.
- Rules guide; they do not guarantee. For what must always hold, such as the tests passing, use a verification.