Appearance
Why ledger
Each why in a commit, a pull request title or a decision record is an option that the human picked.
Record an answer
An agent asks the human with AskUserQuestion. After each question, the record.ts hook writes each picked option to the ledger file in the .git folder of the clone. Each entry holds an id, the question, the label, the text of the option and a mark when the option was the recommended one. Text that the human types counts only after an agent cleans it up and the human picks it as an option. Subagents cannot ask the human, so they cannot add an entry.
node tools/why/answers.ts lists the latest picks.
Check an answer
- Each line of a commit body is the text of a picked option, word for word. A commit that follows a decision record can also hold the line
Follows decision NNNN., with itsDecision: NNNNtrailer. - A pull request title is the text of a picked option.
- Each new reason in
## Options consideredand each new line in## Consequencesof a decision record is the text of a picked option.
The why-from-human rule of commitlint checks each commit that an agent makes. It does not check a commit that a human makes outside Claude Code. The guard.ts hook checks each new commit and each decision record before a push, and the title before a new pull request.
Protect the ledger
Permission rules stop the file tools of an agent from writing the ledger. The guard hook blocks each shell command that names the ledger, skips the commit hooks or changes the environment of the session. An agent that runs a shell as the same user can still reach the file in other ways. So the check catches each why that an agent wrote by mistake or for speed, not a deliberate attack.
The ledger stays in the clone and is not pushed. A commit whose message is already on GitHub passes, so a rebase of published commits does not need the ledger again.