Quickstart
The adr CLI validates a decision corpus, scaffolds new records, explains which
decisions govern a file, renders the decision graph, migrates an existing MADR
corpus in place, emits the ARB operations queue, and runs the deterministic
evaluator.
Install
Section titled “Install”Add the CLI to a project, or run it one-off. It exposes the adr binary.
# one-off, no install — always name the packagenpx @adrkit/cli lintnpx @adrkit/cli explain src/payments/api.ts
# or add it to the project and drive it from a scriptnpm install --save-dev @adrkit/clinpm pkg set scripts.adr=adrnpm run adr -- lint
# or install globally, for a bare `adr` on your PATHnpm install -g @adrkit/cliadr lint# one-off, no install — always name the packagebunx @adrkit/cli lintbunx @adrkit/cli explain src/payments/api.ts
# or add it to the project and drive it from a scriptbun add --dev @adrkit/clibun run adr lint # with "adr": "adr" in package.json scripts
# or install globally, for a bare `adr` on your PATHbun add --global @adrkit/cliadr lintThe examples below are written as bare adr … for readability. A local install
does not put adr on your shell PATH; run it through your package script, such
as npm run adr -- lint.
Create your first record — adr new
Section titled “Create your first record — adr new”If you have no docs/adr/ yet, start here: adr new creates the directory and
writes the first record, so it is the bootstrap step as well as the everyday one.
Running adr lint first on a repository with no corpus exits 2 with
Corpus directory not found: 'docs/adr'.
Scaffold a record with the next sequential id and valid frontmatter.
adr new "Use server-side rendering for authenticated routes"# choose a starting status (accepted/superseded need extra fields and are refused)adr new "Adopt OpenTelemetry" --status proposedThat writes docs/adr/0001-use-server-side-rendering-for-authenticated-routes.md
with affects: []. Filling affects in is what makes the decision locatable by
CI and agents — a record with no affects is advisory only. Each entry is a
type plus a pattern:
affects: - type: path pattern: "apps/web/app/**" - type: package pattern: "next@>=16"type is one of path, package, api, resource, entity, or data. See
the JSON Schema reference for the full field list.
Validate a corpus — adr lint
Section titled “Validate a corpus — adr lint”Validate every record under docs/adr/ against the schema, enforce unique ids,
flag dangling references between records (supersedes / supersededBy /
relatesTo / conflictsWith), and warn when an accepted record declares a
conflict via conflictsWith.
adr lint# lint a specific directory or filesadr lint --dir docs/adradr lint docs/adr/0001-record-architecture-decisions-in-git.md# machine-readable output for CIadr lint --jsonadr lint exits non-zero when it finds errors, so it drops straight into a CI
gate.
Explain what governs a file — adr explain
Section titled “Explain what governs a file — adr explain”Print every decision that matches a path, and the matcher that fired. Only
accepted records are reported as governing; matched proposals and
superseded, rejected, or deprecated records are listed under their own
headings so a rejected decision is never presented as binding.
adr explain packages/core/src/schema/adr.schema.tsadr explain package.json --jsonRender the decision graph — adr graph
Section titled “Render the decision graph — adr graph”Inspect the decision graph interactively, or emit deterministic DOT, Mermaid, or
JSON for another tool. Bare adr graph shows a compact terminal instrument when
stdout is a TTY and preserves DOT when piped or redirected.
# interactive overview, then one readable neighborhoodadr graphadr graph --focus 0014# GitHub-compatible Mermaid sourceadr graph --format mermaid > decisions.mmd# styled Graphviz DOT rendered to SVGadr graph --format dot | dot -Tsvg > decisions.svg# structured JSONadr graph --format jsonAdopt an existing MADR corpus — adr migrate
Section titled “Adopt an existing MADR corpus — adr migrate”Migrate a MADR corpus in place, additively and non-destructively. The migration is one-way; round-trip sync is deliberately unsupported (ADR-0008).
Status, date, and deciders are read from MADR 3.x YAML frontmatter, MADR 2.x
* Status: header bullets, and Nygard ## Status sections, so an
already-accepted corpus does not import as a backlog of proposals attributed to
nobody.
# preview without writingadr migrate --from madr --dry-run# applyadr migrate --from madr --dir docs/adrCorpus discovery requires <id>-<slug>.md filenames. If your MADR files use
descriptive names, migration warns that the records will not be discoverable —
pass --rename to move each file to a discoverable name as part of the run:
adr migrate --from madr --dir docs/adr --renameNext steps
Section titled “Next steps”- Enforce decisions on every PR — see Use in CI.
- Evaluate the proposed generated-wiki boundary — see Use with generated knowledge systems (provisional, pending ratification).
- Give agents the decision graveyard — see MCP setup.
- Discover commands, enable shell completion, configure color, and check every exit code — see the Command reference.
- Reference the schema from your editor and CI — see the JSON Schema.
- Read how adrkit governs itself in the decision records.