@nikovirtala/adr
v0.10.0
Published
Architecture decision records kept as event logs in git: frozen bodies, computed status and supersession chains. CLI and library.
Maintainers
Readme
@nikovirtala/adr
Architecture decision records kept as event logs in git, built on @nikovirtala/ledger. A decision is a Markdown body plus append-only event files. Its status (proposed, accepted, rejected, withdrawn, deprecated, superseded) is computed from the events, the body is frozen by its hash once accepted, and supersession chains always lead to the decision in force. See the design doc.
Released at 0.x. Phase 1 ("Core") brought the decision kind, the library and the adr CLI with new, accept, supersede, list, show and verify. Phase 2a ("Commands and Scope") adds init, reject, withdraw, deprecate, note, link, scope and for, accept --copy-scope, Conventional Commits messages for --commit, and ARK_ON_BEHALF_OF for agents. Phase 2b ("Guardrails") adds git hooks (adr hooks), a generated index.md that every write keeps fresh (adr index), display numbers in shallow clones read from that index, list --since, a recovery hint when git refuses a --commit, and verify checks for scope globs, code anchors, changes under inactive decisions and narrowed scopes. 0.5.0 checks references into other repositories' decision logs against a local cache (verify --fetch-sources, adr sources fetch, list --source, search --source), re-checks every decision in verify --staged when a staged config or template changes, lets proposed decisions name code that doesn't exist yet, and names batches of staged events in default commit subjects.
Install
npm install --save-dev @nikovirtala/adr # Node 24 or newer, git 2.32.0 or newer
npx @nikovirtala/adr --help # or run it without installingadr needs Node 24 or newer (engines: >=24). On older Node, npm prints an EBADENGINE warning and adr isn't supported.
Layout
docs/adr/
adr.toml # optional config (or adr.toml at the repository root)
index.md # generated, with [log] index = "committed"
decisions/k3f9q8a1-use-aurora-for-orders.md
events/k3f9q8a1/20261016T081030Z-p4d2-proposed.yaml
events/k3f9q8a1/20261016T091512Z-7aq5-accepted.yaml
templates/nygard.md # copied from the built-in on first useEach decision has a canonical id (k3f9q8a1). Accepted decisions also get a number (ADR-0001), assigned in the order their acceptances land on the first-parent history of main and never stored or renumbered. Commands take an id or a number in any form: k3f9q8a1, 7, 0007, ADR-7, adr-0007.
Commands
The examples assume the config adr init writes, where [policy] auto_commit = true makes every write commit. Add --no-commit to only stage; in a log whose config doesn't set auto_commit, add --commit to commit.
# Set up: write adr.toml (with auto_commit = true) and starter templates; never overwrites a file.
adr init --template nygard --template madr --commit
adr init --skill # also the agent skill and an AGENTS.md pointer
adr init --skill --skill-dir .kiro/skills/adr
# Propose: render a draft from a template, write the body and the proposed event, and commit them.
adr new "Use Aurora for orders" --section context="We need SQL." --section scope=services/orders
adr new "Use Aurora Serverless" --supersedes ADR-0002 --template madr --edit
# Accept: lint the draft, hash the body, and write accepted (plus superseded on each declared target).
adr accept k3f9q8a1
# Supersede an accepted decision by another accepted one.
adr supersede ADR-0001 --by ADR-0002 --reason "Aurora fits the query load"
# End a decision's life: reject or withdraw a proposal, deprecate an accepted decision.
adr reject k3f9q8a1 --reason "Too early"
adr withdraw k3f9q8a1 # --reason is optional
adr deprecate ADR-0003 --reason "Moving to a managed service"
# Annotate: a note in any state, and typed links (relates-to, refines, depends-on).
adr note ADR-0003 "Benchmarks are in the wiki"
adr link ADR-0004 ADR-0002 --rel refines
adr link ADR-0004 platform:k3f9q8a1 # a decision in a configured [[sources]] log
# Scope: the code a decision governs, as globs, and which decisions govern a file.
adr scope ADR-0004 --set 'services/orders/**' --set 'libs/db/**'
adr scope ADR-0004 --add 'services/billing/**' --remove 'libs/db/**'
adr scope ADR-0004 --clear
adr scope --follow-renames # after git mv: update the globs, stage, never commit
adr for services/orders/api.ts
adr for services/orders/api.ts --ref v1.2.0
# Read: list with computed status, show one decision with its state header.
adr list --status accepted
adr list --since ORIG_HEAD # only decisions with events added since a revision
adr show ADR-0001 --history
adr list --ref v1.2.0 # time travel: the log as of any ref
# Search ids, titles, bodies and notes: every word must match; active decisions unless --all.
adr search orders aurora
adr search dynamodb --all
# Verify the log: the whole tree, a range, or the staged changes (for a pre-commit hook).
adr verify
adr verify --base origin/main --format github
adr verify --staged
adr verify --fetch-sources # fetch [[sources]] first (CI, pre-push); a failed fetch exits 2
# Other repositories' decision logs, read from a local cache.
adr sources fetch [<name>]
adr list --source platform
# The generated index (with [log] index = "committed"): regenerate it, or check that it is current.
adr index
adr index --check
# Git hooks: install adr in ledger's shared hook shims, or print the config for a hook manager.
adr hooks install
adr hooks print --manager lefthook
# The MCP server for agents, over stdio; start it from an MCP client (see "MCP server").
adr mcpnewtakes--template <name>(defaultnygard; built-insnygard,madr,y-statement, or your own<root>/templates/<name>.md),--section <id>=<markdown>(repeatable),--supersedes <decision>(repeatable), and--edit/--no-edit. It opens$VISUALor$EDITORwith--edit, or by default in an interactive terminal; an editor failure never loses your edits and never commits content you didn't confirm.new --no-edit --commit(or--commitwith no editor) refuses a draft with unfilled required sections: exit 1, nothing written. Without--committhe draft is staged with a warning on stderr; after an editor, a draft that still has unfilled sections stays staged and isn't committed.acceptof a decision that supersedes others offers their scope globs:--copy-scopecopies them in the same write,--no-copy-scopedoesn't, and without either it asks[y/N]in a terminal and otherwise prints theadr scope … --add …command that would copy them.scopetakes--set <glob>(repeatable; replaces the set),--add/--remove <glob>(repeatable) or--clear, and stores the set sorted and deduplicated. It notes a glob that matches no tracked file and a narrowing of an accepted decision. verify requires the globs of accepted decisions to match tracked files (scope/glob-unmatched). A proposed decision's globs may name code that doesn't exist yet, because the decision is still planned, and the note says verify reports them once it is accepted;adr acceptnotes each glob that still matches nothing, so with hooks installed anaccept --commitfails in pre-commit until the code is there.scope --follow-renames [<decision>]updates the globs of every decision (or one) for the staged renames, so a moved file stays governed, and only stages.for <path>…lists the decisions governing each file, from scope globs and code anchors, with a warning for decisions that aren't in force. A code anchor is a comment such as// adr:<id>or# adr:<source>:<id>: the token counts only after a comment leader on the same line (a heuristic), and anchors in binary files, submodules, the log directory and files matched by[scope] anchor_excludeare not found.- Writes stage their files and don't commit, unless you pass
--commitor setauto_commit. The configadr initwrites setsauto_commit = true, so in a log it set up every write commits and--no-commitonly stages; a config without the key stages. A commit holds every file of the decisions it touches (body, events, template), soadr verify --ref <commit>is clean, and never your unrelated staged work. It refuses with exit 2 when a file it needs has unstaged changes or isn't tracked. ItsADR: <id>andADR-Event: <type>trailers come in one pair per decision and event type, in a fixed order, whatever yourtrailer.*config. --commitmessages follow Conventional Commits: the subject comes from[commit] subject(defaultdocs(adr): {action} {title}, for exampledocs(adr): propose to use Aurora for orders,docs(adr): decide to use Aurora for orders,docs(adr): set the scope of ADR-0003). The description starts with a lowercase letter and the rest keeps its natural casing (Usebecomesuse;CLI,ARK_AGENT,GraphQLandNode 24stay).new,accept,rejectandwithdrawname the decision by its title (propose to,decide to,decide not to,withdraw the proposal to), whiledeprecate,supersede,note,linkandscopename it by its number or id. A title that would make the description longer than 72 characters is shortened with…, at a word boundary when one is near the limit, the body then starts withFull title: <title>, and a note says so, naming the 72-character limit of the description afterdocs(adr):; numbers and ids are never shortened. A commit that sweeps in staged events of other types names them together (docs(adr): link and scope ADR-0003,update ADR-0003beyond three verbs), and one that sweeps in a staged proposal or status change takes that event's title form (docs(adr): propose to use SQS for jobs).-m/--message <text>replaces the subject and body as given; a message that ends in its own trailer block as git reads it, such asCo-authored-by:orRefs:lines, gets adr's trailers appended to that paragraph. The trailers are always the last paragraph, sogit log --grep "ADR: <id>"finds a decision's commits.- When git refuses a
--commit(a failing hook, signing), the write stays written and staged, and adr exits 2 (commit-failed) with a recovery hint: git's error, the staged paths, the trailers, and the exact command that makes the commit,git -C <top> commit --cleanup=whitespace -F <git dir>/ark/COMMIT_MSG --only -- <paths>, with the full message saved in that file (edit it if needed, but keep the trailers). Don't run the adr command again: the log already holds the change, so a rerun would be refused, do nothing, or write it a second time. Whenindex.mdis among the paths, the hint ends withThen run adr index --no-commit to restore other decisions' entries in docs/adr/index.md.The notes the write would have reported are printed as warnings before the hint. - With
[log] index = "committed", every write keeps<root>/index.mdcurrent: the accepted and proposed decisions, then the superseded, deprecated, rejected and withdrawn ones, each with its number, linked title, status and date, and a last line recording the numbers. A--commitrenders it from exactly the tree the commit holds and includes it whenever the commit changes it; the work-tree copy keeps other decisions' uncommitted entries. Numbers are projected: on a branch they are the numbers its acceptances will get once it merges, after main's ([log] main_branch), also when main was merged into the branch. When a write leaves the stagedindex.mdlisting another decision's untracked or unstaged files, it notes them, since the next plain commit's hook reportsindex/staleuntil they are staged.adr indexregenerates and stages it,adr index --commitcommits it asdocs(adr): regenerate the decision index, andadr index --checkexits 1 when it is stale or missing. list --since <rev>lists only the decisions with event files added between<rev>and HEAD (or--ref), each with the new event types, such as[new: accepted]; it prints nothing when the log didn't change.- In a shallow clone, numbers need history the clone lacks. With a committed index, adr reads them from
index.mdin the commit being read (--ref, else HEAD) and notesnumbers come from docs/adr/index.md (shallow clone); without one, decisions display by id until you rungit fetch --unshallow. Nothing is fetched automatically. hooks installregisters adr in ledger's shims, one per hook and shared with other ark tools:pre-commitrunsadr hooks run pre-commit,commit-msgrunsadr hooks trailers(addsADR:andADR-Event:trailers when event files are staged, unless the message has them or a merge is in progress),pre-pushrunsadr verify --base @{upstream} --ref HEAD --fetch-sources(rerunadr hooks installafter upgrading from 0.4.x to get the flag), which checks the current branch's commits against its upstream whichever refs the push names (without an upstream, againstorigin's default branch; with no remote, the whole log), andpost-mergerunsadr list --since ORIG_HEAD. It never overwrites a foreign hook (it writes the other hooks, exits 2 and names the line to add to that hook) and writes nothing whencore.hooksPathis set (exit 2, pointing toadr hooks print --manager lefthook|husky|pre-commitfor the hook manager in use). Withindex = "committed",hooks installalso sets the clone's merge driveradr-index(merge.adr-index.*in.git/config, named by thedocs/adr/index.md merge=adr-indexlineinit --setupwrites in.gitattributes), so a rebase, merge or cherry-pick of branches that each wrote the log rendersindex.mdinstead of stopping on it;adr doctor --fix-cloneinstalls it too, and a clone without it behaves as before.adr index --mergeis the driver's command, not for people.hooks uninstallremoves adr from the shims. The pre-commit steps are rename following ([hooks] scope_follow_renames), the index (checked, or regenerated and staged with[hooks] index = "stage"), thenverify --staged, which checks every decision when the staged changes touchadr.tomlor the templates. The hook stages only into the commit's own index: forgit commit <paths>, a rename that changes a decision's scope stops the commit and names the command to run. When the stagedindex.mdlists decision files that aren't staged, theindex/stalefinding names them; stage them, or move them out of the work tree and runadr index.search <query>…joins its words and lists the decisions whose id, number, title, body or notes contain every one, case- and accent-insensitively (Caféfindscafe), as substrings (orderfindsorders). Only proposed and accepted decisions are listed unless--all; a note counts the others that match. Each result has the best matching line of the body or a note. It reads the local log, or a cached source's with--source <name>.init --skillwrites the agent skill to.claude/skills/adr/SKILL.md, or to<dir>/SKILL.mdwith--skill-dir <dir>(a directory inside the repository), and adds one line pointing at it toAGENTS.md, creating the file if needed. It never overwrites a SKILL.md (one that differs is kept, with a note), and a second run changes nothing. AnAGENTS.mdwith unstaged changes, or not tracked, gets the line but isn't staged; with--commitit is refused (exit 2).showleads with a state header. A decision that isn't in force says so and names what to read instead, for exampleSUPERSEDED by ADR-0002 (accepted 2026-10-18). Do not apply this decision; read ADR-0002 instead.
Every command takes --json, --root <dir> (the log directory) and --help; reads also take --ref <ref>, and writes refuse it.
Exit codes and JSON
- 0: success.
- 1: failing findings from
verify(orindex --check, or a hook), or a write the log's rules forbid (an illegal transition, a draft that fails its template lint, an agent's acceptance, an unaccepted successor). Nothing is written, and the findings are in the output. - 2: the tool can't run: bad usage (unknown command, flag or decision, a missing argument,
--refon a write), config, environment or internal errors. Nothing is written, except when git refuses a--commit(commit-failed): the write is then staged and the error says how to finish the commit.
With --json, stdout carries exactly one JSON document: adr-list/v1 (with since, null without --since), adr-show/v1, adr-search/v1, adr-write/v1 (for every write command), adr-for/v1, adr-init/v1, adr-index/v1, adr-hooks/v1, ledger's ledger-findings/v1 for verify, or ark-error/v1 ({ "format": "ark-error/v1", "error": { "code", "message" } }) when the command exits 2; a commit-failed error also has the write's notes. Every key is always present, with null where a value is unknown. A numbering object's reason is "index" when a shallow clone's numbers come from index.md, and "no-index" for a --source log without a committed index.md. In a shallow clone with a committed index, adr-write/v1's decision.number comes from the index in HEAD, which on a branch is the number the acceptance will get once the branch merges. Warnings and notes go to stderr.
Config (adr.toml)
Every key is optional.
[log]
root = "docs/adr" # read from <repo>/adr.toml; the default
default_template = "nygard"
main_branch = "origin/main" # the ref numbers come from; default origin/HEAD, origin/main, main, …
index = "none" # or "committed": adr index, fresh on every write, checked in verify
[policy]
accept_requires_human = true # refuse acceptances by an agent
auto_commit = false # commit writes without --commit
mcp_can_decide = false # agents propose, humans decide; true adds adr_accept, adr_reject, adr_deprecate and adr_supersede to adr mcp
[verify]
fail_on = "error" # or "warning"
governed_by_inactive = "warning" # or "error": a change under a superseded or deprecated decision
[commit]
subject = "docs(adr): {action} {title}" # the default; --message overrides it
[scope]
anchor_keyword = "adr" # the default: anchors read adr:<id>
anchor_exclude = ["**/*.md"] # files never searched for anchors (docs that show examples); default []
[hooks]
scope_follow_renames = "stage" # stage, warn or off: pre-commit's rename following
index = "check" # check, or stage to regenerate index.md in pre-commit
[setup] # what init --setup writes; see "Agent setup"
prepare = "…" # the scripts.prepare to write; default none
note = "…" # a line for the generated scripts' headers; default none
[setup.pins]
adr = "0.8.0" # exact versions the setup pins; default the running versionverify also checks code against the log: scope/glob-invalid (error) for a stored glob that doesn't parse, scope/glob-unmatched (error) for a glob of an accepted decision that matches no tracked file, scope/anchor-missing (error) for an adr:<id> anchor naming no decision in the log, decision/governed-by-inactive (a warning, or an error with governed_by_inactive = "error") for a changed file governed by a superseded or deprecated decision, and decision/scope-narrowed (warning) when a new scope stops covering files that still exist. Deprecated decisions' globs no longer have to match files. With index = "committed", index/missing and index/stale are errors, and index/unchecked warns in a shallow clone without a recorded index.
References into other repositories' decision logs (platform:k3f9q8a1, from [[sources]] entries with kind = "adr") are checked against a local cache kept in the git directory. Plain verify, the hooks' pre-commit step and every read and write use only the cache and never the network: a referenced source that isn't cached gives one sources/not-fetched warning. verify --fetch-sources fetches each source first and exits 2 when a fetch fails; adr sources fetch refreshes the cache by hand, and verify --json records the commit each source resolved to. A missing target in a cached source is decision/reference-missing, and a source name that isn't configured decision/unknown-source. A ref may be a branch, a tag or a full commit; a tag or commit keeps CI reproducible. Fetching uses git's credentials: for a private source in CI, an insteadOf URL with a token from the CI secret store, or an SSH deploy key.
[commit] subject is one line with {title} (what names the decision: its title with an ordinary capitalized first word lowercased (Use → use, so a single-capital proper noun such as Aurora loses that capital; CLI, GraphQL and ARK_AGENT stay), or its number or id), {raw_title} (the same with its case kept), {action}, {id}, {display} and {command}. It is checked when the config is read: at most one title placeholder, after the type and scope, and room within 72 characters for the title (20 characters) and, uncut, for the longest number-based name (ADR-0001 to a decision in another log); an invalid template exits 2. Whatever the template, the description's first letter is lowercased.
The config is <repo>/adr.toml, whose [log] root chooses the log directory, or <root>/adr.toml. --root uses a repository-level file that names the same root, and overrides one that names another root with a warning.
Agent setup
adr init --setup writes the agent setup for this tool in any repository. It never writes anything particular to ark's own repository, and what it writes, it writes for adr alone:
- Pins. The MCP config and the hook scripts pin the exact version of the
adrthat ran,@nikovirtala/adr@<that version>, read from its own package. A sibling ark tool is run by the shared hooks only when its own setup pinned it in this repository. - Pieces. For each harness it detects (
.claude/,.kiro/; both when neither exists, narrowed with--harness): the MCP server entry, a session-start and a before-edit hook and the scripts they run, the deny rules (Claude Code) or protect hook (Kiro) for this log's events and index,.gitattributesfor the events, the skill and itsAGENTS.mdline. The hooks run only the tools whose config is in the repository, so a repository that usesadralone never runsissues. - Git hooks. No
preparescript is written unless you pass--prepare(npx -y @nikovirtala/adr@<version> hooks install || true, added topackage.json; with nopackage.json, nothing) or the config names one. Ascripts.preparethat is already there is kept and reported, and--force preparereplaces it. Without it, the session-start hook installs the clone's missing git hooks, andadr doctorreports them with the fixing command (adr doctor --fix-clone). - Reruns. Rerunning
init --setupupdates what it wrote and leaves what you changed, naming each such file and the command that overwrites it (init --force <piece>). It writes no template: a template you removed stays removed, and--templateadds one by name. - Text. The generated scripts say what they do and link this section.
A repository changes the setup with a [setup] table in adr.toml. Every key is optional; without the table the setup is as above. Each tool reads only its own config, so a repository that wants the same value in the shared files whichever tool runs init sets it in each tool's config.
[setup]
prepare = "node scripts/git-hooks.mjs install --if-built" # the scripts.prepare init writes, without --prepare
note = "Why these scripts look as they do." # one line, added to the scripts' header comments
[setup.pins]
adr = "0.8.0" # exact versions, replacing the running one; a sibling's pin goes here too
issues = "0.8.0"ark's own repository sets all three: its configs pin the previous release (ADR-0017), its prepare is a build-safe installer that skips an unbuilt checkout, and its note says why. [setup.pins] is also where its release bumps the pins.
Agents
An agent using the CLI sets ARK_AGENT=<agent-id>, and ARK_ON_BEHALF_OF=<email> for the person it acts for. Its events are recorded as the agent, acting on behalf of that address. Without ARK_ON_BEHALF_OF they are recorded on behalf of the git user, and every write says so in a note on stderr and in the JSON notes: on_behalf_of taken from the git identity <email>; set ARK_ON_BEHALF_OF to name who you act for. An ARK_ON_BEHALF_OF that isn't an email address exits 2 before anything is written; one that is still a ${…} placeholder, which an agent harness leaves when it doesn't pass the variable on, counts as unset and the write's notes say how to fix it; without ARK_AGENT it is ignored, with a note. With accept_requires_human on (the default), adr accept refuses an agent with exit 1 (decision/agent-accepted), and adr new tells the agent to ask a human to review and accept.
The git identity is git's author identity (git var GIT_AUTHOR_IDENT with user.useConfigOnly): GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL when set, else user.name and user.email; it is never guessed. Setting GIT_AUTHOR_* also changes the author of --commit commits, which is why agents should use ARK_ON_BEHALF_OF instead. --commit also needs a committer identity, and exits 2 before writing without one.
Agents with an MCP client use adr mcp instead (below), and adr init --skill gives them the skill: when to check the decisions, how to read them, and that they propose and a human accepts.
MCP server
adr mcp serves the decision log to agents over stdio, in the repository it starts in (--root works as for every command). Add it to your MCP client's server config:
{
"mcpServers": {
"adr": {
"command": "npx",
"args": ["-y", "@nikovirtala/adr", "mcp"],
"env": { "ARK_ON_BEHALF_OF": "[email protected]" }
}
}
}Set ARK_ON_BEHALF_OF in that env: stdio clients pass only a few environment variables (HOME, PATH and the like) to the server, so a value exported in your shell doesn't reach it. Writes are recorded as an agent named by the MCP client (actor.agent), on behalf of ARK_ON_BEHALF_OF, or of the git user, with a note. An invalid ARK_ON_BEHALF_OF makes adr mcp exit 2 before serving.
Setting ARK_ON_BEHALF_OF in each harness
adr init --setup writes MCP configs that pass ARK_ON_BEHALF_OF through from your environment and never hold its value. Set it where the harness can pass it on:
- Claude Code reads
.mcp.json, which passes"${ARK_ON_BEHALF_OF:-}". Export the variable in the shell that startsclaude, for exampleexport [email protected]. Unset, it arrives empty and writes are recorded on behalf of the git user, with a note. Claude Code asks you to approve a project's MCP servers the first time it sees them. - Kiro reads
.kiro/settings/mcp.json, which passes"${ARK_ON_BEHALF_OF}". Kiro expands a variable only after you approve it: open Kiro's settings, search for "Mcp Approved Env Vars", addARK_ON_BEHALF_OF, and export it in the shell that starts Kiro. Until then the server receives the text${ARK_ON_BEHALF_OF}. adr treats that as unset, records the write on behalf of the git user, and says in the write's notes which setting fixes it.
adr doctor reports the variable for each harness the repository configures: unset, left as a placeholder, or set (for Kiro, with a reminder to approve it; doctor can't read that setting).
| Tools | Listed |
| --- | --- |
| adr_search, adr_get, adr_list, adr_templates, adr_for_path (reads) | always |
| adr_propose, adr_update_draft, adr_note, adr_link, adr_scope, adr_withdraw (writes) | always |
| adr_accept, adr_reject, adr_deprecate, adr_supersede | with [policy] mcp_can_decide = true |
- Every tool returns the JSON document its CLI command prints under
--json(adr-search/v1,adr-show/v1,adr-list/v1,adr-for/v1,adr-write/v1, andadr-templates/v1foradr_templates) asstructuredContent, with a readable text whose state headers come first and point atadr://decision/<number>. Errors areisErrorresults withark-error/v1; a write the log or the MCP policy refuses is a document withok: falseand the findings. - Resources:
adr://index(the index table) andadr://decision/{id}, one decision's state header and body, where{id}is the id, the number orADR-NNNN. The promptadr_draft_from_discussion(optionaltitle,template,supersedes) walks an agent from a conversation to a proposal. adr_proposetakes asectionsmap (section id to markdown); template lint findings come back as data, andadr_update_draftreplaces sections of a draft in place, writing only if nobody changed the file meanwhile. Withauto_commit, an incomplete draft is refused instead of committed.- Without
mcp_can_decide, an agent may update, scope and withdraw only proposals made on behalf of the same person, and never rescope an accepted or deprecated decision (decision/mcp-cannot-decide).accept_requires_humanstill refuses an agent'sadr_accept. - MCP writes stage their files and commit only with
[policy] auto_commit; there is no commit input. Each call reads the log again, but the tool list is fixed at startup: restartadr mcpafter changingmcp_can_decide.
Library
The CLI is a thin layer over the library, and the MCP server uses the same functions and returns the same JSON documents.
import { listDecisions, openDecisionLog, readDecisions, showDecision, verifyDecisions } from "@nikovirtala/adr";
const log = await openDecisionLog({ cwd: process.cwd() });
const read = await readDecisions(log);
const { decisions } = listDecisions(read, { status: ["accepted"] });
const findings = await verifyDecisions(log, { type: "full" });initDecisionLog, proposeDecision, acceptDecision, rejectDecision, withdrawDecision, deprecateDecision, supersedeDecision, noteDecision, linkDecision, scopeDecision and followScopeRenames write, decisionsFor answers adr for, resolveDecision turns an id or number into an id, and stateHeader gives the header show prints. searchDecisions answers adr search, listTemplates lists the usable templates (adr-templates/v1), updateDraft replaces sections of a proposed draft, sourcesNote gives the local-only note, and SKILL_MD is the agent skill. indexDecisionLog and renderDecisionIndex regenerate or render the index, and installDecisionHooks, uninstallDecisionHooks, printDecisionHooks, runPreCommitHook and addHookTrailers are the hook commands.
@nikovirtala/adr/kind exports only the decision kind (adrKind, made with ledger's defineKind) and its types, without any CLI code, for tools that fold decision logs themselves, such as issues linking to decisions:
import { adrKind } from "@nikovirtala/adr/kind";Not yet included
- Search limits.
adr searchmatches substrings without stemming (ordersdoesn't findorder) and without phrases, and folds accents but notß(strassedoesn't findStraße). - Qualified anchors.
adr:<source>:<id>anchors aren't checked against sources.
