Vibgrate gives you two complementary ways to keep drift in check: baselines and budgets. They answer different questions, and using both gives you the strongest guardrails. This article clarifies the distinction for developers and leads designing a drift policy.
Overview
- A budget caps the absolute DriftScore. It asks: "Is the project's total drift below our ceiling?"
- A baseline captures a snapshot of scan state for delta comparison. It asks: "Did this change make drift worse than before?"
Budgets enforce a standard; baselines catch regressions relative to a known-good point.
Working with a baseline
Create a baseline snapshot from your project root:
vg baseline
This stores the current state under your .vibgrate directory. Later scans can compare against it to detect whether drift worsened. You can point a scan at a specific baseline file:
vg scan --baseline .vibgrate/baseline.json
You can also initialize a project with a baseline in one step:
vg init --baseline
Working with a budget
A budget is a single number passed at scan time:
vg scan --drift-budget 60
The scan fails if the DriftScore exceeds the budget, regardless of history.
When to use each
- Use a budget to set an organization-wide ceiling and ratchet it down over time.
- Use a baseline when you care about not getting worse on a specific change — ideal for pull-request gates where a small, intentional increase might be fine but a regression should be flagged.
- Use both for defense in depth: the baseline catches new regressions, the budget guarantees the absolute level never crosses your line.
A practical pattern
Many teams commit a baseline, gate pull requests on "no worsening" against it, and additionally enforce a falling budget. As you upgrade, refresh the baseline and lower the budget to lock in gains.
Related
- See Drift budgets explained for choosing and ratcheting a number.
- See Fitness functions for drift for baselines as architectural tests.
- See the
vg baselineandvg scancommand docs for full options.