Rules
Rules are behavioral constraints — guardrails that apply regardless of persona.
Creating a rule
Section titled “Creating a rule”brainjar rules create no-delete --description "Never delete files without asking"This creates a rule on the server with a template — a title, your description, and a Constraints section with bullet points to fill in. Let your AI agent populate it (see Authoring with AI).
Here’s what a filled-in rule looks like:
# No Delete
## Constraints- Never delete files without explicit user confirmation- Before removing any file, list what will be deleted and why- If multiple files are affected, present them as a checklistActivating rules
Section titled “Activating rules”brainjar rules add security # Workspace scope (or project if auto-detected)brainjar rules add no-delete --project # Explicitly force project scopebrainjar rules drop security # Deactivatebrainjar rules delete security # Permanently deleteProject scope is auto-detected when your working directory contains a .brainjar/ directory.
Rules bundled with a persona activate automatically — you don’t need to add them manually.
Managing rules
Section titled “Managing rules”brainjar rules list # See all rules with statusbrainjar rules show security # View a rule's contentbrainjar rules history security # List version historybrainjar rules show security --rev 2 # View a previous versionbrainjar rules revert security --to 2 # Restore a previous versionScope annotations
Section titled “Scope annotations”When you see scope labels in status and rules list output:
| Label | Meaning |
|---|---|
(workspace) | Set at workspace scope on the server |
(project) | Overridden at project scope |
(+project) | Added by project override |
(-project) | Removed by project override |
(env) | Overridden by BRAINJAR_* env var |
(+env) | Added by env var |
(-env) | Removed by env var |