Get Started
DocsTrack 3guards
/llms.txt
Guards & Check4 min readbrevio-core v0.11.1

Learned Guards, Starter Packs & the Pre-PR Check

Plain-English Summary (For Anyone)

Turn a fixed bug into a check, and run a flight check before the pull request

`brevio-core learn` turns a bug fix you commit into a guard that reports the same lines if they come back. `brevio-core add` installs hand-written starter packs. `brevio-core check` is the pre-PR flight check: rules, test custody, test imports, conflict markers and complexity.

Why this matters:
A guard remembers a mistake that is particular to your repository, which no general rule could know.
A new guard is on trial and only reports, so a guard that is too broad does not block your team.
`check` sees what a diff scan cannot: a deleted test file, a removed assertion or a skip marker added by an earlier commit.
When to use:Right after fixing a bug (`learn`), when starting from a pack (`add`), and before you open a pull request (`check`).
Technical Contract (For Engineers)
Line-level rules
CLI Invocation Signature:
brevio-core check [--base BASE] [--json] [--format text|markdown|json] | brevio-core learn | brevio-core add <pack>
Latency / Execution
Not measured for 0.11.1
Token Cost
No model call. No API key.
Exit Codes
0 = nothing found or guard kept; 1 = findings or no guard kept; 2 = usage error
Artifacts & Files Generated:
.brevio/guards.json.agents/rules/.brevio/baseline.json
Visual Execution Pipeline
5-Stage Progressive Flow
01learn
Control run
The guard must match the removed lines and not the fixed file
02--replay N
Replay
The guard is run over recent commits to see how broad it is
03Preview
Trial
A new guard reports and does not fail a run until a person promotes it
04Exit 1 on findings
Check
brevio-core check runs the pre-PR flight check

What `learn` Does Differently from a Linter

In Plain English:A linter ships with rules someone else wrote. A guard is made from a fix in your own history.
`brevio-core learn` reads the lines a fix removed and writes a guard to `.brevio/guards.json` plus an agent rule to `.agents/rules/<id>.md`. The guard must pass a control run first, and it is replayed over recent commits so you can judge how broad it is. A guard is text, not an understanding of the bug: a short or common line can match in many places.

The Pre-PR Flight Check (`brevio-core check`)

In Plain English:One command that looks at the things a diff scan does not.
`brevio-core check` runs rules, test custody (R20.1 to R20.5, a preview), test imports, conflict markers and complexity. It compares the working tree with a base (`--base`, default the base that `scan --diff` uses: origin/main, else main, else HEAD). It exits 1 on findings and 2 on a usage error. `check` takes `--base`, `--json` and `--format`; SARIF comes from `scan --sarif FILE`.

Trial, Promotion and Switching a Guard Off

In Plain English:A new guard is on probation, and a person decides when it counts.
A new guard is on trial until the date in `trial_ends` and stays on trial, reported, until a person promotes or dismisses it. `learn list`, `learn show <id>`, `learn promote <id>`, `learn wrong <id> path:line` and `learn dismiss <id>` are previews. `dismiss` and `wrong` run only at a terminal, the agent hook runs neither, and the MCP server has no tool for either. A guard hit is a warning at most unless `brevio-core.toml` raises that guard to error.

Starter Packs & Hand-Edited Guards

In Plain English:Start from a hand-written pack, then edit the guards to fit your repository.
`brevio-core add <pack>` installs a hand-written starter pack (Next.js, Stripe, FastAPI, EU AI Act and Supabase packs exist; `brevio-core add` with no name lists them). A pack writes its guards to `.brevio/guards.json` and its rules to `.agents/rules/`, active at once as warnings. A pack's patterns are written by hand and have not been through the control run or the replay. A guard has `file_patterns`, `patterns` and an optional `exclude_file_patterns`, and the file is plain JSON you can edit like any file in review.

Interactive Rule Explorer

Explore the brevio-core rules and load their examples into the panel on the right.

129 / 129 rules