Rules
A rule is a sentence you want the agent to obey. bee stores it, and the hooks deliver it — at session start, on every prompt, or on the file it is about.
bee hook rule add "never call GetCollection directly — use a DataSource"bee hook rule listbee hook rule rm <id>Scope — when the rule is delivered
Section titled “Scope — when the rule is delivered”bee hook rule add "<text>" --scope always|session|prompt|file| scope | delivered |
|---|---|
always (default) |
at session start and on every prompt |
session |
once, at session start |
prompt |
on every prompt |
file |
only when a matching file is written — see below |
Path rules — the ones that save tokens
Section titled “Path rules — the ones that save tokens”A rule can name the files it is about:
bee hook rule add "a DataSource never calls GetCollection" --path '*DataSource.cs'bee hook rule add "every component has a Vitest spec" --path 'src/**/*.vue'--path implies file delivery. And this is the point: a rule that names files is
excluded from the per-turn block entirely. The fifty turns that touch nothing
relevant stop paying for it, and the one that does gets it unburied among rules
that do not apply.
Glob syntax
Section titled “Glob syntax”Deliberately gitignore-shaped, because that is the notation people already know:
| pattern | matches |
|---|---|
*DataSource.cs |
that file name anywhere in the tree |
src/**/*.vue |
any .vue under src/, at any depth |
deploy/** |
everything under a directory |
src/*.cs |
only directly inside src/ — * stops at a / |
Matching is case-insensitive: a rule author is describing a convention, not addressing an inode.
Project scope
Section titled “Project scope”By default a rule steers this project only — resolved from the git remote, so the same checkout on another machine is the same project. To steer everything:
bee hook rule add "commit messages are English" --globalAttribution
Section titled “Attribution”Every rule records who wrote it, read from git’s own config (repository-local
identity wins over global). On a team store, bee hook rule list tells you whose
convention you are following.
Seeing what it costs
Section titled “Seeing what it costs”bee budgetBreaks the injected context down by component, for session start and for a sample prompt. If a rule set has grown expensive, this is where it shows.