# Gribble > Tiny bugs that find your bugs before you ship. Gribble is an AI website audit agent that runs during development — before the PR, in CI, before release — and traces every finding back to your source. Source: https://gribble.dev/llms-full.txt --- # Gribble An AI website quality audit agent that runs while you build, not after you ship. Source: https://gribble.dev/docs/index.md Gribble is a website quality audit agent that runs **during development** — before you open a pull request, inside CI, and before a release. It walks your site the way a picky reviewer would: it follows the links, walks the flows you described, checks SEO, accessibility, performance, security and your own house rules, and points every finding at the source file that caused it. ```prompt Set up Gribble in this project by following https://gribble.dev/setup.md ``` Your coding agent installs it, runs `init`, records the first baseline and then asks you which model to use and how to sign in. The [Agent setup guide](/docs/agent-setup) is the page it follows. Prefer to do it by hand? ```bash pnpm add -D gribble pnpm exec gribble install # downloads the Playwright browser pnpm exec gribble init # creates .gribble/ pnpm exec gribble audit # let the gribbles chew on it ``` `gate` mode installs no model runtime; `review` needs two more packages. See [The review runtime is optional](/docs/getting-started#the-review-runtime-is-optional). ## Why the name A gribble is a tiny marine isopod that bores holes into ship hulls from places nobody looks at. Whole piers have quietly collapsed because of them. We named the pest hunter after the pest: tiny bugs that find your bugs before you ship. The "ship" pun is the house joke, and we are not sorry. ## Not a production site auditor Tools like Ahrefs Site Audit, Screaming Frog or a scheduled Lighthouse run point at a site that is **already live**. They tell you what your users are seeing right now. That is useful, and Gribble does not replace it. Gribble points at `localhost:3000`, at your Vercel preview URL, at the container your compose file just brought up. It runs on a branch, against code that has not merged yet, and its job is to stop a regression from reaching the live site in the first place. | | Production auditors | Gribble | | --- | --- | --- | | Target | The deployed site | A dev server, preview URL or container | | Cadence | Scheduled crawls | Every PR, every push, before release | | Output | Dashboards and scores | PR comments, check annotations, a JSON report | | Fix loop | File a ticket | Points at the source file; you ask your coding agent to fix it and verify with `gate` | ## Two modes Gribble runs two very different kinds of check, and the difference matters because only one of them is allowed to block a merge. **[gate](/docs/concepts/gate-and-review)** is deterministic. Plain code, no model: broken links, failed requests, console errors, SEO metadata, axe accessibility violations, Lighthouse thresholds, HTML sanity, security checks, replay of flows that were already fixed in place. Fast, reproducible, same answer every time. Gate findings can fail your build. **review** is the AI agent. It explores the site, walks the flows in `.gribble/flows/*.md`, looks for new flows nobody wrote down, judges the UI against your `.gribble/guidelines.md`, and writes fix suggestions. Slow, non-deterministic, and **never blocks a merge** — it comments. AI findings are capped in severity by your `review/*` rules, which default to `warn`. Run both with `gribble audit`, or pick one with `--mode gate` / `--mode review`. ## Three entry points All three consume the same audit and the same report. 1. **[CLI](/docs/cli)** — `gribble audit`, with a live event stream in your terminal and `--ci` for machine-readable output. 2. **[GitHub Action](/docs/ci-github-action)** — `uses: gribble-dev/action@v1`. Check runs with annotations, PR comments that update in place, SARIF for code scanning, JUnit, and the run directory as an artifact. 3. **Local web UI** — tracked in the [repository issues](https://github.com/gribble-dev/gribble/issues). It will stream the same event bus to a browser next to a live view of the page the agent is driving, so you can replay exactly what it did when a finding was raised. ## Diff, not score Gribble does not hand you a number out of 100. A number out of 100 on an established codebase is a number everybody learns to ignore. Everything is a **diff against the [baseline](/docs/concepts/baseline)** stored on your main branch: - **New** findings are reported and commented on. These are the ones your change introduced. - **Existing** findings are counted and never commented on. You already know. - **Fixed** findings are celebrated in the summary. Somebody patched a hole. Performance works the same way: `perf/regression` compares against the metrics your main branch recorded, so a slow legacy app is perfectly usable with Gribble as long as it stops getting slower. ## Built on pi, keyed by you Gribble is a shell around [pi](https://github.com/earendil-works/pi). The agent loop, the model catalog, the provider auth and the session format come from pi's SDK; the browser tools, the deterministic checks, the guardrails and the report format come from Gribble. We do not maintain our own agent loop, and we do not patch pi. Consequences worth knowing up front: - **Bring your own key.** Gribble has no cloud, no account and no server of ours in the path. You log in to a model provider with `gribble login`, or you set an API key environment variable in CI. Your pages, your screenshots and your source never touch infrastructure we run. - **No hardcoded model.** Gribble does not ship a default model name. `gribble init` shows you what your credentials can reach, with a recommended set first, and writes your choice into `gribble.yaml` so your whole team reproduces the same audit. - **The session file is the trace.** Every tool call, argument and result is recorded in `.gribble/sessions/` (gitignored), which is what the replay UI will read. - **Read-only by default.** The agent gets read, grep, find, ls and Gribble's audit tools. No `edit`, no `write`, no `bash`. Licensed MIT. The report JSON is designed to be self-contained and uploadable, so a hosted dashboard stays possible later — but there is nothing to sign up for today. ## Where to go next - **[Getting started](/docs/getting-started)** — install, init, first audit, what to commit. - **[Agent setup guide](/docs/agent-setup)** — the page your coding agent follows to set Gribble up for you. - **[Working with your agent](/docs/skills)** — what to ask Claude Code, Cursor, pi or Codex once Gribble is in, and the skill that makes it work. - **Concepts** — [gate and review](/docs/concepts/gate-and-review), [the baseline](/docs/concepts/baseline), [findings and fingerprints](/docs/concepts/findings). - **Configuration** — [gribble.yaml](/docs/configuration/gribble-yaml), [rules.yaml](/docs/configuration/rules-yaml), [the rules reference](/docs/configuration/rules-reference). - **[Flows](/docs/flows)** — describe user journeys in Markdown and replay them deterministically. - **[Guidelines](/docs/guidelines)** — the house rules a model has to read, not a linter. - **[Auth](/docs/auth)** — logging in to the site under test, and to your model provider. - **[CI and the GitHub Action](/docs/ci-github-action)** — the workflow, inputs, outputs and permissions. - **[Monorepos](/docs/monorepos)** — one `.gribble/` per app, cascading rules. - **[CLI reference](/docs/cli)** — every command, flag and exit code. - **[Report format](/docs/report-format)** — the JSON, SARIF and JUnit outputs. - **[FAQ](/docs/faq)** — cost, false positives, privacy, Windows, and why not Lighthouse CI. --- # Getting started Install Gribble, run init, and get your first audit and baseline. Source: https://gribble.dev/docs/getting-started.md This page takes you from an empty project to a first audit and a committed baseline. Budget about ten minutes, most of which is the browser download. The quickest way aboard is to let your coding agent do the rigging; everything it does is also written out [by hand](#by-hand) below. ## With your agent Open your coding agent (Claude Code, Cursor, pi, Codex, …) in the project and give it one sentence: ```prompt Set up Gribble in this project by following https://gribble.dev/setup.md ``` It follows the [Agent setup guide](/docs/agent-setup), which tells it to: 1. Work out the package manager, which app is the website, its dev command and its local URL. 2. Install `gribble` as a devDependency, download the browser, and add the review runtime unless you only want `gate`. 3. Run `gribble init --yes` with the URL and start command it found, which also installs the [Gribble skill](/docs/skills) for the agents in your repository. 4. Run a first `gate` audit, which records the [baseline](#the-bootstrap-run). 5. Report every command it ran, every file it changed, and the most severe findings. Two things it stops and asks you about, because only a person should decide them: - **Which model.** It runs `gribble models`, shows you the recommended ones your credentials can reach, and writes your pick to `model:` in `gribble.yaml`. It never makes up a model name. - **Credentials.** If no model is reachable, it asks you to run `gribble login` in your own terminal, or to export your provider's API key. It does not run `login` for you and never writes a key into the repository. Until then it carries on with `gate` only. It does not fix findings, add CI or commit anything until you ask. When it is done, skip ahead to [Next steps](#next-steps). ## By hand The rest of this page is the same setup, one command at a time. ## Prerequisites - **Node.js >= 22.** Gribble is ESM-only and pi requires it. - **A package manager** — pnpm, npm or yarn all work. - **A dev server or a preview URL.** Gribble can start your dev server for you (`target.start`) or point at a URL that is already up. - **A model provider credential** for `review` mode — an API key, or a subscription you log in to. `gate` mode runs without any model at all, and without the packages that would talk to one. ## Install Install Gribble as a devDependency, the way you would ESLint or Playwright. It is not meant to be a global tool: the version belongs in your lockfile so CI and your laptop agree. ```bash pnpm add -D gribble # npm install --save-dev gribble # yarn add --dev gribble ``` ### The review runtime is optional That install gives you the deterministic half and nothing else. The AI half — pi's agent loop, model catalog and the provider SDKs behind it — ships as **optional peer dependencies**, so a fresh install for `--mode gate` in CI brings no model runtime at all: no provider SDKs, no cloud credential chain, roughly 120 fewer packages. Upgrading from 0.3 with pnpm is the exception; see [below](#upgrading-from-0-3). For `review` or `all`, add the two runtime packages next to Gribble: ```bash pnpm add -D gribble @earendil-works/pi-ai @earendil-works/pi-coding-agent # npm install --save-dev gribble @earendil-works/pi-ai @earendil-works/pi-coding-agent # yarn add --dev gribble @earendil-works/pi-ai @earendil-works/pi-coding-agent ``` No package manager installs an optional peer on its own — on a fresh install npm, pnpm, yarn and bun all skip it — so this step is always explicit. Gribble pins one exact pi version and both packages must match it; reach `review` without them and the CLI stops with the exact `npm install` line, version included, instead of a module-resolution stack trace. ### Upgrading from 0.3 Gribble 0.3 shipped the review runtime as a hard dependency. With pnpm, bumping to 0.4 does not remove it: pnpm resolves the new optional peers against what the lockfile already holds, finds the runtime from 0.3 there, and keeps it — along with the provider SDKs and the AWS credential chain behind it. `pnpm install` answers `Already up to date`, and `pnpm dedupe` leaves it too. Gate-mode audits say so with a warning. If you use `review` or `all`, that is fine: add the two packages to your devDependencies as above, so the lockfile keeps them on purpose. If you only run `gate`, check whether the runtime is still there after the bump: ```bash pnpm why @earendil-works/pi-ai ``` No output means it is gone. If it is listed under `gribble`, re-resolve without it. Either: - **Turn off `autoInstallPeers` for one install.** Set `autoInstallPeers: false` in `pnpm-workspace.yaml` (or `auto-install-peers=false` in `.npmrc` on pnpm 9), run `pnpm install`, then remove the setting and run `pnpm install` again. The runtime does not come back, because a fresh resolution never auto-installs an optional peer. The first install also re-resolves every other peer your project relies on pnpm to add automatically, so read the lockfile diff before committing it. Leaving the setting at `false` is not a fix: it is a different dependency graph. - **Regenerate the lockfile.** Delete `pnpm-lock.yaml` and `node_modules`, then `pnpm install`. This re-resolves everything else in the project as well, within the ranges in your `package.json` files. `pnpm remove gribble && pnpm add -D gribble` does not help; the runtime is resolved again from the lockfile. Neither does an `overrides` entry for the pi packages, which leaves the provider SDKs behind or the lockfile unchanged depending on the pnpm version. Then fetch the browser binary: ```bash pnpm exec gribble install ``` This runs Playwright's Chromium download. If your CI image already has Playwright browsers (or you use the [Docker image](/docs/ci-github-action#docker-image)), you can skip it there. ## `gribble init` ```bash pnpm exec gribble init ``` > Let's put some gribbles in your repo. The walkthrough asks four things. **1. Where does your site live?** The URL Gribble should audit, defaulting to `http://localhost:3000`. You can type an environment variable reference like `${PREVIEW_URL}` instead of a literal URL. **2. How does it start?** An optional command such as `pnpm dev`. If you give one, Gribble runs it before each audit and waits until the URL responds (120 seconds by default). Leave it blank if you always point at something that is already running. **3. Which model?** Gribble asks your model runtime which models your current credentials can actually reach, then sorts them with a **recommended set first** — models that handle tool calling well, do not need vision, and are cheap enough to run on every PR. Pick one and it is written into `gribble.yaml` so your whole team reproduces the same audit. If you have no credentials yet, init offers to run [`gribble login`](/docs/auth#part-2-model-provider-auth) first. Gribble deliberately ships no default model name. The recommended table lives in one place in the source and is refreshed every release. **4. Should we teach your coding agent?** > Teach your coding agent to feed the gribbles? Init looks for `.claude/`, `.pi/`, `.cursor/` and `AGENTS.md` and offers to install the [Gribble skill](/docs/skills) into each agent it finds. The skill teaches your coding agent to read the latest report, fix findings by severity, verify with `gribble audit --mode gate`, and keep your flows and rules up to date. Pass `--yes` to accept every default, including installing the skill everywhere. Pass `--url`, `--start` and `--model` to answer individual questions non-interactively. ## Log in to a model provider ```bash gribble login # pick a provider interactively gribble login # OAuth flow or API key prompt gribble login --api-key "$MY_KEY" ``` Credentials go to `~/.gribble/auth.json`, never into your repository. If you already use pi, set `reusePiAuth: true` in `gribble.yaml` and Gribble reads `~/.pi/agent/` instead of keeping a second copy. Gribble also picks up the standard provider environment variables, which is how CI is expected to work: ```bash # whichever provider you chose; e.g. export ANTHROPIC_API_KEY=... export OPENAI_API_KEY=... export GOOGLE_API_KEY=... ``` **Subscription OAuth logins are personal.** Do not try to move one into CI — use an API key there. See [Auth](/docs/auth#part-2-model-provider-auth). ## Your first audit ```bash pnpm exec gribble audit ``` You get a live event stream: the dev server coming up, routes being discovered, deterministic checks running per route, then the agent exploring. ``` 🪱 3 gribbles are nibbling on localhost:3000… ✓ routes 12 discovered ✓ links 248 checked ✓ a11y 12 routes ✓ perf 12 routes … reviewing /pricing ``` And then one of two endings: ``` The gribbles went hungry. Ship it. ``` ``` The gribbles found 4 holes in your hull — 2 need patching before you sail. error links/broken /pricing → /docs/plans returns 404 error a11y/form-labels /signup Input #email has no associated label warn seo/meta-description /blog/[slug] 22 characters, minimum is 50 warn review/copy /pricing "Contact sales" and "Talk to sales" on the same page ``` Findings are dry on purpose. The jokes stop where the bug begins. Exit codes: `0` everything passed, `1` the gate failed, `2` a config or auth problem. See the [CLI reference](/docs/cli#exit-codes). ## The bootstrap run The first audit has nothing to compare against, so Gribble enters **bootstrap mode**: it records what it finds as the known state instead of reporting it as new, writes `.gribble/baseline/`, posts no PR comments, and tells you to commit the result. ``` No baseline yet — this run is the baseline. 18 findings recorded as known. Commit .gribble/baseline/ so future runs have something to diff against. ``` From then on, every run is a diff: new findings get reported, existing ones get counted, fixed ones get celebrated. See [Baseline](/docs/concepts/baseline). ## What `.gribble/` contains ``` .gribble/ gribble.yaml project settings: URL, start command, model, budgets (commit) rules.yaml rule severities, ESLint style (commit) guidelines.md judgement-call house rules for the review AI (commit) flows/ user journeys in Markdown, plus replay sidecars (commit) baseline/ known findings, metrics, aria snapshots, screenshots (commit) .gitignore generated; ignores runs/ sessions/ cache/ (commit) runs/ reports, traces and screenshots per audit (ignored) sessions/ pi session files = full audit traces for replay (ignored) cache/ incremental audit cache, auth storage state (ignored) ``` ### What to commit Commit everything except `runs/`, `sessions/` and `cache/` — and you do not have to do anything to arrange that, because `gribble init` writes `.gribble/.gitignore` for you: ``` runs/ sessions/ cache/ ``` That file is self-contained and is itself committed. `gribble init` **never touches your repository root `.gitignore`**. It only warns you if your root `.gitignore` already ignores the whole `.gribble/` directory, because that would also throw away your rules, flows and baseline: ``` Your root .gitignore ignores .gribble/ entirely. That also ignores rules.yaml, flows/ and baseline/, which should be committed. ``` `sessions/` and `cache/` are ignored for a reason beyond noise: session files record tool arguments (screenshots, test-account data) and `cache/auth/` holds browser storage state for logged-in profiles. Keep them out of git. In CI, reports travel as [artifacts](/docs/ci-github-action#artifacts), not commits. ## Next steps Once the baseline is committed, most of the day-to-day work is a sentence to your coding agent. Some good first ones: ```prompt Fix the new Gribble findings from the latest audit, most severe first, and verify each fix with a gate audit. ``` ```prompt Add a Gribble flow for our checkout: a signed-in user adds a product to the cart, goes to checkout and sees a total that matches the cart, stopping before payment. ``` ```prompt Add the Gribble GitHub Action so every pull request is audited and gets a comment on new findings, reading the model API key from a repository secret. ``` Or read up first: - Loosen or tighten the checks in [rules.yaml](/docs/configuration/rules-yaml). - Write your first [flow](/docs/flows) so review mode knows what "checkout" means in your app. - Put your house style into [guidelines.md](/docs/guidelines). - Add the [GitHub Action](/docs/ci-github-action) so every PR gets a comment. - See [Working with your agent](/docs/skills) for more of what you can ask. --- # Agent setup guide Step-by-step instructions a coding agent follows to add Gribble to a project. Also served at gribble.dev/setup.md. Source: https://gribble.dev/docs/agent-setup.md This page is written for coding agents. Hand it to yours with one sentence and it does the install, the configuration and the first audit, then stops and asks you for the two things only a person should decide. ```prompt Set up Gribble in this project by following https://gribble.dev/setup.md ``` The same page is served as plain Markdown at [`gribble.dev/setup.md`](https://gribble.dev/setup.md) and ships inside the npm package at `node_modules/gribble/docs/agent-setup.md`. The rest of this page speaks to the agent. ## Before you start You are adding Gribble, a website quality audit CLI, to the project in the current working directory. It runs against a dev server or preview URL, reports findings that point at source files, and diffs every run against a committed baseline. The full documentation is at (append `.md` to any page URL for raw Markdown) and, once installed, at `node_modules/gribble/docs/`. Ground rules for this task: - **Do not invent a model name.** Gribble ships no default model. Only use an id that `gribble models` printed. - **Never put a credential in the repository.** No API key in `gribble.yaml`, `.env` files you commit, or workflow files. Secrets go in environment variables or the CI secret store. - **Do not run `gribble login` for the user.** It opens an interactive OAuth or API key prompt. Ask the user to run it. - **Do not suppress findings.** No `ignore` entries in `rules.yaml` and no `gribble ignore` without the user agreeing to each one. - **Report what you ran.** List every command and every file you created or changed when you finish. ## 1. Find the app Work out, from the repository itself: | Question | Where to look | | --- | --- | | Package manager | The lockfile: `pnpm-lock.yaml` → pnpm, `package-lock.json` → npm, `yarn.lock` → yarn, `bun.lock` / `bun.lockb` → bun | | Which app is the website | In a monorepo, the workspace with a web framework dependency (Next.js, SvelteKit, Astro, Nuxt, Remix, Vite, …). If there are several, ask the user which ones to audit. | | Dev command | The `dev` (or `start`) script in that app's `package.json` | | Local URL and port | The framework default, or a `--port` flag / `server.port` setting in the script or framework config | | Node.js version | `node --version` must print 22 or newer. If it does not, stop and tell the user. | Run every command below from the app's directory (in a monorepo, the directory whose `package.json` has the dev script). See [Monorepos](/docs/monorepos) if there is more than one app. ## 2. Install Install Gribble as a devDependency with the project's package manager. pnpm is shown; translate for the others (`npm install --save-dev`, `yarn add --dev`, `bun add --dev`). ```bash pnpm add -D gribble pnpm exec gribble install ``` `gribble install` downloads Playwright's Chromium. It can take a minute. This gives the deterministic `gate` mode only. The AI `review` mode needs two optional peer packages, which no package manager installs on its own. Add them unless the user said they only want `gate`: ```bash pnpm add -D @earendil-works/pi-ai @earendil-works/pi-coding-agent ``` If the versions do not match what Gribble expects, the CLI prints the exact install line to use. Run that line. ## 3. Initialise Run `init` non-interactively, answering from what you found in step 1: ```bash pnpm exec gribble init --yes --url http://localhost:5173 --start "pnpm dev" ``` - `--url` is the local URL of the running app. A preview URL from an environment variable is written as `'${PREVIEW_URL}'`. - `--start` is the command that brings the app up. Leave it out if the user always runs the server themselves. - `--yes` accepts every other default and installs the Gribble skill for every coding agent it detects (`.claude/`, `.pi/`, `.cursor/`, `AGENTS.md`). That skill teaches you and future sessions how to fix findings and edit flows and rules, so keep it. `init` never overwrites existing `.gribble/` files unless you pass `--force`. If `.gribble/` already exists, stop and ask the user whether to keep or replace it. ## 4. Pick a model ```bash pnpm exec gribble models ``` - **It lists models.** The recommended ones come first. Show the user the top few and ask which one to use, then write it to `model:` in `.gribble/gribble.yaml` (format `provider/id`). If credentials were already present, `init --yes` wrote the top recommended model there; ask anyway and replace it if the user picks another. - **It lists nothing, or says no credentials were found.** Ask the user to either run `pnpm exec gribble login` in their own terminal or export their provider's API key (for example `ANTHROPIC_API_KEY`), then run `gribble models` again. Until then, continue with `gate` only. ## 5. First audit ```bash pnpm exec gribble audit --mode gate ``` The first run has no baseline, so it **records** what it finds as the known state and writes `.gribble/baseline/`. That is expected: an established site always has some findings, and they are not failures of this setup. Exit code `2` means a config or startup problem (read the message; usually the URL or start command is wrong). See [Exit codes](/docs/cli#exit-codes). If a model is configured, follow up with the full run: ```bash pnpm exec gribble audit ``` ## 6. Hand back to the user Stop here and report: 1. The commands you ran and the files that changed. Expect `package.json`, the lockfile, `.gribble/` and one or more `skills/gribble/SKILL.md` files. 2. What goes into git: everything in `.gribble/` except `runs/`, `sessions/` and `cache/`, which the generated `.gribble/.gitignore` already excludes. Do not edit the root `.gitignore`. 3. The finding counts from `.gribble/runs/latest.json` (`summary.counts`) and the three most severe findings, dry and precise: rule, route, file. 4. What the user can ask for next, as short prompts: - "Fix the new Gribble findings and verify with gate." - "Add a flow for the sign-up journey." - "Add the Gribble GitHub Action to this repo." Do not fix findings, add CI, or commit anything unless the user asks. ## Optional follow-ups When the user asks for one of these, read the linked page first; each one starts with the prompt that got you there. | Request | Read | | --- | --- | | Run Gribble on every pull request | [CI and the GitHub Action](/docs/ci-github-action) or [GitLab CI](/docs/ci-gitlab) | | Describe a user journey to walk | [Flows](/docs/flows) | | Tighten or loosen a check | [rules.yaml](/docs/configuration/rules-yaml) | | Encode a house style the model should judge | [Guidelines](/docs/guidelines) | | Audit pages behind a login | [Auth](/docs/auth) | | Understand the numbers | [Baseline](/docs/concepts/baseline) and [Findings](/docs/concepts/findings) | --- # Working with your agent What to ask Claude Code, Cursor, pi or Codex once Gribble is in your repository, and the skill that teaches them how. Source: https://gribble.dev/docs/skills.md Gribble finds problems. Something has to fix them. In most repositories that something is already a coding agent, and the fastest closed loop looks like this: **Gribble audits → your agent reads the report → your agent fixes the findings → `gribble audit --mode gate` verifies → your agent updates the flows and rules it learned about.** You steer that loop in plain sentences. The `@gribble/skills` package ships a skill file that teaches your agent every step of it, so none of the requests below need you to explain the tooling first. Not set up yet? Start with the [Agent setup guide](/docs/agent-setup). ## What you can ask ### Fix findings ```prompt Fix the new Gribble findings from the latest audit, most severe first, and verify each fix with a gate audit. ``` ```prompt Gribble says the checkout flow replay is failing. Look at the latest report, find out why and fix it. ``` The agent reads `.gribble/runs/latest.json`, touches only findings with status `new`, follows each finding to its source file, and re-runs `gribble audit --mode gate` rather than declaring victory after the edit. For a finding it believes is wrong, it tells you and suggests a fingerprint to ignore; it does not ignore it. ### Add a flow ```prompt Add a Gribble flow for the password reset journey: a user requests a reset link from /forgot-password, opens it, sets a new password and lands signed in on the dashboard. ``` You get a `.gribble/flows/password-reset.md` with a start URL, steps named by what a user sees, the outcomes that prove the journey worked, and `requires_auth` when it needs a login. The replay sidecar is recorded later by review, not written by the agent. See [Flows](/docs/flows). ### Turn a house rule into config ```prompt No page should ship with "Coming soon" on it, and every error message must say what to do next. Add both to Gribble in whichever file each belongs. ``` The first is a pattern match, so it becomes an extra pattern for `ui/placeholder-text` in `rules.yaml`; the second needs a model to read the message, so it goes in `guidelines.md`. The agent knows the difference; the table [below](#how-the-skill-makes-that-work) is how it decides. ### Understand a finding ```prompt Why is the missing alt text on /blog/[slug] listed as existing in the latest Gribble report, and when did it first show up? ``` `existing` means the finding is already in the committed [baseline](/docs/concepts/baseline), and `firstSeen` in `.gribble/baseline/findings.json` records the commit it arrived in. The agent explains; it does not fix `existing` findings unless you ask, because paying down old debt is a separate piece of work. ```prompt Gribble keeps flagging our admin tables for contrast. Look at whether that rule should be scoped differently and propose a change, without applying it. ``` ### Wire up CI ```prompt Add the Gribble GitHub Action to this repository: audit every pull request and comment on new findings, refresh the baseline on pushes to main, and read the model provider API key from a repository secret. ``` The agent reads [CI and the GitHub Action](/docs/ci-github-action) (or [GitLab CI](/docs/ci-gitlab)) from the installed package, writes the workflow, and tells you which secret to create. It never writes a key into a file; creating the secret is yours to do. A pattern worth adopting: run `gribble audit --mode gate` yourself, then hand the agent the report. Gate is fast, free and deterministic, so the fix-verify loop is tight. Save `--mode all` for when you want the AI review's judgement too. ## How the skill makes that work One skill file, three sections, plus pointers for setup and CI requests. Deliberately one file rather than three: an agent that knows how to fix a finding also needs to know when the right answer is to change a rule instead. ### 1. Fix findings Read `.gribble/runs/latest.json`, work through the findings, fix them, verify. The skill tells the agent to: - read the report and work in severity order — `critical`, then `error`, then `warn`, ignoring `info` unless asked; - only act on findings with `status: "new"`, because `existing` ones are the accepted baseline and fixing them is a separate, deliberate piece of work; - use `location.file` and `location.symbol` to find the code, rather than guessing from the route; - read `suggestion` and follow `docsUrl` when it needs to understand a rule; - **verify with `gribble audit --mode gate`**, which is fast, deterministic and costs no tokens, rather than declaring victory after editing; - treat a finding it believes is wrong as a conversation, not a `gribble ignore` — suppressing a finding is a decision for a human; - never hand-edit `.gribble/baseline/`, and only update the baseline when you ask for it. That last point is the one that matters most. An agent with the power to silence its own critic is not a useful critic. ### 2. Write flows The [flow](/docs/flows) format: Markdown with `name`, `requires_auth`, `env` and `tags` frontmatter, prose describing intent rather than selectors, and at least one stated outcome. The skill covers when to add a flow — usually in response to a `review/flow-coverage` finding — and how the `.replay.json` sidecar gets generated so gate can replay it deterministically. ### 3. Change rules and guidelines Which file a change belongs in, which is the thing people most often get wrong: | Change | File | | --- | --- | | Mechanically checkable standard | [`rules.yaml`](/docs/configuration/rules-yaml) | | Judgement call, needs a model to read the page | [`guidelines.md`](/docs/guidelines) | | Where the site is, which model, budgets, origins | [`gribble.yaml`](/docs/configuration/gribble-yaml) | | One specific finding that is not a real problem | `ignore` in `rules.yaml`, with a comment, after a human agrees | So "our buttons must be at least 44px" ends up as `a11y/touch-target` in `rules.yaml`, while "our error messages must say what to do next" ends up as prose in `guidelines.md` — and your agent knows the difference without being told each time. ## Installing `gribble init` detects which coding agents your repository uses and offers to install: > Teach your coding agent to feed the gribbles? Detection is by directory: | Found | Agent kind | | --- | --- | | `.claude/` | `claude` | | `.pi/` | `pi` | | `.cursor/` | `cursor` | | `AGENTS.md` or `.agents/` | `agents` | Install paths follow each ecosystem's convention: | Agent kind | Path | | --- | --- | | `agents`, `pi` | `.agents/skills/gribble/SKILL.md` | | `claude` | `.claude/skills/gribble/SKILL.md` | | `cursor` | `.cursor/skills/gribble/SKILL.md` | pi reads the Agent Skills standard location directly, which is why `pi` and `agents` share a path. `gribble init --yes` installs to every agent it detects, without asking. That is what the [Agent setup guide](/docs/agent-setup) runs, so if your agent set Gribble up, the skill is already there. Commit the installed skill. It is a project file, like a lint config: everyone on the team — and every agent session — should have it. ## Updating The skill file ships with `@gribble/skills` and carries a version. After upgrading Gribble, refresh it. Your agent can do both in one go: ```prompt Upgrade Gribble to the latest version, refresh the installed Gribble skill, and run a gate audit to check nothing changed. ``` By hand: ```bash pnpm exec gribble init --update-skills ``` This only touches skill files. It does not re-run the init walkthrough, does not touch `gribble.yaml`, `rules.yaml` or `guidelines.md`, and does not ask about the target URL. Each installed skill is reported as `installed`, `updated` or `unchanged`, and the installed version is read from the file itself, so an old copy is detected reliably. Worth adding to whatever you already run after a dependency bump. ## Offline documentation The `docs/` directory ships inside the npm package. After `pnpm add -D gribble`, the full documentation is on disk at: ``` node_modules/gribble/docs/ ``` The skill points agents there first. That means: - an agent can read the rule reference and the config schema **without network access**, which matters in sandboxed environments and locked-down CI; - the documentation an agent reads is the documentation for the **version you have installed**, not whatever is on the website today — no advice about a flag that does not exist in your version yet; - there is no fetch latency in the loop. The same content is at [gribble.dev/docs](https://gribble.dev/docs). Every page is also served as raw Markdown by appending `.md` to its URL, and `llms.txt` and `llms-full.txt` are published at the site root following the llmstxt.org convention, for agents that do have network access. ## Using it without the skill installer The skill is a plain Markdown file. If your agent is not one of the four detected kinds, copy it wherever your agent reads project instructions, or point that agent at `node_modules/gribble/docs/` and let it read these pages directly. Nothing about the loop depends on the skill being installed in a specific place — the skill just saves you re-explaining it. The programmatic interface is available too, if you are building tooling around this: ```ts import { detectAgents, installSkill, skillSource, SKILL_VERSION } from "@gribble/skills"; const kinds = await detectAgents(process.cwd()); const results = await installSkill(process.cwd(), kinds); // -> [{ kind: "claude", path: ".claude/skills/gribble/SKILL.md", status: "updated" }] ``` --- # Gate and review Two modes with different contracts — one is deterministic and can block a merge, the other is an AI agent that only ever comments. Source: https://gribble.dev/docs/concepts/gate-and-review.md Gribble runs two kinds of check, and keeping them apart is the central design decision of the product. One is code, reproducible, and allowed to fail your build. The other is a model, useful but non-deterministic, and structurally prevented from blocking anyone. ## gate Gate mode is ordinary code. No model is loaded, no tokens are spent, and the same commit produces the same findings every time. No model runtime is *installed* either: the pi packages behind review mode are [optional peer dependencies](/docs/getting-started#the-review-runtime-is-optional), so a fresh gate-only install never fetches a provider SDK. (A pnpm lockfile from Gribble 0.3 is the exception: it keeps the runtime across the upgrade until you [re-resolve it](/docs/getting-started#upgrading-from-0-3).) What runs in gate: - **Links and network** — internal 4xx/5xx, external link checks, redirect chains, empty `href`s, failed requests, console errors, asset sizes, request counts. - **SEO** — title and meta description length, single `h1`, heading order, canonical, `robots` and `noindex`, sitemap, `lang`, Open Graph, structured data. - **Accessibility** — an axe run per route, plus the derived rules for image alt text, form labels and accessible names. - **Performance** — a Lighthouse run per route with thresholds on the performance score, LCP, CLS, TBT and page weight. - **HTML sanity** — doctype, charset, viewport meta, duplicate ids. - **Security** — HTTPS-only, mixed content, exposed secret patterns in HTML and JS. - **UI hard rules** — computed styles compared against your design tokens, overlap and overflow math, placeholder text, broken images. All measured in code, not judged by a model. - **Flow replay** — the `flows/replay` rule runs the recorded step list for every flow that has a `.replay.json` sidecar. - **Regressions** — `perf/regression`, `visual/regression` and `structure/regression` compare this run against the [baseline](/docs/concepts/baseline). ```bash gribble audit --mode gate ``` Gate is what you want in a required status check, in a pre-push hook, and as the verification step after your coding agent claims it fixed something. ## review Review mode starts an agent session and hands it the site. It: - walks every flow in [`.gribble/flows/*.md`](/docs/flows) and reports where a journey breaks down; - explores routes that nobody wrote a flow for, looking for dead ends, missing error states and confusing interactions; - judges what it sees against your [`guidelines.md`](/docs/guidelines); - writes a plain-language fix suggestion for each finding, pointing at the component or file responsible. ```bash gribble audit --mode review ``` Review findings map onto the `review/*` rules — `review/guidelines`, `review/ux`, `review/copy`, `review/dead-ends`, `review/flow-coverage`, `review/error-handling` — which default to `warn`. ### How the model perceives the page By default, **the model does not look at screenshots.** It reads a structured snapshot instead: - a simplified DOM with scripts, styles and SVG path data removed, wrapper elements collapsed, and meaningful attributes kept (`role`, `aria-*`, `href`, `alt`, `data-testid`); - a Playwright aria snapshot in compact YAML; - bounding boxes for interactive elements, plus overlaps, overflow and undersized touch targets **already computed in code**; - a subset of computed styles compared against your design tokens in code, with only the violations handed over; - Lighthouse metrics, console errors and failed requests. This is not a cost saving hack. A model reading a DOM knows the exact hex colour, the exact font size and the exact accessible name; a model looking at a PNG is guessing at all three. Text beats pixels for everything except actual pictures. Screenshots are still taken — for pixel-diff visual regression (done in code, never by the model) and for humans to look at in `runs/`. The `screenshot` tool is only handed to the model when you set `review.vision: true`, for the cases where the data genuinely cannot say: canvas rendering, image content, a chart that looks wrong. ### Deterministic results feed the agent Gate checks run **before** the agent and their results are injected as context. The model does not spend steps rediscovering that a link is broken; it spends them on the things only it can do. This also means `--mode all` is cheaper than running the two modes separately. ### Guardrails pi has no permission system, so Gribble adds one in the shell around it: - **Origin allowlist.** The agent cannot navigate off your target host plus whatever you list in `allowed_origins`. - **No side effects off staging.** Form submissions, orders and similar destructive interactions are blocked unless the host is a staging or preview origin you allowed. - **Budgets.** A hard cap on steps, tokens and optionally dollars per audit. The run ends cleanly and reports what it got when a budget is hit. - **No CAPTCHA solving.** Ever. See [Auth](/docs/auth). - **Read-only tools.** The agent gets `read`, `grep`, `find`, `ls` and Gribble's audit tools. No `edit`, `write` or `bash`. ## Why review never blocks Three independent mechanisms, each sufficient on its own: 1. **Severity capping.** A model returns a severity with each finding, but that severity is capped by the matching `review/` rule, which defaults to `warn`. Even if the model says `critical`, the finding lands as `warn`, and `warn` does not fail the gate. 2. **A confidence floor.** Each AI finding carries a 0–1 confidence. Anything below `review.min_confidence` (default `0.7`) is dropped before it reaches the report. 3. **The gate verdict ignores source.** `summary.gate` is `fail` only when a **new** finding with severity `error` or `critical` came from a deterministic rule or from `flows/replay` — or, when a project opts in with [`coverage.required`](/docs/configuration/gribble-yaml#coverage), when required routes, flows, checks or the baseline did not execute. An incomplete review is labeled in the report's [`completeness`](/docs/report-format#completeness) and never fails the gate. If you genuinely want an AI finding to be able to block a merge, you can raise a `review/*` rule to `error` in `rules.yaml`. We think you should not, at least not for a while. ## Comment volume Every finding lands in the run report. Only the top `review.max_comments` **new** findings become PR comments — default `5`, deliberately low, sorted by severity, then confidence, then deterministic-before-AI. The rest are linked from the summary: > Showing 5 of 12 holes. The rest are in the full report. A report nobody reads because it has ninety comments is worth less than five comments somebody acts on. ## Choosing a mode | Situation | Mode | | --- | --- | | Required status check on PRs | `gate` | | PR review comments | `review` or `all` | | After your coding agent fixed something | `gate` | | Nightly, or before a release | `all` | | No model credentials available, or no review runtime installed | `gate` | The default for `gribble audit` and for the GitHub Action is `all`. ## The flywheel Review finds things gate cannot describe yet. When review keeps reporting the same real problem, promote it: - a repeated journey the agent had to figure out → write it down as a [flow](/docs/flows), then record a replay sidecar so `gate` walks it deterministically forever; - a repeated judgement call → write it into [`guidelines.md`](/docs/guidelines) so the model stops rediscovering it, or into [`rules.yaml`](/docs/configuration/rules-yaml) if it turns out to be mechanically checkable after all. Over time the expensive, fuzzy mode shrinks and the cheap, deterministic one grows. That is the intended direction of travel. --- # Baseline The committed snapshot of your main branch's known state — everything Gribble reports is a diff against it. Source: https://gribble.dev/docs/concepts/baseline.md The baseline is Gribble's memory. It is a snapshot of what your main branch looks like today, committed to the repository, and every conclusion on a pull request is measured against it. This is what lets Gribble be useful on a codebase that is not perfect. A ten-year-old app with 400 accessibility findings and a Lighthouse score of 41 gets a clean Gribble run, as long as the PR does not make any of it worse. ## Layout The baseline lives in `.gribble/baseline/` and **is committed**. ``` .gribble/baseline/ findings.json known-problem ledger metrics.json per-route performance numbers snapshots/.aria.yaml aria snapshot per route screenshots/@.webp meta.json commit, time, version, model, viewports ``` ### `findings.json` The ledger of problems that already exist on main. ```json { "version": 1, "findings": [ { "fingerprint": "9f2c1d4a7b3e0c58", "rule": "a11y/img-alt", "severity": "error", "route": "/blog/[slug]", "location": { "file": "src/components/PostHero.tsx", "symbol": "PostHero" }, "subject": "hero-image", "firstSeen": { "commit": "3f9a21c", "at": "2025-02-11T09:14:03.000Z" } } ] } ``` Each PR run compares its findings against this list by [fingerprint](/docs/concepts/findings#fingerprints) and sorts everything into three buckets: | Status | Meaning | What happens | | --- | --- | --- | | `new` | Not in the ledger | Reported, commented on, counted towards the gate | | `existing` | In the ledger | Counted in the summary, never commented on | | `fixed` | In the ledger, gone from this run | Celebrated in the summary | `firstSeen` is kept so you can tell a problem that arrived last week from one that has been there since 2019. ### `metrics.json` Per-route performance numbers, so `perf/regression` can work on deltas instead of absolutes. ```json { "version": 1, "routes": { "/": { "lcpMs": 1840, "cls": 0.04, "tbtMs": 120, "lighthousePerformance": 88, "pageWeightKb": 940, "requestCount": 42 }, "/pricing": { "lcpMs": 2210, "cls": 0.02, "tbtMs": 180, "lighthousePerformance": 81, "pageWeightKb": 1310, "requestCount": 58 } } } ``` With the default `perf/regression` options, a PR fails on a 500 ms LCP increase or a 5-point score drop — regardless of whether the starting score was 95 or 41. ### `snapshots/` One Playwright aria snapshot per route, as compact YAML. Plain text, small, and readable in a git diff — which is the point. `structure/regression` compares this run's snapshot against the committed one and notices when a nav item vanishes, a form disappears or a landmark changes role. Reviewing a Gribble baseline diff is often the fastest way to see what a big refactor actually did to the page structure. ### `screenshots/` One image per route per viewport, scaled to a fixed width, for `visual/regression` pixel comparison. WebP where the encoder is available, PNG otherwise. Control how they are stored with `baseline.screenshots` in [`gribble.yaml`](/docs/configuration/gribble-yaml): | Value | Behaviour | | --- | --- | | `commit` | Written into `.gribble/baseline/screenshots/` and committed. Fine for small sites: three routes and two viewports are under 200 KB. | | `lfs` | Same paths, tracked via Git LFS. Recommended for large sites — you will need a matching `.gitattributes` entry. | | `off` | No baseline screenshots. `visual/regression` cannot run. The default. | Screenshots are opt-in because they are binary churn in git history and because pixels differ between rendering platforms. `visual/regression` is off in `gribble:recommended`; turn it on together with `baseline.screenshots`. Baseline screenshots are capped at 1280px wide and encoded as WebP at quality 70. `lfs` writes `.gribble/baseline/.gitattributes` so the screenshot folder goes through Git LFS; install Git LFS before committing, Gribble warns when it is missing. Screenshot file names carry the rendering platform, the way Playwright names its snapshots: `index@desktop.chromium-linux.webp`, `index@desktop.chromium-darwin.webp`. Each platform that runs `--update-baseline` keeps its own set and only ever compares against it, so a macOS laptop and Linux CI never report each other's font rendering as a regression. On a platform with no screenshots yet, pixel comparison waits until the baseline is updated there once. The aria snapshots behind `structure/regression` are plain text and compare across platforms; they stay on by default and catch the regressions that matter most: a navigation item, form or landmark that disappeared. If the repository size worries you, `off` is a legitimate choice: `structure/regression` on aria snapshots catches most of what matters at a fraction of the bytes. ### `meta.json` ```json { "version": 1, "commit": "3f9a21c", "branch": "main", "at": "2025-02-11T09:14:03.000Z", "gribbleVersion": "1.4.0", "model": { "provider": "", "id": "" }, "viewports": { "mobile": { "width": 390, "height": 844 }, "desktop": { "width": 1366, "height": 768 } } } ``` The model is recorded because changing models changes which `review/*` findings appear. When a wave of new AI findings shows up on an unrelated PR, `meta.json` usually explains it. ### Route slugs File names come from the route: lowercase, non-alphanumeric characters replaced with `_`, collapsed and trimmed. | Route | Slug | | --- | --- | | `/` | `index` | | `/pricing` | `pricing` | | `/blog/[slug]` | `blog__slug_` | | `/docs/api/v2` | `docs_api_v2` | ## Bootstrap mode When there is no baseline — first ever run, or a new app in a monorepo — Gribble enters **bootstrap mode**: - everything it finds is recorded as the known state rather than reported as new; - no PR comments are posted; - the gate passes; - `report.baseline.bootstrap` is `true`, so consumers can tell; - you are told to commit the result. ``` No baseline yet — this run is the baseline. 18 findings recorded as known. Commit .gribble/baseline/ so future runs have something to diff against. ``` Commit `.gribble/baseline/` on main and the next run is a real diff. Do not try to clean up all 18 findings before committing; the point of the baseline is that you do not have to. ## The baseline is read-only on pull requests A PR run never writes the baseline. If it did, a PR could quietly bless its own regressions, and the second run would find nothing wrong. The baseline is only updated from your default branch, after a merge. ## Update strategies `baseline.update` in `gribble.yaml`: ### `commit` (default) On a push to the default branch, the Action runs with `update-baseline: true` and commits `.gribble/baseline/` back to main with `[skip ci]`, the way a bot updates a lockfile. ```yaml # .github/workflows/gribble.yml on: push: branches: [main] permissions: contents: write jobs: baseline: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: gribble-dev/action@v1 with: update-baseline: true ``` ### `pr` Same run, but instead of pushing to main the Action opens a `chore: update gribble baseline` pull request. Use this when your default branch is protected against direct pushes, or when you want a human to eyeball baseline changes. You will need `pull-requests: write`. ### `manual` Gribble never writes the baseline in CI. You update it locally and commit it yourself: ```bash gribble baseline update git add .gribble/baseline git commit -m "chore: update gribble baseline" ``` ## Updating by hand Updating the baseline tells Gribble to stop mentioning everything it currently sees, so it is always a deliberate request. The [Gribble skill](/docs/skills) tells your coding agent never to hand-edit `.gribble/baseline/` and never to re-baseline unless you ask, because re-baselining to make a failing gate pass hides the regression instead of fixing it. Ask for it with a reason you can name: ```prompt We redesigned the pricing page on purpose and the structure regression findings are expected. Update the Gribble baseline from a fresh audit and show me what changed in .gribble/baseline/ before I commit it. ``` Or yourself, two equivalent ways: ```bash gribble audit --update-baseline # run an audit, then write the baseline from it gribble baseline update # same thing, shorthand ``` Both write `.gribble/baseline/` from the run that just finished. Neither commits anything — that is your call, every time. Reach for these when: - you deliberately accepted a regression and want to stop being told about it; - you rewrote a page and the aria snapshot and screenshots are legitimately different; - you changed viewports, routes or rule severities in a way that invalidates the old ledger; - you are onboarding a new app in a monorepo. Suppressing a **single** finding is a different job — use `gribble ignore ` instead of re-baselining everything. See [Findings](/docs/concepts/findings#suppression). ## Incremental runs With `gribble audit --changed`, Gribble uses the git diff to decide which routes a change can affect and audits only those. The comparison is then scoped to those routes' baseline entries: unvisited routes keep their existing findings and metrics untouched, and are never reported as fixed just because nobody looked. Full audits belong in nightly runs and before releases. ## Committing a baseline: practical notes - **Review the diff.** A baseline diff is a readable summary of what changed structurally. Do not rubber-stamp it. - **Expect churn on dynamic content.** A route that renders live data will produce screenshot noise. Raise `visual/regression`'s `threshold`, exclude the viewport, or set `baseline.screenshots: off` for that project. - **One baseline per app.** In a [monorepo](/docs/monorepos) each `.gribble/` has its own `baseline/`; the root `.gribble/` holds only shared rules and guidelines and has no baseline. - **Rebase conflicts happen.** Two PRs both updating the baseline will conflict in `findings.json`. Take main's version and re-run `gribble baseline update`; do not hand-merge the JSON. ```prompt The rebase conflicts in .gribble/baseline/findings.json. Take main's version of the baseline and regenerate it with Gribble instead of merging the JSON by hand. ``` --- # Findings What a finding contains, how its fingerprint is computed, how severity works, and how comments live and die. Source: https://gribble.dev/docs/concepts/findings.md A finding is one problem on one route. It is the unit everything else is built on: the baseline is a list of them, PR comments are one per finding, SARIF results map one-to-one, and the gate verdict is a function of them. ## Anatomy ```json { "fingerprint": "9f2c1d4a7b3e0c58", "rule": "links/broken", "severity": "error", "source": "deterministic", "status": "new", "title": "Internal link returns 404", "message": "The link to /docs/plans in the pricing table returns HTTP 404.", "route": "/pricing", "viewport": "desktop", "location": { "file": "src/components/PlanTable.tsx", "symbol": "PlanTable", "selector": "[data-testid=plan-compare-link]" }, "subject": "https://localhost:3000/docs/plans", "suggestion": "The page was renamed to /docs/pricing-plans in #812. Update the href or add a redirect.", "evidence": { "url": "http://localhost:3000/pricing", "snippet": "Compare plans" }, "docsUrl": "https://gribble.dev/rules/links/broken" } ``` | Field | Notes | | --- | --- | | `fingerprint` | Stable identity. 16 hex chars. Computed in code, never by a model. | | `rule` | Rule id, `category/name`. Always a real registry entry, including for AI findings (`review/*`). | | `severity` | `critical`, `error`, `warn` or `info`. | | `source` | `deterministic` or `ai`. | | `confidence` | 0–1, AI findings only. | | `status` | `new`, `existing` or `fixed`, filled by the baseline diff. | | `title` | One short line. Dry. | | `message` | The detail. Also dry. | | `route` | Normalized path, e.g. `/blog/[slug]`. | | `viewport` | `mobile`, `desktop` or a custom name, when the finding is viewport-specific. | | `location` | `file` + `symbol` where known, else `selector`, else a structural `path`. | | `subject` | Rule-specific key — the broken URL, the failing asset, the untranslated key. | | `suggestion` | How to fix it. | | `evidence` | Screenshot path, HTML snippet, page URL, or rule-specific data. | | `docsUrl` | `https://gribble.dev/rules/`, generated from the rule registry. | Note what `location` does **not** contain: a line number. Line numbers move every time somebody adds an import. File plus component or symbol name survives refactors, which is what a fingerprint needs. ## Fingerprints The fingerprint is the first 16 hex characters of a SHA-256 over five newline-joined parts: ``` rule + "\n" + targetName + "\n" + normalizedRoute + "\n" + locationKey + "\n" + subject ``` - **`rule`** — the rule id. - **`targetName`** — which app in a [monorepo](/docs/monorepos); empty for a single-app repo. Two apps with the same bug get different fingerprints. - **`normalizedRoute`** — lowercased, trailing slash stripped, query string dropped, and numeric or UUID path segments replaced with `[id]`. So `/Blog/Posts/1042?ref=x` and `/blog/posts/9971/` both normalize to `/blog/posts/[id]`. - **`locationKey`** — the most stable locator available, in order: `file#symbol`, then `selector`, then the structural `path`. - **`subject`** — the rule-specific key. For `links/broken` that is the target URL; for `network/failed-requests` the request URL; for `i18n/untranslated-keys` the leaked key. Everything in that list is chosen to survive irrelevant change and to differ on relevant change. A finding keeps its identity when you reformat the file, reorder the DOM, or paginate to a different id. It gets a new identity when the rule, the app, the page, the component or the specific thing being complained about changes. **Models never produce fingerprints.** When the agent reports a finding it must fill in structured fields — rule category, route, subject, title, location — and Gribble computes the hash from them. A model asked to produce a stable hash will produce a different one each run, and the entire comment lifecycle would collapse. ### Deduplication Exact fingerprint matches are collapsed first. AI findings get a second, fuzzy pass: same route, same rule, and normalized titles at least 0.85 similar are treated as one finding. This catches the model reporting "Button label is unclear" on one step and "The CTA text is ambiguous" on another. ### Sorting Findings are sorted by severity descending, then confidence descending, then deterministic before AI. That order governs the report, the terminal output and which findings survive the comment cap. ## Severity Five values in `rules.yaml`, four of which can appear on a finding. There is no implicit escalation anywhere: a rule set to `warn` produces `warn` findings, full stop. | Severity | Meaning | Typical rules | Gate | PR comment | | --- | --- | --- | --- | --- | | `critical` | The site is broken | `flows/replay`, `network/page-error`, `security/exposed-secrets` | **fail** | yes | | `error` | User-visible defect | broken links, unlabelled form fields, CLS over threshold | **fail** | yes | | `warn` | Quality regression | meta length, contrast, perf regression, all `review/*` | pass | yes | | `info` | Suggestion | style nits | pass | no, report only | | `off` | Disabled | — | — | — | The gate verdict is precise: `summary.gate` is `fail` when at least one **new** finding has severity `error` or `critical` **and** comes from a deterministic rule or from `flows/replay`. Existing findings never fail a build, and neither do AI findings under the default configuration. ### AI severity capping and the confidence floor The model returns a severity and a 0–1 confidence with each finding. Two things then happen before it reaches the report: 1. **Capping.** The severity is capped by the severity of the matching `review/` rule. `review/*` rules default to `warn`, so a model insisting a finding is `critical` still lands at `warn` and cannot fail your build. Raise `review/ux: error` in `rules.yaml` if you want that to change; you generally should not. 2. **The floor.** Findings with confidence below `review.min_confidence` (default `0.7`) are dropped entirely — not downgraded, dropped. They do not reach the report, the baseline or the comment cap. Raise `min_confidence` when review mode is noisy. Lower it when you are hunting and willing to sift. ## Comment lifecycle Gribble is stateless. There is no database and no service tracking your findings. State lives in exactly two places: the `findings.json` ledger on your default branch, and hidden HTML markers inside the PR comments themselves. **On a PR:** - One pinned **summary comment** carrying ``. Every subsequent run finds it by that marker and edits it in place, so the thread does not fill up with one summary per push. - One comment **per new finding**, carrying ``. When `location.file` is known it is posted as an inline review comment on that file; otherwise it is folded into the summary. **On re-run:** | Situation | What Gribble does | | --- | --- | | Fingerprint still present | Edits the existing comment, keeps the thread and any replies | | Fingerprint gone | Edits the comment to "patched ✅" and resolves the thread | | New fingerprint | Posts a new comment, up to the cap | | Fingerprint in the baseline ledger | Counts it in the summary, never comments | That last row is the diff-not-score principle in its most concrete form. Your existing 400 accessibility findings are a number in the summary, not 400 comments on a PR that touched the footer. **The cap** applies only to new findings. `review.max_comments` defaults to 5, sorted by severity, then confidence, then deterministic-first. Everything else lives in the report: > Showing 5 of 12 holes. The rest are in the full report. ## Suppression Two ways to make a finding go away without fixing it. Both are decisions for a person. Your coding agent will propose them and explain the trade-off, but the [Gribble skill](/docs/skills) tells it never to suppress a finding on its own: ```prompt Gribble flags the external link to our status page as broken, but it only fails from CI. Check whether it's a real problem, and if it isn't, tell me which fingerprint you would ignore and why instead of changing anything. ``` **Ignore one finding by fingerprint.** This is the precise tool — it suppresses exactly this problem on exactly this route, and a genuinely new instance elsewhere still gets reported. ```bash gribble ignore 9f2c1d4a7b3e0c58 ``` That appends to `ignore` in `rules.yaml`: ```yaml ignore: - 9f2c1d4a7b3e0c58 # external link behind a login wall, checked manually ``` Add the comment. In six months nobody will remember why the hash is there, and an unexplained suppression is indistinguishable from a mistake. **Turn the rule off**, globally or per route, in [rules.yaml](/docs/configuration/rules-yaml): ```yaml rules: seo/twitter-card: off overrides: - routes: ["/admin/**"] rules: seo/*: off ``` **Raise the confidence floor** to suppress a whole class of noisy AI findings: ```yaml review: min_confidence: 0.85 ``` ### Choosing between suppression and the baseline | You want | Use | | --- | --- | | This one finding never mentioned again | `gribble ignore ` | | This rule never mentioned on these routes | An `overrides` entry | | This rule never mentioned anywhere | Set it to `off` | | The current state accepted as the new normal | [`gribble baseline update`](/docs/concepts/baseline#updating-by-hand) | The baseline is for "yes, that is how things are today". Ignores are for "this is not a real problem". Keeping them separate is what keeps the ledger honest. --- # gribble.yaml Project settings — target URL, model, budgets, origins, environments, auth profiles, baseline and output. Source: https://gribble.dev/docs/configuration/gribble-yaml.md `.gribble/gribble.yaml` holds the settings somebody configures once and rarely touches: where the site is, how to start it, which model to use, and what the agent is allowed to do. It is committed. Rules live in a separate file. [`rules.yaml`](/docs/configuration/rules-yaml) is the part the team argues about and edits weekly; `gribble.yaml` is the part the person who installed Gribble set up on day one. Different cadence, different people, different file. **Secrets never go in this file.** Only environment variable names. ```prompt Add a preview environment to gribble.yaml that audits the URL in PREVIEW_URL without starting the dev server, and allow our *.vercel.app preview hosts. ``` ## What `gribble init` writes Init generates the minimum. Every other field exists and is validated, but is not written until you need it. ```yaml # yaml-language-server: $schema=https://gribble.dev/schema/gribble.json target: url: http://localhost:3000 # or ${PREVIEW_URL} start: pnpm dev # optional; Gribble waits until url responds routes: auto # auto (from framework) | crawl | [list of paths] model: # pi syntax, supports provider/id:thinking; chosen during init review: max_comments: 5 min_confidence: 0.7 # AI findings below this are dropped vision: false # enable the screenshot tool for the model budget: max_steps: 200 max_tokens: 2000000 allowed_origins: [localhost, "*.vercel.app"] # Later, when needed: environments, auth (see /docs/auth), baseline, viewports, output ``` ## Editor completion The first line is not decoration. With the YAML Language Server (built into VS Code's YAML extension, and available in Neovim, Zed and JetBrains IDEs) it gives you completion, inline documentation and validation as you type. ```yaml # yaml-language-server: $schema=https://gribble.dev/schema/gribble.json ``` The schema is generated from the same TypeBox definitions Gribble validates with, so it can never drift from what the parser accepts. `rules.yaml` has its own at `https://gribble.dev/schema/rules.json`. ## Full reference ### `target` Where the site under audit lives. | Field | Type | Default | Description | | --- | --- | --- | --- | | `target.url` | string | — | **Required.** The base URL to audit. `${VAR}` interpolation allowed. | | `target.start` | string | — | Command to start the site. Run before the audit; Gribble waits for `url` to respond, then shuts it down afterwards. If it exits mid-audit and `url` stops answering, the audit stops with exit code `4` and prints the command's last output. Omit when the URL is already up. | | `target.routes` | `auto` \| `crawl` \| string[] | `auto` | `auto` reads your framework's routes (Next.js app directory, React Router, Nuxt pages). `crawl` follows links from the base URL. An explicit list audits exactly those paths. | | `target.readyTimeoutMs` | number | `120000` | How long to wait for `url` to respond after running `start`. | | `target.maxConnectionFailures` | number | `3` | Stop the audit when this many routes in a row fail with a connection error (refused, reset, empty response): the server is gone and every later route would fail the same way. `0` disables the check. | ```yaml target: url: ${PREVIEW_URL} routes: - / - /pricing - /blog/[slug] - /docs/getting-started ``` An explicit list is the fastest and most predictable option, and the one to reach for when `auto` picks up hundreds of generated routes. Bracketed segments are matched against real URLs, and one representative page per pattern is audited. `auto` normalizes framework syntax into those same bracketed patterns. **Optional segments expand to every path they serve.** A segment the URL may omit is discovered in both forms, absent first: SvelteKit `[[lang]]/about/+page.svelte` and Remix `($lang).about.tsx` are both discovered as `/about` **and** `/[lang]/about`, and an optional catch-all such as Next.js `app/docs/[[...slug]]/page.tsx` as `/docs` **and** `/docs/[...slug]`. The canonical pages of an i18n site are audited alongside the prefixed ones. A route with many optional segments is capped rather than expanded combinatorially: past the cap only the all-absent and all-present forms are kept. **Framework-specific syntax is dropped.** SvelteKit parameter matchers go, so `[lang=locale]` is discovered as `[lang]` and renaming a matcher in `src/params/` does not orphan your baseline. Next.js intercepting routes (`(.)photo`) are skipped: they re-render a route that already exists elsewhere in the tree rather than adding a URL of their own. Rest parameters match zero or more segments, matching how the frameworks route them, so a configured `/docs/[...slug]` also covers `/docs` itself. List HTML pages only. Sitemaps, feeds, JSON endpoints and other non-HTML responses do not belong in `target.routes`: the page rules (`html/*`, `seo/*`, `links/*`, `ui/*`, `i18n/*`, `a11y/*`, `perf/*`) have nothing to judge there, so Gribble skips them for any route whose `Content-Type` is not HTML and records the skip under `notRun` in the report. Nothing is lost by leaving the sitemap out: `seo/sitemap` is a site-wide rule that fetches `/sitemap.xml` itself and compares it with the audited routes. ### `model` | Field | Type | Default | Description | | --- | --- | --- | --- | | `model` | string | — | `provider/id` or `provider/id:thinking`, pi syntax. Chosen during init. | Committing the model is deliberate: your whole team and your CI then run the same audit, and `review/*` findings stay comparable across runs. When the configured provider has no credentials on the current machine, Gribble fails with exit code 2 and tells you to run `gribble login `. Leave it out and Gribble falls back to `~/.gribble/settings.json`, then to the first model with valid auth, with a warning. See [Auth](/docs/auth#part-2-model-provider-auth). ### `review` Controls the AI half of an audit. Has no effect in `--mode gate`. | Field | Type | Default | Description | | --- | --- | --- | --- | | `review.max_comments` | number | `5` | Maximum PR comments for **new** findings. Everything else stays in the report. | | `review.min_confidence` | number | `0.7` | AI findings below this confidence are dropped entirely. | | `review.vision` | boolean | `false` | Hands the `screenshot` tool to the model. Off by default — the model reads structured page snapshots, which are more accurate than pixels for colours, sizes and names. | | `review.explore` | boolean | `true` | Lets the agent visit routes no flow describes, looking for dead ends and missing states. Set `false` to restrict review to your flows. | ### `budget` Hard caps per audit. When one is hit the run ends cleanly and reports what it has. | Field | Type | Default | Description | | --- | --- | --- | --- | | `budget.max_steps` | number | `200` | Maximum agent steps (tool calls plus model turns). | | `budget.max_tokens` | number | `2000000` | Maximum tokens across the whole audit. | | `budget.max_cost_usd` | number | — | Optional dollar ceiling, using pi's model pricing table. | Every audit prints its actual usage at the end, and the numbers are in `report.budget`. Start with the defaults, look at what a real run costs on your site, then tighten. ### `allowed_origins` | Field | Type | Default | Description | | --- | --- | --- | --- | | `allowed_origins` | string[] | `[]` | Hostnames or globs the agent may navigate to, in addition to the target host, which is always allowed. | ```yaml allowed_origins: - localhost - "*.vercel.app" - "*.mycompany-staging.com" ``` This is a guardrail, not a convenience. The agent cannot navigate outside it, which is what keeps a curious model from wandering onto your production site, a payment provider, or somebody else's server entirely. External link checking is unaffected — `links/broken-external` issues HTTP requests, it does not drive the browser there. ### `environments` Named blocks deep-merged over the top level when you pass `--env `. | Field | Type | Default | Description | | --- | --- | --- | --- | | `environments.` | object | — | A partial `gribble.yaml` merged over the root config. Any top-level field may be overridden. | | `environments..rules` | object | — | Rule settings for this environment only, in the same shape as `rules` in [`rules.yaml`](/docs/configuration/rules-yaml#rules). Applied after presets, the cascade and per-route `overrides`. | ```yaml target: url: http://localhost:3000 start: pnpm dev allowed_origins: [localhost] environments: preview: target: url: ${VERCEL_PREVIEW_URL} start: null # nothing to start; the URL is already live allowed_origins: [localhost, "*.vercel.app"] review: max_comments: 3 staging: target: url: https://staging.example.com start: null auth: profiles: user: type: cookie name: session env: { value: GRIBBLE_STAGING_COOKIE } ``` ```bash gribble audit --env preview ``` The merge is deep: `environments.preview.target.url` replaces `target.url` and leaves `target.routes` alone. The selected environment name ends up in `report.target.environment`, so reports from different environments are distinguishable. #### `environments..rules` Rule severities are the one thing `rules.yaml` cannot vary per environment: its `overrides` are keyed on routes and its cascade on directories. `environments..rules` fills that gap. It takes the same map as `rules` in `rules.yaml` (severities, `[severity, { options }]` pairs and `category/*` wildcards, validated against the same rule ids) and is applied last, after presets, the directory cascade and every per-route `overrides` block, but only when that environment is selected with `--env`. The classic case is a preview deployment that sends `X-Robots-Tag: noindex` by design. `seo/robots-noindex` is exactly right for production and pure noise on every PR: ```yaml environments: preview: target: url: ${PREVIEW_URL} rules: seo/robots-noindex: off ``` `gribble audit --env preview` now skips that rule; `gribble audit` against production keeps it on. `gribble explain seo/robots-noindex --env preview` prints the effective severity and names what set it, so a rule you cannot account for is one command away. Everything else in `rules.yaml` still applies to both. A rule an environment switches off stays off on every route, even where a route override in `rules.yaml` turns it on; a rule it switches on is reported the same way as any other. ### `auth` Auth profiles for the **site under test** — not for your model provider. Full treatment in [Auth](/docs/auth). | Field | Type | Default | Description | | --- | --- | --- | --- | | `auth.profiles..type` | `flow` \| `cookie` \| `header` \| `command` | — | How to obtain the logged-in state. | | `auth.profiles..flow` | string | — | `type: flow`. Path to a login flow Markdown file. | | `auth.profiles..command` | string | — | `type: command`. Command printing a Playwright storage state JSON to stdout. | | `auth.profiles..name` | string | — | `type: cookie` / `header`. The cookie or header name. | | `auth.profiles..env` | object | — | Map of logical field name to **environment variable name**. Never a value. | ```yaml auth: profiles: user: type: flow flow: flows/auth/login.md env: { email: GRIBBLE_USER_EMAIL, password: GRIBBLE_USER_PASSWORD } admin: type: command command: pnpm exec ./scripts/admin-session.ts readonly: type: cookie name: session env: { value: GRIBBLE_COOKIE } api: type: header name: Authorization env: { value: GRIBBLE_TOKEN } ``` A flow claims a profile with `requires_auth: user` in its frontmatter. ### `baseline` | Field | Type | Default | Description | | --- | --- | --- | --- | | `baseline.screenshots` | `commit` \| `lfs` \| `off` | `off` | How baseline screenshots are stored. Set `commit` (small sites) or `lfs` (large sites) when you enable `visual/regression`; `off` disables it. | | `baseline.update` | `commit` \| `pr` \| `manual` | `commit` | How the baseline is refreshed after a merge. `commit` pushes to the default branch with `[skip ci]`; `pr` opens a chore PR; `manual` leaves it to you. | See [Baseline](/docs/concepts/baseline). ### `coverage` By default a run that could not reach part of the site still passes when it found nothing new; the report and the terminal label it `incomplete` (see [`completeness`](/docs/report-format#completeness)). `coverage.required` turns missing coverage into a gate failure, for projects that want CI to insist on it. Everything is off by default. | Field | Type | Default | Description | | --- | --- | --- | --- | | `coverage.required.routes` | boolean | `false` | Fail when a requested route was not checked: unreachable, unresolved dynamic route, aborted run. | | `coverage.required.flows` | boolean \| string[] | `false` | Fail when a flow in scope did not execute. `true` means every flow; a list names the flows that must run. A flow limited to another environment is excluded, not missing. A flow that ran and failed is already a `flows/replay` finding. | | `coverage.required.checks` | boolean | `false` | Fail when a check did not run for an unexpected reason (Lighthouse did not start, a check threw). Intentional omissions such as page rules on a sitemap never count. | | `coverage.required.baseline` | boolean | `false` | Fail unless findings were compared with an established baseline. A bootstrap run, which passes by default, then fails. | ```yaml coverage: required: routes: true flows: [login, checkout] # replayed in gate mode, so they need a replay sidecar ``` The AI review is never required: a review that runs out of budget is labeled `incomplete` and stays advisory. `coverage` can be set per environment, e.g. only under `environments.ci`. ### `viewports` | Field | Type | Default | Description | | --- | --- | --- | --- | | `viewports..width` | number | see below | Viewport width in CSS pixels. | | `viewports..height` | number | see below | Viewport height in CSS pixels. | ```yaml viewports: mobile: { width: 390, height: 844 } desktop: { width: 1366, height: 768 } ``` Those two are the defaults. Add your own names freely — rules that take a `viewports` option, like `ui/horizontal-overflow` and `visual/regression`, refer to these names. Every extra viewport multiplies screenshot and Lighthouse work, so add them with intent. ### `output` | Field | Type | Default | Description | | --- | --- | --- | --- | | `output.dir` | string | `.gribble/runs` | Where run directories are written. | | `output.keep` | number | `10` | How many run directories to keep before pruning the oldest. | `.gribble/runs/latest.json` is always written, whatever `dir` says, because that is the path the [skill](/docs/skills) and your coding agent look for. ### `reusePiAuth` | Field | Type | Default | Description | | --- | --- | --- | --- | | `reusePiAuth` | boolean | `false` | Use `~/.pi/agent/` for model credentials instead of `~/.gribble/`. | For people who already use pi and do not want a second login. It only affects where auth and model files are read from; Gribble still uses its own system prompt, tools and guardrails. `GRIBBLE_HOME` overrides the directory either way. ## `${VAR}` interpolation Any string value may reference an environment variable: ```yaml target: url: ${PREVIEW_URL} ``` Rules: - Interpolation happens at load time, in string values only. - A referenced variable that is not set is a **hard error**, and the message names the variable: ``` Config error at target.url: environment variable PREVIEW_URL is not set. ``` Failing loudly beats auditing `http://undefined/` and reporting that every route is broken. - This is for values that vary per machine or per run — preview URLs, ports, hostnames. **It is not for secrets.** Secrets go in `auth.profiles.*.env`, which takes variable *names* and reads them at the moment they are used, so they never pass through the config object or a session log. ## Validation Config is validated on every command. Errors carry a path and a message: ``` Config error at review.min_confidence: expected number between 0 and 1, got "high". Config error at target: required property "url" is missing. ``` Any config or auth failure exits with code `2`, distinct from `1`, which means the gate found something. CI can tell "your site has a problem" apart from "your setup has a problem". ## A fuller example ```yaml # yaml-language-server: $schema=https://gribble.dev/schema/gribble.json target: url: http://localhost:3000 start: pnpm dev routes: auto readyTimeoutMs: 180000 model: review: max_comments: 5 min_confidence: 0.75 vision: false explore: true budget: max_steps: 200 max_tokens: 2000000 max_cost_usd: 2.00 allowed_origins: [localhost, "*.vercel.app"] auth: profiles: user: type: flow flow: flows/auth/login.md env: { email: GRIBBLE_USER_EMAIL, password: GRIBBLE_USER_PASSWORD } baseline: screenshots: commit update: commit viewports: mobile: { width: 390, height: 844 } desktop: { width: 1366, height: 768 } output: dir: .gribble/runs keep: 10 reusePiAuth: false environments: preview: target: url: ${VERCEL_PREVIEW_URL} start: null review: max_comments: 3 rules: seo/robots-noindex: off ``` --- # rules.yaml ESLint-style rule configuration — extends, ignore, severities, options and per-route overrides. Source: https://gribble.dev/docs/configuration/rules-yaml.md `.gribble/rules.yaml` is the file your team actually edits. It borrows ESLint's shape on purpose: if you have configured ESLint you already know how this works. ```yaml # yaml-language-server: $schema=https://gribble.dev/schema/rules.json extends: - gribble:recommended ignore: [] rules: seo/meta-description: [warn, { min: 50, max: 160 }] perf/lcp: [error, { maxMs: 2500 }] seo/twitter-card: off overrides: - routes: ["/admin/**"] rules: seo/*: off ``` Every rule id, its options and its defaults per preset are listed in the [rules reference](/docs/configuration/rules-reference), which is generated from the registry in the source and is therefore always current. Most edits to this file start as a sentence about a standard. Your coding agent knows the rule ids, reads `gribble explain` for the options, and knows when a standard belongs in [`guidelines.md`](/docs/guidelines) instead: ```prompt Make an LCP over 2.5 seconds a Gribble error on every page, and a missing meta description an error on blog posts only. ``` ```prompt Turn off the SEO checks for everything under /admin in Gribble's rules.yaml; nobody searches for our admin dashboard. ``` Or by hand, starting with the structure below. ## Structure ### `extends` A list of presets to start from, applied in order, each one layering over the last. Your own `rules` block layers over all of them. ```yaml extends: - gribble:recommended - gribble:a11y ``` `gribble init` writes `gribble:recommended`. ### `ignore` Finding [fingerprints](/docs/concepts/findings#fingerprints) to suppress. Usually appended by `gribble ignore ` rather than typed by hand. ```yaml ignore: - 9f2c1d4a7b3e0c58 # external link behind a paywall, verified manually 2025-03-02 - 1b77e0c9ad4f2e31 # legacy admin table, rewrite tracked in #914 ``` Always leave a comment. An unexplained hash is indistinguishable from a mistake, and six months from now nobody will dare delete it. ### `rules` A map of rule id to either a severity or a `[severity, options]` pair. ```yaml rules: links/broken: error links/broken-external: [warn, { timeout: 10000, ignore: ["linkedin.com"] }] network/console-warnings: off ``` Options are merged over the rule's defaults, so you only write what differs. Wildcards work here as well as in overrides: ```yaml rules: i18n/*: off ``` More specific keys win over wildcards regardless of order, so `i18n/*: off` plus `i18n/untranslated-keys: warn` leaves exactly that one rule on. ### `overrides` Per-route adjustments, applied after everything else. Later entries win over earlier ones. ```yaml overrides: - routes: ["/admin/**", "/internal/**"] rules: seo/*: off perf/lighthouse-performance: off - routes: ["/blog/**"] rules: seo/meta-description: error seo/open-graph: error ``` `routes` are glob patterns matched against the normalized route: `*` matches within a segment, `**` crosses segments. Patterns are matched against the pattern form of dynamic routes too, so `/blog/**` covers `/blog/[slug]`. Nobody needs Open Graph tags on an internal admin dashboard, and everybody needs them on a blog post. This is where that lives. ### Per-environment settings Something that is wrong for one deployment and right for another — a preview that sends `noindex` on purpose, say — is not a route thing, so it does not go in `overrides`. It goes in [`environments..rules`](/docs/configuration/gribble-yaml#environments-name-rules) in `gribble.yaml`, which takes this same `rules` map and is applied on top of everything here when that environment is selected with `--env`. `gribble explain --env ` shows the effective severity for that environment and where it came from. ## Severity semantics There are five values, and no implicit escalation anywhere. A rule set to `warn` produces `warn` findings, always. | Severity | Meaning | Gate | PR comment | | --- | --- | --- | --- | | `critical` | The site is broken | **fail** | yes | | `error` | User-visible defect | **fail** | yes | | `warn` | Quality regression | pass | yes | | `info` | Suggestion | pass | no, report only | | `off` | Rule disabled | — | — | The boundary between gate and review is **just severity**. There is no separate "which mode does this rule belong to" setting: set a rule to `error` and it can block a merge, set it to `warn` and it comments. That is the whole mechanism. Two things qualify it: - Only **new** findings can fail the gate. Findings already in the [baseline](/docs/concepts/baseline) are counted, never blocking. - AI findings are capped by their matching `review/*` rule severity, which defaults to `warn`. See [Findings](/docs/concepts/findings#ai-severity-capping-and-the-confidence-floor). ## The four presets ### `gribble:recommended` The default, and what `gribble init` writes. It aims at "a reasonable team would agree this is a bug": broken internal links are `error`, a route that 5xxs is `critical`, serious and critical axe violations are `error`, missing alt text and unlabelled form fields are `error`, LCP and CLS have `error` thresholds, placeholder text shipped to production is `error`, exposed secrets are `critical`, flow replay failures are `critical`. Softer things are `warn`: external link problems, meta description length, heading order, canonical, colour contrast, touch target size, Lighthouse score, page weight, design-token deviations, and every `review/*` rule. Genuinely subjective or noisy rules — `seo/twitter-card`, `a11y/skip-link`, `html/valid`, `security/form-without-csrf`, `ui/spacing-from-tokens`, `i18n/mixed-language` — ship `off`, and so does every rule that has no checker yet, so that a fresh install has nothing to warn about. The expanded form is printed in full below. ### `gribble:strict` Recommended with the dial turned up. Most `warn` rules become `error`, several rules that are `off` in recommended come on, and thresholds tighten — stricter perf budgets, contrast at the higher level, HTML validation enabled, security headers required. Use it on a new project where the cost of staying clean is low, or on a marketing site where quality is the product. Applying it to an established codebase will produce a very large first baseline, which is fine, but expect it. ### `gribble:seo` A focused overlay: everything under `seo/*` on and turned up, plus the parts of `perf/*` and `html/*` that affect crawling and indexing. Accessibility and UI rules are left where they are. Meant to be combined, not used alone: ```yaml extends: - gribble:recommended - gribble:seo ``` ### `gribble:a11y` The accessibility overlay. Widens the axe run to more tag sets and impact levels, and keeps contrast and touch target size on. Rules with no checker yet stay `off` here too. Reach for it when you have a WCAG commitment to meet rather than a general quality bar. Presets are data, not magic. A preset is just a map of rule id to setting, layered in order, and anything you write in your own `rules` block wins. ## Full example This is `gribble:recommended` written out, which doubles as a tour of the rule catalogue. You never need to write this — `extends: [gribble:recommended]` is equivalent — but it is useful to see what you are getting. ```yaml # yaml-language-server: $schema=https://gribble.dev/schema/rules.json extends: - gribble:recommended ignore: [] # finding fingerprints, added via `gribble ignore ` rules: # --- Links & network --- links/broken: error # internal 4xx/5xx links/broken-external: [warn, { timeout: 10000, ignore: ["linkedin.com"] }] links/redirect-chain: [warn, { max: 1 }] links/empty-href: warn # href="#" / javascript:void(0) links/target-blank-noopener: warn network/page-error: critical # route itself returns 5xx or crashes on render network/failed-requests: error # any failed XHR/fetch/asset network/console-errors: [error, { ignore: ["ResizeObserver loop"] }] network/console-warnings: off network/large-assets: [warn, { maxKb: 500 }] network/request-count: [warn, { max: 100 }] # --- SEO --- seo/title: [error, { min: 10, max: 60 }] seo/duplicate-title: warn seo/meta-description: [warn, { min: 50, max: 160 }] seo/single-h1: error seo/heading-order: warn # no skipped levels seo/canonical: warn seo/robots-noindex: [error, { allow: ["/admin/**", "/preview/**"] }] # flags accidental noindex seo/robots-txt: warn seo/sitemap: warn # exists, valid, covers discovered routes seo/lang-attribute: error seo/open-graph: warn seo/twitter-card: off seo/structured-data: warn # JSON-LD parses and validates seo/hreflang: off seo/url-format: [warn, { lowercase: true, trailingSlash: consistent }] # --- Accessibility --- a11y/axe: [error, { impact: [critical, serious], tags: [wcag2a, wcag2aa], disable: [] }] a11y/img-alt: error a11y/form-labels: error a11y/accessible-name: error # buttons/links with no name a11y/color-contrast: [warn, { level: AA }] a11y/focus-visible: off # no checker yet a11y/keyboard-reachable: off # no checker yet; reachable via Tab a11y/touch-target: [warn, { minPx: 44 }] a11y/skip-link: off a11y/reduced-motion: off # --- Performance (Lighthouse + traces) --- perf/lighthouse-performance: [warn, { min: 80 }] perf/lcp: [error, { maxMs: 2500 }] perf/cls: [error, { max: 0.1 }] perf/tbt: [warn, { maxMs: 200 }] perf/page-weight: [warn, { maxKb: 2000 }] perf/unsized-images: warn # missing width/height -> CLS perf/image-format: warn # prefer webp/avif perf/render-blocking: off perf/regression: [warn, { score: -5, lcpMs: 500, cls: 0.05, weightKb: 300 }] # vs baseline # --- UI hard rules (computed styles vs design tokens, layout math done in code) --- ui/colors-from-tokens: [warn, { tokens: auto }] # auto = tailwind.config / CSS vars ui/font-sizes-from-tokens: warn ui/spacing-from-tokens: off ui/min-font-size: [warn, { px: 12 }] ui/overlap: error # interactive elements overlapping ui/horizontal-overflow: [error, { viewports: [mobile] }] ui/text-clipped: warn ui/broken-images: error ui/placeholder-text: [error, { patterns: ["lorem ipsum", "TODO", "FIXME", "placeholder"] }] ui/favicon: warn ui/empty-state: off # lists/tables rendering with zero rows visual/regression: [warn, { threshold: 0.01, viewports: [mobile, desktop] }] # pixel diff vs baseline structure/regression: warn # aria snapshot diff vs baseline # --- HTML --- html/doctype: error html/charset: error html/viewport-meta: error html/duplicate-ids: error html/deprecated-elements: off # no checker yet html/valid: [off, { ignore: [] }] # noisy by default # --- Security --- security/https-only: error security/mixed-content: error security/headers: [warn, { require: [content-security-policy, x-content-type-options, strict-transport-security] }] security/exposed-secrets: critical # API-key patterns in HTML/JS security/sourcemaps-exposed: warn security/form-without-csrf: off # --- i18n --- i18n/untranslated-keys: [warn, { patterns: ["^[a-z]+(\\.[a-z_]+)+$"] }] # raw keys leaking into UI i18n/mixed-language: off i18n/lang-mismatch: off # html lang vs detected content language # --- Flows (replay of recorded steps) --- flows/replay: critical flows/max-duration: [warn, { seconds: 60 }] # --- Review (AI findings map to these severities; never block by default) --- review/guidelines: warn # violations of guidelines.md review/ux: warn # confusing interactions, unclear states review/copy: warn # typos, tone, inconsistent terminology review/dead-ends: warn # pages with no way back, broken navigation review/flow-coverage: warn # important flows not described in flows/ review/error-handling: warn # missing error/empty/loading states overrides: - routes: ["/admin/**", "/internal/**"] rules: seo/*: off perf/lighthouse-performance: off - routes: ["/blog/**"] rules: seo/meta-description: error seo/open-graph: error ``` ## Not every rule is implemented yet The registry contains the whole catalogue above, but the first release implements a subset. Rules that are registered but not yet implemented are marked in the [rules reference](/docs/configuration/rules-reference) and are inert — configuring one is valid YAML and costs you nothing, it just does not produce findings yet. So that this cannot pass for "on and clean", `gribble audit` prints one warning at startup naming every enabled rule that has no checker: ``` 3 enabled rules have no checker yet and will not run: a11y/skip-link, html/valid, i18n/mixed-language. Planned (accepted in rules.yaml, no checker yet); see gribble explain . ``` No built-in preset switches such a rule on, so a configuration that only extends `gribble:recommended` never prints that line; it appears once you enable one yourself. Implemented today: all of `links/*` and `network/*`, all of `seo/*`, `a11y/axe` with `img-alt`, `form-labels` and `accessible-name` derived from it, `perf/lighthouse-performance`, `perf/lcp`, `perf/cls`, `perf/tbt`, `perf/page-weight`, `perf/regression`, `ui/placeholder-text`, `visual/regression`, `structure/regression`, all of `html/doctype|charset|viewport-meta|duplicate-ids`, `security/https-only`, `security/mixed-content`, `security/exposed-secrets`, `i18n/untranslated-keys`, `flows/replay`, `flows/max-duration` and all of `review/*`. ## Explaining a rule ```bash gribble explain a11y/touch-target ``` Prints the description, the option schema with defaults, its severity in each preset, a bad and a good example, and the fix hint — the same registry metadata that generates the reference page and the `docsUrl` on every finding. ## Cascading in a monorepo `rules.yaml` files cascade from the repository root down to each app, child overriding parent. See [Monorepos](/docs/monorepos). ## Where a rule does not belong - Something a model has to judge — "error messages should be friendly", "the tone should be restrained" — cannot be a rule. It goes in [`guidelines.md`](/docs/guidelines). - Where the site is, which model to use, how much to spend — that is [`gribble.yaml`](/docs/configuration/gribble-yaml). - One specific finding you do not care about is an `ignore` entry, not a disabled rule. --- # Rules reference Every rule Gribble knows, with options, preset defaults and fix hints. Source: https://gribble.dev/docs/configuration/rules-reference.md Every rule has an id of the form `category/name`. Set it in `.gribble/rules.yaml` to a severity (`off`, `info`, `warn`, `error`, `critical`) or to `[severity, { options }]`. `error` and `critical` fail the gate; `warn` and `info` never block. Findings link here as `https://gribble.dev/rules/`. Presets: `gribble:recommended`, `gribble:strict`, `gribble:seo`, `gribble:a11y`. `gribble init` extends `gribble:recommended`. ## Contents - **Links**: [links/broken](#links-broken), [links/broken-external](#links-broken-external), [links/redirect-chain](#links-redirect-chain), [links/empty-href](#links-empty-href), [links/target-blank-noopener](#links-target-blank-noopener) - **Network**: [network/page-error](#network-page-error), [network/failed-requests](#network-failed-requests), [network/console-errors](#network-console-errors), [network/console-warnings](#network-console-warnings), [network/large-assets](#network-large-assets), [network/request-count](#network-request-count) - **SEO**: [seo/title](#seo-title), [seo/duplicate-title](#seo-duplicate-title), [seo/meta-description](#seo-meta-description), [seo/single-h1](#seo-single-h1), [seo/heading-order](#seo-heading-order), [seo/canonical](#seo-canonical), [seo/robots-noindex](#seo-robots-noindex), [seo/robots-txt](#seo-robots-txt), [seo/sitemap](#seo-sitemap), [seo/lang-attribute](#seo-lang-attribute), [seo/open-graph](#seo-open-graph), [seo/twitter-card](#seo-twitter-card), [seo/structured-data](#seo-structured-data), [seo/hreflang](#seo-hreflang), [seo/url-format](#seo-url-format) - **Accessibility**: [a11y/axe](#a11y-axe), [a11y/img-alt](#a11y-img-alt), [a11y/form-labels](#a11y-form-labels), [a11y/accessible-name](#a11y-accessible-name), [a11y/color-contrast](#a11y-color-contrast), [a11y/focus-visible](#a11y-focus-visible), [a11y/keyboard-reachable](#a11y-keyboard-reachable), [a11y/touch-target](#a11y-touch-target), [a11y/skip-link](#a11y-skip-link), [a11y/reduced-motion](#a11y-reduced-motion) - **Performance**: [perf/lighthouse-performance](#perf-lighthouse-performance), [perf/lcp](#perf-lcp), [perf/cls](#perf-cls), [perf/tbt](#perf-tbt), [perf/page-weight](#perf-page-weight), [perf/unsized-images](#perf-unsized-images), [perf/image-format](#perf-image-format), [perf/render-blocking](#perf-render-blocking), [perf/regression](#perf-regression) - **UI hard rules**: [ui/colors-from-tokens](#ui-colors-from-tokens), [ui/font-sizes-from-tokens](#ui-font-sizes-from-tokens), [ui/spacing-from-tokens](#ui-spacing-from-tokens), [ui/min-font-size](#ui-min-font-size), [ui/overlap](#ui-overlap), [ui/horizontal-overflow](#ui-horizontal-overflow), [ui/text-clipped](#ui-text-clipped), [ui/broken-images](#ui-broken-images), [ui/placeholder-text](#ui-placeholder-text), [ui/favicon](#ui-favicon), [ui/empty-state](#ui-empty-state) - **Visual regression**: [visual/regression](#visual-regression) - **Structure regression**: [structure/regression](#structure-regression) - **HTML**: [html/doctype](#html-doctype), [html/charset](#html-charset), [html/viewport-meta](#html-viewport-meta), [html/duplicate-ids](#html-duplicate-ids), [html/deprecated-elements](#html-deprecated-elements), [html/valid](#html-valid) - **Security**: [security/https-only](#security-https-only), [security/mixed-content](#security-mixed-content), [security/headers](#security-headers), [security/exposed-secrets](#security-exposed-secrets), [security/sourcemaps-exposed](#security-sourcemaps-exposed), [security/form-without-csrf](#security-form-without-csrf) - **Internationalization**: [i18n/untranslated-keys](#i18n-untranslated-keys), [i18n/mixed-language](#i18n-mixed-language), [i18n/lang-mismatch](#i18n-lang-mismatch) - **Flows**: [flows/replay](#flows-replay), [flows/max-duration](#flows-max-duration) - **AI review**: [review/guidelines](#review-guidelines), [review/ux](#review-ux), [review/copy](#review-copy), [review/dead-ends](#review-dead-ends), [review/flow-coverage](#review-flow-coverage), [review/error-handling](#review-error-handling) ## Links ### links/broken Internal links must not resolve to a 4xx or 5xx response. Every same-origin anchor, image, script and stylesheet reference is requested. A response of 400 or above, a connection failure or a timeout is reported with the link target as the subject. A same-origin link that redirects to another origin is judged by where it lands: its failure belongs to `links/broken-external`, not this rule. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Point the link at an existing route or asset, or remove it. For moved pages add a redirect instead of leaving a dead link. Bad: ```html Pricing ``` Good: ```html Pricing ``` ### links/broken-external External links must respond. Links to other origins are requested with a HEAD (falling back to GET) request. Hosts listed in `ignore` are skipped, and 403, 429 and 999 responses are treated as inconclusive, since some sites block automated requests; this rule defaults to warn. The same treatment applies to a same-origin link that redirects off-site (an affiliate `/go/partner` hop, say): the final host is checked against `ignore`, and a failure is reported here with the same-origin link as the subject. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"timeout":10000,"ignore":["linkedin.com"]}]` | | `gribble:strict` | `[error, {"timeout":10000,"ignore":["linkedin.com"]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `timeout` | integer | `10000` | Per-request timeout in milliseconds. | | `ignore` | string[] | `["linkedin.com"]` | Hostnames (or globs) that are never checked, directly or as the target of a same-origin redirect, e.g. sites that block bots. | **Fix:** Update or remove the link. If the host blocks automated requests, add it to `ignore`. ### links/redirect-chain Links must not go through more than `max` redirects. Each redirect adds a round trip and loses link equity. The rule counts the hops between the link target and the final 2xx response. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"max":1}]` | | `gribble:strict` | `[error, {"max":1}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `max` | integer | `1` | Maximum number of redirects allowed. | **Fix:** Link directly to the final URL. ### links/empty-href Anchors must have a real destination. Reports `href="#"`, `href="javascript:void(0)"` and anchors without an href. These are usually buttons in disguise, which breaks keyboard access and "open in new tab". **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Use a ` ``` ### links/target-blank-noopener `target="_blank"` links must set `rel="noopener"`. Without `noopener`, the opened page gets a reference to the opener window (reverse tabnabbing in older browsers). Modern browsers imply it, but the attribute keeps behaviour consistent. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add rel="noopener noreferrer" to the anchor. Bad: ```html Docs ``` Good: ```html Docs ``` ## Network ### network/page-error The route itself must load. The route's document response returned 5xx, the navigation failed, or the page threw an uncaught exception while rendering. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `critical` | | `gribble:strict` | `critical` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Open the route locally and read the server log or the browser console; this is a crash, not a nit. ### network/failed-requests No request made by the page may fail. Any XHR, fetch, image, font, script or stylesheet request that fails (network error or status 400+) during load and interaction is reported with the request URL as the subject. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Fix the endpoint or asset path, or remove the request. Third-party failures can be excluded via `ignore` on network/console-errors if they only surface as console noise. ### network/console-errors The browser console must stay free of errors. `console.error` calls and uncaught exceptions during load and interaction are reported. Messages matching an `ignore` pattern (substring or regular expression) are skipped. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"ignore":["ResizeObserver loop"]}]` | | `gribble:strict` | `[error, {"ignore":["ResizeObserver loop"]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `ignore` | string[] | `["ResizeObserver loop"]` | Substrings or regular expressions of messages to ignore. | **Fix:** Fix the source of the error. Add known-benign third-party messages to `ignore`. ### network/console-warnings The browser console must stay free of warnings. `console.warn` calls during load and interaction are reported. Noisy by default, so it is off. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Address the warning or turn the rule off for the route. ### network/large-assets No single asset may exceed `maxKb`. Transfer size of every response is measured; anything over the limit is reported with its URL. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"maxKb":500}]` | | `gribble:strict` | `[error, {"maxKb":500}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `maxKb` | number | `500` | Maximum transfer size per asset in kilobytes. | **Fix:** Compress or resize the asset, split the bundle, or lazy-load it. ### network/request-count A route may not issue more than `max` requests on load. Counts every request made until the page is idle. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"max":100}]` | | `gribble:strict` | `[error, {"max":100}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `max` | integer | `100` | Maximum number of requests during page load. | **Fix:** Bundle assets, use sprites or inline small resources, remove unused third-party scripts. ## SEO ### seo/title Every page needs a `` within the configured length. A missing, empty, too short or too long document title is reported. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"min":10,"max":60}]` | | `gribble:strict` | `[error, {"min":10,"max":60}]` | | `gribble:seo` | `[error, {"min":10,"max":60}]` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `min` | integer | `10` | Minimum title length in characters. | | `max` | integer | `60` | Maximum title length in characters. | **Fix:** Set a descriptive <title> per route, typically `Page name – Site name`. <a id="seo-duplicate-title"></a> ### seo/duplicate-title Titles must be unique across routes. Two or more audited routes share the same `<title>`. Search engines and tab bars cannot tell them apart. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Include the page-specific subject in each title. <a id="seo-meta-description"></a> ### seo/meta-description Every page needs a meta description within the configured length. A missing, empty, too short or too long `<meta name="description">` is reported. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"min":50,"max":160}]` | | `gribble:strict` | `[error, {"min":50,"max":160}]` | | `gribble:seo` | `[warn, {"min":50,"max":160}]` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `min` | integer | `50` | Minimum length in characters. | | `max` | integer | `160` | Maximum length in characters. | **Fix:** Add a one-sentence description of the page in the document head. <a id="seo-single-h1"></a> ### seo/single-h1 Exactly one `<h1>` per page. Zero or multiple `<h1>` elements are reported. One top-level heading tells crawlers and screen readers what the page is about. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `error` | | `gribble:a11y` | `off` | **Fix:** Keep one `<h1>` for the page subject; demote the others to `<h2>`. Bad: ```html <h1>Shop</h1> ... <h1>Featured</h1> ``` Good: ```html <h1>Shop</h1> ... <h2>Featured</h2> ``` <a id="seo-heading-order"></a> ### seo/heading-order Heading levels must not skip. An `<h4>` directly after an `<h2>` (and similar jumps) is reported. Heading order is the page outline for assistive technology. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Use the next heading level down; style with CSS, not by picking a smaller heading tag. <a id="seo-canonical"></a> ### seo/canonical Pages need a valid canonical link. Reports a missing `<link rel="canonical">`, a relative or malformed href, or a canonical pointing at a different route than expected. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Emit an absolute canonical URL for each route. <a id="seo-robots-noindex"></a> ### seo/robots-noindex Public routes must not be marked noindex. A `<meta name="robots" content="noindex">` or `X-Robots-Tag: noindex` on a route not covered by `allow` is reported. Catches staging flags shipped to production. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"allow":["/admin/**","/preview/**"]}]` | | `gribble:strict` | `[error, {"allow":["/admin/**","/preview/**"]}]` | | `gribble:seo` | `[error, {"allow":["/admin/**","/preview/**"]}]` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `allow` | string[] | `["/admin/**","/preview/**"]` | Route globs where noindex is intentional. | **Fix:** Remove the noindex directive, or add the route to `allow` if it is intentionally hidden. <a id="seo-robots-txt"></a> ### seo/robots-txt robots.txt must exist and parse. Requests `/robots.txt`; reports a missing file, a non-text response, unparsable directives, or a blanket `Disallow: /` for all agents. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Serve a robots.txt that allows crawling of public routes and lists the sitemap. <a id="seo-sitemap"></a> ### seo/sitemap sitemap.xml must exist, be valid and cover the discovered routes. Loads the sitemap referenced by robots.txt or `/sitemap.xml`, validates the XML, and reports public routes that are missing from it. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Generate the sitemap from the router at build time so it cannot drift. <a id="seo-lang-attribute"></a> ### seo/lang-attribute `<html>` must declare a language. A missing or invalid `lang` attribute on the root element is reported. Screen readers use it to pick a voice and search engines to pick a market. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `error` | | `gribble:a11y` | `off` | **Fix:** Set <html lang="en"> (or the page language, as a BCP 47 tag). <a id="seo-open-graph"></a> ### seo/open-graph Pages need Open Graph title, description and image. Reports missing `og:title`, `og:description` or `og:image`, and an `og:image` that does not load. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Add the og:* meta tags; share previews on chat apps and social sites depend on them. <a id="seo-twitter-card"></a> ### seo/twitter-card Pages need Twitter card meta tags. Reports a missing `twitter:card`. Off by default because Open Graph tags are usually enough. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Add <meta name="twitter:card" content="summary_large_image"> and matching title/description/image tags. <a id="seo-structured-data"></a> ### seo/structured-data JSON-LD blocks must parse and use known types. Every `<script type="application/ld+json">` is parsed. Invalid JSON, a missing `@context`/`@type`, or an unknown schema.org type is reported. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Validate the JSON-LD with the schema.org validator and fix the offending block. <a id="seo-hreflang"></a> ### seo/hreflang Localized pages must declare hreflang alternates. For multi-language sites, reports missing or non-reciprocal `<link rel="alternate" hreflang>` entries. Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `warn` | | `gribble:a11y` | `off` | **Fix:** Emit a full set of hreflang links, including `x-default`, on every localized page. <a id="seo-url-format"></a> ### seo/url-format URLs must be lowercase and use a consistent trailing slash. Reports discovered internal URLs with uppercase characters (when `lowercase` is true) and inconsistent trailing slashes across routes. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"lowercase":true,"trailingSlash":"consistent"}]` | | `gribble:strict` | `[error, {"lowercase":true,"trailingSlash":"consistent"}]` | | `gribble:seo` | `[warn, {"lowercase":true,"trailingSlash":"consistent"}]` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `lowercase` | boolean | `true` | Require lowercase paths. | | `trailingSlash` | "consistent" \\| "always" \\| "never" \\| "ignore" | `"consistent"` | Trailing slash policy. | **Fix:** Normalize URLs in the router and redirect the other form. ## Accessibility <a id="a11y-axe"></a> ### a11y/axe axe-core must report no violations of the configured impact and tags. Runs axe-core on each route and viewport. Violations whose impact is in `impact` and whose tags intersect `tags` are reported one per rule and selector. Rule ids in `disable` are skipped. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"impact":["critical","serious"],"tags":["wcag2a","wcag2aa"],"disable":[]}]` | | `gribble:strict` | `[error, {"impact":["critical","serious"],"tags":["wcag2a","wcag2aa"],"disable":[]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `[error, {"impact":["critical","serious"],"tags":["wcag2a","wcag2aa"],"disable":[]}]` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `impact` | "minor" \\| "moderate" \\| "serious" \\| "critical"[] | `["critical","serious"]` | axe impact levels that produce findings. | | `tags` | string[] | `["wcag2a","wcag2aa"]` | axe tags to run, e.g. wcag2a, wcag2aa, best-practice. | | `disable` | string[] | `[]` | axe rule ids to skip. | **Fix:** Follow the axe help link in the finding; each violation names the failing element. <a id="a11y-img-alt"></a> ### a11y/img-alt Images need alt text. Mapped from axe `image-alt`. Reports <img> elements without an `alt` attribute. Decorative images must use `alt=""`. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `error` | **Fix:** Describe the image in `alt`, or set alt="" for purely decorative images. Bad: ```html <img src="/hero.png"> ``` Good: ```html <img src="/hero.png" alt="A gribble boring into a plank"> ``` <a id="a11y-form-labels"></a> ### a11y/form-labels Form controls need labels. Mapped from axe `label`. Reports inputs, selects and textareas without a <label>, `aria-label` or `aria-labelledby`. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `error` | **Fix:** Add a <label for> that points at the control, or an aria-label. <a id="a11y-accessible-name"></a> ### a11y/accessible-name Buttons and links need an accessible name. Mapped from axe `button-name` and `link-name`. Icon-only controls without text, `aria-label` or a labelled image are reported. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `error` | **Fix:** Add visible text, an aria-label, or alt text on the icon image. <a id="a11y-color-contrast"></a> ### a11y/color-contrast Text must meet the WCAG contrast ratio for `level`. Reports text whose contrast against its background is below 4.5:1 (AA) or 7:1 (AAA); large text uses the lower thresholds. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"level":"AA"}]` | | `gribble:strict` | `[error, {"level":"AA"}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `[warn, {"level":"AA"}]` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `level` | "AA" \\| "AAA" | `"AA"` | WCAG conformance level. | **Fix:** Darken the text or lighten the background until the ratio passes. <a id="a11y-focus-visible"></a> ### a11y/focus-visible Focused elements must be visibly focused. Focuses each visible interactive element and reports those whose computed style (outline, box-shadow, border, background, color, text-decoration, pseudo-elements) does not change at all on focus. Off by default; elements the browser would not paint a focus ring for anyway are skipped. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `warn` | **Fix:** Do not remove `outline` without providing a `:focus-visible` style. <a id="a11y-keyboard-reachable"></a> ### a11y/keyboard-reachable Every interactive element must be reachable with Tab. Reports controls that cannot be reached with Tab: elements with `onclick` or `role="button"`/`role="link"` on a non-focusable tag without `tabindex`, native controls forced to `tabindex="-1"` outside a roving-tabindex widget, and positive `tabindex` values that break document order. Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `warn` | **Fix:** Use native buttons and links, or add tabindex="0" and key handlers to custom controls. <a id="a11y-touch-target"></a> ### a11y/touch-target Interactive elements must be at least `minPx` square on mobile. Measures bounding boxes of interactive elements in the mobile viewport; anything smaller than `minPx` in either dimension is reported. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"minPx":44}]` | | `gribble:strict` | `[error, {"minPx":44}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `[warn, {"minPx":44}]` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `minPx` | number | `44` | Minimum width and height in CSS pixels. | **Fix:** Increase padding or min-height/min-width on the control. <a id="a11y-skip-link"></a> ### a11y/skip-link Pages need a skip-to-content link. Reports pages whose first tabbable element is not a same-page link to an existing target, when at least five tabbable elements come before the main content (`<main>`, `[role="main"]` or the first `<h1>`). Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `warn` | **Fix:** Add <a href="#main" class="skip-link">Skip to content</a> as the first element in `<body>`. <a id="a11y-reduced-motion"></a> ### a11y/reduced-motion Animations must respect prefers-reduced-motion. Emulates `prefers-reduced-motion: reduce` and reports visible elements whose CSS animation is infinite or runs for at least one second in total, and transitions of at least one second on motion properties (`transform`, `translate`, offsets, `all`), that are still active under it. Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `warn` | **Fix:** Wrap animations in `@media (prefers-reduced-motion: no-preference)`. ## Performance <a id="perf-lighthouse-performance"></a> ### perf/lighthouse-performance Lighthouse performance score must be at least `min`. Runs Lighthouse per route and viewport and compares the performance category score (0-100) with `min`. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"min":80}]` | | `gribble:strict` | `[warn, {"min":80}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `min` | number | `80` | Minimum performance score (0-100). | **Fix:** Open the Lighthouse report attached to the run and work through the opportunities list. <a id="perf-lcp"></a> ### perf/lcp Largest Contentful Paint must be under `maxMs`. Measured by Lighthouse under simulated throttling. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"maxMs":2500}]` | | `gribble:strict` | `[error, {"maxMs":2500}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `maxMs` | number | `2500` | Maximum LCP in milliseconds. | **Fix:** Preload the LCP image or font, inline critical CSS, remove render-blocking scripts. <a id="perf-cls"></a> ### perf/cls Cumulative Layout Shift must be under `max`. Measured by Lighthouse. Layout shifts usually come from images without dimensions, late-loading fonts and injected banners. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"max":0.1}]` | | `gribble:strict` | `[error, {"max":0.1}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `max` | number | `0.1` | Maximum CLS score. | **Fix:** Give images and embeds explicit dimensions, reserve space for late content, use font-display: optional or swap with size-adjust. <a id="perf-tbt"></a> ### perf/tbt Total Blocking Time must be under `maxMs`. Measured by Lighthouse. Long tasks on the main thread block input. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"maxMs":200}]` | | `gribble:strict` | `[warn, {"maxMs":200}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `maxMs` | number | `200` | Maximum TBT in milliseconds. | **Fix:** Split long tasks, defer non-critical JavaScript, reduce hydration work. <a id="perf-page-weight"></a> ### perf/page-weight Total transfer size of a route must be under `maxKb`. Sums the transfer size of every request made during load. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"maxKb":2000}]` | | `gribble:strict` | `[warn, {"maxKb":2000}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `maxKb` | number | `2000` | Maximum total transfer size in kilobytes. | **Fix:** Compress images, tree-shake bundles, lazy-load below-the-fold content. <a id="perf-unsized-images"></a> ### perf/unsized-images Images need explicit width and height. Reports <img> elements without `width`/`height` attributes or CSS aspect-ratio; they cause layout shift. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add width and height attributes (or aspect-ratio in CSS) to every image. <a id="perf-image-format"></a> ### perf/image-format Images should use a modern format. Reports large JPEG/PNG images that would be smaller as WebP or AVIF. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Serve WebP/AVIF via `<picture>` or an image CDN. <a id="perf-render-blocking"></a> ### perf/render-blocking No render-blocking scripts or styles. Reports synchronous scripts and stylesheets in `<head>` that delay first paint. Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add defer/async to scripts, inline critical CSS, preload the rest. <a id="perf-regression"></a> ### perf/regression Metrics must not regress against the baseline by more than the thresholds. Compares each route's Lighthouse score, LCP, CLS and page weight with `baseline/metrics.json`. A drop larger than the configured delta is reported. Skipped when there is no baseline for the route. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"score":-5,"lcpMs":500,"cls":0.05,"weightKb":300}]` | | `gribble:strict` | `[warn, {"score":-5,"lcpMs":500,"cls":0.05,"weightKb":300}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `score` | number | `-5` | Allowed Lighthouse score delta (negative means a drop). | | `lcpMs` | number | `500` | Allowed LCP increase in milliseconds. | | `cls` | number | `0.05` | Allowed CLS increase. | | `weightKb` | number | `300` | Allowed page weight increase in kilobytes. | **Fix:** Compare the route against the baseline run and find the change that added weight or blocking time. ## UI hard rules <a id="ui-colors-from-tokens"></a> ### ui/colors-from-tokens Computed colors must come from the design tokens. Collects computed `color`, `background-color` and `border-color` values and compares them with the token set (`auto` reads tailwind.config and CSS custom properties). Values not in the set are reported with their selector. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"tokens":"auto"}]` | | `gribble:strict` | `[warn, {"tokens":"auto"}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `tokens` | "auto" \\| string[] | `"auto"` | `auto` to read tokens from the project, or an explicit list of allowed colors. | **Fix:** Replace the hardcoded color with the closest token. <a id="ui-font-sizes-from-tokens"></a> ### ui/font-sizes-from-tokens Font sizes must come from the type scale. Compares computed font sizes with the sizes defined in the project's tokens. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Use a size from the type scale instead of an arbitrary value. <a id="ui-spacing-from-tokens"></a> ### ui/spacing-from-tokens Margins and paddings must come from the spacing scale. Compares computed margin and padding values with the project's spacing tokens (Tailwind `spacing`, `@theme` lengths, `--spacing-*`/`--space-*`/`--gap*`/`--size-*` custom properties). Zero, `auto` and the browser's own default margins for an element are always allowed; quiet when the project declares no spacing tokens. Off by default because it is noisy. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Use a spacing token. <a id="ui-min-font-size"></a> ### ui/min-font-size Text must be at least `px` pixels. Reports visible text with a computed font size below the threshold. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"px":12}]` | | `gribble:strict` | `[warn, {"px":12}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `px` | number | `12` | Minimum font size in CSS pixels. | **Fix:** Increase the font size; 12px is the floor for body copy on most platforms. <a id="ui-overlap"></a> ### ui/overlap Interactive elements must not overlap. Compares bounding boxes of interactive elements; overlapping pairs that are both visible are reported. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Fix the layout so that the elements do not share screen area. <a id="ui-horizontal-overflow"></a> ### ui/horizontal-overflow Pages must not scroll horizontally in the listed viewports. Reports routes whose document width exceeds the viewport width, together with the widest offending element. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"viewports":["mobile"]}]` | | `gribble:strict` | `[error, {"viewports":["mobile"]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `viewports` | string[] | `["mobile"]` | Viewport names (from gribble.yaml) to check. | **Fix:** Constrain the offending element with max-width: 100% or overflow-x: hidden on the container. <a id="ui-text-clipped"></a> ### ui/text-clipped Text must not be clipped or overflow its container. Reports elements whose scroll size exceeds their client size with overflow hidden and no text-overflow handling. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Let the container grow, wrap the text, or use text-overflow: ellipsis deliberately. <a id="ui-broken-images"></a> ### ui/broken-images Images must load and have a non-zero natural size. Reports <img> elements whose `naturalWidth` is 0 after load. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Fix the image path or the asset pipeline. <a id="ui-placeholder-text"></a> ### ui/placeholder-text No placeholder text may ship. Reports visible text matching any of the `patterns` (case-insensitive substrings or regular expressions). **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[error, {"patterns":["lorem ipsum","TODO","FIXME","placeholder"]}]` | | `gribble:strict` | `[error, {"patterns":["lorem ipsum","TODO","FIXME","placeholder"]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `patterns` | string[] | `["lorem ipsum","TODO","FIXME","placeholder"]` | Substrings or regular expressions that identify placeholder copy. | **Fix:** Replace the placeholder with real copy. <a id="ui-favicon"></a> ### ui/favicon The site needs a favicon. Reports a missing or non-loading `<link rel="icon">` (and `/favicon.ico` fallback). **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add a favicon link in the document head and ship the file. <a id="ui-empty-state"></a> ### ui/empty-state Lists and tables with zero rows need an empty state. Reports visible `<table>`, `<ul>`, `<ol>`, `[role="list"]`, `[role="grid"]` and `[role="table"]` containers that render zero rows or items and no explanatory text inside or next to them. Navigation and menu lists, hidden and `aria-busy` containers are skipped. Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Render a short empty-state message with a next step. ## Visual regression <a id="visual-regression"></a> ### visual/regression Screenshots must not differ from the baseline by more than `threshold`. Compares a screenshot per route and viewport with `baseline/screenshots/` using pixel diffing. The ratio of changed pixels above `threshold` is reported with the diff image as evidence. Skipped when the baseline has no screenshot for the route. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `threshold` | number | `0.01` | Maximum ratio of changed pixels (0-1). | | `viewports` | string[] | `["mobile","desktop"]` | Viewport names to compare. | **Fix:** Review the diff image. If the change is intended, update the baseline. Off in `gribble:recommended`: opt in with `visual/regression: warn` plus `baseline.screenshots: commit` (or `lfs`), because screenshots are binary churn in git and differ across rendering platforms. ## Structure regression <a id="structure-regression"></a> ### structure/regression Landmarks, navigation and forms must not disappear compared with the baseline. Diffs the aria snapshot of each route against `baseline/snapshots/`. A removed navigation item, form, landmark or heading is reported. Additions are not. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Restore the removed element, or update the baseline if the removal is intended. ## HTML <a id="html-doctype"></a> ### html/doctype Documents must start with <!DOCTYPE html>. A missing or non-HTML5 doctype puts the browser in quirks mode. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add <!DOCTYPE html> as the first line of the document. <a id="html-charset"></a> ### html/charset Documents must declare a UTF-8 charset. Reports a missing `<meta charset>` or a charset other than UTF-8, and a charset declared after the first 1024 bytes. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Put <meta charset="utf-8"> first in `<head>`. <a id="html-viewport-meta"></a> ### html/viewport-meta Documents need a viewport meta tag. Without `<meta name="viewport">` mobile browsers render the desktop layout and zoom out. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add <meta name="viewport" content="width=device-width, initial-scale=1">. Good: ```html <meta name="viewport" content="width=device-width, initial-scale=1"> ``` <a id="html-duplicate-ids"></a> ### html/duplicate-ids Element ids must be unique. Reports id values used more than once in a document; duplicates break labels, anchors and ARIA references. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Rename one of the elements, or generate ids per instance in the component. Bad: ```html <input id="email"> ... <input id="email"> ``` Good: ```html <input id="login-email"> ... <input id="newsletter-email"> ``` <a id="html-deprecated-elements"></a> ### html/deprecated-elements No deprecated HTML elements. Reports `<center>`, `<font>`, `<marquee>`, `<frame>` and other obsolete elements, and obsolete presentational attributes such as `align`, `bgcolor`, `cellpadding` and `valign`. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Replace the element with semantic HTML and CSS. <a id="html-valid"></a> ### html/valid Markup must validate. Runs a structural check over the served document source (no network validator): stray and mismatched end tags, unclosed elements, duplicate attributes, self-closing syntax on non-void elements, nested links, list children that are not `<li>` and block content inside `<p>`. Noisy on most real sites, so it is off by default; `ignore` takes message patterns. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[off, {"ignore":[]}]` | | `gribble:strict` | `[off, {"ignore":[]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `ignore` | string[] | `[]` | Validator message patterns to ignore. | **Fix:** Fix the reported markup errors. ## Security <a id="security-https-only"></a> ### security/https-only Non-local targets must be served over HTTPS. Reports an `http://` target URL or a redirect to http. Localhost and loopback addresses are exempt. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Serve the site over HTTPS and redirect http to https. <a id="security-mixed-content"></a> ### security/mixed-content HTTPS pages must not load http resources. Reports subresources requested over http from an https document. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `error` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Use https or protocol-relative URLs for every subresource. <a id="security-headers"></a> ### security/headers Responses must include the required security headers. Checks the document response for each header listed in `require`. A `content-security-policy` delivered as `<meta http-equiv="content-security-policy">` in the document counts as present, as prerendered pages do; a meta policy cannot carry `frame-ancestors`, `report-uri` or `sandbox`, so cover framing with `X-Frame-Options` on the static asset. The other headers have no meta form. The rule does not run when the target is a loopback address (dev and preview servers do not carry production headers); the report lists it under `notRun` instead, so audit a deployed URL to exercise it. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"require":["content-security-policy","x-content-type-options","strict-transport-security"]}]` | | `gribble:strict` | `[error, {"require":["content-security-policy","x-content-type-options","strict-transport-security"]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `require` | string[] | `["content-security-policy","x-content-type-options","strict-transport-security"]` | Lowercase header names that must be present. | **Fix:** Set the headers in the server or hosting configuration. <a id="security-exposed-secrets"></a> ### security/exposed-secrets No API keys or tokens in shipped HTML and JavaScript. Scans document and script responses for known secret formats (cloud provider keys, private keys, bearer tokens). A match is reported with the asset URL; the secret value itself is redacted in the finding. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `critical` | | `gribble:strict` | `critical` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Rotate the secret immediately, then move it to the server side. <a id="security-sourcemaps-exposed"></a> ### security/sourcemaps-exposed Production builds must not expose source maps. Reports `//# sourceMappingURL` comments whose map file is publicly reachable. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `error` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Disable source map emission for production, or restrict access to the .map files. <a id="security-form-without-csrf"></a> ### security/form-without-csrf State-changing forms need CSRF protection. Reports same-origin POST forms without a hidden token field (`csrf`, `xsrf`, `authenticity_token`, `_token`, `__RequestVerificationToken`, `antiforgery`) and no CSRF `<meta>` tag, unless every cookie the browser holds for the target is `SameSite=Lax` or `Strict`. Off by default because frameworks differ. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add a CSRF token to the form or rely on SameSite cookies plus origin checks. ## Internationalization <a id="i18n-untranslated-keys"></a> ### i18n/untranslated-keys Raw translation keys must not leak into the UI. Reports visible text matching any of the `patterns`, which by default catches dotted keys such as `home.hero.title`. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"patterns":["^[a-z]+(\\.[a-z_]+)+$"]}]` | | `gribble:strict` | `[warn, {"patterns":["^[a-z]+(\\.[a-z_]+)+$"]}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `patterns` | string[] | `["^[a-z]+(\\.[a-z_]+)+$"]` | Regular expressions that identify translation keys. | **Fix:** Add the missing translation, or fix the key. <a id="i18n-mixed-language"></a> ### i18n/mixed-language A page must not mix languages. Groups the visible text by Unicode script family and reports pages where a second script holds at least a fifth of the letters. Short strings, code, numerals and subtrees with their own `lang` are ignored; two languages in the same script (English inside German) are not detected. Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Translate the remaining strings. <a id="i18n-lang-mismatch"></a> ### i18n/lang-mismatch The declared html lang must match the content language. Reports a locale segment in the URL (`/de/…`, `/zh-CN/…`) that disagrees with `<html lang>`, and a `lang` attribute (on `<html>` or a subtree) whose visible text is almost entirely in another Unicode script family. Off by default. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `off` | | `gribble:strict` | `off` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Set `lang` to the language the page is actually written in. ## Flows <a id="flows-replay"></a> ### flows/replay Recorded flows must replay without failing a step. Replays every `flows/<name>.replay.json` in gate mode. A failed step (element not found, expectation not met, timeout) is reported with the step index. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `critical` | | `gribble:strict` | `critical` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Open the flow, reproduce the failing step manually, then fix the site or re-record the flow. <a id="flows-max-duration"></a> ### flows/max-duration A flow must complete within `seconds`. Wall-clock time of a replayed flow. **Status:** implemented · **Kind:** deterministic | Preset | Setting | | --- | --- | | `gribble:recommended` | `[warn, {"seconds":60}]` | | `gribble:strict` | `[warn, {"seconds":60}]` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Options** | Option | Type | Default | Description | | --- | --- | --- | --- | | `seconds` | number | `60` | Maximum flow duration in seconds. | **Fix:** Find the slow step in the flow result and speed up that page or request. ## AI review <a id="review-guidelines"></a> ### review/guidelines Violations of guidelines.md found by the AI reviewer. The reviewer reads `.gribble/guidelines.md` and reports pages or components that contradict it. Severity caps every finding in this category. **Status:** implemented · **Kind:** AI review | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Apply the guideline, or refine the guideline text if it is ambiguous. <a id="review-ux"></a> ### review/ux Confusing interactions and unclear states found by the AI reviewer. Unlabelled controls, ambiguous actions, missing feedback after an action, and similar usability problems. **Status:** implemented · **Kind:** AI review | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Follow the suggestion in the finding; verify with a manual walk-through. <a id="review-copy"></a> ### review/copy Typos, tone and inconsistent terminology found by the AI reviewer. Spelling mistakes, inconsistent product names, and copy that clashes with the tone described in guidelines.md. **Status:** implemented · **Kind:** AI review | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Edit the copy as suggested. <a id="review-dead-ends"></a> ### review/dead-ends Pages with no way forward or back found by the AI reviewer. Routes without navigation, actions that lead nowhere, and error pages without a way home. **Status:** implemented · **Kind:** AI review | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add navigation or a clear next action to the page. <a id="review-flow-coverage"></a> ### review/flow-coverage Important flows that are not described in flows/. The reviewer explores the site and reports user journeys that have no matching `flows/*.md`. **Status:** implemented · **Kind:** AI review | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Write the flow as flows/`<name>`.md so that it is walked on every audit. <a id="review-error-handling"></a> ### review/error-handling Missing error, empty and loading states found by the AI reviewer. Forms without validation messages, lists without empty states, and actions without loading feedback. **Status:** implemented · **Kind:** AI review | Preset | Setting | | --- | --- | | `gribble:recommended` | `warn` | | `gribble:strict` | `warn` | | `gribble:seo` | `off` | | `gribble:a11y` | `off` | **Fix:** Add the missing state and its copy. --- # Flows Describe user journeys in Markdown; let the gribbles walk them. Source: https://gribble.dev/docs/flows.md A flow is a user journey written in plain language, in a Markdown file, in your repository. Review mode walks it. Once it has been walked successfully, Gribble can record the exact steps into a sidecar file so gate mode can replay it deterministically forever. Flows live in `.gribble/flows/` and are committed. The quickest way to write one is to describe the journey to your coding agent the way you would to a new tester. The [Gribble skill](/docs/skills) knows the format below and what makes a flow executable: ```prompt Add a Gribble flow for the password reset journey: a user requests a reset link from /forgot-password, opens it, sets a new password and lands signed in on the dashboard. ``` ``` .gribble/flows/ README.md smoke.md smoke.replay.json checkout.md checkout.replay.json auth/login.md ``` ## Format Markdown with a small frontmatter block. The body is prose written for a person, which happens to also be the instruction a model reads. ```md --- name: checkout requires_auth: user env: [preview, staging] tags: [commerce, critical] --- Sign in as the test user, search for "running shoes", add the first result to the cart, open the cart, and go to checkout. Confirm the line item price and the total match what the product page showed. Do not submit the payment form — stop at the payment step. ``` That is the whole format. Prose, and enough structure that a program can route it. ## Frontmatter | Field | Type | Description | | --- | --- | --- | | `name` | string | The flow's identity. Used in reports, in `flows/replay` findings, and to find the `<name>.replay.json` sidecar. Keep it stable — renaming a flow orphans its replay file and its baseline history. | | `requires_auth` | string \| boolean | An [auth profile](/docs/auth) name from `gribble.yaml`, e.g. `user` or `admin`. `true` means the default profile. Omit for flows that run logged out. | | `env` | string[] | Environment names in which this flow should run. A flow with `env: [staging]` is skipped unless the audit was started with `--env staging`. Omit to run everywhere. | | `tags` | string[] | Free-form labels. Useful for grouping in the report and for your own filtering. | `name` is the only required field. ## Writing good steps The body is read by a model that can see the page and by a human who has to maintain the file. Both audiences want the same thing: say what the user is trying to achieve and what has to be true at the end, not which CSS selectors to click. **Be specific about intent and about the check.** Weak: > Test the checkout. Better: > Sign in as the test user, add a product to the cart, and go to checkout. Confirm the total matches the sum of the line items. The second one says what "working" means. Without it the agent will decide for itself, differently each run, and you get a flaky flow. **State the outcome, not the mechanics.** "Search for running shoes" is right. "Click `#search-input`, type, press `#submit-btn`" is wrong — it breaks the first time somebody renames a class, and it throws away the agent's ability to notice that the search box moved somewhere unreasonable. **Say what must not happen.** Guardrails already block obvious side effects off staging, but the flow is where you record intent: > Do not submit the payment form — stop at the payment step. > Do not delete the test account at the end; other flows reuse it. **Use stable data.** A flow that depends on "the first product in the list" is fine if the list is seeded and deterministic, and a coin flip if it is a live catalogue. When in doubt, name the fixture: "search for the seeded product `TEST-SHOE-01`". **Keep flows small and single-purpose.** One journey per file. `checkout.md`, `signup.md`, `password-reset.md`. A 40-step mega-flow fails somewhere in the middle and tells you very little, and it burns your step budget. **Never put secrets in the body.** Reference the auth profile with `requires_auth` and let the env-var indirection handle credentials. Anything you type into a flow file is committed to git. **Mind the clock.** `flows/max-duration` warns at 60 seconds by default. A flow that legitimately takes longer wants either a raised threshold or a split. ## The replay sidecar Prose is flexible and non-deterministic, which is exactly what you want when exploring and exactly what you do not want in a required status check. The sidecar bridges the two. When review mode successfully walks a flow, it records what it actually did into `<name>.replay.json` next to the Markdown file. From then on, **gate mode replays those steps directly** — no model, no tokens, same result every time — under the `flows/replay` rule, which defaults to `critical`. ```json { "version": 1, "name": "checkout", "startUrl": "/products", "steps": [ { "action": "fill", "selector": "[data-testid=search]", "value": "running shoes" }, { "action": "press", "key": "Enter" }, { "action": "wait_for", "selector": "[data-testid=result-card]", "timeoutMs": 5000 }, { "action": "click", "selector": "[data-testid=result-card]:first-child", "description": "Open the first search result" }, { "action": "expect_visible", "selector": "[data-testid=add-to-cart]" }, { "action": "click", "selector": "[data-testid=add-to-cart]" }, { "action": "wait_for", "text": "Added to cart" }, { "action": "navigate", "url": "/cart" }, { "action": "expect_text", "text": "running shoes", "selector": "[data-testid=cart-line]" }, { "action": "click", "selector": "[data-testid=checkout]" }, { "action": "expect_url", "pattern": "^/checkout" } ] } ``` `startUrl` is a path on the target, so a sidecar recorded against your dev server replays against staging with `--env staging`. When the first recorded step is a `navigate`, the recorder writes the target root (`/`) instead of whatever page the review happened to be on, and a start page that fails to load is only a warning: the flow positions itself in step 1. A flow that begins by acting on the current page keeps that page as its `startUrl`, and there a failing start page fails the flow. Older sidecars with an absolute `startUrl` still replay. The recorder picks each selector the way you would: `data-testid`, then `id`, then a link's `href`, then the role and full accessible name (computed the way Playwright does, without `aria-hidden` text), then the element's structural path. It keeps the first one that matches only the element it clicked on the live page, or else the first one whose first match is that element (replays act on the first match). If none does, it writes no sidecar for that flow rather than one that would fail the next gate, and says so in the run log. ### Step actions | Action | Fields | Meaning | | --- | --- | --- | | `navigate` | `url` | Go to a URL. Relative paths resolve against the target. | | `click` | `selector`, `description?` | Click an element. `description` is for humans reading a failure. | | `fill` | `selector`, `value`, `secret?` | Type into a field. `secret: true` redacts the value in logs and reports. | | `press` | `key` | Press a key, e.g. `Enter`, `Escape`, `Tab`. | | `wait_for` | `selector?`, `url?`, `text?`, `timeoutMs?` | Wait for a condition. At least one of the three must be given. | | `expect_text` | `text`, `selector?` | Assert text is present, optionally within a selector. | | `expect_url` | `pattern` | Assert the current URL matches a regular expression. | | `expect_visible` | `selector` | Assert an element is visible. | The `expect_*` actions are the point. A replay that only navigates and clicks proves the buttons exist; a replay with assertions proves the journey worked. When review records a flow it derives assertions from the confirmations your prose asked for — which is another reason to write "confirm the total matches the line items" instead of "check the cart". A failing step produces a `flows/replay` finding naming the flow, the step index, the action and what was expected. `flows/max-duration` produces a separate `warn` when the whole replay takes too long. ### Editing sidecars by hand You may. It is JSON, the schema is small, and tightening a selector or adding an assertion by hand is a perfectly reasonable thing to do. Two cautions: hand edits are overwritten the next time review re-records the flow, and a selector you invent is not one that was observed to work. Prefer `data-testid` attributes over structural selectors when you edit; they are what the recorder prefers too, and they survive redesigns. Delete the sidecar and gate stops replaying that flow; review will re-record it on the next run. ## Promoting an explored flow This is the flywheel, and it is the main reason flows exist in two forms. ```prompt The latest Gribble review raised a flow-coverage finding for signup. Write that journey down as a flow, with the outcomes that prove it worked. ``` Step by step: 1. **Review explores.** With `review.explore: true` (the default) the agent visits routes that no flow describes. It finds the signup journey nobody wrote down, and either walks it successfully or raises a `review/flow-coverage` finding saying an important journey is undocumented. 2. **You write it down.** Turn the journey into a flow file: ```md --- name: signup tags: [onboarding] --- From the landing page, start a signup with a fresh test email address. Complete the form, confirm the welcome screen appears, and confirm the account menu shows the new user's email. ``` 3. **Run review once.** It walks the new flow and writes `signup.replay.json`. 4. **Commit both files.** From now on `gribble audit --mode gate` replays signup on every PR, deterministically, at zero token cost, and a break is a `critical` finding that fails the build. What used to be an expensive, fuzzy check is now a cheap, certain one. Repeat until the interesting part of review is only the genuinely new stuff. Going the other way is just as valid: when a journey changes so much that the recorded steps are meaningless, delete the sidecar, update the prose, and let review re-record. ```prompt Checkout now has a separate shipping step, so the checkout flow's replay fails. Update checkout.md to describe the new journey and delete its replay sidecar so review records a new one. ``` ## Auth flows Login flows live under `flows/auth/` by convention and are referenced from `gribble.yaml`: ```yaml auth: profiles: user: type: flow flow: flows/auth/login.md env: { email: GRIBBLE_USER_EMAIL, password: GRIBBLE_USER_PASSWORD } ``` ```md --- name: login --- Go to the sign-in page. Enter the test user's email and password from the environment, and submit. Confirm the account menu shows the user's email. ``` The flow refers to credentials by intent; the actual values come from the environment variables named in the profile, and are redacted from session logs. An auth flow runs at most once per audit — the resulting browser storage state is cached in `.gribble/cache/auth/<profile>.json` and reused. See [Auth](/docs/auth). ## Flows in a monorepo Flows are **not** cascaded. Each app's `.gribble/flows/` is its own; a checkout journey in `apps/shop` means nothing in `apps/admin`. Only `rules.yaml` and `guidelines.md` cascade. See [Monorepos](/docs/monorepos). ## Checklist for a healthy flow directory - One journey per file, named after the journey. - Every flow states at least one thing that must be true at the end. - Every flow that needs a login declares `requires_auth`. - Critical journeys have a committed `.replay.json` so gate covers them. - No credentials, tokens or personal data in any flow body. - Environment-specific flows declare `env`, so local runs do not fail on a staging-only journey. --- # Guidelines House rules a model has to judge — written in prose, appended to Gribble's system prompt. Source: https://gribble.dev/docs/guidelines.md `.gribble/guidelines.md` is where you write the standards that cannot be measured. It is plain Markdown, it is committed, and review mode reads it as context when it judges your UI. `gribble init` creates it with a short template and a few prompts. Most teams end up with somewhere between 30 and 150 lines. You rarely need to open it yourself. Tell your coding agent the house rule, and let it decide whether the rule is a judgement call for this file or a mechanical check for `rules.yaml`: ```prompt Add a Gribble house rule: every empty state explains what will appear there and offers the action that creates the first item. ``` ```prompt No page should ship with "Coming soon" text on it. Make Gribble enforce that, in rules.yaml if a rule can check it or in guidelines.md if not. ``` ## What belongs here, and what does not The dividing line is simple: **can a program decide this without arguing?** | Statement | Where it goes | Why | | --- | --- | --- | | Buttons must be at least 44px tall | `rules.yaml` (`a11y/touch-target`) | A number compared to a number | | Colours must come from design tokens | `rules.yaml` (`ui/colors-from-tokens`) | Computed style compared to a token list | | No `lorem ipsum` in shipped pages | `rules.yaml` (`ui/placeholder-text`) | Pattern match | | Every page has exactly one `h1` | `rules.yaml` (`seo/single-h1`) | Counting | | Error messages must say what to do next | `guidelines.md` | Requires reading the message | | Tone is restrained and professional, never jokey | `guidelines.md` | Requires taste | | Destructive actions need a confirmation step | `guidelines.md` | Requires understanding what is destructive | | Empty states explain how to create the first item | `guidelines.md` | Requires understanding the screen | | Which URL to audit, which model, budgets | `gribble.yaml` | Runtime settings, not standards | Two useful heuristics: - **If you could write a test for it, it is a rule.** Put it in `rules.yaml` where it is deterministic, free and able to block a merge. Findings from real rules are far more trustworthy than a model's opinion about the same thing. - **If reasonable colleagues could disagree, it is a guideline.** That is not a weakness; it is exactly the class of problem a model is good at spotting and a linter is not. When something starts as a guideline and you later realise it is mechanical, move it. A guideline promoted to a rule is a small win every single run. ## How it is injected Gribble builds a fixed system prompt describing the audit task, the tools, the finding format and the guardrails. **Your guidelines are appended to it as an additional section.** You are adding to the instructions, not replacing them. There is deliberately no way to override the system prompt in this version. The prompt is what makes findings structured, fingerprintable and comparable across runs; letting it be replaced would mean every project's reports mean something different, and the baseline machinery would stop working. Practical consequences: - Guidelines are **context and criteria**, not commands. "Never report accessibility problems" will not disable `a11y/axe` — that is a rule, and rules run in code before the model is involved. - Guidelines only affect **review** mode. `--mode gate` never loads a model, so the file is not read. - Violations surface as `review/guidelines` findings, capped at that rule's severity (`warn` by default). - The file is sent with every review audit, so its length is a real token cost. Prefer sharp and short. ## Writing them well **Be concrete, and say why.** A model, like a new hire, applies a rule better when it knows the reason. Vague: > Copy should be good. Useful: > **Copy** > - Sentence case for headings and buttons. Not Title Case, not ALL CAPS. > - Say what the button does: "Create project", not "Submit" or "OK". > - Use "sign in" and "sign out" throughout. Never "log in", "login" or "logout". > - Numbers over vagueness: "3 members" beats "several members". **Give examples, especially bad ones.** A contrasting pair is worth a paragraph of description. ```md ### Error messages Every error says what happened and what to do next. - Bad: "An error occurred." - Bad: "Error 500: Internal Server Error" - Good: "We couldn't save your changes because the project was deleted. Refresh to see the current list." ``` **Say what you do not want.** Negative rules are often the more useful half, because they name the thing the model would otherwise let pass. > Never use a spinner as the only feedback for an action that takes under 300ms. > Never put a destructive action as the rightmost, primary-styled button in a dialog. **Scope by area when your product has distinct surfaces.** ```md ## Marketing pages Warm, direct, second person. Exclamation marks are fine. ## Application UI Neutral and terse. No exclamation marks. No jokes in error states. ## Admin Density over friendliness. Assume the reader uses this eight hours a day. ``` **Prune.** Guidelines that never produce a finding are either already universally followed or too vague to apply. Both cases argue for deleting the line. ## A worked example ```md # Guidelines House rules for reviewing this product. Rules that can be checked mechanically live in rules.yaml; this file is for judgement calls. ## Voice and tone - Neutral, direct, professional. No jokes in the product UI. - Second person for instructions ("Choose a plan"), never first person plural ("Let's choose a plan"). - Sentence case for all headings, buttons and labels. ## Terminology Use these words and no synonyms. Inconsistency here is a finding. | Use | Not | | --- | --- | | project | workspace, space | | member | user, seat, teammate | | sign in / sign out | login, log in, logout | | plan | tier, package | ## Buttons and actions - The label names the action: "Create project", not "Submit" or "OK". - Exactly one primary button per view. - Destructive actions are secondary-styled, sit on the left of a dialog's button row, and require a confirmation step naming the thing being deleted. ## States Every list, table and data view has all four states designed: - **Loading** — skeleton, not a bare spinner, when the shape is predictable. - **Empty** — explains what goes here and offers the action to create the first one. "No projects" alone is a finding. - **Error** — says what failed and what to do next. Offers a retry when a retry could work. - **Partial** — when some data failed to load, say which part. ## Forms - Labels are always visible. Placeholder text is never the only label. - Validation errors appear next to the field, not only in a summary at the top. - Say what a valid value looks like before the user gets it wrong. - Never clear a user's input on a validation error. ## Navigation - Every page is reachable from the primary navigation or from a page that is. - Every page below the top level has a visible way back that is not the browser button. - The current location is indicated in the navigation. ## What not to flag - Marketing pages (`/`, `/pricing`, `/about`) intentionally use a warmer tone than the app. Do not report them for exclamation marks. - The legacy admin area under `/admin/legacy/**` is being replaced in Q3. Do not report styling or layout there. ``` That last section earns its place. Telling the reviewer where not to look is as valuable as telling it what to look for, and it is the fastest way to kill a recurring false positive without turning a rule off globally. ## Monorepo concatenation In a [monorepo](/docs/monorepos), `guidelines.md` files **concatenate** from the repository root down to the app, root first. ``` .gribble/guidelines.md company-wide voice, terminology, a11y stance apps/web/.gribble/guidelines.md consumer app specifics apps/admin/.gribble/guidelines.md admin specifics ``` Auditing `apps/admin` gives the model the root guidelines followed by the admin ones, in that order, in one document. Nothing is replaced, because concatenating prose is the only merge that makes sense — there is no key to override. This differs from `rules.yaml`, which **merges** with child settings overriding parent ones. Rules have keys; prose does not. Because the later text wins arguments in practice, use the app-level file for narrowing, exceptions and additions: ```md # Admin guidelines Extends the root guidelines. Where they conflict, this file wins. - The root rule about warm, welcoming copy does not apply here. Admin copy is terse and assumes an expert user. - Density is a feature. Do not report compact tables as cramped. - Every destructive admin action must name the affected record count in the confirmation, e.g. "Delete 1,204 records?". ``` Keep the root file to things that are genuinely true everywhere — voice, terminology, accessibility commitments, security expectations. Everything specific belongs next to the app it describes. ## Keeping them alive - **Review them when a finding is wrong.** A false positive from `review/guidelines` usually means a guideline is ambiguous. Sharpen the sentence rather than ignoring the finding. - **Let your coding agent maintain them.** The [Gribble skill](/docs/skills) teaches Claude Code, pi and Cursor what belongs in this file versus `rules.yaml`, so "add a guideline about empty states" lands in the right place. - **Treat them as documentation for people too.** A good `guidelines.md` is the design review checklist your team already had in its head. Writing it down for the model is how it finally gets written down at all. ```prompt Gribble keeps flagging our marketing pages for exclamation marks, which are fine there. Find the guideline behind those findings and rewrite it so it only applies to the application UI. ``` --- # Auth Logging in to the site under test, and logging in to your model provider. Two different problems. Source: https://gribble.dev/docs/auth.md There are two unrelated authentication questions in Gribble, and mixing them up causes a lot of confusion: 1. **The site under test.** How does the audit reach pages behind a login? 2. **The model provider.** How does Gribble pay for the tokens review mode spends? The first is configured per project in `gribble.yaml`. The second is a machine-level credential in `~/.gribble/`. They share nothing. Your coding agent can do most of Part 1 for you. Part 2 is yours: `gribble login` is an interactive prompt that stores a personal credential, so you run it in your own terminal, and the agent is told not to. Part 2 also needs code that a gate-only install does not have: the provider catalog lives in `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent`, which Gribble declares as [optional peer dependencies](/docs/getting-started#the-review-runtime-is-optional). `gribble login`, `gribble logout` and `gribble models` all stop with the install command until they are present. --- ## Part 1: target-site auth Most interesting pages are behind a login. Gribble handles this with **auth profiles** declared in `gribble.yaml`, referenced by name from flows. ```prompt Add a Gribble auth profile called user that signs in through our /login form, with a login flow and the email and password read from GRIBBLE_USER_EMAIL and GRIBBLE_USER_PASSWORD, then mark the account and billing flows as requiring it. ``` The agent writes the profile, the flow and the `requires_auth` lines, and tells you which variables to set. Setting them to real values is up to you, in your shell or your CI secret store. Or by hand: **Secrets are never written in YAML.** A profile's `env` block maps a logical field name to an **environment variable name**; the value is read at the moment it is used and never passes through the config object. ```yaml auth: profiles: user: type: flow flow: flows/auth/login.md env: { email: GRIBBLE_USER_EMAIL, password: GRIBBLE_USER_PASSWORD } admin: type: command command: pnpm exec ./scripts/admin-session.ts ``` ### Profile types #### `flow` Drive a real login form once, using a [flow](/docs/flows) file. ```yaml auth: profiles: user: type: flow flow: flows/auth/login.md env: { email: GRIBBLE_USER_EMAIL, password: GRIBBLE_USER_PASSWORD } ``` ```md --- name: login --- Go to the sign-in page. Enter the test user's email and password from the environment and submit. Confirm the account menu shows the user's email. ``` The most faithful option — it exercises the same path a real user takes — and the slowest. Best when your login is a plain form with no third-party identity provider in the middle. #### `cookie` Inject a session cookie directly. ```yaml auth: profiles: user: type: cookie name: session env: { value: GRIBBLE_SESSION_COOKIE } ``` Fast and reliable. The catch is that somebody has to produce the cookie and rotate it before it expires, which makes this best for short-lived local runs and for staging environments that mint long-lived test sessions. #### `header` Attach a header to every request in the context. ```yaml auth: profiles: api: type: header name: Authorization env: { value: GRIBBLE_TOKEN } ``` For token-based setups and for preview deployments protected by a shared header. `Authorization: Bearer <token>` works by putting the whole header value in the variable. #### `command` Run a script that prints a Playwright storage state JSON to stdout. ```yaml auth: profiles: admin: type: command command: pnpm exec ./scripts/admin-session.ts ``` The escape hatch, and the right answer for SSO, for signed dev-only login endpoints, and for anything requiring a service account. Your script can call an internal API, mint a session, and print: ```json { "cookies": [{ "name": "session", "value": "...", "domain": "localhost", "path": "/", "expires": -1, "httpOnly": true, "secure": false, "sameSite": "Lax" }], "origins": [] } ``` The command runs in your repository root with the audit's environment. Anything it writes to stderr is logged; only stdout is parsed. ```prompt Our staging login goes through SSO. Write a script that calls our dev-only session endpoint and prints a Playwright storage state, and add it to gribble.yaml as a command auth profile called admin. ``` ### Using a profile A flow claims a profile in its frontmatter: ```md --- name: checkout requires_auth: user --- ``` `requires_auth: true` uses the default profile when you have only one. Routes can require a profile too — a route behind a login is audited in that profile's context, and the route list can be scoped per environment if the logged-out and logged-in route sets differ. ### The storage state cache Logging in once per audit would be acceptable. Logging in once per route would not be. Gribble caches the resulting browser storage state at: ``` .gribble/cache/auth/<profile>.json ``` Before a profile is used, the cache is checked: if it exists and still authenticates, it is reused; otherwise the login runs once and the result is written back. `.gribble/cache/` is gitignored by the `.gribble/.gitignore` that `gribble init` generates. **Do not commit it.** It contains live session cookies, which is to say a working login to your staging environment. In CI the cache starts empty every run, so each profile logs in exactly once per job. That is usually a few seconds and not worth caching across jobs — and if you do decide to cache it, understand that you are persisting a session token into your CI cache. Clear it by hand when a login stops behaving: ```bash rm -rf .gribble/cache/auth ``` ### One browser context per profile Each profile gets its own Playwright browser context, kept alive for the whole audit and shared across every tool call that needs it. This matters for two reasons. Sessions do not leak between profiles — an `admin` flow cannot accidentally run as `user`, because they are separate cookie jars. And the audit does not re-authenticate constantly, because the context stays logged in from the first flow to the last route. Multiple profiles means multiple simultaneous contexts. Two or three is normal; twenty means you are modelling something other than auth. ### No CAPTCHA, no 2FA bypass Gribble will not solve CAPTCHAs and will not work around two-factor authentication. This is not a missing feature waiting to be built — defeating a bot check is exactly the behaviour those checks exist to stop, and an agent that does it is an agent you cannot trust on your own infrastructure either. If login is gated by a CAPTCHA or a second factor, pick one: - **Disable the check in staging.** The usual answer. Most teams already do this for their E2E suite. - **Add a dev-only login endpoint** that mints a session for a known test user, and use a `command` profile to call it. Gate it behind an environment flag that is off in production. - **Use a `cookie` or `header` profile** with a session produced out of band. - **Use a test account exempted from the check**, where your identity provider supports it. Never audit production with real user credentials. `allowed_origins` exists partly to make that hard to do by accident. ### Redaction pi session files record every tool call with its arguments — which means a `fill` step on a password field would write your password to disk in plain text, and a report attachment could carry it further. Gribble redacts. Every value of every environment variable named in an auth profile is collected before the run, and both the `tool_call` and `tool_result` hooks replace any occurrence of those values with `***` before anything is written to a session file, a log line, a report or a PR comment. Replay steps that fill secret fields are marked `secret: true` and store no value. Redaction is string replacement on known secrets. It is thorough for the credentials you declared and it cannot help with a secret you never told Gribble about. So: - Declare every credential through `auth.profiles.*.env`. A password typed directly into a flow body is not redacted, because Gribble has no way to know it is a password. It is also committed to git, which is the bigger problem. - Treat `.gribble/sessions/` and `.gribble/runs/` as sensitive anyway. They are gitignored by default. Before attaching a run directory to a public issue, look at it. - Use dedicated test accounts with no real data and no production access. --- ## Part 2: model provider auth Review mode needs a model. Gate mode does not — if you have no credentials at all, `gribble audit --mode gate` still works completely. Gribble is **bring your own key**. There is no Gribble account, no Gribble server and no proxy. You authenticate directly with a provider and the tokens are billed to you. ### `gribble login` Run this yourself. It is interactive, it may open a browser, and the credential it stores is yours; ask your agent to run it and a well-behaved one will hand the job back to you. Once you are logged in, the agent can pick up from there: ```prompt I've logged in to my model provider. List the models Gribble can reach now and set the one I choose in gribble.yaml. ``` ```bash gribble login # pick from available providers gribble login <provider> # OAuth flow, or prompt for an API key gribble login <provider> --api-key "$MY_KEY" gribble logout <provider> ``` Credentials go to `~/.gribble/auth.json`. Gribble does not implement OAuth or key storage itself — it uses pi's `ModelRuntime` with the paths pointed at its own directory. An OAuth login opens the provider's sign-in page in your browser and waits for the redirect back to `localhost`. The URL is printed too: if the browser is on another machine (SSH, a container), open it there and paste the final redirect URL into the prompt. ### `~/.gribble/` ``` ~/.gribble/ settings.json user-level settings: default provider and model auth.json API keys and OAuth tokens models.json model catalogue with pricing models-store.json catalogue cache ``` `GRIBBLE_HOME` overrides the location, which is useful for sandboxes and for keeping work and personal credentials apart. This directory is **never** inside your repository. Project-level `.gribble/` holds settings, rules and baselines; credentials live in your home directory and only there. ### `reusePiAuth` Already a pi user? Skip the second login. ```yaml # .gribble/gribble.yaml reusePiAuth: true ``` Gribble then reads credentials and the model catalogue from `~/.pi/agent/` instead of `~/.gribble/`. Only the credential location changes — the system prompt, tools and guardrails are still Gribble's. ### Resolution order Which model runs: 1. `model` in `gribble.yaml` — committed, team-wide, reproducible. 2. `defaultProvider` / `defaultModel` in `~/.gribble/settings.json`. 3. The first model with valid credentials, with a warning. Which credential is used, for a given provider: 1. A runtime override. 2. `auth.json` (API key or OAuth token). 3. The provider's standard environment variable — `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY` and so on. 4. Custom provider configuration. When the project's configured provider has no credential on this machine, Gribble fails with exit code `2` and a precise message: ``` No credentials for provider "<provider>", which .gribble/gribble.yaml requires. Run: gribble login <provider> ``` ### Choosing a model ```bash gribble models ``` Lists everything your credentials can reach, **recommended models first**. The recommended set favours reliable tool calling, no need for vision (the agent reads structured page snapshots, not screenshots), and a price you can afford on every pull request. Gribble hardcodes no model name anywhere in its code or documentation. The recommendation table lives in one file in the source and is refreshed each release, because any specific recommendation would be stale within months. The `model` field uses pi's syntax and supports a thinking level: ```yaml model: <provider>/<model> model: <provider>/<model>:<thinking-level> ``` Every audit prints its token usage and cost at the end, from pi's pricing table, and the same numbers are in `report.budget`. ### CI uses API keys In CI, put an API key in a repository secret and expose it as the provider's environment variable: ```yaml - uses: gribble-dev/action@v1 env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} ``` No `gribble login` step, no interactive prompt, no credential file. ### Subscription OAuth must not go into CI Some providers let you sign in with a consumer subscription instead of an API key. That is a fine way to work locally. **It must not be moved into CI.** - It is a **personal** login. The tokens CI spends are billed to and rate-limited against one human being, and every failure becomes that person's problem. - Provider terms generally cover interactive personal use, not automated shared infrastructure. - OAuth tokens refresh and expire on a cadence designed for an interactive session, so a CI job will break at an unpredictable time, usually during a release. - Copying the credential into a shared secret store hands your whole personal account to anyone who can read repository secrets or open a pull request that prints environment variables. Use an API key in CI. If the cost of one is the blocker, run `--mode gate` in CI, which needs no model at all — and no model runtime, so the job installs neither a provider SDK nor a credential chain — and run review locally where your subscription belongs. ### If you genuinely cannot use a model in CI ```yaml - uses: gribble-dev/action@v1 with: mode: gate ``` Deterministic checks, flow replay and all three regression rules still run. You lose the AI review comments and keep the merge-blocking half — which, given that review can never block a merge anyway, is a smaller loss than it sounds. --- # CI and the GitHub Action Run Gribble on every pull request, comment findings, upload SARIF, and keep the baseline fresh. Source: https://gribble.dev/docs/ci-github-action.md The GitHub Action wraps `gribble audit --ci` and does the GitHub-shaped work around it: a check run with annotations, PR comments that update in place instead of piling up, SARIF for code scanning, JUnit for test reporters, the run directory as an artifact, and baseline maintenance after a merge. ```yaml uses: gribble-dev/action@v1 ``` ```prompt Add the Gribble GitHub Action to this repository: audit every pull request and comment on new findings, refresh the baseline on pushes to main, and read the model provider API key from a repository secret. ``` Your agent writes the workflow file; it cannot create the secret. Add the API key yourself under the repository's **Settings → Secrets and variables → Actions**, with the name the workflow expects. A key pasted into a workflow file is a key published to everyone who can read the repository. Or by hand: ## A complete workflow Two jobs. Pull requests get audited and commented on; pushes to the default branch refresh the baseline. ```yaml # .github/workflows/gribble.yml name: Gribble on: pull_request: push: branches: [main] jobs: audit: if: github.event_name == 'pull_request' runs-on: ubuntu-latest permissions: contents: read pull-requests: write checks: write security-events: write steps: - uses: actions/checkout@v7 with: fetch-depth: 0 # baseline comparison needs history - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v7 with: node-version: 22 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm exec gribble install # Playwright browser - uses: gribble-dev/action@v1 id: gribble with: mode: all fail-on: error env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - uses: github/codeql-action/upload-sarif@v3 if: always() with: sarif_file: gribble.sarif baseline: if: github.event_name == 'push' runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v7 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v7 with: node-version: 22 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm exec gribble install - uses: gribble-dev/action@v1 with: mode: gate update-baseline: true comment: false env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} ``` A few choices in there worth explaining. `fetch-depth: 0` gives the Action the git history it needs to resolve the base commit and to decide which files changed. `mode: gate` in the baseline job is deliberate — that job exists to record metrics and snapshots, and paying for an AI review that nobody will read is waste. `comment: false` for the same reason: there is no pull request to comment on. `mode: all` in the audit job needs the AI review runtime in the repository's devDependencies — `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent`, which Gribble declares as [optional peer dependencies](/docs/getting-started#the-review-runtime-is-optional) that no package manager installs on its own. `pnpm install --frozen-lockfile` then picks them up like anything else. The baseline job's `mode: gate` needs neither, which is the point: a gate-only repository installs no model runtime at all, as long as its lockfile was not carried over from Gribble 0.3 with pnpm (see [Upgrading from 0.3](/docs/getting-started#upgrading-from-0-3)). ## Inputs | Input | Type | Default | Description | | --- | --- | --- | --- | | `mode` | `gate` \| `review` \| `all` | `all` | Which half of the audit to run. | | `working-directory` | string | `.` | Directory to run in. Use for a repo where the app is not at the root. | | `target` | string | — | Audit a specific app in a monorepo, e.g. `apps/web`. | | `all` | boolean | `false` | Discover and audit every `.gribble/` in the repository. | | `environment` | string | — | Environment name from `gribble.yaml`, passed as `--env`. | | `update-baseline` | boolean | `false` | Write the baseline after the run and commit it back. Only meaningful on the default branch. | | `comment` | boolean | `true` | Post and update PR comments. | | `max-comments` | number | `5` | Maximum number of new per-finding review comments per run; the rest are listed in the summary comment. | | `fail-on` | `critical` \| `error` \| `warn` \| `none` | `error` | Lowest severity of a **new** finding that fails the step. | | `github-token` | string | `${{ github.token }}` | Token used for comments, checks and baseline commits. | | `report-artifact` | boolean | `true` | Upload the run directory as a workflow artifact. | ```prompt Set the Gribble action to fail-on none while we roll it out, so findings are still reported and commented on but no build fails. ``` `fail-on: none` is the right setting while you are rolling Gribble out: everything still gets reported, commented on and uploaded, but nobody's build breaks while the team gets used to it. Tighten to `error` once the baseline is honest. ## Outputs | Output | Description | | --- | --- | | `gate` | `pass` or `fail`. | | `new-findings` | Number of findings with status `new`. | | `report-path` | Absolute path of the report JSON, normally `.gribble/runs/latest.json`. | | `sarif-path` | Absolute path of `gribble.sarif`, ready for `github/codeql-action/upload-sarif`. | ```yaml - uses: gribble-dev/action@v1 id: gribble with: fail-on: none - name: Warn in the job summary if: steps.gribble.outputs.gate == 'fail' run: echo "::warning::Gribble found ${{ steps.gribble.outputs.new-findings }} new findings" ``` ## Permissions Grant the least that covers what you enabled. | Permission | Needed for | | --- | --- | | `contents: read` | Always. Checking out the repository. | | `contents: write` | `update-baseline: true` with `baseline.update: commit`. | | `pull-requests: write` | PR comments, and `baseline.update: pr`. | | `checks: write` | The check run and its annotations. | | `security-events: write` | Uploading SARIF to code scanning. | Gribble uses `GITHUB_TOKEN` and does not require a GitHub App. **Forked pull requests** get a read-only token, so comments and check annotations will not post. This is a GitHub restriction, not a Gribble one. The audit still runs and the artifact still uploads; if you need comments on fork PRs, use `pull_request_target` and understand the security trade-off you are making by doing so. **Workflow approval.** Pull requests from first-time contributors, and workflow runs on branches pushed by a bot or an automation token, can sit in "workflow awaiting approval" until a maintainer approves the run from the pull request's Checks tab. Nothing posts until then; this is not the action being slow. ## How the Action runs the audit 1. Locates the `gribble` package in your repository (`working-directory` first, then the repository root). The version in your lockfile is the version that runs. When nothing is installed it falls back to npx and logs a warning: that is slower, unpinned, and runs whatever the latest release is — for `mode: review` or `all` the fallback also fetches the review runtime, at `latest` like everything else on that path. Add `gribble` as a devDependency instead. 2. Executes `gribble audit --ci --mode <mode>` with flags derived from the inputs. 3. Reads `.gribble/runs/latest.json`. 4. Creates or updates a **check run** with annotations. When a finding has `location.file`, the annotation lands on that file; the line is resolved by locating the recorded symbol in the file, since Gribble stores symbol names rather than line numbers on purpose. 5. Syncs **PR comments** (see below). 6. Writes `gribble.sarif` and `gribble-junit.xml`. 7. Uploads the run directory as an artifact. 8. Sets outputs and fails the step according to `fail-on`. ## PR comments One pinned summary comment carrying `<!-- gribble:summary -->`, edited in place on every run. One comment per **new** finding carrying `<!-- gribble:fp:<hash> -->`, posted as an inline review comment when the file is known. On re-run: a fingerprint that is still present updates its comment and keeps the thread; a fingerprint that has disappeared is edited to "patched ✅" and its thread is resolved; a new fingerprint gets a new comment, up to `max-comments`. Findings already in the baseline are counted in the summary and never commented on. The summary looks roughly like this: ```md <!-- gribble:summary --> 🪱 **The gribbles found 4 holes in your hull — 2 need patching before you sail.** | | critical | error | warn | info | | --- | --- | --- | --- | --- | | New | 0 | 2 | 2 | 1 | 3 existing findings from the baseline · 1 fixed ✅ Showing 4 of 4 new findings. [Full report](…artifact link…) ``` The full mechanism is in [Findings](/docs/concepts/findings#comment-lifecycle). ## Artifacts With `report-artifact: true` (the default), the whole run directory is uploaded: the report JSON, aria snapshots, screenshots, Playwright traces and the per-route metrics. That is the thing to download when a comment says something you do not believe. Reports are self-contained — they carry their own version, repo, commit and model metadata — so an artifact downloaded six months from now still explains itself. See [Report format](/docs/report-format). ## SARIF and code scanning `gribble.sarif` maps every finding to a SARIF result with its rule id, severity, message, file and region. Upload it and findings appear in the repository's Security tab alongside CodeQL results, with GitHub's own dedupe and dismissal workflow on top. ```yaml - uses: github/codeql-action/upload-sarif@v3 if: always() with: sarif_file: gribble.sarif ``` `if: always()` matters — without it, a failed gate skips the upload and you lose exactly the results you wanted to see. `gribble-junit.xml` is written alongside it for test reporters and dashboards that speak JUnit. ## Docker image If installing a browser in CI is inconvenient, use the prebuilt image. It is based on the official Playwright image and ships Node 22, Gribble, the browsers and the AI review runtime, so every mode works out of the box. ``` ghcr.io/gribble-dev/gribble ``` ```yaml jobs: audit: runs-on: ubuntu-latest container: image: ghcr.io/gribble-dev/gribble:0 permissions: contents: read pull-requests: write checks: write steps: - uses: actions/checkout@v7 with: { fetch-depth: 0 } - run: pnpm install --frozen-lockfile - uses: gribble-dev/action@v1 env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} ``` No `gribble install` step is needed inside the container. The image is also handy outside GitHub Actions: ```bash docker run --rm \ -v "$PWD":/app -w /app \ -e ANTHROPIC_API_KEY \ ghcr.io/gribble-dev/gribble:0 \ gribble audit --ci --mode gate ``` The image is tagged `latest`, with the exact version (`0.2.1`) and with the moving major (`0` while the CLI is 0.x, `1` from 1.0.0). Pin the major tag rather than `:latest` so a release cannot change your CI behaviour without a commit. Inside the container the action still runs the `gribble` from your lockfile; the image only supplies Node and the browser. ## Versions and the Node runtime `uses: gribble-dev/action@v1` follows every release; `uses: gribble-dev/action@v0.2.1` pins one. The action is built from the [monorepo](https://github.com/gribble-dev/gribble/tree/main/packages/action) and published to [`gribble-dev/action`](https://github.com/gribble-dev/action) on every CLI release, so a version tag on the action equals the `gribble` version it was built from. `v1` is the moving tag for every 0.x and 1.x release. The action declares `runs.using: node24`. GitHub runners have run JavaScript actions on Node 24 by default since June 16, 2026 and remove Node 20 on September 23, 2026, so this only matches what the runner does anyway. Your own job can still use `actions/setup-node` with Node 22 for the CLI; the two do not interfere. ## Secrets Two categories, both repository secrets, both exposed as environment variables. **Model provider key** — required for `review` and `all`: ```yaml env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} ``` Use an **API key**, not a subscription OAuth login. Subscription logins are personal credentials, billed and rate-limited against one human, and generally not licensed for shared automation. See [Auth](/docs/auth#subscription-oauth-must-not-go-into-ci). **Target-site credentials** — whatever your [auth profiles](/docs/auth#part-1-target-site-auth) name: ```yaml env: GRIBBLE_USER_EMAIL: ${{ secrets.GRIBBLE_USER_EMAIL }} GRIBBLE_USER_PASSWORD: ${{ secrets.GRIBBLE_USER_PASSWORD }} ``` Use a dedicated test account on staging with no real data, never a production account. Values of variables named in auth profiles are redacted from session logs, reports and comments before anything is written. ## Preview deployments ```prompt Change the Gribble workflow to audit our Vercel preview deployment instead of starting the dev server: wait for the deployment, then pass its URL as PREVIEW_URL. ``` To audit a Vercel or Netlify preview instead of starting a dev server, define an environment in `gribble.yaml`: ```yaml environments: preview: target: url: ${PREVIEW_URL} start: null allowed_origins: [localhost, "*.vercel.app"] ``` Then wait for the deployment and pass the URL: ```yaml - uses: gribble-dev/action@v1 with: environment: preview env: PREVIEW_URL: ${{ steps.deployment.outputs.url }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} ``` Gribble skips the start command and audits the deployed URL directly, which is both faster and more honest than a dev build. ## Monorepos One job, every app: ```yaml - uses: gribble-dev/action@v1 with: all: true ``` The summary comment is sectioned per app, and fingerprints include the target name so two apps with the same bug stay distinct. Or audit one app: ```yaml - uses: gribble-dev/action@v1 with: target: apps/web ``` See [Monorepos](/docs/monorepos). ## Baseline maintenance A pull request never writes the baseline — otherwise a PR could bless its own regressions. Updates happen on the default branch, per `baseline.update` in `gribble.yaml`: - **`commit`** (default) — the Action commits `.gribble/baseline/` back to the branch with `[skip ci]`. Needs `contents: write`. - **`pr`** — the Action opens a `chore: update gribble baseline` pull request. For protected branches. Needs `pull-requests: write`. - **`manual`** — CI never writes it; you run `gribble baseline update` locally and commit. See [Baseline](/docs/concepts/baseline#update-strategies). ## Other CI systems There is no bespoke integration for GitLab, CircleCI or Jenkins, and none is needed — the CLI is the whole product and the Action is a convenience around it. GitLab has its own page, [GitLab CI](/docs/ci-gitlab), because its merge request widget reads two of the files the CLI writes. ```bash pnpm install --frozen-lockfile pnpm exec gribble install pnpm exec gribble audit --ci --mode gate ``` `--ci` prints the report JSON to stdout and progress to stderr, so `gribble audit --ci > report.json` gives you a clean file. Exit codes are `0` pass, `1` gate fail, `2` config or auth error, which is enough to drive any pipeline. SARIF, JUnit and GitLab Code Quality files are written to the run directory for whatever consumes them. See the [CLI reference](/docs/cli). --- # GitLab CI Run Gribble in a GitLab pipeline with the Docker image, and let the merge request widget show findings through Code Quality and JUnit reports. Source: https://gribble.dev/docs/ci-gitlab.md There is no GitLab-specific integration and none is needed for the first mile. `gribble audit --ci` writes three files GitLab already knows how to read, so a merge request shows new and fixed findings in its Code Quality widget, annotates the diff where a finding maps to a source file, and lists every finding under the Tests tab — without a token, an API call or a bot account. The [Docker image](#the-docker-image) has Gribble and its browser preinstalled, which keeps the job to two lines. ```prompt Add Gribble to our GitLab pipeline: a gate audit on every merge request that feeds the Code Quality widget and the Tests tab, and a job on the default branch that refreshes the baseline. ``` Your agent can write `.gitlab-ci.yml`; it cannot create the project access token the baseline job pushes with, or any CI/CD variable. Create those yourself in the project settings, masked and protected, as described [below](#a-complete-pipeline). Nothing secret belongs in the pipeline file. Or by hand: ## A complete pipeline Two jobs. Merge request pipelines audit the branch; pushes to the default branch refresh the baseline and produce the report GitLab compares merge requests against. ```yaml # .gitlab-ci.yml stages: [test] .gribble: stage: test image: ghcr.io/gribble-dev/gribble:latest # pin a version in real pipelines before_script: - pnpm install --frozen-lockfile # only needed when target.start runs your dev server artifacts: when: always # a failed gate must still upload its reports paths: - .gribble/runs/ reports: codequality: .gribble/runs/*/gl-code-quality.json junit: .gribble/runs/*/gribble-junit.xml gribble:audit: extends: .gribble rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" script: - gribble audit --ci --mode gate > gribble-report.json artifacts: paths: - gribble-report.json - .gribble/runs/ gribble:baseline: extends: .gribble rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH script: - gribble audit --ci --mode gate --update-baseline > gribble-report.json - git add .gribble/baseline - git config user.name gribble - git config user.email gribble@users.noreply.gitlab.com - 'git commit -m "chore: update gribble baseline [skip ci]" || exit 0' - git push "https://oauth2:${GRIBBLE_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "HEAD:${CI_COMMIT_BRANCH}" ``` A few choices in there worth explaining. **`when: always`** on the artifacts is the one line you cannot leave out. A failed gate exits `1`, GitLab marks the job failed, and without `when: always` it also skips the upload — so the run that found something is the run whose findings you never see. **The baseline job also uploads a Code Quality report.** GitLab computes "new" and "fixed" by comparing the merge request's report with the most recent report from the target branch. If the default branch never produces one, the widget lists every finding as new on every merge request. Running the audit on the default branch gives GitLab its reference and refreshes the [baseline](/docs/concepts/baseline) in the same run. **`mode: gate`** in both jobs is deliberate. Gate is deterministic and needs no model, so the pipeline needs no provider key — and no model runtime: the pi packages are [optional peer dependencies](/docs/getting-started#the-review-runtime-is-optional), so a gate-only `pnpm install` from a fresh lockfile never fetches them. A lockfile that already held them from Gribble 0.3 keeps them across the upgrade; see [Upgrading from 0.3](/docs/getting-started#upgrading-from-0-3). See [Review mode in CI](#review-mode-in-ci) for the alternative. **Pushing the baseline needs a token.** `CI_JOB_TOKEN` cannot push. Create a [project access token](https://docs.gitlab.com/user/project/settings/project_access_tokens/) with the `write_repository` scope and the Developer role, store it as a masked, protected CI/CD variable named `GRIBBLE_PUSH_TOKEN`, and allow that token to push to the default branch in the branch protection settings. `[skip ci]` in the commit message keeps the push from starting another pipeline. If you would rather not let CI write to your branch, set `baseline.update: manual` in `gribble.yaml`, drop the `git` lines, and run `gribble baseline update` locally. **`pnpm install`** is only there for `target.start`. If `gribble.yaml` points at a deployed preview URL instead of starting a dev server, remove the `before_script` and the job runs without installing anything. ## What the merge request shows Three surfaces, all fed by files in the run directory. | Surface | Source file | What appears | | --- | --- | --- | | Code Quality widget | `gl-code-quality.json` | Findings new in this merge request and findings it fixed, compared with the target branch by fingerprint. Expands into the full list. | | Diff annotations | `gl-code-quality.json` | A marker in the changes view on files that carry a finding with a `location.file` — the gutter icon GitLab uses for its own code quality scanners. | | Tests tab | `gribble-junit.xml` | One suite per rule, one case per finding; `critical` and `error` findings are failures. New failures relative to the target branch are called out. | The full [report JSON](/docs/report-format) is uploaded as a plain artifact too, for anything that wants more than the widget can show: per-route metrics, baseline status, confidence, evidence. ### How findings map onto Code Quality The Code Quality format was designed for linters, so a couple of translations are involved. They are spelled out in [Report format](/docs/report-format#gitlab-code-quality); the parts that affect how you read the widget: - Severity maps `critical → critical`, `error → major`, `warn → minor`, `info → info`. - `location.path` is the source file when Gribble mapped the finding to one, otherwise the route (`/pricing`, `/blog/[slug]`). GitLab shows the route as a path it cannot open; that is expected, and the description names the route too. - Line numbers are always `1`. Gribble locates by component or symbol, never by line, so the diff marker lands at the top of the file. - The fingerprint is Gribble's own, which is what makes the new/fixed comparison agree with `gribble` itself. ## Review mode in CI Gate needs no model. Review does, and it costs tokens, so it earns a separate job that is allowed to fail. ```prompt Add an allowed-to-fail Gribble review job to our GitLab pipeline for merge requests, running against the preview environment, and add the review runtime packages to devDependencies. ``` It also needs the runtime on disk. Add `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent` to the audited repository's devDependencies before enabling this job; no package manager installs an optional peer for you, and the job would otherwise fail with the install command instead of a report. ```yaml gribble:review: extends: .gribble rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" allow_failure: true script: - gribble audit --ci --mode review --env preview > gribble-report.json ``` Set the provider key named in your `gribble.yaml` model configuration as a masked CI/CD variable; [Auth](/docs/auth#part-2-model-provider-auth) lists the variable each provider reads. `--env preview` matters for two reasons: it selects the `environments.preview` target in `gribble.yaml`, and it tells the [side-effect guard](/docs/concepts/gate-and-review#guardrails) that clicking "place order" here is acceptable. Never point review mode at production without that guard in place. Review-mode findings have `source: "ai"` and land in the same three files, so they appear in the widget alongside gate findings. If you would rather keep them out of the Code Quality comparison, give the review job its own artifact paths and skip the `reports:` block. ## Auditing a deployed preview When your platform deploys a review app per merge request, audit that instead of starting a dev server. Reference the URL through an environment variable so the same configuration serves local runs: ```yaml # gribble.yaml target: url: http://localhost:3000 start: pnpm dev environments: preview: target: url: ${REVIEW_APP_URL} ``` ```yaml gribble:audit: extends: .gribble needs: [deploy:review] before_script: [] variables: REVIEW_APP_URL: https://$CI_ENVIRONMENT_SLUG.example.com script: - gribble audit --ci --mode gate --env preview > gribble-report.json ``` Add the preview host to `allowed_origins` in `gribble.yaml`, or the crawler will refuse to leave the page it started on. ## Authenticated routes Credentials come from CI/CD variables, never from the flow files. Declare the variable names in the auth profile and mark the variables masked: ```yaml # gribble.yaml auth: profiles: user: type: flow flow: flows/auth/login.md env: { email: GRIBBLE_USER_EMAIL, password: GRIBBLE_USER_PASSWORD } ``` Values of those variables are redacted from the report and the session log before either is written, so the artifacts are safe to keep. See [Auth](/docs/auth). ## The Docker image `ghcr.io/gribble-dev/gribble` is built from the official Playwright image, so the browser and its system libraries are already there and the job skips `gribble install`. Tags follow the npm package version; `latest` tracks the newest release. ```yaml image: ghcr.io/gribble-dev/gribble:0.2.1 ``` The image ships `pnpm` through corepack and Node from the Playwright base, and `gribble` is installed globally. If your project also has `gribble` as a devDependency, `pnpm exec gribble` runs the project's copy instead — either works, but pin them to the same version so the report your teammates see locally is the one CI produced. Without the image, use any Playwright base (`mcr.microsoft.com/playwright:<version>-noble`) and install the CLI from your lockfile; a plain Node image works too, but `gribble install` then has to download the browser on every run. ## Monorepos The CLI flags are the same as anywhere else: `--target apps/web` audits one app, `--all` audits every `.gribble/` directory it finds, and each target writes its own run directory under its own `.gribble/`. Point the `reports:` globs at every app you audit: ```yaml artifacts: reports: codequality: apps/*/.gribble/runs/*/gl-code-quality.json junit: apps/*/.gribble/runs/*/gribble-junit.xml ``` See [Monorepos](/docs/monorepos). ## What is not here yet There is no merge request comment integration: GitLab's widget and diff markers carry the findings instead, and the Action's in-place summary comment has no GitLab counterpart. Baseline updates are a `git push` from the job rather than an opened merge request. Both are on the list; until then the CLI, the Docker image and GitLab's own report artifacts are the whole integration, and they are enough to fail a pipeline on a broken link. --- # Monorepos One .gribble/ per app, with rules and guidelines cascading up to the repository root. Source: https://gribble.dev/docs/monorepos.md A repository with several web apps needs several audits: each app has its own URL, its own routes, its own journeys and its own baseline. What it does not need is several copies of the same accessibility policy. Gribble's answer is the one ESLint and TypeScript already taught everybody: **one config unit per app, cascading upward for the shared parts.** ```prompt Set up Gribble for apps/web and apps/admin in this monorepo by following https://gribble.dev/setup.md, installing it once at the workspace root. ``` The [Agent setup guide](/docs/agent-setup) tells your agent to find the web apps, ask you which ones to audit if there are several, and run `init` inside each. The layout it produces is the one below. ## One `.gribble/` per app ``` my-monorepo/ .gribble/ rules.yaml shared rules guidelines.md shared guidelines (no gribble.yaml — the root is not an app) apps/ web/ .gribble/ gribble.yaml url, start, model, budgets rules.yaml app-specific rule adjustments guidelines.md app-specific guidelines flows/ baseline/ admin/ .gribble/ gribble.yaml rules.yaml flows/ baseline/ packages/ ui/ no .gribble/ — not a site ``` The root `.gribble/` holds **only shared rules and guidelines**. It has no `gribble.yaml`, no target, no flows and no baseline, because there is no site at the repository root to audit. Gribble identifies auditable apps by the presence of a `gribble.yaml`. Run `gribble init` inside each app directory. There is no separate setup step for the root — create `.gribble/rules.yaml` there when you have something to share, and not before. ## Cascading Walking from an app's `.gribble/` up to the repository root, Gribble collects config files and combines them. ```prompt The contrast and design-token rules are the same in every app's Gribble rules.yaml. Move them into a shared .gribble/rules.yaml at the repository root and keep only the app-specific exceptions in each app. ``` ### `rules.yaml` merges, child wins Root: ```yaml # .gribble/rules.yaml extends: - gribble:recommended rules: a11y/color-contrast: [error, { level: AA }] ui/colors-from-tokens: error seo/twitter-card: off ``` App: ```yaml # apps/admin/.gribble/rules.yaml rules: seo/*: off # an internal tool does not need SEO perf/lighthouse-performance: off a11y/color-contrast: error # inherited; restated for clarity overrides: - routes: ["/reports/**"] rules: perf/page-weight: off # report pages are legitimately heavy ``` `apps/admin` ends up with `gribble:recommended`, plus the company-wide contrast and design-token rules, minus SEO and the Lighthouse threshold, with a further exception on report routes. Root first, app last, and the more specific setting wins. `overrides` accumulate, later entries taking precedence — so an app-level override beats a root-level one for the same route. `ignore` lists concatenate. A fingerprint suppressed at the root is suppressed everywhere; app-level fingerprints only apply to that app, which is the correct behaviour since fingerprints include the target name. ### `guidelines.md` concatenates, root first Prose has no keys, so there is nothing to override. The files are joined in order, root first, into one document the model reads. ``` .gribble/guidelines.md company voice, terminology, a11y stance apps/admin/.gribble/guidelines.md admin specifics and exceptions ``` Because later text settles arguments in practice, use the app file to narrow: ```md # Admin guidelines Extends the root guidelines. Where they conflict, this file wins. - The root rule about warm, welcoming copy does not apply here. Admin copy is terse and assumes an expert user. - Density is a feature. Do not report compact tables as cramped. ``` See [Guidelines](/docs/guidelines#monorepo-concatenation). ### What does not cascade - **`gribble.yaml`** — each app's settings are its own. A URL, a start command and a budget are not shareable things. - **`flows/`** — a checkout journey in `apps/shop` is meaningless in `apps/admin`. - **`baseline/`** — per app, obviously. ## Commands ```bash # inside an app cd apps/web && gribble audit # from the repository root gribble audit --target apps/web # every app in the repo gribble audit --all ``` `--all` discovers every `.gribble/` containing a `gribble.yaml` and audits each in turn. It is the right default for CI and for nightly runs; `--target` is what you want while working on one app. Each app's report is written to its own `.gribble/runs/`, and `--all` prints a combined summary. With `--ci`, the JSON on stdout carries one report per target. ## Fingerprints include the target A finding's [fingerprint](/docs/concepts/findings#fingerprints) includes the target name — `apps/web`, `apps/admin` — so the same missing alt attribute in two apps produces two distinct findings, two baseline entries and two comments. Fixing one does not silently mark the other as patched. For a single-app repository the target name is empty, so fingerprints in a repo that later becomes a monorepo will change when the app moves into `apps/`. Re-baseline after that move; it is a one-time cost. ## Incremental audits and the dependency graph `--changed` uses the git diff to decide what to audit. In a monorepo it also uses the **workspace dependency graph**, the same way `pnpm --filter ...[origin/main]` does: a change in `packages/ui` affects every app that depends on it, so every one of those apps is audited, while apps that do not depend on it are skipped. ```bash gribble audit --all --changed ``` Within each affected app, only the routes the change can touch are audited, and only those routes are compared against the baseline. Routes nobody visited keep their existing findings and metrics untouched — they are not reported as fixed just because nobody looked. Full audits belong in nightly runs and before releases. ## In CI One job, every app: ```yaml - uses: gribble-dev/action@v1 with: all: true ``` The PR summary comment is sectioned per app, and each per-finding comment carries its own fingerprint marker, so the [comment lifecycle](/docs/concepts/findings#comment-lifecycle) works across apps without interference. Split into a matrix if your apps have very different setup requirements or you want independent status checks: ```yaml strategy: matrix: app: [apps/web, apps/admin] steps: - uses: gribble-dev/action@v1 with: target: ${{ matrix.app }} ``` The trade-off: a matrix gives you parallelism and separate required checks, but each job posts its own comments, so a PR touching three apps gets three summary comments instead of one sectioned summary. Start with `all: true`. ## Installation and skills Install Gribble **once, at the repository root**: ```bash pnpm add -D -w gribble # add @earendil-works/pi-ai and @earendil-works/pi-coding-agent too for review mode ``` The AI review runtime is an [optional peer dependency](/docs/getting-started#the-review-runtime-is-optional); at the root, once, like Gribble itself. Not per app. The `gribble` binary finds the right `.gribble/` from your working directory or from `--target`. Install the [coding-agent skill](/docs/skills) once too, at the root `.agents/skills/` (or `.claude/skills/`, depending on your agent). The skill reads `.gribble/runs/latest.json` relative to whichever app it is working on, so one installation serves every app. ```bash pnpm exec gribble init --update-skills ``` ## Adding a new app ```prompt Add Gribble to the new apps/docs site, the same way apps/web is set up, and record its first baseline. ``` Or by hand: 1. `cd apps/newthing && pnpm exec gribble init` — answer the URL and start command, and pick the same model your other apps use (or pass it with `--model`). 2. Delete anything from the generated `rules.yaml` that the root already says. The generated file starts from `gribble:recommended`; if your root already extends it, the app file can often be trimmed to nothing. 3. Run `gribble audit` once. No baseline exists, so it [bootstraps](/docs/concepts/baseline#bootstrap-mode). 4. Commit `.gribble/` including `baseline/`. The new app is now in `--all` runs, with its own ledger and no effect on anybody else's. ## Recommended split A rough guide to what goes where: | Root `.gribble/` | App `.gribble/` | | --- | --- | | `extends: [gribble:recommended]` | The target URL and start command | | Accessibility commitments | The model and budgets | | Design-token rules | Route list or discovery mode | | Company voice and terminology | App-specific rule exceptions | | Security expectations | Flows | | Fingerprints suppressed everywhere | The baseline | If the root file starts collecting per-app exceptions, that is the signal to push them down into the app that needs them. A root config full of `overrides` keyed on one app's routes is a cascade being used backwards. --- # CLI reference Every command, every flag, exit codes, and the --ci output contract. Source: https://gribble.dev/docs/cli.md ```bash gribble <command> [options] ``` Most people drive Gribble through their coding agent, which runs these commands for them (see [Working with your agent](/docs/skills)). This page is the reference you both read. Gribble installs as a devDependency, so run it through your package manager: ```bash pnpm exec gribble audit npx gribble audit yarn gribble audit ``` Examples below omit the runner for readability. `gate` mode needs no model, and a fresh install brings none: the AI review runtime is an [optional peer dependency](/docs/getting-started#the-review-runtime-is-optional). A pnpm lockfile carried over from 0.3 keeps it until you [re-resolve it](/docs/getting-started#upgrading-from-0-3), and gate-mode audits warn about that. Commands that do need it — `audit --mode review`, `audit --mode all`, `login`, `logout`, `models` — stop with the install command when it is absent. `init` keeps going and skips model selection. Two flags work on every command: `--verbose` prints debug logs and full stack traces, `--version` prints the version. ## Commands at a glance | Command | Purpose | | --- | --- | | [`init`](#gribble-init) | Create `.gribble/`, choose a model, install agent skills | | [`audit`](#gribble-audit) | Run an audit | | [`install`](#gribble-install) | Download the Playwright browser | | [`login`](#gribble-login) | Authenticate with a model provider | | [`logout`](#gribble-logout) | Remove stored credentials | | [`models`](#gribble-models) | List available models, recommended first | | [`explain`](#gribble-explain) | Describe a rule | | [`ignore`](#gribble-ignore) | Suppress a finding by fingerprint | | [`baseline update`](#gribble-baseline-update) | Refresh the baseline | | [`version`](#gribble-version) | Print the version | --- ## `gribble init` Sets up `.gribble/` in the current directory. ```bash gribble init gribble init --yes gribble init --url http://localhost:5173 --start "pnpm dev" gribble init --update-skills ``` | Flag | Description | | --- | --- | | `--yes` | Accept every default, including installing skills into all detected agents. Non-interactive. | | `--update-skills` | Only refresh installed agent skill files. Skips the rest of the walkthrough entirely. | | `--url <url>` | Target URL. Skips that question. | | `--start <cmd>` | Start command. Skips that question. | | `--model <provider/id>` | Model. Skips model selection. | | `--force` | Overwrite `.gribble/` files and skill files that already exist. Without it, existing files are kept and listed. | Creates: ``` .gribble/ gribble.yaml rules.yaml guidelines.md flows/README.md flows/smoke.md baseline/.gitkeep .gitignore (runs/ sessions/ cache/) ``` It never modifies your repository root `.gitignore`, and warns if that file already ignores the whole `.gribble/` directory — which would also discard the rules, flows and baseline you are meant to commit. If your credentials cannot reach any model, init offers to run `login` first. See [Getting started](/docs/getting-started#gribble-init). --- ## `gribble audit` The main command. ```bash gribble audit gribble audit --mode gate gribble audit --ci --mode all gribble audit --target apps/web --env preview gribble audit --routes /,/pricing,/blog/[slug] gribble audit --all --changed ``` | Flag | Default | Description | | --- | --- | --- | | `--mode gate\|review\|all` | `all` | Which half to run. `gate` is deterministic and needs neither a model nor the packages that would call one; `review` is the AI agent and needs both. See [Gate and review](/docs/concepts/gate-and-review). | | `--ci` | off | Machine-readable mode: report JSON on stdout, progress on stderr. | | `--target <dir>` | — | Audit a specific app in a [monorepo](/docs/monorepos), e.g. `apps/web`. | | `--all` | off | Audit every `.gribble/` in the repository. | | `--env <name>` | — | Apply an `environments.<name>` block from `gribble.yaml`. | | `--update-baseline` | off | Write the [baseline](/docs/concepts/baseline) from this run. Does not commit. | | `--json` | off | Print the report JSON to stdout without the `--ci` progress behaviour. | | `--routes a,b` | — | Audit only these routes. Overrides `target.routes`. | | `--changed` | off | Audit only routes affected by the git diff, using the workspace dependency graph in a monorepo. | `.gribble/runs/latest.json` is written on every run regardless of flags. That path is what the [coding-agent skill](/docs/skills) and the [GitHub Action](/docs/ci-github-action) read. ### Terminal output ``` 🪱 3 gribbles are nibbling on localhost:3000… ✓ routes 12 discovered ✓ links 248 checked ✓ a11y 12 routes ✓ perf 12 routes … reviewing /pricing The gribbles found 4 holes in your hull — 2 need patching before you sail. error links/broken /pricing → /docs/plans returns 404 error a11y/form-labels /signup Input #email has no associated label warn seo/meta-description /blog/[slug] 22 characters, minimum is 50 warn review/copy /pricing "Contact sales" and "Talk to sales" on the same page 3 existing · 1 fixed ✅ Report: .gribble/runs/2025-03-02T14-21-08Z/report.json 204 steps · 318k tokens · $0.42 ``` Or, on a clean run: ``` The gribbles went hungry. Ship it. ``` ### `--ci` output contract This is the contract CI systems can rely on. It will not change within a major version. - **stdout** receives exactly one thing: the complete [report JSON](/docs/report-format), printed once when the audit finishes. Nothing else is ever written to stdout — no progress, no warnings, no banner. `gribble audit --ci > report.json` yields a valid JSON file. - **stderr** receives all progress and diagnostics, as plain lines without ANSI colour or cursor control, safe for a log viewer. - **Exit code** follows the table below. - `.gribble/runs/latest.json` is written as usual, and `gribble.sarif`, `gribble-junit.xml` and `gl-code-quality.json` are written to the run directory. - Sessions are kept in memory rather than written to `.gribble/sessions/`. - No interactive prompt is ever shown. Anything that would need one is an error with exit code `2`. ```bash gribble audit --ci --mode gate > report.json jq '.summary.gate' report.json # "pass" | "fail" jq '.summary.newCount' report.json ``` With `--all`, stdout carries a JSON array with one report per target. --- ## `gribble install` ```bash gribble install gribble install --with-deps ``` Downloads the Playwright Chromium build Gribble drives. `--with-deps` also installs the system libraries Chromium needs on a bare Linux image (it is passed straight to Playwright). Run once after installing, and after a Gribble upgrade that changes the browser version. Unnecessary inside the [Docker image](/docs/ci-github-action#docker-image) or on a CI image that already provisions Playwright browsers. --- ## `gribble login` ```bash gribble login gribble login <provider> gribble login <provider> --api-key "$MY_KEY" ``` | Flag | Description | | --- | --- | | `--api-key <key>` | Store an API key instead of running an interactive OAuth flow. | With no provider, you pick one from a list. Credentials go to `~/.gribble/auth.json`, or to `~/.pi/agent/` when `reusePiAuth: true`. See [Auth](/docs/auth#part-2-model-provider-auth). Passing a key on the command line puts it in your shell history. Prefer `--api-key "$MY_KEY"` with the value in an environment variable, or set the provider's standard environment variable and skip `login` altogether. --- ## `gribble logout` ```bash gribble logout gribble logout <provider> ``` Removes stored credentials for one provider, or for all of them when no provider is named. Environment-variable credentials are unaffected — nothing on disk can unset those. --- ## `gribble models` ```bash gribble models ``` Lists every model your current credentials can reach, **recommended first**. The recommended set prefers reliable tool calling, no vision requirement, and a price that survives being run on every pull request. Copy an id into `model` in `gribble.yaml`. Gribble hardcodes no model name; the recommendation table is refreshed each release. --- ## `gribble explain` ```bash gribble explain a11y/touch-target gribble explain links/broken gribble explain seo/robots-noindex --env preview ``` Prints a rule's description, option schema with defaults, severity in each preset, a bad and a good example, and the fix hint — the same registry metadata that generates the [rules reference](/docs/configuration/rules-reference) and the `docsUrl` on every finding. Run inside a project (any directory at or below the one holding `.gribble/`) it also resolves the rule against that project and appends what it found: the effective severity, the `Source:` that settled it — a preset, a `rules.yaml` in the cascade, or [`environments.<name>.rules`](/docs/configuration/gribble-yaml#environments-name-rules) — the options when they differ from the registry defaults, and the route globs an `overrides` block re-settles it on. `--env <name>` resolves it the way `audit --env <name>` would, and fails the same way on an environment that does not exist. Outside a project nothing is appended: `explain` stays a plain reference. ``` Effective: off Source: environments.preview.rules.seo/robots-noindex ``` --- ## `gribble ignore` ```bash gribble ignore 9f2c1d4a7b3e0c58 gribble ignore 9f2c1d4a7b3e0c58 --target apps/web ``` Appends a fingerprint to `ignore` in `rules.yaml` (the one in `.gribble/` of the current directory, or of `--target`), leaving every other line and comment untouched. Add a comment explaining why, on the same line, before you commit it: ```yaml ignore: - 9f2c1d4a7b3e0c58 # external link behind a paywall, verified manually ``` Fingerprints come from the report, the PR comment marker, or the terminal output with `--json`. This suppresses exactly one problem on exactly one route; it is not a way to turn a rule off. See [Findings](/docs/concepts/findings#suppression). --- ## `gribble baseline update` ```bash gribble baseline update gribble baseline update --target apps/web --env preview gribble baseline update --mode all ``` Runs a `gate` audit and writes `.gribble/baseline/` from it. Equivalent to `gribble audit --mode gate --update-baseline`; pass `--mode all` to record AI findings in the baseline too. `--target`, `--all`, `--env`, `--json` and `--ci` behave as they do for `audit`. It does not commit — staging and committing is always your decision. Reach for it when you deliberately accepted a regression, rewrote a page, changed viewports or rule severities, or are onboarding a new app. To suppress a single finding, use `ignore` instead. See [Baseline](/docs/concepts/baseline#updating-by-hand). --- ## `gribble version` ```bash gribble version ``` Prints the Gribble version. Also available as `--version`. --- ## Exit codes | Code | Meaning | | --- | --- | | `0` | Everything passed. No new blocking findings. | | `1` | The gate failed — at least one new `error` or `critical` finding from a deterministic rule or `flows/replay`, or coverage required by [`coverage.required`](/docs/configuration/gribble-yaml#coverage) did not execute. | | `2` | Config or auth error. Invalid YAML, a missing environment variable, no credentials for the configured provider, a browser that will not start, a prompt that would be needed without a terminal. | | `3` | Gribble itself crashed. Re-run with `--verbose` for the stack trace and please report it. | | `4` | The site stopped answering mid-audit: the `target.start` process exited, or `target.maxConnectionFailures` routes in a row were refused. The dev server's last output is printed; no report or baseline is written. | | `130` | Interrupted: Ctrl+C during a prompt or an audit. | The distinction between `1` and `2` is the useful part: `1` means your site has a problem, `2` means your setup does. A CI job that treats them identically will send people hunting for a bug that does not exist. ```bash gribble audit --ci --mode gate case $? in 0) echo "clean" ;; 1) echo "gate failed" ;; 2) echo "gribble is misconfigured" ;; 4) echo "the dev server died mid-audit" ;; esac ``` --- ## Environment variables | Variable | Effect | | --- | --- | | `GRIBBLE_HOME` | Overrides `~/.gribble` for settings, auth and the model catalogue. | | `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`, … | Provider credentials, read when `auth.json` has none. | | Anything named in `auth.profiles.*.env` | Target-site credentials. Values are redacted from logs and reports. | | Anything referenced as `${VAR}` in `gribble.yaml` | Interpolated at load time. A missing one is a hard error naming the variable. | --- ## Recipes **Fastest possible pre-push check.** ```bash gribble audit --mode gate --changed ``` Deterministic checks on only the routes your diff can affect. No model, no tokens. **Verify an agent's fix.** ```bash gribble audit --mode gate --routes /pricing ``` **Full pre-release sweep.** ```bash gribble audit --mode all ``` **Audit a preview deployment.** ```bash PREVIEW_URL=https://my-app-abc123.vercel.app gribble audit --env preview ``` **Extract findings for another tool.** ```bash gribble audit --ci --mode gate > report.json jq -r '.findings[] | select(.status=="new") | "\(.severity)\t\(.rule)\t\(.route)"' report.json ``` **Every app in a monorepo, incrementally.** ```bash gribble audit --all --changed ``` **Re-baseline after an intentional redesign.** ```bash gribble baseline update git add .gribble/baseline git commit -m "chore: update gribble baseline after nav redesign" ``` --- # Report format The report JSON, its versioning guarantees, and the SARIF, JUnit and GitLab Code Quality outputs derived from it. Source: https://gribble.dev/docs/report-format.md Every audit produces one JSON document. It is the single source of truth: the terminal summary, the PR comments, the check annotations, SARIF, JUnit, GitLab Code Quality and the baseline update are all derived from it, and nothing consumes anything else. ``` .gribble/runs/ 2025-03-02T14-21-08Z/ report.json gribble.sarif gribble-junit.xml gl-code-quality.json snapshots/ screenshots/ traces/ latest.json always the most recent report.json ``` `.gribble/runs/latest.json` is written on every run, whatever flags you pass. That is the path the [coding-agent skill](/docs/skills) and the [GitHub Action](/docs/ci-github-action) read. `output.keep` in `gribble.yaml` controls how many timestamped run directories survive before the oldest are pruned. ## Annotated example ```json { "version": 1, "gribbleVersion": "1.4.0", "generatedAt": "2025-03-02T14:21:08.412Z", "mode": "all", "target": { "name": "apps/web", "url": "http://localhost:3000", "environment": "preview" }, "repo": { "remote": "git@github.com:acme/storefront.git", "branch": "feat/new-pricing", "commit": "c41f8b2e9a7d3f05", "baseCommit": "3f9a21c0d8e4b6a1" }, "model": { "provider": "<provider>", "id": "<model>", "thinking": "medium" }, "budget": { "steps": 148, "maxSteps": 200, "tokens": 318204, "maxTokens": 2000000, "costUsd": 0.42 }, "baseline": { "present": true, "commit": "3f9a21c0d8e4b6a1", "bootstrap": false, "status": "available", "routes": { "compared": 7, "notComparable": [{ "route": "/changelog", "reason": "not in the baseline yet" }] } }, "summary": { "counts": { "critical": 0, "error": 2, "warn": 2, "info": 1 }, "newCount": 5, "existingCount": 3, "fixedCount": 1, "gate": "fail", "headline": "The gribbles found 4 holes in your hull — 2 need patching before you sail." }, "findings": [ { "fingerprint": "9f2c1d4a7b3e0c58", "rule": "links/broken", "severity": "error", "source": "deterministic", "status": "new", "title": "Internal link returns 404", "message": "The link to /docs/plans in the pricing table returns HTTP 404.", "route": "/pricing", "viewport": "desktop", "location": { "file": "src/components/PlanTable.tsx", "symbol": "PlanTable", "selector": "[data-testid=plan-compare-link]" }, "subject": "http://localhost:3000/docs/plans", "suggestion": "The page was renamed to /docs/pricing-plans in #812. Update the href or add a redirect.", "evidence": { "url": "http://localhost:3000/pricing", "snippet": "<a href=\"/docs/plans\">Compare plans</a>" }, "docsUrl": "https://gribble.dev/rules/links/broken" }, { "fingerprint": "4d81a0ff26b7c913", "rule": "review/copy", "severity": "warn", "source": "ai", "confidence": 0.82, "status": "new", "title": "Inconsistent call-to-action wording", "message": "The pricing page uses \"Contact sales\" in the header and \"Talk to sales\" in the enterprise card. guidelines.md requires one term per concept.", "route": "/pricing", "location": { "file": "src/routes/pricing/EnterpriseCard.tsx", "symbol": "EnterpriseCard" }, "subject": "contact-sales-cta", "suggestion": "Use \"Contact sales\" in both places.", "evidence": { "screenshot": "screenshots/pricing@desktop.webp" }, "docsUrl": "https://gribble.dev/rules/review/copy" } ], "routes": [ { "route": "/pricing", "url": "http://localhost:3000/pricing", "status": 200, "metrics": { "lcpMs": 2210, "cls": 0.02, "tbtMs": 180, "lighthousePerformance": 81, "pageWeightKb": 1310, "requestCount": 58 }, "snapshot": "snapshots/pricing.aria.yaml", "screenshots": { "mobile": "screenshots/pricing@mobile.webp", "desktop": "screenshots/pricing@desktop.webp" } } ], "flows": [ { "name": "smoke", "ok": true, "kind": "replay", "durationMs": 4120, "steps": 9 }, { "name": "checkout", "ok": false, "kind": "replay", "durationMs": 18340, "steps": 11, "error": "Step 8 (expect_text \"Order summary\"): timed out after 5000ms" } ], "notRun": [ { "rule": "perf/*", "route": "/pricing", "reason": "Lighthouse could not run: Cannot find module 'tslib'", "code": "error" }, { "rule": "html/*", "route": "/sitemap.xml", "reason": "response is application/xml, not an HTML document; page rules skipped", "code": "unsupported", "intentional": true } ], "completeness": { "status": "incomplete", "routes": { "requested": 10, "checked": 8, "notChecked": [ { "route": "/account/settings", "code": "auth-failed", "intentional": false, "reason": "auth profile \"user\": the login flow did not complete." }, { "route": "/blog/[slug]", "code": "unresolved", "intentional": false, "reason": "no link on the crawled pages matches this dynamic route" } ] }, "flows": { "requested": 3, "ran": 2, "notRun": [ { "flow": "admin-export", "code": "excluded", "intentional": true, "reason": "limited to production; this run is preview" } ] }, "checks": { "notRun": 2, "unexpected": 1 }, "review": { "status": "incomplete", "code": "budget-exhausted", "reason": "max_steps (200) reached" } }, "durationMs": 94210 } ``` ## Field reference ### Top level | Field | Type | Description | | --- | --- | --- | | `version` | `1` | Report schema version. See [versioning](#versioning). | | `gribbleVersion` | string | The Gribble release that produced this report. | | `generatedAt` | ISO string | When the run finished. | | `mode` | `gate` \| `review` \| `all` | Which halves ran. | | `target` | object | `name` (empty for a single-app repo, else a path like `apps/web`), `url`, optional `environment`. | | `repo` | object? | `remote`, `branch`, `commit`, `baseCommit`. Absent outside a git repository. | | `model` | object? | `provider`, `id`, optional `thinking`. Absent in `--mode gate`. | | `budget` | object | Actual and maximum `steps`, `tokens`, plus `costUsd`. | | `baseline` | object | `present`, the baseline's `commit`, `bootstrap`, the comparison `status` and per-route comparability. See [Baseline status](#baseline-status). | | `summary` | object | See below. | | `findings` | Finding[] | All findings, deduped and sorted. | | `routes` | RouteResult[] | One entry per audited route. | | `flows` | FlowResult[] | One entry per flow that ran. | | `notRun` | NotRunCheck[]? | Checks that could not run. Absent when every check ran. | | `completeness` | object? | What executed, separate from what was found. See [`completeness`](#completeness). | | `durationMs` | number | Wall-clock duration of the audit. | `baseline.bootstrap` is `true` when there was no baseline and this run created one. Consumers should suppress comments and pass the gate in that case. ### Baseline status | Field | Type | Description | | --- | --- | --- | | `baseline.status` | `available` \| `bootstrap` \| `not-comparable` | `available`: findings were compared with a baseline. `bootstrap`: this run created the baseline and compared nothing. `not-comparable`: no baseline, or one that shares no route with this run. | | `baseline.routes` | object? | `compared` (checked routes the baseline knows) and `notComparable[]` (`route`, `reason`) for checked routes it has never seen. Only on gate runs that compared. | A route missing from the baseline is not an error: every finding on it is simply `new`. The list tells a reviewer that "no new findings" on that route was never measured against anything. ### `summary` | Field | Type | Description | | --- | --- | --- | | `counts` | object | Findings by severity, **over status `new` only**. | | `newCount` | number | Findings not in the baseline. | | `existingCount` | number | Findings already in the baseline. Counted, never commented. | | `fixedCount` | number | Baseline findings that have disappeared. | | `gate` | `pass` \| `fail` | `fail` when a **new** finding has severity `error` or `critical` **and** comes from a deterministic rule or `flows/replay`, or when [required coverage](#completeness) did not execute. | | `headline` | string | One human sentence for the top of a comment or terminal summary. | `counts` covering only new findings is deliberate: a repository with 400 known accessibility findings should show `error: 0` on a PR that introduced none. ### `findings[]` Full treatment in [Findings](/docs/concepts/findings). In short: `fingerprint` is a stable 16-hex-character identity computed in code; `source` is `deterministic` or `ai`; `confidence` appears on AI findings only; `status` is filled by the baseline diff; `location` carries `file` and `symbol` rather than line numbers, so it survives refactors. ### `routes[]` | Field | Type | Description | | --- | --- | --- | | `route` | string | Normalized path, e.g. `/blog/[slug]`. | | `url` | string | The URL actually visited. | | `status` | number? | HTTP status of the document response. | | `metrics` | RouteMetrics? | `lcpMs`, `cls`, `tbtMs`, `lighthousePerformance`, `pageWeightKb`, `requestCount`. | | `snapshot` | string? | Path to the aria snapshot within the run directory. | | `screenshots` | object? | Viewport name to image path within the run directory. | These are the numbers `perf/regression` compares against `baseline/metrics.json`, and they are recorded for every route whether or not a threshold was crossed — so the history is there even for routes nobody complained about. ### `flows[]` | Field | Type | Description | | --- | --- | --- | | `name` | string | Flow name from its frontmatter. | | `ok` | boolean | Whether the journey completed. | | `kind` | `replay` \| `ai` | Deterministic replay of a recorded sidecar, or an agent walking the prose. | | `durationMs` | number | How long it took. Drives `flows/max-duration`. | | `steps` | number? | Steps executed. | | `error` | string? | For a failure: which step, which action, what was expected. | A failed flow also produces a `flows/replay` finding. `flows[]` is the execution record; `findings[]` is the thing you act on. ### `notRun[]` | Field | Type | Description | | --- | --- | --- | | `rule` | string | The rule family or rule that did not run, e.g. `perf/*`, `html/*` or `security/headers`. | | `route` | string? | The route it was skipped on. Absent for site-wide checks such as `site/*`. | | `reason` | string | Why: Lighthouse failed to start, the response was not HTML, the target is loopback, a check threw. | | `code` | [reason code](#reason-codes)? | The same reason, machine-readable. Absent in reports from older versions: treat that as unexpected. | | `intentional` | `true`? | Present for an expected omission (`unsupported`, `excluded`, `skipped`). | A check that never ran contributes no findings, so a clean `findings[]` alone cannot tell "perf passed" from "perf never executed". `notRun[]` records the difference: Lighthouse that could not start on a route, the page rules skipped on a non-HTML response such as a sitemap, `security/headers` skipped because the target is a loopback address (dev servers do not carry production headers), or a check that threw. The list is omitted when everything ran. It does not affect `summary.gate` unless the project opts in with [`coverage.required.checks`](/docs/configuration/gribble-yaml#coverage). ### `completeness` `findings[]` says what was wrong with the parts that ran. `completeness` says which parts ran, so "no new findings" can be told apart from "nothing reached the pages that matter". It is present on every report written by this version. | Field | Type | Description | | --- | --- | --- | | `status` | `complete` \| `incomplete` | `incomplete` when a requested route, flow or check did not execute for an unexpected reason, or the review stopped early. Intentional omissions do not count. | | `routes` | object | `requested`, `checked`, and `notChecked[]` (`route`, `code`, `reason`, `intentional`). A route that answered with an error status is `unreachable`: its page checks never ran. | | `flows` | object | `requested` (every flow, excluded ones included), `ran`, and `notRun[]` (`flow`, `code`, `reason`, `intentional`). A flow that ran and failed is a finding, not a gap; one that never got past its start is `notRun`. | | `checks` | object | `notRun` (entries in the top-level `notRun[]`) and `unexpected` (those not intentional). Details stay in `notRun[]`. | | `review` | object | `status` (`complete`, `incomplete`, `skipped`, `not-requested`), plus `code` and `reason` when it did not complete. The review is advisory: an incomplete review is labeled, never a coverage failure. | | `required` | object? | Outcome of [`coverage.required`](/docs/configuration/gribble-yaml#coverage): `ok` and `missing[]` (`kind`: `route` \| `flow` \| `check` \| `baseline`, `name`, `code`, `reason`). Absent when nothing is required. When `ok` is `false`, `summary.gate` is `fail`. | #### Reason codes | Code | Intentional | Meaning | | --- | --- | --- | | `unreachable` | no | The page or the flow's start URL did not load (network error, HTTP 4xx/5xx). | | `unresolved` | no | A dynamic route had no concrete URL: no crawled link matched it. | | `auth-failed` | no | The auth profile could not produce a logged-in session. | | `replay-missing` | no | A flow has no recorded replay, and gate mode only replays recorded flows. | | `not-reached` | no | The reviewer did not get to it. | | `budget-exhausted` | no | The review budget ran out first. | | `no-model` | no | It needs the reviewer model and none was resolved. | | `aborted` | no | The run stopped early, e.g. interrupted with Ctrl+C. | | `error` | no | The check itself failed. | | `unsupported` | yes | The check does not apply, e.g. page rules on a sitemap. | | `excluded` | yes | Configuration left it out, e.g. a flow whose `env` does not include this environment. | | `skipped` | yes | The run skipped it on purpose by design e.g. `security/headers` on a loopback target. | Codes may be added in later releases. Treat an unknown code as unexpected. The terminal and the PR comment print the same dimensions side by side: ```text Execution: incomplete — 8 of 10 routes checked, 2 of 3 flows ran, review incomplete (budget-exhausted) Findings: no new blocking findings in completed checks Baseline: available for 7 routes; 1 has no comparable baseline Unreached: /account/settings — auth-failed Unreached: /blog/[slug] — unresolved Excluded: flow admin-export — excluded ``` ## Versioning `version` is the **report schema** version and is independent of `gribbleVersion`. Within `version: 1`: - **Fields are never removed and never change meaning.** A consumer written today keeps working. - **New optional fields may be added** in any release. Parse leniently; ignore what you do not recognise. - **Enum values may gain members.** New rule ids, new viewport names, new `AuditEvent` types. Handle unknown values without crashing. A breaking change bumps `version` to `2`, and Gribble will read both for at least one major release. The JSON Schema is published at [`https://gribble.dev/schema/report.json`](https://gribble.dev/schema/report.json) and generated from the same TypeBox definitions Gribble validates with, so it cannot drift from what the code produces. ```ts import type { Report, Finding } from "@gribble/core"; const report: Report = JSON.parse(await readFile(".gribble/runs/latest.json", "utf8")); const blocking = report.findings.filter( (f) => f.status === "new" && (f.severity === "error" || f.severity === "critical"), ); ``` ## Self-contained by design A report explains itself with no access to the repository that produced it. It carries the Gribble version, the model, the target URL and environment, the git remote, branch, commit and base commit, the baseline commit it was compared against, and the budget actually consumed. That is enough to answer, months later, from a downloaded artifact alone: which commit, which model, which baseline, how much did it cost, and what was the site at the time. Two consequences worth planning for: - **Uploadable.** Gribble is local-only today — no cloud, no account, no telemetry. But a report is a complete, versioned, self-describing document, so a hosted dashboard could ingest one without needing repository access. That path is kept open deliberately; nothing about it is required to use Gribble. - **Treat it as sensitive.** A report can contain page content, screenshots and URLs from a logged-in session. Values of environment variables named in [auth profiles](/docs/auth) are redacted, but a report from a staging site is still internal data. `.gribble/runs/` is gitignored by default; look before you attach one to a public issue. ## Derived outputs All three are written next to `report.json` in the run directory when `--ci` is set, and all three are projections of it. Nothing appears in them that is not in the JSON. ### SARIF `gribble.sarif`, SARIF 2.1.0. Each finding becomes one result: the rule id becomes the SARIF rule, `docsUrl` its help URI, `location.file` the artifact location, `message` the result message, and severity maps to SARIF levels — `critical` and `error` to `error`, `warn` to `warning`, `info` to `note`. ```yaml - uses: github/codeql-action/upload-sarif@v3 if: always() with: sarif_file: gribble.sarif ``` Findings then appear in the repository's Security tab with GitHub's own dedupe and dismissal on top. `if: always()` matters — without it a failed gate skips the upload and you lose the results you wanted. ### JUnit `gribble-junit.xml`, for test reporters and dashboards that speak JUnit. One test case per finding, grouped into suites by rule category, with the route in the case name and the message and suggestion in the failure body. Flow results appear as cases too, so a broken journey shows up as a failed test rather than only as a finding. ### GitLab Code Quality `gl-code-quality.json`, the [Code Quality report](https://docs.gitlab.com/ci/testing/code_quality/) GitLab reads from `artifacts:reports:codequality`. A JSON array with one issue per active finding: ```json [ { "type": "issue", "check_name": "links/broken", "description": "Link to /pricing-old returns 404 (/)", "content": { "body": "…message, subject, fix and docs link…" }, "categories": ["links"], "severity": "major", "fingerprint": "3f9a1c0e7b2d4a58", "location": { "path": "src/components/Footer.tsx", "lines": { "begin": 1 } } } ] ``` - `fingerprint` is the finding's own fingerprint. GitLab diffs the merge request's report against the target branch's by this field, so its new/fixed counts agree with Gribble's. - `severity` maps `critical → critical`, `error → major`, `warn → minor`, `info → info`. GitLab's `blocker` is never used. - `location.path` is `location.file` when the finding was mapped to source, otherwise the route. `lines.begin` is always `1`: Gribble locates by symbol, not by line. - `description` is the title, with the route appended when the path is a file so the widget still says which page it was seen on. The message, subject, suggestion and docs link go in `content.body`. - Fixed findings are omitted, as in SARIF and JUnit. See [GitLab CI](/docs/ci-gitlab) for the pipeline that consumes it. None of these formats can express everything the JSON does — per-route metrics, budget consumption, baseline status, confidence. Use them for integration, and the JSON when you want the whole picture. --- # FAQ Cost, non-determinism, false positives, privacy, Windows, mobile, and why not just use Lighthouse CI. Source: https://gribble.dev/docs/faq.md ## Why not just use Lighthouse CI, axe CI and Percy? Use them. Gribble runs Lighthouse and axe itself, and does pixel-diff visual regression, so it overlaps with all three — but the overlap is the cheap part. What those tools cannot do is answer questions with no metric behind them. Does the checkout journey still work end to end? Does this empty state tell the user what to do next? Is the same button called "Contact sales" here and "Talk to sales" there? Is there any way back from this page? Did we ship a `TODO` in a heading? A Lighthouse score of 94 is compatible with a completely broken signup form. The other difference is shape. Those tools are three configurations, three dashboards, three sets of thresholds and three things to wire into CI. Gribble is one config, one baseline, one report, one PR comment — and the deterministic half is exactly as reproducible as they are, because it is the same engines underneath. If you already have a Lighthouse CI setup you are happy with, set `perf/*` rules to `off` and use Gribble for the rest. Nothing here demands exclusivity. ## How do I control cost? Several levers, roughly in order of effect: - **Run `--mode gate` in CI.** Deterministic checks, flow replay and all regression rules run with no model at all. Zero tokens, and no model runtime installed either — the pi packages are [optional peer dependencies](/docs/getting-started#the-review-runtime-is-optional), so a fresh gate-only install skips three provider SDKs and the AWS credential chain. A pnpm lockfile carried over from 0.3 keeps them until you [re-resolve it](/docs/getting-started#upgrading-from-0-3). Many teams run gate on every PR and review nightly. - **Use `--changed`.** Only routes the diff can affect are audited. - **Set budgets.** `budget.max_steps`, `budget.max_tokens` and optionally `budget.max_cost_usd` in `gribble.yaml` are hard caps; the run ends cleanly and reports what it has. - **Keep `review.vision: false`** — the default. The model reads structured page snapshots instead of images, which is cheaper *and* more accurate. - **Promote flows.** Every explored journey you turn into a recorded [replay sidecar](/docs/flows#the-replay-sidecar) moves work from the expensive mode to the free one, permanently. - **Pick a cheaper model.** `gribble models` sorts by recommendation, and the recommended set is chosen partly on price. Gate does not care which model you picked, because it does not use one. Every audit prints its actual token count and dollar cost, and the same numbers are in `report.budget`. Measure your own site before optimising. ## AI is non-deterministic. How can this be in CI? Because the non-deterministic half is not allowed to matter to your build. The gate verdict is `fail` only when a **new** finding with severity `error` or `critical` comes from a **deterministic rule or `flows/replay`**. AI findings are additionally capped at their `review/*` rule severity, which defaults to `warn`, and dropped entirely below `review.min_confidence`. Three independent mechanisms, each sufficient alone. So `--mode gate` is bit-for-bit reproducible and can be a required status check. Review adds comments, which a human reads and judges — and a comment being occasionally wrong costs thirty seconds, not a blocked release. You can raise a `review/*` rule to `error` and let AI findings block merges. We think you should not, at least not until you have months of evidence about your own false-positive rate. ## What about false positives? They are the main risk to the product. A reviewer you stop trusting is worse than no reviewer. Five defences: 1. **Comment cap.** `review.max_comments` defaults to 5. Five comments somebody reads beats ninety nobody does. 2. **Confidence floor.** `review.min_confidence` defaults to 0.7; below it, findings are dropped rather than downgraded. Raise it to 0.85 if review is noisy. 3. **Severity capping.** AI findings cannot block merges under the default configuration. 4. **The baseline.** Existing findings are counted, never commented. A PR only hears about what it introduced. 5. **Suppression that is precise.** `gribble ignore <fp>` kills one finding on one route, not a whole rule. And a sixth, less mechanical one: a recurring false positive usually means an ambiguous [guideline](/docs/guidelines). Sharpening the sentence fixes it better than an ignore does. A `## What not to flag` section in `guidelines.md` is a legitimate and effective tool. Development is also evaluated against a deliberately broken reference site with dozens of known defects, and every prompt or model change is measured on it for both recall and false positives. ## Can I drive Gribble through my coding agent? Won't it just silence the findings? Yes, and that is how most people use it. `gribble init` installs a [skill](/docs/skills) for Claude Code, Cursor, pi, and any agent that reads the Agent Skills location, so ordinary requests work: ```prompt Fix the new Gribble findings on the pricing page and verify with a gate audit. ``` The skill is explicit that silencing its critic is not the agent's call. It fixes the cause and re-runs the gate to prove it. When it thinks a finding is wrong, it says so and suggests the fingerprint-scoped `gribble ignore` for you to approve; it does not add `ignore` entries, turn rules `off`, lower severities, or touch `.gribble/baseline/` on its own. Those are decisions for a person, and they show up in the diff of a committed file where a reviewer can see them. If an agent does it anyway, treat it like any other bad change: reject the diff, and tell it why. ## Why doesn't the model look at screenshots by default? Because text beats pixels for almost everything. Given the DOM, the model knows the exact hex colour, the exact font size in pixels, the exact accessible name, whether a button has a label, and what a form field is called. Given a PNG, it is guessing at all of them — and models are noticeably bad at exactly this kind of precise visual judgement. So `page_snapshot` returns a simplified DOM, an aria snapshot, bounding boxes, and overlap, overflow and design-token violations **already computed in code**. Screenshots are still taken for pixel-diff regression (done in code) and for humans to look at. Set `review.vision: true` to hand the model the `screenshot` tool for the cases where data genuinely cannot say: canvas rendering, image content, a chart that looks wrong. It costs more and lets you use a vision model rather than any tool-calling model. ## Does Gribble work on Windows? Yes. Node 22, Playwright and Gribble all run on Windows, and CI runs a Windows matrix. Two practical notes. Your `target.start` command runs through the platform shell, so a command with Unix-only syntax needs a cross-platform equivalent — usually the package script you already have. And paths inside reports and baselines are stored with forward slashes regardless of platform, so a baseline committed on macOS compares correctly against a run on Windows. Mixed-platform teams need no special configuration. ## Can Gribble audit my iOS or Android app? Not yet. Mobile apps are phase two. The plan is to swap the browser engine for Appium or Maestro while keeping everything above it — flows, rules, guidelines, findings, fingerprints, baselines, the comment lifecycle and the report format. That layer is already engine-agnostic; the work is the driver underneath. What works today is your mobile **web** experience: the `mobile` viewport is audited by default at 390×844, with a real mobile viewport in a real browser, and rules like `ui/horizontal-overflow` default to mobile-only because that is where it happens. ## Where does my data go? Nowhere. There is no Gribble cloud, no Gribble account, no telemetry and no server of ours in the path. Your pages, screenshots, source code and reports stay on the machine running the audit. The only network traffic Gribble originates is your dev server or preview URL, external links it checks for `links/broken-external`, and — in review mode — **your** model provider, called directly with **your** API key and billed to you. Credentials live in `~/.gribble/auth.json` on your machine (or `~/.pi/agent/` with `reusePiAuth`). Site credentials are environment variables you set, named but never stored in config, and redacted from session logs and reports. Practical caution: review mode does send page content to your model provider. If your staging environment contains real customer data, either use synthetic data — which you should be doing anyway — or run `--mode gate`, which never contacts a model. Report JSON is designed to be self-contained and uploadable so a hosted dashboard stays possible later. Uploading would be an explicit choice you make, not a default. ## Which model should I use? Run `gribble models`. It lists what your credentials can reach, with recommended options first, and you write the one you pick into `gribble.yaml`. The recommended set favours reliable tool calling, no vision requirement (the agent reads structured snapshots) and a price that survives running on every pull request. Gribble deliberately hardcodes no model name in its code or documentation: any specific recommendation would be stale within months. The table lives in one file in the source and is refreshed each release. Commit the model. Your whole team and CI then run the same audit, and `review/*` findings stay comparable across runs. The model is recorded in `baseline/meta.json` too, because a wave of new AI findings on an unrelated PR is usually explained by somebody changing it. ## Why build on pi? Gribble needs an agent loop, a multi-provider model catalogue with pricing, credential storage with OAuth and API keys, a tool-definition system, and a session format that records every call and result. All of that is undifferentiated infrastructure, and [pi](https://github.com/earendil-works/pi) already has it, with a real SDK meant to be embedded. Gribble is a shell around pi rather than a pi extension: it imports the SDK and calls `createAgentSession()` directly, no subprocess and no RPC. That leaves us owning the parts that are actually Gribble — the browser and audit tools, the deterministic checks, the guardrails, the report format and the baseline machinery — and it means every model pi supports works here on day one. pi's session file is also a complete audit trace, which is what the local replay UI will read. Practical consequences for you: Node 22 or newer, `gribble login` uses pi's auth storage, `model` uses pi's `provider/id:thinking` syntax, and `reusePiAuth: true` lets existing pi users skip a second login. ## Will Gribble solve CAPTCHAs or get past 2FA? No, and this is not a missing feature. Defeating a bot check is exactly the behaviour those checks exist to prevent, and an agent that will do it on your instruction is an agent that will do it on a web page's instruction. Ours does not. The workable options are all better anyway: disable the check in staging (most teams already do for their E2E suite), add a dev-only login endpoint behind an environment flag and call it from a `command` [auth profile](/docs/auth#command), or inject a session with a `cookie` or `header` profile. See [Auth](/docs/auth#no-captcha-no-2fa-bypass). ## Do I need a model at all? Not for `--mode gate`. Broken links, network failures, console errors, SEO, axe accessibility, Lighthouse thresholds, HTML sanity, security checks, UI hard rules, flow replay and all three regression rules run as plain code. That is a genuinely useful product on its own, and it is a sensible way to adopt Gribble: gate in CI from day one, review locally where you already have a subscription, and turn on review in CI when you have decided it is worth an API key. ## How long does an audit take? Depends on route count, but rough orders of magnitude on a small site: gate is seconds to a couple of minutes, dominated by Lighthouse, which is the slow part per route. Review adds minutes, depending on how many flows there are and how much exploring it does. Levers if it is too slow: `--changed` to audit only affected routes, an explicit `target.routes` list instead of `auto` on a site with hundreds of generated pages, fewer viewports (each one multiplies screenshot and Lighthouse work), `review.explore: false` to keep review to your written flows, and `budget.max_steps` as a hard ceiling. ## Can I use Gribble on a site somebody else runs? Technically it will point anywhere `allowed_origins` permits. Do not. Gribble drives a real browser through real journeys, submits forms, and runs Lighthouse repeatedly. On infrastructure you do not own that is unsolicited automated load at best. `allowed_origins` defaults to nothing beyond your target host specifically to make wandering hard. Audit your own development, preview and staging environments. Auditing your own production is legitimate but read-only in spirit — expect the guardrails to block form submissions on a non-staging host, which is the intended behaviour, not a bug. ## My PR comments disappeared. What happened? Most likely one of three things. The pull request is **from a fork**, so GitHub gave the workflow a read-only token and comments cannot post. The audit still ran and the artifact still uploaded. The run was a **bootstrap** — no baseline existed, so Gribble recorded the current state instead of reporting it. Commit `.gribble/baseline/` and the next run is a real diff. Or the findings were all **existing**: already in the baseline, so counted in the summary and deliberately not commented on. That is the diff-not-score principle working, not a failure. If a comment vanished rather than never appearing, that is the [lifecycle](/docs/concepts/findings#comment-lifecycle) doing its job: a fingerprint that disappears gets its comment edited to "patched ✅" and its thread resolved.