FEATURES / 12
Rules
What every agent in the project needs to know before it starts, written once and delivered in the file each CLI reads, with writes to CLAUDE.md allowed by you, project by project.
Updated for PrumoGrid 0.5.11
What it's for
A rule is guidance that applies to every task, such as "answer in Portuguese" or "do not change package.json without telling me". You write it once in Rules and roles…, choose who it applies to, and PrumoGrid delivers it in the file each CLI reads when it opens: CLAUDE.md for Claude Code, AGENTS.md for Codex and Gemini. Claude and Codex in the same project now get the same guidance, and you stop repeating it in every request.
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 ↗
When to use it and when not to
Use a rule for what repeats in every task of a project, or of all your projects: the language of the answer, files that are not to be touched without telling you, "every change in src comes with a test".
A rule is different from a task. "Fix the PRIMEIRA coupon" is a task: it goes in New stage. "Before changing a public interface, find who uses it and describe the impact" is a rule.
Rules are optional. With none, terminals, Flow and the end-of-turn notification work the same. If you already keep a hand-written CLAUDE.md, it is still read; PrumoGrid writes only in its own section of it.
Step by step
Create a rule for loja-api
- Select
loja-apiand open Tools → Rules and roles…. - The screen shows three groups of rules: For this project, For every project and By role or CLI type. Open For this project.
- Click + New rule.
- In The 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. The other options are Every project, Only whoever is in a role and, under Advanced, a single agent type.
- Read the delivery sentence, for example "On save, Claude Code receives the rule.", and click Save and deliver.
- Close the screen. In Flow, the counter shows Rules for this project · 1.
A rule can hold more than one instruction, like this one. The counter counts rules, not sentences.
See the rule reach the agent
- Click + New stage and ask
Which rules of this project should you follow? Answer in one line. - Click Create stage. On the project's first stage, Write guidance to CLAUDE.md? appears (see the section below).
- Click See what will be written, read the block and go back. Click Allow in this project.
- Claude Code opens and answers with both instructions. The question did not mention any: it read them from the file.
- In the
loja-apiPowerShell, rungit status --short. You see?? .terminal-grid/(where the rule lives) and?? CLAUDE.md(the file the agent reads).
What you see on screen
| On screen | What it means |
|---|---|
| applies to every agent in project loja-api | The scope of the rule. |
| the agent signals, no command | No one runs a command to check the rule; the agent follows it and reports. |
| in the repository / on this machine only | Where the rule lives: in the project, where it can be versioned, or in your profile. |
| Move to the repository / Bring to this machine | Changes where the rule lives. |
| AGENTS: what each one is reading | Each agent terminal, its file, and whether the rule has reached it, with rewrite. |
| Rules for this project · N | The counter in Flow. |
See what the agent reads shows the whole file, in the order the agent reads it, with the source of each section: your rules, what is written by the product, and what was hand-written (PrumoGrid does not touch it). Open this preview when the agent does something you did not expect. It only has content when an agent terminal is open in the project.
Where rules are stored
- Rules for this project, for a role or for a CLI type can live in the repository, in
<projeto>\.terminal-grid\regras.json. They show up ingit status, go into the commit and reach anyone who clones. PrumoGrid does not touch.gitignore: for the team to get them, commit.terminal-grid\regras.json. - Or they can stay on this machine only, in your profile. They do not show up in Git and do not reach anyone else.
- Rules for every project always stay in the local profile, because one repository does not speak for the others.
To take rules to another machine or send them to a colleague, use Export…, which writes a JSON file, and Import…, which reads that file. Imported rules come in as rules on this machine; moving them to the repository is a separate step. Review the content and the scope before importing.
Writing in projects
For the agent to follow the rules, PrumoGrid writes a marked block to the file the CLI reads in the project folder: CLAUDE.md for Claude Code, AGENTS.md for Codex. The block carries the goal, the stage and the role, the rules, the tg instructions and, if you check Also record the verification command in this file, the verification command. It sits between the markers tg:begin and tg:end. The rest of the file does not change; on the next write, only what is between the markers is replaced.
Because it is a file in your repository, PrumoGrid asks for permission the first time it needs to write in that folder: when you create the project's first stage or, if an agent is already open in the project, when you save and deliver the first rule.
- Write guidance to CLAUDE.md? (or to
AGENTS.md) appears, with the File, the Project and Applies to: future writes in this project. - See what will be written shows the block before you decide. Back returns to the question.
- Allow in this project writes now and on the next stages in this folder, without asking again.
- Never write in this project creates the stage without writing the file. The agent stops getting rules and verification through it, and the project card starts showing writing off, with the link How to turn back on.
The choice is per folder. To review it, open Tools → Project file writing…, which takes you to Advanced options, in the Writing in projects section. Each project appears with its state (writing allowed, writing off or asks on the first stage) and a button: Turn on for a folder that is off, Turn off for the others. Turning it back on makes PrumoGrid ask again on the next stage.
After the first allowed stage, the git diff of CLAUDE.md should change only between the markers. If you edit it by hand, write outside the block.
Tips
- Write short, concrete rules. The rule's counter shows how many characters the agent reads every time it opens.
- Agents that are already open only re-read the file when someone asks. Check Tell the already open agents through messaging when you save, or open the agent again.
- Role rules go under By role or CLI type: "cite file and line for each finding" for the reviewer, for example. See Roles.
- For a preference of yours in any folder, such as the language, use For every project.
Known limitations
- Writing a rule does not prove that the agent obeyed it. Read the answer, or use a verification when there is a command that catches the breakage.
- With writing off, the agent does not get the rules or the verification command through the file.
- A folder that only exists inside WSL does not get the rules from Windows.
- A CLI opened by hand without a type registered in Agent profiles… has no file to write to, and does not get the rule.
- Changing a rule does not change the instruction already delivered to a flow in progress; it applies to the next flows, or when you run a planned flow.