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,1302 @@
1
+ # Complete Step-by-Step Build Plan: ONE Platform (REVISED)
2
+
3
+ **Version:** 3.0.0 - Agent-Parallel Execution
4
+ **Created:** 2025-10-24
5
+ **Philosophy:** Safe → Quick → Accurate (build on solid foundation with parallel agents)
6
+ **Architecture:** Completely separate backend (multi-tenant) and frontend
7
+ **Status:** Foundation 90% complete, refining with parallel agent coordination
8
+ **Execution Model:** Agent-Director orchestrates parallel specialist agents
9
+
10
+ **Using Convex Components:**
11
+ - `@convex-dev/agent` - AI agents with threading
12
+ - `@convex-dev/rag` - Retrieval-augmented generation
13
+ - `@convex-dev/rate-limiter` - Per-user/org rate limiting
14
+ - `@convex-dev/workflow` - Durable workflows with retries
15
+ - `@convex-dev/persistent-text-streaming` - Real-time streaming
16
+ - `@convex-dev/workpool` - Task queuing and parallelism
17
+ - `@convex-dev/retrier` - Robust error recovery
18
+
19
+ **Reference:** `/Users/toc/Server/ONE/one/things/components.md` - Complete integration guide
20
+
21
+ ---
22
+
23
+ ## 🤖 AGENT-DIRECTOR ORCHESTRATION MODEL
24
+
25
+ **WHO DOES THE WORK:**
26
+
27
+ This plan is executed by the agent network, coordinated by **agent-director**:
28
+
29
+ ```
30
+ ┌─────────────────────────────────────────────────────────────────┐
31
+ │ agent-director (Orchestrator) │
32
+ │ ├─ Validates plan against 6-dimension ontology │
33
+ │ ├─ Assigns features to specialist agents │
34
+ │ ├─ Monitors for completion events │
35
+ │ ├─ Detects blockers and delegates to problem-solver │
36
+ │ └─ Marks complete and advances to next phase │
37
+ └─────────────────────────────────────────────────────────────────┘
38
+ ↓ ↓
39
+ ┌────────────────────────┐ ┌─────────────────────────┐
40
+ │ agent-backend │ │ agent-frontend │
41
+ │ ├─ Schema design │ │ ├─ Page components │
42
+ │ ├─ CRUD mutations │ │ ├─ React islands │
43
+ │ ├─ Query optimization │ │ ├─ Tailwind styling │
44
+ │ └─ Effect.ts services │ │ └─ Performance tuning │
45
+ └────────────────────────┘ └─────────────────────────┘
46
+ ↓ ↓
47
+ ┌────────────────────────┐ ┌─────────────────────────┐
48
+ │ agent-quality │ │ agent-ops │
49
+ │ ├─ Test definitions │ │ ├─ Deployment setup │
50
+ │ ├─ Acceptance criteria│ │ ├─ CI/CD pipelines │
51
+ │ ├─ Validation runs │ │ ├─ Monitoring │
52
+ │ └─ Insight generation │ │ └─ Release automation │
53
+ └────────────────────────┘ └─────────────────────────┘
54
+ ↓ ↓
55
+ ┌────────────────────────┐ ┌─────────────────────────┐
56
+ │ agent-documenter │ │ agent-problem-solver │
57
+ │ ├─ API docs │ │ ├─ Root cause analysis │
58
+ │ ├─ Integration guides │ │ ├─ Solution proposals │
59
+ │ ├─ Architecture docs │ │ ├─ Test verification │
60
+ │ └─ Knowledge updates │ │ └─ Lessons captured │
61
+ └────────────────────────┘ └─────────────────────────┘
62
+ ```
63
+
64
+ **HOW IT WORKS:**
65
+
66
+ 1. **agent-director** reads this plan and validates it against ontology
67
+ 2. For **Phase 1 (Backend):**
68
+ - agent-director emits `feature_assigned` event for backend tasks
69
+ - **agent-backend** begins implementation
70
+ - **agent-quality** simultaneously defines tests (no blocking dependency)
71
+ - agent-backend and agent-quality work in parallel
72
+ - When implementation done: agent-quality validates
73
+ - If tests fail: agent-problem-solver investigates
74
+ - If tests pass: agent-documenter writes docs
75
+ - agent-director marks phase complete
76
+
77
+ 3. For **Phase 4 (Features):**
78
+ - agent-director breaks feature into sub-tasks (backend, frontend, integration)
79
+ - **agent-backend**, **agent-frontend**, **agent-integrator** work in parallel
80
+ - Each specialist emits `implementation_complete` when done
81
+ - **agent-quality** runs tests for each component
82
+ - **agent-designer** creates UI specs driven by test requirements
83
+ - All specialists implement to pass tests
84
+ - agent-director waits for all to complete
85
+
86
+ 4. **Failure Recovery:**
87
+ - If any specialist fails: emit `test_failed` event
88
+ - **agent-problem-solver** analyzes failure
89
+ - Problem solver proposes fix with `solution_proposed` event
90
+ - Original specialist implements fix
91
+ - Quality re-validates
92
+ - Pipeline continues
93
+
94
+ ---
95
+
96
+ ## ⚡ PARALLEL EXECUTION STRATEGY
97
+
98
+ **THE GOAL:** 5x faster delivery by eliminating sequential wait times
99
+
100
+ **CURRENT BOTTLENECKS (Sequential):**
101
+ ```
102
+ Phase 1: Backend implementation (10-12 hrs)
103
+ → Wait for backend done
104
+ → Phase 1 QA: Testing (3 hrs)
105
+ → Wait for tests pass
106
+ → Phase 2: Frontend implementation (8-10 hrs)
107
+ Total Sequential: 21-25 hours ❌
108
+ ```
109
+
110
+ **NEW APPROACH (Parallel):**
111
+ ```
112
+ Phase 1a: Backend coding + Phase 1b: Test definition (simultaneous)
113
+ 10-12 hrs (backend) \
114
+ → Parallel execution
115
+ 3 hrs (test def) /
116
+
117
+ Phase 1c: Implementation validation (3 hrs)
118
+ Test backend against defined criteria
119
+
120
+ Phase 2a: Frontend coding + Phase 2b: Integration spec (simultaneous)
121
+ 8-10 hrs (frontend) \
122
+ → Parallel execution
123
+ 2 hrs (integration) /
124
+
125
+ Result: ~18 hours total (vs. 25 sequential) = 28% time savings ✅
126
+ ```
127
+
128
+ **WHICH PHASES CAN RUN IN PARALLEL:**
129
+
130
+ ✅ **Can Parallelize (Independent):**
131
+ - Backend CRUD + Test definition (tests don't depend on implementation)
132
+ - Backend code + Frontend code (different codebases)
133
+ - Documentation + Quality checks (separate concerns)
134
+
135
+ ❌ **Must Wait (Dependencies):**
136
+ - Backend implementation MUST complete before integration tests
137
+ - Schema design MUST complete before tests are written (defines what to test)
138
+ - Quality approval MUST complete before documenter finalizes
139
+
140
+ **PARALLEL PHASE EXECUTION PLAN:**
141
+
142
+ ```yaml
143
+ Phase 1 - Backend Foundation (Week 1-2):
144
+ agent-backend:
145
+ - Implement Groups CRUD (2h)
146
+ - Implement Things CRUD (2h)
147
+ - Implement Connections CRUD (1.5h)
148
+ - Implement Events queries (1.5h)
149
+ - Implement Knowledge queries (1h)
150
+ - Effect.ts service layer (2h)
151
+ - Test coverage: Aim for 80%+
152
+ Parallel with:
153
+
154
+ agent-quality:
155
+ - Define user flows for Groups (1h)
156
+ - Define acceptance criteria (1.5h)
157
+ - Create test suite templates (1h)
158
+ - Coverage analysis prep (0.5h)
159
+ Parallel with:
160
+
161
+ agent-documenter (optional):
162
+ - Draft schema documentation (1h)
163
+ - API endpoint reference (1h)
164
+ - Integration examples (1h)
165
+
166
+ Phase 2 - Integration Layer (Week 2):
167
+ agent-integrator:
168
+ - Design API gateway (optional 1h)
169
+ - Create integration specs (1h)
170
+ Parallel with:
171
+
172
+ agent-backend (continued):
173
+ - Implement remaining CRUD (2h)
174
+ - Fix issues from Phase 1 QA
175
+
176
+ Phase 3 - Full System Test (Week 3):
177
+ agent-quality:
178
+ - Run comprehensive test suite (1h)
179
+ - Performance benchmarking (1h)
180
+ - Coverage reports (0.5h)
181
+ agent-ops:
182
+ - Prepare staging deployment (1h)
183
+ - Set up monitoring (0.5h)
184
+
185
+ Phase 4 - Feature Development (Week 4+):
186
+ For each feature (e.g., Blog):
187
+ agent-backend (1-2 days):
188
+ - Implement blog schema
189
+ - Create blog mutations/queries
190
+ - Effect.ts blog service
191
+
192
+ agent-frontend (1-2 days, starts after backend schema):
193
+ - Create blog components
194
+ - Blog listing pages
195
+ - Blog detail pages
196
+
197
+ agent-integrator (1 day, parallel with above):
198
+ - Design blog API
199
+ - Create integration tests
200
+
201
+ agent-quality (continuous):
202
+ - Define blog user flows
203
+ - Create acceptance criteria
204
+ - Run tests as components complete
205
+
206
+ agent-designer (1 day, driven by test requirements):
207
+ - Create wireframes
208
+ - Design system components
209
+ - Accessibility audit
210
+
211
+ Result: Feature done in 4-5 days (vs. 7+ sequential)
212
+
213
+ Phase 5 - Deployment (Week 5+):
214
+ agent-ops:
215
+ - Create deployment pipeline (2-3h)
216
+ - Staging deployment (1h)
217
+ - Production release (1h)
218
+ - Monitoring setup (1h)
219
+ ```
220
+
221
+ ---
222
+
223
+ ## 📊 AGENT ASSIGNMENTS & RESPONSIBILITIES
224
+
225
+ ### Per-Phase Assignments:
226
+
227
+ | Phase | Primary Agent | Secondary Agents | Duration | Dependencies |
228
+ |-------|---------------|-----------------|----------|--------------|
229
+ | 1a: Backend Code | agent-backend | agent-quality (tests) | 10-12h | None |
230
+ | 1b: Test Definition | agent-quality | agent-backend (schema) | 3h | Schema done |
231
+ | 1c: Validation | agent-quality | agent-backend (fixes) | 2-3h | 1a + 1b done |
232
+ | 2a: Integration | agent-integrator | agent-backend | 2h | Phase 1 done |
233
+ | 2b: HTTP Layer | agent-backend | agent-integrator | 2h | Phase 1 done |
234
+ | 3: System Test | agent-quality | agent-ops | 3h | Phase 2 done |
235
+ | 4a: Feature Backend | agent-backend | agent-quality | 2-3d | Feature spec |
236
+ | 4b: Feature Frontend | agent-frontend | agent-quality | 2-3d | Schema done |
237
+ | 4c: Feature Integration | agent-integrator | agent-quality | 1-2d | Schema done |
238
+ | 5a: Deploy Staging | agent-ops | agent-quality | 1h | Phase 4 done |
239
+ | 5b: Deploy Prod | agent-ops | agent-quality | 1h | Staging pass |
240
+ | Docs & Knowledge | agent-documenter | agent-quality | 1h/phase | Phase done |
241
+
242
+ ### Coordinator (Always agent-director):
243
+ - Validates plan against 6-dimension ontology ✅
244
+ - Emits feature assignments ✅
245
+ - Monitors for blocking issues ✅
246
+ - Delegates to problem-solver on failures ✅
247
+ - Marks features complete ✅
248
+ - Advances to next phase ✅
249
+
250
+ ---
251
+
252
+ ## 🎯 AGENT SKILL IMPROVEMENTS NEEDED
253
+
254
+ To execute this plan optimally, update agents as follows:
255
+
256
+ ### agent-director
257
+ **Current:** Validates ideas, creates plans, assigns features
258
+ **Needed:**
259
+ - Add `parallelExecutionOrchestration()` method to manage concurrent phases
260
+ - Add `dependencyResolution()` to identify which tasks can run in parallel
261
+ - Add `blockageDetection()` to identify stuck tasks waiting for dependencies
262
+ - Add `eventMonitoring()` to watch for `implementation_complete` from all agents
263
+ - Add `progressTracking()` to display real-time parallel execution status
264
+ - Enhance `featureAssignment()` to batch-assign multiple features to multiple agents simultaneously
265
+
266
+ **Implementation:**
267
+ ```typescript
268
+ // In agent-director prompts:
269
+ "You manage parallel execution across 5-8 agents simultaneously.
270
+ When assigning Phase 1 tasks:
271
+ 1. Assign backend code to agent-backend
272
+ 2. SIMULTANEOUSLY assign test definition to agent-quality
273
+ 3. Monitor BOTH for completion events
274
+ 4. Wait for both to complete before validation
275
+ 5. Track overall progress as: Parallel(backend_code, test_def) → validation
276
+ 6. Display progress: 'Backend: 8/10 hrs | Quality: 2/3 hrs | ETA: 2h'"
277
+ ```
278
+
279
+ ### agent-backend
280
+ **Current:** Implements mutations, queries, schema, Effect.ts
281
+ **Needed:**
282
+ - Add `parallelCRUDImplementation()` to parallelize Groups/Things/Connections implementation
283
+ - Add `dependencyTracker()` to know which services are ready for Effect.ts wrapping
284
+ - Add `testReadiness()` to emit `schema_ready` event when schema complete (so quality can start)
285
+ - Add `progressEmission()` to emit hourly updates of which services are complete
286
+ - Add `blockageHandling()` to detect when waiting on quality feedback
287
+
288
+ **Implementation:**
289
+ ```typescript
290
+ // In agent-backend prompts:
291
+ "Emit events to keep agent-quality informed:
292
+ - When schema complete: emit 'schema_ready' event
293
+ - Every hour: emit 'progress_update' with completed_services: ['groups', 'things', ...]
294
+ - When mutation done: emit 'mutation_complete' with mutation_name
295
+ - If stuck: emit 'blocked_waiting_for' with blocker_name"
296
+ ```
297
+
298
+ ### agent-frontend
299
+ **Current:** Implements components, pages, styling, performance
300
+ **Needed:**
301
+ - Add `waitForSchemaEvent()` to not start until backend emits `schema_ready`
302
+ - Add `parallelComponentDevelopment()` to code multiple pages simultaneously
303
+ - Add `designSystemAlignment()` to wait for agent-designer's component specs
304
+ - Add `progressTracking()` to emit component completion events
305
+ - Add `performanceBudgeting()` to measure Core Web Vitals during development
306
+
307
+ **Implementation:**
308
+ ```typescript
309
+ // In agent-frontend prompts:
310
+ "Watch for these events to proceed:
311
+ - 'schema_ready' → Begin component development (can't start before)
312
+ - 'test_definitions_complete' → Understand test requirements
313
+ - 'wireframes_complete' → Have design guidance
314
+ - After each component done: emit 'component_complete' event"
315
+ ```
316
+
317
+ ### agent-quality
318
+ **Current:** Defines tests, validates implementations, generates insights
319
+ **Needed:**
320
+ - Add `parallelTestDefinition()` to define tests for multiple dimensions (Groups, Things, Connections, Events, Knowledge) simultaneously
321
+ - Add `schemaAwarenessWaiting()` to emit `ready_to_define` when schema structure known
322
+ - Add `continuousValidation()` to validate components as they complete (not waiting for all)
323
+ - Add `parallelTestExecution()` to run unit, integration, e2e tests concurrently
324
+ - Add `blockageRecovery()` to handle test failures by emitting `test_failed` for problem-solver
325
+
326
+ **Implementation:**
327
+ ```typescript
328
+ // In agent-quality prompts:
329
+ "Enable parallel test development:
330
+ - Watch for 'schema_ready' event from agent-backend
331
+ - THEN define tests for Groups, Things, Connections, Events, Knowledge in parallel
332
+ - For each, emit 'tests_ready_for_X' event
333
+ - As backend components complete, emit 'validation_passed_for_X'
334
+ - If tests fail: emit 'test_failed' with detailed failure reason
335
+ - Agent-problem-solver monitors test_failed events"
336
+ ```
337
+
338
+ ### agent-designer
339
+ **Current:** Creates wireframes, component specs, design tokens
340
+ **Needed:**
341
+ - Add `testDrivenDesign()` to use agent-quality's test requirements to guide design
342
+ - Add `parallelComponentDesign()` to design multiple components simultaneously
343
+ - Add `accessibilityFirstDesign()` to ensure WCAG 2.1 AA from start (not retrofit)
344
+ - Add `readyStateTracking()` to emit `design_spec_complete_for_X` for each component
345
+ - Add `performanceConsiderations()` to design for Core Web Vitals (LCP < 2.5s)
346
+
347
+ **Implementation:**
348
+ ```typescript
349
+ // In agent-designer prompts:
350
+ "Design components driven by test requirements:
351
+ - Read test user flows from agent-quality
352
+ - For each component: emit 'design_spec_complete_for_X'
353
+ - Ensure all designs meet WCAG 2.1 AA standards
354
+ - Consider image sizes, lazy loading, critical CSS for performance
355
+ - Provide design tokens that agent-frontend can directly implement"
356
+ ```
357
+
358
+ ### agent-ops
359
+ **Current:** Handles deployment, CI/CD, monitoring, releases
360
+ **Needed:**
361
+ - Add `deploymentPipelineSetup()` to prepare staging/production pipelines early
362
+ - Add `releaseAutomation()` to automate version bumping, changelog generation
363
+ - Add `productionReadiness()` to validate all quality gates before production deploy
364
+ - Add `postDeploymentMonitoring()` to track metrics after each release
365
+ - Add `incidentResponse()` to handle failures in production quickly
366
+
367
+ **Implementation:**
368
+ ```typescript
369
+ // In agent-ops prompts:
370
+ "Prepare deployment infrastructure early:
371
+ - During Phase 1: Set up staging environment
372
+ - During Phase 2: Test deployment pipeline with dummy app
373
+ - During Phase 3: Run full system test on staging
374
+ - Before Phase 4: Validate all quality gates
375
+ - Each release: Run sanity checks on production
376
+ - Monitor: Lighthouse scores, API latency, error rates, user retention"
377
+ ```
378
+
379
+ ### agent-documenter
380
+ **Current:** Writes documentation, updates knowledge base
381
+ **Needed:**
382
+ - Add `parallelDocumentation()` to write different docs simultaneously (API, integration, architecture)
383
+ - Add `knowledgeBaseUpdates()` to automatically extract lessons learned from test results
384
+ - Add `semanticSearchOptimization()` to use knowledge embeddings for discovery
385
+ - Add `useCaseDocumentation()` to document real customer workflows
386
+ - Add `lessonsCapture()` to automatically capture and store insights
387
+
388
+ **Implementation:**
389
+ ```typescript
390
+ // In agent-documenter prompts:
391
+ "Document each completed phase:
392
+ - As agent-backend completes: Write API docs + schema docs
393
+ - As agent-frontend completes: Write component usage guide
394
+ - As agent-quality runs tests: Capture test patterns as lessons learned
395
+ - Store in /one/knowledge/ with appropriate labels for semantic search
396
+ - Generate README sections from architecture insights"
397
+ ```
398
+
399
+ ### agent-problem-solver
400
+ **Current:** Analyzes failures, proposes solutions
401
+ **Needed:**
402
+ - Add `continuousMonitoring()` to watch `test_failed` events from all agents
403
+ - Add `rootCauseAnalysisAutomation()` to automatically categorize failures
404
+ - Add `solutionProposalSpeed()` to propose fixes within 10 minutes of failure
405
+ - Add `fixVerification()` to re-run tests after fix to confirm resolution
406
+ - Add `failurePatternDetection()` to identify recurring issues early
407
+
408
+ **Implementation:**
409
+ ```typescript
410
+ // In agent-problem-solver prompts:
411
+ "Monitor all test_failed events continuously:
412
+ - When received: Immediately analyze root cause
413
+ - Categorize: Ontology violation | Logic error | Performance | Accessibility
414
+ - Propose fix with specific code changes
415
+ - Emit 'solution_proposed' event with fix details
416
+ - Original specialist implements fix
417
+ - You re-run tests to verify
418
+ - If pass: Emit 'fix_complete' + capture lesson learned"
419
+ ```
420
+
421
+ ---
422
+
423
+ ## ✅ What's ALREADY DONE
424
+
425
+ **Frontend (COMPLETE):**
426
+ - ✅ Astro 5 + React 19 with SSR on Cloudflare
427
+ - ✅ shadcn/ui (50+ components pre-installed)
428
+ - ✅ Tailwind CSS v4 with dark mode
429
+ - ✅ Better Auth UI (signup, signin, password reset, magic links, email verification, 2FA)
430
+ - ✅ DataProvider pattern (works with ANY backend)
431
+ - ✅ Complete hooks (useThings, useConnections, useEvents, useKnowledge, useGroups, usePeople)
432
+ - ✅ Dashboard, ecommerce templates, blog system
433
+ - ✅ Stripe payment integration
434
+
435
+ **Backend (MOSTLY COMPLETE):**
436
+ - ✅ Convex schema (6-dimension ontology)
437
+ - ✅ Better Auth (6 auth methods fully working)
438
+ - ✅ Query/mutation stubs
439
+ - ✅ Service layer structure
440
+
441
+ **Testing (DONE):**
442
+ - ✅ 50+ auth tests (all 6 methods)
443
+ - ✅ Provider tests
444
+ - ✅ Integration tests
445
+
446
+ **Documentation (EXCELLENT):**
447
+ - ✅ CLAUDE.md (2,500+ lines, comprehensive guidance)
448
+ - ✅ AGENTS.md (Convex patterns)
449
+ - ✅ /one/ directory (41 files, 8 layers)
450
+
451
+ ---
452
+
453
+ ## 🎯 What We're Doing Now
454
+
455
+ **Don't rebuild what's done. Polish what's started.**
456
+
457
+ ```
458
+ Phase 1: POLISH FOUNDATION (3 days)
459
+ └─ Implement Quick Wins to solidify what exists
460
+ ↓
461
+ Phase 2: COMPLETE BACKEND (1-2 weeks)
462
+ └─ Implement all CRUD endpoints that are stubbed
463
+ └─ Connect to frontend that's waiting
464
+ ↓
465
+ Phase 3: FULL SYSTEM TEST (1 week)
466
+ └─ Entire stack: frontend → backend → database → frontend
467
+ ↓
468
+ Phase 4: BUILD FEATURES ONE AT A TIME (2-3 weeks per feature)
469
+ └─ Blog, Portfolio, Courses, Tokens, etc.
470
+ ↓
471
+ Phase 5: DEPLOYMENT (1 week)
472
+ └─ Staging → Production
473
+
474
+ Total: 4-6 weeks to production with SOLID foundation
475
+ ```
476
+
477
+ ---
478
+
479
+ ## 🚀 IMMEDIATE: THIS WEEK (Quick Wins)
480
+
481
+ **Goal:** Polish existing foundation and unblock Phase 2
482
+
483
+ **Do the 10 Quick Wins from quick-wins.md (pick top 5 for now):**
484
+
485
+ 1. ✅ **Error Taxonomy** - All errors are typed
486
+ 2. ✅ **Type Safety Audit** - Zero `any` except properties
487
+ 3. ✅ **Service Documentation** - Services documented with examples
488
+ 4. ✅ **Pre-commit Hooks** - Type check + lint before commit
489
+ 5. ✅ **Performance Baselines** - Know what to optimize
490
+
491
+ **These 5 quick wins:**
492
+ - Take ~2 hours each = 10 hours total
493
+ - Unblock everything else
494
+ - Make code generation 50% more accurate
495
+ - Give team confidence the foundation is solid
496
+
497
+ ---
498
+
499
+ ## 📋 PHASE 1: COMPLETE BACKEND WITH CONVEX COMPONENTS (Week 1-2)
500
+
501
+ **Status:** Using Convex components for production AI agents
502
+ **Owner:** agent-backend
503
+ **Time:** 10-12 hours total
504
+ **Components:** Agent, RAG, Rate Limiter, Workflow, Retrier, Workpool, Streaming
505
+
506
+ ### What's Already in Place:
507
+ - ✅ Schema with all 6 tables defined
508
+ - ✅ Query/mutation stubs
509
+ - ✅ Service structure
510
+ - ✅ Better Auth fully configured
511
+
512
+ ### Component-Based Architecture:
513
+
514
+ ```
515
+ backend/convex/
516
+ ├── schema.ts # 6-dimension ontology
517
+ ├── services/
518
+ │ ├── agent.service.ts # @convex-dev/agent wrapper with Effect
519
+ │ ├── rag.service.ts # @convex-dev/rag for semantic search
520
+ │ ├── rate-limit.service.ts # @convex-dev/rate-limiter wrapper
521
+ │ ├── workflow.service.ts # @convex-dev/workflow for durable jobs
522
+ │ ├── streaming.service.ts # @convex-dev/persistent-text-streaming
523
+ │ ├── workpool.service.ts # @convex-dev/workpool for task queuing
524
+ │ └── layers.ts # Effect.ts Layer composition
525
+ ├── domain/
526
+ │ ├── errors.ts # Tagged Error types
527
+ │ ├── types.ts # Domain types
528
+ │ └── business-logic.ts # Pure Effect.ts logic
529
+ └── api/
530
+ ├── things.ts # Thing CRUD + filtering
531
+ ├── connections.ts # Connection CRUD
532
+ ├── events.ts # Event logging
533
+ ├── groups.ts # Group management
534
+ ├── people.ts # People/authorization
535
+ ├── knowledge.ts # Knowledge search/embeddings
536
+ ├── agents.ts # AI agent endpoints
537
+ └── workflows.ts # Workflow triggers
538
+ ```
539
+
540
+ ### Why This Architecture:
541
+
542
+ **Convex Components handle:**
543
+ - Agent thread management & streaming
544
+ - Vector search for RAG
545
+ - Rate limiting (per-user, per-org)
546
+ - Durable workflows with retries
547
+ - Long-running task queues
548
+ - Real-time persistent streaming
549
+
550
+ **Effect.ts wraps them for:**
551
+ - Type-safe error handling
552
+ - Service composition
553
+ - Dependency injection
554
+ - Testability
555
+ - Business logic orchestration
556
+
557
+ ### Step 1.1: Implement Groups Queries & Mutations
558
+ **Time:** 2 hours
559
+ **Deliverable:** Full CRUD for groups
560
+
561
+ ```typescript
562
+ // backend/convex/queries/groups.ts - Complete this
563
+
564
+ export const get = query({
565
+ args: { id: v.id("groups") },
566
+ handler: async (ctx, args) => {
567
+ return await ctx.db.get(args.id)
568
+ }
569
+ })
570
+
571
+ export const list = query({
572
+ handler: async (ctx) => {
573
+ return await ctx.db.query("groups").collect()
574
+ }
575
+ })
576
+
577
+ // backend/convex/mutations/groups.ts - Complete this
578
+
579
+ export const create = mutation({
580
+ args: {
581
+ name: v.string(),
582
+ type: v.union(
583
+ v.literal("friend_circle"),
584
+ v.literal("business"),
585
+ v.literal("organization"),
586
+ // ... other group types
587
+ ),
588
+ parentGroupId: v.optional(v.id("groups")),
589
+ },
590
+ handler: async (ctx, args) => {
591
+ // Create group with all properties
592
+ const id = await ctx.db.insert("groups", {
593
+ name: args.name,
594
+ type: args.type,
595
+ parentGroupId: args.parentGroupId,
596
+ status: "active",
597
+ createdAt: Date.now(),
598
+ updatedAt: Date.now(),
599
+ })
600
+ // Log creation event
601
+ await ctx.db.insert("events", {
602
+ groupId: id,
603
+ type: "group_created",
604
+ actorId: ctx.auth?.getUserIdentity()?.tokenIdentifier,
605
+ targetId: id,
606
+ timestamp: Date.now(),
607
+ })
608
+ return id
609
+ }
610
+ })
611
+ ```
612
+
613
+ **Check:**
614
+ - [ ] Query returns correct group
615
+ - [ ] Mutation creates with all fields
616
+ - [ ] Events logged
617
+ - [ ] Tests pass
618
+
619
+ ---
620
+
621
+ ### Step 1.2: Implement Things Queries & Mutations
622
+ **Time:** 2 hours
623
+ **Deliverable:** Full CRUD for things with filtering and pagination (Ontology Dimension 3)
624
+
625
+ ```typescript
626
+ // backend/convex/queries/things.ts - Complete this
627
+
628
+ export const list = query({
629
+ args: {
630
+ groupId: v.id("groups"),
631
+ type: v.optional(v.string()),
632
+ status: v.optional(v.string()),
633
+ limit: v.optional(v.number()),
634
+ },
635
+ handler: async (ctx, args) => {
636
+ let query = ctx.db.query("entities")
637
+ .withIndex("group_type", q => q.eq("groupId", args.groupId))
638
+
639
+ if (args.type) query = query.filter(q => q.eq(q.field("type"), args.type))
640
+ if (args.status) query = query.filter(q => q.eq(q.field("status"), args.status))
641
+
642
+ return await query.take(args.limit ?? 100).collect()
643
+ }
644
+ })
645
+
646
+ export const get = query({
647
+ args: { id: v.id("entities") },
648
+ handler: async (ctx, args) => {
649
+ return await ctx.db.get(args.id)
650
+ }
651
+ })
652
+ ```
653
+
654
+ **Check:**
655
+ - [ ] List returns items
656
+ - [ ] Filtering works
657
+ - [ ] Pagination works
658
+ - [ ] Get returns single item
659
+
660
+ ---
661
+
662
+ ### Step 1.3: Implement Connections Queries & Mutations
663
+ **Time:** 1.5 hours
664
+ **Deliverable:** Query and create relationships
665
+
666
+ ```typescript
667
+ // backend/convex/queries/connections.ts - Complete this
668
+
669
+ export const list = query({
670
+ args: { groupId: v.id("groups") },
671
+ handler: async (ctx, args) => {
672
+ return await ctx.db.query("connections")
673
+ .withIndex("by_group", q => q.eq("groupId", args.groupId))
674
+ .collect()
675
+ }
676
+ })
677
+
678
+ export const fromEntity = query({
679
+ args: { entityId: v.id("entities") },
680
+ handler: async (ctx, args) => {
681
+ return await ctx.db.query("connections")
682
+ .filter(q => q.eq(q.field("fromEntityId"), args.entityId))
683
+ .collect()
684
+ }
685
+ })
686
+ ```
687
+
688
+ **Check:**
689
+ - [ ] List works
690
+ - [ ] Filtering by source works
691
+ - [ ] Bidirectional queries work
692
+
693
+ ---
694
+
695
+ ### Step 1.4: Implement Events Queries
696
+ **Time:** 1.5 hours
697
+ **Deliverable:** Query event history and timeline
698
+
699
+ ```typescript
700
+ // backend/convex/queries/events.ts - Complete this
701
+
702
+ export const list = query({
703
+ args: { groupId: v.id("groups") },
704
+ handler: async (ctx, args) => {
705
+ return await ctx.db.query("events")
706
+ .withIndex("by_group", q => q.eq("groupId", args.groupId))
707
+ .order("desc") // Most recent first
708
+ .collect()
709
+ }
710
+ })
711
+
712
+ export const byActor = query({
713
+ args: { actorId: v.id("entities") },
714
+ handler: async (ctx, args) => {
715
+ return await ctx.db.query("events")
716
+ .filter(q => q.eq(q.field("actorId"), args.actorId))
717
+ .order("desc")
718
+ .collect()
719
+ }
720
+ })
721
+ ```
722
+
723
+ **Check:**
724
+ - [ ] Timeline returns events in order
725
+ - [ ] Filtering works
726
+ - [ ] Pagination ready
727
+
728
+ ---
729
+
730
+ ### Step 1.5: Implement Knowledge Queries
731
+ **Time:** 1 hour
732
+ **Deliverable:** Query and search knowledge base
733
+
734
+ ```typescript
735
+ // backend/convex/queries/knowledge.ts - Complete this
736
+
737
+ export const list = query({
738
+ args: { groupId: v.id("groups") },
739
+ handler: async (ctx, args) => {
740
+ return await ctx.db.query("knowledge")
741
+ .withIndex("by_group", q => q.eq("groupId", args.groupId))
742
+ .collect()
743
+ }
744
+ })
745
+
746
+ export const search = query({
747
+ args: {
748
+ groupId: v.id("groups"),
749
+ query: v.string(),
750
+ limit: v.optional(v.number()),
751
+ },
752
+ handler: async (ctx, args) => {
753
+ // For now, basic text search
754
+ // Later: vector similarity search
755
+ const all = await ctx.db.query("knowledge")
756
+ .withIndex("by_group", q => q.eq("groupId", args.groupId))
757
+ .collect()
758
+
759
+ const filtered = all.filter(k =>
760
+ k.text?.toLowerCase().includes(args.query.toLowerCase())
761
+ )
762
+
763
+ return filtered.slice(0, args.limit ?? 10)
764
+ }
765
+ })
766
+ ```
767
+
768
+ **Check:**
769
+ - [ ] List works
770
+ - [ ] Search returns results
771
+ - [ ] Limit works
772
+
773
+ ---
774
+
775
+ ### Step 1.6: Effect.ts Service Layer (Core Infrastructure)
776
+
777
+ **Time:** 2 hours
778
+ **Deliverable:** Effect.ts services wrapping Convex for composition
779
+
780
+ ```typescript
781
+ // backend/convex/services/layers.ts
782
+
783
+ import { Effect, Context, Layer, Data } from "effect"
784
+ import { Agent } from "@convex-dev/agent"
785
+ import { RAG } from "@convex-dev/rag"
786
+
787
+ // Error definitions
788
+ class AgentError extends Data.TaggedError("AgentError")<{
789
+ cause: unknown
790
+ }> {}
791
+
792
+ class RAGError extends Data.TaggedError("RAGError")<{
793
+ cause: unknown
794
+ }> {}
795
+
796
+ // Service definitions
797
+ class AgentService extends Context.Tag("AgentService")<
798
+ AgentService,
799
+ {
800
+ readonly createThread: (userId: string) => Effect.Effect<string, AgentError>
801
+ readonly generateResponse: (threadId: string, prompt: string) => Effect.Effect<string, AgentError>
802
+ }
803
+ >() {}
804
+
805
+ class RAGService extends Context.Tag("RAGService")<
806
+ RAGService,
807
+ {
808
+ readonly addDocument: (namespace: string, text: string, metadata: any) => Effect.Effect<string, RAGError>
809
+ readonly search: (namespace: string, query: string, limit: number) => Effect.Effect<SearchResult[], RAGError>
810
+ }
811
+ >() {}
812
+
813
+ // Implementations
814
+ const AgentServiceLive = Layer.effect(
815
+ AgentService,
816
+ Effect.gen(function* () {
817
+ // Agent component initialized
818
+ const agent = new Agent(components.agent, {
819
+ name: "ONE Assistant",
820
+ chat: openai.chat("gpt-4o-mini"),
821
+ instructions: "You are a helpful assistant for the ONE Platform."
822
+ })
823
+
824
+ return {
825
+ createThread: (userId) =>
826
+ Effect.tryPromise({
827
+ try: async () => {
828
+ const { threadId } = await agent.createThread(ctx, { userId })
829
+ return threadId
830
+ },
831
+ catch: (error) => new AgentError({ cause: error })
832
+ }),
833
+
834
+ generateResponse: (threadId, prompt) =>
835
+ Effect.tryPromise({
836
+ try: async () => {
837
+ const { thread } = await agent.continueThread(ctx, { threadId })
838
+ const { text } = await thread.generateText({ prompt })
839
+ return text
840
+ },
841
+ catch: (error) => new AgentError({ cause: error })
842
+ })
843
+ }
844
+ })
845
+ )
846
+
847
+ const RAGServiceLive = Layer.effect(
848
+ RAGService,
849
+ Effect.gen(function* () {
850
+ const rag = new RAG(components.rag, {
851
+ textEmbeddingModel: openai.embedding("text-embedding-3-small"),
852
+ embeddingDimension: 1536
853
+ })
854
+
855
+ return {
856
+ addDocument: (namespace, text, metadata) =>
857
+ Effect.tryPromise({
858
+ try: () => rag.add(ctx, { namespace, text, filterValues: Object.entries(metadata).map(([k, v]) => ({ name: k, value: v })) }),
859
+ catch: (error) => new RAGError({ cause: error })
860
+ }),
861
+
862
+ search: (namespace, query, limit) =>
863
+ Effect.tryPromise({
864
+ try: () => rag.search(ctx, { namespace, query, limit, vectorScoreThreshold: 0.6 }),
865
+ catch: (error) => new RAGError({ cause: error })
866
+ })
867
+ }
868
+ })
869
+ )
870
+
871
+ // Export combined layer
872
+ export const AllServicesLive = Layer.merge(AgentServiceLive, RAGServiceLive)
873
+ ```
874
+
875
+ **Check:**
876
+ - [ ] Services layer compiles
877
+ - [ ] Effects properly typed
878
+ - [ ] Layers can be composed
879
+
880
+ ---
881
+
882
+ ### Summary: Phase 1 Complete
883
+
884
+ **After Phase 1:**
885
+ - ✅ All basic CRUD operations implemented
886
+ - ✅ Effect.ts service layer wrapping components
887
+ - ✅ Tests verify everything
888
+ - ✅ Frontend can connect to backend
889
+ - ✅ Foundation ready for AI features
890
+
891
+ ---
892
+
893
+ ## 📡 REST API Reference (Ontology-Aligned)
894
+
895
+ **All endpoints follow the 6-dimension ontology exactly:**
896
+
897
+ ```
898
+ # Groups (Dimension 1: Multi-tenant isolation)
899
+ GET /api/groups # List all groups (with ?limit=, ?cursor=)
900
+ GET /api/groups/:id # Get group details
901
+ POST /api/groups # Create group { name, type, parentGroupId? }
902
+ PATCH /api/groups/:id # Update group { name, settings }
903
+ DELETE /api/groups/:id # Archive group (soft delete)
904
+
905
+ # Things (Dimension 3: Entities/Things)
906
+ GET /api/things # List things ?type=course&status=active&limit=10&cursor=
907
+ GET /api/things/:id # Get single thing
908
+ POST /api/things # Create { groupId, type, name, properties }
909
+ PATCH /api/things/:id # Update { name, properties, status }
910
+ DELETE /api/things/:id # Soft delete
911
+
912
+ # Connections (Dimension 4: Relationships)
913
+ GET /api/connections # List connections in group
914
+ GET /api/connections/:id # Get connection details
915
+ POST /api/connections # Create { groupId, fromThingId, toThingId, type }
916
+ DELETE /api/connections/:id # Remove connection
917
+ GET /api/connections?from=:id # Things connected FROM X
918
+ GET /api/connections?to=:id # Things connected TO X
919
+
920
+ # Events (Dimension 5: Audit trail)
921
+ GET /api/events # List events (timeline)
922
+ GET /api/events/:id # Get event details
923
+ POST /api/events # Log custom event
924
+ GET /api/events?actor=:id # Events by actor (person)
925
+ GET /api/events?target=:id # Events by target (thing)
926
+
927
+ # Knowledge (Dimension 6: Semantic search)
928
+ GET /api/knowledge # List knowledge items
929
+ GET /api/knowledge/:id # Get knowledge details
930
+ POST /api/knowledge # Create { text, labels, metadata }
931
+ DELETE /api/knowledge/:id # Delete
932
+ POST /api/knowledge/search # Semantic search { query, limit }
933
+ POST /api/knowledge/embed # Create embeddings { texts }
934
+
935
+ # People (Dimension 2: Authorization)
936
+ GET /api/people # List people in group
937
+ GET /api/people/:id # Get person details
938
+ POST /api/people # Create { groupId, email, role }
939
+ PATCH /api/people/:id # Update role/permissions
940
+ DELETE /api/people/:id # Remove from group
941
+ ```
942
+
943
+ **Response Format (Consistent):**
944
+
945
+ ```typescript
946
+ // Success response
947
+ {
948
+ "data": {
949
+ "_id": "string",
950
+ "groupId": "string",
951
+ "type": "string",
952
+ "name": "string",
953
+ // ... other fields matching ontology
954
+ }
955
+ }
956
+
957
+ // List response
958
+ {
959
+ "data": {
960
+ "items": [...],
961
+ "count": 10,
962
+ "hasMore": true,
963
+ "cursor": "abc123"
964
+ }
965
+ }
966
+
967
+ // Error response
968
+ {
969
+ "error": {
970
+ "_tag": "EntityNotFound" | "Unauthorized" | "ValidationFailed" | etc.,
971
+ "message": "Human-readable message",
972
+ "details": {} // optional extra context
973
+ }
974
+ }
975
+ ```
976
+
977
+ ---
978
+
979
+ ## 🔗 PHASE 2: HONO HTTP LAYER + INTEGRATION (Week 2-3)
980
+
981
+ **Status:** Optional but valuable for external API access
982
+ **Time:** 3-4 hours
983
+ **Deliverable:** External API layer with API key auth
984
+
985
+ ### Option A: Just Connect Frontend to Convex (FAST - 2 hours)
986
+
987
+ If you just want frontend + backend talking:
988
+
989
+ ```typescript
990
+ // The frontend hooks already call the backend perfectly
991
+ // Just ensure:
992
+ ✅ web/.env.local has CONVEX_URL
993
+ ✅ backend/.env.local has CONVEX_DEPLOYMENT
994
+ ✅ Both are the same backend deployment
995
+ ✅ Frontend runs at localhost:4321
996
+ ✅ Backend at localhost:3210
997
+
998
+ // Then test end-to-end:
999
+ 1. Start backend: cd backend && npx convex dev
1000
+ 2. Start frontend: cd web && bun run dev
1001
+ 3. Visit http://localhost:4321/signup
1002
+ 4. Sign up → check convex dashboard for user created
1003
+ 5. Visit dashboard → fetch data from backend
1004
+ ```
1005
+
1006
+ **This works TODAY because:**
1007
+ - ✅ Frontend hooks use DataProvider (backend-agnostic)
1008
+ - ✅ Better Auth is fully configured
1009
+ - ✅ All Convex queries/mutations exist (or will after Phase 1)
1010
+ - ✅ No Hono layer needed unless you want REST API
1011
+
1012
+ ---
1013
+
1014
+ ### Option B: Add Hono REST API (BETTER - 4 hours)
1015
+
1016
+ If you want external API access (mobile apps, third-party integrations, etc.):
1017
+
1018
+ ```typescript
1019
+ // backend/convex/http.ts - Create Hono HTTP layer
1020
+
1021
+ import { Hono } from "hono"
1022
+ import { cors } from "hono/cors"
1023
+ import { handle } from "hono/vercel"
1024
+ import { httpRouter } from "convex/server"
1025
+
1026
+ const app = new Hono()
1027
+
1028
+ // Middleware
1029
+ app.use("*", cors())
1030
+
1031
+ // Health check
1032
+ app.get("/api/health", (c) => {
1033
+ return c.json({ status: "ok", timestamp: Date.now() })
1034
+ })
1035
+
1036
+ // Route to Convex queries
1037
+ app.get("/api/groups/:id", async (c) => {
1038
+ const id = c.req.param("id")
1039
+ // Call Convex mutation/query
1040
+ // Return response
1041
+ })
1042
+
1043
+ app.post("/api/things", async (c) => {
1044
+ const body = await c.req.json()
1045
+ // Call Convex mutation
1046
+ // Return created ID
1047
+ })
1048
+
1049
+ // ... More routes
1050
+
1051
+ export default httpRouter({
1052
+ "/": handle(app),
1053
+ })
1054
+ ```
1055
+
1056
+ **This lets you:**
1057
+ - ✅ Call ONE from mobile apps (API key auth)
1058
+ - ✅ Build third-party integrations
1059
+ - ✅ Use Zapier/Make integrations
1060
+ - ✅ Expose REST API to partners
1061
+
1062
+ **Decision:** Skip Hono for now. Connect frontend→backend directly. Add Hono in Phase 4 if needed.
1063
+
1064
+ ---
1065
+
1066
+ ## ✅ PHASE 3: FULL SYSTEM TEST (Week 3)
1067
+
1068
+ **Status:** After Phase 1 & 2, test the entire stack end-to-end
1069
+
1070
+ ### Test Checklist (2-3 hours)
1071
+
1072
+ ```bash
1073
+ # 1. Start both servers
1074
+ cd backend && npx convex dev & # Terminal 1
1075
+ cd web && bun run dev # Terminal 2
1076
+
1077
+ # 2. Test signup flow
1078
+ - Visit http://localhost:4321/signup
1079
+ - Sign up with test email
1080
+ - Check Convex dashboard for user creation
1081
+ - Should see Better Auth user created
1082
+
1083
+ # 3. Test authentication
1084
+ - Sign in with same email/password
1085
+ - Session should persist
1086
+ - Sign out should clear session
1087
+
1088
+ # 4. Test data operations (after Phase 1)
1089
+ - Create a thing from frontend
1090
+ - See it appear in Convex dashboard
1091
+ - Refresh page - data should persist
1092
+ - Delete from frontend
1093
+ - Confirm deleted in dashboard
1094
+
1095
+ # 5. Test permissions
1096
+ - Create group
1097
+ - Try to access as different user (should fail)
1098
+ - Verify groupId isolation works
1099
+
1100
+ # 6. Test error handling
1101
+ - Try invalid inputs
1102
+ - Should show friendly error
1103
+ - No 500 errors in console
1104
+
1105
+ # 7. Test performance
1106
+ - BUN run build should complete
1107
+ - No TypeScript errors
1108
+ - No linting errors
1109
+ ```
1110
+
1111
+ **Success Criteria:**
1112
+ - [ ] Signup/signin works
1113
+ - [ ] Data persists
1114
+ - [ ] Multi-tenant isolation works
1115
+ - [ ] No errors in console/logs
1116
+ - [ ] Build succeeds
1117
+
1118
+ ---
1119
+
1120
+ ## 🎯 PHASE 4: BUILD FEATURES ONE AT A TIME (Weeks 4+)
1121
+
1122
+ **Pick ONE feature at a time. Complete it fully before starting next.**
1123
+
1124
+ ### Feature Template (2-3 weeks each):
1125
+
1126
+ ```
1127
+ 1. Design (2 hours)
1128
+ - Map to Things/Connections/Events/Knowledge
1129
+ - Identify new entity types
1130
+ - Identify new relationship types
1131
+
1132
+ 2. Backend (4-6 hours)
1133
+ - Update schema if needed (add types)
1134
+ - Implement queries/mutations
1135
+ - Add tests
1136
+
1137
+ 3. Frontend (4-6 hours)
1138
+ - Create components
1139
+ - Wire up API calls
1140
+ - Add tests
1141
+
1142
+ 4. Integration (2 hours)
1143
+ - E2E tests
1144
+ - User flow testing
1145
+
1146
+ 5. Deploy (1 hour)
1147
+ - Staging test
1148
+ - Production deploy
1149
+ ```
1150
+
1151
+ ### Recommended Features (in order):
1152
+
1153
+ 1. **Blog System** (2 weeks)
1154
+ - Things: BlogPost, BlogCategory, BlogTag
1155
+ - Connections: published_in, tagged_with
1156
+ - Events: post_created, post_published, post_commented
1157
+ - UI: Blog list, post view, editor
1158
+
1159
+ 2. **Portfolio** (1.5 weeks)
1160
+ - Things: Project, Skill, Award
1161
+ - Connections: showcases, uses_skill
1162
+ - UI: Portfolio page, project detail
1163
+
1164
+ 3. **Course System** (2 weeks)
1165
+ - Things: Course, Lesson, Quiz
1166
+ - Connections: enrolled_in, completed
1167
+ - Events: course_started, lesson_completed
1168
+ - UI: Course list, lesson view, progress tracking
1169
+
1170
+ 4. **Tokens** (2 weeks)
1171
+ - Things: Token, TokenHolder
1172
+ - Connections: holds_tokens
1173
+ - Events: tokens_purchased, tokens_transferred
1174
+ - Integration: Stripe payment
1175
+
1176
+ 5. **Comments System** (1 week)
1177
+ - Things: Comment
1178
+ - Connections: commented_on
1179
+ - Events: comment_created
1180
+ - UI: Comment threads
1181
+
1182
+ ---
1183
+
1184
+ ## 🚀 PHASE 5: DEPLOYMENT (Week 5+)
1185
+
1186
+ **Get it in production and monitored.**
1187
+
1188
+ ### Staging (1 hour)
1189
+
1190
+ ```bash
1191
+ # Build for production
1192
+ cd web && bun run build
1193
+
1194
+ # Deploy to staging
1195
+ wrangler pages deploy dist --project-name=one-staging
1196
+
1197
+ # Test at https://staging.one.ie
1198
+ # Create account, verify flow works
1199
+ ```
1200
+
1201
+ ### Production (1 hour)
1202
+
1203
+ ```bash
1204
+ # Same as staging but to production
1205
+ wrangler pages deploy dist --project-name=one
1206
+
1207
+ # Live at https://one.ie
1208
+ # Tell the world! 🎉
1209
+ ```
1210
+
1211
+ ### Monitoring (1 hour)
1212
+
1213
+ ```
1214
+ Set up:
1215
+ - Error tracking (Sentry)
1216
+ - Performance monitoring (Web Vitals)
1217
+ - Uptime monitoring
1218
+ - Email alerts for critical errors
1219
+ ```
1220
+
1221
+ ---
1222
+
1223
+ ## 📊 COMPLETE TIMELINE
1224
+
1225
+ ```
1226
+ This Week (3 days): Quick Wins (polish foundation)
1227
+ Week 1-2 (10 hours): Complete backend stubs + Phase 1
1228
+ Week 2-3 (4 hours): Connect frontend to backend (Phase 2)
1229
+ Week 3 (3 hours): Full system test (Phase 3)
1230
+ Week 4 onwards (2-3 wks): Build features one at a time
1231
+
1232
+ TOTAL TO PRODUCTION: 4-5 weeks with solid foundation
1233
+ ```
1234
+
1235
+ ---
1236
+
1237
+ ## 🎓 Key Principles
1238
+
1239
+ 1. **Don't rebuild - build on what exists**
1240
+ - Frontend is complete
1241
+ - Schema is complete
1242
+ - Auth is complete
1243
+ - Just fill in the backend stubs
1244
+
1245
+ 2. **One feature at a time**
1246
+ - Complete feature fully before next
1247
+ - Each feature tests the whole stack
1248
+ - Quick wins = fast feedback
1249
+
1250
+ 3. **Test end-to-end**
1251
+ - Frontend → Backend → Database → Frontend
1252
+ - Real user flows, not just unit tests
1253
+ - Proves integration works
1254
+
1255
+ 4. **Deploy early, often**
1256
+ - Staging after each feature
1257
+ - Production after testing
1258
+ - Learn from real usage
1259
+
1260
+ 5. **Follow the patterns**
1261
+ - Every feature: Things → Connections → Events → Knowledge
1262
+ - Every mutation: create, update, delete with logging
1263
+ - Every component: loading, error, success states
1264
+
1265
+ ---
1266
+
1267
+ ## ✅ RIGHT NOW: Start Here
1268
+
1269
+ ```bash
1270
+ # 1. Read this file completely (15 min)
1271
+
1272
+ # 2. Pick your first quick win (2 hours)
1273
+ - Error Taxonomy, OR
1274
+ - Type Safety Audit, OR
1275
+ - Service Documentation
1276
+
1277
+ # 3. After quick wins, start Phase 1 (8-10 hours)
1278
+ - Complete backend stubs
1279
+ - All queries/mutations fully implemented
1280
+ - Tests passing
1281
+
1282
+ # 4. Phase 2: Connect frontend to backend (2-4 hours)
1283
+ - Test signup/signin flow
1284
+ - Verify data persists
1285
+ - Confirm no errors
1286
+
1287
+ # 5. Phase 3: Full system test (3 hours)
1288
+ - Create thing from frontend
1289
+ - Verify it appears in backend
1290
+ - Test multi-tenant isolation
1291
+
1292
+ # 6. Phase 4: Build your first feature (2-3 weeks)
1293
+ - Pick blog, portfolio, or courses
1294
+ - Complete fully
1295
+ - Deploy to staging
1296
+
1297
+ # 7. Go live! 🚀
1298
+ ```
1299
+
1300
+ ---
1301
+
1302
+ **You have everything you need. You're 90% done. Just finish the backend, test it, and launch. The world is waiting.** 🎉