oneie 3.6.7 → 3.6.11

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 (165) hide show
  1. package/.claude/agents/agent-backend.md +83 -0
  2. package/.claude/agents/agent-designer.md +97 -0
  3. package/.claude/agents/agent-director.md +118 -7
  4. package/.claude/agents/agent-documenter.md +93 -0
  5. package/.claude/agents/agent-frontend.md +96 -0
  6. package/.claude/agents/agent-ops.md +182 -25
  7. package/.claude/agents/agent-problem-solver.md +166 -0
  8. package/.claude/agents/agent-quality.md +127 -0
  9. package/.claude/commands/build.md +293 -0
  10. package/.claude/commands/cascade.md +231 -127
  11. package/.claude/commands/mcp-toggle.md +93 -0
  12. package/.claude/commands/one.md +198 -116
  13. package/.claude/commands/plan.md +394 -80
  14. package/.claude/commands/release.md +41 -19
  15. package/.claude/commands/server.md +2 -0
  16. package/.claude/hooks/root-cleanup.py +75 -0
  17. package/.claude/skills/INDEX.md +523 -0
  18. package/.claude/skills/REGISTRY.md +529 -0
  19. package/.claude/skills/agent-backend-create-mutation.md +319 -0
  20. package/.claude/skills/agent-designer-create-wireframe.md +341 -0
  21. package/.claude/skills/agent-frontend-create-page.md +413 -0
  22. package/.claude/skills/agents/README.md +238 -0
  23. package/dist/clone-web.js +1 -1
  24. package/dist/clone-web.js.map +1 -1
  25. package/folders.yaml +1 -1
  26. package/one/.obsidian/workspace.json +38 -38
  27. package/one/connections/api/queries-reference.md +842 -0
  28. package/one/connections/api-reference.md +1011 -0
  29. package/one/connections/integration-examples.md +875 -0
  30. package/one/connections/integration-guide.md +869 -0
  31. package/one/connections/integration-phase2.md +736 -0
  32. package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
  33. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
  34. package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
  35. package/one/events/CONNECTIONS_DEMO.md +501 -0
  36. package/one/events/DELIVERABLES.md +432 -0
  37. package/one/events/DEMO-GROUPS-PAGE.md +392 -0
  38. package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
  39. package/one/events/DEMO_COMPONENTS.md +487 -0
  40. package/one/events/DEMO_HOOKS_INDEX.md +334 -0
  41. package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
  42. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
  43. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
  44. package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
  45. package/one/events/DEMO_SETUP.md +476 -0
  46. package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
  47. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
  48. package/one/events/HOOKS-DEMO.md +441 -0
  49. package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
  50. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
  51. package/one/events/QA-CHECKLIST.md +674 -0
  52. package/one/events/QUICK-START-ONTOLOGY.md +408 -0
  53. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
  54. package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
  55. package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
  56. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
  57. package/one/events/TEST-PLAN-INDEX.md +346 -0
  58. package/one/events/TEST-PLAN.md +1417 -0
  59. package/one/events/TESTING-DELIVERY.txt +372 -0
  60. package/one/events/TRANSITIONS-QUICK-START.md +141 -0
  61. package/one/events/TYPESCRIPT_FIXES.md +152 -0
  62. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
  63. package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
  64. package/one/events/VIEW-TRANSITIONS.md +428 -0
  65. package/one/events/backend-integration-tests.md +606 -0
  66. package/one/events/backend-structure-diagram.txt +393 -0
  67. package/one/events/backend-structure-summary.txt +269 -0
  68. package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
  69. package/one/events/convex-analysis-index.md +304 -0
  70. package/one/events/convex-structure-analysis.md +700 -0
  71. package/one/events/design-spec-complete.md +208 -0
  72. package/one/events/ontology-test-examples.md +562 -0
  73. package/one/events/phase1-backend-implementation-complete.md +518 -0
  74. package/one/events/test-dashboard.md +345 -0
  75. package/one/events/test-index.md +361 -0
  76. package/one/events/test-report-ontology.md +582 -0
  77. package/one/events/testing-summary.md +344 -0
  78. package/one/groups/features.md +2878 -0
  79. package/one/groups/strategy copy.md +869 -0
  80. package/one/knowledge/backend-api-reference.md +710 -0
  81. package/one/knowledge/documentation-summary.md +285 -0
  82. package/one/knowledge/lessons-learned.md +294 -4
  83. package/one/knowledge/ontology-visual-guide.md +360 -0
  84. package/one/knowledge/ontology.md +9 -17
  85. package/one/things/demo-accessibility-animations.md +999 -0
  86. package/one/things/demo-components.md +1304 -0
  87. package/one/things/demo-design-summary.md +629 -0
  88. package/one/things/demo-design-system.md +919 -0
  89. package/one/things/demo-page-layouts.md +989 -0
  90. package/one/things/designs/accessibility-audit.md +790 -0
  91. package/one/things/designs/component-specifications.md +757 -0
  92. package/one/things/designs/design-overview.md +318 -0
  93. package/one/things/designs/design-tokens.md +414 -0
  94. package/one/things/designs/wireframes-dashboard.md +653 -0
  95. package/one/things/docs/api-requests.md +923 -0
  96. package/one/things/features/0 All Features.md +2 -0
  97. package/one/things/implementation/backend-guide.md +412 -0
  98. package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
  99. package/one/things/plans/ai-elements.md +1259 -0
  100. package/one/things/plans/ai-integration.md +947 -0
  101. package/one/things/plans/ai-sdk.md +761 -0
  102. package/one/things/plans/app.md +1 -1
  103. package/one/things/plans/architecture-summary.md +283 -0
  104. package/one/things/plans/async-ai-agents.md +215 -0
  105. package/one/things/plans/backend-agnostic-frontend.md +11 -6
  106. package/one/things/plans/backend-cleanup-quickstart.md +346 -0
  107. package/one/things/plans/backend-ontology-conformance.md +416 -0
  108. package/one/things/plans/backend-status.md +541 -0
  109. package/one/things/plans/backend-structure.md +799 -0
  110. package/one/things/plans/backend-target-structure.md +438 -0
  111. package/one/things/plans/backend.md +1133 -0
  112. package/one/things/plans/better-auth-any-backend.md +11 -11
  113. package/one/things/plans/cli-updates-required.md +280 -0
  114. package/one/things/plans/complete-step-by-step.md +1302 -0
  115. package/one/things/plans/convex-agents.md +1005 -0
  116. package/one/things/plans/deployment-architecture.md +426 -0
  117. package/one/things/plans/development-plan.md +1220 -0
  118. package/one/things/plans/effect.md +808 -48
  119. package/one/things/plans/integrate-frontend-and-backend.md +579 -0
  120. package/one/things/plans/mcp-clear-context-prompt.md +60 -0
  121. package/one/things/plans/mcp-simple.md +228 -0
  122. package/one/things/plans/one.md +8 -7
  123. package/one/things/plans/ontology-6-dimensions.md +20 -14
  124. package/one/things/plans/quick-wins.md +1273 -0
  125. package/one/things/plans/readme-backend-cleanup.md +361 -0
  126. package/one/things/plans/separate-demo.md +830 -0
  127. package/one/things/plans/separate.md +3 -3
  128. package/one/things/plans/sequence.md +1897 -0
  129. package/one/things/plans/sync-checklist.md +321 -0
  130. package/one/things/plans/unified-implementation-plan.md +3 -3
  131. package/one/things/plans/update-demos.md +513 -0
  132. package/package.json +1 -1
  133. package/.claude/agents/backend-specialist.md +0 -169
  134. package/.claude/agents/designer.md +0 -216
  135. package/.claude/agents/frontend-specialist.md +0 -236
  136. package/.claude/commands/done.md +0 -35
  137. package/.claude/commands/infer.md +0 -138
  138. package/.claude/commands/next.md +0 -53
  139. package/.claude/commands/one copy.md +0 -565
  140. package/.claude/commands/one-template.md +0 -106
  141. package/.claude/commands/one-v1.md +0 -609
  142. package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
  143. package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
  144. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  145. package/one/groups/nine-padel-customers.md +0 -138
  146. package/one/groups/nine-padel-data-structure.md +0 -167
  147. package/one/groups/nine-padel-ontology-specification.md +0 -359
  148. package/one/groups/nine-padel-ontology.md +0 -143
  149. package/one/groups/nine-padel-strategy.md +0 -234
  150. package/one/groups/nine-padel.md +0 -211
  151. package/one/groups/nine-padle-contents.baked.md +0 -1252
  152. package/one/groups/nine-padle-contents.md +0 -6
  153. package/one/things/features/1-1-agent-prompts/design.md +0 -470
  154. package/one/things/features/1-1-agent-prompts/tests.md +0 -264
  155. package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
  156. package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
  157. package/one/things/features/1-3-event-coordination/design.md +0 -544
  158. package/one/things/features/1-3-event-coordination/tests.md +0 -223
  159. package/one/things/features/1-4-knowledge-management/design.md +0 -609
  160. package/one/things/features/1-4-knowledge-management/tests.md +0 -195
  161. package/one/things/features/1-5-quality-loops/design.md +0 -797
  162. package/one/things/features/1-5-quality-loops/tests.md +0 -212
  163. package/one/things/features/1-6-numbering-structure/design.md +0 -610
  164. package/one/things/features/1-6-numbering-structure/tests.md +0 -213
  165. package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
@@ -0,0 +1,541 @@
1
+ # Backend Status: What's Complete, What's Next
2
+
3
+ **Date:** 2025-10-24
4
+ **Status:** ✅ Foundation Complete, 🚧 Features In Progress
5
+ **Version:** 1.0.0
6
+
7
+ ---
8
+
9
+ ## Executive Summary
10
+
11
+ The ONE Platform backend is **fully functional with Better Auth integration**. The connection between frontend and backend is working. Here's what exists and what's next.
12
+
13
+ ---
14
+
15
+ ## ✅ COMPLETE: What Already Works
16
+
17
+ ### 1. Authentication Backend (Working)
18
+
19
+ **Location:** `/backend/convex/auth.ts`
20
+
21
+ **Implemented:**
22
+ - ✅ Email/Password signup
23
+ - ✅ Email/Password signin
24
+ - ✅ Sign out
25
+ - ✅ JWT token generation (access + refresh)
26
+ - ✅ Password hashing (SHA-256 for demo, needs bcrypt for production)
27
+ - ✅ Email verification token generation
28
+ - ✅ Rate limiting (5 mutations per second)
29
+ - ✅ Sessions table with token validation
30
+
31
+ **Current Flow:**
32
+ ```
33
+ Frontend (Better Auth) → POST /auth/signup
34
+ ↓
35
+ Backend (auth.ts) → Hash password, create user, generate JWT
36
+ ↓
37
+ Frontend stores JWT → Uses for subsequent requests
38
+ ```
39
+
40
+ ### 2. Database Schema (Complete)
41
+
42
+ **Location:** `/backend/convex/schema.ts`
43
+
44
+ **Tables:**
45
+ - ✅ users (email, passwordHash, emailVerified)
46
+ - ✅ sessions (userId, token, expiresAt)
47
+ - ✅ groups (slug, name, type, parentGroupId, settings)
48
+ - ✅ entities (groupId, type, name, properties, status)
49
+ - ✅ connections (groupId, type, fromId, toId, metadata)
50
+ - ✅ events (groupId, type, actorId, targetId, timestamp)
51
+ - ✅ knowledge (groupId, type, text, embedding, metadata)
52
+
53
+ **Status:**
54
+ - ✅ Schema defined
55
+ - ✅ All 6 dimensions represented
56
+ - ✅ Indexes created for common queries
57
+ - ⚠️ Missing: apiKeys table (for API key authentication)
58
+
59
+ ### 3. Frontend Auth Integration (Working)
60
+
61
+ **Location:** `/web/src/lib/auth-client.ts`
62
+
63
+ **Components:**
64
+ - ✅ Better Auth client configured
65
+ - ✅ Auth hooks (useSession, useSignIn, useSignUp)
66
+ - ✅ Auth page (`/account/auth.astro`)
67
+ - ✅ Tests for auth flows (50+ test cases)
68
+ - ✅ OAuth configuration (Google, GitHub)
69
+
70
+ **Test Coverage:**
71
+ - ✅ Email/password signup
72
+ - ✅ Email/password signin
73
+ - ✅ Session management
74
+ - ✅ Token refresh
75
+ - ✅ OAuth flows
76
+
77
+ ### 4. Core Mutations (Partial)
78
+
79
+ **Location:** `/backend/convex/mutations/`
80
+
81
+ **Implemented:**
82
+ - ✅ entities.ts (create, update, delete things)
83
+ - ✅ groups.ts (create, update groups)
84
+ - ✅ connections.ts (create, delete relationships)
85
+ - ✅ contact.ts (contact form submissions)
86
+ - ✅ onboarding.ts (user onboarding)
87
+
88
+ **Status:**
89
+ - ✅ Basic CRUD for core entities
90
+ - ⚠️ Missing: Full 66 thing types
91
+ - ⚠️ Missing: Event logging on mutations
92
+ - ⚠️ Missing: Group scoping enforcement
93
+
94
+ ### 5. Core Queries (Partial)
95
+
96
+ **Location:** `/backend/convex/queries/`
97
+
98
+ **Implemented:**
99
+ - ✅ entities.ts (list, get things)
100
+ - ✅ groups.ts (list, get groups)
101
+ - ✅ connections.ts (list connections)
102
+ - ✅ ontology.ts (get available types)
103
+ - ✅ init.ts (initialization data)
104
+
105
+ **Status:**
106
+ - ✅ Basic read operations
107
+ - ⚠️ Missing: Vector search for RAG
108
+ - ⚠️ Missing: Complex filtering/sorting
109
+
110
+ ### 6. Services (Partial)
111
+
112
+ **Location:** `/backend/convex/services/`
113
+
114
+ **Implemented:**
115
+ - ✅ ontologyMapper.ts (map features to ontology)
116
+ - ✅ websiteAnalyzer.ts (analyze existing websites)
117
+ - ✅ brandGuideGenerator.ts (generate brand guides)
118
+ - ✅ featureRecommender.ts (recommend features)
119
+
120
+ **Status:**
121
+ - ✅ Specialized services working
122
+ - ⚠️ Missing: General CRUD services
123
+ - ⚠️ Missing: RAG service
124
+ - ⚠️ Missing: AI SDK integration
125
+
126
+ ---
127
+
128
+ ## 🚧 IN PROGRESS: What Needs Work
129
+
130
+ ### 1. HTTP API Layer (NOT STARTED)
131
+
132
+ **Needed:** Hono HTTP endpoints for external access
133
+
134
+ **What's Missing:**
135
+ - [ ] `/backend/convex/http.ts` - Hono setup
136
+ - [ ] API key authentication middleware
137
+ - [ ] REST endpoints for all 6 dimensions
138
+ - [ ] OpenAPI documentation
139
+ - [ ] Rate limiting per group
140
+ - [ ] CORS configuration
141
+
142
+ **Priority:** HIGH - Required for multi-client support
143
+
144
+ **Estimated Effort:** 1-2 weeks
145
+
146
+ ### 2. API Key Management (NOT STARTED)
147
+
148
+ **Needed:** API key generation and validation
149
+
150
+ **What's Missing:**
151
+ - [ ] apiKeys table in schema
152
+ - [ ] createApiKey mutation
153
+ - [ ] verifyApiKey query
154
+ - [ ] revokeApiKey mutation
155
+ - [ ] API key middleware in Hono
156
+
157
+ **Priority:** HIGH - Needed for external access
158
+
159
+ **Estimated Effort:** 3-4 days
160
+
161
+ ### 3. Event Logging (PARTIAL)
162
+
163
+ **Current:** Events table exists, but not auto-logged
164
+
165
+ **What's Missing:**
166
+ - [ ] Auto-log events on all mutations
167
+ - [ ] Event filtering/search
168
+ - [ ] Timeline views
169
+ - [ ] Event retention policies
170
+
171
+ **Priority:** MEDIUM - Important for audit trail
172
+
173
+ **Estimated Effort:** 1 week
174
+
175
+ ### 4. Group Scoping (PARTIAL)
176
+
177
+ **Current:** Groups table exists, but not enforced
178
+
179
+ **What's Missing:**
180
+ - [ ] Middleware to extract groupId from auth
181
+ - [ ] Enforce groupId on all queries/mutations
182
+ - [ ] Hierarchical group access (parent → child)
183
+ - [ ] Resource quotas per group
184
+
185
+ **Priority:** MEDIUM - Critical for multi-tenancy
186
+
187
+ **Estimated Effort:** 1 week
188
+
189
+ ### 5. AI SDK Integration (NOT STARTED)
190
+
191
+ **Needed:** RAG pipeline and AI features
192
+
193
+ **What's Missing:**
194
+ - [ ] Install AI SDK: `npm install ai @ai-sdk/openai`
195
+ - [ ] RAG ingestion (document chunking)
196
+ - [ ] Vector embeddings (OpenAI embedding model)
197
+ - [ ] Vector search query
198
+ - [ ] Generation action (with context)
199
+ - [ ] Streaming support
200
+
201
+ **Priority:** MEDIUM - Needed for AI features
202
+
203
+ **Estimated Effort:** 2 weeks
204
+
205
+ ### 6. Better Auth Expansion (PARTIAL)
206
+
207
+ **Current:** Email/password + basic OAuth setup
208
+
209
+ **What's Missing:**
210
+ - [ ] Magic links
211
+ - [ ] Email verification (UI/API)
212
+ - [ ] Password reset flow
213
+ - [ ] 2FA (TOTP)
214
+ - [ ] Session management (revoke, list)
215
+ - [ ] OAuth provider expansion
216
+
217
+ **Priority:** MEDIUM - Improve security/UX
218
+
219
+ **Estimated Effort:** 1-2 weeks
220
+
221
+ ### 7. Complete CRUD (PARTIAL)
222
+
223
+ **Current:** Basic CRUD for ~5-10 entity types
224
+
225
+ **What's Missing:**
226
+ - [ ] CRUD mutations for all 66+ thing types
227
+ - [ ] CRUD for 25 connection types
228
+ - [ ] Bulk operations
229
+ - [ ] Batch mutations
230
+
231
+ **Priority:** MEDIUM - Needed for feature completeness
232
+
233
+ **Estimated Effort:** 2-3 weeks
234
+
235
+ ### 8. Production Hardening (NOT STARTED)
236
+
237
+ **What's Missing:**
238
+ - [ ] Use bcrypt instead of SHA-256 for password hashing
239
+ - [ ] Input validation on all endpoints
240
+ - [ ] SQL injection prevention (already handled by Convex)
241
+ - [ ] Rate limiting tuning
242
+ - [ ] Security headers
243
+ - [ ] HTTPS enforcement
244
+
245
+ **Priority:** HIGH - Critical for production
246
+
247
+ **Estimated Effort:** 1 week
248
+
249
+ ---
250
+
251
+ ## Architecture: Current State
252
+
253
+ ```
254
+ ┌──────────────────────────────────┐
255
+ │ FRONTEND (Astro + React) │
256
+ │ Better Auth Components │
257
+ │ ✅ Working & Tested │
258
+ └────────────┬─────────────────────┘
259
+ │ JWT Token
260
+ ↓
261
+ ┌──────────────────────────────────┐
262
+ │ CONVEX FUNCTIONS (Current) │
263
+ │ ✅ Auth (signup/signin/signout) │
264
+ │ ✅ Basic CRUD (groups, things) │
265
+ │ ⚠️ Missing: HTTP API │
266
+ │ ⚠️ Missing: RAG/AI │
267
+ └────────────┬─────────────────────┘
268
+ │
269
+ ↓
270
+ ┌──────────────────────────────────┐
271
+ │ CONVEX DATABASE (Complete) │
272
+ │ ✅ 6-dimension ontology schema │
273
+ │ ✅ All tables with indexes │
274
+ │ ⚠️ Missing: apiKeys table │
275
+ └──────────────────────────────────┘
276
+ ```
277
+
278
+ **Gap:** Frontend currently uses Convex hooks directly. Need HTTP API for:
279
+ - External clients (mobile, desktop, CLI)
280
+ - Third-party integrations
281
+ - Easier client library generation
282
+
283
+ ---
284
+
285
+ ## Next Priority: What to Build First
286
+
287
+ ### Phase 1: HTTP API Layer (Weeks 1-2)
288
+
289
+ **Goal:** Make backend accessible via REST API
290
+
291
+ **Steps:**
292
+ 1. Install Hono: `npm install hono`
293
+ 2. Create `http.ts` with Hono app
294
+ 3. Add API key authentication
295
+ 4. Implement `/api/health` endpoint
296
+ 5. Add rate limiting middleware
297
+ 6. Set up CORS
298
+
299
+ **Deliverable:** External clients can call `/api/health`
300
+
301
+ ### Phase 2: API Key Management (Week 3)
302
+
303
+ **Goal:** Enable API key-based authentication
304
+
305
+ **Steps:**
306
+ 1. Add `apiKeys` table to schema
307
+ 2. Create `createApiKey` mutation
308
+ 3. Create `verifyApiKey` query
309
+ 4. Add API key middleware
310
+ 5. Test with curl/Postman
311
+
312
+ **Deliverable:** Can generate and use API keys
313
+
314
+ ### Phase 3: CRUD Endpoints (Weeks 4-5)
315
+
316
+ **Goal:** All 6 dimensions accessible via REST
317
+
318
+ **Steps:**
319
+ 1. Implement 37 REST endpoints
320
+ 2. Add input validation
321
+ 3. Add error handling
322
+ 4. Add pagination
323
+ 5. Add filtering/sorting
324
+
325
+ **Deliverable:** Full REST API for all ontology dimensions
326
+
327
+ ### Phase 4: AI SDK Integration (Weeks 6-7)
328
+
329
+ **Goal:** RAG pipeline working
330
+
331
+ **Steps:**
332
+ 1. Install AI SDK
333
+ 2. Implement ingestion (chunking)
334
+ 3. Add embeddings
335
+ 4. Add vector search
336
+ 5. Add generation with context
337
+
338
+ **Deliverable:** `/api/ai/search` and `/api/ai/generate` working
339
+
340
+ ### Phase 5: Production Hardening (Week 8)
341
+
342
+ **Goal:** Production-ready backend
343
+
344
+ **Steps:**
345
+ 1. Use bcrypt for passwords
346
+ 2. Add input validation
347
+ 3. Tune rate limits
348
+ 4. Set up monitoring
349
+ 5. Security audit
350
+
351
+ **Deliverable:** Backend ready for production deployment
352
+
353
+ ---
354
+
355
+ ## Code Quality Assessment
356
+
357
+ ### ✅ What's Good
358
+
359
+ 1. **Schema Design** - Clean, normalized, well-indexed
360
+ 2. **Type Safety** - Full TypeScript with Convex types
361
+ 3. **Error Handling** - Rate limiting, duplicate checking
362
+ 4. **Testing** - 50+ auth tests with good coverage
363
+ 5. **Documentation** - Schema well-commented
364
+ 6. **Multi-tenancy Foundation** - Groups table ready
365
+
366
+ ### ⚠️ What Needs Improvement
367
+
368
+ 1. **Password Hashing** - SHA-256 demo → needs bcrypt
369
+ 2. **Event Logging** - Not auto-logged on mutations
370
+ 3. **Input Validation** - Minimal validation
371
+ 4. **Error Messages** - Generic error handling
372
+ 5. **API Documentation** - No OpenAPI spec
373
+ 6. **Tests** - Only auth tested, need full coverage
374
+
375
+ ---
376
+
377
+ ## Commands to Get Started
378
+
379
+ ### Install Dependencies
380
+
381
+ ```bash
382
+ cd backend
383
+ npm install hono @ai-sdk/openai ai bcryptjs zod
384
+ ```
385
+
386
+ ### Create HTTP Layer
387
+
388
+ ```typescript
389
+ // /backend/convex/http.ts
390
+ import { Hono } from "hono";
391
+ import { cors } from "hono/cors";
392
+ import { handle } from "hono/vercel";
393
+ import { httpRouter } from "convex/server";
394
+
395
+ const app = new Hono();
396
+ app.use("*", cors());
397
+
398
+ app.get("/api/health", (c) => {
399
+ return c.json({ status: "ok" });
400
+ });
401
+
402
+ export default httpRouter({
403
+ "/": handle(app),
404
+ });
405
+ ```
406
+
407
+ ### Test It
408
+
409
+ ```bash
410
+ # Start dev server
411
+ npx convex dev
412
+
413
+ # Test endpoint
414
+ curl http://localhost:3000/api/health
415
+ # Should return: {"status":"ok"}
416
+ ```
417
+
418
+ ---
419
+
420
+ ## Key Files to Reference
421
+
422
+ **Frontend Auth:**
423
+ - `/web/src/lib/auth-client.ts` - Auth setup
424
+ - `/web/src/pages/account/auth.astro` - Auth page
425
+ - `/web/tests/auth/auth.test.ts` - Test examples
426
+
427
+ **Backend Auth:**
428
+ - `/backend/convex/auth.ts` - Auth mutations
429
+ - `/backend/convex/auth.config.ts` - Auth config
430
+ - `/backend/convex/lib/jwt.ts` - JWT utilities
431
+
432
+ **Schema:**
433
+ - `/backend/convex/schema.ts` - Complete 6-dimension schema
434
+ - `/backend/convex/types/ontology.ts` - Generated types
435
+
436
+ **CRUD Examples:**
437
+ - `/backend/convex/mutations/entities.ts` - Example mutations
438
+ - `/backend/convex/queries/entities.ts` - Example queries
439
+
440
+ ---
441
+
442
+ ## Team Assignments (Inference-Based)
443
+
444
+ **Phase 1 (HTTP API): Infer 101-120 (3 weeks)**
445
+ - Agent-backend: Implement Hono routes
446
+ - Agent-backend: Add middleware
447
+ - Agent-quality: Write API tests
448
+
449
+ **Phase 2 (API Keys): Infer 121-140 (2 weeks)**
450
+ - Agent-backend: Schema + mutations
451
+ - Agent-frontend: Generate API key UI
452
+ - Agent-quality: Security testing
453
+
454
+ **Phase 3 (CRUD): Infer 141-160 (2 weeks)**
455
+ - Agent-backend: Implement endpoints
456
+ - Agent-integrator: Generate OpenAPI
457
+ - Agent-quality: Integration tests
458
+
459
+ **Phase 4 (AI SDK): Infer 161-180 (2 weeks)**
460
+ - Agent-backend: RAG pipeline
461
+ - Agent-quality: RAG tests
462
+ - Agent-documenter: API docs
463
+
464
+ **Phase 5 (Production): Infer 181-200 (1 week)**
465
+ - Agent-ops: Monitoring setup
466
+ - Agent-clean: Code review
467
+ - Agent-documenter: Final docs
468
+
469
+ ---
470
+
471
+ ## Success Metrics
472
+
473
+ After Phase 1 (HTTP API):
474
+ - ✅ `/api/health` returns 200
475
+ - ✅ External clients can query backend
476
+ - ✅ Rate limiting working
477
+
478
+ After Phase 2 (API Keys):
479
+ - ✅ Can generate API key
480
+ - ✅ API key authentication working
481
+ - ✅ Group-scoped requests
482
+
483
+ After Phase 3 (CRUD):
484
+ - ✅ All 37 REST endpoints working
485
+ - ✅ Input validation passing
486
+ - ✅ Error handling consistent
487
+
488
+ After Phase 4 (AI SDK):
489
+ - ✅ Vector search working
490
+ - ✅ Generation with context working
491
+ - ✅ Streaming responses working
492
+
493
+ After Phase 5 (Production):
494
+ - ✅ bcrypt passwords
495
+ - ✅ All tests passing
496
+ - ✅ OpenAPI documentation
497
+ - ✅ Monitoring alerts working
498
+
499
+ ---
500
+
501
+ ## Related Documentation
502
+
503
+ - **`one/things/plans/backend.md`** - Complete backend architecture plan
504
+ - **`one/knowledge/ontology.md`** - 6-dimension specification
505
+ - **`CLAUDE.md`** - Development workflow
506
+ - **`web/AGENTS.md`** - Convex patterns reference
507
+
508
+ ---
509
+
510
+ ## What's Working Right Now
511
+
512
+ You can immediately:
513
+
514
+ 1. ✅ Sign up with email/password (frontend)
515
+ 2. ✅ Sign in with OAuth (Google, GitHub)
516
+ 3. ✅ Stay logged in (JWT tokens)
517
+ 4. ✅ Create/update/delete entities (via Convex hooks)
518
+ 5. ✅ Create/manage groups
519
+ 6. ✅ View connections and events
520
+
521
+ What's NOT working yet:
522
+
523
+ 1. ❌ External API access (HTTP)
524
+ 2. ❌ API key authentication
525
+ 3. ❌ AI/RAG features
526
+ 4. ❌ Third-party integrations
527
+ 5. ❌ Mobile apps (no HTTP API)
528
+
529
+ ---
530
+
531
+ ## Bottom Line
532
+
533
+ **The foundation is solid.** Backend auth is working, schema is complete, frontend integration is done. The main gaps are:
534
+
535
+ 1. **HTTP API** - Make it accessible externally
536
+ 2. **AI SDK** - Add RAG/generation features
537
+ 3. **Production Hardening** - bcrypt, validation, monitoring
538
+
539
+ Everything else is in place. Build the HTTP layer first (1-2 weeks), then everything else follows naturally.
540
+
541
+ **Status:** 🟢 Ready to build Phase 1 (HTTP API)