You are building a **`@dreamtree-org/ai-builder`** app: an Express API + Vite/React
SPA, multi-tenant, data via **`@dreamtree-org/korm-js`**, UI via **`@dreamtree-org/twreact-ui`**.
This skill + its MCP server exist so you build correctly with **minimal tokens**:
fetch facts live instead of re-reading files, and write down where you got to so
the next session doesn't start from zero.

## The session loop

__SESSION_PROTOCOL__

- `project_state` reports `evidence` — how it decided the project root. `"cwd"` or
  `".git"` with `isDreamtreeApp: false` means it guessed; re-call with `dir=<root>`
  rather than reasoning about the wrong project. Read `hints[]` too.
- `tracking/plan.md` is for the work; a GitHub Projects card (the `github-projects`
  skill) is for the team. **The board says what and who; the plan says where I stopped.**

## BUILD

__ADD_FEATURE__

## VERIFY — match the gate to the change

| Changed | Run |
| --- | --- |
| `modules.config.js` | `npm run seed:rbac` |
| schema / `sync.json` | `npm run db:sync`, then `npm run seed:rbac` |
| models, utils, RBAC | `npm run test:unit` |
| client pages / components | `npm run test:client`, then `npm run build` |
| auth, routes, a user journey | `npm run test:e2e` |

A change nobody ran is not done. Record real gates in the plan's verification log.

## RECORD

__PLAN_PROTOCOL__

## The non-negotiables (call `build_rules` for the full text)

__BUILD_RULES__

## MCP tools — call these instead of guessing

| Need | Tool |
| --- | --- |
| Where am I, what's in flight, what next | `project_state` |
| The plan / big-picture / backlog skeleton + protocol | `plan_template` |
| A twreact-ui component's real props; a KORM option | `layer_docs` |
| The binding build rules + RBAC + add-a-feature path | `build_rules` |
| How to read/write data + the schema column format | `data_contract` |
| The starter module catalog; one module in full | `list_modules` / `describe_module` |
| The generated `schema/sync.json` / `modules.config.js` | `get_schema` / `get_registry` |
| Exact files a scaffold would emit (dry run) | `scaffold_plan` |
| Version drift across the whole @dreamtree-org family | `check_version` |

Not connected? Run `npx -y @dreamtree-org/ai-builder init --ai <provider>`.

## Layer knowledge — never from memory

korm-js and twreact-ui ship their own docs *inside the package this app installed*,
and `layer_docs` reads them — so every answer is true for the version running here.

- Props → `layer_docs {package:"@dreamtree-org/twreact-ui", mode:"component", component:"Button"}`
- The component list → `mode:"components"` · a KORM topic → `mode:"toc"`, then `mode:"section"`
- A prop that isn't there **does not exist at this version**: raise a twreact-ui
  issue (the `github-workflow` skill). Never invent it, never re-implement the component.

## Stay current

This file is a snapshot taken when `init` ran. Call `check_version` once per session:
if ai-builder `isOutdated`, offer `npx @dreamtree-org/ai-builder@latest update`; if a
layer is behind, offer the `npm i <pkg>@latest` it names. Then re-read this skill and
`build_rules` — the rules may have changed.
