ADR Guard
# ADR Guard
[](https://github.com/rodri-oliveira-dev/adr-guard/actions/workflows/ci.yml)
[](https://www.nuget.org/packages/RodriOliveira.AdrGuard)
[](https://www.nuget.org/packages/RodriOliveira.AdrGuard.Mcp)
**MCP:** [](https://glama.ai/mcp/servers/rodri-oliveira-dev/adr-guard)
[](https://marketplace.visualstudio.com/items?itemName=rodrioliveira.adr-guard)
[](https://github.com/rodri-oliveira-dev/adr-guard/releases)

[](LICENSE)
[Português (Brasil)](README.pt-BR.md) · [Documentation portal](https://rodri-oliveira-dev.github.io/adr-guard/) · [Markdown documentation](docs/index.md) · [Changelog](CHANGELOG.md) · [Accessibility](ACCESSIBILITY.md#english)
**Understand architectural decisions. Record the reasoning. Keep the history trustworthy.**
ADR Guard is a lightweight .NET command-line tool for creating, validating, reviewing, and indexing Architecture Decision Records (ADRs). It keeps decision documentation consistent in local development and CI without making architectural decisions for your team.
## What is an ADR?
An ADR is a short document that explains one consequential software decision: the context that required it, the option selected, and the benefits and costs that follow. ADRs help future contributors understand **why** a system was shaped a certain way—not only what the code does.
New to the practice? Follow the progressive guide:
1. [What is an ADR?](docs/fundamentals/what-is-an-adr.md)
2. [Why and when should a team use ADRs?](docs/fundamentals/why-use-adrs.md)
3. [Write and validate your first ADR](docs/guides/getting-started.md)
## What ADR Guard does
- creates offline `Proposed` ADRs from Minimal, Extended, or constrained Custom templates;
- validates canonical structure, filenames, statuses, required sections, links, IDs, and supersession relationships;
- supports separate, opt-in MADR 4.0 validation;
- generates a deterministic Markdown index only after validation succeeds;
- exports deterministic ADR metadata, declared relationships, and validation issues as schema `1.0` JSON for external integrations;
- supports Git-aware incremental checks, diagnostic baselines, and JSON/SARIF reports;
- offers opt-in, advisory [architecture impact analysis](docs/guides/architecture-impact-analysis.md) from explicit ADR-to-code mappings;
- verifies opt-in [architectural drift and fitness evidence](docs/guides/architectural-drift.md) without evaluating MSBuild or treating missing evidence as compliance;
- offers opt-in, human-reviewed AI drafting and technical review with explicit providers and context;
- integrates with GitHub Actions, VS Code, versioned container images, and an optional independently packaged MCP server for compatible agents.
Validation confirms deterministic documentation rules. It does **not** approve technical merit, authorize a decision, or turn AI output into an accepted architecture.
## Install
Install the published .NET Tool from NuGet.org:
```bash
dotnet tool install --global RodriOliveira.AdrGuard
adr-guard --version
```
Update an existing installation with `dotnet tool update --global RodriOliveira.AdrGuard`. Verify the currently published CLI on [NuGet.org](https://www.nuget.org/packages/RodriOliveira.AdrGuard) and the [GitHub Releases page](https://github.com/rodri-oliveira-dev/adr-guard/releases). MCP and VS Code are published and versioned independently. See the [compatibility matrix](docs/compatibility.md) for the verified channel-by-channel snapshot instead of inferring publication from source metadata or a tag.
## Quick start
From the root of an existing repository:
```bash
adr-guard init . --adr-directory docs/adr --template minimal
adr-guard new docs/adr --title "Use PostgreSQL as the order system of record"
```
Edit the generated `Proposed` ADR to replace its guidance with your real context, decision, and balanced consequences. Review it with the people affected by the choice, then run:
```bash
adr-guard check docs/adr
adr-guard index docs/adr
```
`check` validates the ADR set. `index` validates again and creates or updates `docs/adr/README.md`; `new` does not update the index automatically. Read the [first ADR tutorial](docs/guides/getting-started.md) for the complete published workflow.
CLI 1.12.0 adds the relationship exporter. With a CLI that reports version 1.12.0, run:
```bash
adr-guard export relationships docs/adr
```
It writes `.adr-guard/relationships.json` for tools such as Align and succeeds even when the artifact records validation issues. See the [export contract](docs/adr-relationships-export-v1.md) for integration details.
Published CLI 1.10.0 includes the read-only `adr-guard doctor [repository]` command for local CLI, repository, configuration, ADR-directory, .NET, and optional Git diagnostics. It never applies fixes or accesses the network. See the [CLI reference](docs/cli-reference.md#diagnose-a-local-environment); the command is not available in the older CLI 1.9.0 package.
## Choose the right structure
| Option | Use it when | Product boundary |
| --- | --- | --- |
| Minimal | Core context, choice, rationale, and consequences are enough | Generated by `new`/`draft`; canonical validation |
| Extended | Options, drivers, risks, or cross-team impact need explicit treatment | Generated by `new`/`draft`; canonical validation; **not MADR** |
| Custom | A team needs additional canonical prompts or sections | One strict local file via `--template-file`; not arbitrary Markdown |
| MADR 4.0 | The team deliberately uses MADR's external structure | Native `new --adr-format madr-4` generation in published CLI 1.11.0; canonical remains the default |
See the [selection matrix](docs/decision-design/choosing-a-template.md), [complete examples](docs/examples/README.md), [custom template contract](docs/custom-templates.md), and [MADR compatibility guide](docs/madr-4.md).
## Integrations
| Integration | Use | Guide |
| --- | --- | --- |
| GitHub Action | Validate, index, or explicitly run AI review/architecture impact; current development source also adapts read-only drift verification | [Consumer guide](docs/github-action.md) |
| VS Code | Visual ADR management, architecture/governance workflows, commands, Problems diagnostics, and ADR Explorer through a compatible installed CLI | [Extension guide](extensions/vscode/README.md) |
| MCP server | Give compatible agents structured, read-only access to ADR discovery, validation, impact, and drift tools | [MCP overview](docs/mcp.md) |
| Architecture Agent (source only) | Query local MCP evidence without a model, optionally request bounded OpenAI synthesis, and supervise one fingerprint-authorized `Proposed` creation through the CLI | [Development guide](docs/architecture-agent.md) |
| Containers | Run the same versioned CLI from GHCR or Docker Hub | [Container and supply-chain guide](docs/container.md) |
| CI reports | Produce text, JSON, or SARIF validation output | [Check reports](docs/check-reports.md) |
| Agent Skills | Give agents portable instructions for human-controlled ADR and CLI workflows | [Skills guide](docs/skills/README.md) |
The development-only Architecture Agent is distinct from the published CLI, MCP server, and portable Skills: it orchestrates them but has no package, installer, container, manifest, or release channel. See the guide for local build prerequisites, explicit configuration, architecture diagram, privacy/cost boundaries, supervised creation, troubleshooting, and current distribution status.
### See ADR Guard in action
The [ADR Guard demo repository](https://github.com/rodri-oliveira-dev/adr-guard-demo) shows the complete GitHub Actions validation cycle: an intentionally incomplete Architecture Decision Record fails deterministic `check` validation, then passes after the document is corrected. Follow the preserved [demonstration pull request](https://github.com/rodri-oliveira-dev/adr-guard-demo/pull/1), or read the [GitHub Action guide](docs/github-action.md#real-github-actions-demo) for the verified runs.
### Repository code quality (optional)
Maintainers can enable [SonarQube Cloud checks](docs/sonarqube-cloud.md) for .NET coverage, pull-request Quality Gates, and controlled HIGH/BLOCKER issue synchronization. This automation is **disabled until explicitly configured** and does not affect released products or the normal CI.
### Internal runtime architecture
The CLI and MCP server are separate executables that reference the same internal `AdrGuard.Core` class library. Core owns their shared deterministic parsing, validation, configuration, Git inventory, impact, drift, and relationship-export behavior; it does not depend on either executable and is not a standalone product or NuGet package. CLI packages include CLI plus Core. MCP packages include MCP plus Core without the CLI executable. VS Code and the GitHub Action remain adapters over the CLI contract and do not reimplement Core rules. See [ADR 0008](docs/adr/0008-extract-an-internal-shared-core.md) and the [compatibility matrix](docs/compatibility.md).
Publication is tracked independently for the CLI on [NuGet.org](https://www.nuget.org/packages/RodriOliveira.AdrGuard) and [GitHub Releases](https://github.com/rodri-oliveira-dev/adr-guard/releases), MCP on [NuGet.org](https://www.nuget.org/packages/RodriOliveira.AdrGuard.Mcp), and VS Code in the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=rodrioliveira.adr-guard). The Action compatibility tag `v1` follows an exact CLI release only through the controlled release workflow. See the [compatibility matrix](docs/compatibility.md) for the verified versions and exact component boundaries.
The [published ADR Guard for VS Code extension](https://marketplace.visualstudio.com/items?itemName=rodrioliveira.adr-guard) includes the visual ADR list plus guided creation, editing, and settings. These screens require the CLI 1.7.0 form contracts. Extension and CLI versions remain independent.

See the [extension source and installation guide](extensions/vscode/README.md) and the portal's [VS Code Visual Guide](https://rodri-oliveira-dev.github.io/adr-guard/product/vscode-visual-guide/) for the complete interface walkthrough.
Structured ADR creation and editing are implemented for trusted visual clients such as the VS Code extension. A compatible CLI from the 1.7.0 line exposes `new <directory> --form` and `edit <file> --form` as versioned JSON stdin/stdout contracts; they are not interactive terminal forms. The traditional `new --title` workflow remains the human-facing command-line path, including constrained custom templates. See the [creation guide](docs/creation.md), [CLI contract reference](docs/cli-reference.md), and [extension guide](extensions/vscode/README.md). Confirm that both the CLI and extension versions providing the visual forms have been published before relying on them.
The [GitHub Marketplace Action](https://github.com/marketplace/actions/adr-guard-architecture-decision-validator) and [Visual Studio Marketplace extension](https://marketplace.visualstudio.com/items?itemName=rodrioliveira.adr-guard) are published. The moving `@v1` tag is published, points to the latest published CLI release in the 1.x series, and supports `check`, `index`, opt-in `review` since v1.1.6, opt-in `impact` since v1.5.0, and read-only `drift` since v1.10.0. The Action does not expose `export relationships`, and the extension does not bundle the CLI.
The independent MCP `1.0.1` release can be installed with `dotnet tool install --global RodriOliveira.AdrGuard.Mcp --version 1.0.1`. See [MCP configuration](docs/mcp-configuration.md), [available tools](docs/mcp-tools.md), [VS Code integration](extensions/vscode/README.md#mcp-integration), and [security and permissions](docs/mcp-security.md).
## Agent Skills (P0 + P1)
Eleven portable [Agent Skills](docs/skills/README.md) cover ADR setup, creation, validation, technical review, lifecycle management, CI setup, when to write ADRs, trade-off analysis, supersession, audits, and team adoption. The skills guide agents in using ADR Guard; they do not install the CLI or make architectural approvals.
```bash
npx skills add rodri-oliveira-dev/adr-guard --list
npx skills add rodri-oliveira-dev/adr-guard --skill adr-guard-create --agent codex
```
The eleven Agent Skills are available on the default branch. See [installation, safeguards, and scope](docs/skills/README.md) to select and install only the workflows you need.
## Documentation
- **Learn:** [fundamentals](docs/index.md#learn-the-practice), [decision categories](docs/decision-design/decision-categories.md), [lifecycle](docs/fundamentals/lifecycle.md), and [anti-patterns](docs/decision-design/anti-patterns.md).
- **Use:** [first ADR tutorial](docs/guides/getting-started.md), [team adoption](docs/guides/team-adoption.md), and [offline creation](docs/creation.md).
- **Reference:** [CLI and configuration](docs/cli-reference.md), [compatibility matrix](docs/compatibility.md), [validation and governance](docs/relationship-governance.md), and [full technical index](docs/index.md#technical-reference).
- **Architecture analysis:** [impact analysis](docs/guides/architecture-impact-analysis.md), [architectural drift](docs/guides/architectural-drift.md), [diagnostic baselines](docs/incremental-validation.md), and [AI review](docs/adr-review.md).
- **MCP:** [overview](docs/mcp.md), [configuration](docs/mcp-configuration.md), [tool contracts](docs/mcp-tools.md), and [security](docs/mcp-security.md).
- **AI boundaries:** CLI review has been published since v1.1.2 and runs explicitly as `adr-guard review`; deterministic policy enforcement may return exit code `4`. See the [AI review guide](docs/adr-review.md), [draft privacy](docs/draft-templates.md), and [review security](docs/adr-review-security.md).
- **Project architecture:** [ADR Guard's own generated ADR index](docs/adr/README.md).
English is the default documentation language. Brazilian Portuguese pages use `.pt-BR.md` and are linked from each translated page.
## Build and contribute
The project targets .NET 10. To build and test from source:
```bash
dotnet restore AdrGuard.slnx
dotnet build AdrGuard.slnx --configuration Release --no-restore
dotnet test --solution AdrGuard.slnx --configuration Release --no-build
```
Issues and focused pull requests are welcome. Use the [issue tracker](https://github.com/rodri-oliveira-dev/adr-guard/issues) for scoped proposals and reproducible bugs, [GitHub Discussions](https://github.com/rodri-oliveira-dev/adr-guard/discussions) for questions, early ideas, and showcases, [SUPPORT.md](SUPPORT.md) for support guidance, and [SECURITY.md](SECURITY.md) for private vulnerability reporting.
## Releases and license
Published artifacts and exact version notes are available in [GitHub Releases](https://github.com/rodri-oliveira-dev/adr-guard/releases). Repository release notes remain under [`docs/releases`](docs/releases/).
ADR Guard is licensed under the [MIT License](LICENSE).
TDQS
Scored across 7 tools
Each tool has a distinct purpose: list/get/search operate on ADRs, relationships exposes declared edges, and validate/analyze/verify cover separate analysis concerns. The descriptions clarify boundaries, especially for read-only validation versus architecture-rule verification.
All tool names follow a consistent snake_case verb_noun pattern: list_adrs, get_adr, search_adrs, validate_adrs, analyze_impact, verify_architecture. get_adr_relationships is a minor noun extension but remains predictable and readable.
Seven tools is well-scoped for an ADR guard/analysis server. Each tool covers a meaningful operation without obvious redundancy or missing scope-driving tools.
The surface covers listing, retrieval, search, relationships, validation, impact analysis, and architecture verification, which is strong for a read-only guard server. However, there is no create/update/delete lifecycle support for ADRs, though that may be intentional for this guard-focused toolset.