decision-wiki
A Claude Code plugin that gives a session a module's decision context before it edits the
module, and records new decisions so the next session inherits them.
- Ledger: one markdown file per decision under
decisions/, append-only, with YAML
frontmatter (decisions/D-NNNN.md).
- Wiki: one page per module under
docs/wiki/, rendered from the ledger plus a curated
preamble that Claude maintains.
- Hooks: SessionStart injects the consult contract; the first Edit/Write per module per
session is denied with the module page in the reason and allowed on retry; Stop blocks once
when a gated module changed with no decision recorded.
Runtime: Node 24 running TypeScript natively (erasable syntax only, no build step), zero
runtime dependencies, node --test.
Install
User level is the default: install once and every repository gets the hooks. They are inert in
a repository with no .claude/decision-wiki.json (SessionStart emits nothing, PreToolUse
allows), so a global install costs nothing until a repo opts in with init.
This repository is its own marketplace (.claude-plugin/marketplace.json lists the plugin),
so installing takes two commands. From GitHub:
claude plugin marketplace add Kastalien-Research/decision-wiki
claude plugin install decision-wiki@decision-wiki # --scope user is the default
From a local clone, give the path instead of the GitHub slug:
claude plugin marketplace add /path/to/decision-wiki
claude plugin install decision-wiki@decision-wiki
Repository level is optional, for a team that wants the plugin pinned to one project:
claude plugin install decision-wiki@decision-wiki --scope project
For development, load a checkout directly without installing:
claude --plugin-dir /path/to/decision-wiki
Installing copies the plugin into ~/.claude/plugins/cache/, so after the repository changes
run claude plugin update decision-wiki to refresh the installed copy.
Then in the target repository run /decision-wiki:init (or decision-wiki init).
CLI
bin/decision-wiki is a shell shim for node src/cli.ts. Exit codes: 0 ok, 1 command
failure, 2 usage error.
Global option -C <dir> (before the command) runs as if started in <dir>. The skills always
pass -C "${CLAUDE_PROJECT_DIR}" so a record lands in the project even when the shell's working
directory is elsewhere; in one headless session a decide call ran with its cwd in a different
repository and appended to that repository's ledger.
| Command | What it does |
|---|
init | Writes .claude/decision-wiki.json with one placeholder module, docs/wiki/index.md, docs/wiki/SCHEMA.md, docs/wiki/placeholder.md, an empty decisions/, and a .gitignore entry for the state directory. Refuses to overwrite an existing config. |
decide --statement S --rationale R [--alternatives A] [--evidence E] [--reversal V] [--module m]... [--supersedes D-NNNN] [--provisional] [--session id] | Appends a record with the next id, stamps files from session state when --session is given, updates decisions/.index.json, runs generate, prints the id. Text flags accept @path to read from a file. With --session and no --module, modules are inferred from the session's touched files; nothing inferable is a usage error (exit 2). Without --session, --module is required. Exit 1 when --supersedes names an unknown or already superseded id, or when a module is not in config. |
generate | Renders module pages and index.md, rewriting only generated blocks and frontmatter hashes. Idempotent: a second run writes nothing and prints nothing. |
lint [--strict] | Checks ledger and wiki. Exit 1 on any error; under --strict, warnings are errors too (except the advisory rule below). |
check <base> <head> | git diff --name-only base..head; exit 1 when a gated module changed and no decisions/D-NNNN.md added in the range (read at head) has that module or * in its modules. Per module: a record mapped to an unrelated module does not cover the change. |
hook <session-start|pre-tool-use|stop> | Runs a hook handler over Claude Code hook JSON on stdin. Always exits 0. |
Config: .claude/decision-wiki.json
{
"version": 1,
"paths": { "decisionsDir": "decisions", "wikiDir": "docs/wiki", "stateDir": ".claude/state/decision-wiki" },
"budgets": { "injectionBytes": 8192, "pageWholesaleBytes": 4096 },
"modules": {
"core": { "globs": ["src/**"], "why": "…", "gate": true }
}
}
paths and budgets default to the values above. Module names match
^[a-z0-9]+(?:-[a-z0-9]+)*$; globs are repo-relative and matched with node:path
matchesGlob. Files under wikiDir, decisionsDir, and stateDir never match a module.
Record format and page anatomy are documented in docs/wiki/SCHEMA.md (written by init).
Hooks