PrumoGrid

HomeLearnRecipesA rule that applies to every agent

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

VIDEO 08 · 1:26

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

  1. Select loja-api and open Tools → Rules and roles….
  2. Under For this project, click + New rule.
  3. Type:

    Always answer in Brazilian Portuguese. Do not change package.json without telling me first.

  4. Check Applies to: every agent in project loja-api.
  5. Click Save and deliver. In Flow, the counter now shows Rules for this project · 1.
For this project, For every project and By role or CLI type: the scope decides who gets the rule.

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:

  1. Click + New stage and type: Which rules of this project should you follow? Answer in one line.
  2. Click Create stage. Write guidance to CLAUDE.md? appears.
  3. Use See what will be written: it is a block between two markers, and the rest of the file stays as it is.
  4. Click Allow in this project. The permission applies to this folder, and PrumoGrid does not ask again.
  5. Claude Code answers by citing the two instructions, which it read from the file.
The permission is per folder. Never write in this project creates the stage without touching the file.

Check what the agent gets

  1. 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.
  2. In a PowerShell in loja-api, run git status --short:
text
?? .terminal-grid/
?? CLAUDE.md

The 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 itWho gets itExample
For this projectEvery agent in this project"Do not change package.json without telling me first."
For every projectEvery agent in every project, on your computer only"Explain the plan before changing more than three files."
By role or CLI typeOnly 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 diff of CLAUDE.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.