// docs · v1.0

Severity and CI gating

The five-level severity scale, --fail-on semantics, exit codes, and recipes for wiring CommitBrief into pre-commit hooks and CI pipelines.

Findings are tagged with a severity. CommitBrief uses a five-level scale and exposes the highest matched level via --fail-on for CI gating.

The five levels

Highest impact → lowest:

critical > high > medium > low > info
LevelWhat it flags
criticalExploitable defects, data-loss bugs, regulatory violations, hard security holes (auth bypass, injection, key leak). Treat as release-blocking.
highLikely defects with significant impact: race conditions, missing authorization checks, broken business invariants, severe performance regressions. Should be fixed before merge.
mediumReal bugs with moderate impact or significant maintainability issues: incorrect-but-recoverable error handling, missing input validation that downstream catches, expensive but non-critical inefficiencies.
lowMinor defects or notable improvements that do not block the PR: inconsistent style breaking project conventions, small efficiency wins, missed cleanup.
infoPure informational notes: educational pointers, alternative approaches, “consider this for v2”. Not a defect.

The level names are part of the public JSON schema and cannot be renamed. The level definitions come from the embedded COMMITBRIEF.md default — your project-local COMMITBRIEF.md can tighten or relax them for your codebase.

Severity drives three things

  • --fail-on=<severity> — “fail at this level or worse”.
  • Cards panel color — severity-coded left border (red → orange → yellow → blue → grey).
  • --compact ordering — sorted critical-first.

The --fail-on flag

Maps the highest finding severity to an exit code. Case-insensitive.

--fail-on=<critical|high|medium|low|info|any|none>
ValueMeaning
"" (default)Off. Pipeline failures still exit 1; findings do not.
noneExplicit off.
anyAny finding at any severity fails.
criticalFail when one or more findings have severity critical.
highFail at high OR critical.
mediumFail at medium, high, OR critical.
lowFail at low, medium, high, OR critical.
infoFail on any finding (since info is the lowest level). Equivalent to any.

Anything else is a parse error before the review fires:

invalid --fail-on value "X" (expected: critical, high, medium, low, info, any, none)

Exit codes

CodeMeaning
0Review completed; no --fail-on threshold reached.
1An error occurred (git failure, provider error, parse failure, guard abort, etc.) OR --fail-on threshold was reached.

There is no distinction between “pipeline failed” and “--fail-on matched” at the exit-code level — both exit 1. Stderr disambiguates: pipeline failures print the underlying error; --fail-on matches print <N> finding(s) at or above '<severity>' severity.

Graceful degrade behavior

When the LLM produces unparseable JSON (and the one-shot retry also fails), CommitBrief degrades to markdown rendering and the findings list is nil. In that case --fail-on is intentionally skipped and stderr prints:

ℹ --fail-on skipped: LLM produced unparseable output, no findings to evaluate.

Failing CI on a flaky model invocation is worse than letting the run succeed and surfacing the markdown text — you still see the review content.

CI recipes

GitHub Actions — fail on critical

- name: CommitBrief review
  run: commitbrief --staged --fail-on=critical --no-cost-check
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

GitLab CI — save review JSON

review:
  script:
    - commitbrief --staged --fail-on=high --quiet --json --output review.json
  artifacts:
    paths: [review.json]

Pre-commit hook

The generated pre-commit hook embeds --fail-on=critical --quiet --no-cost-check already — install it with one command:

commitbrief install-hook

See Git hooks.

Interaction with other guards

Each guard exits 1 independently of --fail-on — guards run before the review completes; --fail-on only evaluates after a successful provider call.

GuardExit on abort
.commitbrief/ pre-send guard1 with aborted by pre-send guard.
Secret scanner1 with aborted: pre-send secret scanner.
Cost preflight1 with aborted: cost preflight.
--fail-on1 with the count + severity label.

See Safety and cost for what each guard does and how to opt out.