Enforcement Overview

Rulebound enforces rules at multiple points in your development workflow: during validation, on git commit, in CI/CD pipelines, and in real-time while editing. The enforcement mode controls how strictly violations are handled.

Enforcement Points

PointCommandWhen
Plan validationrulebound validateBefore implementation
Diff validationrulebound diffBefore commit
Pre-commit hookAuto (via rulebound hook)On git commit
CI/CD pipelinerulebound ciOn PR/push
Real-time watchrulebound watchOn file save
AST analysisrulebound check-codeOn demand

Enforcement Modes

Configure with rulebound enforce --mode <mode> or in .rulebound/config.json:

Advisory (default)

{ "enforcement": { "mode": "advisory" } }
  • Never blocks commits or CI
  • Reports all violations as warnings
  • Good for onboarding or evaluating rules

Moderate

{ "enforcement": { "mode": "moderate", "scoreThreshold": 70 } }
  • Blocks on MUST rule violations
  • Blocks when score drops below threshold
  • SHOULD violations are warnings only
  • Recommended for most teams

Strict

{ "enforcement": { "mode": "strict", "scoreThreshold": 80 } }
  • Blocks on any MUST or SHOULD violation
  • Blocks when score drops below threshold
  • For regulated environments or mature teams

Blocking Logic

ConditionAdvisoryModerateStrict
MUST violationNo blockBlocksBlocks
SHOULD violationNo blockNo blockBlocks
Score below thresholdNo blockBlocksBlocks
NOT_COVERED rulesNo blockNo blockNo block

Score Calculation

Validation score is a weighted average:

StatusWeight
PASS1.0
NOT_COVERED0.5
VIOLATED0.0

Score formula: (PASS + NOT_COVERED * 0.5) / total * 100

Default threshold: 70. Configurable with --threshold.

Auto-Promotion

When autoPromote is enabled (default) and your score reaches 90+, Rulebound suggests upgrading to the next enforcement level. This helps teams gradually increase strictness as their rule compliance improves.

Configuration

# View current enforcement config
rulebound enforce

# Set mode
rulebound enforce --mode moderate

# Set threshold
rulebound enforce --threshold 80

# Both at once
rulebound enforce --mode strict --threshold 85

Or edit .rulebound/config.json directly:

{
  "enforcement": {
    "mode": "moderate",
    "scoreThreshold": 70,
    "autoPromote": true
  }
}