| name | bit-rules |
| description | Manage enforced rules — list, add, toggle, test patterns. The onboarding skill for rule enforcement. |
| user-invocable | true |
| argument-hint | [list|add|toggle|test|remove] |
Manage .bit Rules
Manage @Rule entities in the project's .bit store. Parse the argument to determine which subcommand to run. If no argument is given, default to list.
list
Show all rules with their enforcement status, patterns, and actions.
bit query "@Rule"
Format each rule as:
ID: @Rule:abc123
text: "Always work on dev branch"
enforced: true
scope: global
pattern: git checkout|git switch
action: block
Group by enforcement status — show enforced rules first, then advisory rules.
add
Ask the user for:
- Rule text — what the rule says in plain language
- Pattern — regex that would match violations (can be empty)
- Action — block, warn, or log
- Scope — global, directory, or file (default: global)
- Enforced — true or false (default: true)
Then write the entity to a .bit file and collapse:
mutate:@Rule
text: "<user's rule text>"!
enforced: <true/false>?
scope: :<scope>!
pattern: "<regex>"
action: :<action>!
Append the entity to CLAUDE.bit (or rules.bit if CLAUDE.bit does not exist). Then collapse:
bit collapse . --output project.bitstore
Verify with:
bit query "@Rule"
Confirm the new rule appears in the output.
toggle
Ask the user which rule to toggle (by ID or text match). Then update the enforced field:
bit update @Rule:<id> enforced=true
or
bit update @Rule:<id> enforced=false
If bit update is not available, read the .bit file containing the rule, flip the enforced value manually, and re-collapse.
After toggling, confirm the new state:
bit query "@Rule"
test
Ask the user for:
- Pattern — the regex to test (can be from an existing rule or a new one)
- Sample — a command, file path, or string to test against
Run the regex match and report:
- Whether the sample matches the pattern
- What the match captures (if any)
Use a simple inline test — no external tools needed:
echo "<sample>" | grep -P "<pattern>" && echo "MATCH" || echo "NO MATCH"
This helps users validate their patterns before adding them as rules.
remove
Ask the user which rule to remove (by ID or text match).
bit delete @Rule:<id>
If bit delete is not available, read the .bit file containing the rule, remove the mutate:@Rule block, and re-collapse.
After removal, confirm:
bit query "@Rule"
Verify the rule no longer appears.