Contributing
How to build, test and change ai-coach. For how it's put together, read ARCHITECTURE.md first; for why, the decision records.
Issues
Start every change from a GitHub issue. Issues are the planning entry point for both contributors and maintainers, so work stays scoped and verifiable before code is written.
Blank issues are disabled (.github/ISSUE_TEMPLATE/config.yml). Pick the form that matches what you want to change:
| Issue form | Template file | Auto-label | When to use it |
|---|---|---|---|
| Bug Report | .github/ISSUE_TEMPLATE/bug_report.yml | bug | Something is broken, crashes, or regressed. Include reproduction steps, expected behavior, and screenshots or terminal output when helpful. |
| Enhancement | .github/ISSUE_TEMPLATE/enhancement.yml | enhancement | Something already works, but can be improved functionally, visually, or in DX/workflow. Include current behavior, visuals of the current state, and desired behavior. |
| New Feature | .github/ISSUE_TEMPLATE/new_feature.yml | feature | You are proposing a new capability or user flow. Spell out the problem, proposed flow, scope and preserved behavior, non-goals, and acceptance criteria. |
Issues can also carry secondary labels such as documentation, refactor, architecture, or good first issue. Reference the issue number in your pull request (for example, Closes #123).
When working from an AI coding agent, use the create-issue skill (.agents/skills/create-issue/SKILL.md, DEC-AIC-0067, DEC-AIC-0068). It routes between Bug, Enhancement, and New Feature, captures browser screenshots to /tmp/issue-screenshots/ (never committed to git), previews everything, and publishes via gh issue create only after you confirm.
Feature shaping, PRDs and Reasonry
Bugs and enhancements are quick to scope directly in a GitHub issue. New features go through a two-stage brownfield workflow before code is written:
- Shape the feature:
create-issueinspects the existing packages,ARCHITECTURE.md, andreasonry/decisions, then walks you through motivation, surface boundaries,FR-NNNrequirements (new/modified/preserved), Given/When/Then acceptance criteria, a Socratic challenge on each requirement, domain rule deltas, and non-goals. Multi-session drafts stay in/tmp/issue-shaping/<slug>.md(never committed). - Write the PRD in Reasonry's
output/layer: both focused (Tier 1) and large multi-package (Tier 2) features save their PRD toreasonry/output/documents/prd/<slug>.mdand link it to the GitHub issue created withgh issue create --label feature. Every non-obvious architectural constraint cites its source inreasonry/source/as_Source: <ID> §<Section>_(seereasonry/AGENTS.md). - Keep gaps visible: unresolved questions stay verbatim in
## Open Questionsrather than being guessed. Major cross-cutting architectural unknowns can be promoted intoreasonry/source/initiatives/ai-coach/questions/(Q-AIC-*). - Record durable decisions when you build: the PRD captures what to build; once you implement the feature, the lasting architectural choices ship as an accepted
DEC-AIC-*record inreasonry/source/initiatives/ai-coach/decisions/(see Decision records).
Build and test
The workspace is an Nx monorepo. After npm install:
npx nx run-many -t build # build everything
npx nx run-many -t test # run every test
npx nx run-many -t lint typecheck # check style, types and package boundaries
npx nx format:check # check formatting
npx nx test @ai-coach/domain # test one package
npx nx graph # see how the packages depend on each other
npm run build:board -w @ai-coach/climb-board # rebuild the climb page's drawing board, then commit its output
Tests don't need Ollama, Gemini or a real vault: each layer is tested with fakes, a local stub server or a temporary vault. The vault adapter has no automated tests yet (DEC-AIC-0010), so try changes to it against a copy of a vault.
CI runs format, lint, test, build and typecheck on every push to main and every pull request.
Documentation
The documentation site is built from the Markdown in this repository and deploys from main (DEC-AIC-0032). Edit the files where they are; apps/docs only arranges them.
npx nx serve docs # preview the site while you edit
npx nx build docs # build it and check every link
| What you're writing | Where it goes |
|---|---|
| What ai-coach is, how to start | README.md: keep it to one screen |
| How to use it | docs/guide/ |
| How to work on it | this file |
| How it's built | ARCHITECTURE.md and each package's README |
| Why it's built that way | reasonry/ |
| Planning with an AI agent | .agents/skills/README.md |
Write for someone new: say who a page is for and what they'll be able to do, use short sentences and "you", and link a term to the glossary instead of explaining it twice (DEC-AIC-0060). For the root README.md, follow the seven-section product front-door blueprint in the root-readme skill (.agents/skills/root-readme/SKILL.md, DEC-AIC-0066). For package READMEs (apps/*/README.md, libs/*/*/README.md), follow the eight-section blueprint in the package-readme skill (.agents/skills/package-readme/SKILL.md).
Decision records
Every important change ships with a decision record in the same commit. DEC-AIC-0001 lists what counts. The records live in reasonry/, a Reasonry knowledge base (@push-based/reasonry, installed as a devDependency; see DEC-AIC-0065, superseding DEC-AIC-0049):
| Folder | Holds |
|---|---|
reasonry/source/initiatives/ai-coach/ | the coach's decisions, DEC-AIC-0001 onwards. New records go here. |
reasonry/source/initiatives/vault/ | the vault server's earlier decisions, DEC-KI-0058 to DEC-KI-0071, and Q-KI-0042 |
Reading needs nothing: open the file, or the Decisions pages on the documentation site.
Writing uses @push-based/reasonry (installed by npm install):
- Connect the
reasonry-keeperserver from.mcp.example.jsonin your.mcp.json(or install the Reasonry plugin /npx -y @push-based/reasonry-skills install). - Have your agent write the record with the
upsert_documenttool, or runnpx reasonry upsert --spec=<file> --execute. The engine gives the record its ID and file name. Don't copy an existing file. - Run
npx reasonry check(ornpm run kb:check). It checks every record's fields, IDs and links. - A new record is a
draft. When the change is committed, accept it with thetransition_statustool.
Never rewrite an accepted record: write a new one that supersedes it. reasonry/ isn't formatted by Prettier, because the engine writes it.
House rules
- Important changes come with a decision record in the knowledge base, in the same commit. DEC-AIC-0001 says what counts, and DEC-AIC-0049 says how a record is written. Accepted records are never rewritten, only superseded.
- No comments in source code. Names and tests carry the meaning (DEC-AIC-0011).
- Commit messages follow Conventional Commits:
feat(cli): add the review command,fix(domain): …,docs: …,build: …. CI checks every commit in a pull request (DEC-AIC-0033);npx commitlint --from origin/mainchecks yours before you push. - Rules go in the domain, not in prompts. If a model could talk its way past it, it belongs in code.
- New vault abilities belong in the vault server: the
libs/vault/*libraries andapps/vault-mcp-server(andapps/vault-view-serverfor UI endpoints).adapter-vault-mcponly wraps the tools the server offers, and nothing else in the coach may import the vault (DEC-AIC-0048, DEC-AIC-0061). - Frontend changes in
vault-viewfollow DEC-AIC-0062:ChangeDetectionStrategy.OnPush, explicitpublic/privateaccess modifiers, no inline CSS (separate.cssfiles viastyleUrl), external.htmltemplates over ~40 lines, ~250 LOC soft cap, lazy feature routes, and pureuicomponents (primitives, composite wrappers, and layout shells) with zerodata-accessinjected. - Never point tests or experiments at your real vault. Use a copy.