echos-ocr/docs/SCHEMA_MAP.md
Randall Stillwell 9c1aaaa61f Bootstrap agent-context pipeline (L1 + L2 + L3)
Installs a 3-layer Cursor-aligned agent pipeline so future agent
sessions can orient quickly and stay inside guard rails:

L1 — context for any agent reading the repo:
  - AGENTS.md (top-level orientation, conventions, no-go zones)
  - .cursor/rules/ (no-go-zones, api-routes, prisma, prisma-schema-map)
  - .cursor/skills/ (add-api-route, add-prisma-model)
  - docs/SCHEMA_MAP.md generated from prisma/schema.prisma
  - scripts/generate-schema-map.ts (regenerate the map; wired up as
    `npm run schema:map`)

L2 — subagent roles for the 9-stage idea-to-feature pipeline:
  - .cursor/agents/role-*.md (conductor, architect, ia-architect,
    design-system-auditor, implementer, reviewer, ux-reviewer,
    a11y-auditor, doc-writer) with explicit multitask annotations.

L3 — pipeline scaffolding:
  - .github/CODEOWNERS, PR template, and CI workflows (ci.yml,
    preview-smoke.yml, visual-diff.yml, pr-health-rollup.yml).
    Test job is intentionally disabled until Playwright is wired up.
  - .convoys/ folder for per-feature run notes + scripts/log-convoy-event.sh.
  - scripts/wt.sh worktree helper.
  - src/lib/flags/index.ts simple env-driven feature flag wrapper.
  - tests/smoke/app.smoke.spec.ts (Playwright smoke; excluded from
    tsc until @playwright/test is installed — see tsconfig change).

Also writes .agent-context-manifest.yml so the sync-agent-context
skill can detect drift and offer selective updates from upstream.

Follow-ups (not in this commit):
  - Install @playwright/test and re-enable the test job in ci.yml.
  - Review .cursor/agents/role-*.md and trim any roles that don't
    apply to this codebase.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 14:55:18 -05:00

206 lines
6 KiB
Markdown

# Prisma Schema Map
_Auto-generated by `npm run schema:map` from [prisma/schema.prisma](../prisma/schema.prisma). Do not edit by hand._
Models: **21** • Enums: **0** • Groups: **9**
## Table of contents
- [Auth & Users](#auth-users) (5)
- [Org & Membership](#org-membership) (4)
- [Locations & Events](#locations-events) (2)
- [Form Templates](#form-templates) (2)
- [Cards & OCR](#cards-ocr) (2)
- [People (CRM)](#people-crm-) (1)
- [Integrations](#integrations) (1)
- [Activity & Notifications](#activity-notifications) (2)
- [Settings](#settings) (2)
## Auth & Users
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **Account** | `—` | 1 | [User](#auth-users) |
| **PasswordResetToken** | `—` | 0 | — |
| **Session** | `—` | 1 | [User](#auth-users) |
| **User** | `—` | 8 | [Account](#auth-users), [ActivityLog](#activity-notifications), [Notification](#activity-notifications), [OrgMember](#org-membership), [ResponseCard](#cards-ocr), [Session](#auth-users) |
| **VerificationToken** | `—` | 0 | — |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
Account "1" ||--|| "1" User : user
PasswordResetToken {
string id
}
Session "1" ||--|| "1" User : user
User "1" ||--o{ "many" OrgMember : memberships
User "1" ||--o{ "many" ResponseCard : assignedCards
User "1" ||--o{ "many" ActivityLog : activityLogs
User "1" ||--o{ "many" Notification : notifications
VerificationToken {
string id
}
```
</details>
## Org & Membership
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **ApiKey** | `—` | 1 | [Organization](#org-membership) |
| **Invitation** | `—` | 1 | [Organization](#org-membership) |
| **Organization** | `—` | 9 | [ApiKey](#org-membership), [FormTemplate](#form-templates), [Integration](#integrations), [Invitation](#org-membership), [Location](#locations-events), [OrgMember](#org-membership), [Person](#people-crm-), [ProcessingJob](#cards-ocr), [ResponseCard](#cards-ocr) |
| **OrgMember** | `—` | 2 | [Organization](#org-membership), [User](#auth-users) |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
ApiKey "1" ||--|| "1" Organization : organization
Invitation "1" ||--|| "1" Organization : organization
Organization "1" ||--o{ "many" Location : locations
Organization "1" ||--o{ "many" OrgMember : members
Organization "1" ||--o{ "many" ResponseCard : cards
Organization "1" ||--o{ "many" ProcessingJob : jobs
Organization "1" ||--o{ "many" Integration : integrations
Organization "1" ||--o{ "many" FormTemplate : formTemplates
Organization "1" ||--o{ "many" Person : persons
OrgMember "1" ||--|| "1" User : user
```
</details>
## Locations & Events
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **CollectionDay** | `—` | 2 | [Location](#locations-events), [ResponseCard](#cards-ocr) |
| **Location** | `—` | 3 | [CollectionDay](#locations-events), [Organization](#org-membership), [ResponseCard](#cards-ocr) |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
CollectionDay "1" ||--|| "1" Location : location
CollectionDay "1" ||--o{ "many" ResponseCard : cards
Location "1" ||--|| "1" Organization : organization
Location "1" ||--o{ "many" ResponseCard : cards
```
</details>
## Form Templates
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **FormField** | `—` | 1 | [FormTemplate](#form-templates) |
| **FormTemplate** | `—` | 3 | [FormField](#form-templates), [Organization](#org-membership), [ResponseCard](#cards-ocr) |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
FormField "1" ||--|| "1" FormTemplate : formTemplate
FormTemplate "1" ||--|| "1" Organization : organization
FormTemplate "1" ||--o{ "many" ResponseCard : cards
```
</details>
## Cards & OCR
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **ProcessingJob** | `—` | 1 | [Organization](#org-membership) |
| **ResponseCard** | `—` | 8 | [CollectionDay](#locations-events), [FormTemplate](#form-templates), [Location](#locations-events), [Organization](#org-membership), [Person](#people-crm-), [User](#auth-users) |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
ProcessingJob "1" ||--|| "1" Organization : organization
ResponseCard "1" ||--|| "1" User : assignedTo
ResponseCard "1" ||--|| "1" Organization : organization
ResponseCard "1" ||--|| "1" Location : location
ResponseCard "1" ||--|| "1" CollectionDay : collectionDay
ResponseCard "1" ||--|| "1" FormTemplate : formTemplate
ResponseCard "1" ||--|| "1" Person : person
```
</details>
## People (CRM)
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **Person** | `—` | 4 | [Organization](#org-membership), [Person](#people-crm-), [ResponseCard](#cards-ocr) |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
Person "1" ||--|| "1" Organization : organization
Person "1" ||--o{ "many" ResponseCard : cards
```
</details>
## Integrations
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **Integration** | `—` | 1 | [Organization](#org-membership) |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
Integration "1" ||--|| "1" Organization : organization
```
</details>
## Activity & Notifications
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **ActivityLog** | `—` | 1 | [User](#auth-users) |
| **Notification** | `—` | 1 | [User](#auth-users) |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
ActivityLog "1" ||--|| "1" User : user
Notification "1" ||--|| "1" User : user
```
</details>
## Settings
| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **AppSettings** | `—` | 0 | — |
| **SystemConfig** | `—` | 0 | — |
<details><summary>ER diagram</summary>
```mermaid
erDiagram
AppSettings {
string id
}
SystemConfig {
string id
}
```
</details>
---
Regenerate after schema changes: `npm run schema:map`. Curated groupings live in [scripts/generate-schema-map.ts](../scripts/generate-schema-map.ts) under `MODEL_GROUPS`.