Rules
A rule is a short instruction with a key, written in markdown: testing, commit-style, no-force-push. Rules are always injected in full (unlike memories, which are searched), merged by key so an agent never sees two conflicting versions of the same instruction.
Scopes
From broadest to most specific:
| Scope | Applies to | Who can write |
|---|---|---|
org | Everyone in the instance | Admins |
team | Members of one team | Members of that team |
repo | Everyone working in one repository | Any user (admins only, if the instance is set to that) |
user | You, everywhere (shown as "Everywhere" in the dashboard) | You |
user_repo | You, in one repository ("This repo") | You |
Repos are identified by their normalized git remote, so repo and user_repo rules match on every machine. In a directory with no git remote, repo scopes are skipped and the rest still apply. In personal mode (a single-user instance) only your own scopes are offered.
How rules merge
For each key:
- If an
orgrule with that key is locked, it wins. - Otherwise, if any
teamrules with that key are locked, those win. - Otherwise the most specific scope wins:
user_repooveruseroverrepooverteamoverorg.
If you are in several teams and they define the same key, all of those team rules are shown, each labelled with its team. The merged result records which broader scopes the winner overrode.
Personal overrides
Your user_repo:testing rule replaces the repo's testing rule for you only. Because personal rules live on the server, they follow you to every laptop, container and tool. Set one by telling an agent "from now on, always...", which should call set_rule, or in the dashboard.
Locking
Admins can lock a rule at org or team scope. Nobody below can override a locked key. Writing a key that a broader scope has locked is refused with an error, not silently ignored. Locked rules are labelled company policy when injected. A non-admin cannot lock anything.
What the agent sees
At the start of each Claude Code session the hook injects the merged rules under a short trust statement, each as a quoted block with its author, date and label:
company policy (locked, org)for locked org or team rulesyour rule (user_repo)for your personal rulesteam suggestion (repo)for unlocked rules others wrote
Quoting and escaped headings mean rule text cannot forge new instructions or headings. Codex and Cursor get the same text through carrybrain sync codex|cursor, and any MCP client through get_rules. The trust order is in the Introduction.
History and agent writes
Every change to a shared rule is recorded in the rule history and the audit log, with who changed it. Agents over MCP can only write user and user_repo rules unless an admin turns on agent shared writes in the dashboard settings; otherwise a set_rule for a shared scope is refused and the agent tells you to add it in the dashboard.
Limits
Keys are lowercase letters, digits and -, up to 64 characters, starting with a letter or digit. A rule's content is at most 8000 characters. Importing a long CLAUDE.md splits it into one rule per heading (see carrybrain import).