oneie 3.6.40 → 3.8.0

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 (984) hide show
  1. package/README.md +28 -9
  2. package/dist/admin/build.d.ts +15 -0
  3. package/dist/admin/build.d.ts.map +1 -0
  4. package/dist/admin/build.js +295 -0
  5. package/dist/admin/build.js.map +1 -0
  6. package/dist/admin/index.d.ts +24 -0
  7. package/dist/admin/index.d.ts.map +1 -0
  8. package/dist/admin/index.js +98 -0
  9. package/dist/admin/index.js.map +1 -0
  10. package/dist/admin/list.d.ts +14 -0
  11. package/dist/admin/list.d.ts.map +1 -0
  12. package/dist/admin/list.js +90 -0
  13. package/dist/admin/list.js.map +1 -0
  14. package/dist/admin/manifest.d.ts +86 -0
  15. package/dist/admin/manifest.d.ts.map +1 -0
  16. package/dist/admin/manifest.js +183 -0
  17. package/dist/admin/manifest.js.map +1 -0
  18. package/dist/admin/monorepo.d.ts +25 -0
  19. package/dist/admin/monorepo.d.ts.map +1 -0
  20. package/dist/admin/monorepo.js +59 -0
  21. package/dist/admin/monorepo.js.map +1 -0
  22. package/dist/admin/release.d.ts +17 -0
  23. package/dist/admin/release.d.ts.map +1 -0
  24. package/dist/admin/release.js +144 -0
  25. package/dist/admin/release.js.map +1 -0
  26. package/dist/admin/sync.d.ts +14 -0
  27. package/dist/admin/sync.d.ts.map +1 -0
  28. package/dist/admin/sync.js +104 -0
  29. package/dist/admin/sync.js.map +1 -0
  30. package/dist/admin/validate.d.ts +15 -0
  31. package/dist/admin/validate.d.ts.map +1 -0
  32. package/dist/admin/validate.js +169 -0
  33. package/dist/admin/validate.js.map +1 -0
  34. package/dist/commands/agent.d.ts +2 -0
  35. package/dist/commands/agent.d.ts.map +1 -1
  36. package/dist/commands/agent.js +44 -0
  37. package/dist/commands/agent.js.map +1 -1
  38. package/dist/commands/ask.d.ts +4 -0
  39. package/dist/commands/ask.d.ts.map +1 -0
  40. package/dist/commands/ask.js +8 -0
  41. package/dist/commands/ask.js.map +1 -0
  42. package/dist/commands/bounty.d.ts +4 -0
  43. package/dist/commands/bounty.d.ts.map +1 -0
  44. package/dist/commands/bounty.js +24 -0
  45. package/dist/commands/bounty.js.map +1 -0
  46. package/dist/commands/capabilities.d.ts +4 -0
  47. package/dist/commands/capabilities.d.ts.map +1 -0
  48. package/dist/commands/capabilities.js +18 -0
  49. package/dist/commands/capabilities.js.map +1 -0
  50. package/dist/commands/claw.d.ts +4 -0
  51. package/dist/commands/claw.d.ts.map +1 -0
  52. package/dist/commands/claw.js +14 -0
  53. package/dist/commands/claw.js.map +1 -0
  54. package/dist/commands/commend.d.ts +4 -0
  55. package/dist/commands/commend.d.ts.map +1 -0
  56. package/dist/commands/commend.js +13 -0
  57. package/dist/commands/commend.js.map +1 -0
  58. package/dist/commands/completion.d.ts +4 -0
  59. package/dist/commands/completion.d.ts.map +1 -0
  60. package/dist/commands/completion.js +49 -0
  61. package/dist/commands/completion.js.map +1 -0
  62. package/dist/commands/config.d.ts +4 -0
  63. package/dist/commands/config.d.ts.map +1 -0
  64. package/dist/commands/config.js +78 -0
  65. package/dist/commands/config.js.map +1 -0
  66. package/dist/commands/deploy.d.ts +4 -0
  67. package/dist/commands/deploy.d.ts.map +1 -0
  68. package/dist/commands/deploy.js +10 -0
  69. package/dist/commands/deploy.js.map +1 -0
  70. package/dist/commands/doctor.d.ts +4 -0
  71. package/dist/commands/doctor.d.ts.map +1 -0
  72. package/dist/commands/doctor.js +72 -0
  73. package/dist/commands/doctor.js.map +1 -0
  74. package/dist/commands/export.d.ts +4 -0
  75. package/dist/commands/export.d.ts.map +1 -0
  76. package/dist/commands/export.js +15 -0
  77. package/dist/commands/export.js.map +1 -0
  78. package/dist/commands/fade.d.ts +4 -0
  79. package/dist/commands/fade.d.ts.map +1 -0
  80. package/dist/commands/fade.js +15 -0
  81. package/dist/commands/fade.js.map +1 -0
  82. package/dist/commands/flag.d.ts +4 -0
  83. package/dist/commands/flag.d.ts.map +1 -0
  84. package/dist/commands/flag.js +13 -0
  85. package/dist/commands/flag.js.map +1 -0
  86. package/dist/commands/forget.d.ts +4 -0
  87. package/dist/commands/forget.d.ts.map +1 -0
  88. package/dist/commands/forget.js +16 -0
  89. package/dist/commands/forget.js.map +1 -0
  90. package/dist/commands/frontier.d.ts +4 -0
  91. package/dist/commands/frontier.d.ts.map +1 -0
  92. package/dist/commands/frontier.js +11 -0
  93. package/dist/commands/frontier.js.map +1 -0
  94. package/dist/commands/health.d.ts +4 -0
  95. package/dist/commands/health.d.ts.map +1 -0
  96. package/dist/commands/health.js +11 -0
  97. package/dist/commands/health.js.map +1 -0
  98. package/dist/commands/highways.d.ts +4 -0
  99. package/dist/commands/highways.d.ts.map +1 -0
  100. package/dist/commands/highways.js +14 -0
  101. package/dist/commands/highways.js.map +1 -0
  102. package/dist/commands/hire.d.ts +4 -0
  103. package/dist/commands/hire.d.ts.map +1 -0
  104. package/dist/commands/hire.js +16 -0
  105. package/dist/commands/hire.js.map +1 -0
  106. package/dist/commands/init.d.ts.map +1 -1
  107. package/dist/commands/init.js +69 -42
  108. package/dist/commands/init.js.map +1 -1
  109. package/dist/commands/know.d.ts +4 -0
  110. package/dist/commands/know.d.ts.map +1 -0
  111. package/dist/commands/know.js +8 -0
  112. package/dist/commands/know.js.map +1 -0
  113. package/dist/commands/launch.d.ts +4 -0
  114. package/dist/commands/launch.d.ts.map +1 -0
  115. package/dist/commands/launch.js +16 -0
  116. package/dist/commands/launch.js.map +1 -0
  117. package/dist/commands/mark.d.ts +4 -0
  118. package/dist/commands/mark.d.ts.map +1 -0
  119. package/dist/commands/mark.js +15 -0
  120. package/dist/commands/mark.js.map +1 -0
  121. package/dist/commands/pay.d.ts +4 -0
  122. package/dist/commands/pay.d.ts.map +1 -0
  123. package/dist/commands/pay.js +21 -0
  124. package/dist/commands/pay.js.map +1 -0
  125. package/dist/commands/pipe.d.ts +4 -0
  126. package/dist/commands/pipe.d.ts.map +1 -0
  127. package/dist/commands/pipe.js +35 -0
  128. package/dist/commands/pipe.js.map +1 -0
  129. package/dist/commands/publish.d.ts +4 -0
  130. package/dist/commands/publish.d.ts.map +1 -0
  131. package/dist/commands/publish.js +23 -0
  132. package/dist/commands/publish.js.map +1 -0
  133. package/dist/commands/recall.d.ts +4 -0
  134. package/dist/commands/recall.d.ts.map +1 -0
  135. package/dist/commands/recall.js +12 -0
  136. package/dist/commands/recall.js.map +1 -0
  137. package/dist/commands/repl.d.ts +4 -0
  138. package/dist/commands/repl.d.ts.map +1 -0
  139. package/dist/commands/repl.js +56 -0
  140. package/dist/commands/repl.js.map +1 -0
  141. package/dist/commands/reveal.d.ts +4 -0
  142. package/dist/commands/reveal.d.ts.map +1 -0
  143. package/dist/commands/reveal.js +11 -0
  144. package/dist/commands/reveal.js.map +1 -0
  145. package/dist/commands/revenue.d.ts +4 -0
  146. package/dist/commands/revenue.d.ts.map +1 -0
  147. package/dist/commands/revenue.js +11 -0
  148. package/dist/commands/revenue.js.map +1 -0
  149. package/dist/commands/select.d.ts +4 -0
  150. package/dist/commands/select.d.ts.map +1 -0
  151. package/dist/commands/select.js +19 -0
  152. package/dist/commands/select.js.map +1 -0
  153. package/dist/commands/signal.d.ts +4 -0
  154. package/dist/commands/signal.d.ts.map +1 -0
  155. package/dist/commands/signal.js +8 -0
  156. package/dist/commands/signal.js.map +1 -0
  157. package/dist/commands/stats.d.ts +4 -0
  158. package/dist/commands/stats.d.ts.map +1 -0
  159. package/dist/commands/stats.js +11 -0
  160. package/dist/commands/stats.js.map +1 -0
  161. package/dist/commands/status.d.ts +4 -0
  162. package/dist/commands/status.d.ts.map +1 -0
  163. package/dist/commands/status.js +18 -0
  164. package/dist/commands/status.js.map +1 -0
  165. package/dist/commands/sync.d.ts +4 -0
  166. package/dist/commands/sync.d.ts.map +1 -0
  167. package/dist/commands/sync.js +20 -0
  168. package/dist/commands/sync.js.map +1 -0
  169. package/dist/commands/tail.d.ts +4 -0
  170. package/dist/commands/tail.d.ts.map +1 -0
  171. package/dist/commands/tail.js +51 -0
  172. package/dist/commands/tail.js.map +1 -0
  173. package/dist/commands/warn.d.ts +4 -0
  174. package/dist/commands/warn.d.ts.map +1 -0
  175. package/dist/commands/warn.js +15 -0
  176. package/dist/commands/warn.js.map +1 -0
  177. package/dist/create-org-profile.js +2 -2
  178. package/dist/create-user-profile.js +2 -2
  179. package/dist/index.js +135 -7
  180. package/dist/index.js.map +1 -1
  181. package/dist/lib/args.d.ts +11 -0
  182. package/dist/lib/args.d.ts.map +1 -0
  183. package/dist/lib/args.js +57 -0
  184. package/dist/lib/args.js.map +1 -0
  185. package/dist/lib/config.d.ts +12 -0
  186. package/dist/lib/config.d.ts.map +1 -0
  187. package/dist/lib/config.js +38 -0
  188. package/dist/lib/config.js.map +1 -0
  189. package/dist/lib/http.d.ts +9 -0
  190. package/dist/lib/http.d.ts.map +1 -0
  191. package/dist/lib/http.js +25 -0
  192. package/dist/lib/http.js.map +1 -0
  193. package/dist/lib/output.d.ts +5 -0
  194. package/dist/lib/output.d.ts.map +1 -0
  195. package/dist/lib/output.js +32 -0
  196. package/dist/lib/output.js.map +1 -0
  197. package/dist/lib/sdk.d.ts +10 -0
  198. package/dist/lib/sdk.d.ts.map +1 -0
  199. package/dist/lib/sdk.js +22 -0
  200. package/dist/lib/sdk.js.map +1 -0
  201. package/dist/lib/telemetry.d.ts +4 -0
  202. package/dist/lib/telemetry.d.ts.map +1 -0
  203. package/dist/lib/telemetry.js +61 -0
  204. package/dist/lib/telemetry.js.map +1 -0
  205. package/dist/utils/file-resolver.js +1 -3
  206. package/dist/utils/file-resolver.js.map +1 -1
  207. package/dist/utils/installation-setup.d.ts +15 -0
  208. package/dist/utils/installation-setup.d.ts.map +1 -1
  209. package/dist/utils/installation-setup.js +71 -8
  210. package/dist/utils/installation-setup.js.map +1 -1
  211. package/package.json +5 -21
  212. package/.claude/agents/TROUBLESHOOTING.md +0 -530
  213. package/.claude/agents/agent-backend.md +0 -574
  214. package/.claude/agents/agent-builder.md +0 -911
  215. package/.claude/agents/agent-claude.md +0 -645
  216. package/.claude/agents/agent-clean.md +0 -477
  217. package/.claude/agents/agent-clone.md +0 -554
  218. package/.claude/agents/agent-designer.md +0 -1080
  219. package/.claude/agents/agent-director.md +0 -2254
  220. package/.claude/agents/agent-documenter.md +0 -688
  221. package/.claude/agents/agent-frontend.md +0 -1199
  222. package/.claude/agents/agent-integrator.md +0 -670
  223. package/.claude/agents/agent-lawyer.md +0 -1320
  224. package/.claude/agents/agent-news.md +0 -363
  225. package/.claude/agents/agent-onboard.md +0 -613
  226. package/.claude/agents/agent-ontology.md +0 -585
  227. package/.claude/agents/agent-ops.md +0 -1275
  228. package/.claude/agents/agent-problem-solver.md +0 -669
  229. package/.claude/agents/agent-quality.md +0 -1042
  230. package/.claude/agents/agent-sales.md +0 -507
  231. package/.claude/agents/agent-writer.md +0 -1068
  232. package/.claude/commands/cascade.md +0 -742
  233. package/.claude/commands/chat.md +0 -728
  234. package/.claude/commands/commit.md +0 -95
  235. package/.claude/commands/create.md +0 -544
  236. package/.claude/commands/deploy.md +0 -309
  237. package/.claude/commands/fast.md +0 -636
  238. package/.claude/commands/mcp-on.md +0 -191
  239. package/.claude/commands/media-upload.md +0 -186
  240. package/.claude/commands/news.md +0 -274
  241. package/.claude/commands/onboard.md +0 -440
  242. package/.claude/commands/one.md +0 -398
  243. package/.claude/commands/optimize.md +0 -74
  244. package/.claude/commands/plan.md +0 -719
  245. package/.claude/commands/push.md +0 -214
  246. package/.claude/commands/release.md +0 -105
  247. package/.claude/commands/review.md +0 -99
  248. package/.claude/commands/server.md +0 -487
  249. package/.claude/commands/start.md +0 -227
  250. package/.claude/commands/test.md +0 -197
  251. package/.claude/commands/validate.md +0 -140
  252. package/.claude/hooks/.last-news-context +0 -1
  253. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
  254. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  255. package/.claude/hooks/README-news-generation.md +0 -364
  256. package/.claude/hooks/README-root-cleanup.md +0 -200
  257. package/.claude/hooks/README.md +0 -284
  258. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  259. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  260. package/.claude/hooks/auto-format.sh +0 -106
  261. package/.claude/hooks/check-filenames.py +0 -177
  262. package/.claude/hooks/clean-post.py +0 -468
  263. package/.claude/hooks/clean-pre.py +0 -393
  264. package/.claude/hooks/clean-root-markdown.sh +0 -73
  265. package/.claude/hooks/commit-push.sh +0 -95
  266. package/.claude/hooks/done.py +0 -236
  267. package/.claude/hooks/format-hook.sh +0 -163
  268. package/.claude/hooks/formatting.py +0 -187
  269. package/.claude/hooks/hook-logger.sh +0 -173
  270. package/.claude/hooks/knowledge-post.py +0 -355
  271. package/.claude/hooks/knowledge-pre.py +0 -245
  272. package/.claude/hooks/mcp-on.sh +0 -134
  273. package/.claude/hooks/notification-hook.sh +0 -279
  274. package/.claude/hooks/ontology-validation.py +0 -255
  275. package/.claude/hooks/push.sh +0 -153
  276. package/.claude/hooks/release-cli.sh +0 -205
  277. package/.claude/hooks/root-cleanup.py +0 -217
  278. package/.claude/hooks/security-hook.sh +0 -397
  279. package/.claude/hooks/tag-all-docs.py +0 -464
  280. package/.claude/hooks/test-validate-ontology.sh +0 -170
  281. package/.claude/hooks/todo.py +0 -368
  282. package/.claude/hooks/track-changes.sh +0 -101
  283. package/.claude/hooks/validate-imports.py +0 -182
  284. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  285. package/.claude/hooks/validate-ontology-structure.py +0 -558
  286. package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
  287. package/.claude/hooks/validate-ontology.py +0 -140
  288. package/.claude/hooks/write-news.sh +0 -194
  289. package/.claude/skills/INDEX.md +0 -523
  290. package/.claude/skills/REGISTRY.md +0 -529
  291. package/.claude/skills/agent-backend-create-mutation.md +0 -319
  292. package/.claude/skills/agent-designer-create-wireframe.md +0 -341
  293. package/.claude/skills/agent-frontend-create-page.md +0 -413
  294. package/.claude/skills/agents/README.md +0 -238
  295. package/.claude/skills/astro/add-content-collection.md +0 -30
  296. package/.claude/skills/astro/check-build.md +0 -29
  297. package/.claude/skills/astro/create-component.md +0 -29
  298. package/.claude/skills/astro/create-page.md +0 -30
  299. package/.claude/skills/astro/optimize-performance.md +0 -21
  300. package/.claude/skills/convex/check-deployment.md +0 -46
  301. package/.claude/skills/convex/create-mutation.md +0 -405
  302. package/.claude/skills/convex/create-query.md +0 -52
  303. package/.claude/skills/convex/read-schema.md +0 -373
  304. package/.claude/skills/convex/test-function.md +0 -50
  305. package/.claude/skills/deployment/check-deployment-health.md +0 -20
  306. package/.claude/skills/deployment/create-release.md +0 -21
  307. package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
  308. package/.claude/skills/deployment/deploy-convex.md +0 -30
  309. package/.claude/skills/deployment/sync-repositories.md +0 -19
  310. package/.claude/skills/design/check-accessibility.md +0 -21
  311. package/.claude/skills/design/create-component-spec.md +0 -27
  312. package/.claude/skills/design/generate-design-tokens.md +0 -24
  313. package/.claude/skills/design/generate-wireframe.md +0 -30
  314. package/.claude/skills/documentation/create-migration-guide.md +0 -20
  315. package/.claude/skills/documentation/generate-api-docs.md +0 -27
  316. package/.claude/skills/documentation/generate-readme.md +0 -22
  317. package/.claude/skills/documentation/update-knowledge.md +0 -20
  318. package/.claude/skills/integration/connect-external-system.md +0 -21
  319. package/.claude/skills/integration/implement-a2a.md +0 -20
  320. package/.claude/skills/integration/implement-acp.md +0 -20
  321. package/.claude/skills/integration/verify-integration.md +0 -20
  322. package/.claude/skills/ontology/README.md +0 -255
  323. package/.claude/skills/ontology/check-dimension.md +0 -307
  324. package/.claude/skills/ontology/generate-entity-type.md +0 -339
  325. package/.claude/skills/ontology/validate-schema.md +0 -229
  326. package/.claude/skills/ontology/verify-relationships.md +0 -310
  327. package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
  328. package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
  329. package/.claude/skills/problem-solving/propose-solution.md +0 -29
  330. package/.claude/skills/problem-solving/verify-fix.md +0 -21
  331. package/.claude/skills/sales/generate-demo-script.md +0 -21
  332. package/.claude/skills/sales/qualify-lead.md +0 -30
  333. package/.claude/skills/sales/track-trial.md +0 -20
  334. package/.claude/skills/sales/verify-kyc.md +0 -20
  335. package/.claude/skills/testing/analyze-coverage.md +0 -24
  336. package/.claude/skills/testing/generate-tests.md +0 -24
  337. package/.claude/skills/testing/run-tests.md +0 -27
  338. package/.claude/skills/testing/validate-e2e.md +0 -25
  339. package/AGENTS.md +0 -60
  340. package/CLAUDE.md +0 -321
  341. package/CREATE-WEBSITE.md +0 -458
  342. package/SECURITY.md +0 -31
  343. package/dist/commands/create-website.d.ts +0 -19
  344. package/dist/commands/create-website.d.ts.map +0 -1
  345. package/dist/commands/create-website.js +0 -231
  346. package/dist/commands/create-website.js.map +0 -1
  347. package/folders.yaml +0 -92
  348. package/one/README.md +0 -760
  349. package/one/connections/a2a.md +0 -600
  350. package/one/connections/acp.md +0 -808
  351. package/one/connections/acps.md +0 -749
  352. package/one/connections/agentkit.md +0 -367
  353. package/one/connections/agui.md +0 -785
  354. package/one/connections/any-backend.md +0 -1720
  355. package/one/connections/ap2.md +0 -1072
  356. package/one/connections/api/queries-reference.md +0 -860
  357. package/one/connections/api-docs.md +0 -1909
  358. package/one/connections/api-reference.md +0 -1029
  359. package/one/connections/api.md +0 -2208
  360. package/one/connections/architecture-diagram.md +0 -112
  361. package/one/connections/communications.md +0 -467
  362. package/one/connections/connections.md +0 -357
  363. package/one/connections/copilotkit.md +0 -1577
  364. package/one/connections/cryptonetworks.md +0 -799
  365. package/one/connections/documentation.md +0 -1138
  366. package/one/connections/effect.md +0 -297
  367. package/one/connections/elizaos.md +0 -1308
  368. package/one/connections/groups.md +0 -814
  369. package/one/connections/inference.md +0 -76
  370. package/one/connections/integration-examples.md +0 -893
  371. package/one/connections/integration-guide.md +0 -887
  372. package/one/connections/integration-phase2.md +0 -754
  373. package/one/connections/kyc.md +0 -650
  374. package/one/connections/mcp.md +0 -860
  375. package/one/connections/membership.md +0 -1170
  376. package/one/connections/middleware.md +0 -1085
  377. package/one/connections/multitenant.md +0 -1359
  378. package/one/connections/n8n.md +0 -1033
  379. package/one/connections/patterns.md +0 -107
  380. package/one/connections/protocols.md +0 -297
  381. package/one/connections/relationships.md +0 -125
  382. package/one/connections/schema.md +0 -605
  383. package/one/connections/service-layer.md +0 -568
  384. package/one/connections/vectors.md +0 -225
  385. package/one/connections/wordpress.md +0 -1320
  386. package/one/connections/workflow-copy.md +0 -923
  387. package/one/connections/workflow-examples.md +0 -759
  388. package/one/connections/workflow-onboarding.md +0 -701
  389. package/one/connections/workflow.md +0 -923
  390. package/one/connections/workflows/delegation.md +0 -903
  391. package/one/connections/workflows/frontend.md +0 -1055
  392. package/one/connections/workflows/strategy.md +0 -921
  393. package/one/connections/workflows/tasks.md +0 -716
  394. package/one/connections/x402-baazar.md +0 -131
  395. package/one/connections/x402.md +0 -1353
  396. package/one/groups/features.md +0 -2904
  397. package/one/groups/groups.md +0 -587
  398. package/one/groups/one.md +0 -619
  399. package/one/groups/strategy-copy.md +0 -887
  400. package/one/knowledge/.obsidian/app.json +0 -1
  401. package/one/knowledge/.obsidian/appearance.json +0 -1
  402. package/one/knowledge/.obsidian/core-plugins.json +0 -33
  403. package/one/knowledge/.obsidian/ecommerce-ontology.md +0 -210
  404. package/one/knowledge/.obsidian/workspace.json +0 -211
  405. package/one/knowledge/100-inference-quick-reference.md +0 -449
  406. package/one/knowledge/ag-ui-protocol.md +0 -613
  407. package/one/knowledge/agent-onboard-usage.md +0 -630
  408. package/one/knowledge/agentic-commerce.md +0 -146
  409. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +0 -683
  410. package/one/knowledge/ai-api-reference.md +0 -715
  411. package/one/knowledge/ai-platform.md +0 -323
  412. package/one/knowledge/ai-quickstart.md +0 -355
  413. package/one/knowledge/ai-sdk-implementation.md +0 -436
  414. package/one/knowledge/ai-token-crypto-analysis-framework.md +0 -1191
  415. package/one/knowledge/ai-token-paradigm-shift-2025.md +0 -732
  416. package/one/knowledge/altcoin-cycle-prediction-ontology.md +0 -884
  417. package/one/knowledge/altcoin-cycle-trading-strategy.md +0 -642
  418. package/one/knowledge/architecture-any-backend.md +0 -1589
  419. package/one/knowledge/architecture-diagram.md +0 -404
  420. package/one/knowledge/architecture-frontend.md +0 -1014
  421. package/one/knowledge/architecture.md +0 -1742
  422. package/one/knowledge/archived/ontology.old.md +0 -2840
  423. package/one/knowledge/astro-effect-complete-vision.md +0 -2148
  424. package/one/knowledge/astro-effect-simple-architecture.md +0 -750
  425. package/one/knowledge/audit-agent-onboard-alignment.md +0 -481
  426. package/one/knowledge/audit-agent-sales-alignment.md +0 -444
  427. package/one/knowledge/backend-api-reference.md +0 -728
  428. package/one/knowledge/cascading-context-specification.md +0 -1617
  429. package/one/knowledge/claude-code-integration.md +0 -1293
  430. package/one/knowledge/cli-claude-handoff.md +0 -736
  431. package/one/knowledge/context-engineering.md +0 -610
  432. package/one/knowledge/crypto-analysis-strategy.md +0 -1276
  433. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +0 -44
  434. package/one/knowledge/crypto.md +0 -978
  435. package/one/knowledge/develop/design.md +0 -364
  436. package/one/knowledge/develop/index.md +0 -145
  437. package/one/knowledge/development-commands.md +0 -251
  438. package/one/knowledge/docs.md +0 -627
  439. package/one/knowledge/dsl.md +0 -1678
  440. package/one/knowledge/event-driven-documentation.md +0 -270
  441. package/one/knowledge/files.md +0 -2489
  442. package/one/knowledge/frontend.md +0 -1056
  443. package/one/knowledge/games-english.md +0 -691
  444. package/one/knowledge/games.md +0 -1082
  445. package/one/knowledge/generative-ui-patterns.md +0 -559
  446. package/one/knowledge/guidelines.md +0 -314
  447. package/one/knowledge/hono.md +0 -2127
  448. package/one/knowledge/implementation-examples.md +0 -2554
  449. package/one/knowledge/installation-folders.md +0 -366
  450. package/one/knowledge/institutional-cycle-paradigm-2025.md +0 -555
  451. package/one/knowledge/knowledge.md +0 -660
  452. package/one/knowledge/language.md +0 -998
  453. package/one/knowledge/lessons-learned.md +0 -378
  454. package/one/knowledge/lessons-website-building-focus.md +0 -382
  455. package/one/knowledge/merge-report.md +0 -254
  456. package/one/knowledge/metadata-system.md +0 -504
  457. package/one/knowledge/nine-padel-playbook.md +0 -229
  458. package/one/knowledge/one-protocol-ai-agents.md +0 -892
  459. package/one/knowledge/one-protocol-executive-report.md +0 -617
  460. package/one/knowledge/one-protocol-standard.md +0 -869
  461. package/one/knowledge/one-protocol-whitepaper.md +0 -756
  462. package/one/knowledge/ontology-blog.yaml +0 -47
  463. package/one/knowledge/ontology-cheatsheet.md +0 -617
  464. package/one/knowledge/ontology-community.yaml +0 -65
  465. package/one/knowledge/ontology-core-universal.md +0 -740
  466. package/one/knowledge/ontology-core.yaml +0 -63
  467. package/one/knowledge/ontology-courses.yaml +0 -76
  468. package/one/knowledge/ontology-creator.md +0 -402
  469. package/one/knowledge/ontology-crypto.md +0 -1603
  470. package/one/knowledge/ontology-developer-guide.md +0 -814
  471. package/one/knowledge/ontology-documentation.md +0 -377
  472. package/one/knowledge/ontology-ecommerce.md +0 -269
  473. package/one/knowledge/ontology-education-game.md +0 -1654
  474. package/one/knowledge/ontology-education.md +0 -938
  475. package/one/knowledge/ontology-engineering-specification.md +0 -1310
  476. package/one/knowledge/ontology-engineering.md +0 -1676
  477. package/one/knowledge/ontology-files.yaml +0 -525
  478. package/one/knowledge/ontology-frontend-master.md +0 -2898
  479. package/one/knowledge/ontology-frontend-specifications.md +0 -2196
  480. package/one/knowledge/ontology-frontend.md +0 -2475
  481. package/one/knowledge/ontology-index.md +0 -397
  482. package/one/knowledge/ontology-minimal.yaml +0 -301
  483. package/one/knowledge/ontology-portfolio.yaml +0 -45
  484. package/one/knowledge/ontology-quickstart.md +0 -602
  485. package/one/knowledge/ontology-release.md +0 -317
  486. package/one/knowledge/ontology-shop.yaml +0 -148
  487. package/one/knowledge/ontology-tokens.yaml +0 -51
  488. package/one/knowledge/ontology-tutorial.md +0 -455
  489. package/one/knowledge/ontology-v2.md +0 -4449
  490. package/one/knowledge/ontology-video-script.md +0 -939
  491. package/one/knowledge/ontology-visual-guide.md +0 -378
  492. package/one/knowledge/ontology.md +0 -3847
  493. package/one/knowledge/ontology.yaml +0 -1653
  494. package/one/knowledge/parallel-agents.md +0 -932
  495. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +0 -130
  496. package/one/knowledge/patterns/backend/convex-query-pattern.md +0 -143
  497. package/one/knowledge/patterns/backend/mutation-template.md +0 -249
  498. package/one/knowledge/patterns/backend/query-template.md +0 -286
  499. package/one/knowledge/patterns/backend/service-template.md +0 -258
  500. package/one/knowledge/patterns/design/component-architecture.md +0 -435
  501. package/one/knowledge/patterns/design/index.md +0 -160
  502. package/one/knowledge/patterns/design/test-driven-design-pattern.md +0 -196
  503. package/one/knowledge/patterns/design/wireframe-template.md +0 -250
  504. package/one/knowledge/patterns/frontend/component-template.md +0 -246
  505. package/one/knowledge/patterns/frontend/form-template.md +0 -348
  506. package/one/knowledge/patterns/frontend/page-template.md +0 -209
  507. package/one/knowledge/patterns/frontend/react-component-pattern.md +0 -188
  508. package/one/knowledge/patterns/test/acceptance-criteria-template.md +0 -396
  509. package/one/knowledge/patterns/test/technical-test-template.md +0 -566
  510. package/one/knowledge/patterns/test/test-driven-pattern.md +0 -160
  511. package/one/knowledge/patterns/test/user-flow-template.md +0 -272
  512. package/one/knowledge/performance.md +0 -459
  513. package/one/knowledge/provider-agnostic-content.md +0 -995
  514. package/one/knowledge/provider-creation-guide.md +0 -1082
  515. package/one/knowledge/quality-loop.md +0 -419
  516. package/one/knowledge/quick-start-ontology-mapping.md +0 -773
  517. package/one/knowledge/readme-architecture.md +0 -158
  518. package/one/knowledge/readme.md +0 -149
  519. package/one/knowledge/rules.md +0 -644
  520. package/one/knowledge/score.md +0 -85
  521. package/one/knowledge/specifications.md +0 -873
  522. package/one/knowledge/tags.md +0 -148
  523. package/one/knowledge/todo-template.md +0 -269
  524. package/one/knowledge/todo.md +0 -269
  525. package/one/knowledge/troubleshooting.md +0 -434
  526. package/one/knowledge/typescript-patterns.md +0 -321
  527. package/one/knowledge/universal-generation-language.md +0 -827
  528. package/one/knowledge/x402-research.md +0 -104
  529. package/one/license.md +0 -107
  530. package/one/people/anthony-o-connell.md +0 -469
  531. package/one/people/people.md +0 -590
  532. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
  533. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
  534. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
  535. package/one/things/CHECKLIST.md +0 -407
  536. package/one/things/IMPLEMENTATION_STATUS.md +0 -379
  537. package/one/things/ONE.md +0 -529
  538. package/one/things/agents/agent-backend.md +0 -1501
  539. package/one/things/agents/agent-builder.md +0 -1064
  540. package/one/things/agents/agent-clean.md +0 -1112
  541. package/one/things/agents/agent-clone.md +0 -1324
  542. package/one/things/agents/agent-deploy.md +0 -986
  543. package/one/things/agents/agent-designer.md +0 -2305
  544. package/one/things/agents/agent-director.md +0 -1526
  545. package/one/things/agents/agent-documenter.md +0 -1129
  546. package/one/things/agents/agent-frontend.md +0 -1201
  547. package/one/things/agents/agent-integrator.md +0 -1269
  548. package/one/things/agents/agent-lawyer.md +0 -1371
  549. package/one/things/agents/agent-problem-solver.md +0 -1457
  550. package/one/things/agents/agent-quality.md +0 -1483
  551. package/one/things/agents/agent-sales.md +0 -1074
  552. package/one/things/cascade/cascade.yaml +0 -481
  553. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
  554. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
  555. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
  556. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
  557. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
  558. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
  559. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
  560. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
  561. package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
  562. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
  563. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
  564. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
  565. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
  566. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
  567. package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
  568. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
  569. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
  570. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
  571. package/one/things/cascade/docs/examples/readme.md +0 -259
  572. package/one/things/cascade/docs/getting-started.md +0 -533
  573. package/one/things/cascade/docs/workflow.md +0 -1378
  574. package/one/things/cascade/readme.md +0 -379
  575. package/one/things/cascade/templates/feature-template.md +0 -289
  576. package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
  577. package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
  578. package/one/things/claude/agents/analyst.md +0 -508
  579. package/one/things/claude/agents/architect.md +0 -505
  580. package/one/things/claude/agents/brand-identity-specialist.md +0 -538
  581. package/one/things/claude/agents/bstp-token-strategist.md +0 -690
  582. package/one/things/claude/agents/builder-repo.md +0 -532
  583. package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
  584. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
  585. package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
  586. package/one/things/claude/agents/company-bullstamp-character.md +0 -602
  587. package/one/things/claude/agents/company-bullstamp-community.md +0 -307
  588. package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
  589. package/one/things/claude/agents/company-bullstamp-token.md +0 -307
  590. package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
  591. package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
  592. package/one/things/claude/agents/content-calendar-planner.md +0 -473
  593. package/one/things/claude/agents/content-chapter-formatter.md +0 -513
  594. package/one/things/claude/agents/content-formatter.md +0 -571
  595. package/one/things/claude/agents/content-hook-specialist.md +0 -485
  596. package/one/things/claude/agents/content-image-formatter.md +0 -560
  597. package/one/things/claude/agents/content-introduction-formatter.md +0 -510
  598. package/one/things/claude/agents/content-multiplication-engine.md +0 -579
  599. package/one/things/claude/agents/content-playbook-writer.md +0 -473
  600. package/one/things/claude/agents/content-team-manager.md +0 -647
  601. package/one/things/claude/agents/content-toc-formatter.md +0 -547
  602. package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
  603. package/one/things/claude/agents/core-manager.md +0 -607
  604. package/one/things/claude/agents/core-master.md +0 -426
  605. package/one/things/claude/agents/cross-functional-manager.md +0 -476
  606. package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
  607. package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
  608. package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
  609. package/one/things/claude/agents/crypto-community-analyst.md +0 -314
  610. package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
  611. package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
  612. package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
  613. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
  614. package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
  615. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
  616. package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
  617. package/one/things/claude/agents/crypto-market-researcher.md +0 -307
  618. package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
  619. package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
  620. package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
  621. package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
  622. package/one/things/claude/agents/crypto-team-manager.md +0 -392
  623. package/one/things/claude/agents/crypto-token-analyst.md +0 -319
  624. package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
  625. package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
  626. package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
  627. package/one/things/claude/agents/customer-journey-designer.md +0 -474
  628. package/one/things/claude/agents/customer-success-manager.md +0 -574
  629. package/one/things/claude/agents/dev.md +0 -406
  630. package/one/things/claude/agents/documenter.md +0 -548
  631. package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
  632. package/one/things/claude/agents/engagement-specialist.md +0 -502
  633. package/one/things/claude/agents/engineering-architect.md +0 -387
  634. package/one/things/claude/agents/engineering-business-analyst.md +0 -527
  635. package/one/things/claude/agents/engineering-developer.md +0 -386
  636. package/one/things/claude/agents/engineering-director.md +0 -322
  637. package/one/things/claude/agents/engineering-ingestor.md +0 -659
  638. package/one/things/claude/agents/engineering-product-manager.md +0 -525
  639. package/one/things/claude/agents/engineering-product-owner.md +0 -527
  640. package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
  641. package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
  642. package/one/things/claude/agents/engineering-team-manager.md +0 -515
  643. package/one/things/claude/agents/engineering-user-experience.md +0 -386
  644. package/one/things/claude/agents/framework-elevate-manager.md +0 -309
  645. package/one/things/claude/agents/improver.md +0 -805
  646. package/one/things/claude/agents/intelligence-team-manager.md +0 -390
  647. package/one/things/claude/agents/lead-capture-expert.md +0 -459
  648. package/one/things/claude/agents/lead-magnet-creator.md +0 -446
  649. package/one/things/claude/agents/market-research-analyst.md +0 -435
  650. package/one/things/claude/agents/marketing-brand-identity.md +0 -344
  651. package/one/things/claude/agents/marketing-content-hooks.md +0 -455
  652. package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
  653. package/one/things/claude/agents/marketing-content-poster.md +0 -372
  654. package/one/things/claude/agents/marketing-customer-journey.md +0 -331
  655. package/one/things/claude/agents/marketing-director.md +0 -402
  656. package/one/things/claude/agents/marketing-engagement.md +0 -331
  657. package/one/things/claude/agents/marketing-lead-capture.md +0 -331
  658. package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
  659. package/one/things/claude/agents/marketing-network-effects.md +0 -331
  660. package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
  661. package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
  662. package/one/things/claude/agents/marketing-team-manager.md +0 -451
  663. package/one/things/claude/agents/marketing-viral-growth.md +0 -232
  664. package/one/things/claude/agents/mission-commander.md +0 -378
  665. package/one/things/claude/agents/network-effect-analyst.md +0 -604
  666. package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
  667. package/one/things/claude/agents/npx.md +0 -946
  668. package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
  669. package/one/things/claude/agents/one-master.md +0 -378
  670. package/one/things/claude/agents/one-orchestrator.md +0 -345
  671. package/one/things/claude/agents/one.md +0 -658
  672. package/one/things/claude/agents/playbook-generator.md +0 -526
  673. package/one/things/claude/agents/pm.md +0 -349
  674. package/one/things/claude/agents/po.md +0 -370
  675. package/one/things/claude/agents/qa.md +0 -361
  676. package/one/things/claude/agents/research-foundation-analyst.md +0 -324
  677. package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
  678. package/one/things/claude/agents/research-market-analyst.md +0 -324
  679. package/one/things/claude/agents/research-team-manager.md +0 -489
  680. package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
  681. package/one/things/claude/agents/sales-team-manager.md +0 -407
  682. package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
  683. package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
  684. package/one/things/claude/agents/service-advocacy-manager.md +0 -324
  685. package/one/things/claude/agents/service-success-manager.md +0 -324
  686. package/one/things/claude/agents/service-team-manager.md +0 -405
  687. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
  688. package/one/things/claude/agents/share-optimization-specialist.md +0 -576
  689. package/one/things/claude/agents/sm.md +0 -352
  690. package/one/things/claude/agents/story-teller.md +0 -498
  691. package/one/things/claude/agents/task-master.md +0 -621
  692. package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
  693. package/one/things/claude/agents/tester.md +0 -595
  694. package/one/things/claude/agents/the-bull-character-manager.md +0 -603
  695. package/one/things/claude/agents/tools-playbook-generator.md +0 -492
  696. package/one/things/claude/agents/turbo-repo-builder.md +0 -346
  697. package/one/things/claude/agents/upsell-strategist.md +0 -503
  698. package/one/things/claude/agents/ux-expert.md +0 -360
  699. package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
  700. package/one/things/claude/claude-code-hooks-development.json +0 -21
  701. package/one/things/claude/claude-code-hooks-production.json +0 -21
  702. package/one/things/claude/claude-code-hooks.json +0 -25
  703. package/one/things/claude/commands/agent.md +0 -124
  704. package/one/things/claude/commands/cascade-status.md +0 -153
  705. package/one/things/claude/commands/ingest.md +0 -343
  706. package/one/things/claude/commands/ingestor.md +0 -158
  707. package/one/things/claude/commands/mission.md +0 -103
  708. package/one/things/claude/commands/npx.md +0 -156
  709. package/one/things/claude/commands/one.md +0 -486
  710. package/one/things/claude/commands/quality-check.md +0 -252
  711. package/one/things/claude/commands/smart-route.md +0 -261
  712. package/one/things/claude/commands/start.md +0 -139
  713. package/one/things/claude/commands/story.md +0 -103
  714. package/one/things/claude/commands/task.md +0 -193
  715. package/one/things/claude/hook-bypass.json +0 -32
  716. package/one/things/claude/hooks/agent-hook-config.json +0 -427
  717. package/one/things/claude/hooks/build-hook.sh +0 -156
  718. package/one/things/claude/hooks/cleanup-hook.sh +0 -201
  719. package/one/things/claude/hooks/file-organization-hook.sh +0 -80
  720. package/one/things/claude/hooks/format-hook.sh +0 -43
  721. package/one/things/claude/hooks/hook-bypass.sh +0 -293
  722. package/one/things/claude/hooks/hook-debouncer.sh +0 -62
  723. package/one/things/claude/hooks/hook-logger.sh +0 -89
  724. package/one/things/claude/hooks/lint-hook.sh +0 -140
  725. package/one/things/claude/hooks/notification-hook.sh +0 -204
  726. package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
  727. package/one/things/claude/hooks/performance-metrics.json +0 -25
  728. package/one/things/claude/hooks/security-hook.sh +0 -256
  729. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
  730. package/one/things/claude/hooks/story-validation-hook.sh +0 -145
  731. package/one/things/claude/hooks/test-hook.sh +0 -145
  732. package/one/things/claude/hooks/test-story-validation.sh +0 -170
  733. package/one/things/claude/settings-local.json +0 -86
  734. package/one/things/cli/cli-code.md +0 -677
  735. package/one/things/cli/cli-compiler-code.md +0 -677
  736. package/one/things/cli/cli.md +0 -871
  737. package/one/things/components/card-shadcn.md +0 -953
  738. package/one/things/components/card.md +0 -1041
  739. package/one/things/components.md +0 -1743
  740. package/one/things/componets.md +0 -19
  741. package/one/things/contracts/Move.toml +0 -12
  742. package/one/things/contracts/README.md +0 -288
  743. package/one/things/contracts/one.move +0 -762
  744. package/one/things/contracts/sdk.ts +0 -578
  745. package/one/things/creator-diagram.md +0 -184
  746. package/one/things/crypto/FEATURES.md +0 -78
  747. package/one/things/crypto/ONECORE.md +0 -62
  748. package/one/things/crypto/ONECOREFAQ.md +0 -22
  749. package/one/things/crypto/ONECOREHOW.md +0 -46
  750. package/one/things/crypto/ONEENTERPRISE.md +0 -64
  751. package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
  752. package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
  753. package/one/things/crypto/ONEPRO.md +0 -60
  754. package/one/things/crypto/ONEPROFAQ.md +0 -22
  755. package/one/things/crypto/ONEPROHOW.md +0 -53
  756. package/one/things/crypto/READMEAGENCY.md +0 -64
  757. package/one/things/crypto/VSL.md +0 -45
  758. package/one/things/crypto/WebsiteCopy.md +0 -176
  759. package/one/things/demo-accessibility-animations.md +0 -1025
  760. package/one/things/demo-components.md +0 -1310
  761. package/one/things/demo-design-summary.md +0 -692
  762. package/one/things/demo-design-system.md +0 -973
  763. package/one/things/demo-page-layouts.md +0 -1016
  764. package/one/things/design-system.md +0 -832
  765. package/one/things/designs/accessibility-audit.md +0 -877
  766. package/one/things/designs/component-specifications.md +0 -855
  767. package/one/things/designs/design-overview.md +0 -377
  768. package/one/things/designs/design-tokens.md +0 -448
  769. package/one/things/designs/wireframes-dashboard.md +0 -710
  770. package/one/things/docs/api-requests.md +0 -987
  771. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
  772. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
  773. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
  774. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
  775. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
  776. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
  777. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
  778. package/one/things/docs/ecommerce/QUICK-START.md +0 -405
  779. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
  780. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
  781. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
  782. package/one/things/docs/ecommerce/demo.astro +0 -309
  783. package/one/things/examples/children/lemonade-stand.md +0 -404
  784. package/one/things/examples/enterprise/crm-saas.md +0 -1444
  785. package/one/things/features/1-1-agent-prompts.md +0 -562
  786. package/one/things/features/1-2-yaml-orchestrator.md +0 -548
  787. package/one/things/features/1-3-event-coordination.md +0 -547
  788. package/one/things/features/1-4-knowledge-management.md +0 -652
  789. package/one/things/features/1-5-quality-loops.md +0 -725
  790. package/one/things/features/1-6-numbering-structure.md +0 -639
  791. package/one/things/features/2-1-dataprovider-interface.md +0 -2583
  792. package/one/things/features/2-2-config-system.md +0 -3242
  793. package/one/things/features/2-3-effectts-services.md +0 -1645
  794. package/one/things/features/2-4-react-hooks.md +0 -2136
  795. package/one/things/features/2-5-auth-migration.md +0 -2144
  796. package/one/things/features/2-6-dashboard-migration.md +0 -2084
  797. package/one/things/features/2-7-alternative-providers.md +0 -2578
  798. package/one/things/features/2-7-implementation-report.md +0 -724
  799. package/one/things/features/2-cli.md +0 -1720
  800. package/one/things/features/2-design.md +0 -1770
  801. package/one/things/features/2-tests.md +0 -576
  802. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
  803. package/one/things/features/DECOUPLING.md +0 -290
  804. package/one/things/features/DEPLOYMENT.md +0 -470
  805. package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
  806. package/one/things/features/improve.md +0 -861
  807. package/one/things/features/remove-convex-deps.md +0 -63
  808. package/one/things/features/top-features.md +0 -87
  809. package/one/things/features/use-one-backend.md +0 -1217
  810. package/one/things/features-in-english.md +0 -200
  811. package/one/things/files.yaml +0 -721
  812. package/one/things/ideas/1-create-workflow.md +0 -207
  813. package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
  814. package/one/things/implementation/backend-guide.md +0 -457
  815. package/one/things/interface.md +0 -257
  816. package/one/things/landing-page-implementation.md +0 -455
  817. package/one/things/legal/README.md +0 -234
  818. package/one/things/legal/privacy-policy.md +0 -1227
  819. package/one/things/legal/terms-of-service.md +0 -1432
  820. package/one/things/master-workflow-plan.md +0 -806
  821. package/one/things/pay.one.ie.md +0 -53
  822. package/one/things/plans/0-in-sync.md +0 -136
  823. package/one/things/plans/0-timeline.md +0 -36
  824. package/one/things/plans/1-create-workflow.md +0 -732
  825. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
  826. package/one/things/plans/README-SIMPLIFICATION.md +0 -349
  827. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
  828. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
  829. package/one/things/plans/ai-elements-integration.md +0 -483
  830. package/one/things/plans/ai-elements.md +0 -1278
  831. package/one/things/plans/ai-integration-plan.md +0 -263
  832. package/one/things/plans/ai-integration.md +0 -996
  833. package/one/things/plans/ai-sdk.md +0 -798
  834. package/one/things/plans/ai-tools.md +0 -621
  835. package/one/things/plans/app.md +0 -832
  836. package/one/things/plans/architecture-summary.md +0 -312
  837. package/one/things/plans/async-ai-agents.md +0 -233
  838. package/one/things/plans/backend-agnostic-frontend.md +0 -390
  839. package/one/things/plans/backend-cleanup-quickstart.md +0 -380
  840. package/one/things/plans/backend-ontology-conformance.md +0 -475
  841. package/one/things/plans/backend-status.md +0 -599
  842. package/one/things/plans/backend-structure.md +0 -847
  843. package/one/things/plans/backend-target-structure.md +0 -482
  844. package/one/things/plans/backend.md +0 -1175
  845. package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
  846. package/one/things/plans/better-auth-any-backend.md +0 -1896
  847. package/one/things/plans/better-auth-available-features.md +0 -273
  848. package/one/things/plans/big-plan.md +0 -52
  849. package/one/things/plans/cli-updates-required.md +0 -320
  850. package/one/things/plans/complete-step-by-step.md +0 -1409
  851. package/one/things/plans/components.md +0 -709
  852. package/one/things/plans/convex-agents.md +0 -1034
  853. package/one/things/plans/convex-better-auth.md +0 -1141
  854. package/one/things/plans/convex-on-off.md +0 -407
  855. package/one/things/plans/crypto-token-researcher.md +0 -629
  856. package/one/things/plans/data-quality-metrics.md +0 -745
  857. package/one/things/plans/deep-researcher-agent.md +0 -466
  858. package/one/things/plans/deploy-to-cloudflare.md +0 -623
  859. package/one/things/plans/deployment-architecture.md +0 -469
  860. package/one/things/plans/desktop.md +0 -1139
  861. package/one/things/plans/development-plan.md +0 -1283
  862. package/one/things/plans/development-workflow-tldr.md +0 -207
  863. package/one/things/plans/development-workflow.md +0 -959
  864. package/one/things/plans/dsl-claude-code.md +0 -1011
  865. package/one/things/plans/effect-components.md +0 -1743
  866. package/one/things/plans/effect-patterns-reference.md +0 -2235
  867. package/one/things/plans/effect.md +0 -1806
  868. package/one/things/plans/email.md +0 -966
  869. package/one/things/plans/enhance-auth.md +0 -1692
  870. package/one/things/plans/execution-strategy.md +0 -1291
  871. package/one/things/plans/existing-infrastructure.md +0 -712
  872. package/one/things/plans/feature-based-sites.md +0 -894
  873. package/one/things/plans/frontend-effects.md +0 -1276
  874. package/one/things/plans/group-folder-multi-tenancy.md +0 -893
  875. package/one/things/plans/improve-codebase.md +0 -1811
  876. package/one/things/plans/install-components.md +0 -215
  877. package/one/things/plans/integrate-frontend-and-backend.md +0 -603
  878. package/one/things/plans/landing.md +0 -820
  879. package/one/things/plans/layout.md +0 -249
  880. package/one/things/plans/mail-backend.md +0 -1361
  881. package/one/things/plans/mail.md +0 -2677
  882. package/one/things/plans/mcp-clear-context-prompt.md +0 -81
  883. package/one/things/plans/mcp-simple.md +0 -248
  884. package/one/things/plans/multi-ontology-architecture.md +0 -885
  885. package/one/things/plans/next-features.md +0 -114
  886. package/one/things/plans/npx-agent-safety.md +0 -785
  887. package/one/things/plans/npx-agent.md +0 -1089
  888. package/one/things/plans/onboarding.md +0 -51
  889. package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
  890. package/one/things/plans/one.md +0 -677
  891. package/one/things/plans/ontology-6-dimensions.md +0 -2201
  892. package/one/things/plans/ontology-compliance-audit.md +0 -342
  893. package/one/things/plans/ontology-driven-strategy.md +0 -882
  894. package/one/things/plans/ontology-refine.md +0 -586
  895. package/one/things/plans/ontology-ui-approach.md +0 -375
  896. package/one/things/plans/open-agent.md +0 -840
  897. package/one/things/plans/performace.md +0 -122
  898. package/one/things/plans/phase-1-foundation.md +0 -620
  899. package/one/things/plans/phase-3-implementation.md +0 -1037
  900. package/one/things/plans/plan-connect-to-api.md +0 -146
  901. package/one/things/plans/quick-wins.md +0 -1428
  902. package/one/things/plans/r2.md +0 -777
  903. package/one/things/plans/readme-backend-cleanup.md +0 -402
  904. package/one/things/plans/release.md +0 -507
  905. package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
  906. package/one/things/plans/repos.md +0 -98
  907. package/one/things/plans/separate-copy-2.md +0 -1349
  908. package/one/things/plans/separate-copy-3.md +0 -2479
  909. package/one/things/plans/separate-copy.md +0 -1349
  910. package/one/things/plans/separate-demo.md +0 -864
  911. package/one/things/plans/separate.md +0 -1999
  912. package/one/things/plans/sequence.md +0 -2040
  913. package/one/things/plans/shadcn-integration-summary.md +0 -510
  914. package/one/things/plans/sidebar.md +0 -206
  915. package/one/things/plans/skills.md +0 -709
  916. package/one/things/plans/small-fixes.md +0 -23
  917. package/one/things/plans/start-new.md +0 -764
  918. package/one/things/plans/switch-off-auth.md +0 -42
  919. package/one/things/plans/sync-checklist.md +0 -351
  920. package/one/things/plans/test-backend-connection.md +0 -514
  921. package/one/things/plans/unified-implementation-plan.md +0 -934
  922. package/one/things/plans/update-demos.md +0 -581
  923. package/one/things/plans/use-our-backend.md +0 -572
  924. package/one/things/plans/video-backend.md +0 -638
  925. package/one/things/plans/video-frontend.md +0 -490
  926. package/one/things/plans/video-old-archived.md +0 -656
  927. package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
  928. package/one/things/plans/wave1-onboarding-vision.md +0 -744
  929. package/one/things/plans/wave1-orchestration-summary.md +0 -604
  930. package/one/things/plans/wave1-specialist-assignments.md +0 -1413
  931. package/one/things/plans/workflow-files.md +0 -1210
  932. package/one/things/plans/workflow.md +0 -1378
  933. package/one/things/plans-u.md +0 -905
  934. package/one/things/products/Blockchain Products.md +0 -6278
  935. package/one/things/products/cascade-landing-page.md +0 -841
  936. package/one/things/products/cascade.md +0 -1568
  937. package/one/things/products/context-engineering.md +0 -1488
  938. package/one/things/products/onthology.md +0 -15
  939. package/one/things/products/ontology-ui-shadcn.md +0 -1302
  940. package/one/things/products/ontology-ui.md +0 -1429
  941. package/one/things/products/ontology.md +0 -789
  942. package/one/things/products/sdk.md +0 -573
  943. package/one/things/promptkit.md +0 -930
  944. package/one/things/repos/all-repos.md +0 -0
  945. package/one/things/scripts-clean-mac.sh +0 -409
  946. package/one/things/service-providers-new.md +0 -1052
  947. package/one/things/service-providers.md +0 -1121
  948. package/one/things/structure.md +0 -532
  949. package/one/things/system.md +0 -618
  950. package/one/things/templates.md +0 -294
  951. package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
  952. package/one/things/tests/2-1-test-analysis.md +0 -544
  953. package/one/things/things.md +0 -384
  954. package/one/things/todo-acp-integration.md +0 -744
  955. package/one/things/todo-ai.md +0 -933
  956. package/one/things/todo-api.md +0 -1078
  957. package/one/things/todo-assignment.md +0 -580
  958. package/one/things/todo-buy-chatgpt.md +0 -1450
  959. package/one/things/todo-components.md +0 -1683
  960. package/one/things/todo-connections.md +0 -278
  961. package/one/things/todo-ecommerce-frontend.md +0 -1313
  962. package/one/things/todo-ecommerce.md +0 -569
  963. package/one/things/todo-effects.md +0 -1075
  964. package/one/things/todo-frontend-effects.md +0 -977
  965. package/one/things/todo-landing-page.md +0 -1091
  966. package/one/things/todo-mail.md +0 -1160
  967. package/one/things/todo-master-plan.md +0 -490
  968. package/one/things/todo-onboard.md +0 -666
  969. package/one/things/todo-one-ie.md +0 -538
  970. package/one/things/todo-page.md +0 -606
  971. package/one/things/todo-plans.md +0 -282
  972. package/one/things/todo-projects.md +0 -241
  973. package/one/things/todo-refactoring-plan.md +0 -366
  974. package/one/things/todo-release.md +0 -654
  975. package/one/things/todo-sequence.md +0 -1621
  976. package/one/things/todo-use-our-backend.md +0 -1908
  977. package/one/things/todo-workflow.md +0 -626
  978. package/one/things/todo-x402.md +0 -2047
  979. package/one/things/todo.md +0 -21
  980. package/one/things/video/scripts-crypto.md +0 -835
  981. package/one/things/video-script-backup.md +0 -318
  982. package/one/things/video-script-demo.md +0 -382
  983. package/one/things/video-script-ontology.md +0 -333
  984. package/one/things/video-script.md +0 -361
@@ -1,2554 +0,0 @@
1
- ---
2
- title: Implementation Examples
3
- dimension: knowledge
4
- category: implementation-examples.md
5
- tags: agent, ai, architecture, auth, backend, connections, events, frontend, knowledge, ontology
6
- related_dimensions: connections, events, people, things
7
- scope: global
8
- created: 2025-11-03
9
- updated: 2025-11-03
10
- version: 1.0.0
11
- ai_context: |
12
- This document is part of the knowledge dimension in the implementation-examples.md category.
13
- Location: one/knowledge/implementation-examples.md
14
- Purpose: Documents one platform - implementation examples
15
- Related dimensions: connections, events, people, things
16
- For AI agents: Read this to understand implementation examples.
17
- ---
18
-
19
-
20
- # ONE Platform - Implementation Examples
21
-
22
- **Complete Reference**: Ontology, DSL, Schema, and Implementation Patterns
23
-
24
- ---
25
-
26
- ## Overview
27
-
28
- The 6-dimension ontology architecture (things, connections, events, knowledge, people, protocols) provides unprecedented flexibility, while Convex + Effect.ts delivers production-grade reliability.
29
-
30
- **Tech Stack**: Astro + React + shadcn/ui frontend, Convex backend with comprehensive components (@convex-dev/agent, workflow, rag, rate-limiter), Effect.ts service layer, Stripe Connect for payments.
31
-
32
- ### Foundation Documents
33
-
34
- This document integrates information from:
35
-
36
- 1. **Ontology** (`Ontology.md`) - The 6-dimension data model that defines ALL things, connections, events, knowledge, people, and protocols
37
- 2. **DSL** (`DSL.md`, `ONE DSL.md`, `ONE DSL English.md`) - Domain-specific language for feature definition
38
- 3. **Schema** (`convex/schema.ts`) - Current authentication-focused schema and target ontology-based schema
39
- 4. **Implementation Examples** - Real-world code patterns and feature implementations
40
-
41
- ### Complete Architecture Stack
42
-
43
- ```
44
- ┌─────────────────────────────────────────────────────────────┐
45
- │ Plain English DSL (Creator/CEO writes features) │
46
- └─────────────────────────────────────────────────────────────┘
47
- ↓
48
- ┌─────────────────────────────────────────────────────────────┐
49
- │ Technical DSL (JSON-like, validates against ontology) │
50
- └─────────────────────────────────────────────────────────────┘
51
- ↓
52
- ┌─────────────────────────────────────────────────────────────┐
53
- │ Ontology (6 dimensions: things, connections, events, knowledge, people, protocols) │
54
- └─────────────────────────────────────────────────────────────┘
55
- ↓
56
- ┌─────────────────────────────────────────────────────────────┐
57
- │ Schema Definition (Convex with validation) │
58
- └─────────────────────────────────────────────────────────────┘
59
- ↓
60
- ┌─────────────────────────────────────────────────────────────┐
61
- │ Generated Types (TypeScript strict mode) │
62
- └─────────────────────────────────────────────────────────────┘
63
- ↓
64
- ┌─────────────────────────────────────────────────────────────┐
65
- │ Provider Services (Effect.ts with dependency injection) │
66
- └─────────────────────────────────────────────────────────────┘
67
- ↓
68
- ┌─────────────────────────────────────────────────────────────┐
69
- │ Compiled TypeScript (Production code with tests) │
70
- └─────────────────────────────────────────────────────────────┘
71
- ↓
72
- ┌─────────────────────────────────────────────────────────────┐
73
- │ Deployed Feature (Live on ONE platform) │
74
- └─────────────────────────────────────────────────────────────┘
75
- ```
76
-
77
- ### Why This Architecture Works
78
-
79
- **Ontology-First Design:**
80
- - Every feature maps to 6 dimensions (things, connections, events, knowledge, people, protocols)
81
- - Simple test: "If you can't map it to these 6 dimensions, rethink it"
82
- - AI agents can't generate invalid data models
83
-
84
- **DSL Validation:**
85
- - Plain English → Technical DSL → TypeScript
86
- - Validates against ontology before compilation
87
- - Generates type-safe code automatically
88
- - Non-technical users can write features
89
-
90
- **Schema Enforcement:**
91
- - Convex schema validates all database operations
92
- - Type-safe queries with full autocompletion
93
- - Indexed for performance (< 100ms queries)
94
- - Vector search for semantic operations
95
-
96
- **Effect.ts Service Layer:**
97
- - Typed error channels (no silent failures)
98
- - Automatic dependency injection
99
- - Testable with mocked services
100
- - Composable business logic
101
-
102
- ---
103
-
104
- ## Ontology: The 6-Dimension Universe
105
-
106
- **Purpose**: Complete data model for AI agents to understand how EVERYTHING in ONE platform is structured.
107
-
108
- ### Core Concept
109
-
110
- Every single thing in ONE platform exists in one of these 6 dimensions:
111
-
112
- ```
113
- ┌──────────────────────────────────────────────────────────────┐
114
- │ ENTITIES TABLE │
115
- │ Every "thing" - users, agents, content, tokens, courses │
116
- └──────────────────────────────────────────────────────────────┘
117
- ↓
118
- ┌──────────────────────────────────────────────────────────────┐
119
- │ CONNECTIONS TABLE │
120
- │ Every relationship - owns, follows, taught_by, powers │
121
- └──────────────────────────────────────────────────────────────┘
122
- ↓
123
- ┌──────────────────────────────────────────────────────────────┐
124
- │ EVENTS TABLE │
125
- │ Every action - purchased, created, viewed, completed │
126
- └──────────────────────────────────────────────────────────────┘
127
- ↓
128
- ┌──────────────────────────────────────────────────────────────┐
129
- │ TAGS TABLE │
130
- │ Every category - industry:fitness, skill:video, etc. │
131
- └──────────────────────────────────────────────────────────────┘
132
- ```
133
-
134
- **Golden Rule:** If you can't map your feature to these 6 dimensions, you're thinking about it wrong.
135
-
136
- ### Entity Types
137
-
138
- ```typescript
139
- type EntityType =
140
- // CORE
141
- | "creator" // Human creator
142
- | "ai_clone" // Digital twin of creator
143
- | "audience_member" // Fan/user
144
-
145
- // BUSINESS AGENTS (10 types)
146
- | "strategy_agent" // Vision, planning, OKRs
147
- | "research_agent" // Market, trends, competitors
148
- | "marketing_agent" // Content strategy, SEO, distribution
149
- | "sales_agent" // Funnels, conversion, follow-up
150
- | "service_agent" // Support, onboarding, success
151
- | "design_agent" // Brand, UI/UX, assets
152
- | "engineering_agent" // Tech, integration, automation
153
- | "finance_agent" // Revenue, costs, forecasting
154
- | "legal_agent" // Compliance, contracts, IP
155
- | "intelligence_agent" // Analytics, insights, predictions
156
-
157
- // CONTENT
158
- | "blog_post" // Written content
159
- | "video" // Video content
160
- | "podcast" // Audio content
161
- | "social_post" // Social media post
162
- | "email" // Email content
163
- | "course" // Educational course
164
- | "lesson" // Individual lesson
165
-
166
- // PRODUCTS
167
- | "digital_product" // Templates, tools, assets
168
- | "membership" // Tiered membership
169
- | "consultation" // 1-on-1 session
170
- | "nft" // NFT collectible
171
-
172
- // COMMUNITY
173
- | "community" // Community space
174
- | "conversation" // Thread/discussion
175
- | "message" // Individual message
176
-
177
- // TOKEN
178
- | "token" // Actual token instance
179
- | "token_contract" // Smart contract
180
-
181
- // KNOWLEDGE
182
- | "knowledge_item" // Piece of creator knowledge
183
- | "embedding" // Vector embedding
184
- ```
185
-
186
- ### Connection Types (Optimized 24 Types)
187
-
188
- **Design Philosophy**: Use metadata fields instead of proliferating connection types.
189
-
190
- ```typescript
191
- type ConnectionType =
192
- // OWNERSHIP (3 types)
193
- | "owns" // Creator owns token/content (metadata.revenueShare)
194
- | "created_by" // Content created by creator
195
- | "authored" // User authored content (vs. generated_by for AI)
196
-
197
- // AI RELATIONSHIPS (3 types)
198
- | "clone_of" // AI is clone of creator
199
- | "trained_on" // Clone trained on content (metadata.trainingDataType)
200
- | "powers" // Agent powers clone/feature (metadata.capability)
201
-
202
- // CONTENT RELATIONSHIPS (4 types)
203
- | "published_to" // Content published to platform (metadata.visibility)
204
- | "part_of" // Lesson part of course (metadata.order, metadata.section)
205
- | "references" // Content references entity (metadata.referenceType)
206
- | "derived_from" // Content derived from original (metadata.derivationType)
207
-
208
- // COMMUNITY RELATIONSHIPS (3 types)
209
- | "member_of" // User member of community (metadata.role, metadata.joinedAt)
210
- | "following" // User follows creator (metadata.notificationsEnabled)
211
- | "engaged_with" // User engaged with content (metadata.engagementType: "liked", "commented", "shared")
212
-
213
- // BUSINESS RELATIONSHIPS (3 types)
214
- | "manages" // Agent manages function (metadata.permissions)
215
- | "collaborates_with" // Entities collaborate (metadata.collaborationType, metadata.revenueShare)
216
- | "assigned_to" // Task assigned to entity (metadata.priority, metadata.deadline)
217
-
218
- // TRANSACTIONAL RELATIONSHIPS (4 types - consolidated from 7)
219
- | "transacted" // Generic transaction (metadata.transactionType: "purchase", "subscription", "invoice")
220
- | "holds" // User holds asset (metadata.assetType: "tokens", "nft", "stake", metadata.amount)
221
- | "enrolled_in" // User enrolled in course (metadata.progress, metadata.startedAt)
222
- | "completed" // User completed course/task (metadata.completedAt, metadata.certificateId)
223
-
224
- // REFERRAL/GROWTH (2 types)
225
- | "referred_by" // User referred by another (metadata.referralCode, metadata.conversionStatus)
226
- | "converted_from" // User converted from lead (metadata.conversionType, metadata.source)
227
-
228
- // MEDIA/ANALYTICS (2 types)
229
- | "featured_in" // Entity featured in content (metadata.startTime, metadata.endTime)
230
- | "analyzed_by" // Entity analyzed by intelligence (metadata.analysisType, metadata.confidence)
231
- ```
232
-
233
- **Key Improvements**:
234
- - **Before**: 30+ connection types
235
- - **After**: 24 optimized types
236
- - **Strategy**: Use `metadata` for variants (e.g., "transacted" with metadata.transactionType instead of "paid_for", "subscribed_to", "invoiced_to")
237
- - **Benefits**: Simpler schema, more flexible queries, easier to extend
238
-
239
- ### Event Types (Optimized 38 Types)
240
-
241
- **Design Philosophy**: Consolidate status variants into metadata fields.
242
-
243
- ```typescript
244
- type EventType =
245
- // ENTITY LIFECYCLE (6 types)
246
- | "entity_created" // Any entity created (metadata.entityType)
247
- | "entity_updated" // Any entity updated (metadata.fields)
248
- | "entity_deleted" // Soft delete (metadata.reason)
249
- | "entity_restored" // Undelete (metadata.restoredBy)
250
- | "entity_published" // Draft → Published (metadata.visibility)
251
- | "entity_archived" // Active → Archived (metadata.archiveReason)
252
-
253
- // AI/CLONE EVENTS (4 types)
254
- | "clone_interaction" // Chat/interaction with clone (metadata.messageCount, metadata.duration)
255
- | "clone_trained" // Training completed (metadata.dataPoints, metadata.model)
256
- | "ai_generated" // AI generated content (metadata.contentType, metadata.prompt)
257
- | "voice_cloned" // Voice clone created (metadata.provider, metadata.voiceId)
258
-
259
- // AGENT EVENTS (3 types - consolidated from 4)
260
- | "agent_executed" // Agent ran (metadata.status: "success", "failed", "partial")
261
- | "workflow_started" // Workflow initiated (metadata.workflowType, metadata.steps)
262
- | "workflow_completed" // Workflow finished (metadata.duration, metadata.status)
263
-
264
- // CONTENT EVENTS (5 types)
265
- | "content_viewed" // Content viewed (metadata.duration, metadata.completionRate)
266
- | "content_interacted" // User interacted (metadata.interactionType: "liked", "shared", "commented")
267
- | "content_downloaded" // Content downloaded (metadata.format)
268
- | "content_embedded" // Embedding generated (metadata.model, metadata.dimensions)
269
- | "content_moderated" // Moderation action (metadata.action, metadata.reason)
270
-
271
- // LEARNING EVENTS (4 types - consolidated from 5)
272
- | "course_enrolled" // User enrolled in course
273
- | "progress_updated" // Progress on course/lesson (metadata.entityId, metadata.progress)
274
- | "assessment_completed" // Test/quiz finished (metadata.score, metadata.passed)
275
- | "certificate_earned" // Certificate issued (metadata.certificateId, metadata.skills)
276
-
277
- // TOKEN/ASSET EVENTS (5 types - consolidated from 7)
278
- | "token_deployed" // Contract deployed (metadata.contractAddress, metadata.chain)
279
- | "token_transacted" // Token transaction (metadata.action: "purchased", "earned", "burned", metadata.amount)
280
- | "token_staked" // Staking action (metadata.action: "staked", "unstaked", metadata.amount, metadata.duration)
281
- | "governance_action" // Governance event (metadata.actionType: "vote", "proposal", "execution")
282
- | "nft_minted" // NFT minted (metadata.tokenId, metadata.metadata)
283
-
284
- // PAYMENT EVENTS (3 types - consolidated from 5)
285
- | "payment_processed" // Payment event (metadata.status: "initiated", "completed", "failed", "refunded")
286
- | "subscription_changed" // Subscription event (metadata.action: "started", "renewed", "cancelled", "upgraded")
287
- | "invoice_generated" // Invoice created/sent (metadata.amount, metadata.dueDate, metadata.status)
288
-
289
- // GROWTH/ENGAGEMENT (5 types)
290
- | "referral_created" // Referral made (metadata.referralCode, metadata.channel)
291
- | "referral_converted" // Referral converted (metadata.conversionValue)
292
- | "achievement_unlocked" // Achievement earned (metadata.achievementId, metadata.points)
293
- | "level_changed" // User level changed (metadata.oldLevel, metadata.newLevel, metadata.reason)
294
- | "viral_shared" // Viral share occurred (metadata.platform, metadata.reach)
295
-
296
- // ANALYTICS/INTELLIGENCE (3 types)
297
- | "metric_calculated" // Metric computed (metadata.metricType, metadata.value)
298
- | "insight_generated" // AI insight created (metadata.insightType, metadata.confidence)
299
- | "report_generated" // Report created (metadata.reportType, metadata.period)
300
- ```
301
-
302
- **Key Improvements**:
303
- - **Before**: 50+ event types with status variants
304
- - **After**: 38 consolidated types
305
- - **Strategy**: Use `metadata.status` or `metadata.action` for state variants
306
- - **Example**: "payment_initiated", "payment_completed", "payment_failed" → "payment_processed" with metadata.status
307
- - **Benefits**: Easier analytics queries, consistent event structure, simpler event handlers
308
-
309
- **For complete ontology details, see:** `Ontology.md`
310
-
311
- ---
312
-
313
- ## ONE DSL: Domain-Specific Language
314
-
315
- **Purpose**: Declarative language for defining features that compiles to Effect.ts and TypeScript.
316
-
317
- ### DSL Architecture Stack
318
-
319
- ```
320
- Plain English (CEO writes)
321
- ↓ [Parser]
322
- Technical DSL (validated against ontology)
323
- ↓ [Compiler]
324
- TypeScript with Effect.ts (production code)
325
- ↓ [Generated automatically]
326
- Tests + Documentation
327
- ↓
328
- Deployed Feature
329
- ```
330
-
331
- ### Plain English DSL
332
-
333
- **For creators and non-technical users** - Natural language that compiles to working code.
334
-
335
- **Example:**
336
- ```
337
- FEATURE: Let fans chat with my AI clone
338
-
339
- WHEN a fan sends a message
340
- CHECK they own tokens
341
- GET my AI personality
342
- SEND message to AI with my personality
343
- SAVE the conversation
344
- GIVE fan 10 tokens as reward
345
- SHOW AI response to fan
346
- ```
347
-
348
- **Core Commands:**
349
- - `CHECK` - Validate something
350
- - `CREATE` - Make something new
351
- - `CONNECT` - Link two things
352
- - `RECORD` - Log that something happened
353
- - `CALL` - Use external service
354
- - `GET` - Retrieve something
355
- - `IF/THEN/ELSE` - Conditional logic
356
- - `DO TOGETHER` - Atomic operations
357
- - `WAIT` - Pause execution
358
- - `FOR EACH` - Loop through items
359
- - `GIVE` - Return result
360
-
361
- ### Technical DSL
362
-
363
- **For AI agents and developers** - JSON-like syntax that validates against ontology.
364
-
365
- **Example:**
366
- ```typescript
367
- const createAICloneDSL = {
368
- feature: "CreateAIClone",
369
- input: {
370
- creatorId: "Id<entities>",
371
- videoUrls: "string[]",
372
- },
373
- output: {
374
- cloneId: "Id<entities>",
375
- voiceId: "string",
376
- },
377
- flow: [
378
- {
379
- validate: {
380
- creatorId: { exists: true, type: "creator" },
381
- videoUrls: { minLength: 3 },
382
- },
383
- onError: { return: { error: "InsufficientContent" } },
384
- },
385
- {
386
- service: {
387
- provider: "elevenlabs",
388
- method: "cloneVoice",
389
- params: { samples: "$audioSamples" },
390
- output: "voiceId",
391
- retry: { times: 3, delay: "5s" },
392
- },
393
- },
394
- {
395
- entity: {
396
- type: "ai_clone",
397
- name: "$creator.name + ' AI Clone'",
398
- properties: {
399
- voiceId: "$voiceId",
400
- systemPrompt: "$personality.systemPrompt",
401
- temperature: 0.7,
402
- },
403
- status: "active",
404
- },
405
- output: "cloneId",
406
- },
407
- {
408
- connect: {
409
- from: "$input.creatorId",
410
- to: "$cloneId",
411
- type: "owns",
412
- },
413
- },
414
- {
415
- event: {
416
- entity: "$cloneId",
417
- type: "clone_created",
418
- actor: "$input.creatorId",
419
- },
420
- },
421
- {
422
- return: {
423
- cloneId: "$cloneId",
424
- voiceId: "$voiceId",
425
- },
426
- },
427
- ],
428
- };
429
- ```
430
-
431
- **DSL Primitives:**
432
- - `entity` - Create entity in ontology
433
- - `connect` - Create relationship between entities
434
- - `event` - Log an event
435
- - `query` - Retrieve entities/connections/events
436
- - `flow` - Multi-step workflow with branching
437
- - `service` - Call external provider (OpenAI, ElevenLabs, Stripe, etc.)
438
- - `validate` - Check conditions
439
- - `atomic` - Group operations with rollback support
440
-
441
- ### DSL Validation & Compilation
442
-
443
- **Validator** - Ensures DSL uses only valid ontology types:
444
- ```typescript
445
- class ONEValidator {
446
- validate(dsl: any): { valid: boolean; errors: string[] } {
447
- // Validates all entity types exist in ontology
448
- // Validates all connection types exist in ontology
449
- // Validates all event types exist in ontology
450
- return { valid: true, errors: [] };
451
- }
452
- }
453
- ```
454
-
455
- **Compiler** - Generates type-safe TypeScript with Effect.ts:
456
- ```typescript
457
- class ONECompiler {
458
- compile(dsl: any): string {
459
- // Compiles DSL to TypeScript
460
- // Generates Effect.ts service calls
461
- // Adds proper error handling
462
- // Creates fully typed code
463
- return generatedCode;
464
- }
465
- }
466
- ```
467
-
468
- **Complete DSL examples and specifications in:** `DSL.md`, `ONE DSL.md`, `ONE DSL English.md`
469
-
470
- ---
471
-
472
- ## Schema Implementation
473
-
474
- ### Current Schema (Authentication Focus)
475
-
476
- **File**: `convex/schema.ts` (Current - Authentication focused)
477
-
478
- ```typescript
479
- import { defineSchema, defineTable } from "convex/server";
480
- import { v } from "convex/values";
481
-
482
- export default defineSchema({
483
- users: defineTable({
484
- email: v.string(),
485
- passwordHash: v.string(),
486
- name: v.optional(v.string()),
487
- emailVerified: v.optional(v.boolean()),
488
- createdAt: v.number(),
489
- }).index("by_email", ["email"]),
490
-
491
- sessions: defineTable({
492
- userId: v.id("users"),
493
- token: v.string(),
494
- expiresAt: v.number(),
495
- createdAt: v.number(),
496
- }).index("by_token", ["token"])
497
- .index("by_userId", ["userId"]),
498
-
499
- passwordResets: defineTable({
500
- userId: v.id("users"),
501
- token: v.string(),
502
- expiresAt: v.number(),
503
- createdAt: v.number(),
504
- used: v.boolean(),
505
- }).index("by_token", ["token"])
506
- .index("by_userId", ["userId"]),
507
-
508
- emailVerifications: defineTable({
509
- userId: v.id("users"),
510
- email: v.string(),
511
- token: v.string(),
512
- expiresAt: v.number(),
513
- createdAt: v.number(),
514
- verified: v.boolean(),
515
- }).index("by_token", ["token"])
516
- .index("by_userId", ["userId"])
517
- .index("by_email", ["email"]),
518
-
519
- magicLinks: defineTable({
520
- email: v.string(),
521
- token: v.string(),
522
- expiresAt: v.number(),
523
- createdAt: v.number(),
524
- used: v.boolean(),
525
- }).index("by_token", ["token"])
526
- .index("by_email", ["email"]),
527
-
528
- twoFactorAuth: defineTable({
529
- userId: v.id("users"),
530
- secret: v.string(),
531
- backupCodes: v.array(v.string()),
532
- enabled: v.boolean(),
533
- createdAt: v.number(),
534
- }).index("by_userId", ["userId"]),
535
- });
536
- ```
537
-
538
- ### Target Ontology-Based Schema (Plain Convex)
539
-
540
- **Future implementation** - 6-dimension architecture with full ontology support:
541
-
542
- ```typescript
543
- import { defineSchema, defineTable } from "convex/server";
544
- import { v } from "convex/values";
545
-
546
- export default defineSchema({
547
- // ENTITIES TABLE - All "things"
548
- entities: defineTable({
549
- type: v.union(
550
- // Core
551
- v.literal("creator"),
552
- v.literal("ai_clone"),
553
- v.literal("audience_member"),
554
- // Business Agents
555
- v.literal("strategy_agent"),
556
- v.literal("research_agent"),
557
- v.literal("marketing_agent"),
558
- v.literal("sales_agent"),
559
- v.literal("service_agent"),
560
- v.literal("design_agent"),
561
- v.literal("engineering_agent"),
562
- v.literal("finance_agent"),
563
- v.literal("legal_agent"),
564
- v.literal("intelligence_agent"),
565
- // Content
566
- v.literal("blog_post"),
567
- v.literal("video"),
568
- v.literal("podcast"),
569
- v.literal("social_post"),
570
- v.literal("email"),
571
- v.literal("course"),
572
- v.literal("lesson"),
573
- // Products
574
- v.literal("digital_product"),
575
- v.literal("membership"),
576
- v.literal("consultation"),
577
- v.literal("nft"),
578
- // Community
579
- v.literal("community"),
580
- v.literal("conversation"),
581
- v.literal("message"),
582
- // Token
583
- v.literal("token"),
584
- v.literal("token_contract"),
585
- // Knowledge
586
- v.literal("knowledge_item"),
587
- v.literal("embedding"),
588
- // Platform
589
- v.literal("website"),
590
- v.literal("landing_page"),
591
- v.literal("template"),
592
- v.literal("livestream"),
593
- v.literal("recording"),
594
- v.literal("media_asset"),
595
- // Business
596
- v.literal("payment"),
597
- v.literal("subscription"),
598
- v.literal("invoice"),
599
- v.literal("metric"),
600
- v.literal("insight"),
601
- v.literal("prediction"),
602
- v.literal("report"),
603
- // Marketing
604
- v.literal("notification"),
605
- v.literal("email_campaign"),
606
- v.literal("announcement"),
607
- v.literal("referral"),
608
- v.literal("campaign"),
609
- v.literal("lead")
610
- ),
611
- name: v.string(),
612
- properties: v.any(), // Type-specific properties as JSON
613
- status: v.optional(
614
- v.union(
615
- v.literal("active"),
616
- v.literal("inactive"),
617
- v.literal("draft"),
618
- v.literal("published"),
619
- v.literal("archived")
620
- )
621
- ),
622
- createdAt: v.number(),
623
- updatedAt: v.number(),
624
- deletedAt: v.optional(v.number()),
625
- })
626
- .index("by_type", ["type"])
627
- .index("by_status", ["status"])
628
- .index("by_createdAt", ["createdAt"])
629
- .index("by_type_status", ["type", "status"])
630
- .searchIndex("search_entities", {
631
- searchField: "name",
632
- filterFields: ["type", "status"],
633
- }),
634
-
635
- // CONNECTIONS TABLE - All relationships
636
- connections: defineTable({
637
- fromEntityId: v.id("entities"),
638
- toEntityId: v.id("entities"),
639
- relationshipType: v.union(
640
- // Ownership (3 types)
641
- v.literal("owns"),
642
- v.literal("created_by"),
643
- v.literal("authored"),
644
- // AI relationships (3 types)
645
- v.literal("clone_of"),
646
- v.literal("trained_on"),
647
- v.literal("powers"),
648
- // Content relationships (4 types)
649
- v.literal("published_to"),
650
- v.literal("part_of"),
651
- v.literal("references"),
652
- v.literal("derived_from"),
653
- // Community relationships (3 types)
654
- v.literal("member_of"),
655
- v.literal("following"),
656
- v.literal("engaged_with"),
657
- // Business relationships (3 types)
658
- v.literal("manages"),
659
- v.literal("collaborates_with"),
660
- v.literal("assigned_to"),
661
- // Transactional relationships (4 types)
662
- v.literal("transacted"),
663
- v.literal("holds"),
664
- v.literal("enrolled_in"),
665
- v.literal("completed"),
666
- // Referral/growth (2 types)
667
- v.literal("referred_by"),
668
- v.literal("converted_from"),
669
- // Media/analytics (2 types)
670
- v.literal("featured_in"),
671
- v.literal("analyzed_by")
672
- ),
673
- metadata: v.optional(v.any()),
674
- strength: v.optional(v.number()),
675
- validFrom: v.optional(v.number()),
676
- validTo: v.optional(v.number()),
677
- createdAt: v.number(),
678
- updatedAt: v.optional(v.number()),
679
- })
680
- .index("by_relationshipType", ["relationshipType"])
681
- .index("by_fromEntity", ["fromEntityId"])
682
- .index("by_toEntity", ["toEntityId"])
683
- .index("by_from_type", ["fromEntityId", "relationshipType"])
684
- .index("by_to_type", ["toEntityId", "relationshipType"])
685
- .index("by_bidirectional", ["fromEntityId", "toEntityId"])
686
- .index("by_type_from_to", ["relationshipType", "fromEntityId", "toEntityId"]),
687
-
688
- // EVENTS TABLE - All actions
689
- events: defineTable({
690
- entityId: v.id("entities"),
691
- eventType: v.union(
692
- // Entity lifecycle (6 types)
693
- v.literal("entity_created"),
694
- v.literal("entity_updated"),
695
- v.literal("entity_deleted"),
696
- v.literal("entity_restored"),
697
- v.literal("entity_published"),
698
- v.literal("entity_archived"),
699
- // AI/Clone events (4 types)
700
- v.literal("clone_interaction"),
701
- v.literal("clone_trained"),
702
- v.literal("ai_generated"),
703
- v.literal("voice_cloned"),
704
- // Agent events (3 types)
705
- v.literal("agent_executed"),
706
- v.literal("workflow_started"),
707
- v.literal("workflow_completed"),
708
- // Content events (5 types)
709
- v.literal("content_viewed"),
710
- v.literal("content_interacted"),
711
- v.literal("content_downloaded"),
712
- v.literal("content_embedded"),
713
- v.literal("content_moderated"),
714
- // Learning events (4 types)
715
- v.literal("course_enrolled"),
716
- v.literal("progress_updated"),
717
- v.literal("assessment_completed"),
718
- v.literal("certificate_earned"),
719
- // Token/asset events (5 types)
720
- v.literal("token_deployed"),
721
- v.literal("token_transacted"),
722
- v.literal("token_staked"),
723
- v.literal("governance_action"),
724
- v.literal("nft_minted"),
725
- // Payment events (3 types)
726
- v.literal("payment_processed"),
727
- v.literal("subscription_changed"),
728
- v.literal("invoice_generated"),
729
- // Growth/engagement (5 types)
730
- v.literal("referral_created"),
731
- v.literal("referral_converted"),
732
- v.literal("achievement_unlocked"),
733
- v.literal("level_changed"),
734
- v.literal("viral_shared"),
735
- // Analytics/intelligence (3 types)
736
- v.literal("metric_calculated"),
737
- v.literal("insight_generated"),
738
- v.literal("report_generated")
739
- ),
740
- timestamp: v.number(),
741
- metadata: v.optional(v.any()),
742
- actorType: v.optional(
743
- v.union(
744
- v.literal("user"),
745
- v.literal("ai_agent"),
746
- v.literal("system"),
747
- v.literal("api")
748
- )
749
- ),
750
- actorId: v.optional(v.id("entities")),
751
- source: v.optional(v.string()),
752
- sessionId: v.optional(v.string()),
753
- })
754
- .index("by_entity", ["entityId"])
755
- .index("by_timestamp", ["timestamp"])
756
- .index("by_eventType", ["eventType"])
757
- .index("by_entity_type", ["entityId", "eventType"])
758
- .index("by_entity_type_time", ["entityId", "eventType", "timestamp"])
759
- .index("by_type_time", ["eventType", "timestamp"])
760
- .index("by_session", ["sessionId", "timestamp"])
761
- .index("by_actor", ["actorId", "timestamp"]),
762
-
763
- // TAGS TABLE - All categories
764
- tags: defineTable({
765
- name: v.string(),
766
- category: v.optional(
767
- v.union(
768
- v.literal("skill"),
769
- v.literal("industry"),
770
- v.literal("topic"),
771
- v.literal("format"),
772
- v.literal("goal"),
773
- v.literal("audience"),
774
- v.literal("technology"),
775
- v.literal("status")
776
- )
777
- ),
778
- description: v.optional(v.string()),
779
- color: v.optional(v.string()),
780
- icon: v.optional(v.string()),
781
- usageCount: v.number(),
782
- createdAt: v.number(),
783
- })
784
- .index("by_name", ["name"])
785
- .index("by_category", ["category"])
786
- .index("by_usageCount", ["usageCount"]),
787
-
788
- // ENTITY-TAG JUNCTION TABLE
789
- entityTags: defineTable({
790
- entityId: v.id("entities"),
791
- tagId: v.id("tags"),
792
- createdAt: v.number(),
793
- })
794
- .index("by_entity", ["entityId"])
795
- .index("by_tag", ["tagId"])
796
- .index("by_entity_tag", ["entityId", "tagId"]),
797
-
798
- // EMBEDDINGS TABLE - Vector search
799
- embeddings: defineTable({
800
- entityId: v.id("entities"),
801
- embedding: v.array(v.float64()),
802
- model: v.string(),
803
- createdAt: v.number(),
804
- })
805
- .index("by_entity", ["entityId"])
806
- .vectorIndex("by_embedding", {
807
- vectorField: "embedding",
808
- dimensions: 1536,
809
- filterFields: ["entityId", "model"],
810
- }),
811
- });
812
- ```
813
-
814
- **Migration Strategy**: Batched processing with dual-write pattern during transition period.
815
-
816
- **Success Criteria**: ✅ Schema deploys without errors, ✅ All entity types creatable, ✅ Relationship queries work
817
-
818
- ### Metadata-Based Query Patterns
819
-
820
- **Purpose**: Show how to query consolidated types using metadata filters instead of proliferating specific types.
821
-
822
- #### Example 1: Query Payments by Status
823
-
824
- ```typescript
825
- // OLD WAY: Multiple event types
826
- // query("events").filter(q =>
827
- // q.or(
828
- // q.eq(q.field("eventType"), "payment_initiated"),
829
- // q.eq(q.field("eventType"), "payment_completed"),
830
- // q.eq(q.field("eventType"), "payment_failed")
831
- // )
832
- // )
833
-
834
- // NEW WAY: Single event type with metadata filter
835
- export const getPaymentsByStatus = query({
836
- args: { status: v.union(v.literal("initiated"), v.literal("completed"), v.literal("failed"), v.literal("refunded")) },
837
- handler: async (ctx, args) => {
838
- const payments = await ctx.db
839
- .query("events")
840
- .withIndex("by_eventType", (q) => q.eq("eventType", "payment_processed"))
841
- .filter((q) => q.eq(q.field("metadata.status"), args.status))
842
- .order("desc")
843
- .take(100);
844
-
845
- return payments;
846
- },
847
- });
848
- ```
849
-
850
- #### Example 2: Query Connections by Transaction Type
851
-
852
- ```typescript
853
- // OLD WAY: Separate connection types for each transaction
854
- // "paid_for", "subscribed_to", "invoiced_to"
855
-
856
- // NEW WAY: Single "transacted" type with metadata
857
- export const getTransactionsByType = query({
858
- args: {
859
- userId: v.id("entities"),
860
- transactionType: v.union(v.literal("purchase"), v.literal("subscription"), v.literal("invoice"))
861
- },
862
- handler: async (ctx, args) => {
863
- const transactions = await ctx.db
864
- .query("connections")
865
- .withIndex("by_from_type", (q) =>
866
- q.eq("fromEntityId", args.userId).eq("relationshipType", "transacted")
867
- )
868
- .filter((q) => q.eq(q.field("metadata.transactionType"), args.transactionType))
869
- .collect();
870
-
871
- return transactions;
872
- },
873
- });
874
- ```
875
-
876
- #### Example 3: Query User Engagement by Interaction Type
877
-
878
- ```typescript
879
- // OLD WAY: Multiple connection types
880
- // "content_liked", "content_shared", "content_commented"
881
-
882
- // NEW WAY: Single "engaged_with" type with metadata
883
- export const getUserEngagement = query({
884
- args: {
885
- contentId: v.id("entities"),
886
- interactionType: v.optional(v.union(v.literal("liked"), v.literal("shared"), v.literal("commented")))
887
- },
888
- handler: async (ctx, args) => {
889
- let engagements = ctx.db
890
- .query("connections")
891
- .withIndex("by_to_type", (q) =>
892
- q.eq("toEntityId", args.contentId).eq("relationshipType", "engaged_with")
893
- );
894
-
895
- // Filter by interaction type if specified
896
- if (args.interactionType) {
897
- engagements = engagements.filter((q) =>
898
- q.eq(q.field("metadata.engagementType"), args.interactionType)
899
- );
900
- }
901
-
902
- return await engagements.collect();
903
- },
904
- });
905
- ```
906
-
907
- #### Example 4: Query Agent Executions by Status
908
-
909
- ```typescript
910
- // OLD WAY: Multiple event types
911
- // "agent_executed", "agent_completed", "agent_failed"
912
-
913
- // NEW WAY: Single event type with status in metadata
914
- export const getAgentExecutions = query({
915
- args: {
916
- agentId: v.id("entities"),
917
- status: v.optional(v.union(v.literal("success"), v.literal("failed"), v.literal("partial")))
918
- },
919
- handler: async (ctx, args) => {
920
- let executions = ctx.db
921
- .query("events")
922
- .withIndex("by_entity_type", (q) =>
923
- q.eq("entityId", args.agentId).eq("eventType", "agent_executed")
924
- );
925
-
926
- // Filter by status if specified
927
- if (args.status) {
928
- executions = executions.filter((q) =>
929
- q.eq(q.field("metadata.status"), args.status)
930
- );
931
- }
932
-
933
- return await executions.order("desc").take(50);
934
- },
935
- });
936
- ```
937
-
938
- #### Example 5: Analytics Query Across Consolidated Types
939
-
940
- ```typescript
941
- // Query all payment statuses for analytics
942
- export const getPaymentAnalytics = query({
943
- args: { startDate: v.number(), endDate: v.number() },
944
- handler: async (ctx, args) => {
945
- const payments = await ctx.db
946
- .query("events")
947
- .withIndex("by_type_time", (q) =>
948
- q.eq("eventType", "payment_processed")
949
- .gte("timestamp", args.startDate)
950
- .lte("timestamp", args.endDate)
951
- )
952
- .collect();
953
-
954
- // Aggregate by status
955
- const analytics = {
956
- initiated: 0,
957
- completed: 0,
958
- failed: 0,
959
- refunded: 0,
960
- totalAmount: 0,
961
- };
962
-
963
- payments.forEach((payment) => {
964
- const status = payment.metadata?.status || "unknown";
965
- if (status in analytics) {
966
- analytics[status]++;
967
- }
968
- if (status === "completed") {
969
- analytics.totalAmount += payment.metadata?.amount || 0;
970
- }
971
- });
972
-
973
- return analytics;
974
- },
975
- });
976
- ```
977
-
978
- **Benefits of Metadata-Based Queries**:
979
- - **Simpler schema**: 25 connection types vs. 30+, 35 event types vs. 50+
980
- - **Easier analytics**: Single event type aggregation vs. multiple OR conditions
981
- - **More flexible**: Add new statuses without schema migrations
982
- - **Better performance**: Index on single eventType, filter on metadata
983
- - **Clearer intent**: `metadata.status` explicitly shows state variants
984
-
985
- ---
986
-
987
- ## Quick Reference Guide
988
-
989
- ### How to Build a Feature (Step-by-Step)
990
-
991
- **1. Map to Ontology**
992
- - What **entities** are involved? (creator, ai_clone, token, etc.)
993
- - What **connections** link them? (owns, follows, enrolled_in, etc.)
994
- - What **events** need logging? (clone_created, tokens_purchased, etc.)
995
- - What **tags** categorize them? (industry:fitness, skill:video, etc.)
996
-
997
- **2. Write in Plain English DSL**
998
- ```
999
- FEATURE: [What this does]
1000
-
1001
- INPUT:
1002
- - [what you need]
1003
-
1004
- OUTPUT:
1005
- - [what you get back]
1006
-
1007
- FLOW:
1008
- CHECK [validations]
1009
- CALL [external services]
1010
- CREATE [entities]
1011
- CONNECT [relationships]
1012
- RECORD [events]
1013
- GIVE [results]
1014
- ```
1015
-
1016
- **3. Validate Against Ontology**
1017
- ```typescript
1018
- const validator = new ONEValidator(ontology);
1019
- const validation = validator.validate(myFeatureDSL);
1020
- if (!validation.valid) {
1021
- console.error(validation.errors);
1022
- }
1023
- ```
1024
-
1025
- **4. Compile to TypeScript**
1026
- ```typescript
1027
- const compiler = new ONECompiler();
1028
- const code = compiler.compile(myFeatureDSL);
1029
- // Generates type-safe Effect.ts code
1030
- ```
1031
-
1032
- **5. Deploy**
1033
- ```bash
1034
- # Code is automatically tested and deployed
1035
- ```
1036
-
1037
- ### Common Patterns
1038
-
1039
- **Pattern: Create Thing with Ownership**
1040
- ```typescript
1041
- // DSL
1042
- {
1043
- thing: { type: "ai_clone", name: "My Clone", properties: {...} },
1044
- output: "cloneId"
1045
- }
1046
- {
1047
- connect: { from: "$creatorId", to: "$cloneId", type: "owns" }
1048
- }
1049
- {
1050
- event: { thing: "$cloneId", type: "clone_created", actor: "$creatorId" }
1051
- }
1052
- ```
1053
-
1054
- **Pattern: Token Purchase with Rollback**
1055
- ```typescript
1056
- // DSL
1057
- {
1058
- atomic: [
1059
- { service: { provider: "stripe", method: "charge", ... } },
1060
- { service: { provider: "blockchain", method: "mint", ... } }
1061
- ],
1062
- onError: {
1063
- rollback: [
1064
- { service: { provider: "stripe", method: "refund", ... } },
1065
- { service: { provider: "blockchain", method: "burn", ... } }
1066
- ]
1067
- }
1068
- }
1069
- ```
1070
-
1071
- **Pattern: Query with Relationships**
1072
- ```typescript
1073
- // Get creator's content
1074
- {
1075
- query: {
1076
- from: "connections",
1077
- where: [
1078
- { field: "fromEntityId", operator: "eq", value: "$creatorId" },
1079
- { field: "relationshipType", operator: "eq", value: "authored" }
1080
- ]
1081
- },
1082
- output: "contentConnections"
1083
- }
1084
- ```
1085
-
1086
- ### Validation Rules
1087
-
1088
- **Thing Validation:**
1089
- - ✅ Type must be valid ThingType from ontology
1090
- - ✅ Name cannot be empty
1091
- - ✅ Properties structure must match type
1092
- - ✅ Status must be valid (active, inactive, draft, published, archived)
1093
-
1094
- **Connection Validation:**
1095
- - ✅ fromThingId and toThingId must exist
1096
- - ✅ relationshipType must be valid ConnectionType
1097
- - ✅ Cannot connect thing to itself (usually)
1098
- - ✅ Relationship must make semantic sense
1099
-
1100
- **Event Validation:**
1101
- - ✅ thingId must exist
1102
- - ✅ eventType must be valid EventType
1103
- - ✅ timestamp required
1104
- - ✅ actorId must exist if provided
1105
-
1106
- **Knowledge Validation:**
1107
- - ✅ label must be unique or properly scoped
1108
- - ✅ category must be valid KnowledgeCategory
1109
- - ✅ usageCount must be >= 0
1110
-
1111
- ### Performance Guidelines
1112
-
1113
- **Indexes:**
1114
- - Use indexes for all filter fields
1115
- - Compound indexes for multi-field queries
1116
- - Vector indexes for semantic search
1117
-
1118
- **Query Optimization:**
1119
- - Always use indexes for filters
1120
- - Limit results with `.take(n)`
1121
- - Paginate large result sets
1122
- - Prefer streaming over `.collect()` for large datasets
1123
-
1124
- **Caching:**
1125
- - Cache frequently accessed entities
1126
- - Invalidate cache on entity updates
1127
- - Use stale-while-revalidate pattern
1128
-
1129
- ### Reference Files
1130
-
1131
- - **Ontology Spec**: `Ontology.md` - Complete 6-dimension data model
1132
- - **Technical DSL**: `DSL.md`, `ONE DSL.md` - JSON-like syntax and compiler
1133
- - **Plain English DSL**: `ONE DSL English.md` - Natural language syntax
1134
- - **Schema**: `convex/schema.ts` - Current and target schemas
1135
- - **Examples**: This file - Real-world implementation patterns
1136
-
1137
- ---
1138
-
1139
- ### Week 2: Payment Infrastructure
1140
-
1141
- **Stripe Connect Integration - Direct Revenue Enabler**
1142
-
1143
- #### Implementation: Token Purchase with Revenue Splits
1144
-
1145
- **File**: `convex/payments/tokenPurchase.ts`
1146
-
1147
- ```typescript
1148
- import { v } from "convex/values";
1149
- import { mutation, query } from "./_generated/server";
1150
- import { internal } from "./_generated/api";
1151
-
1152
- // Query to get token ownership for revenue splits
1153
- export const getTokenOwnership = query({
1154
- args: { tokenId: v.id("entities") },
1155
- handler: async (ctx, args) => {
1156
- // Get token entity
1157
- const token = await ctx.db.get(args.tokenId);
1158
- if (!token || token.type !== "token") {
1159
- throw new Error("Token not found");
1160
- }
1161
-
1162
- // Get ownership connections using plain Convex query with index
1163
- const ownerships = await ctx.db
1164
- .query("connections")
1165
- .withIndex("by_to_type", (q) =>
1166
- q.eq("toEntityId", args.tokenId).eq("relationshipType", "owns")
1167
- )
1168
- .collect();
1169
-
1170
- // Return owners with revenue split metadata
1171
- return Promise.all(
1172
- ownerships.map(async (conn) => {
1173
- const owner = await ctx.db.get(conn.fromEntityId);
1174
- return {
1175
- ownerId: conn.fromEntityId,
1176
- ownerName: owner?.name,
1177
- revenueShare: conn.metadata?.revenueShare || 0,
1178
- stripeAccountId: owner?.properties?.stripeAccountId,
1179
- };
1180
- })
1181
- );
1182
- },
1183
- });
1184
-
1185
- // Mutation to process token purchase
1186
- export const purchaseTokens = mutation({
1187
- args: {
1188
- userId: v.id("entities"),
1189
- tokenId: v.id("entities"),
1190
- amount: v.number(),
1191
- usdAmount: v.number(),
1192
- },
1193
- handler: async (ctx, args) => {
1194
- // Validate entities exist
1195
- const user = await ctx.db.get(args.userId);
1196
- const token = await ctx.db.get(args.tokenId);
1197
-
1198
- if (!user || user.type !== "audience_member") {
1199
- throw new Error("User not found");
1200
- }
1201
- if (!token || token.type !== "token") {
1202
- throw new Error("Token not found");
1203
- }
1204
-
1205
- // Schedule payment processing (will be done in action)
1206
- await ctx.scheduler.runAfter(0, internal.payments.processTokenPayment, {
1207
- userId: args.userId,
1208
- tokenId: args.tokenId,
1209
- amount: args.amount,
1210
- usdAmount: args.usdAmount,
1211
- });
1212
-
1213
- return { success: true, message: "Payment processing initiated" };
1214
- },
1215
- });
1216
- ```
1217
-
1218
- **File**: `convex/payments/processPayment.ts` (Action)
1219
-
1220
- ```typescript
1221
- "use node";
1222
- import { v } from "convex/values";
1223
- import { internalAction } from "./_generated/server";
1224
- import { internal } from "./_generated/api";
1225
- import Stripe from "stripe";
1226
-
1227
- const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
1228
-
1229
- export const processTokenPayment = internalAction({
1230
- args: {
1231
- userId: v.id("entities"),
1232
- tokenId: v.id("entities"),
1233
- amount: v.number(),
1234
- usdAmount: v.number(),
1235
- },
1236
- handler: async (ctx, args) => {
1237
- // Get ownership for revenue splits
1238
- const ownership = await ctx.runQuery(internal.payments.getTokenOwnership, {
1239
- tokenId: args.tokenId,
1240
- });
1241
-
1242
- const platformFee = Math.floor(args.usdAmount * 0.15 * 100); // 15% platform fee
1243
-
1244
- // Create Stripe checkout with revenue splits
1245
- const session = await stripe.checkout.sessions.create({
1246
- line_items: [
1247
- {
1248
- price_data: {
1249
- currency: "usd",
1250
- unit_amount: args.usdAmount * 100,
1251
- product_data: { name: `${args.amount} Tokens` },
1252
- },
1253
- quantity: 1,
1254
- },
1255
- ],
1256
- mode: "payment",
1257
- payment_intent_data: {
1258
- application_fee_amount: platformFee,
1259
- transfer_data: {
1260
- destination: ownership[0].stripeAccountId, // Primary owner gets payment
1261
- },
1262
- },
1263
- metadata: {
1264
- userId: args.userId,
1265
- tokenId: args.tokenId,
1266
- amount: args.amount.toString(),
1267
- },
1268
- });
1269
-
1270
- // Record payment event with metadata status
1271
- await ctx.runMutation(internal.events.create, {
1272
- entityId: args.tokenId,
1273
- eventType: "payment_processed",
1274
- actorType: "user",
1275
- actorId: args.userId,
1276
- metadata: {
1277
- status: "initiated",
1278
- paymentType: "token_purchase",
1279
- amount: args.amount,
1280
- usdAmount: args.usdAmount,
1281
- sessionId: session.id,
1282
- },
1283
- });
1284
-
1285
- return { sessionId: session.id, url: session.url };
1286
- },
1287
- });
1288
- ```
1289
-
1290
- **Seller Onboarding**: 2-minute Stripe Express flow with automatic account creation.
1291
-
1292
- **Success Criteria**: ✅ Transactions process correctly, ✅ Revenue splits accurate, ✅ Webhooks handled
1293
-
1294
- ---
1295
-
1296
- ## Phase 2: Content & Product Economy (Weeks 3-4)
1297
-
1298
- ### Week 3: Content Creation & Discovery
1299
-
1300
- **Universal Content Creator - Multiple types following ontology (blog_post, video, podcast, social_post, course, digital_product)**
1301
-
1302
- #### Content Creator Implementation
1303
-
1304
- **File**: `convex/content/create.ts`
1305
-
1306
- ```typescript
1307
- import { v } from "convex/values";
1308
- import { mutation } from "./_generated/server";
1309
-
1310
- export const createContent = mutation({
1311
- args: {
1312
- creatorId: v.id("entities"),
1313
- type: v.union(
1314
- v.literal("blog_post"),
1315
- v.literal("video"),
1316
- v.literal("podcast"),
1317
- v.literal("social_post"),
1318
- v.literal("course"),
1319
- v.literal("digital_product")
1320
- ),
1321
- name: v.string(),
1322
- properties: v.any(), // Type-specific properties
1323
- tags: v.optional(v.array(v.string())),
1324
- collaborators: v.optional(
1325
- v.array(
1326
- v.object({
1327
- entityId: v.id("entities"),
1328
- revenueShare: v.number(), // 0.0 to 1.0
1329
- })
1330
- )
1331
- ),
1332
- },
1333
- handler: async (ctx, args) => {
1334
- // Validate creator exists
1335
- const creator = await ctx.db.get(args.creatorId);
1336
- if (!creator || creator.type !== "creator") {
1337
- throw new Error("Creator not found");
1338
- }
1339
-
1340
- // Create content entity
1341
- const contentId = await ctx.db.insert("entities", {
1342
- type: args.type,
1343
- name: args.name,
1344
- properties: args.properties,
1345
- status: "draft",
1346
- createdAt: Date.now(),
1347
- updatedAt: Date.now(),
1348
- });
1349
-
1350
- // Create ownership connection (creator owns content)
1351
- await ctx.db.insert("connections", {
1352
- fromEntityId: args.creatorId,
1353
- toEntityId: contentId,
1354
- relationshipType: "owns",
1355
- metadata: { revenueShare: 1.0 }, // Creator gets 100% initially
1356
- createdAt: Date.now(),
1357
- });
1358
-
1359
- // Create authored connection
1360
- await ctx.db.insert("connections", {
1361
- fromEntityId: args.creatorId,
1362
- toEntityId: contentId,
1363
- relationshipType: "authored",
1364
- createdAt: Date.now(),
1365
- });
1366
-
1367
- // Add collaborators with revenue splits
1368
- if (args.collaborators) {
1369
- for (const collab of args.collaborators) {
1370
- await ctx.db.insert("connections", {
1371
- fromEntityId: collab.entityId,
1372
- toEntityId: contentId,
1373
- relationshipType: "owns",
1374
- metadata: { revenueShare: collab.revenueShare },
1375
- createdAt: Date.now(),
1376
- });
1377
- }
1378
- }
1379
-
1380
- // Add tags
1381
- if (args.tags) {
1382
- for (const tagName of args.tags) {
1383
- // Get or create tag
1384
- let tag = await ctx.db
1385
- .query("tags")
1386
- .withIndex("by_name", (q) => q.eq("name", tagName))
1387
- .unique();
1388
-
1389
- if (!tag) {
1390
- const tagId = await ctx.db.insert("tags", {
1391
- name: tagName,
1392
- category: "topic",
1393
- usageCount: 0,
1394
- createdAt: Date.now(),
1395
- });
1396
- tag = await ctx.db.get(tagId);
1397
- }
1398
-
1399
- // Create entity-tag association
1400
- await ctx.db.insert("entityTags", {
1401
- entityId: contentId,
1402
- tagId: tag!._id,
1403
- createdAt: Date.now(),
1404
- });
1405
-
1406
- // Increment tag usage count
1407
- await ctx.db.patch(tag!._id, {
1408
- usageCount: tag!.usageCount + 1,
1409
- });
1410
- }
1411
- }
1412
-
1413
- // Log entity creation event with content-specific metadata
1414
- await ctx.db.insert("events", {
1415
- entityId: contentId,
1416
- eventType: "entity_created",
1417
- timestamp: Date.now(),
1418
- actorType: "user",
1419
- actorId: args.creatorId,
1420
- metadata: {
1421
- entityType: args.type,
1422
- collaboratorCount: args.collaborators?.length || 0,
1423
- tagCount: args.tags?.length || 0,
1424
- },
1425
- });
1426
-
1427
- return { contentId, success: true };
1428
- },
1429
- });
1430
- ```
1431
-
1432
- **Frontend**: Multi-step wizard with file upload, collaborator management, tag selection, and license controls
1433
-
1434
- ---
1435
-
1436
- ### Week 4: Semantic Search Implementation
1437
-
1438
- **Hybrid Search: Vector Similarity + Keyword Matching using ontology entities table**
1439
-
1440
- #### Vector Embeddings
1441
-
1442
- **File**: `convex/embeddings/generate.ts`
1443
-
1444
- ```typescript
1445
- "use node";
1446
- import { v } from "convex/values";
1447
- import { internalAction } from "./_generated/server";
1448
- import { internal } from "./_generated/api";
1449
- import OpenAI from "openai";
1450
-
1451
- const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
1452
-
1453
- export const generateEntityEmbedding = internalAction({
1454
- args: { entityId: v.id("entities") },
1455
- handler: async (ctx, args) => {
1456
- // Get entity
1457
- const entity = await ctx.runQuery(internal.entities.get, {
1458
- id: args.entityId,
1459
- });
1460
-
1461
- if (!entity) {
1462
- throw new Error("Entity not found");
1463
- }
1464
-
1465
- // Create searchable text from entity
1466
- const text = `${entity.name}\n${entity.properties?.description || ""}\n${
1467
- entity.properties?.content || ""
1468
- }`;
1469
-
1470
- // Generate embedding
1471
- const response = await openai.embeddings.create({
1472
- model: "text-embedding-3-small",
1473
- input: text,
1474
- dimensions: 1536,
1475
- });
1476
-
1477
- // Save embedding
1478
- await ctx.runMutation(internal.embeddings.save, {
1479
- entityId: args.entityId,
1480
- embedding: response.data[0].embedding,
1481
- model: "text-embedding-3-small",
1482
- });
1483
-
1484
- return { success: true };
1485
- },
1486
- });
1487
- ```
1488
-
1489
- **File**: `convex/embeddings/save.ts`
1490
-
1491
- ```typescript
1492
- import { v } from "convex/values";
1493
- import { internalMutation } from "./_generated/server";
1494
-
1495
- export const save = internalMutation({
1496
- args: {
1497
- entityId: v.id("entities"),
1498
- embedding: v.array(v.float64()),
1499
- model: v.string(),
1500
- },
1501
- handler: async (ctx, args) => {
1502
- // Check if embedding exists
1503
- const existing = await ctx.db
1504
- .query("embeddings")
1505
- .withIndex("by_entity", (q) => q.eq("entityId", args.entityId))
1506
- .unique();
1507
-
1508
- if (existing) {
1509
- // Update existing
1510
- await ctx.db.patch(existing._id, {
1511
- embedding: args.embedding,
1512
- model: args.model,
1513
- createdAt: Date.now(),
1514
- });
1515
- } else {
1516
- // Create new
1517
- await ctx.db.insert("embeddings", {
1518
- entityId: args.entityId,
1519
- embedding: args.embedding,
1520
- model: args.model,
1521
- createdAt: Date.now(),
1522
- });
1523
- }
1524
-
1525
- return { success: true };
1526
- },
1527
- });
1528
- ```
1529
-
1530
- #### Semantic Search Query
1531
-
1532
- **File**: `convex/search/semantic.ts`
1533
-
1534
- ```typescript
1535
- "use node";
1536
- import { v } from "convex/values";
1537
- import { action } from "./_generated/server";
1538
- import { internal } from "./_generated/api";
1539
- import OpenAI from "openai";
1540
-
1541
- const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
1542
-
1543
- export const semanticSearch = action({
1544
- args: {
1545
- query: v.string(),
1546
- entityTypes: v.optional(v.array(v.string())),
1547
- limit: v.optional(v.number()),
1548
- },
1549
- handler: async (ctx, args) => {
1550
- // Generate query embedding
1551
- const response = await openai.embeddings.create({
1552
- model: "text-embedding-3-small",
1553
- input: args.query,
1554
- dimensions: 1536,
1555
- });
1556
-
1557
- const queryEmbedding = response.data[0].embedding;
1558
-
1559
- // Vector search on embeddings table
1560
- const results = await ctx.vectorSearch("embeddings", "by_embedding", {
1561
- vector: queryEmbedding,
1562
- limit: args.limit || 20,
1563
- });
1564
-
1565
- // Hydrate entities and filter by type if specified
1566
- const entities = await Promise.all(
1567
- results.map(async (r) => {
1568
- const entity = await ctx.runQuery(internal.entities.get, {
1569
- id: r._id,
1570
- });
1571
- return { entity, score: r._score };
1572
- })
1573
- );
1574
-
1575
- // Filter by entity type if specified
1576
- const filtered = args.entityTypes
1577
- ? entities.filter((e) => args.entityTypes!.includes(e.entity?.type || ""))
1578
- : entities;
1579
-
1580
- return filtered.map((e) => e.entity);
1581
- },
1582
- });
1583
-
1584
- // Hybrid search combining vector similarity and keyword matching
1585
- export const hybridSearch = action({
1586
- args: {
1587
- query: v.string(),
1588
- entityTypes: v.optional(v.array(v.string())),
1589
- limit: v.optional(v.number()),
1590
- },
1591
- handler: async (ctx, args) => {
1592
- // Run semantic search
1593
- const semanticResults = await ctx.runAction(internal.search.semanticSearch, {
1594
- query: args.query,
1595
- entityTypes: args.entityTypes,
1596
- limit: args.limit,
1597
- });
1598
-
1599
- // Run keyword search using search index
1600
- const keywordResults = await ctx.runQuery(internal.search.keywordSearch, {
1601
- query: args.query,
1602
- entityTypes: args.entityTypes,
1603
- limit: args.limit,
1604
- });
1605
-
1606
- // Combine and deduplicate results
1607
- const combined = new Map();
1608
- semanticResults.forEach((entity) => combined.set(entity._id, entity));
1609
- keywordResults.forEach((entity) => combined.set(entity._id, entity));
1610
-
1611
- return Array.from(combined.values());
1612
- },
1613
- });
1614
- ```
1615
-
1616
- **Search UI**: Real-time results with filters (entity type, tags, status), debounced input, instant previews.
1617
-
1618
- **Success Criteria**: ✅ Semantic search returns relevant results, ✅ Sub-300ms response time, ✅ Works for all entity types
1619
-
1620
- ---
1621
-
1622
- ## Phase 3: Viral Growth & ELEVATE (Weeks 5-6)
1623
-
1624
- ### Week 5: ELEVATE Journey System
1625
-
1626
- **9-Step Candy Crush-Style Progress System**
1627
-
1628
- #### Journey Steps (ELEVATE Framework)
1629
-
1630
- 1. **Hook** - Capture attention with free AI business analysis
1631
- 2. **Gift** - Provide immediate value (insights report)
1632
- 3. **Identify** - Payment gate ($100) - qualify serious users
1633
- 4. **Engage** - Interactive workshops and tools
1634
- 5. **Sell** - Core product/service delivery
1635
- 6. **Nurture** - Ongoing support and resources
1636
- 7. **Upsell** - Premium features and services
1637
- 8. **Understand** - Analytics and optimization
1638
- 9. **Share** - Referral rewards and viral loop
1639
-
1640
- #### Workflow Implementation
1641
-
1642
- **File**: `convex/elevate/journey.ts`
1643
-
1644
- ```typescript
1645
- import { WorkflowManager } from "@convex-dev/workflow";
1646
-
1647
- const workflow = new WorkflowManager(components.workflow);
1648
-
1649
- export const elevateJourney = workflow.define({
1650
- defaultRetryBehavior: { maxAttempts: 3, initialBackoffMs: 1000 }
1651
- }, async (ctx, { userId, journeyId }) => {
1652
-
1653
- // Step 1: Hook - Generate AI analysis
1654
- await ctx.step("hook", async () => {
1655
- const analysis = await ctx.runAction(internal.ai.generateBusinessAnalysis, {
1656
- userId,
1657
- });
1658
- await ctx.runMutation(internal.elevate.saveStep, {
1659
- userId,
1660
- stepId: "hook",
1661
- status: "completed",
1662
- output: analysis,
1663
- });
1664
- });
1665
-
1666
- // Wait for user to review (24 hours)
1667
- await ctx.wait(24 * 60 * 60 * 1000);
1668
-
1669
- // Step 2: Gift - Deliver insights
1670
- await ctx.step("gift", async () => {
1671
- await ctx.runMutation(internal.notifications.sendInsightsReport, { userId });
1672
- });
1673
-
1674
- // Step 3: Identify - Payment gate
1675
- await ctx.step("identify", async () => {
1676
- const paid = await waitForPayment(ctx, userId, 100);
1677
- if (!paid) {
1678
- throw new Error("Payment not completed");
1679
- }
1680
- });
1681
-
1682
- // Continue remaining steps...
1683
-
1684
- return { completed: true };
1685
- });
1686
- ```
1687
-
1688
- #### Visual Journey UI
1689
-
1690
- **File**: `src/components/features/elevate/JourneyMap.tsx`
1691
-
1692
- **Features**:
1693
-
1694
- - SVG path visualization (Candy Crush style)
1695
- - Step nodes with lock/unlock states
1696
- - Star ratings (1-3 per step)
1697
- - Progress percentage
1698
- - Achievement badges
1699
- - Animated transitions
1700
-
1701
- **Pattern**:
1702
-
1703
- ```typescript
1704
- <svg viewBox="0 0 800 600">
1705
- <path d="M 100,300 Q 200,100 400,300 T 700,300" />
1706
- {steps.map((step, i) => (
1707
- <g key={step.id}>
1708
- <circle
1709
- cx={positions[i].x}
1710
- cy={positions[i].y}
1711
- r="30"
1712
- className={step.status === 'completed' ? 'fill-green' : 'fill-gray'}
1713
- />
1714
- <text>{step.name}</text>
1715
- </g>
1716
- ))}
1717
- </svg>
1718
- ```
1719
-
1720
- **Payment Gate**: Integrated Stripe checkout modal at "Identify" step.
1721
-
1722
- **Success Criteria**: ✅ All 9 steps functional, ✅ Payment gate works, ✅ Progress persists, ✅ Workflows resume after restart
1723
-
1724
- ---
1725
-
1726
- ### Week 6: Viral Invitation System
1727
-
1728
- **Magic Links + Referral Tracking**
1729
-
1730
- #### Magic Link Generation
1731
-
1732
- **File**: `convex/invitations/magicLinks.ts`
1733
-
1734
- ```typescript
1735
- export const generateMagicLink = mutation({
1736
- args: {
1737
- email: v.string(),
1738
- referralCode: v.string(),
1739
- },
1740
- handler: async (ctx, args) => {
1741
- const token = crypto.randomBytes(32).toString("base64url");
1742
-
1743
- await ctx.db.insert("events", {
1744
- eventType: "invitation_created",
1745
- timestamp: Date.now(),
1746
- metadata: {
1747
- email: args.email,
1748
- token,
1749
- referralCode: args.referralCode,
1750
- expiresAt: Date.now() + (60 * 60 * 1000), // 1 hour
1751
- },
1752
- });
1753
-
1754
- return `https://one.ie/invite/${token}`;
1755
- },
1756
- });
1757
- ```
1758
-
1759
- #### Auto-Registration Flow
1760
-
1761
- **File**: `src/pages/invite/[token].astro`
1762
-
1763
- ```typescript
1764
- // Server-side validation
1765
- const { token } = Astro.params;
1766
- const invitation = await convex.query(api.invitations.verify, { token });
1767
-
1768
- if (invitation.valid) {
1769
- // Auto-register user
1770
- const userId = await convex.mutation(api.auth.autoRegister, {
1771
- email: invitation.email,
1772
- referredBy: invitation.referralCode,
1773
- });
1774
-
1775
- // Create session and redirect
1776
- return Astro.redirect("/dashboard");
1777
- }
1778
- ```
1779
-
1780
- #### Referral Tracking
1781
-
1782
- **Schema**: Track referrer → referred → conversion pipeline
1783
-
1784
- **Commission Model**:
1785
-
1786
- - 10% of referred user's first transaction
1787
- - Tiered bonuses (5 referrals = $50 bonus, 25 = $500)
1788
- - Lifetime tracking with attribution
1789
-
1790
- **Bulk Invitations**: Queue-based processing for 100+ invitations with personalized messages.
1791
-
1792
- **Success Criteria**: ✅ Magic links work reliably, ✅ Auto-registration smooth, ✅ Referral commissions accurate, ✅ K-factor > 1
1793
-
1794
- ---
1795
-
1796
- ## Phase 4: Scale & Production Readiness (Weeks 7-8)
1797
-
1798
- ### Week 7: AI Agent Marketplace
1799
-
1800
- **10 Business Agent Types from Ontology (strategy, research, marketing, sales, service, design, engineering, finance, legal, intelligence)**
1801
-
1802
- #### Agent Registry
1803
-
1804
- **File**: `convex/agents/register.ts`
1805
-
1806
- ```typescript
1807
- import { v } from "convex/values";
1808
- import { mutation } from "./_generated/server";
1809
-
1810
- export const registerAgent = mutation({
1811
- args: {
1812
- creatorId: v.id("entities"),
1813
- agentType: v.union(
1814
- v.literal("strategy_agent"),
1815
- v.literal("research_agent"),
1816
- v.literal("marketing_agent"),
1817
- v.literal("sales_agent"),
1818
- v.literal("service_agent"),
1819
- v.literal("design_agent"),
1820
- v.literal("engineering_agent"),
1821
- v.literal("finance_agent"),
1822
- v.literal("legal_agent"),
1823
- v.literal("intelligence_agent")
1824
- ),
1825
- name: v.string(),
1826
- description: v.string(),
1827
- capabilities: v.array(v.string()),
1828
- systemPrompt: v.string(),
1829
- pricingModel: v.union(
1830
- v.literal("per_request"),
1831
- v.literal("token_based"),
1832
- v.literal("subscription")
1833
- ),
1834
- basePrice: v.number(),
1835
- tags: v.optional(v.array(v.string())),
1836
- },
1837
- handler: async (ctx, args) => {
1838
- // Validate creator exists
1839
- const creator = await ctx.db.get(args.creatorId);
1840
- if (!creator || creator.type !== "creator") {
1841
- throw new Error("Creator not found");
1842
- }
1843
-
1844
- // Create agent entity
1845
- const agentId = await ctx.db.insert("entities", {
1846
- type: args.agentType,
1847
- name: args.name,
1848
- properties: {
1849
- description: args.description,
1850
- capabilities: args.capabilities,
1851
- systemPrompt: args.systemPrompt,
1852
- model: "gpt-4-turbo",
1853
- temperature: 0.7,
1854
- pricingModel: args.pricingModel,
1855
- basePrice: args.basePrice,
1856
- totalExecutions: 0,
1857
- successRate: 0,
1858
- averageExecutionTime: 0,
1859
- },
1860
- status: "active",
1861
- createdAt: Date.now(),
1862
- updatedAt: Date.now(),
1863
- });
1864
-
1865
- // Create ownership connection
1866
- await ctx.db.insert("connections", {
1867
- fromEntityId: args.creatorId,
1868
- toEntityId: agentId,
1869
- relationshipType: "owns",
1870
- metadata: { revenueShare: 1.0 },
1871
- createdAt: Date.now(),
1872
- });
1873
-
1874
- // Add tags
1875
- if (args.tags) {
1876
- for (const tagName of args.tags) {
1877
- let tag = await ctx.db
1878
- .query("tags")
1879
- .withIndex("by_name", (q) => q.eq("name", tagName))
1880
- .unique();
1881
-
1882
- if (!tag) {
1883
- const tagId = await ctx.db.insert("tags", {
1884
- name: tagName,
1885
- category: "technology",
1886
- usageCount: 0,
1887
- createdAt: Date.now(),
1888
- });
1889
- tag = await ctx.db.get(tagId);
1890
- }
1891
-
1892
- await ctx.db.insert("entityTags", {
1893
- entityId: agentId,
1894
- tagId: tag!._id,
1895
- createdAt: Date.now(),
1896
- });
1897
-
1898
- await ctx.db.patch(tag!._id, {
1899
- usageCount: tag!.usageCount + 1,
1900
- });
1901
- }
1902
- }
1903
-
1904
- // Log entity creation event with agent-specific metadata
1905
- await ctx.db.insert("events", {
1906
- entityId: agentId,
1907
- eventType: "entity_created",
1908
- timestamp: Date.now(),
1909
- actorType: "user",
1910
- actorId: args.creatorId,
1911
- metadata: {
1912
- entityType: args.agentType,
1913
- pricingModel: args.pricingModel,
1914
- basePrice: args.basePrice,
1915
- capabilities: args.capabilities,
1916
- },
1917
- });
1918
-
1919
- return { agentId, success: true };
1920
- },
1921
- });
1922
- ```
1923
-
1924
- #### Agent Execution
1925
-
1926
- **File**: `convex/agents/execute.ts`
1927
-
1928
- ```typescript
1929
- "use node";
1930
- import { v } from "convex/values";
1931
- import { action } from "./_generated/server";
1932
- import { internal } from "./_generated/api";
1933
- import OpenAI from "openai";
1934
-
1935
- const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
1936
-
1937
- export const invokeAgent = action({
1938
- args: {
1939
- agentId: v.id("entities"),
1940
- userId: v.id("entities"),
1941
- message: v.string(),
1942
- },
1943
- handler: async (ctx, args) => {
1944
- const startTime = Date.now();
1945
-
1946
- // Get agent configuration
1947
- const agent = await ctx.runQuery(internal.agents.get, {
1948
- id: args.agentId,
1949
- });
1950
-
1951
- if (!agent || !agent.type.endsWith("_agent")) {
1952
- throw new Error("Agent not found");
1953
- }
1954
-
1955
- // Execute agent with OpenAI
1956
- const response = await openai.chat.completions.create({
1957
- model: agent.properties.model || "gpt-4-turbo",
1958
- messages: [
1959
- { role: "system", content: agent.properties.systemPrompt },
1960
- { role: "user", content: args.message },
1961
- ],
1962
- temperature: agent.properties.temperature || 0.7,
1963
- });
1964
-
1965
- const executionTime = Date.now() - startTime;
1966
- const aiResponse = response.choices[0].message.content || "";
1967
-
1968
- // Track invocation (update metrics)
1969
- await ctx.runMutation(internal.agents.trackInvocation, {
1970
- agentId: args.agentId,
1971
- executionTime,
1972
- success: true,
1973
- });
1974
-
1975
- // Log agent execution event with success status in metadata
1976
- await ctx.runMutation(internal.events.create, {
1977
- entityId: args.agentId,
1978
- eventType: "agent_executed",
1979
- actorType: "user",
1980
- actorId: args.userId,
1981
- metadata: {
1982
- status: "success",
1983
- message: args.message,
1984
- response: aiResponse,
1985
- executionTime,
1986
- tokensUsed: response.usage?.total_tokens || 0,
1987
- },
1988
- });
1989
-
1990
- return {
1991
- response: aiResponse,
1992
- executionTime,
1993
- tokensUsed: response.usage?.total_tokens || 0,
1994
- };
1995
- },
1996
- });
1997
- ```
1998
-
1999
- **File**: `convex/agents/trackInvocation.ts`
2000
-
2001
- ```typescript
2002
- import { v } from "convex/values";
2003
- import { internalMutation } from "./_generated/server";
2004
-
2005
- export const trackInvocation = internalMutation({
2006
- args: {
2007
- agentId: v.id("entities"),
2008
- executionTime: v.number(),
2009
- success: v.boolean(),
2010
- },
2011
- handler: async (ctx, args) => {
2012
- const agent = await ctx.db.get(args.agentId);
2013
- if (!agent) return;
2014
-
2015
- const totalExecutions = agent.properties.totalExecutions || 0;
2016
- const successRate = agent.properties.successRate || 0;
2017
- const avgExecTime = agent.properties.averageExecutionTime || 0;
2018
-
2019
- // Update metrics
2020
- const newTotalExecutions = totalExecutions + 1;
2021
- const newSuccessRate =
2022
- (successRate * totalExecutions + (args.success ? 1 : 0)) / newTotalExecutions;
2023
- const newAvgExecTime =
2024
- (avgExecTime * totalExecutions + args.executionTime) / newTotalExecutions;
2025
-
2026
- await ctx.db.patch(args.agentId, {
2027
- properties: {
2028
- ...agent.properties,
2029
- totalExecutions: newTotalExecutions,
2030
- successRate: newSuccessRate,
2031
- averageExecutionTime: newAvgExecTime,
2032
- },
2033
- updatedAt: Date.now(),
2034
- });
2035
- },
2036
- });
2037
- ```
2038
-
2039
- #### Agent Marketplace UI
2040
-
2041
- **File**: `src/components/features/agents/AgentMarketplace.tsx`
2042
-
2043
- **Features**:
2044
-
2045
- - Browse by category/capability
2046
- - Try before you buy (free tier)
2047
- - Usage-based billing
2048
- - Rating and review system
2049
- - Agent-to-agent delegation
2050
-
2051
- **Success Criteria**: ✅ Agents execute reliably, ✅ Billing tracks usage accurately, ✅ UI responsive and intuitive
2052
-
2053
- ---
2054
-
2055
- ### Week 8: Analytics & Optimization
2056
-
2057
- **Dashboard for Revenue, Engagement, and Performance Metrics**
2058
-
2059
- #### Analytics Implementation
2060
-
2061
- **File**: `convex/analytics/dashboards.ts`
2062
-
2063
- ```typescript
2064
- export const getRevenueMetrics = query({
2065
- args: { timeRange: v.string() },
2066
- handler: async (ctx, args) => {
2067
- // Query consolidated payment events
2068
- const payments = await ctx.db
2069
- .query("events")
2070
- .withIndex("by_type_time", (q) =>
2071
- q.eq("eventType", "payment_processed")
2072
- .gte("timestamp", getTimeRangeStart(args.timeRange))
2073
- )
2074
- .collect();
2075
-
2076
- // Filter to completed payments only using metadata
2077
- const completedPayments = payments.filter(
2078
- (p) => p.metadata?.status === "completed"
2079
- );
2080
-
2081
- const totalRevenue = completedPayments.reduce(
2082
- (sum, p) => sum + (p.metadata?.amount || 0),
2083
- 0
2084
- );
2085
-
2086
- const platformFees = completedPayments.reduce(
2087
- (sum, p) => sum + (p.metadata?.platformFee || 0),
2088
- 0
2089
- );
2090
-
2091
- return {
2092
- totalRevenue,
2093
- platformFees,
2094
- transactionCount: completedPayments.length,
2095
- averageOrderValue: totalRevenue / completedPayments.length || 0,
2096
- statusBreakdown: {
2097
- initiated: payments.filter((p) => p.metadata?.status === "initiated").length,
2098
- completed: completedPayments.length,
2099
- failed: payments.filter((p) => p.metadata?.status === "failed").length,
2100
- refunded: payments.filter((p) => p.metadata?.status === "refunded").length,
2101
- },
2102
- };
2103
- },
2104
- });
2105
-
2106
- export const getElevateAnalytics = query({
2107
- args: {},
2108
- handler: async (ctx) => {
2109
- // Query progress_updated events for journey tracking
2110
- const progressEvents = await ctx.db
2111
- .query("events")
2112
- .withIndex("by_eventType", (q) => q.eq("eventType", "progress_updated"))
2113
- .filter((q) => q.eq(q.field("metadata.journeyType"), "elevate"))
2114
- .collect();
2115
-
2116
- // Calculate step completion rates using metadata
2117
- const stepCounts = {};
2118
- progressEvents.forEach((event) => {
2119
- const step = event.metadata?.stepId;
2120
- if (step) {
2121
- stepCounts[step] = (stepCounts[step] || 0) + 1;
2122
- }
2123
- });
2124
-
2125
- return {
2126
- totalJourneys: new Set(progressEvents.map((e) => e.actorId)).size,
2127
- stepCompletionRates: stepCounts,
2128
- conversionRate: (stepCounts["share"] || 0) / (stepCounts["hook"] || 1),
2129
- };
2130
- },
2131
- });
2132
- ```
2133
-
2134
- #### Analytics Dashboard UI
2135
-
2136
- **File**: `src/pages/analytics/index.astro`
2137
-
2138
- **Charts**:
2139
-
2140
- - Revenue over time (line chart)
2141
- - Transaction volume (bar chart)
2142
- - ELEVATE funnel (funnel chart)
2143
- - Top-performing blocks (table)
2144
- - User engagement heatmap
2145
- - Real-time activity feed
2146
-
2147
- **Libraries**: Recharts for React components, TailwindCSS for styling.
2148
-
2149
- **Success Criteria**: ✅ All metrics accurate, ✅ Real-time updates, ✅ Export functionality, ✅ Sub-second load times
2150
-
2151
- ---
2152
-
2153
- ## Effect.ts Service Layer Integration
2154
-
2155
- **Production-Grade Error Handling & Dependency Injection**
2156
-
2157
- ### Typed Error Channels
2158
-
2159
- **Purpose**: All errors are typed and explicit - no silent failures or generic error handling.
2160
-
2161
- ```typescript
2162
- import { Effect, Data } from "effect";
2163
-
2164
- // Define typed error classes
2165
- class ValidationError extends Data.TaggedError("ValidationError")<{
2166
- field: string;
2167
- message: string;
2168
- }> {}
2169
-
2170
- class DatabaseError extends Data.TaggedError("DatabaseError")<{
2171
- operation: string;
2172
- cause: unknown;
2173
- }> {}
2174
-
2175
- class ExternalServiceError extends Data.TaggedError("ExternalServiceError")<{
2176
- service: string;
2177
- statusCode?: number;
2178
- message: string;
2179
- }> {}
2180
-
2181
- class NotFoundError extends Data.TaggedError("NotFoundError")<{
2182
- entityType: string;
2183
- entityId: string;
2184
- }> {}
2185
- ```
2186
-
2187
- ### Service Layer Architecture
2188
-
2189
- **File**: `convex/services/entities.ts`
2190
-
2191
- ```typescript
2192
- import { Effect, Layer, Context } from "effect";
2193
- import { v } from "convex/values";
2194
-
2195
- // Define service interface with typed errors
2196
- class EntityService extends Context.Tag("EntityService")<
2197
- EntityService,
2198
- {
2199
- create: (data: EntityCreateData) => Effect.Effect<
2200
- string, // Success type: entity ID
2201
- ValidationError | DatabaseError // Error types
2202
- >;
2203
- get: (id: string) => Effect.Effect<
2204
- Entity,
2205
- NotFoundError | DatabaseError
2206
- >;
2207
- update: (id: string, data: Partial<Entity>) => Effect.Effect<
2208
- void,
2209
- NotFoundError | ValidationError | DatabaseError
2210
- >;
2211
- search: (query: string) => Effect.Effect<
2212
- Entity[],
2213
- ExternalServiceError | DatabaseError
2214
- >;
2215
- }
2216
- >() {}
2217
-
2218
- // Implementation
2219
- const EntityServiceLive = Layer.effect(
2220
- EntityService,
2221
- Effect.gen(function* () {
2222
- const db = yield* DatabaseService;
2223
- const embeddings = yield* EmbeddingService;
2224
-
2225
- return {
2226
- create: (data: EntityCreateData) =>
2227
- Effect.gen(function* () {
2228
- // Validation with typed error
2229
- if (!data.name || data.name.trim().length === 0) {
2230
- return yield* Effect.fail(
2231
- new ValidationError({
2232
- field: "name",
2233
- message: "Name is required and cannot be empty",
2234
- })
2235
- );
2236
- }
2237
-
2238
- if (!data.type) {
2239
- return yield* Effect.fail(
2240
- new ValidationError({
2241
- field: "type",
2242
- message: "Entity type is required",
2243
- })
2244
- );
2245
- }
2246
-
2247
- // Create entity with error handling
2248
- const entityId = yield* Effect.tryPromise({
2249
- try: () =>
2250
- db.insert("entities", {
2251
- type: data.type,
2252
- name: data.name,
2253
- properties: data.properties || {},
2254
- status: data.status || "active",
2255
- createdAt: Date.now(),
2256
- updatedAt: Date.now(),
2257
- }),
2258
- catch: (error) =>
2259
- new DatabaseError({
2260
- operation: "insert",
2261
- cause: error,
2262
- }),
2263
- });
2264
-
2265
- // Generate embedding asynchronously (errors logged but don't fail creation)
2266
- yield* embeddings
2267
- .generate(entityId)
2268
- .pipe(
2269
- Effect.catchAll((error) =>
2270
- Effect.logWarning(`Failed to generate embedding: ${error}`)
2271
- )
2272
- );
2273
-
2274
- return entityId;
2275
- }),
2276
-
2277
- get: (id: string) =>
2278
- Effect.gen(function* () {
2279
- const entity = yield* Effect.tryPromise({
2280
- try: () => db.get(id),
2281
- catch: (error) =>
2282
- new DatabaseError({
2283
- operation: "get",
2284
- cause: error,
2285
- }),
2286
- });
2287
-
2288
- if (!entity) {
2289
- return yield* Effect.fail(
2290
- new NotFoundError({
2291
- entityType: "entity",
2292
- entityId: id,
2293
- })
2294
- );
2295
- }
2296
-
2297
- return entity;
2298
- }),
2299
-
2300
- update: (id: string, data: Partial<Entity>) =>
2301
- Effect.gen(function* () {
2302
- // Check entity exists
2303
- yield* Effect.get(id);
2304
-
2305
- // Validation
2306
- if (data.name !== undefined && data.name.trim().length === 0) {
2307
- return yield* Effect.fail(
2308
- new ValidationError({
2309
- field: "name",
2310
- message: "Name cannot be empty",
2311
- })
2312
- );
2313
- }
2314
-
2315
- // Update entity
2316
- yield* Effect.tryPromise({
2317
- try: () =>
2318
- db.patch(id, {
2319
- ...data,
2320
- updatedAt: Date.now(),
2321
- }),
2322
- catch: (error) =>
2323
- new DatabaseError({
2324
- operation: "update",
2325
- cause: error,
2326
- }),
2327
- });
2328
- }),
2329
-
2330
- search: (query: string) =>
2331
- Effect.gen(function* () {
2332
- // Generate query embedding
2333
- const embedding = yield* embeddings
2334
- .generateQuery(query)
2335
- .pipe(
2336
- Effect.mapError(
2337
- (error) =>
2338
- new ExternalServiceError({
2339
- service: "OpenAI",
2340
- message: `Failed to generate embedding: ${error}`,
2341
- })
2342
- )
2343
- );
2344
-
2345
- // Vector search
2346
- const results = yield* Effect.tryPromise({
2347
- try: () => db.vectorSearch("embeddings", { vector: embedding }),
2348
- catch: (error) =>
2349
- new DatabaseError({
2350
- operation: "vectorSearch",
2351
- cause: error,
2352
- }),
2353
- });
2354
-
2355
- return results;
2356
- }),
2357
- };
2358
- })
2359
- );
2360
- ```
2361
-
2362
- ### Usage in Convex Functions
2363
-
2364
- **File**: `convex/entities/create.ts`
2365
-
2366
- ```typescript
2367
- import { mutation } from "./_generated/server";
2368
- import { v } from "convex/values";
2369
- import { Effect } from "effect";
2370
- import { EntityService, ValidationError, DatabaseError } from "../services/entities";
2371
- import { MainLayer } from "../services/layers";
2372
-
2373
- export const createEntity = mutation({
2374
- args: {
2375
- type: v.string(),
2376
- name: v.string(),
2377
- properties: v.optional(v.any()),
2378
- },
2379
- handler: async (ctx, args) => {
2380
- const program = Effect.gen(function* () {
2381
- const service = yield* EntityService;
2382
- return yield* service.create({
2383
- type: args.type,
2384
- name: args.name,
2385
- properties: args.properties,
2386
- });
2387
- });
2388
-
2389
- // Run program with explicit error handling
2390
- const result = await Effect.runPromise(
2391
- program.pipe(
2392
- Effect.provide(MainLayer),
2393
- Effect.catchTags({
2394
- ValidationError: (error) =>
2395
- Effect.succeed({
2396
- success: false,
2397
- error: "validation",
2398
- field: error.field,
2399
- message: error.message,
2400
- }),
2401
- DatabaseError: (error) =>
2402
- Effect.succeed({
2403
- success: false,
2404
- error: "database",
2405
- message: "Failed to create entity",
2406
- }),
2407
- }),
2408
- Effect.map((entityId) => ({
2409
- success: true,
2410
- entityId,
2411
- }))
2412
- )
2413
- );
2414
-
2415
- return result;
2416
- },
2417
- });
2418
- ```
2419
-
2420
- ### Testing with Mocked Services
2421
-
2422
- **File**: `convex/services/entities.test.ts`
2423
-
2424
- ```typescript
2425
- import { Effect, Layer } from "effect";
2426
- import { EntityService, ValidationError } from "./entities";
2427
-
2428
- const MockEntityService = Layer.succeed(EntityService, {
2429
- create: () => Effect.succeed("mock-entity-id"),
2430
- get: () => Effect.succeed({ _id: "mock-id", name: "Mock Entity" }),
2431
- update: () => Effect.succeed(undefined),
2432
- search: () => Effect.succeed([]),
2433
- });
2434
-
2435
- describe("EntityService", () => {
2436
- test("creates entity successfully", async () => {
2437
- const program = Effect.gen(function* () {
2438
- const service = yield* EntityService;
2439
- return yield* service.create({
2440
- type: "creator",
2441
- name: "Test Creator",
2442
- });
2443
- });
2444
-
2445
- const result = await Effect.runPromise(
2446
- program.pipe(Effect.provide(MockEntityService))
2447
- );
2448
-
2449
- expect(result).toBe("mock-entity-id");
2450
- });
2451
-
2452
- test("validates required fields", async () => {
2453
- const program = Effect.gen(function* () {
2454
- const service = yield* EntityService;
2455
- return yield* service.create({
2456
- type: "creator",
2457
- name: "", // Invalid
2458
- });
2459
- });
2460
-
2461
- const result = await Effect.runPromiseExit(
2462
- program.pipe(Effect.provide(MockEntityService))
2463
- );
2464
-
2465
- if (Effect.isFailure(result)) {
2466
- expect(result.cause._tag).toBe("ValidationError");
2467
- }
2468
- });
2469
- });
2470
- ```
2471
-
2472
- **Benefits of Effect.ts Pattern**:
2473
-
2474
- - **Typed error channels**: Every error is explicit in the type signature
2475
- - **No silent failures**: Impossible to ignore errors
2476
- - **Automatic dependency injection**: Services compose cleanly
2477
- - **Testable**: Mock any dependency with `Layer.succeed`
2478
- - **Composable**: Chain operations with `Effect.gen`
2479
- - **Full observability**: Built-in logging and tracing
2480
- - **Retry logic**: Built-in retry with backoff
2481
- - **Concurrent operations**: Safe parallel execution with `Effect.all`
2482
-
2483
- ### Advanced Pattern: Atomic Operations with Rollback
2484
-
2485
- ```typescript
2486
- export const createContentWithOwnership = Effect.gen(function* () {
2487
- const entities = yield* EntityService;
2488
- const connections = yield* ConnectionService;
2489
- const events = yield* EventService;
2490
-
2491
- // All operations or none (atomic)
2492
- const contentId = yield* entities.create({
2493
- type: "blog_post",
2494
- name: "My Post",
2495
- });
2496
-
2497
- yield* connections.create({
2498
- fromEntityId: creatorId,
2499
- toEntityId: contentId,
2500
- relationshipType: "owns",
2501
- });
2502
-
2503
- yield* events.log({
2504
- entityId: contentId,
2505
- eventType: "entity_created",
2506
- metadata: { entityType: "blog_post" },
2507
- });
2508
-
2509
- return contentId;
2510
- }).pipe(
2511
- Effect.catchAll((error) =>
2512
- Effect.gen(function* () {
2513
- // Rollback logic here
2514
- yield* Effect.logError(`Transaction failed: ${error}`);
2515
- return yield* Effect.fail(error);
2516
- })
2517
- )
2518
- );
2519
- ```
2520
-
2521
- ---
2522
-
2523
-
2524
-
2525
- ### Environment Setup
2526
-
2527
- ```bash
2528
- # Production
2529
- CONVEX_DEPLOY_KEY=prod_xxx
2530
- STRIPE_SECRET_KEY=sk_live_xxx
2531
- STRIPE_WEBHOOK_SECRET=whsec_xxx
2532
- CLERK_SECRET_KEY=sk_live_xxx
2533
- OPENAI_API_KEY=sk-xxx
2534
- SITE_URL=https://one.ie
2535
-
2536
- # Monitoring
2537
- AXIOM_API_KEY=xxx
2538
- SENTRY_DSN=xxx
2539
- ```
2540
-
2541
- ---
2542
-
2543
- ---
2544
-
2545
- ## Risk Mitigation Matrix
2546
-
2547
- |Risk|Likelihood|Impact|Mitigation|Owner|
2548
- |---|---|---|---|---|
2549
- |Payment failures|Medium|High|Stripe retry logic, clear error messages|Backend|
2550
- |Migration data loss|Low|Critical|Batched processing, dual-write, backups|DevOps|
2551
- |Performance degradation|Medium|High|Proper indexing, load testing, caching|Backend|
2552
- |Security breach|Low|Critical|Security audit, penetration testing, bug bounty|Security|
2553
- |Low user adoption|Medium|High|Beta testing, user interviews, onboarding optimization|Product|
2554
- |Feature creep|High|Medium|Strict prioritization, MVP focus, iterative releases|PM|