
nirnay-dag
io.github.Yash4305d-y/nirnay-dag
Computational Architecture Decision Graph Engine, Linter & MCP Server
Documentation
NirnayDAG
Turn Markdown Architecture Decision Records (ADRs) into a dependency graph so you can catch circular dependencies, measure blast radius before changing a decision, enforce lifecycle rules, and give AI coding agents architecture context over MCP.

Try it in 60 seconds
Requires Node.js 20+. Create an adrs/ folder with two ADR files:
<!-- adrs/0001-use-postgresql.md -->
---
id: ADR-0001
title: Use PostgreSQL
status: accepted
---
<!-- adrs/0002-add-reporting-service.md -->
---
id: ADR-0002
title: Add reporting service
status: accepted
depends_on:
- ADR-0001
---
Validate the DAG and inspect blast radius:
npx nirnay-dag validate ./adrs
✅ Architecture DAG validated successfully.
- Total ADRs: 2
- Root Decisions: 1
- Zero Cycles: Verified
npx nirnay-dag blast ADR-0001 ./adrs
Direct Dependents: 1 | Cascade Count: 1 | Risk Score: 66.5/100 (High)
Cascading Impacts:
- ADR-0002
Install globally for the short ndag command: npm i -g nirnay-dag.
Connect your AI agent
Generate the MCP configuration for your repo:
npx nirnay-dag init --agent <client>
Add --write to write the config file (--yes skips confirmation), then run npx nirnay-dag doctor to verify the MCP handshake.

Google Antigravity (tested end-to-end)
Config path: ~/.gemini/config/mcp_config.json (on Windows, init uses "command": "cmd", "args": ["/c", "npx", "-y", "nirnay-dag", "mcp"]):
{
"mcpServers": {
"nirnay-dag": {
"command": "npx",
"args": ["-y", "nirnay-dag", "mcp"],
"env": {
"ADR_DIR": "/absolute/path/to/docs/adr"
}
}
}
}
Other clients (Claude Code, Cursor, Claude Desktop) are documented in docs/AGENTS.md (config verified against docs, not tested by the author).
Try it on a real project
Run NirnayDAG against examples/shop-api (a 6-ADR service with affects globs and a deprecated session store):
npx nirnay-dag why src/payments/retry.ts ./docs/adr
src/payments/retry.ts
ADR-0003 — Retry Failed Payments with Exponential Backoff [accepted] (glob: src/payments/**)
Upstream constraints: ADR-0002 (accepted), ADR-0001 (accepted)
npx nirnay-dag blast ADR-0001 ./docs/adr
Direct Dependents: 3 | Cascade Count: 4 | Max Depth: 2 | Risk Score: 49/100 (Medium)
Cascading Impacts:
- ADR-0002
- ADR-0004
- ADR-0006
- ADR-0003
npx nirnay-dag lint ./docs/adr
warn │ deprecated-governs-code │ 0005-store-sessions-in-mongodb.md │ Deprecated decision ADR-0005 still governs existing files via affects.
Summary: 0 error(s), 1 warning(s), 0 info(s)
Then try these prompts in your connected AI agent:
"I want to change how payment retries work in src/payments/retry.ts. Before editing anything, check which architecture decisions govern it and what would be affected""What about src/legacy-sessions/?"

Reference
- CLI Reference — every command, flag, exit code, and
--jsonoutput shape - MCP Server Reference — all 6 stdio tools (
list_adrs,get_adr_context,query_blast_radius,validate_architecture,lint_architecture,get_adrs_for_files), inputs, and outputs - Configuration & Frontmatter — YAML frontmatter fields,
.nirnayrc.jsonschema, and built-in lint rules - Agent Setup Guide — setup details, troubleshooting, and rules snippet
- Risk Model — 0–100 topological risk scoring formula
Evidence
Tested across 7 pinned open-source repositories (results/corpus-results.json, docs/FINDINGS.md):
- 1,565 Markdown files scanned (1,538 decision nodes after excluding 27 template/index files;
450active edges,1,104isolated nodes). - Zero
depends_onedges declared in the wild (0hard edges,12succession edges,438soft body/KEP references). - Caught and fixed real parser bugs: duplicate
README.mdIDs in KEP directories and regex-extracted prose/code-block links.
Honest limits
- Hard dependency edges require
depends_onin YAML frontmatter (no NLP inference from prose). - Two
kep.yamlfiles inkubernetes/enhancementswith column-0 flow-sequence brackets emit a single-line warning and recover via line fallback. - Local web UI (
ndag serve) binds to127.0.0.1only.
Related projects
- AdrMcp — A .NET MCP server focused on authoring and searching ADRs. NirnayDAG focuses on computed analysis over existing ADR graphs (dependency validation, blast radius, topological risk scoring, linting, and file-governance queries).
Built by Yash
Built by Yash Vinay Kalyani · CONTRIBUTING.md · SECURITY.md · LICENSE (MIT)
nirnay-dagnpm install nirnay-dag