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:

FieldTypeDescription
namestringProject identifier
stackstring[]Tech stack tags (e.g., ["typescript", "react", "postgresql"])
scopestring[]Project scope (e.g., ["frontend", "dashboard"])
teamstringTeam 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:

FileDetected Stack
package.jsontypescript, javascript
pom.xml, build.gradlejava, spring-boot
go.modgo
Cargo.tomlrust
requirements.txt, pyproject.tomlpython
Dockerfiledocker

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:

  1. Relative paths -- Resolved from the project root
  2. Package paths -- Looked up in node_modules/<package>/rules or node_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
  }
}
FieldDefaultDescription
mode"advisory"advisory (never blocks), moderate (blocks MUST violations + low score), strict (blocks any violation)
scoreThreshold70Minimum score (0-100) to pass in moderate/strict mode
autoPromotetrueSuggest 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:

  1. .rulebound/rules/
  2. rules/
  3. examples/rules/