Adopt bce on an existing repository#

Turning a conformance gate on a codebase that already drifts is where most such gates die: a first honest run surfaces dozens of pre-existing violations, "fix all of them first" becomes a blocking chore nobody schedules, and the gate is never turned on. bce is designed so you can turn it on today — enforcing from this commit forward for anything new, while the debt that predates the gate burns down as normal work.

There is deliberately no --skip flag. Adoption is handled by committed, PR-reviewed configuration files — never by an invisible CI-line override. That is what keeps a green verdict honest. The two config files are .bce-mode.json (advisory mode) and .blueprints/baseline.json (the shrink-only baseline).

BCE brownfield adoption begins in committed advisory mode with all existing violations visible. A reviewed shrink-only baseline separates known debt from new drift, then enforced mode blocks every new violation while existing debt decreases from 75 to 38 to zero. A downgrade requires visible reviewed rationale.

The two adoption controls#

Mode and baseline are independent, committed controls. Mode decides whether a graded violation blocks; an optional baseline decides which already-recorded violations are non-blocking. Graduation changes mode and does not require an empty baseline.

mode:      advisory  ── graduate ──►  enforced
baseline:  absent   ◄──────────────►  present (existing debt only)

Advisory mode: turn it on, block graded violations later#

Author a blueprint (or have an agent draft one — see agent-loop.md) and drop it in .blueprints/. Then commit an advisory-mode marker so a red verdict is printed loudly but does not fail the build:

# .bce-mode.json  — committed, reviewed; NOT a flag on the gate
{ "mode": "advisory" }

Now bce gate runs in CI, prints the full verdict with an unmissable advisory banner, stamps the report mode: "advisory" — and exits 0 regardless of the verdict. You see exactly how much drift exists without turning the tree red on anyone. This is the first-look rung: it changes the whole gate's exit code to 0; it never hides or softens the verdict.

Baseline overlay: block new drift, show the debt#

When you are ready to start failing on new drift — but not yet ready to fix all the pre-existing violations — record the current violations into a baseline and switch out of advisory:

bce baseline                 # writes .blueprints/baseline.json with today's violations
rm .bce-mode.json            # (or graduate — see rung 3) so the gate enforces again

With a baseline present the gate stays fully enforcing and partitions every run's violations:

An existing baseline cannot grow in place. A re-run auto-removes violations you have since fixed and refuses to add any that were not already in it. To accept a genuinely new violation you must delete the file and re-create it — and that deletion is a line in a pull request. There is no in-place "add this one" affordance, precisely because that affordance would be the bypass. Baselined violations are identified by a content-addressed (blueprint, constraint, component) tuple, so reformatting or moving a line does not spuriously re-redden — but moving a violation to a different component is correctly a new identity, and fails.

Why a baseline is not a # noqa-for-the-whole-repo — the full mechanics — is in faq.md §"Why is baseline not a bypass?".

Graduate: the recorded flip to enforced#

bce graduate records the advisory→enforced transition in-repo and flips the config. It is one-way: going back to advisory requires an explicit --rationale, recorded in the tree, so the posture is always a governed, visible fact rather than a quiet CI edit.

bce graduate                 # advisory → enforced, recorded

Enforced mode: new drift blocks#

Enforced mode can coexist with a nonempty baseline: new violations block while recorded debt remains visible and non-blocking. As that debt is fixed, the baseline shrinks; when empty, delete it and the gate enforces everything.

The honest brownfield story#

On a real codebase a first run might surface, say, 75 pre-existing violations. The dishonest options are "fix all 75 before turning it on" (so it never gets turned on) or "add a skip flag" (so the gate means nothing). bce's answer is the ladder: turn it on today in advisory to see the 75, baseline them so new drift is caught from this commit forward, and burn the 75 down as normal work with the tool guaranteeing the wall only comes down. Enforcing from day one for everything new; shrink-only for the debt that predates the gate.

What adoption never does#

Read Markdown · Source: docs/adopt-existing-repo.md