oneie 3.6.7 → 3.6.12

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 (168) 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 +264 -32
  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/deploy.md +56 -17
  12. package/.claude/commands/mcp-toggle.md +93 -0
  13. package/.claude/commands/one.md +78 -127
  14. package/.claude/commands/plan.md +394 -80
  15. package/.claude/commands/push.md +75 -14
  16. package/.claude/commands/release.md +89 -25
  17. package/.claude/commands/server.md +2 -0
  18. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  19. package/.claude/hooks/root-cleanup.py +75 -0
  20. package/.claude/skills/INDEX.md +523 -0
  21. package/.claude/skills/REGISTRY.md +529 -0
  22. package/.claude/skills/agent-backend-create-mutation.md +319 -0
  23. package/.claude/skills/agent-designer-create-wireframe.md +341 -0
  24. package/.claude/skills/agent-frontend-create-page.md +413 -0
  25. package/.claude/skills/agents/README.md +238 -0
  26. package/dist/clone-web.js +1 -1
  27. package/dist/clone-web.js.map +1 -1
  28. package/folders.yaml +1 -1
  29. package/one/.obsidian/workspace.json +38 -38
  30. package/one/connections/api/queries-reference.md +842 -0
  31. package/one/connections/api-reference.md +1011 -0
  32. package/one/connections/integration-examples.md +875 -0
  33. package/one/connections/integration-guide.md +869 -0
  34. package/one/connections/integration-phase2.md +736 -0
  35. package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
  36. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
  37. package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
  38. package/one/events/CONNECTIONS_DEMO.md +501 -0
  39. package/one/events/DELIVERABLES.md +432 -0
  40. package/one/events/DEMO-GROUPS-PAGE.md +392 -0
  41. package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
  42. package/one/events/DEMO_COMPONENTS.md +487 -0
  43. package/one/events/DEMO_HOOKS_INDEX.md +334 -0
  44. package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
  45. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
  46. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
  47. package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
  48. package/one/events/DEMO_SETUP.md +476 -0
  49. package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
  50. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
  51. package/one/events/HOOKS-DEMO.md +441 -0
  52. package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
  53. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
  54. package/one/events/QA-CHECKLIST.md +674 -0
  55. package/one/events/QUICK-START-ONTOLOGY.md +408 -0
  56. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
  57. package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
  58. package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
  59. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
  60. package/one/events/TEST-PLAN-INDEX.md +346 -0
  61. package/one/events/TEST-PLAN.md +1417 -0
  62. package/one/events/TESTING-DELIVERY.txt +372 -0
  63. package/one/events/TRANSITIONS-QUICK-START.md +141 -0
  64. package/one/events/TYPESCRIPT_FIXES.md +152 -0
  65. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
  66. package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
  67. package/one/events/VIEW-TRANSITIONS.md +428 -0
  68. package/one/events/backend-integration-tests.md +606 -0
  69. package/one/events/backend-structure-diagram.txt +393 -0
  70. package/one/events/backend-structure-summary.txt +269 -0
  71. package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
  72. package/one/events/convex-analysis-index.md +304 -0
  73. package/one/events/convex-structure-analysis.md +700 -0
  74. package/one/events/design-spec-complete.md +208 -0
  75. package/one/events/ontology-test-examples.md +562 -0
  76. package/one/events/phase1-backend-implementation-complete.md +518 -0
  77. package/one/events/test-dashboard.md +345 -0
  78. package/one/events/test-index.md +361 -0
  79. package/one/events/test-report-ontology.md +582 -0
  80. package/one/events/testing-summary.md +344 -0
  81. package/one/groups/features.md +2878 -0
  82. package/one/groups/strategy copy.md +869 -0
  83. package/one/knowledge/backend-api-reference.md +710 -0
  84. package/one/knowledge/documentation-summary.md +285 -0
  85. package/one/knowledge/lessons-learned.md +294 -4
  86. package/one/knowledge/ontology-visual-guide.md +360 -0
  87. package/one/knowledge/ontology.md +9 -17
  88. package/one/things/demo-accessibility-animations.md +999 -0
  89. package/one/things/demo-components.md +1304 -0
  90. package/one/things/demo-design-summary.md +629 -0
  91. package/one/things/demo-design-system.md +919 -0
  92. package/one/things/demo-page-layouts.md +989 -0
  93. package/one/things/designs/accessibility-audit.md +790 -0
  94. package/one/things/designs/component-specifications.md +757 -0
  95. package/one/things/designs/design-overview.md +318 -0
  96. package/one/things/designs/design-tokens.md +414 -0
  97. package/one/things/designs/wireframes-dashboard.md +653 -0
  98. package/one/things/docs/api-requests.md +923 -0
  99. package/one/things/features/0 All Features.md +2 -0
  100. package/one/things/implementation/backend-guide.md +412 -0
  101. package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
  102. package/one/things/plans/2-sites.md +895 -0
  103. package/one/things/plans/ai-elements.md +1259 -0
  104. package/one/things/plans/ai-integration.md +947 -0
  105. package/one/things/plans/ai-sdk.md +761 -0
  106. package/one/things/plans/app.md +1 -1
  107. package/one/things/plans/architecture-summary.md +283 -0
  108. package/one/things/plans/async-ai-agents.md +215 -0
  109. package/one/things/plans/backend-agnostic-frontend.md +11 -6
  110. package/one/things/plans/backend-cleanup-quickstart.md +346 -0
  111. package/one/things/plans/backend-ontology-conformance.md +416 -0
  112. package/one/things/plans/backend-status.md +541 -0
  113. package/one/things/plans/backend-structure.md +799 -0
  114. package/one/things/plans/backend-target-structure.md +438 -0
  115. package/one/things/plans/backend.md +1133 -0
  116. package/one/things/plans/better-auth-any-backend.md +11 -11
  117. package/one/things/plans/cli-updates-required.md +280 -0
  118. package/one/things/plans/complete-step-by-step.md +1302 -0
  119. package/one/things/plans/convex-agents.md +1005 -0
  120. package/one/things/plans/deployment-architecture.md +426 -0
  121. package/one/things/plans/development-plan.md +1220 -0
  122. package/one/things/plans/effect.md +808 -48
  123. package/one/things/plans/integrate-frontend-and-backend.md +579 -0
  124. package/one/things/plans/mcp-clear-context-prompt.md +60 -0
  125. package/one/things/plans/mcp-simple.md +228 -0
  126. package/one/things/plans/one.md +8 -7
  127. package/one/things/plans/ontology-6-dimensions.md +20 -14
  128. package/one/things/plans/quick-wins.md +1273 -0
  129. package/one/things/plans/readme-backend-cleanup.md +361 -0
  130. package/one/things/plans/separate-demo.md +830 -0
  131. package/one/things/plans/separate.md +3 -3
  132. package/one/things/plans/sequence.md +1897 -0
  133. package/one/things/plans/sync-checklist.md +321 -0
  134. package/one/things/plans/unified-implementation-plan.md +3 -3
  135. package/one/things/plans/update-demos.md +513 -0
  136. package/package.json +1 -1
  137. package/.claude/agents/backend-specialist.md +0 -169
  138. package/.claude/agents/designer.md +0 -216
  139. package/.claude/agents/frontend-specialist.md +0 -236
  140. package/.claude/commands/done.md +0 -35
  141. package/.claude/commands/infer.md +0 -138
  142. package/.claude/commands/next.md +0 -53
  143. package/.claude/commands/one copy.md +0 -565
  144. package/.claude/commands/one-template.md +0 -106
  145. package/.claude/commands/one-v1.md +0 -609
  146. package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
  147. package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
  148. package/one/groups/nine-padel-customers.md +0 -138
  149. package/one/groups/nine-padel-data-structure.md +0 -167
  150. package/one/groups/nine-padel-ontology-specification.md +0 -359
  151. package/one/groups/nine-padel-ontology.md +0 -143
  152. package/one/groups/nine-padel-strategy.md +0 -234
  153. package/one/groups/nine-padel.md +0 -211
  154. package/one/groups/nine-padle-contents.baked.md +0 -1252
  155. package/one/groups/nine-padle-contents.md +0 -6
  156. package/one/things/features/1-1-agent-prompts/design.md +0 -470
  157. package/one/things/features/1-1-agent-prompts/tests.md +0 -264
  158. package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
  159. package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
  160. package/one/things/features/1-3-event-coordination/design.md +0 -544
  161. package/one/things/features/1-3-event-coordination/tests.md +0 -223
  162. package/one/things/features/1-4-knowledge-management/design.md +0 -609
  163. package/one/things/features/1-4-knowledge-management/tests.md +0 -195
  164. package/one/things/features/1-5-quality-loops/design.md +0 -797
  165. package/one/things/features/1-5-quality-loops/tests.md +0 -212
  166. package/one/things/features/1-6-numbering-structure/design.md +0 -610
  167. package/one/things/features/1-6-numbering-structure/tests.md +0 -213
  168. package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
@@ -0,0 +1,360 @@
1
+ # Visual Guide: 6-Dimension Ontology Implementation
2
+
3
+ ## The Reality Flow
4
+
5
+ ```
6
+ What exists? How are they related?
7
+ │ │
8
+ ↓ ↓
9
+ ┌───────────────┐ ┌──────────────────────┐
10
+ │ THINGS │◄──────►│ CONNECTIONS │
11
+ │ (Entities) │ │ (Relationships) │
12
+ │ │ │ │
13
+ │ • Users │ │ • owns │
14
+ │ • Content │ │ • member_of │
15
+ │ • Products │ │ • follows │
16
+ │ • Courses │ │ • collaborates_with │
17
+ │ • Agents │ │ • transacted │
18
+ └───────────────┘ └──────────────────────┘
19
+ ▲ ▲
20
+ │ │
21
+ │ Who authorized it? │
22
+ │ (with what roles) │
23
+ │ │
24
+ ┌──┴──────────────────────────┘
25
+ │
26
+ ┌────▼────┐
27
+ │ PEOPLE │ • platform_owner
28
+ │ (Roles) │ • org_owner
29
+ │ │ • org_user
30
+ └────┬────┘ • customer
31
+ │
32
+ │ organized in
33
+ │
34
+ ┌────▼─────────────────────────┐
35
+ │ GROUPS │
36
+ │ (Multi-tenant isolation) │
37
+ │ │
38
+ │ friend_circle │
39
+ │ business │
40
+ │ community │
41
+ │ dao ←─ hierarchical nesting │
42
+ │ government (groups in │
43
+ │ organization groups) │
44
+ └────────────────────────────────┘
45
+ │
46
+ │ Everything scoped to groupId
47
+ ├─► THINGS scoped to group
48
+ ├─► CONNECTIONS scoped to group
49
+ ├─► EVENTS scoped to group
50
+ └─► KNOWLEDGE scoped to group
51
+
52
+ What happened? What does it mean?
53
+ │ │
54
+ ↓ ↓
55
+ ┌──────────────────┐ ┌──────────────────┐
56
+ │ EVENTS │ │ KNOWLEDGE │
57
+ │ (Audit Trail) │ │ (Vectors/RAG) │
58
+ │ │ │ │
59
+ │ • created │ │ • embeddings │
60
+ │ • purchased │ │ • labels │
61
+ │ • viewed │ │ • semantic │
62
+ │ • completed │ │ search │
63
+ │ • voted │ │ • RAG context │
64
+ └──────────────────┘ └──────────────────┘
65
+ │ │
66
+ │ actor (PEOPLE) │ source_thing_id (THINGS)
67
+ │ target (THINGS) │ linked (THINGS)
68
+ │ timestamp (WHEN) │ labels (categorization)
69
+ └────────────────────────────┘
70
+ ```
71
+
72
+ ## Query Layer Organization
73
+
74
+ ```
75
+ QUERIES (Read Operations)
76
+
77
+ ┌─────────────────────────────────────────────────────────────┐
78
+ │ convex/queries/ │
79
+ ├─────────────────────────────────────────────────────────────┤
80
+ │ │
81
+ │ DIMENSION 1: GROUPS.TS (12 queries) │
82
+ │ ├─ getBySlug(slug) URL routing │
83
+ │ ├─ getById(id) Direct lookup │
84
+ │ ├─ list() All groups │
85
+ │ ├─ getSubgroups() Direct children │
86
+ │ ├─ getHierarchy() All descendants │
87
+ │ ├─ getGroupPath() Breadcrumb trail │
88
+ │ ├─ isDescendantOf() Permission check │
89
+ │ ├─ getEntitiesInHierarchy() [GROUP] → [THINGS] │
90
+ │ ├─ getConnectionsInHierarchy() [GROUP] → [CONNECTIONS] │
91
+ │ ├─ getEventsInHierarchy() [GROUP] → [EVENTS] │
92
+ │ ├─ getStats() Aggregated counts │
93
+ │ └─ search() Full-text search │
94
+ │ │
95
+ │ DIMENSION 2: PEOPLE.TS (4 queries) │
96
+ │ ├─ list(groupId) All members │
97
+ │ ├─ getById(id) Get person │
98
+ │ ├─ getRole(id) Get authorization │
99
+ │ └─ listByRole() Filter by role │
100
+ │ │
101
+ │ DIMENSION 3: ENTITIES.TS (9 queries) │
102
+ │ ├─ list() All entities │
103
+ │ ├─ getById() Direct lookup │
104
+ │ ├─ listByType() Filter by type │
105
+ │ ├─ listByStatus() Filter by status │
106
+ │ ├─ search() Full-text search │
107
+ │ ├─ listRecent() Timeline view │
108
+ │ ├─ getStats() Counts by type │
109
+ │ ├─ getRelated() Connected entities │
110
+ │ └─ getProperties() Get properties object │
111
+ │ │
112
+ │ DIMENSION 4: CONNECTIONS.TS (4 queries) │
113
+ │ ├─ listFrom() Outgoing edges │
114
+ │ ├─ listTo() Incoming edges │
115
+ │ ├─ listBetween() Bidirectional │
116
+ │ └─ listByType() Filter by type │
117
+ │ │
118
+ │ DIMENSION 5: EVENTS.TS (7 queries) │
119
+ │ ├─ list() All events │
120
+ │ ├─ byActor() [PEOPLE] → [EVENTS] │
121
+ │ ├─ byTarget() [THINGS] → [EVENTS] │
122
+ │ ├─ byTimeRange() Time-based filter │
123
+ │ ├─ stats() Counts by type │
124
+ │ ├─ recent() Most recent first │
125
+ │ └─ getById() Direct lookup │
126
+ │ │
127
+ │ DIMENSION 6: KNOWLEDGE.TS (8 queries) │
128
+ │ ├─ list() All knowledge │
129
+ │ ├─ search() Semantic search │
130
+ │ ├─ bySourceThing() [THINGS] → [KNOWLEDGE] │
131
+ │ ├─ byThing() Knowledge linked to │
132
+ │ ├─ byLabel() Filter by tag │
133
+ │ ├─ listLabels() Available tags │
134
+ │ ├─ stats() Counts by type │
135
+ │ └─ getById() Direct lookup │
136
+ │ │
137
+ └─────────────────────────────────────────────────────────────┘
138
+
139
+ TOTAL: 44 queries across all 6 dimensions
140
+ ```
141
+
142
+ ## Mutation Layer Organization
143
+
144
+ ```
145
+ MUTATIONS (Write Operations)
146
+
147
+ ┌─────────────────────────────────────────────────────────────┐
148
+ │ convex/mutations/ │
149
+ ├─────────────────────────────────────────────────────────────┤
150
+ │ │
151
+ │ DIMENSION 1: GROUPS.TS │
152
+ │ ├─ create() Create new group │
153
+ │ ├─ update() Modify group │
154
+ │ ├─ archive() Soft delete │
155
+ │ └─ restore() Unarchive │
156
+ │ │
157
+ │ DIMENSION 2: PEOPLE.TS │
158
+ │ ├─ create() Add person to group │
159
+ │ ├─ updateRole() Change authorization │
160
+ │ ├─ updateProfile() Modify person │
161
+ │ └─ removeFromGroup() Soft delete │
162
+ │ │
163
+ │ DIMENSION 3: ENTITIES.TS │
164
+ │ ├─ create() Create entity │
165
+ │ ├─ update() Modify entity │
166
+ │ ├─ archive() Soft delete │
167
+ │ ├─ restore() Unarchive │
168
+ │ └─ bulkCreate() Batch create │
169
+ │ │
170
+ │ DIMENSION 4: CONNECTIONS.TS │
171
+ │ ├─ create() Create relationship │
172
+ │ ├─ upsert() Create or update │
173
+ │ └─ bulkCreate() Batch create │
174
+ │ │
175
+ │ DIMENSION 5: EVENTS.TS │
176
+ │ └─ (Auto-logged by other mutations) │
177
+ │ │
178
+ │ DIMENSION 6: KNOWLEDGE.TS │
179
+ │ ├─ create() Create knowledge │
180
+ │ ├─ update() Modify knowledge │
181
+ │ ├─ delete() Delete knowledge │
182
+ │ ├─ bulkCreate() Batch create │
183
+ │ └─ linkToThing() Link to entity │
184
+ │ │
185
+ └─────────────────────────────────────────────────────────────┘
186
+ ```
187
+
188
+ ## Data Flow Example: "User follows Creator"
189
+
190
+ ```
191
+ ┌──────────────────────────────────────────────────────────────┐
192
+ │ ACTION: User clicks "Follow" button for creator │
193
+ └──────────────────────────────────────────────────────────────┘
194
+ │
195
+ ↓
196
+ ┌───────────────────────────────┐
197
+ │ MUTATION: Create Connection │
198
+ │ ├─ fromEntityId: userId │
199
+ │ ├─ toEntityId: creatorId │
200
+ │ └─ type: "following" │
201
+ └───────────────┬───────────────┘
202
+ │
203
+ ↓
204
+ ┌───────────────────────────────────────┐
205
+ │ AUTO: Log Event │
206
+ │ ├─ type: "connection_created" │
207
+ │ ├─ actorId: userId (who) │
208
+ │ ├─ targetId: creatorId (what) │
209
+ │ ├─ timestamp: now() │
210
+ │ └─ metadata: { type: "following" } │
211
+ └───────────────┬───────────────────────┘
212
+ │
213
+ ┌───────────────┴────────────────────┐
214
+ │ │
215
+ ↓ ↓
216
+ USER CAN NOW: SYSTEM CAN:
217
+ ├─ Query: listFrom() ├─ Show activity feed
218
+ │ "What do I follow?" ├─ Send notifications
219
+ ├─ Query: listByType() ├─ Compute influence score
220
+ │ "All following rel's" ├─ Find similar users
221
+ └─ Query: listRecent() └─ Train recommendation ML
222
+ "Recent follows"
223
+
224
+ ↓ Later: User reads article from creator
225
+
226
+ ┌─────────────────────────────────────┐
227
+ │ ACTION: View article │
228
+ └─────────────────────────────────────┘
229
+ │
230
+ ↓
231
+ ┌───────────────────────────┐
232
+ │ AUTO: Log Event │
233
+ │ ├─ type: "viewed" │
234
+ │ ├─ actorId: userId │
235
+ │ ├─ targetId: articleId │
236
+ │ └─ timestamp: now() │
237
+ └───────────────┬───────────┘
238
+ │
239
+ QUERY: byTarget(articleId)
240
+ "Who viewed this article?"
241
+ → Shows userId (already following)
242
+ → System learns user engagement
243
+ ```
244
+
245
+ ## Multi-Tenancy Pattern
246
+
247
+ ```
248
+ GROUP 1 (Acme Corp)
249
+ ├─── PEOPLE (Acme employees)
250
+ ├─── THINGS (Acme products, docs)
251
+ ├─── CONNECTIONS (Acme relationships)
252
+ ├─── EVENTS (Acme activity)
253
+ └─── KNOWLEDGE (Acme embeddings)
254
+
255
+ GROUP 2 (Smith Family)
256
+ ├─── PEOPLE (Family members)
257
+ ├─── THINGS (Family projects)
258
+ ├─── CONNECTIONS (Family relationships)
259
+ ├─── EVENTS (Family activity)
260
+ └─── KNOWLEDGE (Family embeddings)
261
+
262
+ GROUP 3 (Public DAO)
263
+ ├─── PEOPLE (DAO members)
264
+ ├─── THINGS (DAO proposals)
265
+ ├─── CONNECTIONS (DAO governance)
266
+ ├─── EVENTS (DAO activity)
267
+ └─── KNOWLEDGE (DAO embeddings)
268
+
269
+ ┌──────────────────────────────────────────┐
270
+ │ CRITICAL: Every query filters by groupId│
271
+ │ │
272
+ │ ❌ WRONG: await query.collect() │
273
+ │ ✅ RIGHT: .withIndex("by_group", │
274
+ │ q => q.eq("groupId", gid)) │
275
+ └──────────────────────────────────────────┘
276
+
277
+ Result: Perfect isolation between groups
278
+ - User from Group 1 can NEVER see Group 2 data
279
+ - No data leaks through queries
280
+ - Each group's AI training stays isolated
281
+ ```
282
+
283
+ ## Query Performance Strategy
284
+
285
+ ```
286
+ FAST (< 100ms)
287
+ ├─ getById() Direct ID lookup (O(1))
288
+ ├─ getBySlug() Indexed field lookup
289
+ └─ listByType() Indexed field filter
290
+
291
+ MEDIUM (100-500ms)
292
+ ├─ list() Multiple results with filter
293
+ ├─ search() Full-text search
294
+ └─ getHierarchy() Recursive with bounded depth
295
+
296
+ SLOW (> 500ms)
297
+ ├─ getEntitiesInHierarchy() Recursive traversal
298
+ ├─ getConnectionsInHierarchy() Complex traversal
299
+ └─ stats() with subgroups Multiple aggregations
300
+
301
+ ✅ OPTIMIZATION RULES:
302
+ 1. Filter by groupId FIRST (always)
303
+ 2. Use available indexes
304
+ 3. Limit result set size
305
+ 4. Cache computed results
306
+ 5. Denormalize frequently accessed aggregates
307
+ ```
308
+
309
+ ## Adding Features: Step-by-Step
310
+
311
+ ```
312
+ Step 1: Identify the dimension
313
+ ┌─────────────────────┐
314
+ │ Which dimension? │
315
+ ├─────────────────────┤
316
+ │ Groups? │ → groups.ts
317
+ │ People/Auth? │ → people.ts
318
+ │ Entities/Things? │ → entities.ts
319
+ │ Relationships? │ → connections.ts
320
+ │ Audit/Timeline? │ → events.ts
321
+ │ AI/Search? │ → knowledge.ts
322
+ └─────────────────────┘
323
+
324
+ Step 2: Add Query or Mutation
325
+ ┌──────────────────────────────────────────┐
326
+ │ export const myQuery = query({ │
327
+ │ args: { │
328
+ │ groupId: v.id("groups"), ← REQUIRED│
329
+ │ myArg: v.string() │
330
+ │ }, │
331
+ │ handler: async (ctx, args) => { │
332
+ │ // Filter by groupId first │
333
+ │ // Use indexes │
334
+ │ // Return results │
335
+ │ } │
336
+ │ }) │
337
+ └──────────────────────────────────────────┘
338
+
339
+ Step 3: Log Event (if write operation)
340
+ ┌──────────────────────────────────────────┐
341
+ │ await ctx.db.insert("events", { │
342
+ │ groupId: args.groupId, │
343
+ │ type: "entity_created", │
344
+ │ actorId: userId, │
345
+ │ targetId: entityId, │
346
+ │ timestamp: Date.now(), │
347
+ │ metadata: { ... } │
348
+ │ }); │
349
+ └──────────────────────────────────────────┘
350
+
351
+ Step 4: Document
352
+ - Add JSDoc comment
353
+ - Update queries/README.md
354
+ - Add to INDEX.md
355
+ ```
356
+
357
+ ---
358
+
359
+ **Key Insight**: The entire backend is organized around reality modeling through 6 dimensions. This provides natural organization, perfect isolation, and scalability from friend circles to global DAOs.
360
+
@@ -1113,11 +1113,10 @@ Examples:
1113
1113
 
1114
1114
  ```typescript
1115
1115
  type EventType =
1116
- // ENTITY LIFECYCLE (4)
1117
- | 'entity_created'
1118
- | 'entity_updated'
1119
- | 'entity_deleted'
1120
- | 'entity_archived'
1116
+ // THING LIFECYCLE (3) - Consolidated with metadata.thingType
1117
+ | 'thing_created' // metadata: { thingType: "group" | "user" | "course" | etc. }
1118
+ | 'thing_updated' // metadata: { thingType, action: "updated" | "archived" | "restored" }
1119
+ | 'thing_deleted' // metadata: { thingType, action: "deleted" | "archived", deletionType: "soft" | "hard" }
1121
1120
 
1122
1121
  // USER EVENTS (5)
1123
1122
  | 'user_registered'
@@ -1134,9 +1133,7 @@ type EventType =
1134
1133
  | 'two_factor_enabled'
1135
1134
  | 'two_factor_disabled'
1136
1135
 
1137
- // GROUP EVENTS (5)
1138
- | 'group_created'
1139
- | 'group_updated'
1136
+ // GROUP-SPECIFIC EVENTS (3) - Not lifecycle events (those use thing_*)
1140
1137
  | 'user_invited_to_group'
1141
1138
  | 'user_joined_group'
1142
1139
  | 'user_removed_from_group'
@@ -1147,20 +1144,16 @@ type EventType =
1147
1144
  | 'theme_changed'
1148
1145
  | 'preferences_updated'
1149
1146
 
1150
- // AI/CLONE EVENTS (4)
1151
- | 'clone_created'
1152
- | 'clone_updated'
1147
+ // AI/CLONE EVENTS (2) - Creation uses thing_created with thingType: "clone"
1153
1148
  | 'voice_cloned'
1154
1149
  | 'appearance_cloned'
1155
1150
 
1156
- // AGENT EVENTS (4)
1157
- | 'agent_created'
1151
+ // AGENT EVENTS (3) - Creation uses thing_created with thingType: "agent"
1158
1152
  | 'agent_executed'
1159
1153
  | 'agent_completed'
1160
1154
  | 'agent_failed'
1161
1155
 
1162
- // TOKEN EVENTS (7)
1163
- | 'token_created'
1156
+ // TOKEN EVENTS (6) - Creation uses thing_created with thingType: "token"
1164
1157
  | 'token_minted'
1165
1158
  | 'token_burned'
1166
1159
  | 'tokens_purchased'
@@ -1168,8 +1161,7 @@ type EventType =
1168
1161
  | 'tokens_unstaked'
1169
1162
  | 'tokens_transferred'
1170
1163
 
1171
- // COURSE EVENTS (5)
1172
- | 'course_created'
1164
+ // COURSE EVENTS (4) - Creation uses thing_created with thingType: "course"
1173
1165
  | 'course_enrolled'
1174
1166
  | 'lesson_completed'
1175
1167
  | 'course_completed'