Skip to main content

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 formTemplate fileAuto-labelWhen to use it
Bug Report.github/ISSUE_TEMPLATE/bug_report.ymlbugSomething is broken, crashes, or regressed. Include reproduction steps, expected behavior, and screenshots or terminal output when helpful.
Enhancement.github/ISSUE_TEMPLATE/enhancement.ymlenhancementSomething 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.ymlfeatureYou 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:

  1. Shape the feature: create-issue inspects the existing packages, ARCHITECTURE.md, and reasonry/ decisions, then walks you through motivation, surface boundaries, FR-NNN requirements (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).
  2. Write the PRD in Reasonry's output/ layer: both focused (Tier 1) and large multi-package (Tier 2) features save their PRD to reasonry/output/documents/prd/<slug>.md and link it to the GitHub issue created with gh issue create --label feature. Every non-obvious architectural constraint cites its source in reasonry/source/ as _Source: <ID> §<Section>_ (see reasonry/AGENTS.md).
  3. Keep gaps visible: unresolved questions stay verbatim in ## Open Questions rather than being guessed. Major cross-cutting architectural unknowns can be promoted into reasonry/source/initiatives/ai-coach/questions/ (Q-AIC-*).
  4. 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 in reasonry/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 writingWhere it goes
What ai-coach is, how to startREADME.md: keep it to one screen
How to use itdocs/guide/
How to work on itthis file
How it's builtARCHITECTURE.md and each package's README
Why it's built that wayreasonry/
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):

FolderHolds
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):

  1. Connect the reasonry-keeper server from .mcp.example.json in your .mcp.json (or install the Reasonry plugin / npx -y @push-based/reasonry-skills install).
  2. Have your agent write the record with the upsert_document tool, or run npx reasonry upsert --spec=<file> --execute. The engine gives the record its ID and file name. Don't copy an existing file.
  3. Run npx reasonry check (or npm run kb:check). It checks every record's fields, IDs and links.
  4. A new record is a draft. When the change is committed, accept it with the transition_status tool.

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/main checks 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 and apps/vault-mcp-server (and apps/vault-view-server for UI endpoints). adapter-vault-mcp only 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-view follow DEC-AIC-0062: ChangeDetectionStrategy.OnPush, explicit public/private access modifiers, no inline CSS (separate .css files via styleUrl), external .html templates over ~40 lines, ~250 LOC soft cap, lazy feature routes, and pure ui components (primitives, composite wrappers, and layout shells) with zero data-access injected.
  • Never point tests or experiments at your real vault. Use a copy.