Skip to content

Rules

Rules are behavioral constraints — guardrails that apply regardless of persona.

Terminal window
cat no-delete.md | brainjar rule create no-delete
# or
brainjar rule create no-delete --file ./no-delete.md

create is an upsert — it stores whatever content you hand it (stdin, --content, or --file, in that precedence order). There is no scaffolded template; let your AI agent populate the file (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 checklist
Terminal window
brainjar rule add security # Add to the active state
brainjar rule remove security # Remove from the active state
brainjar rule delete security # Permanently delete the rule

rule add and rule remove write to the workspace state override. They do not take --project, and cd-ing into a repo does not change that — these CLI commands always target workspace state. Project-scoped rule overrides can only be set via the state_set MCP tool with a project field, typically from inside an agent session. See Configuration → State cascade.

Rules bundled with a persona activate automatically — you don’t need to add them manually.

Terminal window
brainjar rule list # See all rules with status
brainjar rule show security # View a rule's content
brainjar versions rule security # List version history
brainjar versions rule security 2 # Print version 2's content to stdout

There is no revert subcommand. To restore an old version, capture its content with brainjar versions rule security <n> and pipe it back into brainjar rule create security.

See full flag and subcommand details in the CLI reference for rule and versions.

When you see scope labels in status and rule list output:

LabelMeaning
(workspace)Set at workspace scope
(project)Overridden at project scope
(+project)Added by project override
(-project)Removed by project override