Configuration
Rulebound is configured through .rulebound/config.json in your project root. This file is created by rulebound init and controls rule loading, context matching, inheritance, and enforcement.
Config File
{
"project": {
"name": "auth-service",
"stack": ["java", "spring-boot"],
"scope": ["backend"],
"team": "backend"
},
"extends": [
"../shared-rules/.rulebound/rules",
"@company/rules"
],
"rulesDir": ".rulebound/rules",
"enforcement": {
"mode": "moderate",
"scoreThreshold": 70,
"autoPromote": true
}
}
Project Section
The project block describes your project for context-aware rule matching:
| Field | Type | Description |
|---|---|---|
name | string | Project identifier |
stack | string[] | Tech stack tags (e.g., ["typescript", "react", "postgresql"]) |
scope | string[] | Project scope (e.g., ["frontend", "dashboard"]) |
team | string | Team name for team-specific rule filtering |
When you run validate, diff, or ci, Rulebound uses these fields to select which rules apply. Rules with matching stack, scope, or team metadata score higher and are prioritized.
Stack Auto-Detection
If stack is not set, Rulebound can detect your stack from project files:
| File | Detected Stack |
|---|---|
package.json | typescript, javascript |
pom.xml, build.gradle | java, spring-boot |
go.mod | go |
Cargo.toml | rust |
requirements.txt, pyproject.toml | python |
Dockerfile | docker |
Extends (Inheritance)
The extends array lets you inherit rules from other sources. Local rules override inherited rules with the same ID.
{
"extends": [
"../shared-rules/.rulebound/rules",
"@company/rules"
]
}
Rulebound resolves extends paths in this order:
- Relative paths -- Resolved from the project root
- Package paths -- Looked up in
node_modules/<package>/rulesornode_modules/<package>/.rulebound/rules
See Rule Inheritance for more detail.
Enforcement Section
Controls how strictly Rulebound enforces rules:
{
"enforcement": {
"mode": "moderate",
"scoreThreshold": 70,
"autoPromote": true
}
}
| Field | Default | Description |
|---|---|---|
mode | "advisory" | advisory (never blocks), moderate (blocks MUST violations + low score), strict (blocks any violation) |
scoreThreshold | 70 | Minimum score (0-100) to pass in moderate/strict mode |
autoPromote | true | Suggest promoting enforcement level when score reaches 90+ |
You can also set enforcement from the CLI:
rulebound enforce --mode strict --threshold 80
See Enforcement Modes for details.
Rules Directory
By default, rules live in .rulebound/rules/. Override with:
{
"rulesDir": "custom/rules/path"
}
Rulebound also checks these fallback locations:
.rulebound/rules/rules/examples/rules/