howone 0.1.30 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/templates/vite/.howone/skills/howone/01-architect/01-app-generation.md +138 -176
  3. package/templates/vite/.howone/skills/howone/01-architect/02-manifest-codegen.md +2 -2
  4. package/templates/vite/.howone/skills/howone/{02-database → 02-entity-schema}/01-schema-design.md +12 -30
  5. package/templates/vite/.howone/skills/howone/02-entity-schema/02-schema-operations.md +329 -0
  6. package/templates/vite/.howone/skills/howone/02-entity-schema/03-access-models.md +151 -0
  7. package/templates/vite/.howone/skills/howone/02-entity-schema/04-query-contracts.md +123 -0
  8. package/templates/vite/.howone/skills/howone/02-entity-schema/05-ai-persistence-patterns.md +255 -0
  9. package/templates/vite/.howone/skills/howone/{04-ai → 03-ai-capabilities}/01-ai-capability-architecture.md +42 -36
  10. package/templates/vite/.howone/skills/howone/{04-ai → 03-ai-capabilities}/02-workflow-contract-rules.md +5 -4
  11. package/templates/vite/.howone/skills/howone/{04-ai/04-service-capability-catalog.md → 03-ai-capabilities/03-service-capability-catalog.md} +15 -11
  12. package/templates/vite/.howone/skills/howone/03-ai-capabilities/04-workflow-operations.md +141 -0
  13. package/templates/vite/.howone/skills/howone/{04-ai/06-ai-feature-playbooks.md → 03-ai-capabilities/05-ai-feature-playbooks.md} +8 -29
  14. package/templates/vite/.howone/skills/howone/{03-sdk → 04-app-sdk}/01-client-setup.md +7 -6
  15. package/templates/vite/.howone/skills/howone/{03-sdk → 04-app-sdk}/07-ai-action-calls.md +5 -5
  16. package/templates/vite/.howone/skills/howone/{04-ai/03-ai-sdk-handoff.md → 04-app-sdk/08-ai-manifest-handoff.md} +8 -7
  17. package/templates/vite/.howone/skills/howone/{03-sdk/08-extension-boundaries.md → 04-app-sdk/09-extension-boundaries.md} +1 -1
  18. package/templates/vite/.howone/skills/howone/{02-database/03-data-access-patterns.md → 04-app-sdk/11-entity-data-access-patterns.md} +4 -4
  19. package/templates/vite/.howone/skills/howone/{02-database/04-query-dsl-and-responses.md → 04-app-sdk/12-query-dsl-and-responses.md} +1 -1
  20. package/templates/vite/.howone/skills/howone/SKILL.md +137 -133
  21. package/templates/vite/.howone/skills/howone/agents/openai.yaml +3 -3
  22. package/templates/vite/AGENTS.md +2 -2
  23. package/templates/vite/.howone/skills/howone/02-database/02-schema-operations.md +0 -398
  24. package/templates/vite/.howone/skills/howone/02-database/05-ai-persistence-patterns.md +0 -372
  25. package/templates/vite/.howone/skills/howone/04-ai/05-workflow-operations.md +0 -256
  26. /package/templates/vite/.howone/skills/howone/{03-sdk → 04-app-sdk}/02-entity-operations.md +0 -0
  27. /package/templates/vite/.howone/skills/howone/{03-sdk → 04-app-sdk}/03-auth.md +0 -0
  28. /package/templates/vite/.howone/skills/howone/{03-sdk → 04-app-sdk}/04-react-integration.md +0 -0
  29. /package/templates/vite/.howone/skills/howone/{03-sdk → 04-app-sdk}/05-file-upload.md +0 -0
  30. /package/templates/vite/.howone/skills/howone/{03-sdk → 04-app-sdk}/06-raw-http.md +0 -0
  31. /package/templates/vite/.howone/skills/howone/{03-sdk/09-workflow-execute-sse.md → 04-app-sdk/10-workflow-execute-sse.md} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "howone",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "private": false,
5
5
  "description": "HowOne command line tools for creating app templates.",
6
6
  "type": "module",
@@ -1,215 +1,177 @@
1
1
  # App Generation Architect
2
2
 
3
- Use this file before building or changing a HowOne generated app. It decides which platform tracks
4
- must be used and what order to execute them in.
3
+ Read immediately after `skill(name="howone")` and before platform design tools, SDK contract
4
+ edits, or implementation guesses.
5
5
 
6
- This is the planning layer. It should prevent the agent from jumping straight into UI code while
7
- missing schema, auth, AI, manifest, or SDK binding contracts.
6
+ HowOne is a generated app platform. This file classifies **user scope**, separates **platform
7
+ contracts** from **app-owned integrations**, and routes to backend, AI, or SDK tracks. Keep design
8
+ tracks separate: backend design does not require SDK references; AI design does not require SDK
9
+ references until the synced AI manifest is ready for code.
8
10
 
9
- ## Platform Shape
11
+ ## Scope classification
10
12
 
11
- HowOne generated apps have four product layers:
13
+ Map the user request to surfaces. Include only what they need.
12
14
 
13
- | Layer | Source of truth | App code should do |
15
+ | Need | Tracks | Notes |
14
16
  |---|---|---|
15
- | Backend database | synced `.howone/database/manifest.json` | generate entity types/bindings and call SDK |
16
- | AI capabilities | synced `.howone/ai/manifest.json` + workflow status | generate AI action bindings and call SDK |
17
- | SDK runtime | `@howone/sdk` + `src/lib/sdk.ts` | centralize env/auth/entities/AI/upload |
18
- | Frontend app | user experience | own UI, state, feedback, forms, navigation |
17
+ | Unclear or full product scope | `01-architect/` (+ others as discovered) | Finish this file before other tracks |
18
+ | Persisted app data on HowOne | `02-entity-schema/` sync | Skip SDK until app code needs calls |
19
+ | HowOne AI features | `03-ai-capabilities/` sync → external workflow | Verify catalog before design |
20
+ | SDK wiring, auth, UI calls | `04-app-sdk/` | Only after manifests exist when contracts apply |
21
+ | UI only, no HowOne data/AI | App code under `{appRoot}` | No schema/AI design tools |
22
+ | External systems the user provides | App code + config | Not platform contracts unless combined with rows above |
19
23
 
20
- The agent may propose schema/capability changes, but the validated/synced manifests drive code.
24
+ **Mixed scope:** read at least one file per touched track (`SKILL.md` index) before writing.
21
25
 
22
- ```text
23
- user request -> architecture decision -> backend/AI contracts -> sync manifests -> sdk binding -> UI
24
- ```
25
-
26
- Do not skip the binding layer. UI code should import `howone` from `src/lib/sdk.ts`, not construct
27
- raw URLs or guessed entity/action names.
26
+ ## HowOne platform boundary
28
27
 
29
- ## First Decision: What Surfaces Are Touched?
28
+ Use this decision model for **any** user request. Do not maintain a mental deny-list of technologies
29
+ (K8s, message buses, custom protocols, etc.). Ask whether the ask is a **platform contract surface**
30
+ or **app-owned**.
30
31
 
31
- Classify the request before editing.
32
+ ### Platform provides (evidence required)
32
33
 
33
- | User request says | Touched surfaces | Required references |
34
+ | Surface | Evidence to check | Design track |
34
35
  |---|---|---|
35
- | "store/save/history/list/my data" | database + SDK + UI | `02-database/`, `03-sdk/02-entity-operations.md` |
36
- | "login/account/my/private" | auth + database access | `03-sdk/03-auth.md`, `03-sdk/04-react-integration.md` |
37
- | "public page/share/link/landing/catalog" | public access + SDK public namespace | `02-database/03-data-access-patterns.md` |
38
- | "AI/generate/analyze/summarize/research/edit image/video/audio" | AI contract + workflow + SDK | `04-ai/` |
39
- | "upload file/image/audio/pdf" | upload + maybe AI URL input | `03-sdk/05-file-upload.md`, `04-ai/02-workflow-contract-rules.md` |
40
- | "change schema/add field/new table" | schema operations + manifest codegen | `02-database/02-schema-operations.md`, `01-architect/02-manifest-codegen.md` |
41
- | "frontend only" | SDK usage + UI | `03-sdk/01-client-setup.md` and relevant SDK docs |
42
-
43
- If multiple surfaces are touched, read one reference from each surface before editing.
44
-
45
- ## Data Posture Decision
46
-
47
- Choose data posture before schema and UI.
48
-
49
- | Product need | Access contract | SDK read |
50
- |---|---|---|
51
- | per-user private data | authenticated own, public none | `howone.entities.X.query.mine()` |
52
- | logged-in shared admin/team data | authenticated all, public none | `howone.entities.X.query()` |
53
- | anonymous public catalog/feed | authenticated all, public list | `howone.public.entities.X.query()` |
54
- | one public share/detail page | authenticated own/all, public scoped | `howone.public.entities.X.queryScoped()` |
55
- | anonymous form submission | authenticated all, public create scoped/any | `howone.public.entities.X.create()` |
56
- | AI generation history | authenticated own, public none | `runAiActionAndPersist()` + `query.mine()` |
57
- | AI public share | private history + public scoped share entity | two entities |
58
-
59
- Defaults:
60
-
61
- - "my" / "per user" / "private" -> authenticated own.
62
- - "landing page" / "blog" / "gallery" -> public list only if fields are safe.
63
- - "share link" / "QR" / "public result" -> public scoped, small `maxLimit`.
64
- - "AI history" -> private history entity; do not make it public just for sharing.
65
-
66
- ## Auth Decision
67
-
68
- | Need | SDK config | Provider behavior |
69
- |---|---|---|
70
- | default HowOne login | `createClient({ projectId, env })` | hosted login |
71
- | custom designed login page using HowOne auth APIs | `auth: 'custom'`, `HowOneProvider auth="none"` | app owns login UI |
72
- | external identity provider/JWT | `auth: { mode: 'headless', adapter }` | adapter owns token/user |
73
- | public-only app | `auth: 'none'` | no auth guard |
74
-
75
- Rules:
76
-
77
- - Keep the bottom-right HowOne `FloatingButton` by default unless explicitly hidden.
78
- - SDK must not add toast/overlay/login-page UI.
79
- - Use `client.me()` or `client.requireMe()` for first-load user resolution.
80
- - Do not use `auth.isAuthenticated()` as the only initial truth when user data must be loaded.
81
-
82
- ## Backend Feature Workflow
83
-
84
- Use when persistence or schema changes are needed:
36
+ | Persisted structured data on HowOne | Schema tools + `{appRoot}/.howone/database/manifest.json` | `02-entity-schema/` |
37
+ | AI execution on HowOne workflow service | `03-service-capability-catalog.md` + AI manifest + AI tools | `03-ai-capabilities/` |
38
+ | App calls HowOne runtime | Synced manifests + `04-app-sdk/` reference for that behavior | `04-app-sdk/` |
39
+ | Mutating platform contracts | `backend-api-design`, `ai-capability-design`, sync tools, `external-ai-capability` | Per surface |
85
40
 
86
- 1. Read `02-database/01-schema-design.md`.
87
- 2. Read `02-database/02-schema-operations.md`.
88
- 3. Inspect current schema state/manifest.
89
- 4. Design complete entity contract: fields, required, access, indexes, presentation.
90
- 5. Preview one complete schema patch.
91
- 6. Apply the exact previewed patch if risk is acceptable.
92
- 7. Sync schema artifacts from returned version.
93
- 8. Read `.howone/database/manifest.json`.
94
- 9. Update `src/lib/sdk.ts` from manifest using `01-architect/02-manifest-codegen.md`.
95
- 10. Implement UI with `howone.entities.*` or `howone.public.entities.*`.
96
- 11. Validate build/tests.
41
+ If none of these surfaces can express the user's **platform** requirement after checking contracts,
42
+ catalog, and tool schemas, it is a **platform gap**—not an automatic ban on whatever technology the
43
+ user named.
97
44
 
98
- Risk stops:
45
+ ### App-owned (not platform gap)
99
46
 
100
- - deleting entity/field;
101
- - making required field without default;
102
- - broadening public access;
103
- - enabling public write;
104
- - changing owner/public scope semantics.
47
+ Anything the user runs, hosts, or buys **outside** HowOne contracts: orchestration, clusters,
48
+ custom APIs, message systems, identity products, analytics, payment gateways, etc.
105
49
 
106
- ## AI Feature Workflow
50
+ - Implement in application code and configuration under `{appRoot}`.
51
+ - **Do not refuse** because HowOne does not provision it.
52
+ - **Do not** call platform design tools to fake it as entities, AI capabilities, or manifest fields.
53
+ - **Do not** tell the user they cannot use their own stack—only clarify it is outside HowOne platform scope.
107
54
 
108
- Use when AI capability/workflow is needed:
109
-
110
- 1. Read `04-ai/01-ai-capability-architecture.md`.
111
- 2. Read `04-ai/04-service-capability-catalog.md` to verify support.
112
- 3. Pick a playbook from `04-ai/06-ai-feature-playbooks.md` when applicable.
113
- 4. Design schemas with `04-ai/02-workflow-contract-rules.md`.
114
- 5. Preview/apply AI capability patch.
115
- 6. Sync `.howone/ai/manifest.json`.
116
- 7. Submit external workflow create/update using `04-ai/05-workflow-operations.md`.
117
- 8. Preserve returned `request_id`.
118
- 9. Poll status until terminal; preserve `workflowConfigID` on success.
119
- 10. Update `src/lib/sdk.ts` with `04-ai/03-ai-sdk-handoff.md`.
120
- 11. Implement UI through `howone.ai.*`.
121
- 12. If output persists, use `02-database/05-ai-persistence-patterns.md`.
122
-
123
- Do not build fake AI. If the required capability is unsupported, report the exact gap.
124
-
125
- ## Manifest Codegen Workflow
126
-
127
- Run after database or AI sync:
128
-
129
- 1. Read current `src/lib/sdk.ts`.
130
- 2. Read synced manifests.
131
- 3. Preserve existing exports and naming style.
132
- 4. Generate/update:
133
- - entity `Record/Create/Update` types;
134
- - optional exported `*EntityDefinition` for guards;
135
- - `client.entity<...>()` bindings;
136
- - AI Zod schemas and `defineAiAction(...)`;
137
- - composed `howone` export.
138
- 5. Never write generated source under `.howone/`.
139
-
140
- ## Common User Situations
141
-
142
- ### User asks for "just a frontend"
143
-
144
- Still check whether UI needs stored data, auth, upload, or AI. If it only renders static/local state,
145
- do not invent schema or workflow. If it saves anything, use database flow.
146
-
147
- ### User asks for "AI app" but no persistence
148
-
149
- Design AI capability and SDK binding only. Keep results in app state. Do not create entities unless
150
- history, refresh resilience, user library, or share page is needed.
151
-
152
- ### User asks for "AI app with history"
153
-
154
- Design AI first, then database:
55
+ ### Boundary decision (always)
155
56
 
156
57
  ```text
157
- AI output contract -> Generation entity -> runAiActionAndPersist -> history query.mine()
58
+ 1. What did the user ask for?
59
+ 2. Does it require HowOne persisted data? → entity-schema path or skip
60
+ 3. Does it require HowOne AI? → catalog + ai-capabilities path or skip
61
+ 4. Is it only their external infrastructure? → app-owned; wire in UI/config
62
+ 5. Did they ask for a platform feature with no contract evidence? → platform stop (generic)
63
+ 6. Mixed? → platform parts via tracks; app-owned parts in app code
158
64
  ```
159
65
 
160
- Do not put history fields into workflow output unless the AI itself must generate them.
66
+ ### Platform scope rules
161
67
 
162
- ### User asks for "public AI result"
68
+ - **No invented platform APIs:** Only fields and behaviors present in manifests, catalog, tools, or documented SDK references.
69
+ - **No invalid shortcuts:** Do not handwrite `.howone/` metadata or guess version/workflow identifiers.
70
+ - **Stop wording:** Name the **missing contract surface** (e.g. no catalog family, no manifest binding, no tool operation)—not the user's technology choice.
163
71
 
164
- Use two entities:
72
+ When stopping a platform path, separate what HowOne can provide from what remains possible via app-owned integration.
165
73
 
166
- - private `Generation` for owner history and retry;
167
- - public scoped `SharedGeneration` for anonymous viewing.
74
+ Inspect-only platform reads do not replace this file before the first **design write**.
168
75
 
169
- Do not expose private prompt/history broadly.
76
+ ## Platform layers
170
77
 
171
- ### User asks for "latest/current/research"
78
+ | Layer | Source of truth | App responsibility |
79
+ |---|---|---|
80
+ | Database | `{appRoot}/.howone/database/manifest.json` | Entity binding handoff |
81
+ | AI | `{appRoot}/.howone/ai/manifest.json` + workflow status | AI binding handoff |
82
+ | SDK | `@howone/sdk` + `{appRoot}/src/lib/sdk.ts` | App runtime calls |
83
+ | Frontend | App code | UI, state, feedback |
172
84
 
173
- Use AI workflow with web search/crawling capability. If app also lists saved briefings, add entity
174
- persistence after output contract.
85
+ Validated/synced manifests drive code—not prompts or memory.
175
86
 
176
- ### User asks to modify existing AI behavior
87
+ ```text
88
+ user request → scope → platform contracts → sync → sdk binding → UI
89
+ ```
177
90
 
178
- If only behavior changes, use external workflow update with `workflowConfigID`.
179
- If input/output changes, update AI capability contract first, sync manifest, then update workflow
180
- and SDK bindings.
91
+ When SDK work is in scope, import the app runtime from `src/lib/sdk.ts`; do not guess entity/action
92
+ names or platform URLs.
181
93
 
182
- ### User asks to change schema used by UI
94
+ ## Minimum track reads (after this file)
183
95
 
184
- Change backend schema first, sync, regenerate SDK, then update UI. Do not patch UI types from memory.
96
+ Use `SKILL.md` for the full file index. Typical minimums:
185
97
 
186
- ### User asks for custom auth
98
+ | Surface in scope | Read at least |
99
+ |---|---|
100
+ | Entity/schema design | `02-entity-schema/01-schema-design.md`, `02-entity-schema/02-schema-operations.md` |
101
+ | Backend query/public contracts | add `02-entity-schema/03-access-models.md`, `02-entity-schema/04-query-contracts.md` |
102
+ | App entity query code | add `04-app-sdk/11-entity-data-access-patterns.md`, `04-app-sdk/12-query-dsl-and-responses.md` after manifest sync |
103
+ | AI design | `03-ai-capabilities/01-ai-capability-architecture.md`, `03-ai-capabilities/03-service-capability-catalog.md`, `03-ai-capabilities/02-workflow-contract-rules.md` |
104
+ | AI + saved outputs | add `02-entity-schema/05-ai-persistence-patterns.md` after AI contract is known |
105
+ | Bindings after sync | `02-manifest-codegen.md` + relevant `04-app-sdk/` files |
187
106
 
188
- Use `auth: 'custom'` or headless `AuthAdapter`. App owns visible login UI. Keep SDK callbacks/data
189
- only.
107
+ ## Data posture
190
108
 
191
- ## Implementation Guardrails
109
+ Choose before schema and UI.
192
110
 
193
- - Use `@howone/sdk` typed clients before `raw`.
194
- - Use `howone.raw` only when typed surface is missing.
195
- - Do not hardcode HowOne API URLs.
196
- - Do not pass owner fields for authenticated own records.
197
- - Do not import or create SDK toast APIs.
198
- - Do not remove HowOne floating logo unless explicitly requested.
199
- - Do not call AI workflows from render.
200
- - Do not persist workflow envelopes or UI-only fields.
201
- - Do not assume unavailable AI capabilities.
111
+ | Product need | Access posture | Runtime handoff |
112
+ |---|---|---|
113
+ | Per-user private data | authenticated own | SDK entity track later |
114
+ | Shared authenticated data | authenticated all | SDK entity track later |
115
+ | Public catalog | public list where safe | SDK public entity track later |
116
+ | Public share/detail | public scoped | SDK public entity track later |
117
+ | Anonymous create | public create scoped/any | SDK public entity track later |
118
+ | AI run history | authenticated own | private history entity |
119
+ | AI public share | private + public scoped entities | two entities |
202
120
 
203
- ## Final Architecture Checklist
121
+ Defaults: "my/private" own; public catalog only when fields are safe; share links → scoped + limits.
204
122
 
205
- Before writing final code:
123
+ ## Auth posture
206
124
 
207
- - Data posture is explicit.
208
- - Auth mode is explicit.
209
- - Public access has filters/sorts/scopes/limits.
210
- - AI capability is supported by service catalog.
211
- - Workflow count follows one-feature rule or RAG exception.
212
- - Persistence is separate from AI workflow.
213
- - Manifests are synced before SDK codegen.
214
- - `src/lib/sdk.ts` is the only app SDK entrypoint.
215
- - UI owns visible states and feedback.
125
+ | Need | Client | Provider |
126
+ |---|---|---|
127
+ | Hosted HowOne login | default `createClient` | hosted |
128
+ | Custom login UI | `auth: 'custom'`, provider `auth="none"` | app UI |
129
+ | External IdP | headless + adapter | adapter owns token |
130
+ | No auth | `auth: 'none'` | — |
131
+
132
+ Keep default HowOne brand control unless user asks to hide. Resolve identity through the SDK track
133
+ when app code depends on the current user.
134
+
135
+ ## Entity workflow (when `02-entity-schema/` in scope)
136
+
137
+ 1. Read schema design + operations references.
138
+ 2. Inspect current schema/manifest.
139
+ 3. Design full entity contract (fields, access, indexes).
140
+ 4. Apply one complete patch → `sync_schema_artifacts`.
141
+ 5. Read `{appRoot}/.howone/database/manifest.json`.
142
+ 6. Stop backend design. Read SDK references only if implementing app calls.
143
+
144
+ No schema dry-run step. High-risk changes (delete entity/field, broaden public write, required
145
+ without default) need explicit user alignment before applying the final patch.
146
+
147
+ ## AI workflow (when `03-ai-capabilities/` in scope)
148
+
149
+ 1. Read architecture + **catalog** (feasibility) + contract rules; use playbooks when they match.
150
+ 2. Apply one complete capability patch → `sync_ai_artifacts`.
151
+ 3. External workflow create/update per workflow-operations reference; keep job/request IDs from tool results.
152
+ 4. Read `{appRoot}/.howone/ai/manifest.json`.
153
+ 5. Stop AI design. Read SDK references only if implementing app calls.
154
+ 6. If persistence required: entity workflow after output contract is fixed.
155
+
156
+ Do not fake catalog-backed AI. Platform gap → stop AI design path, explain generically.
157
+ No AI capability dry-run step. Design the contract from the skill references, then apply the final
158
+ capability patch.
159
+
160
+ ## Scope patterns (not a product catalog)
161
+
162
+ | Pattern | Platform work |
163
+ |---|---|
164
+ | Ephemeral AI result in UI state only | AI + SDK; skip entity-schema unless user adds storage |
165
+ | AI with history/library | AI contract first, then persistence entity |
166
+ | Public view of private AI output | private entity + scoped public entity |
167
+ | Behavior-only AI change | workflow update when schemas unchanged |
168
+ | Schema/UI drift | schema → sync → SDK → then UI |
169
+
170
+ ## Checklist before implementation
171
+
172
+ - [ ] Scope explicit: which tracks apply; app-owned vs platform clear
173
+ - [ ] Data and auth posture chosen when data in scope
174
+ - [ ] AI requirements verified against catalog when AI in scope
175
+ - [ ] Manifests synced before SDK codegen
176
+ - [ ] `src/lib/sdk.ts` is the HowOne entrypoint
177
+ - [ ] UI owns visible feedback; no invented platform APIs
@@ -15,8 +15,8 @@ Sync tools (`sync_schema_artifacts`, `sync_ai_artifacts`) write the manifests. T
15
15
 
16
16
  For AI capabilities, external workflow create/update is submitted by `external-ai-capability` from
17
17
  the synced manifest. Do not duplicate AI schemas in app code beyond generated zod/type bindings.
18
- For workflow edits, `workflowConfigID` belongs to the external workflow operation; it is not an SDK
19
- binding field.
18
+ For workflow edits, `external-ai-capability` may rotate the manifest `workflowId`; always re-read
19
+ `.howone/ai/manifest.json` after the tool returns before updating `src/lib/sdk.ts`.
20
20
 
21
21
  ---
22
22
 
@@ -1,12 +1,15 @@
1
1
  # Database Schema Design
2
2
 
3
+ **Track:** `02-entity-schema/` — platform entity contracts only; skip when the user needs no HowOne persisted data.
4
+
3
5
  Use this reference when designing or changing HowOne backend entity schemas. It condenses the
4
6
  runtime contract from `docs/dynamic-entity-architecture.zh.md` into instructions an AI agent can
5
7
  actually apply.
6
8
 
7
9
  This file answers: **what should the schema be?** For how to apply changes, read
8
- `02-schema-operations.md`. For frontend calls, read `03-data-access-patterns.md` and
9
- `03-sdk/02-entity-operations.md`.
10
+ `02-schema-operations.md`. For access/query contract details, read `03-access-models.md` and
11
+ `04-query-contracts.md`. For frontend calls, wait for manifest sync, then read
12
+ `04-app-sdk/02-entity-operations.md`.
10
13
 
11
14
  ## Mental Model
12
15
 
@@ -47,7 +50,7 @@ Each section has a different job:
47
50
  | `relations` | Valid include names | What can be joined/expanded? |
48
51
  | `presentation` | Admin/generator hints | What fields identify the record in UI? |
49
52
  | `lifecycle` | Audit/delete policy hints | Is this append-only, soft-deletable, audited? |
50
- | `performance` | SDK/admin pagination/sort hints | What limits and sorts are safe? |
53
+ | `performance` | Runtime/admin pagination/sort hints | What limits and sorts are safe? |
51
54
 
52
55
  ## Storage Reality
53
56
 
@@ -227,7 +230,7 @@ Rules:
227
230
  - For private user data, use all `own`.
228
231
  - For authenticated shared dashboards/CMS, use `read: "all"` and be conservative on update/delete.
229
232
  - Do not pass owner fields in authenticated payloads or filters. Backend derives owner from auth.
230
- - `query.mine()` is the SDK shorthand for authenticated own lists.
233
+ - Authenticated own lists must use the authenticated channel so the backend can derive ownership.
231
234
 
232
235
  ### Public Access
233
236
 
@@ -310,14 +313,7 @@ Use for todos, notes, journals, saved generations, personal settings.
310
313
  }
311
314
  ```
312
315
 
313
- SDK list:
314
-
315
- ```ts
316
- await howone.entities.Todo.query.mine({
317
- page: { number: 1, size: 50 },
318
- orderBy: { updatedDate: 'desc' },
319
- })
320
- ```
316
+ App implementation handoff: use the SDK entity operations reference after manifest sync.
321
317
 
322
318
  ### B. Public Read-Only Catalog
323
319
 
@@ -360,15 +356,8 @@ Use for articles, templates, listings, published galleries.
360
356
  }
361
357
  ```
362
358
 
363
- SDK public list:
364
-
365
- ```ts
366
- await howone.public.entities.Article.query({
367
- where: { status: 'published' },
368
- orderBy: { publishedAt: 'desc' },
369
- page: { number: 1, size: 20 },
370
- })
371
- ```
359
+ App implementation handoff: public list calls are generated from `access.public.allowedFilters`,
360
+ `allowedSorts`, and pagination limits after manifest sync.
372
361
 
373
362
  ### C. Public Scoped Share Page
374
363
 
@@ -406,14 +395,7 @@ Use for QR profile, public invoice, public resume, shared report.
406
395
  }
407
396
  ```
408
397
 
409
- SDK public scoped read:
410
-
411
- ```ts
412
- await howone.public.entities.QrProfile.queryScoped({
413
- where: { ownerId, slug, active: true },
414
- page: { number: 1, size: 1 },
415
- })
416
- ```
398
+ App implementation handoff: scoped public reads must include every `requiredScopes` value.
417
399
 
418
400
  ### D. Workflow Output History
419
401
 
@@ -491,7 +473,7 @@ Use `relations` only when frontend/admin needs `include`.
491
473
 
492
474
  Rules:
493
475
 
494
- - Keep relation names stable; SDK/UI may use them in `include`.
476
+ - Keep relation names stable; app code may use them in `include`.
495
477
  - Do not use relations to hide missing denormalized fields required by list pages.
496
478
  - Public include should be conservative; ensure related data is safe to expose.
497
479