oneie 3.7.0 → 3.8.1

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 (1156) hide show
  1. package/README.md +9 -9
  2. package/dist/commands/agent.d.ts +2 -0
  3. package/dist/commands/agent.d.ts.map +1 -1
  4. package/dist/commands/agent.js +44 -0
  5. package/dist/commands/agent.js.map +1 -1
  6. package/dist/commands/bounty.d.ts +4 -0
  7. package/dist/commands/bounty.d.ts.map +1 -0
  8. package/dist/commands/bounty.js +24 -0
  9. package/dist/commands/bounty.js.map +1 -0
  10. package/dist/commands/buy.d.ts +19 -0
  11. package/dist/commands/buy.d.ts.map +1 -0
  12. package/dist/commands/buy.js +63 -0
  13. package/dist/commands/buy.js.map +1 -0
  14. package/dist/commands/capabilities.d.ts +4 -0
  15. package/dist/commands/capabilities.d.ts.map +1 -0
  16. package/dist/commands/capabilities.js +18 -0
  17. package/dist/commands/capabilities.js.map +1 -0
  18. package/dist/commands/commend.d.ts +4 -0
  19. package/dist/commands/commend.d.ts.map +1 -0
  20. package/dist/commands/commend.js +13 -0
  21. package/dist/commands/commend.js.map +1 -0
  22. package/dist/commands/completion.d.ts +4 -0
  23. package/dist/commands/completion.d.ts.map +1 -0
  24. package/dist/commands/completion.js +49 -0
  25. package/dist/commands/completion.js.map +1 -0
  26. package/dist/commands/config.d.ts +4 -0
  27. package/dist/commands/config.d.ts.map +1 -0
  28. package/dist/commands/config.js +78 -0
  29. package/dist/commands/config.js.map +1 -0
  30. package/dist/commands/deploy.d.ts +1 -1
  31. package/dist/commands/deploy.d.ts.map +1 -1
  32. package/dist/commands/deploy.js +39 -4
  33. package/dist/commands/deploy.js.map +1 -1
  34. package/dist/commands/doctor.d.ts +4 -0
  35. package/dist/commands/doctor.d.ts.map +1 -0
  36. package/dist/commands/doctor.js +72 -0
  37. package/dist/commands/doctor.js.map +1 -0
  38. package/dist/commands/domain.d.ts +4 -0
  39. package/dist/commands/domain.d.ts.map +1 -0
  40. package/dist/commands/domain.js +19 -0
  41. package/dist/commands/domain.js.map +1 -0
  42. package/dist/commands/export.d.ts +4 -0
  43. package/dist/commands/export.d.ts.map +1 -0
  44. package/dist/commands/export.js +15 -0
  45. package/dist/commands/export.js.map +1 -0
  46. package/dist/commands/fade.d.ts.map +1 -1
  47. package/dist/commands/fade.js +8 -4
  48. package/dist/commands/fade.js.map +1 -1
  49. package/dist/commands/flag.d.ts +4 -0
  50. package/dist/commands/flag.d.ts.map +1 -0
  51. package/dist/commands/flag.js +13 -0
  52. package/dist/commands/flag.js.map +1 -0
  53. package/dist/commands/health.d.ts +4 -0
  54. package/dist/commands/health.d.ts.map +1 -0
  55. package/dist/commands/health.js +11 -0
  56. package/dist/commands/health.js.map +1 -0
  57. package/dist/commands/highways.d.ts.map +1 -1
  58. package/dist/commands/highways.js +7 -4
  59. package/dist/commands/highways.js.map +1 -1
  60. package/dist/commands/hire.d.ts +4 -0
  61. package/dist/commands/hire.d.ts.map +1 -0
  62. package/dist/commands/hire.js +16 -0
  63. package/dist/commands/hire.js.map +1 -0
  64. package/dist/commands/init.d.ts.map +1 -1
  65. package/dist/commands/init.js +85 -48
  66. package/dist/commands/init.js.map +1 -1
  67. package/dist/commands/invite.d.ts +4 -0
  68. package/dist/commands/invite.d.ts.map +1 -0
  69. package/dist/commands/invite.js +37 -0
  70. package/dist/commands/invite.js.map +1 -0
  71. package/dist/commands/mark.d.ts.map +1 -1
  72. package/dist/commands/mark.js +7 -7
  73. package/dist/commands/mark.js.map +1 -1
  74. package/dist/commands/pay.d.ts +4 -0
  75. package/dist/commands/pay.d.ts.map +1 -0
  76. package/dist/commands/pay.js +21 -0
  77. package/dist/commands/pay.js.map +1 -0
  78. package/dist/commands/pipe.d.ts +4 -0
  79. package/dist/commands/pipe.d.ts.map +1 -0
  80. package/dist/commands/pipe.js +35 -0
  81. package/dist/commands/pipe.js.map +1 -0
  82. package/dist/commands/publish.d.ts +4 -0
  83. package/dist/commands/publish.d.ts.map +1 -0
  84. package/dist/commands/publish.js +23 -0
  85. package/dist/commands/publish.js.map +1 -0
  86. package/dist/commands/repl.d.ts +4 -0
  87. package/dist/commands/repl.d.ts.map +1 -0
  88. package/dist/commands/repl.js +56 -0
  89. package/dist/commands/repl.js.map +1 -0
  90. package/dist/commands/revenue.d.ts +4 -0
  91. package/dist/commands/revenue.d.ts.map +1 -0
  92. package/dist/commands/revenue.js +11 -0
  93. package/dist/commands/revenue.js.map +1 -0
  94. package/dist/commands/sell.d.ts +15 -0
  95. package/dist/commands/sell.d.ts.map +1 -0
  96. package/dist/commands/sell.js +49 -0
  97. package/dist/commands/sell.js.map +1 -0
  98. package/dist/commands/stats.d.ts +4 -0
  99. package/dist/commands/stats.d.ts.map +1 -0
  100. package/dist/commands/stats.js +11 -0
  101. package/dist/commands/stats.js.map +1 -0
  102. package/dist/commands/status.d.ts +4 -0
  103. package/dist/commands/status.d.ts.map +1 -0
  104. package/dist/commands/status.js +18 -0
  105. package/dist/commands/status.js.map +1 -0
  106. package/dist/commands/subscribe.d.ts +14 -0
  107. package/dist/commands/subscribe.d.ts.map +1 -0
  108. package/dist/commands/subscribe.js +33 -0
  109. package/dist/commands/subscribe.js.map +1 -0
  110. package/dist/commands/tail.d.ts +4 -0
  111. package/dist/commands/tail.d.ts.map +1 -0
  112. package/dist/commands/tail.js +51 -0
  113. package/dist/commands/tail.js.map +1 -0
  114. package/dist/commands/warn.d.ts.map +1 -1
  115. package/dist/commands/warn.js +6 -6
  116. package/dist/commands/warn.js.map +1 -1
  117. package/dist/index.js +70 -1
  118. package/dist/index.js.map +1 -1
  119. package/dist/lib/args.d.ts +1 -0
  120. package/dist/lib/args.d.ts.map +1 -1
  121. package/dist/lib/args.js +3 -0
  122. package/dist/lib/args.js.map +1 -1
  123. package/dist/lib/output.d.ts +5 -0
  124. package/dist/lib/output.d.ts.map +1 -0
  125. package/dist/lib/output.js +32 -0
  126. package/dist/lib/output.js.map +1 -0
  127. package/dist/lib/sdk.d.ts +10 -0
  128. package/dist/lib/sdk.d.ts.map +1 -0
  129. package/dist/lib/sdk.js +22 -0
  130. package/dist/lib/sdk.js.map +1 -0
  131. package/dist/utils/installation-setup.d.ts +15 -0
  132. package/dist/utils/installation-setup.d.ts.map +1 -1
  133. package/dist/utils/installation-setup.js +63 -0
  134. package/dist/utils/installation-setup.js.map +1 -1
  135. package/package.json +3 -18
  136. package/.claude/agents/TROUBLESHOOTING.md +0 -530
  137. package/.claude/agents/agent-backend.md +0 -574
  138. package/.claude/agents/agent-builder.md +0 -911
  139. package/.claude/agents/agent-claude.md +0 -645
  140. package/.claude/agents/agent-clean.md +0 -477
  141. package/.claude/agents/agent-clone.md +0 -554
  142. package/.claude/agents/agent-designer.md +0 -1080
  143. package/.claude/agents/agent-director.md +0 -2254
  144. package/.claude/agents/agent-documenter.md +0 -688
  145. package/.claude/agents/agent-frontend.md +0 -1199
  146. package/.claude/agents/agent-integrator.md +0 -670
  147. package/.claude/agents/agent-lawyer.md +0 -1320
  148. package/.claude/agents/agent-news.md +0 -363
  149. package/.claude/agents/agent-onboard.md +0 -613
  150. package/.claude/agents/agent-ontology.md +0 -585
  151. package/.claude/agents/agent-ops.md +0 -1275
  152. package/.claude/agents/agent-problem-solver.md +0 -669
  153. package/.claude/agents/agent-quality.md +0 -1042
  154. package/.claude/agents/agent-sales.md +0 -507
  155. package/.claude/agents/agent-writer.md +0 -1068
  156. package/.claude/commands/cascade.md +0 -742
  157. package/.claude/commands/chat.md +0 -728
  158. package/.claude/commands/commit.md +0 -95
  159. package/.claude/commands/create.md +0 -544
  160. package/.claude/commands/deploy.md +0 -309
  161. package/.claude/commands/fast.md +0 -636
  162. package/.claude/commands/mcp-on.md +0 -191
  163. package/.claude/commands/media-upload.md +0 -186
  164. package/.claude/commands/news.md +0 -274
  165. package/.claude/commands/onboard.md +0 -440
  166. package/.claude/commands/one.md +0 -398
  167. package/.claude/commands/optimize.md +0 -74
  168. package/.claude/commands/plan.md +0 -719
  169. package/.claude/commands/push.md +0 -214
  170. package/.claude/commands/release.md +0 -105
  171. package/.claude/commands/review.md +0 -99
  172. package/.claude/commands/server.md +0 -487
  173. package/.claude/commands/start.md +0 -227
  174. package/.claude/commands/test.md +0 -197
  175. package/.claude/commands/validate.md +0 -140
  176. package/.claude/hooks/.last-news-context +0 -1
  177. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
  178. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  179. package/.claude/hooks/README-news-generation.md +0 -364
  180. package/.claude/hooks/README-root-cleanup.md +0 -200
  181. package/.claude/hooks/README.md +0 -284
  182. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  183. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  184. package/.claude/hooks/auto-format.sh +0 -106
  185. package/.claude/hooks/check-filenames.py +0 -177
  186. package/.claude/hooks/clean-post.py +0 -468
  187. package/.claude/hooks/clean-pre.py +0 -393
  188. package/.claude/hooks/clean-root-markdown.sh +0 -73
  189. package/.claude/hooks/commit-push.sh +0 -95
  190. package/.claude/hooks/done.py +0 -236
  191. package/.claude/hooks/format-hook.sh +0 -163
  192. package/.claude/hooks/formatting.py +0 -187
  193. package/.claude/hooks/hook-logger.sh +0 -173
  194. package/.claude/hooks/knowledge-post.py +0 -355
  195. package/.claude/hooks/knowledge-pre.py +0 -245
  196. package/.claude/hooks/mcp-on.sh +0 -134
  197. package/.claude/hooks/notification-hook.sh +0 -279
  198. package/.claude/hooks/ontology-validation.py +0 -255
  199. package/.claude/hooks/push.sh +0 -153
  200. package/.claude/hooks/release-cli.sh +0 -205
  201. package/.claude/hooks/root-cleanup.py +0 -217
  202. package/.claude/hooks/security-hook.sh +0 -397
  203. package/.claude/hooks/tag-all-docs.py +0 -464
  204. package/.claude/hooks/test-validate-ontology.sh +0 -170
  205. package/.claude/hooks/todo.py +0 -368
  206. package/.claude/hooks/track-changes.sh +0 -101
  207. package/.claude/hooks/validate-imports.py +0 -182
  208. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  209. package/.claude/hooks/validate-ontology-structure.py +0 -558
  210. package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
  211. package/.claude/hooks/validate-ontology.py +0 -140
  212. package/.claude/hooks/write-news.sh +0 -194
  213. package/.claude/skills/INDEX.md +0 -523
  214. package/.claude/skills/REGISTRY.md +0 -529
  215. package/.claude/skills/agent-backend-create-mutation.md +0 -319
  216. package/.claude/skills/agent-designer-create-wireframe.md +0 -341
  217. package/.claude/skills/agent-frontend-create-page.md +0 -413
  218. package/.claude/skills/agents/README.md +0 -238
  219. package/.claude/skills/astro/add-content-collection.md +0 -30
  220. package/.claude/skills/astro/check-build.md +0 -29
  221. package/.claude/skills/astro/create-component.md +0 -29
  222. package/.claude/skills/astro/create-page.md +0 -30
  223. package/.claude/skills/astro/optimize-performance.md +0 -21
  224. package/.claude/skills/convex/check-deployment.md +0 -46
  225. package/.claude/skills/convex/create-mutation.md +0 -405
  226. package/.claude/skills/convex/create-query.md +0 -52
  227. package/.claude/skills/convex/read-schema.md +0 -373
  228. package/.claude/skills/convex/test-function.md +0 -50
  229. package/.claude/skills/deployment/check-deployment-health.md +0 -20
  230. package/.claude/skills/deployment/create-release.md +0 -21
  231. package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
  232. package/.claude/skills/deployment/deploy-convex.md +0 -30
  233. package/.claude/skills/deployment/sync-repositories.md +0 -19
  234. package/.claude/skills/design/check-accessibility.md +0 -21
  235. package/.claude/skills/design/create-component-spec.md +0 -27
  236. package/.claude/skills/design/generate-design-tokens.md +0 -24
  237. package/.claude/skills/design/generate-wireframe.md +0 -30
  238. package/.claude/skills/documentation/create-migration-guide.md +0 -20
  239. package/.claude/skills/documentation/generate-api-docs.md +0 -27
  240. package/.claude/skills/documentation/generate-readme.md +0 -22
  241. package/.claude/skills/documentation/update-knowledge.md +0 -20
  242. package/.claude/skills/integration/connect-external-system.md +0 -21
  243. package/.claude/skills/integration/implement-a2a.md +0 -20
  244. package/.claude/skills/integration/implement-acp.md +0 -20
  245. package/.claude/skills/integration/verify-integration.md +0 -20
  246. package/.claude/skills/ontology/README.md +0 -255
  247. package/.claude/skills/ontology/check-dimension.md +0 -307
  248. package/.claude/skills/ontology/generate-entity-type.md +0 -339
  249. package/.claude/skills/ontology/validate-schema.md +0 -229
  250. package/.claude/skills/ontology/verify-relationships.md +0 -310
  251. package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
  252. package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
  253. package/.claude/skills/problem-solving/propose-solution.md +0 -29
  254. package/.claude/skills/problem-solving/verify-fix.md +0 -21
  255. package/.claude/skills/sales/generate-demo-script.md +0 -21
  256. package/.claude/skills/sales/qualify-lead.md +0 -30
  257. package/.claude/skills/sales/track-trial.md +0 -20
  258. package/.claude/skills/sales/verify-kyc.md +0 -20
  259. package/.claude/skills/testing/analyze-coverage.md +0 -24
  260. package/.claude/skills/testing/generate-tests.md +0 -24
  261. package/.claude/skills/testing/run-tests.md +0 -27
  262. package/.claude/skills/testing/validate-e2e.md +0 -25
  263. package/AGENTS.md +0 -60
  264. package/CLAUDE.md +0 -130
  265. package/CREATE-WEBSITE.md +0 -458
  266. package/SECURITY.md +0 -31
  267. package/folders.yaml +0 -92
  268. package/one/README.md +0 -760
  269. package/one/actors/anthony-o-connell.md +0 -469
  270. package/one/actors/people.md +0 -590
  271. package/one/events/0-changes.md +0 -2764
  272. package/one/events/1-PROJECTS-START-HERE.md +0 -384
  273. package/one/events/1-projects-developer-quickstart.md +0 -620
  274. package/one/events/1-projects-feature.md +0 -2047
  275. package/one/events/1-projects-team-briefing.md +0 -583
  276. package/one/events/2024-10-14-deployment-plan.md +0 -330
  277. package/one/events/2024-10-14-deployment-success.md +0 -447
  278. package/one/events/2024-10-14-final-sync-complete.md +0 -250
  279. package/one/events/2024-10-14-release-v2.0.6.md +0 -414
  280. package/one/events/2024-10-15-agent-clean-v2-summary.md +0 -495
  281. package/one/events/2024-10-15-handoff-to-clean.md +0 -347
  282. package/one/events/2024-10-15-package-manager-tests.md +0 -442
  283. package/one/events/2024-10-15-release-command-complete.md +0 -416
  284. package/one/events/2025-10-15-private-files-secured.md +0 -359
  285. package/one/events/2025-10-15-unignore-public-group-docs.md +0 -298
  286. package/one/events/2025-11-08-backend-claude-refactor.md +0 -242
  287. package/one/events/2025-11-08-parallel-agent-implementation.md +0 -620
  288. package/one/events/2025-11-10-ai-integration-status-report.md +0 -241
  289. package/one/events/ACCESSIBILITY_CHECKLIST.md +0 -275
  290. package/one/events/ACCESSIBILITY_FIXES_SUMMARY.md +0 -293
  291. package/one/events/ALIGNMENT_REPORT_PROBLEM_SOLVER.md +0 -335
  292. package/one/events/ALIGNMENT_SUMMARY.md +0 -280
  293. package/one/events/API_ROUTES_FIXES_SUMMARY.md +0 -280
  294. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +0 -654
  295. package/one/events/AUDIT-ONTOLOGY-ALIGNMENT.md +0 -598
  296. package/one/events/AUDIT_PLAN_COMPLETION-20251108-125555.md +0 -262
  297. package/one/events/BEFORE_AFTER_COMPARISON.md +0 -978
  298. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +0 -372
  299. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +0 -430
  300. package/one/events/CHARTS-READY-TO-USE-20251106-080939.md +0 -184
  301. package/one/events/CHARTS-SUMMARY-20251106-080938.md +0 -196
  302. package/one/events/CLAUDE copy.md +0 -897
  303. package/one/events/CLEANUP-RELEASE-V2.0.8.md +0 -308
  304. package/one/events/CLOUDFLARE-FS-FIX-20251106-100516.md +0 -75
  305. package/one/events/COMPONENT_SHOWCASE-20251106-080938.md +0 -629
  306. package/one/events/CONNECTIONS_DEMO.md +0 -519
  307. package/one/events/CREATE-WEBSITE.md +0 -460
  308. package/one/events/CRITICAL-FIXES-COMPLETE.md +0 -571
  309. package/one/events/CUSTOM-DOMAIN.md +0 -375
  310. package/one/events/DELIVERABLES.md +0 -450
  311. package/one/events/DELIVERABLES.txt +0 -273
  312. package/one/events/DEMO-GROUPS-PAGE.md +0 -410
  313. package/one/events/DEMO-TESTING-SUMMARY.md +0 -536
  314. package/one/events/DEMO_COMPONENTS.md +0 -505
  315. package/one/events/DEMO_HOOKS_INDEX.md +0 -352
  316. package/one/events/DEMO_INFRASTRUCTURE.md +0 -923
  317. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +0 -588
  318. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +0 -449
  319. package/one/events/DEMO_QUICK_REFERENCE.md +0 -459
  320. package/one/events/DEMO_SETUP.md +0 -494
  321. package/one/events/DEPLOYMENT copy.md +0 -444
  322. package/one/events/DEPLOYMENT.md +0 -196
  323. package/one/events/DESIGN-DELIVERABLES-20251106-080938.md +0 -557
  324. package/one/events/DESIGN-EXECUTIVE-SUMMARY-20251106-080938.md +0 -484
  325. package/one/events/DOCS-SYSTEM-GUIDE-20251105-142103.md +0 -458
  326. package/one/events/DOCUMENTER-DELIVERY-SUMMARY.md +0 -481
  327. package/one/events/DOCUMENTER-EXECUTION-GUIDE.md +0 -394
  328. package/one/events/DOCUMENTER-TASK-BREAKDOWN.md +0 -783
  329. package/one/events/ECOMMERCE-BEFORE-AFTER.md +0 -267
  330. package/one/events/ECOMMERCE-DEMO-PLAN.md +0 -243
  331. package/one/events/ECOMMERCE-ENHANCEMENTS.md +0 -594
  332. package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +0 -439
  333. package/one/events/ECOMMERCE-LIVE-DEMO.md +0 -381
  334. package/one/events/ECOMMERCE-QUICKSTART.md +0 -376
  335. package/one/events/ECOMMERCE-README.md +0 -354
  336. package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +0 -214
  337. package/one/events/ECOMMERCE-SETUP-SUMMARY.md +0 -414
  338. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +0 -753
  339. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +0 -941
  340. package/one/events/EFFECT_TS_API_PATTERN.md +0 -496
  341. package/one/events/EXECUTION-READY.md +0 -359
  342. package/one/events/EXECUTION-SUMMARY.md +0 -478
  343. package/one/events/FEATURE-2-4-COMPLETE.md +0 -320
  344. package/one/events/FEATURE_2_3_COMPLETE.md +0 -593
  345. package/one/events/FILE-REFERENCE-20251105-142103.md +0 -325
  346. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +0 -241
  347. package/one/events/GROUPS-MIGRATION.md +0 -643
  348. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +0 -432
  349. package/one/events/HANDOFF.md +0 -331
  350. package/one/events/HOOKS-DEMO.md +0 -459
  351. package/one/events/IMPLEMENTATION-CHECKLIST-20251105-142103.md +0 -274
  352. package/one/events/IMPLEMENTATION-REPORT-DOCS-20251105-142102.md +0 -394
  353. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +0 -568
  354. package/one/events/IMPLEMENTATION_SUMMARY-20251106-080938.md +0 -571
  355. package/one/events/IMPLEMENTATION_SUMMARY.md +0 -547
  356. package/one/events/INDEX-ALL-AGENTS.md +0 -190
  357. package/one/events/INDEX-FRONTEND-TESTING.md +0 -524
  358. package/one/events/INDEX-PROBLEM-SOLVER.md +0 -488
  359. package/one/events/INDEX-QUALITY-AGENT-INFER65.md +0 -455
  360. package/one/events/INDEX.md +0 -295
  361. package/one/events/INDEX_QUICK_START_REDESIGN-20251106-080939.md +0 -342
  362. package/one/events/INSTALL-TESTS.md +0 -311
  363. package/one/events/INSTALLATION_FOLDERS.md +0 -534
  364. package/one/events/INSTALLATION_FOLDERS_FILES.md +0 -223
  365. package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +0 -437
  366. package/one/events/INTEGRATION-ARCHITECTURE.md +0 -579
  367. package/one/events/INTEGRATION-CHECKLIST.md +0 -1252
  368. package/one/events/INTEGRATION-ORCHESTRATION.md +0 -2641
  369. package/one/events/INTEGRATION-SUMMARY.md +0 -671
  370. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +0 -684
  371. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +0 -660
  372. package/one/events/LANDING-PAGE-QUICKSTART.md +0 -425
  373. package/one/events/LICENSE.md +0 -107
  374. package/one/events/MASTER-COORDINATION-PLAN.md +0 -613
  375. package/one/events/MASTER-ORCHESTRATION-INFER65.md +0 -441
  376. package/one/events/MASTER-PLAN-SUMMARY.md +0 -309
  377. package/one/events/MCP-CONFIGURATION.md +0 -354
  378. package/one/events/MCP-SETUP-COMPLETE.md +0 -223
  379. package/one/events/MIGRATION-REPORT.md +0 -453
  380. package/one/events/MIGRATION.md +0 -87
  381. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +0 -1663
  382. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +0 -643
  383. package/one/events/NEWS-COMMANDS.md +0 -506
  384. package/one/events/NEWS-SYSTEM-SUMMARY.md +0 -480
  385. package/one/events/NODE-UPGRADE.md +0 -129
  386. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +0 -416
  387. package/one/events/ONTOLOGY-HOOKS-README.md +0 -718
  388. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +0 -383
  389. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +0 -569
  390. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +0 -491
  391. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +0 -504
  392. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +0 -221
  393. package/one/events/PACKAGE-STRUCTURE.md +0 -328
  394. package/one/events/PLAN-COMPLETE.md +0 -429
  395. package/one/events/PLAYBOOK-SETUP-SUMMARY.md +0 -349
  396. package/one/events/PROBLEM-SOLVER-EXECUTIVE-SUMMARY.md +0 -484
  397. package/one/events/PROBLEM-SOLVER-QUICKSTART.md +0 -420
  398. package/one/events/PROJECTS-PLAN-SUMMARY.md +0 -480
  399. package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +0 -585
  400. package/one/events/QA-CHECKLIST.md +0 -692
  401. package/one/events/QUALITY-AGENT-SUMMARY.md +0 -334
  402. package/one/events/QUALITY-EXECUTION-CHECKLIST.md +0 -593
  403. package/one/events/QUICK-REFERENCE-FRONTEND-TESTING.md +0 -475
  404. package/one/events/QUICK-START-ONTOLOGY.md +0 -426
  405. package/one/events/QUICK_START_REDESIGN-20251106-080938.md +0 -400
  406. package/one/events/README-PROBLEM-SOLVER.md +0 -394
  407. package/one/events/README-archived.md +0 -537
  408. package/one/events/README_QUICK_START_REDESIGN-20251106-080938.md +0 -484
  409. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +0 -657
  410. package/one/events/SEARCH_DEMO_DELIVERY.md +0 -433
  411. package/one/events/SEARCH_DEMO_SUMMARY.md +0 -321
  412. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +0 -399
  413. package/one/events/SECURITY-AUDIT-FIXES.md +0 -394
  414. package/one/events/SECURITY-SCAN-COMPLETE.md +0 -299
  415. package/one/events/SHOP-BUILD-STATUS.md +0 -132
  416. package/one/events/SHOP-PREMIUM-UPDATE.md +0 -165
  417. package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +0 -280
  418. package/one/events/SITE-WIDE-GRADIENT-FIX.md +0 -317
  419. package/one/events/SPECIALIST-QUICK-REFERENCE.md +0 -678
  420. package/one/events/STORE-PRODUCTION-READY-STATUS.md +0 -377
  421. package/one/events/STRIPE-INTEGRATION.md +0 -432
  422. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +0 -447
  423. package/one/events/STRIPE-SETUP-GUIDE.md +0 -480
  424. package/one/events/TEST-PLAN-INDEX.md +0 -364
  425. package/one/events/TEST-PLAN.md +0 -1435
  426. package/one/events/TEST-SUMMARY.md +0 -411
  427. package/one/events/TESTING-DELIVERY.txt +0 -372
  428. package/one/events/TESTS-QUICK-REF.md +0 -280
  429. package/one/events/TRANSITIONS-QUICK-START.md +0 -159
  430. package/one/events/TRANSPARENCY-FIXES.md +0 -293
  431. package/one/events/TYPESCRIPT_FIXES.md +0 -170
  432. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +0 -412
  433. package/one/events/TYPESCRIPT_FIXES_INDEX.md +0 -359
  434. package/one/events/VERIFICATION_CHECKLIST-20251106-080938.md +0 -326
  435. package/one/events/VIEW-TRANSITIONS.md +0 -446
  436. package/one/events/agent-command-implementation.md +0 -305
  437. package/one/events/agent-director-enhancement-summary.md +0 -404
  438. package/one/events/agent-director-routing-update.md +0 -214
  439. package/one/events/agent-onboard-implementation-summary.md +0 -475
  440. package/one/events/agent-ontology-alignment-completion.md +0 -263
  441. package/one/events/ai-integration-complete.md +0 -294
  442. package/one/events/ai-integration-lessons-learned.md +0 -511
  443. package/one/events/backend-integration-tests.md +0 -624
  444. package/one/events/backend-structure-diagram.txt +0 -393
  445. package/one/events/backend-structure-summary.txt +0 -269
  446. package/one/events/bullfm-video-podcast-analysis.md +0 -319
  447. package/one/events/clean-agent-ontology-cleanup-report.md +0 -371
  448. package/one/events/clean-agent-todo-analysis-summary.md +0 -336
  449. package/one/events/cloudflare-automation-complete.md +0 -350
  450. package/one/events/cloudflare-pages-infrastructure-setup.md +0 -282
  451. package/one/events/contact-page-complete.md +0 -316
  452. package/one/events/convex-analysis-index.md +0 -322
  453. package/one/events/convex-structure-analysis.md +0 -718
  454. package/one/events/creation-instructions-9-todos.md +0 -906
  455. package/one/events/cycle-3-video-player-port-20251108.md +0 -368
  456. package/one/events/cycle-3-video-player-port-complete-20251108.md +0 -334
  457. package/one/events/deployment-installation-folders.md +0 -178
  458. package/one/events/deployment-ops-summary.md +0 -386
  459. package/one/events/deployment-verification.md +0 -366
  460. package/one/events/design-spec-complete.md +0 -226
  461. package/one/events/documentation-audit-index.md +0 -473
  462. package/one/events/documentation-audit-summary.md +0 -417
  463. package/one/events/documentation-improvement-roadmap.md +0 -906
  464. package/one/events/documentation-standards-compliance-report.md +0 -538
  465. package/one/events/documentation-updates.md +0 -370
  466. package/one/events/events.md +0 -563
  467. package/one/events/fix-product-hydration-20251106.md +0 -211
  468. package/one/events/frontend-effects-complete.md +0 -584
  469. package/one/events/frontend-effects-orchestration.md +0 -1356
  470. package/one/events/frontend-effects-risk-register.md +0 -1055
  471. package/one/events/frontend-effects-week1-assignments.md +0 -1594
  472. package/one/events/hook-ontology-alignment-summary.md +0 -528
  473. package/one/events/installation-folders-workflow-integration.md +0 -458
  474. package/one/events/landing-page-generator.md +0 -476
  475. package/one/events/legal-assessment-2025-10-16.md +0 -1917
  476. package/one/events/master-coordination-plan.json +0 -1078
  477. package/one/events/master-plan-9-todos.md +0 -900
  478. package/one/events/mobile-performance-optimization.md +0 -179
  479. package/one/events/onboarding-implementation-complete.md +0 -523
  480. package/one/events/ontology-audit-agent-clone.md +0 -323
  481. package/one/events/ontology-test-examples.md +0 -580
  482. package/one/events/phase1-backend-implementation-complete.md +0 -536
  483. package/one/events/plan-completion-audit.md +0 -707
  484. package/one/events/plan-files-updated.md +0 -273
  485. package/one/events/production-readiness-plan.md +0 -389
  486. package/one/events/readme.md +0 -100
  487. package/one/events/release.md +0 -272
  488. package/one/events/root-cleanup-alignment-report.md +0 -265
  489. package/one/events/security-fixes-2025-01-15.md +0 -226
  490. package/one/events/separate-implementation-status.md +0 -555
  491. package/one/events/server-command-optimization-20251108.md +0 -150
  492. package/one/events/session-summary-2025-10-18.md +0 -366
  493. package/one/events/skills-complete.md +0 -351
  494. package/one/events/skills-infer-6-10-summary.md +0 -70
  495. package/one/events/skills-phase1-complete.md +0 -281
  496. package/one/events/specialist-assignments.md +0 -766
  497. package/one/events/structural-analysis-architecture-vs-plans.md +0 -600
  498. package/one/events/test-dashboard.md +0 -363
  499. package/one/events/test-index.md +0 -421
  500. package/one/events/test-report-ontology.md +0 -611
  501. package/one/events/testing-summary.md +0 -388
  502. package/one/events/todo-agent-builder.md +0 -1180
  503. package/one/events/todo-agent-director.md +0 -164
  504. package/one/events/todo-agent-documenter.md +0 -1815
  505. package/one/events/todo-agent-frontend.md +0 -1542
  506. package/one/events/todo-agent-problem-solver.md +0 -1682
  507. package/one/events/todo-agent-quality.md +0 -1647
  508. package/one/events/todo-refactoring-complete.md +0 -408
  509. package/one/events/wave1-backend-implementation-complete.md +0 -698
  510. package/one/events/web-AI_INTEGRATION_PHASE2_SUMMARY-20251111-152540.md +0 -529
  511. package/one/events/web-BUY-IN-CHATGPT-README-20251116-235241.md +0 -491
  512. package/one/events/web-CHARTS-IMPLEMENTATION-20251106-080939.md +0 -576
  513. package/one/events/web-CHARTS-QUICKSTART-20251106-080939.md +0 -416
  514. package/one/events/web-CODE-HIGHLIGHTING-SUMMARY-20251111-152540.md +0 -442
  515. package/one/events/web-DEPLOYMENT_SUMMARY-20251116-005428.md +0 -290
  516. package/one/events/web-DESIGN-SUMMARY-20251106-080939.md +0 -514
  517. package/one/events/web-README-AI-INTEGRATION-20251111-152540.md +0 -196
  518. package/one/events/web-RECHARTS-INTEGRATION-20251111-152540.md +0 -265
  519. package/one/events/web-RELEASE_OPTIMIZATION_PLAN-20251116-005428.md +0 -447
  520. package/one/events/web-TEST-CLEANUP-20251105-143205.md +0 -3
  521. package/one/events/web-USING-ANY-COMPONENT-IN-CHAT-20251111-152540.md +0 -561
  522. package/one/events/web-test-code-highlighting-20251111-152540.md +0 -231
  523. package/one/groups/features.md +0 -2904
  524. package/one/groups/groups.md +0 -587
  525. package/one/groups/one.md +0 -619
  526. package/one/groups/strategy-copy.md +0 -887
  527. package/one/learning/.obsidian/app.json +0 -1
  528. package/one/learning/.obsidian/appearance.json +0 -1
  529. package/one/learning/.obsidian/core-plugins.json +0 -33
  530. package/one/learning/.obsidian/ecommerce-ontology.md +0 -210
  531. package/one/learning/.obsidian/workspace.json +0 -211
  532. package/one/learning/100-inference-quick-reference.md +0 -449
  533. package/one/learning/ag-ui-protocol.md +0 -613
  534. package/one/learning/agent-onboard-usage.md +0 -630
  535. package/one/learning/agentic-commerce.md +0 -146
  536. package/one/learning/ai-agents-vs-memecoins-thesis.md +0 -683
  537. package/one/learning/ai-api-reference.md +0 -715
  538. package/one/learning/ai-platform.md +0 -323
  539. package/one/learning/ai-quickstart.md +0 -355
  540. package/one/learning/ai-sdk-implementation.md +0 -436
  541. package/one/learning/ai-token-crypto-analysis-framework.md +0 -1191
  542. package/one/learning/ai-token-paradigm-shift-2025.md +0 -732
  543. package/one/learning/altcoin-cycle-prediction-ontology.md +0 -884
  544. package/one/learning/altcoin-cycle-trading-strategy.md +0 -642
  545. package/one/learning/architecture-any-backend.md +0 -1589
  546. package/one/learning/architecture-diagram.md +0 -404
  547. package/one/learning/architecture-frontend.md +0 -1014
  548. package/one/learning/architecture.md +0 -1742
  549. package/one/learning/archived/ontology.old.md +0 -2840
  550. package/one/learning/astro-effect-complete-vision.md +0 -2148
  551. package/one/learning/astro-effect-simple-architecture.md +0 -750
  552. package/one/learning/audit-agent-onboard-alignment.md +0 -481
  553. package/one/learning/audit-agent-sales-alignment.md +0 -444
  554. package/one/learning/backend-api-reference.md +0 -728
  555. package/one/learning/cascading-context-specification.md +0 -1617
  556. package/one/learning/claude-code-integration.md +0 -1293
  557. package/one/learning/cli-claude-handoff.md +0 -736
  558. package/one/learning/context-engineering.md +0 -610
  559. package/one/learning/crypto-analysis-strategy.md +0 -1276
  560. package/one/learning/crypto-cycle-2024-2025-analysis.md +0 -44
  561. package/one/learning/crypto.md +0 -978
  562. package/one/learning/develop/design.md +0 -364
  563. package/one/learning/develop/index.md +0 -145
  564. package/one/learning/development-commands.md +0 -251
  565. package/one/learning/docs.md +0 -627
  566. package/one/learning/dsl.md +0 -1678
  567. package/one/learning/event-driven-documentation.md +0 -270
  568. package/one/learning/files.md +0 -2489
  569. package/one/learning/frontend.md +0 -1056
  570. package/one/learning/games-english.md +0 -691
  571. package/one/learning/games.md +0 -1082
  572. package/one/learning/generative-ui-patterns.md +0 -559
  573. package/one/learning/guidelines.md +0 -314
  574. package/one/learning/hono.md +0 -2127
  575. package/one/learning/implementation-examples.md +0 -2554
  576. package/one/learning/installation-folders.md +0 -366
  577. package/one/learning/institutional-cycle-paradigm-2025.md +0 -555
  578. package/one/learning/knowledge.md +0 -660
  579. package/one/learning/language.md +0 -998
  580. package/one/learning/lessons-learned.md +0 -378
  581. package/one/learning/lessons-website-building-focus.md +0 -382
  582. package/one/learning/merge-report.md +0 -254
  583. package/one/learning/metadata-system.md +0 -504
  584. package/one/learning/nine-padel-playbook.md +0 -229
  585. package/one/learning/one-protocol-ai-agents.md +0 -892
  586. package/one/learning/one-protocol-executive-report.md +0 -617
  587. package/one/learning/one-protocol-standard.md +0 -869
  588. package/one/learning/one-protocol-whitepaper.md +0 -756
  589. package/one/learning/ontology-blog.yaml +0 -47
  590. package/one/learning/ontology-cheatsheet.md +0 -617
  591. package/one/learning/ontology-community.yaml +0 -65
  592. package/one/learning/ontology-core-universal.md +0 -740
  593. package/one/learning/ontology-core.yaml +0 -63
  594. package/one/learning/ontology-courses.yaml +0 -76
  595. package/one/learning/ontology-creator.md +0 -402
  596. package/one/learning/ontology-crypto.md +0 -1603
  597. package/one/learning/ontology-developer-guide.md +0 -814
  598. package/one/learning/ontology-documentation.md +0 -377
  599. package/one/learning/ontology-ecommerce.md +0 -269
  600. package/one/learning/ontology-education-game.md +0 -1654
  601. package/one/learning/ontology-education.md +0 -938
  602. package/one/learning/ontology-engineering-specification.md +0 -1310
  603. package/one/learning/ontology-engineering.md +0 -1676
  604. package/one/learning/ontology-files.yaml +0 -525
  605. package/one/learning/ontology-frontend-master.md +0 -2898
  606. package/one/learning/ontology-frontend-specifications.md +0 -2196
  607. package/one/learning/ontology-frontend.md +0 -2475
  608. package/one/learning/ontology-index.md +0 -397
  609. package/one/learning/ontology-minimal.yaml +0 -301
  610. package/one/learning/ontology-portfolio.yaml +0 -45
  611. package/one/learning/ontology-quickstart.md +0 -602
  612. package/one/learning/ontology-release.md +0 -317
  613. package/one/learning/ontology-shop.yaml +0 -148
  614. package/one/learning/ontology-tokens.yaml +0 -51
  615. package/one/learning/ontology-tutorial.md +0 -455
  616. package/one/learning/ontology-v2.md +0 -4449
  617. package/one/learning/ontology-video-script.md +0 -939
  618. package/one/learning/ontology-visual-guide.md +0 -378
  619. package/one/learning/ontology.md +0 -3847
  620. package/one/learning/ontology.yaml +0 -1653
  621. package/one/learning/parallel-agents.md +0 -932
  622. package/one/learning/patterns/backend/convex-mutation-pattern.md +0 -130
  623. package/one/learning/patterns/backend/convex-query-pattern.md +0 -143
  624. package/one/learning/patterns/backend/mutation-template.md +0 -249
  625. package/one/learning/patterns/backend/query-template.md +0 -286
  626. package/one/learning/patterns/backend/service-template.md +0 -258
  627. package/one/learning/patterns/design/component-architecture.md +0 -435
  628. package/one/learning/patterns/design/index.md +0 -160
  629. package/one/learning/patterns/design/test-driven-design-pattern.md +0 -196
  630. package/one/learning/patterns/design/wireframe-template.md +0 -250
  631. package/one/learning/patterns/frontend/component-template.md +0 -246
  632. package/one/learning/patterns/frontend/form-template.md +0 -348
  633. package/one/learning/patterns/frontend/page-template.md +0 -209
  634. package/one/learning/patterns/frontend/react-component-pattern.md +0 -188
  635. package/one/learning/patterns/test/acceptance-criteria-template.md +0 -396
  636. package/one/learning/patterns/test/technical-test-template.md +0 -566
  637. package/one/learning/patterns/test/test-driven-pattern.md +0 -160
  638. package/one/learning/patterns/test/user-flow-template.md +0 -272
  639. package/one/learning/performance.md +0 -459
  640. package/one/learning/provider-agnostic-content.md +0 -995
  641. package/one/learning/provider-creation-guide.md +0 -1082
  642. package/one/learning/quality-loop.md +0 -419
  643. package/one/learning/quick-start-ontology-mapping.md +0 -773
  644. package/one/learning/readme-architecture.md +0 -158
  645. package/one/learning/readme.md +0 -149
  646. package/one/learning/rules.md +0 -644
  647. package/one/learning/score.md +0 -85
  648. package/one/learning/specifications.md +0 -873
  649. package/one/learning/tags.md +0 -148
  650. package/one/learning/todo-template.md +0 -269
  651. package/one/learning/todo.md +0 -269
  652. package/one/learning/troubleshooting.md +0 -434
  653. package/one/learning/typescript-patterns.md +0 -321
  654. package/one/learning/universal-generation-language.md +0 -827
  655. package/one/learning/x402-research.md +0 -104
  656. package/one/license.md +0 -107
  657. package/one/paths/a2a.md +0 -600
  658. package/one/paths/acp.md +0 -808
  659. package/one/paths/acps.md +0 -749
  660. package/one/paths/agentkit.md +0 -367
  661. package/one/paths/agui.md +0 -785
  662. package/one/paths/any-backend.md +0 -1720
  663. package/one/paths/ap2.md +0 -1072
  664. package/one/paths/api/queries-reference.md +0 -860
  665. package/one/paths/api-docs.md +0 -1909
  666. package/one/paths/api-reference.md +0 -1029
  667. package/one/paths/api.md +0 -2208
  668. package/one/paths/architecture-diagram.md +0 -112
  669. package/one/paths/communications.md +0 -467
  670. package/one/paths/connections.md +0 -357
  671. package/one/paths/copilotkit.md +0 -1577
  672. package/one/paths/cryptonetworks.md +0 -799
  673. package/one/paths/documentation.md +0 -1138
  674. package/one/paths/effect.md +0 -297
  675. package/one/paths/elizaos.md +0 -1308
  676. package/one/paths/groups.md +0 -814
  677. package/one/paths/inference.md +0 -76
  678. package/one/paths/integration-examples.md +0 -893
  679. package/one/paths/integration-guide.md +0 -887
  680. package/one/paths/integration-phase2.md +0 -754
  681. package/one/paths/kyc.md +0 -650
  682. package/one/paths/mcp.md +0 -860
  683. package/one/paths/membership.md +0 -1170
  684. package/one/paths/middleware.md +0 -1085
  685. package/one/paths/multitenant.md +0 -1359
  686. package/one/paths/n8n.md +0 -1033
  687. package/one/paths/patterns.md +0 -107
  688. package/one/paths/protocols.md +0 -297
  689. package/one/paths/relationships.md +0 -125
  690. package/one/paths/schema.md +0 -605
  691. package/one/paths/service-layer.md +0 -568
  692. package/one/paths/vectors.md +0 -225
  693. package/one/paths/wordpress.md +0 -1320
  694. package/one/paths/workflow-copy.md +0 -923
  695. package/one/paths/workflow-examples.md +0 -759
  696. package/one/paths/workflow-onboarding.md +0 -701
  697. package/one/paths/workflow.md +0 -923
  698. package/one/paths/workflows/delegation.md +0 -903
  699. package/one/paths/workflows/frontend.md +0 -1055
  700. package/one/paths/workflows/strategy.md +0 -921
  701. package/one/paths/workflows/tasks.md +0 -716
  702. package/one/paths/x402-baazar.md +0 -131
  703. package/one/paths/x402.md +0 -1353
  704. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
  705. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
  706. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
  707. package/one/things/CHECKLIST.md +0 -407
  708. package/one/things/IMPLEMENTATION_STATUS.md +0 -379
  709. package/one/things/ONE.md +0 -529
  710. package/one/things/agents/agent-backend.md +0 -1501
  711. package/one/things/agents/agent-builder.md +0 -1064
  712. package/one/things/agents/agent-clean.md +0 -1112
  713. package/one/things/agents/agent-clone.md +0 -1324
  714. package/one/things/agents/agent-deploy.md +0 -986
  715. package/one/things/agents/agent-designer.md +0 -2305
  716. package/one/things/agents/agent-director.md +0 -1526
  717. package/one/things/agents/agent-documenter.md +0 -1129
  718. package/one/things/agents/agent-frontend.md +0 -1201
  719. package/one/things/agents/agent-integrator.md +0 -1269
  720. package/one/things/agents/agent-lawyer.md +0 -1371
  721. package/one/things/agents/agent-problem-solver.md +0 -1457
  722. package/one/things/agents/agent-quality.md +0 -1483
  723. package/one/things/agents/agent-sales.md +0 -1074
  724. package/one/things/cascade/cascade.yaml +0 -481
  725. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
  726. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
  727. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
  728. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
  729. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
  730. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
  731. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
  732. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
  733. package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
  734. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
  735. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
  736. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
  737. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
  738. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
  739. package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
  740. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
  741. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
  742. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
  743. package/one/things/cascade/docs/examples/readme.md +0 -259
  744. package/one/things/cascade/docs/getting-started.md +0 -533
  745. package/one/things/cascade/docs/workflow.md +0 -1378
  746. package/one/things/cascade/readme.md +0 -379
  747. package/one/things/cascade/templates/feature-template.md +0 -289
  748. package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
  749. package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
  750. package/one/things/claude/agents/analyst.md +0 -508
  751. package/one/things/claude/agents/architect.md +0 -505
  752. package/one/things/claude/agents/brand-identity-specialist.md +0 -538
  753. package/one/things/claude/agents/bstp-token-strategist.md +0 -690
  754. package/one/things/claude/agents/builder-repo.md +0 -532
  755. package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
  756. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
  757. package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
  758. package/one/things/claude/agents/company-bullstamp-character.md +0 -602
  759. package/one/things/claude/agents/company-bullstamp-community.md +0 -307
  760. package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
  761. package/one/things/claude/agents/company-bullstamp-token.md +0 -307
  762. package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
  763. package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
  764. package/one/things/claude/agents/content-calendar-planner.md +0 -473
  765. package/one/things/claude/agents/content-chapter-formatter.md +0 -513
  766. package/one/things/claude/agents/content-formatter.md +0 -571
  767. package/one/things/claude/agents/content-hook-specialist.md +0 -485
  768. package/one/things/claude/agents/content-image-formatter.md +0 -560
  769. package/one/things/claude/agents/content-introduction-formatter.md +0 -510
  770. package/one/things/claude/agents/content-multiplication-engine.md +0 -579
  771. package/one/things/claude/agents/content-playbook-writer.md +0 -473
  772. package/one/things/claude/agents/content-team-manager.md +0 -647
  773. package/one/things/claude/agents/content-toc-formatter.md +0 -547
  774. package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
  775. package/one/things/claude/agents/core-manager.md +0 -607
  776. package/one/things/claude/agents/core-master.md +0 -426
  777. package/one/things/claude/agents/cross-functional-manager.md +0 -476
  778. package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
  779. package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
  780. package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
  781. package/one/things/claude/agents/crypto-community-analyst.md +0 -314
  782. package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
  783. package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
  784. package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
  785. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
  786. package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
  787. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
  788. package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
  789. package/one/things/claude/agents/crypto-market-researcher.md +0 -307
  790. package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
  791. package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
  792. package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
  793. package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
  794. package/one/things/claude/agents/crypto-team-manager.md +0 -392
  795. package/one/things/claude/agents/crypto-token-analyst.md +0 -319
  796. package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
  797. package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
  798. package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
  799. package/one/things/claude/agents/customer-journey-designer.md +0 -474
  800. package/one/things/claude/agents/customer-success-manager.md +0 -574
  801. package/one/things/claude/agents/dev.md +0 -406
  802. package/one/things/claude/agents/documenter.md +0 -548
  803. package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
  804. package/one/things/claude/agents/engagement-specialist.md +0 -502
  805. package/one/things/claude/agents/engineering-architect.md +0 -387
  806. package/one/things/claude/agents/engineering-business-analyst.md +0 -527
  807. package/one/things/claude/agents/engineering-developer.md +0 -386
  808. package/one/things/claude/agents/engineering-director.md +0 -322
  809. package/one/things/claude/agents/engineering-ingestor.md +0 -659
  810. package/one/things/claude/agents/engineering-product-manager.md +0 -525
  811. package/one/things/claude/agents/engineering-product-owner.md +0 -527
  812. package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
  813. package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
  814. package/one/things/claude/agents/engineering-team-manager.md +0 -515
  815. package/one/things/claude/agents/engineering-user-experience.md +0 -386
  816. package/one/things/claude/agents/framework-elevate-manager.md +0 -309
  817. package/one/things/claude/agents/improver.md +0 -805
  818. package/one/things/claude/agents/intelligence-team-manager.md +0 -390
  819. package/one/things/claude/agents/lead-capture-expert.md +0 -459
  820. package/one/things/claude/agents/lead-magnet-creator.md +0 -446
  821. package/one/things/claude/agents/market-research-analyst.md +0 -435
  822. package/one/things/claude/agents/marketing-brand-identity.md +0 -344
  823. package/one/things/claude/agents/marketing-content-hooks.md +0 -455
  824. package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
  825. package/one/things/claude/agents/marketing-content-poster.md +0 -372
  826. package/one/things/claude/agents/marketing-customer-journey.md +0 -331
  827. package/one/things/claude/agents/marketing-director.md +0 -402
  828. package/one/things/claude/agents/marketing-engagement.md +0 -331
  829. package/one/things/claude/agents/marketing-lead-capture.md +0 -331
  830. package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
  831. package/one/things/claude/agents/marketing-network-effects.md +0 -331
  832. package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
  833. package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
  834. package/one/things/claude/agents/marketing-team-manager.md +0 -451
  835. package/one/things/claude/agents/marketing-viral-growth.md +0 -232
  836. package/one/things/claude/agents/mission-commander.md +0 -378
  837. package/one/things/claude/agents/network-effect-analyst.md +0 -604
  838. package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
  839. package/one/things/claude/agents/npx.md +0 -946
  840. package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
  841. package/one/things/claude/agents/one-master.md +0 -378
  842. package/one/things/claude/agents/one-orchestrator.md +0 -345
  843. package/one/things/claude/agents/one.md +0 -658
  844. package/one/things/claude/agents/playbook-generator.md +0 -526
  845. package/one/things/claude/agents/pm.md +0 -349
  846. package/one/things/claude/agents/po.md +0 -370
  847. package/one/things/claude/agents/qa.md +0 -361
  848. package/one/things/claude/agents/research-foundation-analyst.md +0 -324
  849. package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
  850. package/one/things/claude/agents/research-market-analyst.md +0 -324
  851. package/one/things/claude/agents/research-team-manager.md +0 -489
  852. package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
  853. package/one/things/claude/agents/sales-team-manager.md +0 -407
  854. package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
  855. package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
  856. package/one/things/claude/agents/service-advocacy-manager.md +0 -324
  857. package/one/things/claude/agents/service-success-manager.md +0 -324
  858. package/one/things/claude/agents/service-team-manager.md +0 -405
  859. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
  860. package/one/things/claude/agents/share-optimization-specialist.md +0 -576
  861. package/one/things/claude/agents/sm.md +0 -352
  862. package/one/things/claude/agents/story-teller.md +0 -498
  863. package/one/things/claude/agents/task-master.md +0 -621
  864. package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
  865. package/one/things/claude/agents/tester.md +0 -595
  866. package/one/things/claude/agents/the-bull-character-manager.md +0 -603
  867. package/one/things/claude/agents/tools-playbook-generator.md +0 -492
  868. package/one/things/claude/agents/turbo-repo-builder.md +0 -346
  869. package/one/things/claude/agents/upsell-strategist.md +0 -503
  870. package/one/things/claude/agents/ux-expert.md +0 -360
  871. package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
  872. package/one/things/claude/claude-code-hooks-development.json +0 -21
  873. package/one/things/claude/claude-code-hooks-production.json +0 -21
  874. package/one/things/claude/claude-code-hooks.json +0 -25
  875. package/one/things/claude/commands/agent.md +0 -124
  876. package/one/things/claude/commands/cascade-status.md +0 -153
  877. package/one/things/claude/commands/ingest.md +0 -343
  878. package/one/things/claude/commands/ingestor.md +0 -158
  879. package/one/things/claude/commands/mission.md +0 -103
  880. package/one/things/claude/commands/npx.md +0 -156
  881. package/one/things/claude/commands/one.md +0 -486
  882. package/one/things/claude/commands/quality-check.md +0 -252
  883. package/one/things/claude/commands/smart-route.md +0 -261
  884. package/one/things/claude/commands/start.md +0 -139
  885. package/one/things/claude/commands/story.md +0 -103
  886. package/one/things/claude/commands/task.md +0 -193
  887. package/one/things/claude/hook-bypass.json +0 -32
  888. package/one/things/claude/hooks/agent-hook-config.json +0 -427
  889. package/one/things/claude/hooks/build-hook.sh +0 -156
  890. package/one/things/claude/hooks/cleanup-hook.sh +0 -201
  891. package/one/things/claude/hooks/file-organization-hook.sh +0 -80
  892. package/one/things/claude/hooks/format-hook.sh +0 -43
  893. package/one/things/claude/hooks/hook-bypass.sh +0 -293
  894. package/one/things/claude/hooks/hook-debouncer.sh +0 -62
  895. package/one/things/claude/hooks/hook-logger.sh +0 -89
  896. package/one/things/claude/hooks/lint-hook.sh +0 -140
  897. package/one/things/claude/hooks/notification-hook.sh +0 -204
  898. package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
  899. package/one/things/claude/hooks/performance-metrics.json +0 -25
  900. package/one/things/claude/hooks/security-hook.sh +0 -256
  901. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
  902. package/one/things/claude/hooks/story-validation-hook.sh +0 -145
  903. package/one/things/claude/hooks/test-hook.sh +0 -145
  904. package/one/things/claude/hooks/test-story-validation.sh +0 -170
  905. package/one/things/claude/settings-local.json +0 -86
  906. package/one/things/cli/cli-code.md +0 -677
  907. package/one/things/cli/cli-compiler-code.md +0 -677
  908. package/one/things/cli/cli.md +0 -871
  909. package/one/things/components/card-shadcn.md +0 -953
  910. package/one/things/components/card.md +0 -1041
  911. package/one/things/components.md +0 -1743
  912. package/one/things/componets.md +0 -19
  913. package/one/things/contracts/Move.toml +0 -12
  914. package/one/things/contracts/README.md +0 -288
  915. package/one/things/contracts/one.move +0 -762
  916. package/one/things/contracts/sdk.ts +0 -579
  917. package/one/things/creator-diagram.md +0 -184
  918. package/one/things/crypto/FEATURES.md +0 -78
  919. package/one/things/crypto/ONECORE.md +0 -62
  920. package/one/things/crypto/ONECOREFAQ.md +0 -22
  921. package/one/things/crypto/ONECOREHOW.md +0 -46
  922. package/one/things/crypto/ONEENTERPRISE.md +0 -64
  923. package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
  924. package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
  925. package/one/things/crypto/ONEPRO.md +0 -60
  926. package/one/things/crypto/ONEPROFAQ.md +0 -22
  927. package/one/things/crypto/ONEPROHOW.md +0 -53
  928. package/one/things/crypto/READMEAGENCY.md +0 -64
  929. package/one/things/crypto/VSL.md +0 -45
  930. package/one/things/crypto/WebsiteCopy.md +0 -176
  931. package/one/things/demo-accessibility-animations.md +0 -1025
  932. package/one/things/demo-components.md +0 -1310
  933. package/one/things/demo-design-summary.md +0 -692
  934. package/one/things/demo-design-system.md +0 -973
  935. package/one/things/demo-page-layouts.md +0 -1016
  936. package/one/things/design-system.md +0 -832
  937. package/one/things/designs/accessibility-audit.md +0 -877
  938. package/one/things/designs/component-specifications.md +0 -855
  939. package/one/things/designs/design-overview.md +0 -377
  940. package/one/things/designs/design-tokens.md +0 -448
  941. package/one/things/designs/wireframes-dashboard.md +0 -710
  942. package/one/things/docs/api-requests.md +0 -987
  943. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
  944. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
  945. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
  946. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
  947. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
  948. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
  949. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
  950. package/one/things/docs/ecommerce/QUICK-START.md +0 -405
  951. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
  952. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
  953. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
  954. package/one/things/docs/ecommerce/demo.astro +0 -309
  955. package/one/things/examples/children/lemonade-stand.md +0 -404
  956. package/one/things/examples/enterprise/crm-saas.md +0 -1444
  957. package/one/things/features/1-1-agent-prompts.md +0 -562
  958. package/one/things/features/1-2-yaml-orchestrator.md +0 -548
  959. package/one/things/features/1-3-event-coordination.md +0 -547
  960. package/one/things/features/1-4-knowledge-management.md +0 -652
  961. package/one/things/features/1-5-quality-loops.md +0 -725
  962. package/one/things/features/1-6-numbering-structure.md +0 -639
  963. package/one/things/features/2-1-dataprovider-interface.md +0 -2583
  964. package/one/things/features/2-2-config-system.md +0 -3242
  965. package/one/things/features/2-3-effectts-services.md +0 -1645
  966. package/one/things/features/2-4-react-hooks.md +0 -2136
  967. package/one/things/features/2-5-auth-migration.md +0 -2144
  968. package/one/things/features/2-6-dashboard-migration.md +0 -2084
  969. package/one/things/features/2-7-alternative-providers.md +0 -2578
  970. package/one/things/features/2-7-implementation-report.md +0 -724
  971. package/one/things/features/2-cli.md +0 -1720
  972. package/one/things/features/2-design.md +0 -1770
  973. package/one/things/features/2-tests.md +0 -576
  974. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
  975. package/one/things/features/DECOUPLING.md +0 -290
  976. package/one/things/features/DEPLOYMENT.md +0 -470
  977. package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
  978. package/one/things/features/improve.md +0 -861
  979. package/one/things/features/remove-convex-deps.md +0 -63
  980. package/one/things/features/top-features.md +0 -87
  981. package/one/things/features/use-one-backend.md +0 -1217
  982. package/one/things/features-in-english.md +0 -200
  983. package/one/things/files.yaml +0 -721
  984. package/one/things/ideas/1-create-workflow.md +0 -207
  985. package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
  986. package/one/things/implementation/backend-guide.md +0 -457
  987. package/one/things/interface.md +0 -257
  988. package/one/things/landing-page-implementation.md +0 -455
  989. package/one/things/legal/README.md +0 -234
  990. package/one/things/legal/privacy-policy.md +0 -1227
  991. package/one/things/legal/terms-of-service.md +0 -1432
  992. package/one/things/master-workflow-plan.md +0 -806
  993. package/one/things/pay.one.ie.md +0 -53
  994. package/one/things/plans/0-in-sync.md +0 -136
  995. package/one/things/plans/0-timeline.md +0 -36
  996. package/one/things/plans/1-create-workflow.md +0 -732
  997. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
  998. package/one/things/plans/README-SIMPLIFICATION.md +0 -349
  999. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
  1000. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
  1001. package/one/things/plans/ai-elements-integration.md +0 -483
  1002. package/one/things/plans/ai-elements.md +0 -1278
  1003. package/one/things/plans/ai-integration-plan.md +0 -263
  1004. package/one/things/plans/ai-integration.md +0 -996
  1005. package/one/things/plans/ai-sdk.md +0 -798
  1006. package/one/things/plans/ai-tools.md +0 -621
  1007. package/one/things/plans/app.md +0 -832
  1008. package/one/things/plans/architecture-summary.md +0 -312
  1009. package/one/things/plans/async-ai-agents.md +0 -233
  1010. package/one/things/plans/backend-agnostic-frontend.md +0 -390
  1011. package/one/things/plans/backend-cleanup-quickstart.md +0 -380
  1012. package/one/things/plans/backend-ontology-conformance.md +0 -475
  1013. package/one/things/plans/backend-status.md +0 -599
  1014. package/one/things/plans/backend-structure.md +0 -847
  1015. package/one/things/plans/backend-target-structure.md +0 -482
  1016. package/one/things/plans/backend.md +0 -1175
  1017. package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
  1018. package/one/things/plans/better-auth-any-backend.md +0 -1896
  1019. package/one/things/plans/better-auth-available-features.md +0 -273
  1020. package/one/things/plans/big-plan.md +0 -52
  1021. package/one/things/plans/cli-updates-required.md +0 -320
  1022. package/one/things/plans/complete-step-by-step.md +0 -1409
  1023. package/one/things/plans/components.md +0 -709
  1024. package/one/things/plans/convex-agents.md +0 -1034
  1025. package/one/things/plans/convex-better-auth.md +0 -1141
  1026. package/one/things/plans/convex-on-off.md +0 -407
  1027. package/one/things/plans/crypto-token-researcher.md +0 -629
  1028. package/one/things/plans/data-quality-metrics.md +0 -745
  1029. package/one/things/plans/deep-researcher-agent.md +0 -466
  1030. package/one/things/plans/deploy-to-cloudflare.md +0 -623
  1031. package/one/things/plans/deployment-architecture.md +0 -469
  1032. package/one/things/plans/desktop.md +0 -1139
  1033. package/one/things/plans/development-plan.md +0 -1283
  1034. package/one/things/plans/development-workflow-tldr.md +0 -207
  1035. package/one/things/plans/development-workflow.md +0 -959
  1036. package/one/things/plans/dsl-claude-code.md +0 -1011
  1037. package/one/things/plans/effect-components.md +0 -1743
  1038. package/one/things/plans/effect-patterns-reference.md +0 -2235
  1039. package/one/things/plans/effect.md +0 -1806
  1040. package/one/things/plans/email.md +0 -966
  1041. package/one/things/plans/enhance-auth.md +0 -1692
  1042. package/one/things/plans/execution-strategy.md +0 -1291
  1043. package/one/things/plans/existing-infrastructure.md +0 -712
  1044. package/one/things/plans/feature-based-sites.md +0 -894
  1045. package/one/things/plans/frontend-effects.md +0 -1276
  1046. package/one/things/plans/group-folder-multi-tenancy.md +0 -893
  1047. package/one/things/plans/improve-codebase.md +0 -1811
  1048. package/one/things/plans/install-components.md +0 -215
  1049. package/one/things/plans/integrate-frontend-and-backend.md +0 -603
  1050. package/one/things/plans/landing.md +0 -820
  1051. package/one/things/plans/layout.md +0 -249
  1052. package/one/things/plans/mail-backend.md +0 -1361
  1053. package/one/things/plans/mail.md +0 -2677
  1054. package/one/things/plans/mcp-clear-context-prompt.md +0 -81
  1055. package/one/things/plans/mcp-simple.md +0 -248
  1056. package/one/things/plans/multi-ontology-architecture.md +0 -885
  1057. package/one/things/plans/next-features.md +0 -114
  1058. package/one/things/plans/npx-agent-safety.md +0 -785
  1059. package/one/things/plans/npx-agent.md +0 -1089
  1060. package/one/things/plans/onboarding.md +0 -51
  1061. package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
  1062. package/one/things/plans/one.md +0 -677
  1063. package/one/things/plans/ontology-6-dimensions.md +0 -2201
  1064. package/one/things/plans/ontology-compliance-audit.md +0 -342
  1065. package/one/things/plans/ontology-driven-strategy.md +0 -882
  1066. package/one/things/plans/ontology-refine.md +0 -586
  1067. package/one/things/plans/ontology-ui-approach.md +0 -375
  1068. package/one/things/plans/open-agent.md +0 -840
  1069. package/one/things/plans/performace.md +0 -122
  1070. package/one/things/plans/phase-1-foundation.md +0 -620
  1071. package/one/things/plans/phase-3-implementation.md +0 -1037
  1072. package/one/things/plans/plan-connect-to-api.md +0 -146
  1073. package/one/things/plans/quick-wins.md +0 -1428
  1074. package/one/things/plans/r2.md +0 -777
  1075. package/one/things/plans/readme-backend-cleanup.md +0 -402
  1076. package/one/things/plans/release.md +0 -507
  1077. package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
  1078. package/one/things/plans/repos.md +0 -98
  1079. package/one/things/plans/separate-copy-2.md +0 -1349
  1080. package/one/things/plans/separate-copy-3.md +0 -2479
  1081. package/one/things/plans/separate-copy.md +0 -1349
  1082. package/one/things/plans/separate-demo.md +0 -864
  1083. package/one/things/plans/separate.md +0 -1999
  1084. package/one/things/plans/sequence.md +0 -2040
  1085. package/one/things/plans/shadcn-integration-summary.md +0 -510
  1086. package/one/things/plans/sidebar.md +0 -206
  1087. package/one/things/plans/skills.md +0 -709
  1088. package/one/things/plans/small-fixes.md +0 -23
  1089. package/one/things/plans/start-new.md +0 -764
  1090. package/one/things/plans/switch-off-auth.md +0 -42
  1091. package/one/things/plans/sync-checklist.md +0 -351
  1092. package/one/things/plans/test-backend-connection.md +0 -514
  1093. package/one/things/plans/unified-implementation-plan.md +0 -934
  1094. package/one/things/plans/update-demos.md +0 -581
  1095. package/one/things/plans/use-our-backend.md +0 -572
  1096. package/one/things/plans/video-backend.md +0 -638
  1097. package/one/things/plans/video-frontend.md +0 -490
  1098. package/one/things/plans/video-old-archived.md +0 -656
  1099. package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
  1100. package/one/things/plans/wave1-onboarding-vision.md +0 -744
  1101. package/one/things/plans/wave1-orchestration-summary.md +0 -604
  1102. package/one/things/plans/wave1-specialist-assignments.md +0 -1413
  1103. package/one/things/plans/workflow-files.md +0 -1210
  1104. package/one/things/plans/workflow.md +0 -1378
  1105. package/one/things/plans-u.md +0 -905
  1106. package/one/things/products/Blockchain Products.md +0 -6278
  1107. package/one/things/products/cascade-landing-page.md +0 -841
  1108. package/one/things/products/cascade.md +0 -1568
  1109. package/one/things/products/context-engineering.md +0 -1488
  1110. package/one/things/products/onthology.md +0 -15
  1111. package/one/things/products/ontology-ui-shadcn.md +0 -1302
  1112. package/one/things/products/ontology-ui.md +0 -1429
  1113. package/one/things/products/ontology.md +0 -789
  1114. package/one/things/products/sdk.md +0 -573
  1115. package/one/things/promptkit.md +0 -930
  1116. package/one/things/repos/all-repos.md +0 -0
  1117. package/one/things/scripts-clean-mac.sh +0 -409
  1118. package/one/things/service-providers-new.md +0 -1052
  1119. package/one/things/service-providers.md +0 -1121
  1120. package/one/things/structure.md +0 -532
  1121. package/one/things/system.md +0 -618
  1122. package/one/things/templates.md +0 -294
  1123. package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
  1124. package/one/things/tests/2-1-test-analysis.md +0 -544
  1125. package/one/things/things.md +0 -384
  1126. package/one/things/todo-acp-integration.md +0 -744
  1127. package/one/things/todo-ai.md +0 -933
  1128. package/one/things/todo-api.md +0 -1078
  1129. package/one/things/todo-assignment.md +0 -580
  1130. package/one/things/todo-buy-chatgpt.md +0 -1450
  1131. package/one/things/todo-components.md +0 -1683
  1132. package/one/things/todo-connections.md +0 -278
  1133. package/one/things/todo-ecommerce-frontend.md +0 -1313
  1134. package/one/things/todo-ecommerce.md +0 -569
  1135. package/one/things/todo-effects.md +0 -1075
  1136. package/one/things/todo-frontend-effects.md +0 -977
  1137. package/one/things/todo-landing-page.md +0 -1091
  1138. package/one/things/todo-mail.md +0 -1160
  1139. package/one/things/todo-master-plan.md +0 -490
  1140. package/one/things/todo-onboard.md +0 -666
  1141. package/one/things/todo-one-ie.md +0 -538
  1142. package/one/things/todo-page.md +0 -606
  1143. package/one/things/todo-plans.md +0 -282
  1144. package/one/things/todo-projects.md +0 -241
  1145. package/one/things/todo-refactoring-plan.md +0 -366
  1146. package/one/things/todo-release.md +0 -654
  1147. package/one/things/todo-sequence.md +0 -1621
  1148. package/one/things/todo-use-our-backend.md +0 -1908
  1149. package/one/things/todo-workflow.md +0 -626
  1150. package/one/things/todo-x402.md +0 -2047
  1151. package/one/things/todo.md +0 -21
  1152. package/one/things/video/scripts-crypto.md +0 -835
  1153. package/one/things/video-script-backup.md +0 -318
  1154. package/one/things/video-script-demo.md +0 -382
  1155. package/one/things/video-script-ontology.md +0 -333
  1156. package/one/things/video-script.md +0 -361
@@ -1,4449 +0,0 @@
1
- ---
2
- title: Ontology
3
- dimension: knowledge
4
- category: ontology.md
5
- tags: 6-dimensions, ai, architecture, ontology
6
- related_dimensions: connections, events, groups, people, things
7
- scope: global
8
- created: 2025-11-25
9
- updated: 2025-11-25
10
- version: 2.0.0
11
- ai_context: |
12
- This document is part of the knowledge dimension in the ontology.md category.
13
- Location: one/knowledge/ontology-v2.md
14
- Purpose: Documents one platform - ontology specification v2
15
- Related dimensions: connections, events, groups, people, things
16
- For AI agents: Read this to understand ontology.
17
- ---
18
-
19
- # ONE Platform - Ontology Specification V2
20
-
21
- **Version:** 2.0.0 (Reality as DSL - The Universal Code Generation Language)
22
- **Status:** Active - Reality-Aware Architecture
23
- **Design Principle:** This isn't just a data model. It's a Domain-Specific Language (DSL) that models reality itself, enabling 98% AI code generation accuracy through compound structure.
24
-
25
- ---
26
-
27
- ## Why This Changes Everything
28
-
29
- ### The Breakthrough: Reality as DSL
30
-
31
- **Most developers think databases model their application.**
32
-
33
- We flipped this. **The 6-dimension ontology models reality itself**. Applications map to it.
34
-
35
- This enables:
36
-
37
- - **98% AI code generation accuracy** (not 30-70%)
38
- - **Compound structure** (each feature makes the next MORE accurate, not less)
39
- - **Universal feature import** (clone ANY system into the ontology)
40
- - **Never breaks** (reality doesn't change, technology does)
41
-
42
- ### What AI Sees
43
-
44
- **Traditional Codebase (Pattern Divergence):**
45
-
46
- ```
47
- Feature 1: createUser(email) ────────┐
48
- Feature 2: addProduct(name) ─────────┼─→ 100 patterns
49
- Feature 3: registerCustomer(data) ───┤ AI confused
50
- Feature 4: insertOrder(items) ───────┤ Accuracy: 30%
51
- ...each uses different approach
52
- ```
53
-
54
- **ONE Codebase (Pattern Convergence):**
55
-
56
- ```
57
- Feature 1: provider.things.create({ type: "user" }) ────┐
58
- Feature 2: provider.things.create({ type: "product" }) ─┼─→ 1 pattern
59
- Feature 3: provider.things.create({ type: "customer" })─┤ AI masters it
60
- Feature 4: provider.things.create({ type: "order" }) ───┤ Accuracy: 98%
61
- ...all use same pattern
62
- ```
63
-
64
- **The difference:** Traditional codebases teach AI 100 patterns (chaos). ONE teaches AI 1 pattern (mastery).
65
-
66
- ### Why This Never Breaks
67
-
68
- **Reality is stable. Technology changes.**
69
-
70
- The 6 dimensions model reality:
71
-
72
- 1. **Groups** - Containers exist (friend circles → governments)
73
- 2. **People** - Actors authorize (who can do what)
74
- 3. **Things** - Entities exist (users, products, courses, agents)
75
- 4. **Connections** - Relationships relate (owns, purchased, enrolled_in)
76
- 5. **Events** - Actions happen (created, updated, purchased)
77
- 6. **Knowledge** - Understanding emerges (embeddings, search, RAG)
78
-
79
- These dimensions NEVER change because they model reality itself, not any specific technology.
80
-
81
- **Examples of systems that map perfectly:**
82
-
83
- - **Shopify** → Products (things), Orders (connections + events), Customers (people)
84
- - **Moodle** → Courses (things), Enrollments (connections), Completions (events)
85
- - **Stripe** → Payments (things), Transactions (connections + events), Customers (people)
86
- - **WordPress** → Posts (things), Authors (people), Categories (knowledge labels)
87
-
88
- **Every system maps to the same 6 dimensions.** That's why AI agents achieve 98% accuracy.
89
-
90
- ---
91
-
92
- ## Structure
93
-
94
- This ontology is organized into 6 dimension files:
95
-
96
- 1. **[organisation.md](./organisation.md)** - Multi-tenant isolation & ownership
97
- 2. **[people.md](./people.md)** - Authorization, governance, & user customization
98
- 3. **[things.md](./things.md)** - 66 entity types (what exists)
99
- 4. **[connections.md](./connections.md)** - 25 relationship types (how they relate)
100
- 5. **[events.md](./events.md)** - 67 event types (what happened)
101
- 6. **[knowledge.md](./knowledge.md)** - Vectors, embeddings, RAG (what it means)
102
-
103
- **Execution Guide:**
104
-
105
- 7. **[todo.md](./todo.md)** - 100-cycle execution sequence (plan in cycles, not days)
106
-
107
- **This document (Ontology.md)** contains the complete technical specification. The consolidated files above provide focused summaries and patterns.
108
-
109
- **Planning Paradigm:** We don't plan in days. We plan in **cycle passes** (Cycle 1-100). See [todo.md](./todo.md) for the complete 100-cycle template that guides feature implementation from idea to production.
110
-
111
- ## The 6-Dimension Reality Model
112
-
113
- **This is the universal interface.** Every feature in every system maps to these 6 dimensions.
114
-
115
- **Every single thing in ONE platform exists within one of these 6 dimensions:**
116
-
117
- ```
118
- ┌──────────────────────────────────────────────────────────────┐
119
- │ 1. GROUPS │
120
- │ Multi-tenant isolation with hierarchical nesting - who owns │
121
- │ what at group level (friend circles → DAOs → governments) │
122
- └──────────────────────────────────────────────────────────────┘
123
- ↓
124
- ┌──────────────────────────────────────────────────────────────┐
125
- │ 2. PEOPLE │
126
- │ Authorization & governance - platform owner, group owners │
127
- └──────────────────────────────────────────────────────────────┘
128
- ↓
129
- ┌──────────────────────────────────────────────────────────────┐
130
- │ 3. THINGS │
131
- │ Every "thing" - users, agents, content, tokens, courses │
132
- └──────────────────────────────────────────────────────────────┘
133
- ↓
134
- ┌──────────────────────────────────────────────────────────────┐
135
- │ 4. CONNECTIONS │
136
- │ Every relationship - owns, follows, taught_by, powers │
137
- └──────────────────────────────────────────────────────────────┘
138
- ↓
139
- ┌──────────────────────────────────────────────────────────────┐
140
- │ 5. EVENTS │
141
- │ Every action - purchased, created, viewed, completed │
142
- └──────────────────────────────────────────────────────────────┘
143
- ↓
144
- ┌──────────────────────────────────────────────────────────────┐
145
- │ 6. KNOWLEDGE │
146
- │ Labels + chunks + vectors powering RAG & search │
147
- └──────────────────────────────────────────────────────────────┘
148
- ```
149
-
150
- **The Universal Interface (How Technology Implements the Ontology):**
151
-
152
- ```
153
- ┌─────────────────────────────────────────────────────────────────────┐
154
- │ LAYER 1: UNIVERSAL INTERFACE │
155
- │ (The 6-Dimension DSL) │
156
- ├─────────────────────────────────────────────────────────────────────┤
157
- │ groups → Hierarchical containers (friend circles → governments)│
158
- │ people → Authorization & governance (who can do what) │
159
- │ things → All entities (66 types: user, product, course...) │
160
- │ connections → All relationships (25 types: owns, purchased...) │
161
- │ events → All actions (67 types: created, updated, logged...) │
162
- │ knowledge → AI understanding (embeddings, search, RAG) │
163
- │ │
164
- │ This layer NEVER changes. It models reality. │
165
- └──────────────────┬──────────────────────────────────────────────────┘
166
- │
167
- ↓ Technology changes, ontology stays the same
168
-
169
- ┌─────────────────────────────────────────────────────────────────────┐
170
- │ TECHNOLOGY ADAPTERS (swap freely) │
171
- │ (Convex, Hono, Astro, React, etc.) │
172
- ├─────────────────────────────────────────────────────────────────────┤
173
- │ Backend: Hono API + Convex Database (implements ontology) │
174
- │ Frontend: Astro SSR + React Islands (renders ontology) │
175
- │ Real-time: Convex hooks (live ontology subscriptions) │
176
- │ Static: Astro Content Collections (ontology as files) │
177
- │ │
178
- │ Technology can be swapped. Ontology stays the same. │
179
- └─────────────────────────────────────────────────────────────────────┘
180
- ```
181
-
182
- ### Dimension 1: Groups (Containers)
183
-
184
- **Purpose:** Partition the system with hierarchical nesting (friend circles → DAOs → governments)
185
-
186
- **Why it never changes:** Containers always contain things. Whether it's a lemonade stand or a global government, the concept of "container" is universal.
187
-
188
- **Pattern for AI:**
189
-
190
- ```typescript
191
- // AI learns: Everything belongs to a group
192
- provider.things.create({ groupId, type, name, properties });
193
- ```
194
-
195
- **Example mappings:**
196
-
197
- - Shopify Store → group (type: business)
198
- - Moodle School → group (type: organization)
199
- - DAO Treasury → group (type: dao)
200
- - Friend Circle → group (type: friend_circle)
201
-
202
- ### Dimension 2: People (Authorization)
203
-
204
- **Purpose:** Define who can do what (actors, roles, permissions)
205
-
206
- **Why it never changes:** Authorization is a universal concept. Someone always performs actions.
207
-
208
- **Pattern for AI:**
209
-
210
- ```typescript
211
- // AI learns: Every action has an actor
212
- events.log({ actorId: personId, type, targetId });
213
- ```
214
-
215
- **Example mappings:**
216
-
217
- - Shopify Admin → person (role: org_owner)
218
- - Moodle Student → person (role: customer)
219
- - Platform Owner → person (role: platform_owner)
220
- - Team Member → person (role: org_user)
221
-
222
- ### Dimension 3: Things (Entities)
223
-
224
- **Purpose:** All nouns in the system (66 types, infinitely extensible)
225
-
226
- **Why it never changes:** Entities exist. Users, products, courses, agents—these are all "things" with different types.
227
-
228
- **Pattern for AI:**
229
-
230
- ```typescript
231
- // AI learns: One pattern for all entities
232
- provider.things.create({ type: "product" | "course" | "user" | ..., name, properties })
233
- ```
234
-
235
- **Example mappings:**
236
-
237
- - Shopify Product → thing (type: product)
238
- - Moodle Course → thing (type: course)
239
- - Stripe Payment → thing (type: payment)
240
- - WordPress Post → thing (type: blog_post)
241
-
242
- **New entity type?** Just add to `properties`. No schema migration needed.
243
-
244
- ### Dimension 4: Connections (Relationships)
245
-
246
- **Purpose:** How entities relate to each other (25 types + metadata)
247
-
248
- **Why it never changes:** Relationships are universal. Things connect to other things.
249
-
250
- **Pattern for AI:**
251
-
252
- ```typescript
253
- // AI learns: One pattern for all relationships
254
- provider.connections.create({
255
- fromThingId,
256
- toThingId,
257
- relationshipType,
258
- metadata,
259
- });
260
- ```
261
-
262
- **Example mappings:**
263
-
264
- - Shopify Order → connection (type: purchased) + event (type: order_placed)
265
- - Moodle Enrollment → connection (type: enrolled_in)
266
- - GitHub Follows → connection (type: following)
267
- - Token Holdings → connection (type: holds_tokens, metadata: { balance })
268
-
269
- ### Dimension 5: Events (Actions)
270
-
271
- **Purpose:** Complete audit trail of what happened when (67 types + metadata)
272
-
273
- **Why it never changes:** Actions happen at specific times. This is universal.
274
-
275
- **Pattern for AI:**
276
-
277
- ```typescript
278
- // AI learns: All actions are logged the same way
279
- provider.events.log({ type, actorId, targetId, timestamp, metadata });
280
- ```
281
-
282
- **Example mappings:**
283
-
284
- - Shopify Checkout → event (type: payment_processed)
285
- - Moodle Lesson View → event (type: content_viewed)
286
- - User Login → event (type: user_login)
287
- - Token Purchase → event (type: tokens_purchased)
288
-
289
- ### Dimension 6: Knowledge (Understanding)
290
-
291
- **Purpose:** Labels, embeddings, and semantic search for AI
292
-
293
- **Why it never changes:** Categorization and understanding are universal concepts.
294
-
295
- **Pattern for AI:**
296
-
297
- ```typescript
298
- // AI learns: Knowledge is linked to things
299
- provider.knowledge.create({
300
- sourceThingId,
301
- knowledgeType: "label" | "chunk",
302
- text,
303
- embedding,
304
- });
305
- ```
306
-
307
- **Example mappings:**
308
-
309
- - WordPress Categories → knowledge (type: label)
310
- - Course Content → knowledge (type: chunk, embedding: [...])
311
- - Product Tags → knowledge (type: label)
312
- - Semantic Search → knowledge vector search
313
-
314
- ---
315
-
316
- **Golden Rule:** If you can't map your feature to these 6 dimensions, you're thinking about it wrong.
317
-
318
- **For AI Agents:** This ontology is your universal language. Learn these 6 patterns and you can generate ANY feature with 98% accuracy.
319
-
320
- ---
321
-
322
- ## Compound Structure Accuracy: Why AI Gets Better Over Time
323
-
324
- ### Traditional AI Code Generation (Pattern Divergence)
325
-
326
- **The death spiral:**
327
-
328
- ```
329
- Generation 1: Clean code → 95% accurate
330
- Generation 2: Slight drift → 90% accurate (-5% - patterns starting to diverge)
331
- Generation 3: Pattern divergence → 80% accurate (-10% - AI sees multiple patterns)
332
- Generation 4: Inconsistency → 65% accurate (-15% - AI confused by variations)
333
- Generation N: Unmaintainable mess → 30% accurate (-20% - complete chaos)
334
- ```
335
-
336
- **Why?** Each feature introduces NEW patterns. AI has to guess which pattern to use.
337
-
338
- ### ONE's AI Code Generation (Pattern Convergence)
339
-
340
- **The virtuous cycle:**
341
-
342
- ```
343
- Generation 1: Maps to ontology → 85% accurate (learning the ontology)
344
- Generation 2: Follows patterns → 90% accurate (+5% - recognizing service pattern)
345
- Generation 3: Reuses services → 93% accurate (+3% - composing existing services)
346
- Generation 4: Predictable structure → 96% accurate (+3% - mastering Effect.ts patterns)
347
- Generation N: Perfect consistency → 98%+ accurate (+2% - generalized patterns)
348
- ```
349
-
350
- **Why?** Each feature uses the SAME patterns. AI masters the ontology, then reuses it.
351
-
352
- ### How Agents Learn the Ontology
353
-
354
- **Generation 1-5: Learning (85% accurate)**
355
-
356
- ```
357
- Agent thinks:
358
- "I see things being created with `type` field. Let me check..."
359
- "All entities are things? Even users, products, courses?"
360
- "Connections link things together. Got it."
361
- "Events log actions. People are actors."
362
- "Pattern emerging: 6 dimensions for everything."
363
- CONFIDENCE: 85% (still learning)
364
- ```
365
-
366
- **Generation 6-20: Recognizing (90% accurate)**
367
-
368
- ```
369
- Agent thinks:
370
- "Every create operation uses provider.things.create. 100% of the time."
371
- "Every service uses Effect.gen. Pattern confirmed."
372
- "All errors are tagged unions. I can handle exhaustively."
373
- "Dependencies are injected. I know what's needed."
374
- CONFIDENCE: 90% (pattern recognized)
375
- ```
376
-
377
- **Generation 21-50: Composing (93% accurate)**
378
-
379
- ```
380
- Agent thinks:
381
- "I can reuse existing services:"
382
- "- createThing service exists"
383
- "- createConnection service exists"
384
- "- logEvent service exists"
385
- "My new feature: compose these three services."
386
- "No new patterns needed. Just composition."
387
- CONFIDENCE: 93% (composing existing patterns)
388
- ```
389
-
390
- **Generation 51-100: Mastering (96% accurate)**
391
-
392
- ```
393
- Agent thinks:
394
- "I've generated 50 services. All follow same structure:"
395
- "1. Get provider from context"
396
- "2. Call provider operation"
397
- "3. Handle typed errors"
398
- "4. Return typed result"
399
- "Pattern is UNIVERSAL. Works for ANY feature."
400
- CONFIDENCE: 96% (mastered the structure)
401
- ```
402
-
403
- **Generation 100+: Generalizing (98%+ accurate)**
404
-
405
- ```
406
- Agent thinks:
407
- "I don't even need to think. The pattern IS the system."
408
- "New feature request? Map to 6 dimensions."
409
- "Need validation? Effect.ts service."
410
- "Need data? Provider interface."
411
- "Need state? Nanostores."
412
- "Every decision is deterministic."
413
- CONFIDENCE: 98%+ (system internalized)
414
- ```
415
-
416
- ### What This Means for Development
417
-
418
- **Feature #1:**
419
-
420
- - Traditional: 8 hours (70% AI, 30% human)
421
- - ONE: 8 hours (70% AI, 30% human)
422
- - **No difference yet**
423
-
424
- **Feature #10:**
425
-
426
- - Traditional: 10 hours (60% AI, 40% human - patterns diverging)
427
- - ONE: 6 hours (85% AI, 15% human - patterns converging)
428
- - **ONE is 1.7x faster**
429
-
430
- **Feature #50:**
431
-
432
- - Traditional: 16 hours (40% AI, 60% human - technical debt)
433
- - ONE: 3 hours (95% AI, 5% human - pattern mastery)
434
- - **ONE is 5.3x faster**
435
-
436
- **Feature #100:**
437
-
438
- - Traditional: 24 hours (25% AI, 75% human - chaos)
439
- - ONE: 1.5 hours (98% AI, 2% human - generalized)
440
- - **ONE is 16x faster**
441
-
442
- **Cumulative for 100 features:**
443
-
444
- - Traditional: 1,400 hours
445
- - ONE: 350 hours
446
- - **ONE is 4x faster overall**
447
- - **And the gap keeps growing**
448
-
449
- ### Why Schema Migrations Never Break This
450
-
451
- **New entity type?**
452
-
453
- ```typescript
454
- // NO schema migration needed
455
- { type: "new_thing", name: "...", properties: { ...custom } }
456
- ```
457
-
458
- **New field on existing type?**
459
-
460
- ```typescript
461
- // NO schema migration needed
462
- { type: "product", properties: { price, SKU, newField: "value" } }
463
- ```
464
-
465
- **New relationship?**
466
-
467
- ```typescript
468
- // NO schema migration needed
469
- { relationshipType: "new_connection", metadata: { ...custom } }
470
- ```
471
-
472
- **New protocol integration?**
473
-
474
- ```typescript
475
- // NO schema migration needed
476
- {
477
- relationshipType: "transacted",
478
- metadata: { protocol: "new_protocol", ...custom }
479
- }
480
- ```
481
-
482
- **Result:** Technology changes (React → Svelte, REST → GraphQL), but the ontology stays the same forever.
483
-
484
- ---
485
-
486
- ## GROUPS: The Isolation Boundary with Hierarchical Nesting
487
-
488
- Purpose: Partition the system with perfect isolation and support nested groups (groups within groups) - from friend circles to DAOs to governments. Every group owns its own graph of things, connections, events, and knowledge.
489
-
490
- ### Group Structure
491
-
492
- ```typescript
493
- {
494
- _id: Id<'groups'>,
495
- slug: string, // REQUIRED: URL identifier (/group/slug)
496
- name: string, // REQUIRED: Display name
497
- type: 'friend_circle' | 'business' | 'community' | 'dao' | 'government' | 'organization',
498
- parentGroupId?: Id<'groups'>, // OPTIONAL: Parent group for hierarchical nesting
499
- description?: string, // OPTIONAL: About text
500
-
501
- metadata: Record<string, any>,
502
-
503
- settings: {
504
- visibility: 'public' | 'private',
505
- joinPolicy: 'open' | 'invite_only' | 'approval_required',
506
- plan: 'starter' | 'pro' | 'enterprise',
507
- limits: {
508
- users: number,
509
- storage: number, // GB
510
- apiCalls: number,
511
- }
512
- },
513
-
514
- status: 'active' | 'archived',
515
- createdAt: number,
516
- updatedAt: number,
517
- }
518
- ```
519
-
520
- ### Common Fields by Use Case
521
-
522
- **Identity:** `[slug, name]` - Who they are + URL
523
- **Web:** `[slug, name, description]` - Website generation
524
- **Operations:** `[status, type, settings, parentGroupId]` - System management
525
-
526
- ### Why Groups Matter
527
-
528
- 1. **Multi-Tenant Isolation:** Each group's data is completely separate
529
- 2. **Hierarchical Nesting:** Groups can contain sub-groups for complex organizations (parent → child → grandchild...)
530
- 3. **Flexible Types:** From friend circles (2 people) to businesses to DAOs to governments (billions)
531
- 4. **Resource Quotas:** Control costs and usage per group
532
- 5. **Privacy Control:** Groups can be public or private with controlled access
533
- 6. **Flexible Scale:** Scales from friend circles to global governments without schema changes
534
-
535
- ### Hierarchical Group Examples by Domain
536
-
537
- **E-Commerce (Retail Chain):**
538
-
539
- ```
540
- Corporate Headquarters (group)
541
- ├─ North American Division (child group)
542
- │ ├─ New York Store (grandchild group)
543
- │ └─ California Store (grandchild group)
544
- └─ European Division (child group)
545
- ├─ London Store (grandchild group)
546
- └─ Paris Store (grandchild group)
547
- ```
548
-
549
- **Education (University System):**
550
-
551
- ```
552
- MIT (group)
553
- ├─ School of Engineering (child group)
554
- │ ├─ Computer Science Dept (grandchild group)
555
- │ ├─ Electrical Engineering Dept (grandchild group)
556
- │ └─ Mechanical Engineering Dept (grandchild group)
557
- ├─ School of Science (child group)
558
- │ ├─ Mathematics Dept (grandchild group)
559
- │ └─ Physics Dept (grandchild group)
560
- └─ School of Business (child group)
561
- ```
562
-
563
- **Creator (Multi-Channel Brand):**
564
-
565
- ```
566
- Creator Brand (group)
567
- ├─ YouTube Channel (child group)
568
- │ └─ Content Series 1 (grandchild group)
569
- ├─ Podcast (child group)
570
- │ └─ Season 2 (grandchild group)
571
- └─ Community (child group - Discord server with channels)
572
- ```
573
-
574
- **Crypto (DAO Treasury):**
575
-
576
- ```
577
- DAO Treasury (group)
578
- ├─ Core Operations (child group)
579
- │ ├─ Development Fund (grandchild group)
580
- │ └─ Marketing Fund (grandchild group)
581
- ├─ Investment Committee (child group)
582
- │ └─ Venture Capital Allocation (grandchild group)
583
- └─ Community Grants (child group)
584
- ```
585
-
586
- ---
587
-
588
-
589
- ### System Group Pattern (Global Entities)
590
-
591
- **Problem:** Some entities are truly global and don't belong to any user group.
592
-
593
- **Examples:**
594
- - Platform-wide settings
595
- - System notifications
596
- - Global rate limits
597
- - Reference data (timezones, currencies, countries)
598
- - Platform-level analytics
599
-
600
- **Solution:** Reserve a special "system" group.
601
-
602
- ```typescript
603
- // Create system group on platform initialization
604
- const SYSTEM_GROUP_ID = 'system';
605
-
606
- await ctx.db.insert('groups', {
607
- _id: SYSTEM_GROUP_ID,
608
- slug: 'system',
609
- name: 'System',
610
- type: 'organization',
611
- settings: {
612
- visibility: 'private',
613
- joinPolicy: 'invite_only',
614
- plan: 'enterprise',
615
- limits: { users: Infinity, storage: Infinity, apiCalls: Infinity }
616
- },
617
- status: 'active',
618
- createdAt: Date.now(),
619
- });
620
-
621
- // Use for global entities
622
- await ctx.db.insert('things', {
623
- type: 'platform_setting',
624
- name: 'Global Rate Limit',
625
- groupId: SYSTEM_GROUP_ID, // System group
626
- properties: {
627
- maxRequestsPerMinute: 1000,
628
- scope: 'global'
629
- },
630
- status: 'active',
631
- createdAt: Date.now(),
632
- });
633
- ```
634
-
635
- **Rules:**
636
- - System group ID is reserved and cannot be deleted
637
- - Only platform owners can create things in system group
638
- - System group has no resource limits
639
- - System entities are visible to all groups (read-only)
640
-
641
- ---
642
-
643
- ## PEOPLE: Authorization & Governance
644
-
645
- Purpose: Define who can do what. People direct groups, customize AI agents, and govern access.
646
-
647
- ### Person Structure
648
-
649
- ```typescript
650
- {
651
- _id: Id<'people'>,
652
- email: string,
653
- username: string,
654
- displayName: string,
655
-
656
- // CRITICAL: Role determines access level
657
- role: 'platform_owner' | 'group_owner' | 'group_user' | 'customer',
658
-
659
- // Group context
660
- groupId?: Id<'groups'>, // Current/default group
661
- permissions?: string[],
662
-
663
- // Profile
664
- bio?: string,
665
- avatar?: string,
666
-
667
- // Multi-tenant tracking
668
- groups: Id<'groups'>[], // All groups this person belongs to
669
-
670
- createdAt: number,
671
- updatedAt: number,
672
- }
673
- ```
674
-
675
- ### Four Roles
676
-
677
- 1. **Platform Owner** (Anthony)
678
- - Owns the ONE Platform
679
- - 100% revenue from platform-level services
680
- - Can access all groups (support/debugging)
681
- - Creates new groups
682
-
683
- 2. **Group Owner**
684
- - Owns/manages one or more groups
685
- - Controls users, permissions, billing within group
686
- - Customizes AI agents and frontend
687
- - Revenue sharing with platform
688
-
689
- 3. **Group User**
690
- - Works within a group
691
- - Limited permissions (defined by group owner)
692
- - Can create content, run agents (within quotas)
693
-
694
- 4. **Customer**
695
- - External user consuming content
696
- - Purchases tokens, enrolls in courses
697
- - No admin access
698
-
699
- ### Why People Matter
700
-
701
- 1. **Authorization:** Every action must have an actor (person)
702
- 2. **Governance:** Group owners control who can do what
703
- 3. **Audit Trail:** Events log who did what when
704
- 4. **Customization:** People teach AI agents their preferences
705
-
706
- ---
707
-
708
- ## KNOWLEDGE: Labels, Chunks, and Vectors (RAG)
709
-
710
- Purpose: unify taxonomy (“tags”) and retrieval‑augmented generation (RAG) under one table. A knowledge item can be a label (former tag), a document wrapper, or a chunk with an embedding.
711
-
712
- Design principles:
713
-
714
- - Protocol‑agnostic: store protocol details in `metadata`.
715
- - Many‑to‑many: link knowledge ⇄ things via `thingKnowledge` with optional context metadata.
716
- - Scalable: consolidated types minimize index fan‑out; embeddings enable semantic search.
717
-
718
- ### Knowledge Types
719
-
720
- ```typescript
721
- type KnowledgeType =
722
- | "label" // replaces legacy "tag"; lightweight categorical marker
723
- | "document" // wrapper for a source text/blob (pre-chunking)
724
- | "chunk" // atomic chunk of text with embedding
725
- | "vector_only"; // embedding without stored text (e.g., privacy)
726
- ```
727
-
728
- ### Knowledge Structure
729
-
730
- ```typescript
731
- {
732
- _id: Id<'knowledge'>,
733
- knowledgeType: KnowledgeType,
734
- // Textual content (optional for label/vector_only)
735
- text?: string,
736
- // Embedding for semantic search (optional for label/document)
737
- embedding?: number[], // Float32 vector; model-dependent dimension
738
- embeddingModel?: string, // e.g., "text-embedding-3-large"
739
- embeddingDim?: number,
740
- // Source linkage
741
- sourceThingId?: Id<'things'>, // Primary source entity
742
- sourceField?: string, // e.g., 'content', 'transcript', 'title'
743
- chunk?: { index: number; start?: number; end?: number; tokenCount?: number; overlap?: number },
744
- // Lightweight categorization (free-form)
745
- labels?: string[], // Replaces per-thing tags; applied to knowledge
746
- // Additional metadata (protocol, language, mime, hash, version)
747
- metadata?: Record<string, any>,
748
- createdAt: number,
749
- updatedAt: number,
750
- deletedAt?: number,
751
- }
752
- ```
753
-
754
- ### Junction: thingKnowledge
755
-
756
- ```typescript
757
- {
758
- _id: Id<'thingKnowledge'>,
759
- thingId: Id<'things'>,
760
- knowledgeId: Id<'knowledge'>,
761
- role?: 'label' | 'summary' | 'chunk_of' | 'caption' | 'keyword',
762
- // Context for the link (e.g., confidence, section name)
763
- metadata?: Record<string, any>,
764
- createdAt: number,
765
- }
766
- ```
767
-
768
- ### Indexes (recommended)
769
-
770
- - `knowledge.by_type` (knowledgeType)
771
- - `knowledge.by_source` (sourceThingId)
772
- - `knowledge.by_created` (createdAt)
773
- - `thingKnowledge.by_thing` (thingId)
774
- - `thingKnowledge.by_knowledge` (knowledgeId)
775
- - Vector index (provider-dependent): `knowledge.by_embedding` for ANN search
776
-
777
- ### How Domains Apply Knowledge
778
-
779
- **Education - Learning Objectives & Study Materials:**
780
-
781
- ```typescript
782
- // Knowledge: Learning objective chunk
783
- {
784
- knowledgeType: 'chunk',
785
- text: 'Students should be able to solve quadratic equations',
786
- sourceThingId: courseId,
787
- labels: ['subject:mathematics', 'grade:9-12', 'objective:apply', 'skill:algebra']
788
- }
789
-
790
- // Link: Course references this learning objective
791
- {
792
- thingId: courseId,
793
- knowledgeId: knowledgeId,
794
- role: 'learning_objective'
795
- }
796
- ```
797
-
798
- **Creator - Content SEO & Discovery:**
799
-
800
- ```typescript
801
- // Knowledge: Video description chunk with embedded metadata
802
- {
803
- knowledgeType: 'chunk',
804
- text: 'This video teaches React hooks for beginners...',
805
- sourceThingId: videoId,
806
- embedding: [0.1, 0.2, ...],
807
- labels: ['topic:react', 'difficulty:beginner', 'platform:youtube', 'series:javascript101']
808
- }
809
- ```
810
-
811
- **E-Commerce - Product Categorization & Search:**
812
-
813
- ```typescript
814
- // Knowledge: Product description for semantic search
815
- {
816
- knowledgeType: 'document',
817
- text: 'Blue wireless headphones with 40-hour battery life',
818
- sourceThingId: productId,
819
- embedding: [0.5, 0.3, ...],
820
- labels: ['category:electronics', 'color:blue', 'feature:wireless', 'price_range:premium']
821
- }
822
- ```
823
-
824
- **Crypto - Risk Analysis & Token Intelligence:**
825
-
826
- ```typescript
827
- // Knowledge: Token risk assessment
828
- {
829
- knowledgeType: 'chunk',
830
- text: 'Token has no minting restrictions, moderate holder concentration',
831
- sourceThingId: tokenId,
832
- labels: ['risk:medium', 'metric:tvl_trend_up', 'audit:completed', 'governance:none']
833
- }
834
-
835
- // Knowledge: Protocol dependency analysis
836
- {
837
- knowledgeType: 'label',
838
- text: 'Depends on Chainlink oracle',
839
- sourceThingId: protocolId,
840
- labels: ['dependency:critical', 'type:oracle', 'risk_factor:oracle']
841
- }
842
- ```
843
-
844
- ### RAG Ingestion Strategy
845
-
846
- Objective: Attach vectors to **relevant** content for high-quality retrieval while controlling costs and maintaining performance.
847
-
848
- **CRITICAL:** Not every field needs RAG. Be selective. Embeddings are expensive in storage, compute, and money.
849
-
850
- ---
851
-
852
- #### What to Embed (Decision Matrix by Domain)
853
-
854
- **Universal Rule:**
855
- ```
856
- IF "user will semantically search this" → EMBED
857
- IF "user will filter/sort this" → DON'T EMBED
858
- IF "structured data" → DON'T EMBED
859
- ```
860
-
861
- | Content Type | Embed? | Domain Example | Use Case |
862
- |--------------|--------|----------------|----------|
863
- | **Long-form Content** |||||
864
- | Blog post content | ✅ YES | Creator | "Find posts about React hooks" |
865
- | Course lesson content | ✅ YES | E-Learning | "Search lessons on form validation" |
866
- | Video/podcast transcripts | ✅ YES | E-Learning, Creator | Makes A/V content searchable |
867
- | Email campaign body | ✅ YES | Creator, E-Commerce | Content discovery |
868
- | **Product Content** |||||
869
- | Product descriptions | ✅ YES | E-Commerce | "Find eco-friendly water bottles" |
870
- | Product specs (JSON) | ❌ NO | E-Commerce | Use filters: `size === 'L'` |
871
- | Customer reviews | ✅ YES | E-Commerce | "What do people say about durability?" |
872
- | Q&A responses | ✅ YES | E-Commerce | Customer support knowledge base |
873
- | Prices, SKUs, inventory | ❌ NO | E-Commerce | Exact match: `price < 50` |
874
- | **Social Content** |||||
875
- | Social post text (>100 chars) | ✅ YES | Social | "Find my AI posts with high engagement" |
876
- | Social post text (<100 chars) | ❌ NO | Social | Too short, use labels |
877
- | Thread content (combined) | ✅ YES | Social | Combine into single chunk |
878
- | Hashtags | ❌ NO | Social | Exact match, not semantic |
879
- | Comments (>50 words) | ⚠️ MAYBE | Social | Only for community insights |
880
- | **Image Generation** |||||
881
- | Image prompts | ✅ YES | Image Gen | "Find cyberpunk city prompts" |
882
- | Prompt descriptions | ✅ YES | Image Gen | Style discovery |
883
- | Negative prompts | ✅ YES | Image Gen | "Avoid common mistakes" |
884
- | Generation params | ❌ NO | Image Gen | Use filters: `steps === 50` |
885
- | Image pixels | ❌ NO | Image Gen | Use CLIP embeddings separately |
886
- | **Educational Content** |||||
887
- | Course descriptions | ✅ YES | E-Learning | Discovery + recommendations |
888
- | Lesson summaries | ✅ YES | E-Learning | "React hooks for beginners" |
889
- | Student notes | ✅ YES | E-Learning | Personal knowledge base |
890
- | Quiz questions | ⚠️ MAYBE | E-Learning | Only for study guides |
891
- | Progress data | ❌ NO | E-Learning | Use analytics: `progress >= 0.5` |
892
- | Certificates | ❌ NO | E-Learning | Metadata only |
893
- | **Metadata** |||||
894
- | Titles, summaries | ✅ YES | All | High signal-to-noise |
895
- | Descriptions (>50 words) | ✅ YES | All | Context for search |
896
- | Tags, categories | ❌ NO | All | Use `labels` instead (free) |
897
- | **User-Generated** |||||
898
- | Bios, profiles | ⚠️ MAYBE | Social | Only for people search |
899
- | **System Data** |||||
900
- | Logs, errors | ❌ NO | All | Use log aggregation tools |
901
- | Metrics, analytics | ❌ NO | All | Use time-series DB |
902
- | Audit trails | ❌ NO | All | Events table is sufficient |
903
-
904
- **Domain-Specific Examples:**
905
-
906
- **E-Commerce:**
907
- ```typescript
908
- // ✅ EMBED: Product discovery
909
- "Find sustainable yoga mats" → Semantic search on descriptions
910
-
911
- // ❌ DON'T EMBED: Filtering
912
- "Show mats under $30" → Filter: price < 30
913
- "In stock only" → Filter: inventory > 0
914
- ```
915
-
916
- **E-Learning:**
917
- ```typescript
918
- // ✅ EMBED: Course/lesson discovery
919
- "Learn React hooks for beginners" → Semantic search on course descriptions + lesson transcripts
920
-
921
- // ❌ DON'T EMBED: Progress tracking
922
- "Show my completed courses" → Filter: connections where completed = true
923
- ```
924
-
925
- **Image Generation:**
926
- ```typescript
927
- // ✅ EMBED: Prompt library
928
- "Cyberpunk city at night" → Semantic search on successful prompts
929
-
930
- // ❌ DON'T EMBED: Generation settings
931
- "Images with CFG 7.5" → Filter: metadata.cfg === 7.5
932
- ```
933
-
934
- **Social Posting:**
935
- ```typescript
936
- // ✅ EMBED: Content inspiration
937
- "My posts about AI with high engagement" → Semantic search on post text
938
-
939
- // ❌ DON'T EMBED: Engagement metrics
940
- "Posts with >1000 likes" → Filter: engagement.likes > 1000
941
- ```
942
-
943
- **Cost Reality Check (10K items):**
944
-
945
- | Domain | What to Embed | Monthly Cost |
946
- |--------|---------------|--------------|
947
- | E-Commerce | Product descriptions | ~$1.30 |
948
- | E-Learning | Lesson transcripts | ~$13 (longer content) |
949
- | Image Gen | Prompts + descriptions | ~$0.50 |
950
- | Social | Long posts only | ~$0.80 |
951
-
952
- **Key Insight:** Be ruthlessly selective. Only embed content users will **semantically search**, not data they'll **filter or sort**.
953
-
954
- ---
955
-
956
- #### When to Update Embeddings
957
-
958
- **Trigger:** Content changes in source thing.
959
-
960
- ```typescript
961
- // On content update
962
- export const updateBlogPost = mutation({
963
- handler: async (ctx, { postId, content }) => {
964
- // 1. Update the thing
965
- await ctx.db.patch(postId, {
966
- properties: { content },
967
- updatedAt: Date.now(),
968
- });
969
-
970
- // 2. Schedule re-embedding (debounced)
971
- await ctx.scheduler.runAfter(5000, internal.knowledge.reEmbedThing, {
972
- thingId: postId,
973
- fields: ['content'], // Only re-embed changed fields
974
- });
975
-
976
- // 3. Log event
977
- await ctx.db.insert('events', {
978
- type: 'content_event',
979
- actorId: ctx.auth.userId!,
980
- targetId: postId,
981
- groupId: post.groupId,
982
- timestamp: Date.now(),
983
- metadata: { action: 'updated', triggeredReEmbedding: true },
984
- });
985
- },
986
- });
987
- ```
988
-
989
- **Re-embedding Strategy:**
990
-
991
- | Change Type | Action | Why |
992
- |-------------|--------|-----|
993
- | Content edited | Re-embed immediately | Content changed |
994
- | Title/summary edited | Re-embed immediately | High-signal metadata |
995
- | Tags/labels changed | Update labels only | No embedding needed |
996
- | Status changed (draft→published) | Re-embed if first publish | Visibility changed |
997
- | Minor typo fix | Debounce 5 seconds | Avoid re-embedding every keystroke |
998
- | Bulk import | Batch embed (100/batch) | Rate limiting |
999
-
1000
- **Cost Optimization:**
1001
-
1002
- ```typescript
1003
- // Hash content to detect actual changes
1004
- import { createHash } from 'crypto';
1005
-
1006
- export const reEmbedThing = internalMutation({
1007
- handler: async (ctx, { thingId, fields }) => {
1008
- const thing = await ctx.db.get(thingId);
1009
- const content = fields.map(f => thing.properties[f]).join('\n');
1010
-
1011
- // Hash current content
1012
- const contentHash = createHash('sha256').update(content).digest('hex');
1013
-
1014
- // Check if content actually changed
1015
- const existingKnowledge = await ctx.db
1016
- .query('knowledge')
1017
- .withIndex('by_source')
1018
- .filter(q => q.eq(q.field('sourceThingId'), thingId))
1019
- .first();
1020
-
1021
- if (existingKnowledge?.metadata?.contentHash === contentHash) {
1022
- console.log('Content unchanged, skipping re-embedding');
1023
- return; // Save $$$ by skipping
1024
- }
1025
-
1026
- // Content changed, re-embed
1027
- await embedAndStore(ctx, thing, content, contentHash);
1028
- },
1029
- });
1030
- ```
1031
-
1032
- ---
1033
-
1034
- #### Chunking Standard
1035
-
1036
- **Window:** ~800 tokens (~3,200 characters)
1037
- **Overlap:** ~200 tokens (~800 characters)
1038
- **Boundaries:** Sentence-aware (don't split mid-sentence)
1039
-
1040
- ```typescript
1041
- export async function chunkText(text: string): Promise<Chunk[]> {
1042
- const chunks: Chunk[] = [];
1043
- const sentences = text.split(/[.!?]+\s+/); // Split on sentence boundaries
1044
-
1045
- let currentChunk = '';
1046
- let currentTokens = 0;
1047
- let chunkIndex = 0;
1048
-
1049
- for (const sentence of sentences) {
1050
- const sentenceTokens = estimateTokens(sentence);
1051
-
1052
- if (currentTokens + sentenceTokens > 800 && currentChunk.length > 0) {
1053
- // Save chunk
1054
- chunks.push({
1055
- index: chunkIndex++,
1056
- text: currentChunk.trim(),
1057
- tokenCount: currentTokens,
1058
- start: chunks.length > 0 ? chunks[chunks.length - 1].end - 200 : 0,
1059
- end: currentChunk.length,
1060
- });
1061
-
1062
- // Start new chunk with overlap (last 200 tokens)
1063
- const overlapText = getLastNTokens(currentChunk, 200);
1064
- currentChunk = overlapText + ' ' + sentence;
1065
- currentTokens = 200 + sentenceTokens;
1066
- } else {
1067
- currentChunk += ' ' + sentence;
1068
- currentTokens += sentenceTokens;
1069
- }
1070
- }
1071
-
1072
- // Save final chunk
1073
- if (currentChunk.length > 0) {
1074
- chunks.push({
1075
- index: chunkIndex,
1076
- text: currentChunk.trim(),
1077
- tokenCount: currentTokens,
1078
- start: chunks.length > 0 ? chunks[chunks.length - 1].end - 200 : 0,
1079
- end: currentChunk.length,
1080
- });
1081
- }
1082
-
1083
- return chunks;
1084
- }
1085
- ```
1086
-
1087
- ---
1088
-
1089
- #### Embedding Pipeline
1090
-
1091
- ```typescript
1092
- // 1. Schedule embedding
1093
- export const scheduleEmbeddingForThing = mutation({
1094
- handler: async (ctx, { thingId, fields }) => {
1095
- await ctx.scheduler.runAfter(0, internal.knowledge.embedThing, {
1096
- thingId,
1097
- fields,
1098
- });
1099
- },
1100
- });
1101
-
1102
- // 2. Embed text (internal action - calls OpenAI)
1103
- export const embedText = internalAction({
1104
- handler: async (ctx, { text, model = 'text-embedding-3-large' }) => {
1105
- const response = await openai.embeddings.create({
1106
- model,
1107
- input: text,
1108
- });
1109
- return {
1110
- embedding: response.data[0].embedding,
1111
- dim: response.data[0].embedding.length,
1112
- };
1113
- },
1114
- });
1115
-
1116
- // 3. Store chunks with embeddings
1117
- export const upsertKnowledgeChunks = internalMutation({
1118
- handler: async (ctx, { thingId, chunks, embeddings }) => {
1119
- // Delete old chunks
1120
- const oldChunks = await ctx.db
1121
- .query('knowledge')
1122
- .withIndex('by_source')
1123
- .filter(q => q.eq(q.field('sourceThingId'), thingId))
1124
- .collect();
1125
-
1126
- for (const old of oldChunks) {
1127
- await ctx.db.delete(old._id);
1128
- }
1129
-
1130
- // Insert new chunks
1131
- for (let i = 0; i < chunks.length; i++) {
1132
- const knowledgeId = await ctx.db.insert('knowledge', {
1133
- knowledgeType: 'chunk',
1134
- text: chunks[i].text,
1135
- embedding: embeddings[i].embedding,
1136
- embeddingModel: 'text-embedding-3-large',
1137
- embeddingDim: embeddings[i].dim,
1138
- sourceThingId: thingId,
1139
- chunk: chunks[i],
1140
- metadata: {
1141
- contentHash: chunks[i].hash,
1142
- embeddingVersion: 'v3',
1143
- },
1144
- createdAt: Date.now(),
1145
- });
1146
-
1147
- // Link to thing
1148
- await ctx.db.insert('thingKnowledge', {
1149
- thingId,
1150
- knowledgeId,
1151
- role: 'chunk_of',
1152
- createdAt: Date.now(),
1153
- });
1154
- }
1155
- },
1156
- });
1157
- ```
1158
-
1159
- ---
1160
-
1161
- #### Cost Management
1162
-
1163
- **Embedding Costs (OpenAI text-embedding-3-large):**
1164
- - $0.13 per 1M tokens
1165
- - Average blog post: ~1,000 tokens = $0.00013
1166
- - 1M blog posts embedded: ~$130
1167
-
1168
- **Storage Costs:**
1169
- - 3,072 dimensions × 4 bytes = 12KB per chunk
1170
- - 1M chunks = 12GB of vector data
1171
- - Convex: ~$0.25/GB/month = $3/month per 1M chunks
1172
-
1173
- **Optimization Strategies:**
1174
-
1175
- 1. **Selective Embedding:** Only embed content types with high search value
1176
- 2. **Lazy Embedding:** Embed on first publish, not on draft save
1177
- 3. **Batch Processing:** Embed 100 items at a time to avoid rate limits
1178
- 4. **Content Hashing:** Skip re-embedding if content unchanged
1179
- 5. **Smaller Models:** Use `text-embedding-3-small` (512 dims) for less critical content (75% cost savings)
1180
-
1181
- ---
1182
-
1183
- #### Query & Retrieval
1184
-
1185
- ```typescript
1186
- export const semanticSearch = query({
1187
- args: { query: v.string(), groupId: v.id('groups'), limit: v.number() },
1188
- handler: async (ctx, { query, groupId, limit = 10 }) => {
1189
- // 1. Embed query
1190
- const queryEmbedding = await ctx.runAction(internal.knowledge.embedText, {
1191
- text: query,
1192
- });
1193
-
1194
- // 2. Vector search (filtered by group)
1195
- const results = await ctx.db
1196
- .vectorSearch('knowledge', 'by_embedding', {
1197
- vector: queryEmbedding.embedding,
1198
- limit: limit * 2, // Over-fetch for filtering
1199
- filter: q => q.eq(q.field('knowledgeType'), 'chunk'),
1200
- })
1201
- .collect();
1202
-
1203
- // 3. Filter by group (get source things)
1204
- const groupResults = [];
1205
- for (const result of results) {
1206
- const sourceThing = await ctx.db.get(result.sourceThingId);
1207
- if (sourceThing?.groupId === groupId) {
1208
- groupResults.push({
1209
- ...result,
1210
- score: result._score,
1211
- thing: sourceThing,
1212
- });
1213
- }
1214
- if (groupResults.length >= limit) break;
1215
- }
1216
-
1217
- return groupResults;
1218
- },
1219
- });
1220
- ```
1221
-
1222
- ---
1223
-
1224
- #### Governance & Lifecycle
1225
-
1226
- **Versioning:**
1227
- - Store `metadata.contentHash` of source content
1228
- - If hash unchanged, skip re-embedding
1229
- - Track `metadata.embeddingVersion` for model migrations
1230
-
1231
- **Retention:**
1232
- - Archive old chunks on major content edits (keep last 3 versions)
1233
- - Garbage collect orphaned knowledge items (no thingKnowledge links)
1234
- - Delete embeddings when source thing is hard-deleted
1235
-
1236
- **Quality:**
1237
- - Track `metadata.qualityScore` based on user feedback
1238
- - Monitor search relevance metrics
1239
- - A/B test embedding models
1240
-
1241
- **Summary:** Be ruthlessly selective about what gets embedded. RAG is powerful but expensive. Embed content users will semantically search, not structured data they'll filter.
1242
-
1243
-
1244
- ### Knowledge Governance
1245
-
1246
- Policy: Default is free-form, user-extensible knowledge labels for maximum flexibility and zero schema churn.
1247
-
1248
- - Curated label prefixes (recommended): `skill:*`, `industry:*`, `topic:*`, `format:*`, `goal:*`, `audience:*`, `technology:*`, `status:*`, `capability:*`, `protocol:*`, `payment_method:*`, `network:*`.
1249
- - Validation: Enforce label hygiene (no duplicates within scope); allow synonyms via an alias list if needed.
1250
- - Ownership: Platform/group owners may curate official labels; users can still apply ad‑hoc labels.
1251
- - Hygiene: Periodically consolidate low-usage duplicates; do not delete knowledge items with active references—mark deprecated instead.
1252
-
1253
- ---
1254
-
1255
- ## THINGS: All The "Things"
1256
-
1257
- ### What Goes in Things?
1258
-
1259
- **Simple test:** If you can point at it and say "this is a \_\_\_", it's a thing.
1260
-
1261
- Examples:
1262
-
1263
- - "This is a **creator**" ✅ Thing
1264
- - "This is a **blog post**" ✅ Thing
1265
- - "This is a **token**" ✅ Thing
1266
- - "This is a **relationship**" ❌ Connection, not thing
1267
- - "This is a **purchase**" ❌ Event, not thing
1268
-
1269
- ### Thing Types
1270
-
1271
- **66 Types Organized in 13 Categories:**
1272
-
1273
- ```typescript
1274
- type ThingType =
1275
- // CORE (4)
1276
- | "creator" // Human creator (role: platform_owner, org_owner, org_user, customer)
1277
- | "ai_clone" // Digital twin of creator
1278
- | "audience_member" // Fan/user (role: customer)
1279
- | "organization" // Multi-tenant organization
1280
-
1281
- // BUSINESS AGENTS (10)
1282
- | "strategy_agent" // Vision, planning, OKRs
1283
- | "research_agent" // Market, trends, competitors
1284
- | "marketing_agent" // Content strategy, SEO, distribution
1285
- | "sales_agent" // Funnels, conversion, follow-up
1286
- | "service_agent" // Support, onboarding, success
1287
- | "design_agent" // Brand, UI/UX, assets
1288
- | "engineering_agent" // Tech, integration, automation
1289
- | "finance_agent" // Revenue, costs, forecasting
1290
- | "legal_agent" // Compliance, contracts, IP
1291
- | "intelligence_agent" // Analytics, insights, predictions
1292
-
1293
- // CONTENT (7)
1294
- | "blog_post" // Written content (guides, newsletters, articles)
1295
- | "video" // Video content (lectures, demos, shorts)
1296
- | "podcast" // Audio content (episodes, interviews)
1297
- | "social_post" // Social media post (all platforms)
1298
- | "email" // Email content (campaigns, newsletters)
1299
- | "course" // Educational course (programs, learning paths)
1300
- | "lesson" // Individual lesson (units, modules, segments)
1301
-
1302
- // PRODUCTS (4)
1303
- | "digital_product" // Templates, tools, assets
1304
- | "membership" // Tiered membership (Patreon, Substack)
1305
- | "consultation" // 1-on-1 session (coaching, support)
1306
- | "nft" // NFT collectible (governance, utility)
1307
-
1308
- // COMMUNITY (3)
1309
- | "community" // Community space (Discord, forums)
1310
- | "conversation" // Thread/discussion (boards, channels)
1311
- | "message" // Individual message (chat, DM)
1312
-
1313
- // TOKEN (2)
1314
- | "token" // Actual token instance
1315
- | "token_contract" // Smart contract
1316
-
1317
- // KNOWLEDGE (2)
1318
- | "knowledge_item" // Piece of creator knowledge
1319
- | "embedding" // Vector embedding
1320
-
1321
- // PLATFORM (6)
1322
- | "website" // Auto-generated creator site
1323
- | "landing_page" // Custom landing pages (campaigns, sales)
1324
- | "template" // Design templates (reusable components)
1325
- | "livestream" // Live broadcast (streaming, webinars)
1326
- | "recording" // Saved livestream content
1327
- | "media_asset" // Images, videos, files
1328
-
1329
- // BUSINESS (7)
1330
- | "payment" // Payment transaction
1331
- | "subscription" // Recurring subscription
1332
- | "invoice" // Invoice record
1333
- | "metric" // Tracked metric
1334
- | "insight" // AI-generated insight
1335
- | "prediction" // AI prediction
1336
- | "report" // Analytics report
1337
-
1338
- // AUTHENTICATION & SESSION (5)
1339
- | "session" // User session (Better Auth)
1340
- | "oauth_account" // OAuth connection (GitHub, Google)
1341
- | "verification_token" // Email/2FA verification token
1342
- | "password_reset_token" // Password reset token
1343
- | "ui_preferences" // User UI settings (theme, layout)
1344
-
1345
- // MARKETING (6)
1346
- | "notification" // System notification
1347
- | "email_campaign" // Email marketing campaign
1348
- | "announcement" // Platform announcement
1349
- | "referral" // Referral record
1350
- | "campaign" // Marketing campaign
1351
- | "lead" // Potential customer/lead
1352
-
1353
- // EXTERNAL INTEGRATIONS (3)
1354
- | "external_agent" // External AI agent (ElizaOS)
1355
- | "external_workflow" // External workflow (n8n, Zapier)
1356
- | "external_connection" // Connection config
1357
-
1358
- // PROTOCOL ENTITIES (2, protocol-agnostic)
1359
- | "mandate" // Intent/cart (AP2, shopping)
1360
- | "product"; // Sellable product (ACP marketplace)
1361
- ```
1362
-
1363
- **How Domains Apply These Types:**
1364
-
1365
- - **E-Commerce**: Uses `product` (catalog items), `mandate` (shopping carts), `payment` (transactions), `subscription` (auto-renewals), `membership` (loyalty), `notification` (order updates), `email_campaign` (promotional)
1366
- - **Education**: Uses `course` (programs), `lesson` (units), `community` (cohorts), `assignment` (assessments), `conversation` (discussion boards), `metric` (grades), `report` (transcripts)
1367
- - **Creator**: Uses `video` (YouTube/TikTok), `podcast` (episodes), `blog_post` (newsletters), `membership` (tiers), `course` (products), `email_campaign` (outreach), `metric` (engagement), `insight` (analytics)
1368
- - **Crypto**: Uses `token` (holdings), `token_contract` (smart contracts), `metric` (TVL/volume), `payment` (transfers), `knowledge_item` (risk profiles), `report` (protocol analysis)
1369
-
1370
- ### Thing Structure
1371
-
1372
- ```typescript
1373
- {
1374
- _id: Id<"things">,
1375
- type: ThingType,
1376
- name: string, // Display name
1377
- groupId: Id<"groups">, // REQUIRED: Multi-tenant isolation
1378
- properties: { // Type-specific properties (JSON)
1379
- // For creator:
1380
- email?: string,
1381
- username?: string,
1382
- niche?: string[],
1383
- // For token:
1384
- contractAddress?: string,
1385
- totalSupply?: number,
1386
- // etc...
1387
- },
1388
- status: "active" | "inactive" | "draft" | "published" | "archived",
1389
- createdAt: number,
1390
- updatedAt: number,
1391
- deletedAt?: number
1392
- }
1393
- ```
1394
-
1395
- ### Properties by Thing Type
1396
-
1397
- **Creator Properties:**
1398
-
1399
- ```typescript
1400
- {
1401
- email: string,
1402
- username: string,
1403
- displayName: string,
1404
- bio?: string,
1405
- avatar?: string,
1406
- niche: string[],
1407
- expertise: string[],
1408
- targetAudience: string,
1409
- brandColors?: {
1410
- primary: string,
1411
- secondary: string,
1412
- accent: string
1413
- },
1414
- totalFollowers: number,
1415
- totalContent: number,
1416
- totalRevenue: number,
1417
- // MULTI-TENANT ROLES
1418
- role: "platform_owner" | "group_owner" | "group_user" | "customer",
1419
- groupId?: Id<"groups">, // Current/default group (if group_owner or group_user)
1420
- permissions?: string[], // Additional permissions
1421
- }
1422
- ```
1423
-
1424
- **Organization Properties:**
1425
-
1426
- ```typescript
1427
- {
1428
- name: string,
1429
- slug: string, // URL-friendly identifier
1430
- domain?: string, // Custom domain (e.g., acme.one.ie)
1431
- logo?: string,
1432
- description?: string,
1433
- status: "active" | "suspended" | "trial" | "cancelled",
1434
- plan: "starter" | "pro" | "enterprise",
1435
- limits: {
1436
- users: number, // Max users allowed
1437
- storage: number, // GB
1438
- apiCalls: number, // Per month
1439
- },
1440
- usage: {
1441
- users: number, // Current users
1442
- storage: number, // GB used
1443
- apiCalls: number, // This month
1444
- },
1445
- billing: {
1446
- customerId?: string, // Stripe customer ID
1447
- subscriptionId?: string, // Stripe subscription ID
1448
- currentPeriodEnd?: number,
1449
- },
1450
- settings: {
1451
- allowSignups: boolean,
1452
- requireEmailVerification: boolean,
1453
- enableTwoFactor: boolean,
1454
- allowedDomains?: string[], // Email domain whitelist
1455
- },
1456
- createdAt: number,
1457
- trialEndsAt?: number,
1458
- }
1459
- ```
1460
-
1461
- **AI Clone Properties:**
1462
-
1463
- ```typescript
1464
- {
1465
- voiceId?: string,
1466
- voiceProvider?: "elevenlabs" | "azure" | "custom",
1467
- appearanceId?: string,
1468
- appearanceProvider?: "d-id" | "heygen" | "custom",
1469
- systemPrompt: string,
1470
- temperature: number,
1471
- knowledgeBaseSize: number,
1472
- lastTrainingDate: number,
1473
- totalInteractions: number,
1474
- satisfactionScore: number
1475
- }
1476
- ```
1477
-
1478
- **Agent Properties:**
1479
-
1480
- ```typescript
1481
- {
1482
- agentType: "strategy" | "marketing" | "sales" | ...,
1483
- systemPrompt: string,
1484
- model: string,
1485
- temperature: number,
1486
- capabilities: string[],
1487
- tools: string[],
1488
- totalExecutions: number,
1489
- successRate: number,
1490
- averageExecutionTime: number
1491
- }
1492
- ```
1493
-
1494
- **Token Properties:**
1495
-
1496
- ```typescript
1497
- {
1498
- contractAddress: string,
1499
- blockchain: "base" | "ethereum" | "polygon",
1500
- standard: "ERC20" | "ERC721" | "ERC1155",
1501
- totalSupply: number,
1502
- circulatingSupply: number,
1503
- price: number,
1504
- marketCap: number,
1505
- utility: string[],
1506
- burnRate: number,
1507
- holders: number,
1508
- transactions24h: number,
1509
- volume24h: number
1510
- }
1511
- ```
1512
-
1513
- **Course Properties:**
1514
-
1515
- ```typescript
1516
- {
1517
- title: string,
1518
- description: string,
1519
- thumbnail?: string,
1520
- modules: number,
1521
- lessons: number,
1522
- totalDuration: number,
1523
- price: number,
1524
- currency: string,
1525
- tokenPrice?: number,
1526
- enrollments: number,
1527
- completions: number,
1528
- averageRating: number,
1529
- generatedBy: "ai" | "human" | "hybrid",
1530
- personalizationLevel: "none" | "basic" | "advanced"
1531
- }
1532
- ```
1533
-
1534
- **Website Properties:**
1535
-
1536
- ```typescript
1537
- {
1538
- domain: string,
1539
- subdomain: string, // creator.one.ie
1540
- template: "minimal" | "showcase" | "portfolio",
1541
- customCSS?: string,
1542
- customDomain?: string,
1543
- sslEnabled: boolean,
1544
- analytics: {
1545
- visitors30d: number,
1546
- pageViews: number,
1547
- conversionRate: number
1548
- }
1549
- }
1550
- ```
1551
-
1552
- **Livestream Properties:**
1553
-
1554
- ```typescript
1555
- {
1556
- title: string,
1557
- scheduledAt: number,
1558
- startedAt?: number,
1559
- endedAt?: number,
1560
- platform: "youtube" | "twitch" | "custom",
1561
- streamUrl: string,
1562
- recordingUrl?: string,
1563
- viewersPeak: number,
1564
- viewersAverage: number,
1565
- chatEnabled: boolean,
1566
- aiCloneMixEnabled: boolean, // For human + AI mixing
1567
- status: "scheduled" | "live" | "ended" | "cancelled"
1568
- }
1569
- ```
1570
-
1571
- **Payment Properties (Consolidated):**
1572
-
1573
- ```typescript
1574
- {
1575
- protocol: "x402" | "acp" | "ap2" | "stripe", // Protocol identifier
1576
- amount: number,
1577
- currency: "usd" | "eur",
1578
- paymentMethod: "stripe" | "crypto",
1579
- stripePaymentIntentId?: string,
1580
- txHash?: string, // Blockchain transaction
1581
- status: "pending" | "completed" | "failed" | "refunded",
1582
- fees: number,
1583
- netAmount: number,
1584
- processedAt?: number,
1585
- // Protocol specifics
1586
- scheme?: "permit", // X402
1587
- network?: "base", // X402/Crypto
1588
- invoiceId?: string // ACP
1589
- }
1590
- ```
1591
-
1592
- **Subscription Properties:**
1593
-
1594
- ```typescript
1595
- {
1596
- tier: "starter" | "pro" | "enterprise",
1597
- price: number,
1598
- currency: string,
1599
- interval: "monthly" | "yearly",
1600
- status: "active" | "cancelled" | "past_due" | "expired",
1601
- currentPeriodStart: number,
1602
- currentPeriodEnd: number,
1603
- cancelAt?: number,
1604
- stripeSubscriptionId?: string
1605
- }
1606
- ```
1607
-
1608
- **Metric Properties:**
1609
-
1610
- ```typescript
1611
- {
1612
- name: string,
1613
- value: number,
1614
- unit: string,
1615
- timestamp: number,
1616
- period: "realtime" | "hourly" | "daily" | "weekly" | "monthly",
1617
- change: number, // Percentage change from previous
1618
- trend: "up" | "down" | "stable"
1619
- }
1620
- ```
1621
-
1622
- **Insight Properties:**
1623
-
1624
- ```typescript
1625
- {
1626
- title: string,
1627
- description: string,
1628
- category: "performance" | "audience" | "revenue" | "content",
1629
- confidence: number, // 0.0 to 1.0
1630
- actionable: boolean,
1631
- recommendations: string[],
1632
- generatedAt: number,
1633
- generatedBy: Id<"things"> // intelligence_agent
1634
- }
1635
- ```
1636
-
1637
- **Referral Properties:**
1638
-
1639
- ```typescript
1640
- {
1641
- referrerCode: string,
1642
- referredEmail: string,
1643
- referredUserId?: Id<"things">,
1644
- status: "pending" | "converted" | "expired",
1645
- tokensEarned: number,
1646
- bonusEarned?: number,
1647
- conversionDate?: number,
1648
- expiresAt: number
1649
- }
1650
- ```
1651
-
1652
- **Notification Properties:**
1653
-
1654
- ```typescript
1655
- {
1656
- title: string,
1657
- message: string,
1658
- type: "info" | "success" | "warning" | "error",
1659
- channel: "email" | "sms" | "push" | "in_app",
1660
- read: boolean,
1661
- readAt?: number,
1662
- actionUrl?: string,
1663
- actionLabel?: string
1664
- }
1665
- ```
1666
-
1667
- **External Agent Properties:**
1668
-
1669
- ```typescript
1670
- {
1671
- platform: "elizaos" | "autogen" | "crewai" | "langchain" | "custom",
1672
- agentId: string, // External platform's agent ID
1673
- name: string, // Agent name
1674
- description?: string, // What the agent does
1675
- capabilities: string[], // Available actions/tools
1676
- apiEndpoint?: string, // REST/GraphQL endpoint
1677
- websocketUrl?: string, // WebSocket endpoint for real-time
1678
- status: "online" | "offline" | "busy" | "unknown",
1679
- lastSeen?: number,
1680
- metadata: { // Platform-specific data
1681
- personality?: any, // For ElizaOS character
1682
- tools?: string[], // Available tools
1683
- model?: string, // LLM model used
1684
- [key: string]: any // Other platform-specific fields
1685
- },
1686
- conversationCount: number, // Total conversations
1687
- messageCount: number, // Total messages exchanged
1688
- createdAt: number,
1689
- updatedAt: number
1690
- }
1691
- ```
1692
-
1693
- **External Workflow Properties:**
1694
-
1695
- ```typescript
1696
- {
1697
- platform: "n8n" | "zapier" | "make" | "pipedream" | "custom",
1698
- workflowId: string, // External platform's workflow ID
1699
- name: string, // Workflow name
1700
- description: string, // What the workflow does
1701
- webhookUrl?: string, // Trigger URL
1702
- active: boolean, // Is workflow active?
1703
- tags: string[], // Workflow tags/categories
1704
- inputSchema: { // Expected input parameters
1705
- [key: string]: {
1706
- type: "string" | "number" | "boolean" | "object" | "array",
1707
- required: boolean,
1708
- description: string,
1709
- default?: any
1710
- }
1711
- },
1712
- outputSchema: { // Expected output structure
1713
- [key: string]: {
1714
- type: "string" | "number" | "boolean" | "object" | "array",
1715
- description: string
1716
- }
1717
- },
1718
- executionCount: number, // Total executions
1719
- successRate: number, // 0.0 to 1.0
1720
- averageExecutionTime: number, // milliseconds
1721
- lastExecutedAt?: number,
1722
- createdAt: number,
1723
- updatedAt: number
1724
- }
1725
- ```
1726
-
1727
- **External Connection Properties:**
1728
-
1729
- ```typescript
1730
- {
1731
- platform: "elizaos" | "n8n" | "zapier" | "make" | "autogen" | "custom",
1732
- name: string, // Connection name
1733
- baseUrl?: string, // API base URL
1734
- apiKey?: string, // Encrypted API key
1735
- websocketUrl?: string, // WebSocket endpoint
1736
- webhookSecret?: string, // Webhook signature secret
1737
- connectionType: "rest" | "websocket" | "webhook" | "graphql",
1738
- authentication: {
1739
- type: "apiKey" | "oauth" | "basic" | "bearer" | "custom",
1740
- credentials: any // Encrypted credentials
1741
- },
1742
- status: "active" | "inactive" | "error",
1743
- lastConnectedAt?: number,
1744
- lastError?: string,
1745
- linkedEntityIds: string[], // Connected agents/workflows
1746
- rateLimits?: {
1747
- requestsPerMinute: number,
1748
- requestsPerDay: number
1749
- },
1750
- createdAt: number,
1751
- updatedAt: number
1752
- }
1753
- ```
1754
-
1755
- **Session Properties:**
1756
-
1757
- ```typescript
1758
- {
1759
- userId: Id<"things">, // User this session belongs to
1760
- token: string, // Session token (hashed)
1761
- expiresAt: number, // Expiration timestamp
1762
- ipAddress?: string, // IP address
1763
- userAgent?: string, // Browser/device info
1764
- lastActivityAt: number, // Last activity timestamp
1765
- createdAt: number,
1766
- }
1767
- ```
1768
-
1769
- **OAuth Account Properties:**
1770
-
1771
- ```typescript
1772
- {
1773
- userId: Id<"things">, // User this account belongs to
1774
- provider: "github" | "google" | "discord" | "twitter",
1775
- providerAccountId: string, // Provider's user ID
1776
- accessToken?: string, // Encrypted access token
1777
- refreshToken?: string, // Encrypted refresh token
1778
- expiresAt?: number, // Token expiration
1779
- tokenType?: string, // Bearer, etc.
1780
- scope?: string, // Granted scopes
1781
- idToken?: string, // OpenID Connect ID token
1782
- createdAt: number,
1783
- updatedAt: number,
1784
- }
1785
- ```
1786
-
1787
- **Verification Token Properties:**
1788
-
1789
- ```typescript
1790
- {
1791
- userId: Id<"things">, // User to verify
1792
- token: string, // Verification token (hashed)
1793
- type: "email" | "two_factor", // Verification type
1794
- expiresAt: number, // Expiration timestamp
1795
- attempts: number, // Failed attempts count
1796
- maxAttempts: number, // Max allowed attempts
1797
- verifiedAt?: number, // When verified (if completed)
1798
- createdAt: number,
1799
- }
1800
- ```
1801
-
1802
- **Password Reset Token Properties:**
1803
-
1804
- ```typescript
1805
- {
1806
- userId: Id<"things">, // User requesting reset
1807
- token: string, // Reset token (hashed)
1808
- expiresAt: number, // Expiration timestamp (15-30 min)
1809
- usedAt?: number, // When token was used
1810
- createdAt: number,
1811
- }
1812
- ```
1813
-
1814
- **UI Preferences Properties:**
1815
-
1816
- ```typescript
1817
- {
1818
- userId: Id<"things">, // User these preferences belong to
1819
- theme: "light" | "dark" | "system",
1820
- language: string, // ISO language code
1821
- timezone: string, // IANA timezone
1822
- dashboardLayout: {
1823
- sidebarCollapsed: boolean,
1824
- defaultView: "grid" | "list" | "kanban",
1825
- itemsPerPage: number,
1826
- },
1827
- notifications: {
1828
- email: boolean,
1829
- push: boolean,
1830
- sms: boolean,
1831
- inApp: boolean,
1832
- },
1833
- accessibility: {
1834
- reducedMotion: boolean,
1835
- highContrast: boolean,
1836
- fontSize: "small" | "medium" | "large",
1837
- },
1838
- customSettings: any, // App-specific settings
1839
- updatedAt: number,
1840
- }
1841
- ```
1842
-
1843
- **Mandate Properties (AP2/Shopping):**
1844
-
1845
- ```typescript
1846
- {
1847
- mandateType: "intent" | "cart",
1848
- protocol: "ap2",
1849
- intent?: { // For intent mandates
1850
- targetProduct?: string,
1851
- maxBudget?: number,
1852
- constraints?: any
1853
- },
1854
- items?: { // For cart mandates
1855
- productId: string,
1856
- quantity: number,
1857
- price: number
1858
- }[],
1859
- subtotal?: number,
1860
- tax?: number,
1861
- total?: number,
1862
- status: "active" | "completed" | "abandoned",
1863
- signature?: string, // Cryptographic signature
1864
- credentialHash?: string, // Verifiable credential
1865
- approvedAt?: number,
1866
- completedAt?: number
1867
- }
1868
- ```
1869
-
1870
- ---
1871
-
1872
- ## CONNECTIONS: All The Relationships
1873
-
1874
- ### What Goes in Connections?
1875
-
1876
- **Simple test:** If you're describing how thing X relates to thing Y, it's a connection.
1877
-
1878
- Examples:
1879
-
1880
- - "Creator **owns** token" ✅ Connection
1881
- - "User **enrolled_in** course" ✅ Connection
1882
- - "Agent **powers** AI clone" ✅ Connection
1883
- - "Creator created a post" ❌ Event (action), not connection
1884
-
1885
- ### Connection Types (25 total)
1886
-
1887
- **Design Principle:** Consolidated types with metadata for variants. Protocol identity stored in `metadata.protocol`.
1888
-
1889
- ```typescript
1890
- type ConnectionType =
1891
- // OWNERSHIP (2)
1892
- | "owns"
1893
- | "created_by"
1894
-
1895
- // AI RELATIONSHIPS (3)
1896
- | "clone_of"
1897
- | "trained_on"
1898
- | "powers"
1899
-
1900
- // CONTENT RELATIONSHIPS (5)
1901
- | "authored"
1902
- | "generated_by"
1903
- | "published_to"
1904
- | "part_of"
1905
- | "references"
1906
-
1907
- // COMMUNITY RELATIONSHIPS (4)
1908
- | "member_of"
1909
- | "following"
1910
- | "moderates"
1911
- | "participated_in"
1912
-
1913
- // BUSINESS RELATIONSHIPS (3)
1914
- | "manages"
1915
- | "reports_to"
1916
- | "collaborates_with"
1917
-
1918
- // TOKEN RELATIONSHIPS (3)
1919
- | "holds_tokens"
1920
- | "staked_in"
1921
- | "earned_from"
1922
-
1923
- // PRODUCT RELATIONSHIPS (4)
1924
- | "purchased"
1925
- | "enrolled_in"
1926
- | "completed"
1927
- | "teaching"
1928
-
1929
- // CONSOLIDATED TYPES (use metadata for variants + protocol)
1930
- | "transacted" // Payment/subscription/invoice (metadata.transactionType + protocol)
1931
- | "notified" // Notifications (metadata.channel + notificationType)
1932
- | "referred" // Referrals (metadata.referralType)
1933
- | "communicated" // Agent/protocol communication (metadata.protocol + messageType)
1934
- | "delegated" // Task/workflow delegation (metadata.protocol + taskType)
1935
- | "approved" // Approvals (metadata.approvalType + protocol)
1936
- | "fulfilled"; // Fulfillment (metadata.fulfillmentType + protocol)
1937
-
1938
- // Total: 25 connection types
1939
- ```
1940
-
1941
- ### Connection Structure
1942
-
1943
- ```typescript
1944
- {
1945
- _id: Id<"connections">,
1946
- fromThingId: Id<"things">,
1947
- toThingId: Id<"things">,
1948
- relationshipType: ConnectionType,
1949
- metadata?: { // Optional relationship data
1950
- // For revenue splits:
1951
- revenueShare?: number, // 0.0 to 1.0
1952
- // For token holdings:
1953
- balance?: number,
1954
- // For course enrollment:
1955
- enrolledAt?: number,
1956
- progress?: number,
1957
- // Protocol specifics
1958
- protocol?: string,
1959
- // etc...
1960
- },
1961
- strength?: number, // Relationship strength (0-1)
1962
- validFrom?: number, // When relationship started
1963
- validTo?: number, // When relationship ended
1964
- createdAt: number,
1965
- updatedAt?: number,
1966
- deletedAt?: number // OPTIONAL: Soft delete timestamp
1967
- }
1968
- ```
1969
-
1970
- ### Common Connection Patterns
1971
-
1972
- **Pattern: Ownership**
1973
-
1974
- ```typescript
1975
- // Creator owns AI clone (thing-to-thing)
1976
- {
1977
- fromThingId: creatorId,
1978
- toThingId: cloneId,
1979
- relationshipType: "owns",
1980
- createdAt: Date.now()
1981
- }
1982
-
1983
- // E-Commerce: Store owns product inventory
1984
- {
1985
- fromThingId: groupId, // Store
1986
- toThingId: productId,
1987
- relationshipType: "owns",
1988
- createdAt: Date.now()
1989
- }
1990
-
1991
- // Education: Department owns course
1992
- {
1993
- fromThingId: departmentGroupId,
1994
- toThingId: courseId,
1995
- relationshipType: "owns",
1996
- createdAt: Date.now()
1997
- }
1998
-
1999
- // Crypto: DAO owns treasury tokens
2000
- {
2001
- fromThingId: daoGroupId,
2002
- toThingId: tokenId,
2003
- relationshipType: "owns",
2004
- metadata: {
2005
- balance: 1000000
2006
- },
2007
- createdAt: Date.now()
2008
- }
2009
- ```
2010
-
2011
- **Pattern: Revenue Split**
2012
-
2013
- ```typescript
2014
- // Collaborator owns 30% of course
2015
- {
2016
- fromThingId: collaboratorId,
2017
- toThingId: courseId,
2018
- relationshipType: "owns",
2019
- metadata: {
2020
- revenueShare: 0.3
2021
- },
2022
- createdAt: Date.now()
2023
- }
2024
- ```
2025
-
2026
- **Pattern: Token Holding**
2027
-
2028
- ```typescript
2029
- // User holds 1000 tokens
2030
- {
2031
- fromThingId: userId,
2032
- toThingId: tokenId,
2033
- relationshipType: "holds_tokens",
2034
- metadata: {
2035
- balance: 1000,
2036
- acquiredAt: Date.now()
2037
- },
2038
- createdAt: Date.now()
2039
- }
2040
- ```
2041
-
2042
- **Pattern: Course Enrollment**
2043
-
2044
- ```typescript
2045
- // User enrolled in course
2046
- {
2047
- fromThingId: userId,
2048
- toThingId: courseId,
2049
- relationshipType: "enrolled_in",
2050
- metadata: {
2051
- progress: 0.45, // 45% complete
2052
- enrolledAt: Date.now(),
2053
- lastAccessedAt: Date.now()
2054
- },
2055
- createdAt: Date.now()
2056
- }
2057
-
2058
- // Education: Student enrolled in school with grade level
2059
- {
2060
- fromThingId: studentId,
2061
- toThingId: courseId,
2062
- relationshipType: "enrolled_in",
2063
- metadata: {
2064
- enrollmentType: "credit",
2065
- progress: 0.65,
2066
- currentGrade: 92.5,
2067
- letterGrade: "A",
2068
- enrolledAt: Date.now()
2069
- },
2070
- createdAt: Date.now()
2071
- }
2072
-
2073
- // E-Commerce: Customer purchased product
2074
- {
2075
- fromThingId: customerId,
2076
- toThingId: productId,
2077
- relationshipType: "purchased",
2078
- metadata: {
2079
- quantity: 2,
2080
- price: 49.99,
2081
- currency: "USD",
2082
- purchasedAt: Date.now()
2083
- },
2084
- createdAt: Date.now()
2085
- }
2086
-
2087
- // Creator: Subscriber joined membership tier
2088
- {
2089
- fromThingId: subscriberId,
2090
- toThingId: membershipTierId,
2091
- relationshipType: "member_of",
2092
- metadata: {
2093
- tier: "pro",
2094
- price: 9.99,
2095
- interval: "monthly",
2096
- subscribedAt: Date.now()
2097
- },
2098
- createdAt: Date.now()
2099
- }
2100
- ```
2101
-
2102
- **Pattern: Group Membership**
2103
-
2104
- ```typescript
2105
- // User is member of group with role
2106
- {
2107
- fromThingId: userId,
2108
- toThingId: groupId,
2109
- relationshipType: "member_of",
2110
- metadata: {
2111
- role: "group_owner" | "group_user", // Group-specific role
2112
- permissions: ["read", "write", "admin"],
2113
- invitedBy?: Id<"things">, // Who invited this user
2114
- invitedAt?: number,
2115
- joinedAt: Date.now(),
2116
- },
2117
- createdAt: Date.now()
2118
- }
2119
-
2120
- // Group owns content/resources
2121
- {
2122
- fromThingId: groupId,
2123
- toThingId: contentId,
2124
- relationshipType: "owns",
2125
- metadata: {
2126
- createdBy: userId, // User who created it
2127
- },
2128
- createdAt: Date.now()
2129
- }
2130
- ```
2131
-
2132
- **Pattern: Payment Transaction (Consolidated)**
2133
-
2134
- ```typescript
2135
- // User paid for product (use "transacted" with metadata)
2136
- {
2137
- fromThingId: userId,
2138
- toThingId: productId,
2139
- relationshipType: "transacted",
2140
- metadata: {
2141
- transactionType: "payment", // or "subscription" or "invoice"
2142
- amount: 99.00,
2143
- currency: "USD",
2144
- paymentId: "pi_123456",
2145
- status: "completed"
2146
- },
2147
- createdAt: Date.now()
2148
- }
2149
-
2150
- // User subscribed to service
2151
- {
2152
- fromThingId: userId,
2153
- toThingId: subscriptionId,
2154
- relationshipType: "transacted",
2155
- metadata: {
2156
- transactionType: "subscription",
2157
- amount: 29.00,
2158
- currency: "USD",
2159
- interval: "monthly",
2160
- subscriptionId: "sub_123456",
2161
- status: "active"
2162
- },
2163
- createdAt: Date.now()
2164
- }
2165
- ```
2166
-
2167
- **Pattern: Referral (Consolidated)**
2168
-
2169
- ```typescript
2170
- // User referred by another user (use "referred" with metadata)
2171
- {
2172
- fromThingId: newUserId,
2173
- toThingId: referrerId,
2174
- relationshipType: "referred",
2175
- metadata: {
2176
- referralType: "direct", // or "conversion" or "campaign"
2177
- source: "referral_link",
2178
- referralCode: "REF123",
2179
- tokensEarned: 100,
2180
- status: "converted"
2181
- },
2182
- createdAt: Date.now()
2183
- }
2184
- ```
2185
-
2186
- **Pattern: Notification (Consolidated)**
2187
-
2188
- ```typescript
2189
- // User notified about event (use "notified" with metadata)
2190
- {
2191
- fromThingId: userId,
2192
- toThingId: notificationId,
2193
- relationshipType: "notified",
2194
- metadata: {
2195
- channel: "email", // or "sms" or "push" or "in_app"
2196
- campaignId: campaignId, // optional
2197
- deliveredAt: Date.now(),
2198
- readAt: Date.now(),
2199
- clicked: true
2200
- },
2201
- createdAt: Date.now()
2202
- }
2203
- ```
2204
-
2205
- **Pattern: Protocol Communication (Consolidated)**
2206
-
2207
- ```typescript
2208
- // Agents communicate (A2A)
2209
- {
2210
- fromThingId: oneAgentId,
2211
- toThingId: externalAgentId,
2212
- relationshipType: "communicated",
2213
- metadata: {
2214
- protocol: "a2a",
2215
- platform: "elizaos",
2216
- messagesExchanged: 42
2217
- },
2218
- createdAt: Date.now()
2219
- }
2220
- ```
2221
-
2222
- **Pattern: Task Delegation (Consolidated)**
2223
-
2224
- ```typescript
2225
- // Agent delegates task
2226
- {
2227
- fromThingId: mainAgentId,
2228
- toThingId: workerAgentId,
2229
- relationshipType: "delegated",
2230
- metadata: {
2231
- protocol: "a2a",
2232
- taskType: "research",
2233
- status: "pending"
2234
- },
2235
- createdAt: Date.now()
2236
- }
2237
- ```
2238
-
2239
- ---
2240
-
2241
- ## EVENTS: All The Actions
2242
-
2243
- ### What Goes in Events?
2244
-
2245
- **Simple test:** If you're describing something that HAPPENED at a specific TIME, it's an event.
2246
-
2247
- Examples:
2248
-
2249
- - "User **purchased** tokens at 3pm" ✅ Event
2250
- - "Content **was published** yesterday" ✅ Event
2251
- - "Clone **interacted** with user" ✅ Event
2252
- - "User owns tokens" ❌ Connection (state), not event
2253
-
2254
- ### Event Types (35 total)
2255
-
2256
- **Design Principle:** Consolidated types with metadata for variants. Protocol identity stored in `metadata.protocol`.
2257
-
2258
- ```typescript
2259
- type EventType =
2260
- // THING LIFECYCLE (3) - Consolidated with metadata.thingType
2261
- | "thing_created" // metadata: { thingType: "group" | "user" | "course" | etc. }
2262
- | "thing_updated" // metadata: { thingType, action: "updated" | "archived" | "restored" }
2263
- | "thing_deleted" // metadata: { thingType, action: "deleted" | "archived", deletionType: "soft" | "hard" }
2264
-
2265
- // USER EVENTS (5)
2266
- | "user_registered"
2267
- | "user_verified"
2268
- | "user_login"
2269
- | "user_logout"
2270
- | "profile_updated"
2271
-
2272
- // AUTHENTICATION EVENTS (6)
2273
- | "password_reset_requested"
2274
- | "password_reset_completed"
2275
- | "email_verification_sent"
2276
- | "email_verified"
2277
- | "two_factor_enabled"
2278
- | "two_factor_disabled"
2279
-
2280
- // GROUP-SPECIFIC EVENTS (3) - Not lifecycle events (those use thing_*)
2281
- | "user_invited_to_group"
2282
- | "user_joined_group"
2283
- | "user_removed_from_group"
2284
-
2285
- // DASHBOARD & UI EVENTS (4)
2286
- | "dashboard_viewed"
2287
- | "settings_updated"
2288
- | "theme_changed"
2289
- | "preferences_updated"
2290
-
2291
- // AI/CLONE EVENTS (2) - Creation uses thing_created with thingType: "clone"
2292
- | "voice_cloned"
2293
- | "appearance_cloned"
2294
-
2295
- // AGENT EVENTS (3) - Creation uses thing_created with thingType: "agent"
2296
- | "agent_executed"
2297
- | "agent_completed"
2298
- | "agent_failed"
2299
-
2300
- // TOKEN EVENTS (6) - Creation uses thing_created with thingType: "token"
2301
- | "token_minted"
2302
- | "token_burned"
2303
- | "tokens_purchased"
2304
- | "tokens_staked"
2305
- | "tokens_unstaked"
2306
- | "tokens_transferred"
2307
-
2308
- // COURSE EVENTS (4) - Creation uses thing_created with thingType: "course"
2309
- | "course_enrolled"
2310
- | "lesson_completed"
2311
- | "course_completed"
2312
- | "certificate_earned"
2313
-
2314
- // ANALYTICS EVENTS (5)
2315
- | "metric_calculated"
2316
- | "insight_generated"
2317
- | "prediction_made"
2318
- | "optimization_applied"
2319
- | "report_generated"
2320
-
2321
- // CYCLE EVENTS (7) - NEW
2322
- | "cycle_request" // User requests AI cycle
2323
- | "cycle_completed" // Cycle result delivered
2324
- | "cycle_failed" // Cycle failed
2325
- | "cycle_quota_exceeded" // Monthly limit hit
2326
- | "cycle_revenue_collected" // Daily revenue sweep
2327
- | "org_revenue_generated" // Group generates platform revenue
2328
- | "revenue_share_distributed" // Revenue share paid out
2329
-
2330
- // BLOCKCHAIN EVENTS (5) - NEW
2331
- | "nft_minted" // NFT created on-chain
2332
- | "nft_transferred" // NFT ownership changed
2333
- | "tokens_bridged" // Cross-chain bridge
2334
- | "contract_deployed" // Smart contract deployed
2335
- | "treasury_withdrawal" // Platform owner withdraws revenue
2336
-
2337
- // CONSOLIDATED EVENTS (use metadata for variants + protocol)
2338
- | "content_event" // metadata.action: created|updated|deleted|viewed|shared|liked
2339
- | "payment_event" // metadata.status: requested|verified|processed + protocol
2340
- | "subscription_event" // metadata.action: started|renewed|cancelled
2341
- | "commerce_event" // metadata.eventType + protocol (ACP, AP2)
2342
- | "livestream_event" // metadata.status: started|ended + metadata.action: joined|left|chat|donation
2343
- | "notification_event" // metadata.channel: email|sms|push|in_app + deliveryStatus
2344
- | "referral_event" // metadata.action: created|completed|rewarded
2345
- | "communication_event" // metadata.protocol (A2A, ACP, AG-UI) + messageType
2346
- | "task_event" // metadata.action: delegated|completed|failed + protocol
2347
- | "mandate_event" // metadata.mandateType: intent|cart + protocol (AP2)
2348
- | "price_event"; // metadata.action: checked|changed
2349
-
2350
- // Total: 52 event types (35 original + 7 cycle + 5 blockchain + 5 NFT overlap)
2351
- ```
2352
-
2353
- ### Event Structure
2354
-
2355
- ```typescript
2356
- {
2357
- _id: Id<"events">,
2358
- type: EventType, // What happened
2359
- actorId: Id<"things">, // Who/what caused this
2360
- targetId?: Id<"things">, // Optional target thing
2361
- groupId: Id<"groups">, // REQUIRED: Multi-tenant isolation & efficient filtering
2362
- timestamp: number, // When it happened
2363
- metadata: any // Event-specific data
2364
- }
2365
- ```
2366
-
2367
- ### Metadata Structure
2368
-
2369
- The `metadata` field is flexible JSON that ALWAYS includes `protocol` for protocol-specific events:
2370
-
2371
- ```typescript
2372
- // Protocol-agnostic events (no protocol field needed)
2373
- { action: "created", contentType: "blog_post" }
2374
-
2375
- // Protocol-specific events (includes protocol identifier)
2376
- {
2377
- protocol: "a2a" | "acp" | "ap2" | "x402" | "ag-ui",
2378
- // ... protocol-specific fields
2379
- }
2380
-
2381
- // Examples:
2382
- // A2A message
2383
- { protocol: "a2a", messageType: "task_delegation", task: "research" }
2384
-
2385
- // ACP commerce
2386
- { protocol: "acp", eventType: "purchase_initiated", agentPlatform: "chatgpt" }
2387
-
2388
- // AP2 mandate
2389
- { protocol: "ap2", mandateType: "intent", autoExecute: true }
2390
-
2391
- // X402 payment
2392
- { protocol: "x402", network: "base", txHash: "0x..." }
2393
- ```
2394
-
2395
- ### Event Patterns
2396
-
2397
- **Pattern: User Action**
2398
-
2399
- ```typescript
2400
- // User purchased tokens
2401
- {
2402
- type: "tokens_purchased",
2403
- actorId: userId,
2404
- targetId: tokenId,
2405
- timestamp: Date.now(),
2406
- metadata: {
2407
- amount: 100,
2408
- usdAmount: 10,
2409
- paymentId: "pi_123",
2410
- txHash: "0x456"
2411
- }
2412
- }
2413
- ```
2414
-
2415
- **Pattern: Payment Event (Consolidated)**
2416
-
2417
- ```typescript
2418
- // Payment completed (use "payment_processed" with metadata.status)
2419
- {
2420
- type: "payment_event",
2421
- actorId: userId,
2422
- targetId: paymentId,
2423
- timestamp: Date.now(),
2424
- metadata: {
2425
- status: "processed", // or "requested" | "verified" | "failed"
2426
- amount: 99.00,
2427
- currency: "USD",
2428
- paymentId: "pi_123456",
2429
- method: "stripe"
2430
- }
2431
- }
2432
-
2433
- // Subscription renewed (use "subscription_event" with metadata.action)
2434
- {
2435
- type: "subscription_event",
2436
- actorId: userId,
2437
- targetId: subscriptionId,
2438
- timestamp: Date.now(),
2439
- metadata: {
2440
- action: "renewed", // or "started" | "cancelled"
2441
- tier: "pro",
2442
- amount: 29.00,
2443
- nextBillingDate: Date.now() + 30 * 24 * 60 * 60 * 1000
2444
- }
2445
- }
2446
- ```
2447
-
2448
- **Pattern: Content Event (Consolidated)**
2449
-
2450
- ```typescript
2451
- // Content created (use "content_event" with metadata.action)
2452
- {
2453
- type: "content_event",
2454
- actorId: creatorId,
2455
- targetId: contentId,
2456
- timestamp: Date.now(),
2457
- metadata: {
2458
- action: "created", // or "updated" | "deleted"
2459
- contentType: "blog_post",
2460
- generatedBy: "marketing_agent",
2461
- platform: "instagram"
2462
- }
2463
- }
2464
-
2465
- // Content viewed (use "content_event" with metadata.action)
2466
- {
2467
- type: "content_event",
2468
- actorId: userId,
2469
- targetId: contentId,
2470
- timestamp: Date.now(),
2471
- metadata: {
2472
- action: "viewed", // or "shared" | "liked"
2473
- duration: 120, // seconds
2474
- source: "feed"
2475
- }
2476
- }
2477
- ```
2478
-
2479
- **Pattern: Livestream Event (Consolidated)**
2480
-
2481
- ```typescript
2482
- // Livestream started (use "livestream_event" with metadata.status)
2483
- {
2484
- type: "livestream_event",
2485
- actorId: creatorId,
2486
- targetId: livestreamId,
2487
- timestamp: Date.now(),
2488
- metadata: {
2489
- status: "started", // or "scheduled" | "ended"
2490
- streamId: "stream_123",
2491
- platform: "cloudflare",
2492
- rtmpUrl: "rtmp://..."
2493
- }
2494
- }
2495
-
2496
- // Viewer joined (use "livestream_event" with metadata.action)
2497
- {
2498
- type: "livestream_event",
2499
- actorId: viewerId,
2500
- targetId: livestreamId,
2501
- timestamp: Date.now(),
2502
- metadata: {
2503
- action: "joined", // or "left" | "chat" | "donation"
2504
- viewerCount: 42,
2505
- message: "Hello!" // if action === "chat"
2506
- }
2507
- }
2508
- ```
2509
-
2510
- **Pattern: Notification Event (Consolidated)**
2511
-
2512
- ```typescript
2513
- // Email notification sent (use "notification_event" with metadata.channel)
2514
- {
2515
- type: "notification_event",
2516
- actorId: systemId,
2517
- targetId: userId,
2518
- timestamp: Date.now(),
2519
- metadata: {
2520
- channel: "email", // or "sms" | "push" | "in_app"
2521
- messageId: "msg_123",
2522
- subject: "New content available",
2523
- deliveryStatus: "sent",
2524
- readAt: Date.now() + 1000 // optional
2525
- }
2526
- }
2527
- ```
2528
-
2529
- **Pattern: Protocol Events (Consolidated)**
2530
-
2531
- ```typescript
2532
- // A2A Task Delegation
2533
- {
2534
- type: "task_event",
2535
- actorId: oneAgentId,
2536
- targetId: externalAgentId,
2537
- timestamp: Date.now(),
2538
- metadata: {
2539
- protocol: "a2a",
2540
- action: "delegated",
2541
- task: "research_market_trends"
2542
- }
2543
- }
2544
-
2545
- // ACP Purchase
2546
- {
2547
- type: "commerce_event",
2548
- actorId: agentId,
2549
- targetId: transactionId,
2550
- timestamp: Date.now(),
2551
- metadata: {
2552
- protocol: "acp",
2553
- eventType: "purchase_initiated",
2554
- agentPlatform: "chatgpt",
2555
- amount: 99.00
2556
- }
2557
- }
2558
-
2559
- // AP2 Mandate
2560
- {
2561
- type: "mandate_event",
2562
- actorId: userId,
2563
- targetId: mandateId,
2564
- timestamp: Date.now(),
2565
- metadata: {
2566
- protocol: "ap2",
2567
- mandateType: "intent",
2568
- autoExecute: true
2569
- }
2570
- }
2571
-
2572
- // X402 Payment
2573
- {
2574
- type: "payment_event",
2575
- actorId: apiServiceId,
2576
- targetId: resourceId,
2577
- timestamp: Date.now(),
2578
- metadata: {
2579
- protocol: "x402",
2580
- status: "requested",
2581
- scheme: "permit",
2582
- network: "base",
2583
- amount: "0.01"
2584
- }
2585
- }
2586
- ```
2587
-
2588
- ---
2589
-
2590
- ## The Philosophy: Reality as DSL
2591
-
2592
- **This isn't a database schema. It's a Domain-Specific Language for reality itself.**
2593
-
2594
- ### The Core Insight
2595
-
2596
- **Most systems model their application. ONE models reality.**
2597
-
2598
- This ontology proves that you don't need hundreds of tables or complex schemas to build a complete AI-native platform. You need:
2599
-
2600
- 1. **6 dimensions** (groups, people, things, connections, events, knowledge)
2601
- 2. **66 thing types** (every "thing")
2602
- 3. **25 connection types** (every relationship)
2603
- 4. **52 event types** (every action)
2604
- 5. **Metadata** (for protocol identity via metadata.protocol)
2605
-
2606
- That's it. Everything else is just data.
2607
-
2608
- ### Why This Works for AI Agents
2609
-
2610
- **Traditional codebases:**
2611
-
2612
- - 100 different patterns for the same concept
2613
- - AI sees chaos, accuracy degrades (95% → 30%)
2614
- - Technical debt compounds
2615
- - Each feature makes the next HARDER
2616
-
2617
- **ONE codebase:**
2618
-
2619
- - 1 universal pattern for each dimension
2620
- - AI sees structure, accuracy compounds (85% → 98%)
2621
- - Technical credit accumulates
2622
- - Each feature makes the next EASIER
2623
-
2624
- **The result:** 100x developer productivity. Not hyperbole. Math.
2625
-
2626
- ### Why Schema Migrations Never Happen
2627
-
2628
- **Other systems:**
2629
-
2630
- - Create new tables for every feature
2631
- - Add protocol-specific columns
2632
- - Pollute schema with temporary concepts
2633
- - End up with 50+ tables, 200+ columns
2634
- - Require migrations for every change
2635
- - Become unmaintainable nightmares
2636
-
2637
- **ONE's approach:**
2638
-
2639
- - Map every feature to 6 dimensions (reality model)
2640
- - Groups partition the space (hierarchical containers)
2641
- - People authorize and govern (role-based access)
2642
- - Things exist with flexible properties (no migrations)
2643
- - Connections relate (metadata for protocols)
2644
- - Events record (complete audit trail)
2645
- - Knowledge understands (embeddings + RAG)
2646
- - Scale infinitely without schema changes
2647
- - Stay simple, clean, beautiful
2648
-
2649
- ### The Economic Impact
2650
-
2651
- **Traditional Development:**
2652
-
2653
- - Developer writes 100 lines/day
2654
- - AI assistance degrades over time
2655
- - Technical debt compounds
2656
- - Codebases become unmaintainable
2657
- - **Cost scales linearly with codebase size**
2658
-
2659
- **ONE Development:**
2660
-
2661
- - Agent generates 10,000 lines/day (100x)
2662
- - AI accuracy improves over time (98%+)
2663
- - Structure compounds (technical credit)
2664
- - Codebases become MORE maintainable
2665
- - **Cost scales sublinearly—larger codebases are cheaper per feature**
2666
-
2667
- **Result:** 12x cheaper per feature at scale. Feature #100 costs LESS than feature #1.
2668
-
2669
- ### The Universal Language
2670
-
2671
- A system architecture that:
2672
-
2673
- - **Scales infinitely** - Lemonade stands to global governments, same schema
2674
- - **Children can understand** - "I own (group), I'm the boss (person), I sell lemonade (things)"
2675
- - **Enterprises can rely on** - Multi-tenant isolation, clear governance, infinite scale
2676
- - **AI agents can master** - 6 patterns, 98% accuracy, compound structure
2677
- - **Never breaks** - Reality doesn't change, technology does
2678
- - **Grows more powerful** - Each feature adds structure, making the next feature easier
2679
- - **Enables feature import** - Clone ANY system into the ontology (Shopify, Moodle, Stripe, etc.)
2680
-
2681
- ### What This Enables
2682
-
2683
- **1. Compound Velocity**
2684
-
2685
- - Traditional: Feature #100 takes LONGER than feature #1 (technical debt)
2686
- - ONE: Feature #100 takes LESS TIME than feature #1 (pattern reuse)
2687
-
2688
- **2. Universal Feature Import**
2689
-
2690
- - Traditional: Want Shopify's checkout? Build from scratch (3 months)
2691
- - ONE: Point agent-clone at Shopify. Clone checkout feature (20 minutes)
2692
-
2693
- **3. Backend Agnosticism**
2694
-
2695
- - Traditional: Migrating from WordPress to custom backend takes months
2696
- - ONE: Switch `CONTENT_SOURCE` env var. Done in 1 minute.
2697
-
2698
- **4. AI-Native Development**
2699
-
2700
- - Traditional: AI is an assistant. Human is the driver (70% human work)
2701
- - ONE: AI is the primary builder. Human is the architect (2% human work at scale)
2702
-
2703
- **5. No Breaking Changes**
2704
-
2705
- - Traditional: Major versions break everything
2706
- - ONE: Technology changes (React → Svelte), ontology stays the same
2707
-
2708
- **This is what happens when you design for AI agents first, not humans.**
2709
-
2710
- The 6-dimension ontology is the **universal code generation language** that enables 98% accuracy by modeling reality itself.
2711
-
2712
- ---
2713
-
2714
- ## Frontend Integration Examples
2715
-
2716
- ### How the Frontend Uses This Ontology
2717
-
2718
- The Astro frontend (documented in `Frontend.md`) uses this ontology through:
2719
-
2720
- 1. **Astro Content Collections** - Can load entities as typed collections
2721
- 2. **Convex Hooks** - Real-time subscriptions to entity/connection/event data
2722
- 3. **Hono API** - Complex mutations that create/update entities and log events
2723
-
2724
- **Example: Multi-Tenant Dashboard**
2725
-
2726
- ```typescript
2727
- // Frontend Component (src/components/admin/GroupList.tsx)
2728
- import { useQuery } from 'convex/react';
2729
- import { api } from '@/convex/_generated/api';
2730
-
2731
- export function GroupList() {
2732
- // Query groups (table: "groups")
2733
- const groups = useQuery(api.queries.admin.listGroups);
2734
-
2735
- return (
2736
- <div>
2737
- {groups?.map(group => (
2738
- <Card key={group._id}>
2739
- <CardHeader>
2740
- <CardTitle>{group.name}</CardTitle>
2741
- <Badge>{group.settings.plan}</Badge>
2742
- </CardHeader>
2743
- <CardContent>
2744
- <p>{group.metadata.userCount || 0} / {group.settings.limits.users} users</p>
2745
- <p>Status: {group.status}</p>
2746
- </CardContent>
2747
- </Card>
2748
- ))}
2749
- </div>
2750
- );
2751
- }
2752
- ```
2753
-
2754
- **Example: Authentication Flow**
2755
-
2756
- ```typescript
2757
- // Password reset request creates:
2758
- // 1. Entity: password_reset_token
2759
- // 2. Event: password_reset_requested
2760
-
2761
- // Backend (Convex mutation)
2762
- export const requestPasswordReset = mutation({
2763
- handler: async (ctx, { email }) => {
2764
- // 1. Find user entity
2765
- const user = await ctx.db
2766
- .query("entities")
2767
- .filter((q) => q.eq(q.field("properties.email"), email))
2768
- .first();
2769
-
2770
- if (!user) return { success: true }; // Don't reveal if user exists
2771
-
2772
- // 2. Create password_reset_token entity
2773
- const tokenId = await ctx.db.insert("entities", {
2774
- type: "password_reset_token",
2775
- name: `Reset token for ${email}`,
2776
- properties: {
2777
- userId: user._id,
2778
- token: hashedToken,
2779
- expiresAt: Date.now() + 30 * 60 * 1000,
2780
- },
2781
- status: "active",
2782
- createdAt: Date.now(),
2783
- updatedAt: Date.now(),
2784
- });
2785
-
2786
- // 3. Log event
2787
- await ctx.db.insert("events", {
2788
- type: "password_reset_requested",
2789
- actorId: user._id,
2790
- targetId: tokenId,
2791
- timestamp: Date.now(),
2792
- metadata: {
2793
- email,
2794
- ipAddress: ctx.auth.sessionId,
2795
- expiresAt: Date.now() + 30 * 60 * 1000,
2796
- },
2797
- });
2798
-
2799
- return { success: true };
2800
- },
2801
- });
2802
-
2803
- // Frontend usage
2804
- import { useMutation } from "convex/react";
2805
-
2806
- export function PasswordResetForm() {
2807
- const requestReset = useMutation(api.auth.requestPasswordReset);
2808
-
2809
- const handleSubmit = async (email: string) => {
2810
- await requestReset({ email });
2811
- // Show success message
2812
- };
2813
- }
2814
- ```
2815
-
2816
- **Example: Group Membership Check**
2817
-
2818
- ```typescript
2819
- // Check if user is group_owner (Middleware.md pattern)
2820
- export const checkGroupOwner = query({
2821
- args: { userId: v.id("things"), groupId: v.id("groups") },
2822
- handler: async (ctx, { userId, groupId }) => {
2823
- // Query connection with role metadata
2824
- const membership = await ctx.db
2825
- .query("connections")
2826
- .withIndex("from_type", (q) =>
2827
- q
2828
- .eq("fromThingId", userId)
2829
- .eq("toThingId", groupId)
2830
- .eq("relationshipType", "member_of"),
2831
- )
2832
- .first();
2833
-
2834
- return membership?.metadata?.role === "group_owner";
2835
- },
2836
- });
2837
-
2838
- // Frontend usage in middleware
2839
- import { ConvexHttpClient } from "convex/browser";
2840
-
2841
- export async function checkAccess(userId: string, groupId: string) {
2842
- const convex = new ConvexHttpClient(env.CONVEX_URL);
2843
- const isOwner = await convex.query(api.auth.checkGroupOwner, {
2844
- userId,
2845
- groupId,
2846
- });
2847
-
2848
- if (!isOwner) {
2849
- throw new Error("Forbidden: Group owner access required");
2850
- }
2851
- }
2852
- ```
2853
-
2854
- **Example: Dashboard Analytics**
2855
-
2856
- ```typescript
2857
- // Query events for analytics (Dashboard.md pattern)
2858
- export const getGroupAnalytics = query({
2859
- args: { groupId: v.id("groups"), days: v.number() },
2860
- handler: async (ctx, { groupId, days }) => {
2861
- const since = Date.now() - days * 24 * 60 * 60 * 1000;
2862
-
2863
- // Get all dashboard_viewed events for group users
2864
- const groupMembers = await ctx.db
2865
- .query("connections")
2866
- .withIndex("to_type", (q) =>
2867
- q.eq("toThingId", groupId).eq("relationshipType", "member_of"),
2868
- )
2869
- .collect();
2870
-
2871
- const memberIds = groupMembers.map((m) => m.fromThingId);
2872
-
2873
- const dashboardViews = await ctx.db
2874
- .query("events")
2875
- .withIndex("type_time", (q) =>
2876
- q.eq("type", "dashboard_viewed").gte("timestamp", since),
2877
- )
2878
- .filter((q) => memberIds.includes(q.field("actorId")))
2879
- .collect();
2880
-
2881
- return {
2882
- totalViews: dashboardViews.length,
2883
- uniqueUsers: new Set(dashboardViews.map((e) => e.actorId)).size,
2884
- averageSessionDuration:
2885
- dashboardViews.reduce(
2886
- (sum, e) => sum + (e.metadata.sessionDuration || 0),
2887
- 0,
2888
- ) / dashboardViews.length,
2889
- };
2890
- },
2891
- });
2892
- ```
2893
-
2894
- **Example: UI Preferences Sync**
2895
-
2896
- ```typescript
2897
- // Update user preferences (creates ui_preferences thing if not exists)
2898
- export const updatePreferences = mutation({
2899
- args: {
2900
- userId: v.id("entities"),
2901
- theme: v.optional(
2902
- v.union(v.literal("light"), v.literal("dark"), v.literal("system")),
2903
- ),
2904
- language: v.optional(v.string()),
2905
- },
2906
- handler: async (ctx, { userId, theme, language }) => {
2907
- // Get or create ui_preferences entity
2908
- let prefs = await ctx.db
2909
- .query("entities")
2910
- .withIndex("by_type", (q) => q.eq("type", "ui_preferences"))
2911
- .filter((q) => q.eq(q.field("properties.userId"), userId))
2912
- .first();
2913
-
2914
- if (!prefs) {
2915
- // Create new preferences entity
2916
- const prefsId = await ctx.db.insert("entities", {
2917
- type: "ui_preferences",
2918
- name: `Preferences for user ${userId}`,
2919
- properties: {
2920
- userId,
2921
- theme: theme || "system",
2922
- language: language || "en",
2923
- timezone: "UTC",
2924
- dashboardLayout: {
2925
- sidebarCollapsed: false,
2926
- defaultView: "grid",
2927
- itemsPerPage: 20,
2928
- },
2929
- notifications: { email: true, push: false, sms: false, inApp: true },
2930
- accessibility: {
2931
- reducedMotion: false,
2932
- highContrast: false,
2933
- fontSize: "medium",
2934
- updatedAt: Date.now(),
2935
- },
2936
- updatedAt: Date.now(),
2937
- },
2938
- status: "active",
2939
- createdAt: Date.now(),
2940
- updatedAt: Date.now(),
2941
- });
2942
-
2943
- prefs = await ctx.db.get(prefsId);
2944
- } else {
2945
- // Update existing preferences
2946
- await ctx.db.patch(prefs._id, {
2947
- properties: {
2948
- ...prefs.properties,
2949
- theme: theme || prefs.properties.theme,
2950
- language: language || prefs.properties.language,
2951
- updatedAt: Date.now(),
2952
- },
2953
- updatedAt: Date.now(),
2954
- });
2955
- }
2956
-
2957
- // Log preferences_updated event
2958
- if (theme) {
2959
- await ctx.db.insert("events", {
2960
- type: "theme_changed",
2961
- actorId: userId,
2962
- targetId: prefs._id,
2963
- timestamp: Date.now(),
2964
- metadata: {
2965
- previousTheme: prefs.properties.theme,
2966
- newTheme: theme,
2967
- },
2968
- });
2969
- }
2970
-
2971
- return { success: true };
2972
- },
2973
- });
2974
-
2975
- // Frontend hook
2976
- export function usePreferences(userId: string) {
2977
- const prefs = useQuery(api.queries.preferences.get, { userId });
2978
- const updatePrefs = useMutation(api.mutations.preferences.update);
2979
-
2980
- return { preferences: prefs?.properties, updatePreferences: updatePrefs };
2981
- }
2982
- ```
2983
-
2984
- ### Key Frontend Patterns
2985
-
2986
- **1. Thing as Content Collection**
2987
-
2988
- ```typescript
2989
- // src/content/config.ts
2990
- const agentsCollection = defineCollection({
2991
- type: "data",
2992
- loader: async () => {
2993
- const convex = new ConvexHttpClient(env.CONVEX_URL);
2994
- const agents = await convex.query(api.queries.entities.list, {
2995
- type: "strategy_agent",
2996
- });
2997
- return agents;
2998
- },
2999
- });
3000
- ```
3001
-
3002
- **2. Real-time Dashboard Stats**
3003
-
3004
- ```tsx
3005
- export function DashboardStats({ groupId }) {
3006
- // Subscribes to changes - auto-updates when events are logged!
3007
- const stats = useQuery(api.queries.dashboard.getStats, { groupId });
3008
-
3009
- return <StatsCards data={stats} />;
3010
- }
3011
- ```
3012
-
3013
- **3. Permission-Based Rendering**
3014
-
3015
- ```tsx
3016
- export function AdminPanel({ userId, groupId }) {
3017
- const membership = useQuery(api.queries.groups.getMembership, {
3018
- userId,
3019
- groupId,
3020
- });
3021
-
3022
- if (membership?.metadata?.role !== "group_owner") {
3023
- return <div>Access denied</div>;
3024
- }
3025
-
3026
- return <AdminDashboard />;
3027
- }
3028
- ```
3029
-
3030
- **4. Astro SSR with Ontology**
3031
-
3032
- ```astro
3033
- ---
3034
- // src/pages/group/[groupId]/dashboard.astro
3035
- import { ConvexHttpClient } from 'convex/browser';
3036
- import { api } from '@/convex/_generated/api';
3037
-
3038
- const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
3039
-
3040
- // Fetch group
3041
- const group = await convex.query(api.queries.groups.get, {
3042
- id: Astro.params.groupId,
3043
- });
3044
-
3045
- // Fetch group members (connections where relationshipType = "member_of")
3046
- const members = await convex.query(api.queries.groups.getMembers, {
3047
- groupId: Astro.params.groupId,
3048
- });
3049
- ---
3050
-
3051
- <Layout title={group.name}>
3052
- <h1>{group.name} Dashboard</h1>
3053
- <p>Plan: {group.settings.plan}</p>
3054
- <p>Members: {members.length} / {group.settings.limits.users}</p>
3055
-
3056
- <!-- Real-time stats component -->
3057
- <GroupStats client:load groupId={group._id} />
3058
- </Layout>
3059
- ```
3060
-
3061
- This demonstrates how the complete ontology (things, connections, events, knowledge) powers the entire frontend architecture through clean, type-safe queries and real-time subscriptions.
3062
-
3063
- ---
3064
-
3065
- ## For Implementers: Using the Universal Language
3066
-
3067
- ### AI Agents: The 6-Question Framework
3068
-
3069
- When implementing ANY feature, ask these 6 questions (maps to 6 dimensions):
3070
-
3071
- 1. **Groups** - Which group owns this? Any parent/child relationships?
3072
- 2. **People** - Who can access/modify this? What role is required?
3073
- 3. **Things** - What entities are involved? Which thing types?
3074
- 4. **Connections** - How do they relate? Which connection types?
3075
- 5. **Events** - What actions need logging? Which event types?
3076
- 6. **Knowledge** - What needs to be learned/searched? Labels? Chunks? Embeddings?
3077
-
3078
- **Example: User Purchases a Course**
3079
-
3080
- 1. **Groups** - User's organization (groupId scoping)
3081
- 2. **People** - User (role: customer), Creator (role: org_owner)
3082
- 3. **Things** - User thing, Course thing, Payment thing
3083
- 4. **Connections** - User → Course (enrolled_in), User → Payment (transacted)
3084
- 5. **Events** - course_enrolled, payment_processed
3085
- 6. **Knowledge** - Course chunks (RAG), "education" label, "video" label
3086
-
3087
- **Pattern Learned:** Every feature maps to all 6 dimensions. This is the universal pattern.
3088
-
3089
- ### Humans: Why This Matters
3090
-
3091
- **You're building the universal code generation language.**
3092
-
3093
- Your AI agents now have a complete, unambiguous data model. They will generate consistent database operations because they understand the underlying structure.
3094
-
3095
- **Key insights:**
3096
-
3097
- - The ontology models reality, not your app (that's why it never breaks)
3098
- - Each feature AI generates makes the NEXT feature more accurate
3099
- - You're not managing technical debt—you're accumulating technical credit
3100
- - 100 features in, your codebase is EASIER to work with, not harder
3101
-
3102
- ### Developers: Pattern Recognition
3103
-
3104
- **You have a schema that will never need major refactoring.**
3105
-
3106
- **Adding features:**
3107
-
3108
- - New entity type? → Add to `properties`, no schema migration
3109
- - New relationship? → Use existing connection types + metadata
3110
- - New protocol? → Add `metadata.protocol`, no new tables
3111
- - New workflow? → Compose existing services via Effect.ts
3112
-
3113
- **What you DON'T do:**
3114
-
3115
- - ❌ Create custom tables (map to 6 dimensions instead)
3116
- - ❌ Add protocol-specific columns (use metadata)
3117
- - ❌ Schema migrations for new fields (use properties)
3118
- - ❌ Hardcode patterns (use provider interface)
3119
-
3120
- **What you DO:**
3121
-
3122
- - ✅ Map features to 6 dimensions (groups, people, things, connections, events, knowledge)
3123
- - ✅ Use flexible properties for type-specific data
3124
- - ✅ Use metadata for protocol identity
3125
- - ✅ Compose services via Effect.ts
3126
- - ✅ Log all actions as events (complete audit trail)
3127
-
3128
- ### The Learning Curve
3129
-
3130
- **Generation 1-10: Learning the ontology (85% accuracy)**
3131
-
3132
- - You're teaching AI the 6 dimensions
3133
- - Patterns are being established
3134
- - Services are being created
3135
-
3136
- **Generation 11-50: Pattern recognition (90-93% accuracy)**
3137
-
3138
- - AI recognizes the universal patterns
3139
- - Services are being reused
3140
- - Composition is happening
3141
-
3142
- **Generation 51-100: Pattern mastery (96-98% accuracy)**
3143
-
3144
- - AI has internalized the structure
3145
- - Generation is deterministic
3146
- - You're reviewing, not debugging
3147
-
3148
- **Generation 100+: Generalized patterns (98%+ accuracy)**
3149
-
3150
- - AI doesn't need to think
3151
- - Every decision is pattern-based
3152
- - You're the architect, AI is the builder
3153
-
3154
- **This ontology is complete. It's ready for production. It's the foundation for 98% AI code generation accuracy.**
3155
-
3156
- ---
3157
-
3158
- ## Implementation Requirements
3159
-
3160
- **Critical:** The ontology provides flexibility. These requirements provide guardrails.
3161
-
3162
- While the 6-dimension ontology models reality and never changes, **implementation details** matter for correctness, performance, and scale. This section defines mandatory validation, retention, and operational patterns.
3163
-
3164
- ---
3165
-
3166
- ### 1. Type Safety & Runtime Validation
3167
-
3168
- **Problem:** `properties` is a JSON blob. The database won't enforce that a `product` has a `price`.
3169
-
3170
- **Solution:** Mandatory runtime validation using Zod/Valibot schemas.
3171
-
3172
- ```typescript
3173
- // Define schemas for each ThingType
3174
- const ProductPropertiesSchema = z.object({
3175
- title: z.string(),
3176
- description: z.string(),
3177
- price: z.number().positive(),
3178
- currency: z.enum(['USD', 'EUR', 'GBP']),
3179
- inventory: z.number().int().nonnegative(),
3180
- sku: z.string().optional(),
3181
- });
3182
-
3183
- // Validate on create/update
3184
- export const createProduct = mutation({
3185
- handler: async (ctx, args) => {
3186
- // Parse and validate
3187
- const properties = ProductPropertiesSchema.parse(args.properties);
3188
-
3189
- await ctx.db.insert('things', {
3190
- type: 'product',
3191
- name: properties.title,
3192
- properties,
3193
- status: 'draft',
3194
- createdAt: Date.now(),
3195
- });
3196
- },
3197
- });
3198
- ```
3199
-
3200
- **Metadata Protocol Validation:**
3201
-
3202
- ```typescript
3203
- const ProtocolMetadataSchema = z.discriminatedUnion('protocol', [
3204
- z.object({ protocol: z.literal('x402'), network: z.string(), txHash: z.string() }),
3205
- z.object({ protocol: z.literal('a2a'), platform: z.string(), messageType: z.string() }),
3206
- z.object({ protocol: z.literal('acp'), agentPlatform: z.string(), eventType: z.string() }),
3207
- z.object({ protocol: z.literal('ap2'), mandateType: z.enum(['intent', 'cart']) }),
3208
- ]);
3209
- ```
3210
-
3211
- **Rule:** Every `properties` field and protocol `metadata` MUST be validated at the application boundary.
3212
-
3213
- ---
3214
-
3215
- ### 1b. Protocol Registry Pattern (Scalable Protocol Validation)
3216
-
3217
- **Problem:** Hardcoded protocol validation doesn't scale to 50+ protocols. Each new protocol requires code changes.
3218
-
3219
- **Solution:** Store protocol definitions in database, validate dynamically. Protocols are data, not code.
3220
-
3221
- **Protocol Definition Table:**
3222
-
3223
- ```typescript
3224
- defineTable('protocol_definitions')
3225
- .index('by_name', ['name'])
3226
- .index('by_category', ['category', 'status']);
3227
-
3228
- {
3229
- _id: Id<'protocol_definitions'>,
3230
- name: string, // e.g., 'x402', 'solana_pay', 'a2a'
3231
- version: string, // e.g., '1.0', '2.1'
3232
- category: 'payment' | 'messaging' | 'commerce' | 'identity' | 'storage',
3233
- schema: {
3234
- required: string[], // Required metadata fields
3235
- optional: string[], // Optional metadata fields
3236
- types: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array'>
3237
- },
3238
- examples: any[], // Valid metadata examples
3239
- documentation?: string, // Link to protocol spec
3240
- status: 'active' | 'deprecated' | 'experimental',
3241
- createdAt: number,
3242
- updatedAt: number,
3243
- }
3244
- ```
3245
-
3246
- **Example Protocol Definitions:**
3247
-
3248
- ```typescript
3249
- // X402 (HTTP 402 Payment)
3250
- {
3251
- name: 'x402',
3252
- version: '1.0',
3253
- category: 'payment',
3254
- schema: {
3255
- required: ['network', 'txHash'],
3256
- optional: ['amount', 'token', 'scheme'],
3257
- types: {
3258
- network: 'string',
3259
- txHash: 'string',
3260
- amount: 'number',
3261
- token: 'string',
3262
- scheme: 'string'
3263
- }
3264
- },
3265
- examples: [
3266
- { network: 'base', txHash: '0x123...', amount: 0.01, scheme: 'permit' }
3267
- ],
3268
- documentation: 'https://x402.org/spec',
3269
- status: 'active'
3270
- }
3271
-
3272
- // Solana Pay (NEW - added without code changes)
3273
- {
3274
- name: 'solana_pay',
3275
- version: '1.0',
3276
- category: 'payment',
3277
- schema: {
3278
- required: ['signature', 'slot'],
3279
- optional: ['memo', 'reference'],
3280
- types: {
3281
- signature: 'string',
3282
- slot: 'number',
3283
- memo: 'string',
3284
- reference: 'string'
3285
- }
3286
- },
3287
- examples: [
3288
- { signature: '5J7kMQ...', slot: 123456789, memo: 'Coffee payment' }
3289
- ],
3290
- documentation: 'https://docs.solanapay.com',
3291
- status: 'active'
3292
- }
3293
-
3294
- // A2A (Agent-to-Agent)
3295
- {
3296
- name: 'a2a',
3297
- version: '1.0',
3298
- category: 'messaging',
3299
- schema: {
3300
- required: ['platform', 'messageType'],
3301
- optional: ['taskId', 'priority'],
3302
- types: {
3303
- platform: 'string',
3304
- messageType: 'string',
3305
- taskId: 'string',
3306
- priority: 'number'
3307
- }
3308
- },
3309
- examples: [
3310
- { platform: 'elizaos', messageType: 'task_delegation', taskId: 'task_123' }
3311
- ],
3312
- status: 'active'
3313
- }
3314
- ```
3315
-
3316
- **Generic Validator:**
3317
-
3318
- ```typescript
3319
- export async function validateProtocolMetadata(
3320
- ctx: QueryCtx,
3321
- metadata: any
3322
- ): Promise<{ valid: boolean; errors?: string[]; warnings?: string[] }> {
3323
- if (!metadata.protocol) {
3324
- return { valid: false, errors: ['Missing protocol field'] };
3325
- }
3326
-
3327
- // Fetch protocol definition
3328
- const protocolDef = await ctx.db
3329
- .query('protocol_definitions')
3330
- .withIndex('by_name')
3331
- .filter(q => q.eq(q.field('name'), metadata.protocol))
3332
- .first();
3333
-
3334
- if (!protocolDef) {
3335
- // Unknown protocol = warning, not error (forward compatibility)
3336
- return {
3337
- valid: true,
3338
- warnings: [`Unknown protocol: ${metadata.protocol}. Validation skipped.`]
3339
- };
3340
- }
3341
-
3342
- if (protocolDef.status === 'deprecated') {
3343
- return {
3344
- valid: true,
3345
- warnings: [`Protocol ${metadata.protocol} is deprecated. Consider upgrading.`]
3346
- };
3347
- }
3348
-
3349
- // Validate required fields
3350
- const errors: string[] = [];
3351
- for (const field of protocolDef.schema.required) {
3352
- if (!(field in metadata)) {
3353
- errors.push(`Missing required field: ${field}`);
3354
- }
3355
- }
3356
-
3357
- // Validate types
3358
- for (const [field, expectedType] of Object.entries(protocolDef.schema.types)) {
3359
- if (field in metadata) {
3360
- const actualType = typeof metadata[field];
3361
- if (actualType !== expectedType) {
3362
- errors.push(`Field ${field} should be ${expectedType}, got ${actualType}`);
3363
- }
3364
- }
3365
- }
3366
-
3367
- return { valid: errors.length === 0, errors };
3368
- }
3369
- ```
3370
-
3371
- **Usage in Mutations:**
3372
-
3373
- ```typescript
3374
- export const createProtocolConnection = mutation({
3375
- handler: async (ctx, { fromThingId, toThingId, relationshipType, metadata }) => {
3376
- // Validate protocol metadata
3377
- const validation = await validateProtocolMetadata(ctx, metadata);
3378
-
3379
- if (!validation.valid) {
3380
- throw new Error(`Invalid protocol metadata: ${validation.errors!.join(', ')}`);
3381
- }
3382
-
3383
- if (validation.warnings) {
3384
- console.warn(validation.warnings.join(', '));
3385
- }
3386
-
3387
- await ctx.db.insert('connections', {
3388
- fromThingId,
3389
- toThingId,
3390
- relationshipType,
3391
- metadata,
3392
- createdAt: Date.now(),
3393
- });
3394
- },
3395
- });
3396
- ```
3397
-
3398
- **Adding New Protocols (Zero Code Changes):**
3399
-
3400
- ```typescript
3401
- // Platform owner adds new blockchain/protocol via admin UI
3402
- export const registerProtocol = mutation({
3403
- handler: async (ctx, args) => {
3404
- // Only platform owners can register protocols
3405
- if (ctx.auth.role !== 'platform_owner') {
3406
- throw new Error('Unauthorized');
3407
- }
3408
-
3409
- await ctx.db.insert('protocol_definitions', {
3410
- name: args.name,
3411
- version: args.version,
3412
- category: args.category,
3413
- schema: args.schema,
3414
- examples: args.examples,
3415
- documentation: args.documentation,
3416
- status: 'active',
3417
- createdAt: Date.now(),
3418
- updatedAt: Date.now(),
3419
- });
3420
- },
3421
- });
3422
-
3423
- // Now the protocol works immediately
3424
- await createProtocolConnection(ctx, {
3425
- fromThingId: userId,
3426
- toThingId: merchantId,
3427
- relationshipType: 'transacted',
3428
- metadata: {
3429
- protocol: 'solana_pay', // NEW PROTOCOL
3430
- signature: '5J7kMQ...',
3431
- slot: 123456789
3432
- }
3433
- });
3434
- ```
3435
-
3436
- **Advanced: Protocol Inheritance (Optional):**
3437
-
3438
- ```typescript
3439
- // Base protocol for all blockchain payments
3440
- {
3441
- name: 'blockchain_payment_base',
3442
- category: 'payment',
3443
- schema: {
3444
- required: ['txHash', 'network'],
3445
- types: { txHash: 'string', network: 'string' }
3446
- }
3447
- }
3448
-
3449
- // Specific protocols extend the base
3450
- {
3451
- name: 'ethereum_payment',
3452
- extends: 'blockchain_payment_base', // Inherits base schema
3453
- schema: {
3454
- required: ['gasUsed'], // Additional required fields
3455
- types: { gasUsed: 'number' }
3456
- }
3457
- }
3458
- ```
3459
-
3460
- **Benefits:**
3461
-
3462
- 1. **Zero Code Deploys:** Add protocols via database insert, not code deployment
3463
- 2. **Self-Documenting:** Schema + examples live with the protocol
3464
- 3. **Versioning:** Track protocol versions over time
3465
- 4. **Forward Compatible:** Unknown protocols don't break (just warn)
3466
- 5. **AI-Friendly:** AI can read protocol definitions and generate correct metadata
3467
- 6. **Governance:** Platform owner approves new protocols before activation
3468
- 7. **Infinite Scalability:** Support 1,000+ protocols without code bloat
3469
-
3470
- **Rule:** Protocols are data, not code. The ontology stays simple, protocols are infinitely extensible.
3471
-
3472
- ---
3473
-
3474
- ### 1c. Protocol Superpowers: The Universal Protocol Layer
3475
-
3476
- The Protocol Registry Pattern unlocks 10 superpowers that make ONE Platform the universal protocol adapter for the internet.
3477
-
3478
- #### Superpower 1: Universal Protocol Adapter
3479
-
3480
- **The Magic:** Same interface, infinite protocols.
3481
-
3482
- ```typescript
3483
- // Application code doesn't care which protocol
3484
- function processPayment(connection: Connection) {
3485
- const { protocol, ...details } = connection.metadata;
3486
- const handler = getProtocolHandler(protocol);
3487
- return handler.process(details);
3488
- }
3489
-
3490
- // Works for ALL payment protocols
3491
- metadata: { protocol: 'stripe' | 'solana_pay' | 'lightning' | 'paypal' | ... }
3492
- ```
3493
-
3494
- **Impact:** Your app accepts payments from **every blockchain and payment system** without changing application logic.
3495
-
3496
- ---
3497
-
3498
- #### Superpower 2: Protocol Composability
3499
-
3500
- **Cross-protocol workflows are trivial.**
3501
-
3502
- ```typescript
3503
- // Scenario: Pay with Solana → Mint NFT on Ethereum → Email receipt
3504
-
3505
- // Step 1: Solana payment
3506
- { relationshipType: 'transacted', metadata: { protocol: 'solana_pay', signature: '5J7...' } }
3507
-
3508
- // Step 2: NFT minted (different blockchain!)
3509
- { relationshipType: 'owns', metadata: { protocol: 'ethereum', tokenId: '42' } }
3510
-
3511
- // Step 3: Email receipt
3512
- { relationshipType: 'notified', metadata: { protocol: 'smtp', messageId: 'msg_123' } }
3513
- ```
3514
-
3515
- **Impact:** Pay with Bitcoin, mint on Polygon, notify via Discord—all in one seamless flow.
3516
-
3517
- ---
3518
-
3519
- #### Superpower 3: Protocol Time Travel (Versioning)
3520
-
3521
- **Support multiple protocol versions simultaneously.**
3522
-
3523
- ```typescript
3524
- // 2024: X402 v1.0
3525
- { protocol: 'x402', version: '1.0', schema: { required: ['network', 'txHash'] } }
3526
-
3527
- // 2025: X402 v2.0 adds new fields
3528
- { protocol: 'x402', version: '2.0', schema: { required: ['network', 'txHash', 'proofOfPayment'] } }
3529
-
3530
- // Old connections still work (v1.0)
3531
- // New connections use v2.0
3532
- ```
3533
-
3534
- **Impact:** Protocol upgrades don't break existing data. Backward compatibility is automatic.
3535
-
3536
- ---
3537
-
3538
- #### Superpower 4: AI Protocol Discovery
3539
-
3540
- **AI agents learn new protocols on-the-fly.**
3541
-
3542
- ```typescript
3543
- // AI workflow:
3544
- // 1. User: "Pay this invoice with Solana"
3545
- // 2. AI queries protocol registry
3546
- const protocols = await ctx.db.query('protocol_definitions')
3547
- .withIndex('by_category')
3548
- .filter(q => q.eq(q.field('category'), 'payment'))
3549
- .collect();
3550
-
3551
- // 3. AI finds: solana_pay
3552
- // 4. AI reads schema: { required: ['signature', 'slot'] }
3553
- // 5. AI generates correct metadata automatically
3554
- ```
3555
-
3556
- **Impact:** AI agents **discover and use new protocols** without human intervention or code updates.
3557
-
3558
- ---
3559
-
3560
- #### Superpower 5: Protocol Marketplace
3561
-
3562
- **Community-driven protocol library with network effects.**
3563
-
3564
- ```typescript
3565
- // Developer publishes integration
3566
- await registerProtocol({
3567
- name: 'stripe_connect',
3568
- publisher: 'stripe_official',
3569
- documentation: 'https://stripe.com/docs/connect',
3570
- pricing: { free: true }
3571
- });
3572
-
3573
- // Other users instantly use it (no code deployment)
3574
- ```
3575
-
3576
- **Impact:** Platform becomes more valuable with every protocol added. Developers publish integrations like npm packages.
3577
-
3578
- ---
3579
-
3580
- #### Superpower 6: Cross-Protocol Analytics
3581
-
3582
- **Universal analytics across all protocols.**
3583
-
3584
- ```typescript
3585
- // Query: "Which payment protocol has highest success rate?"
3586
- const stats = await ctx.db.query('connections')
3587
- .filter(q => q.eq(q.field('relationshipType'), 'transacted'))
3588
- .collect();
3589
-
3590
- // Group by protocol
3591
- const byProtocol = stats.reduce((acc, conn) => {
3592
- acc[conn.metadata.protocol] = (acc[conn.metadata.protocol] || 0) + 1;
3593
- return acc;
3594
- }, {});
3595
-
3596
- // Result: { stripe: 1200, solana_pay: 340, x402: 89 }
3597
- ```
3598
-
3599
- **Impact:** Compare Stripe vs. Solana vs. Lightning Network performance in one query.
3600
-
3601
- ---
3602
-
3603
- #### Superpower 7: Protocol Fallback Chains
3604
-
3605
- **Automatic fallback when protocols fail.**
3606
-
3607
- ```typescript
3608
- // User preference: Try Solana first, fallback to Stripe
3609
- const paymentProtocols = [
3610
- { protocol: 'solana_pay', priority: 1 },
3611
- { protocol: 'stripe', priority: 2 },
3612
- { protocol: 'paypal', priority: 3 }
3613
- ];
3614
-
3615
- async function processPaymentWithFallback(amount: number) {
3616
- for (const { protocol } of paymentProtocols) {
3617
- try {
3618
- return await processPayment(protocol, amount);
3619
- } catch (error) {
3620
- console.log(`${protocol} failed, trying next...`);
3621
- }
3622
- }
3623
- }
3624
- ```
3625
-
3626
- **Impact:** **Resilience.** If Solana network is congested, automatically fall back to Ethereum or credit card.
3627
-
3628
- ---
3629
-
3630
- #### Superpower 8: Protocol Interoperability (Rosetta Stone)
3631
-
3632
- **Translate between protocols.**
3633
-
3634
- ```typescript
3635
- // Example: Stripe → Solana Pay translation
3636
- async function translateProtocol(connection: Connection, targetProtocol: string) {
3637
- const translator = await getTranslator(connection.metadata.protocol, targetProtocol);
3638
-
3639
- // Stripe: { chargeId, amount, currency }
3640
- // Solana: { signature, slot, amount }
3641
-
3642
- return translator.translate(connection.metadata);
3643
- }
3644
- ```
3645
-
3646
- **Impact:** **Protocol bridges.** Convert Stripe payment to Solana transaction, or vice versa.
3647
-
3648
- ---
3649
-
3650
- #### Superpower 9: Protocol Compliance & Auditing
3651
-
3652
- **Track regulatory requirements per protocol.**
3653
-
3654
- ```typescript
3655
- {
3656
- name: 'stripe',
3657
- compliance: {
3658
- pci_dss: true,
3659
- gdpr: true,
3660
- kyc: true,
3661
- regions: ['US', 'EU', 'UK']
3662
- }
3663
- }
3664
-
3665
- // Query: "Show GDPR-compliant payment protocols for EU users"
3666
- const compliant = await ctx.db.query('protocol_definitions')
3667
- .filter(q => q.eq(q.field('compliance.gdpr'), true))
3668
- .collect();
3669
- ```
3670
-
3671
- **Impact:** **Automatic compliance.** Filter protocols by regulatory requirements per region.
3672
-
3673
- ---
3674
-
3675
- #### Superpower 10: Protocol-Agnostic Applications
3676
-
3677
- **Complete decoupling from specific protocols.**
3678
-
3679
- ```
3680
- Traditional App:
3681
- ├─ Stripe integration (hardcoded)
3682
- ├─ PayPal integration (hardcoded)
3683
- ├─ Solana integration (hardcoded)
3684
- └─ Each requires separate code, testing, maintenance
3685
-
3686
- ONE App:
3687
- ├─ Universal payment interface
3688
- └─ Protocol registry handles everything
3689
- ├─ Stripe ✅
3690
- ├─ PayPal ✅
3691
- ├─ Solana ✅
3692
- ├─ Lightning ✅
3693
- ├─ ... infinite protocols
3694
- ```
3695
-
3696
- **Adding new protocols:**
3697
- - Add Bitcoin support? **Database insert.**
3698
- - Add Polygon support? **Database insert.**
3699
- - Add Apple Pay support? **Database insert.**
3700
- - Add future blockchain (2030)? **Database insert.**
3701
-
3702
- **No code changes. Ever.**
3703
-
3704
- ---
3705
-
3706
- ### The Economic Moat: Unstoppable Network Effects
3707
-
3708
- ```
3709
- More protocols → More users (support their preferred payment/blockchain)
3710
- ↓
3711
- More users → More developers (build on the platform)
3712
- ↓
3713
- More developers → More protocols (publish integrations)
3714
- ↓
3715
- More protocols → More users (cycle repeats)
3716
- ```
3717
-
3718
- **Why competitors can't catch up:**
3719
- - They hardcode protocols (slow, brittle)
3720
- - You have a protocol marketplace (fast, extensible)
3721
- - Every new protocol makes your platform MORE valuable
3722
- - Their platform gets MORE complex with each protocol
3723
- - Your platform stays SIMPLE (ontology never changes)
3724
-
3725
- ---
3726
-
3727
- ### The Vision: ONE Platform as "Stripe for Everything"
3728
-
3729
- **Stripe's superpower:** One API for all payment methods
3730
- **ONE's superpower:** One ontology for all protocols
3731
-
3732
- **In 5 years:**
3733
- - 1,000+ protocols in the registry
3734
- - Developers publish protocol integrations like npm packages
3735
- - AI agents automatically discover and use new protocols
3736
- - Applications are truly protocol-agnostic
3737
- - The ontology becomes the **universal standard**
3738
-
3739
- **This is the superpower.** Not just supporting protocols—**becoming the protocol layer for the entire internet.**
3740
-
3741
- ---
3742
-
3743
- ### 2. Event Retention Policies
3744
-
3745
- **Problem:** Storing all events forever causes storage explosion and query degradation.
3746
-
3747
- **Solution:** Define retention by event type (comprehensive policy for all 52 types).
3748
-
3749
- | Event Type | Retention | Reason |
3750
- |------------|-----------|--------|
3751
- | **Lifecycle (Forever - System Integrity)** |||
3752
- | `thing_created`, `thing_updated`, `thing_deleted` | Forever | System integrity & audit |
3753
- | **User Events (Forever - Legal/Compliance)** |||
3754
- | `user_registered`, `user_verified` | Forever | Legal/audit requirements |
3755
- | **Financial (7 Years - Compliance)** |||
3756
- | `payment_event`, `subscription_event` | 7 years | Financial compliance (GAAP) |
3757
- | **Blockchain (Forever - Immutability)** |||
3758
- | `tokens_purchased`, `tokens_transferred`, `tokens_staked`, `tokens_unstaked` | Forever | Blockchain audit trail |
3759
- | `token_minted`, `token_burned`, `tokens_bridged` | Forever | On-chain state tracking |
3760
- | `nft_minted`, `nft_transferred`, `contract_deployed` | Forever | NFT provenance |
3761
- | **Educational Records (Forever - Accreditation)** |||
3762
- | `course_enrolled`, `lesson_completed`, `course_completed`, `certificate_earned` | Forever | Academic transcripts |
3763
- | **Cycle/Revenue (Forever - Financial)** |||
3764
- | `cycle_revenue_collected`, `org_revenue_generated`, `revenue_share_distributed`, `treasury_withdrawal` | Forever | Platform revenue tracking |
3765
- | **Authentication (1 Year - Security Audit)** |||
3766
- | `password_reset_requested`, `password_reset_completed` | 1 year | Security audit trail |
3767
- | `email_verification_sent`, `email_verified` | 1 year | Verification history |
3768
- | `two_factor_enabled`, `two_factor_disabled` | 1 year | Security changes |
3769
- | **Group Events (1 Year - Organizational History)** |||
3770
- | `user_invited_to_group`, `user_joined_group`, `user_removed_from_group` | 1 year | Membership history |
3771
- | **Engagement (1 Year - Analytics)** |||
3772
- | `content_event` (created/updated/deleted/shared/liked) | 1 year | Content lifecycle |
3773
- | `content_event` (viewed) | 1 year | Engagement analytics |
3774
- | `livestream_event` | 1 year | Stream analytics |
3775
- | `commerce_event` | 1 year | Commerce patterns |
3776
- | `mandate_event` | 1 year | Purchase intents |
3777
- | **Agent/Task (180 Days - Operational)** |||
3778
- | `agent_executed`, `agent_completed`, `agent_failed` | 180 days | Agent performance |
3779
- | `task_event` | 180 days | Task delegation history |
3780
- | `communication_event` | 180 days | Agent-to-agent comms |
3781
- | **Analytics (90 Days - Reporting)** |||
3782
- | `metric_calculated`, `insight_generated`, `prediction_made` | 90 days | Analytics snapshots |
3783
- | `optimization_applied`, `report_generated` | 90 days | Report history |
3784
- | `cycle_request`, `cycle_completed`, `cycle_failed`, `cycle_quota_exceeded` | 90 days | Cycle tracking |
3785
- | **UI/UX (90 Days - Low-Value)** |||
3786
- | `dashboard_viewed`, `settings_updated`, `theme_changed`, `preferences_updated` | 90 days | UI analytics |
3787
- | `profile_updated` | 90 days | Profile change history |
3788
- | **Session (30 Days - Operational)** |||
3789
- | `user_login`, `user_logout` | 30 days | Session tracking |
3790
- | `notification_event` | 30 days | Delivery tracking only |
3791
- | `referral_event` | 30 days | Referral tracking |
3792
- | **Clone Creation (Forever - Asset Tracking)** |||
3793
- | `voice_cloned`, `appearance_cloned` | Forever | AI asset creation |
3794
- | **Price Monitoring (90 Days - Market Data)** |||
3795
- | `price_event` | 90 days | Price change history |
3796
-
3797
- **Implementation:**
3798
-
3799
- ```typescript
3800
- // Daily cleanup cron
3801
- export const cleanupOldEvents = internalMutation({
3802
- handler: async (ctx) => {
3803
- const now = Date.now();
3804
- const DAY_MS = 24 * 60 * 60 * 1000;
3805
-
3806
- const retentionPolicies = {
3807
- // 90 days
3808
- dashboard_viewed: 90 * DAY_MS,
3809
- theme_changed: 90 * DAY_MS,
3810
- preferences_updated: 90 * DAY_MS,
3811
- settings_updated: 90 * DAY_MS,
3812
- profile_updated: 90 * DAY_MS,
3813
- metric_calculated: 90 * DAY_MS,
3814
- insight_generated: 90 * DAY_MS,
3815
- prediction_made: 90 * DAY_MS,
3816
- optimization_applied: 90 * DAY_MS,
3817
- report_generated: 90 * DAY_MS,
3818
- cycle_request: 90 * DAY_MS,
3819
- cycle_completed: 90 * DAY_MS,
3820
- cycle_failed: 90 * DAY_MS,
3821
- cycle_quota_exceeded: 90 * DAY_MS,
3822
- price_event: 90 * DAY_MS,
3823
-
3824
- // 30 days
3825
- user_login: 30 * DAY_MS,
3826
- user_logout: 30 * DAY_MS,
3827
- notification_event: 30 * DAY_MS,
3828
- referral_event: 30 * DAY_MS,
3829
-
3830
- // 180 days
3831
- agent_executed: 180 * DAY_MS,
3832
- agent_completed: 180 * DAY_MS,
3833
- agent_failed: 180 * DAY_MS,
3834
- task_event: 180 * DAY_MS,
3835
- communication_event: 180 * DAY_MS,
3836
-
3837
- // 1 year
3838
- password_reset_requested: 365 * DAY_MS,
3839
- password_reset_completed: 365 * DAY_MS,
3840
- email_verification_sent: 365 * DAY_MS,
3841
- email_verified: 365 * DAY_MS,
3842
- two_factor_enabled: 365 * DAY_MS,
3843
- two_factor_disabled: 365 * DAY_MS,
3844
- user_invited_to_group: 365 * DAY_MS,
3845
- user_joined_group: 365 * DAY_MS,
3846
- user_removed_from_group: 365 * DAY_MS,
3847
- content_event: 365 * DAY_MS,
3848
- livestream_event: 365 * DAY_MS,
3849
- commerce_event: 365 * DAY_MS,
3850
- mandate_event: 365 * DAY_MS,
3851
- };
3852
-
3853
- for (const [eventType, retention] of Object.entries(retentionPolicies)) {
3854
- const cutoff = now - retention;
3855
- const oldEvents = await ctx.db
3856
- .query('events')
3857
- .withIndex('by_type_time') // FIXED: Correct index name
3858
- .filter(q => q.eq(q.field('type'), eventType))
3859
- .filter(q => q.lt(q.field('timestamp'), cutoff))
3860
- .collect();
3861
-
3862
- for (const event of oldEvents) {
3863
- await ctx.db.delete(event._id);
3864
- }
3865
- }
3866
- },
3867
- });
3868
- ```
3869
-
3870
- **Rule:** All low-value events MUST be deleted after their retention period. Archive to cold storage if needed for compliance.
3871
-
3872
- ---
3873
-
3874
- ### 3. Knowledge Embedding Versioning
3875
-
3876
- **Problem:** Upgrading from `text-embedding-3-large` to `text-embedding-4` makes old embeddings incompatible.
3877
-
3878
- **Solution:** Keep core schema simple (single embedding). Use metadata for version tracking and separate table for multi-version storage.
3879
-
3880
- **Core Knowledge Schema (unchanged):**
3881
-
3882
- ```typescript
3883
- {
3884
- _id: Id<'knowledge'>,
3885
- knowledgeType: 'chunk',
3886
- text: string,
3887
- embedding?: number[], // Current active embedding
3888
- embeddingModel?: string, // e.g., "text-embedding-3-large"
3889
- embeddingDim?: number,
3890
- sourceThingId: Id<'things'>,
3891
- metadata: {
3892
- embeddingVersion: 'v3', // Track version for migration
3893
- needsReEmbedding?: boolean, // Flag for background jobs
3894
- },
3895
- createdAt: number,
3896
- }
3897
- ```
3898
-
3899
- **Optional: Multi-Version Storage (separate table for migration period):**
3900
-
3901
- ```typescript
3902
- // Only used during embedding model migrations
3903
- defineTable('embedding_versions')
3904
- .index('by_knowledge', ['knowledgeId', 'modelVersion'])
3905
-
3906
- {
3907
- _id: Id<'embedding_versions'>,
3908
- knowledgeId: Id<'knowledge'>,
3909
- modelVersion: 'v3' | 'v4',
3910
- model: string, // e.g., "text-embedding-3-large"
3911
- vector: number[],
3912
- dim: number,
3913
- createdAt: number,
3914
- }
3915
- ```
3916
-
3917
- **Migration Strategy:**
3918
-
3919
- 1. **Phase 1:** Create `embedding_versions` table, dual-write new embeddings
3920
- 2. **Phase 2:** Background job populates `embedding_versions` for existing knowledge
3921
- 3. **Phase 3:** Switch `knowledge.embedding` to point to new version
3922
- 4. **Phase 4:** Drop `embedding_versions` table after 30-day validation period
3923
- 5. **Phase 5:** Update `metadata.embeddingVersion` to 'v4'
3924
-
3925
- **Rule:** Core schema stays simple. Multi-version complexity is temporary and isolated to migration table.
3926
-
3927
- ---
3928
-
3929
- ### 4. Group Hierarchy Validation
3930
-
3931
- **Problem:** Circular references (Group A → parent: Group B → parent: Group A) cause infinite loops.
3932
-
3933
- **Solution:** Validation on insert/update + max depth limit.
3934
-
3935
- ```typescript
3936
- export const createGroup = mutation({
3937
- handler: async (ctx, { parentGroupId, ...rest }) => {
3938
- // Rule 1: Prevent circular references and max depth
3939
- if (parentGroupId) {
3940
- const ancestors = await getAncestors(ctx, parentGroupId); // Single call
3941
-
3942
- // Check max depth
3943
- if (ancestors.length >= 5) {
3944
- throw new Error('Maximum group nesting depth (5 levels) exceeded');
3945
- }
3946
-
3947
- // Check for circular reference (defensive - shouldn't happen if depth check works)
3948
- const ancestorIds = new Set(ancestors.map(g => g._id));
3949
- if (ancestorIds.has(parentGroupId)) {
3950
- throw new Error('Circular reference detected');
3951
- }
3952
- }
3953
-
3954
- // Create group
3955
- const groupId = await ctx.db.insert('groups', {
3956
- parentGroupId,
3957
- ...rest,
3958
- createdAt: Date.now(),
3959
- });
3960
-
3961
- return groupId;
3962
- },
3963
- });
3964
-
3965
- async function getAncestors(ctx, groupId: Id<'groups'>) {
3966
- const ancestors = [];
3967
- let current = await ctx.db.get(groupId);
3968
-
3969
- while (current?.parentGroupId && ancestors.length < 10) {
3970
- const parent = await ctx.db.get(current.parentGroupId);
3971
- if (!parent) break;
3972
- ancestors.push(parent);
3973
- current = parent;
3974
- }
3975
-
3976
- return ancestors;
3977
- }
3978
- ```
3979
-
3980
- **Rules:**
3981
- - Max depth: 5 levels
3982
- - Circular reference check on every insert/update
3983
- - Timeout protection: stop traversal after 10 iterations
3984
-
3985
- ---
3986
-
3987
- ### 5. Indexing Strategy
3988
-
3989
- **Problem:** Multi-tenant queries without proper indexes scan entire tables.
3990
-
3991
- **Required Indexes (Convex):**
3992
-
3993
- ```typescript
3994
- // groups
3995
- defineTable('groups')
3996
- .index('by_slug', ['slug'])
3997
- .index('by_parent', ['parentGroupId'])
3998
- .index('by_status', ['status', 'createdAt']);
3999
-
4000
- // things
4001
- defineTable('things')
4002
- .index('by_type', ['type', 'createdAt'])
4003
- .index('by_status', ['status', 'updatedAt'])
4004
- .index('by_type_status', ['type', 'status', 'createdAt']);
4005
-
4006
- // connections
4007
- defineTable('connections')
4008
- .index('by_from', ['fromThingId', 'relationshipType'])
4009
- .index('by_to', ['toThingId', 'relationshipType'])
4010
- .index('by_relationship', ['relationshipType', 'createdAt']);
4011
-
4012
- // events
4013
- defineTable('events')
4014
- .index('by_actor', ['actorId', 'timestamp'])
4015
- .index('by_target', ['targetId', 'timestamp'])
4016
- .index('by_type_time', ['type', 'timestamp'])
4017
- .index('by_actor_type', ['actorId', 'type', 'timestamp']);
4018
-
4019
- // knowledge
4020
- defineTable('knowledge')
4021
- .index('by_type', ['knowledgeType', 'createdAt'])
4022
- .index('by_source', ['sourceThingId', 'knowledgeType'])
4023
- .vectorIndex('by_embedding', {
4024
- vectorField: 'embedding',
4025
- dimensions: 3072,
4026
- filterFields: ['knowledgeType', 'sourceThingId'],
4027
- });
4028
- ```
4029
-
4030
- **Multi-Tenant Query Pattern:**
4031
-
4032
- ```typescript
4033
- // WRONG: Full table scan
4034
- const things = await ctx.db.query('things').filter(q => q.eq(q.field('type'), 'product')).collect();
4035
-
4036
- // RIGHT: Use compound index
4037
- const things = await ctx.db.query('things').withIndex('by_type', q => q.eq('type', 'product')).collect();
4038
- ```
4039
-
4040
- **Rule:** Every query MUST use an index. Never do full table scans in production.
4041
-
4042
- ---
4043
-
4044
- ### 6. Soft Delete Cascade Rules
4045
-
4046
- **Problem:** Soft-deleting a group leaves orphaned things/connections.
4047
-
4048
- **Solution:** Explicit cascade rules.
4049
-
4050
- ```typescript
4051
- export const softDeleteGroup = mutation({
4052
- handler: async (ctx, { groupId }) => {
4053
- // 1. Soft delete the group
4054
- await ctx.db.patch(groupId, {
4055
- status: 'archived',
4056
- deletedAt: Date.now(),
4057
- });
4058
-
4059
- // 2. CASCADE: Soft delete all child groups
4060
- const childGroups = await ctx.db
4061
- .query('groups')
4062
- .withIndex('by_parent')
4063
- .filter(q => q.eq(q.field('parentGroupId'), groupId))
4064
- .collect();
4065
-
4066
- for (const child of childGroups) {
4067
- await softDeleteGroup(ctx, { groupId: child._id });
4068
- }
4069
-
4070
- // 3. CASCADE: Soft delete all connections where group is involved
4071
- const connections = await ctx.db
4072
- .query('connections')
4073
- .filter(q =>
4074
- q.or(
4075
- q.eq(q.field('fromThingId'), groupId),
4076
- q.eq(q.field('toThingId'), groupId)
4077
- )
4078
- )
4079
- .collect();
4080
-
4081
- for (const conn of connections) {
4082
- await ctx.db.patch(conn._id, { deletedAt: Date.now() });
4083
- }
4084
-
4085
- // 4. Log cascade event
4086
- await ctx.db.insert('events', {
4087
- type: 'thing_deleted',
4088
- actorId: ctx.auth.userId!,
4089
- targetId: groupId,
4090
- timestamp: Date.now(),
4091
- metadata: {
4092
- thingType: 'group',
4093
- deletionType: 'soft',
4094
- cascadedChildren: childGroups.length,
4095
- cascadedConnections: connections.length,
4096
- },
4097
- });
4098
- },
4099
- });
4100
- ```
4101
-
4102
- **Cascade Matrix:**
4103
-
4104
- | Deleted Entity | Cascades To | Type |
4105
- |----------------|-------------|------|
4106
- | Group | Child groups, Connections | Soft delete |
4107
- | Thing | Connections, Knowledge links | Soft delete |
4108
- | Connection | *(none)* | Direct delete |
4109
- | Event | *(never deleted)* | Retention policy only |
4110
- | Knowledge | thingKnowledge links | Soft delete |
4111
-
4112
- **Rule:** Soft deletes MUST cascade to dependent entities. Log all cascade operations.
4113
-
4114
- ---
4115
-
4116
- ### 7. Connection Directionality & Performance
4117
-
4118
- **Problem:** Bidirectional relationships (e.g., "following") require two queries.
4119
-
4120
- **Solution:** Strategic denormalization for hot paths.
4121
-
4122
- ```typescript
4123
- // OPTION A: Pure ontology (2 queries)
4124
- const followers = await ctx.db.query('connections')
4125
- .withIndex('by_to')
4126
- .filter(q => q.eq(q.field('toThingId'), userId))
4127
- .filter(q => q.eq(q.field('relationshipType'), 'following'))
4128
- .collect();
4129
-
4130
- const following = await ctx.db.query('connections')
4131
- .withIndex('by_from')
4132
- .filter(q => q.eq(q.field('fromThingId'), userId))
4133
- .filter(q => q.field('relationshipType'), 'following'))
4134
- .collect();
4135
-
4136
- // OPTION B: Denormalized (1 query, but violates pure ontology)
4137
- interface UserThing {
4138
- type: 'user',
4139
- properties: {
4140
- followerIds: Id<'things'>[], // Cached for performance
4141
- followingIds: Id<'things'>[], // Cached for performance
4142
- followerCount: number,
4143
- followingCount: number,
4144
- }
4145
- }
4146
- ```
4147
-
4148
- **When to denormalize:**
4149
- - Query frequency > 1000/minute
4150
- - Bidirectional relationship is core feature (social graph)
4151
- - Acceptable staleness (eventual consistency)
4152
-
4153
- **Rule:** Start with pure ontology. Denormalize only when performance metrics justify it.
4154
-
4155
- ---
4156
-
4157
- ### 8. Multi-Target Event Pattern
4158
-
4159
- **Problem:** Some events involve multiple entities (e.g., "User A transferred Token B to User C").
4160
-
4161
- **Solution:** Use standardized metadata pattern.
4162
-
4163
- ```typescript
4164
- {
4165
- type: 'tokens_transferred',
4166
- actorId: userA, // Who initiated
4167
- targetId: tokenId, // Primary entity
4168
- timestamp: Date.now(),
4169
- metadata: {
4170
- fromUserId: userA, // Secondary target 1
4171
- toUserId: userC, // Secondary target 2
4172
- amount: 1000,
4173
- txHash: '0x...',
4174
- }
4175
- }
4176
- ```
4177
-
4178
- **Query Pattern:**
4179
-
4180
- ```typescript
4181
- // Find all events involving User C
4182
- const eventsAsActor = await ctx.db.query('events')
4183
- .withIndex('by_actor')
4184
- .filter(q => q.eq(q.field('actorId'), userC))
4185
- .collect();
4186
-
4187
- const eventsAsTarget = await ctx.db.query('events')
4188
- .withIndex('by_target')
4189
- .filter(q => q.eq(q.field('targetId'), userC))
4190
- .collect();
4191
-
4192
- // ALSO search metadata (requires full scan unless indexed)
4193
- const eventsAsSecondary = await ctx.db.query('events')
4194
- .filter(q =>
4195
- q.or(
4196
- q.eq(q.field('metadata.fromUserId'), userC),
4197
- q.eq(q.field('metadata.toUserId'), userC)
4198
- )
4199
- )
4200
- .collect();
4201
- ```
4202
-
4203
- **Rule:** Primary target → `targetId`. Secondary targets → `metadata`. Accept that secondary target queries are slower.
4204
-
4205
- ---
4206
-
4207
- ### 9. Connection Strength Standards
4208
-
4209
- **Problem:** Subjective `strength` values (0-1) have no meaning.
4210
-
4211
- **Solution:** Define standard strength levels.
4212
-
4213
- | Strength | Meaning | Use Case |
4214
- |----------|---------|----------|
4215
- | 1.0 | Owner/Creator | User owns product, Creator owns content |
4216
- | 0.9 | Admin/Manager | Group owner, Content moderator |
4217
- | 0.7 | Core Member | Paid subscriber, Active contributor |
4218
- | 0.5 | Member | Group member, Course enrollee |
4219
- | 0.3 | Follower | Social following, Newsletter subscriber |
4220
- | 0.1 | Viewer | Casual visitor, Free tier user |
4221
-
4222
- **Implementation:**
4223
-
4224
- ```typescript
4225
- const StrengthLevel = {
4226
- OWNER: 1.0,
4227
- CO_OWNER: 0.95, // Shared ownership (equal rights)
4228
- ADMIN: 0.9,
4229
- MODERATOR: 0.8, // Content/community moderation
4230
- CORE_MEMBER: 0.7,
4231
- MEMBER: 0.5,
4232
- TRIAL_MEMBER: 0.4, // Trial period
4233
- FOLLOWER: 0.3,
4234
- TRIAL_USER: 0.2, // Trial/freemium
4235
- VIEWER: 0.1,
4236
- SUSPENDED: 0.0, // Suspended/banned (retain connection for audit)
4237
- } as const;
4238
-
4239
- // Use enum instead of raw numbers
4240
- await ctx.db.insert('connections', {
4241
- fromThingId: userId,
4242
- toThingId: groupId,
4243
- relationshipType: 'member_of',
4244
- strength: StrengthLevel.MEMBER,
4245
- createdAt: Date.now(),
4246
- });
4247
- ```
4248
-
4249
- **Rule:** Use defined strength levels. Never use arbitrary decimal values.
4250
-
4251
- ---
4252
-
4253
- ### 10. Knowledge Field Reference Validation
4254
-
4255
- **Problem:** `sourceField: 'bio'` breaks silently if field is renamed.
4256
-
4257
- **Solution:** Validate field existence on write.
4258
-
4259
- ```typescript
4260
- // Helper: Get nested property safely
4261
- function getNestedProperty(obj: any, path: string): any {
4262
- return path.split('.').reduce((acc, part) => acc?.[part], obj);
4263
- }
4264
-
4265
- export const createKnowledgeChunk = mutation({
4266
- handler: async (ctx, { sourceThingId, sourceField, text }) => {
4267
- // Validate source thing exists
4268
- const sourceThing = await ctx.db.get(sourceThingId);
4269
- if (!sourceThing) {
4270
- throw new Error('Source thing not found');
4271
- }
4272
-
4273
- // Validate source field exists (supports nested paths like "contact.email")
4274
- if (sourceField && getNestedProperty(sourceThing.properties, sourceField) === undefined) {
4275
- throw new Error(`Field '${sourceField}' does not exist on thing type '${sourceThing.type}'`);
4276
- }
4277
-
4278
- // Create knowledge
4279
- await ctx.db.insert('knowledge', {
4280
- knowledgeType: 'chunk',
4281
- text,
4282
- sourceThingId,
4283
- sourceField,
4284
- createdAt: Date.now(),
4285
- });
4286
- },
4287
- });
4288
- ```
4289
-
4290
- **Field Rename Migration:**
4291
-
4292
- ```typescript
4293
- // When renaming a field, update all knowledge references
4294
- export const renameThingField = internalMutation({
4295
- handler: async (ctx, { thingType, oldField, newField }) => {
4296
- // Update all knowledge items
4297
- const knowledgeItems = await ctx.db
4298
- .query('knowledge')
4299
- .filter(q => q.eq(q.field('sourceField'), oldField))
4300
- .collect();
4301
-
4302
- for (const item of knowledgeItems) {
4303
- await ctx.db.patch(item._id, { sourceField: newField });
4304
- }
4305
- },
4306
- });
4307
- ```
4308
-
4309
- **Rule:** Validate field existence on knowledge creation. Provide migration path for field renames.
4310
-
4311
- ---
4312
-
4313
- ### Summary: Implementation Philosophy
4314
-
4315
- **The ontology defines WHAT (the 6 dimensions).**
4316
- **These requirements define HOW (validation, retention, performance).**
4317
-
4318
- | Aspect | Ontology | Implementation |
4319
- |--------|----------|----------------|
4320
- | Schema | Flexible JSON | Strict runtime validation (Zod) |
4321
- | Storage | Keep everything | Retention policies + cleanup |
4322
- | Relationships | Pure graph | Strategic denormalization |
4323
- | Integrity | Soft constraints | Hard validation rules |
4324
- | Performance | Unlimited scale | Indexing + query optimization |
4325
-
4326
- **Key Principle:** The ontology models reality (never changes). Implementation adapts to reality constraints (validation, performance, cost).
4327
-
4328
- ---
4329
-
4330
- ## Summary: The Universal Code Generation Language
4331
-
4332
-
4333
- ### What Makes ONE Universal
4334
-
4335
- 1. **6-Dimension Ontology** - Models reality, not technology
4336
- 2. **Compound Structure** - Each feature adds structure (not debt)
4337
- 3. **Pattern Convergence** - 1 pattern per dimension (not 100 patterns)
4338
- 4. **Backend Agnostic** - Swap technology freely (Convex, WordPress, Shopify)
4339
- 5. **Never Breaks** - Reality doesn't change, technology does
4340
- 6. **Infinite Scale** - Lemonade stands to global governments, same schema
4341
-
4342
- ### The Economic Result
4343
-
4344
- **Traditional Codebases:**
4345
-
4346
- ```
4347
- 100 files → 90% accurate
4348
- 1,000 files → 70% accurate
4349
- 10,000 files → 30% accurate
4350
- AI becomes a liability
4351
- ```
4352
-
4353
- **ONE Codebase:**
4354
-
4355
- ```
4356
- 100 files → 85% accurate (learning)
4357
- 1,000 files → 92% accurate (mastering)
4358
- 10,000 files → 98% accurate (generalized)
4359
- AI becomes more valuable
4360
- ```
4361
-
4362
- **Why?** The ontology is the language. Patterns converge. Structure compounds.
4363
-
4364
- ### Next Steps for AI Agents
4365
-
4366
- **When implementing ANY feature:**
4367
-
4368
- 1. Read `/CLAUDE.md` (platform overview)
4369
- 2. Read `/one/knowledge/ontology.md` (this file - understand the 6 dimensions)
4370
- 3. Read `/one/knowledge/architecture.md` (why this enables 98% accuracy)
4371
- 4. Map feature to ontology (groups, people, things, connections, events, knowledge)
4372
- 5. Generate Effect.ts services (composable business logic)
4373
- 6. Generate provider adapters (if needed)
4374
- 7. Generate UI components (shadcn/ui)
4375
- 8. Test with mocked layers
4376
-
4377
- **Remember:**
4378
-
4379
- - The ontology never changes (it's reality)
4380
- - Effect.ts is for agents (predictable patterns)
4381
- - Provider pattern is the universal adapter
4382
- - Every feature adds structure
4383
- - Each generation compounds accuracy
4384
-
4385
- **This is how software should be built.**
4386
-
4387
- ---
4388
-
4389
- ## Summary Statistics
4390
-
4391
- **Dimensions:** 6 total (groups, people, things, connections, events, knowledge)
4392
-
4393
- **Thing Types:** 66 total
4394
-
4395
- - Core: 4 (creator, ai_clone, audience_member, organization)
4396
- - Business Agents: 10
4397
- - Content: 7
4398
- - Products: 4
4399
- - Community: 3
4400
- - Token: 2
4401
- - Knowledge: 2
4402
- - Platform: 6
4403
- - Business: 7
4404
- - Authentication & Session: 5
4405
- - Marketing: 6
4406
- - External: 3
4407
- - Protocol: 2
4408
-
4409
- **Connection Types:** 25 total (Hybrid approach)
4410
-
4411
- - 18 specific semantic types
4412
- - 7 consolidated types with metadata variants
4413
- - Protocol-agnostic via metadata.protocol
4414
- - Includes group membership with role-based metadata
4415
-
4416
- **Event Types:** 52 total (Hybrid approach)
4417
-
4418
- - 3 Thing lifecycle
4419
- - 5 User events
4420
- - 6 Authentication events
4421
- - 3 Group events
4422
- - 4 Dashboard & UI events
4423
- - 2 AI/Clone events
4424
- - 3 Agent events
4425
- - 6 Token events
4426
- - 4 Course events
4427
- - 5 Analytics events
4428
- - 7 Cycle events
4429
- - 5 Blockchain events
4430
- - 11 consolidated types with metadata variants
4431
-
4432
- **Design Benefits:**
4433
-
4434
- - ✅ Single source of truth
4435
- - ✅ Protocol-agnostic core
4436
- - ✅ Infinite protocol extensibility
4437
- - ✅ Cross-protocol analytics
4438
- - ✅ Clean, maintainable
4439
- - ✅ Type-safe
4440
- - ✅ Future-proof
4441
-
4442
- ---
4443
-
4444
- **END OF ONTOLOGY SPECIFICATION**
4445
-
4446
-
4447
-
4448
-
4449
-