oneie 3.6.13 → 3.6.15

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 (768) hide show
  1. package/.claude/agents/AUDIT-agent-ops-alignment.md +379 -0
  2. package/.claude/agents/NEWS-QUICKSTART.md +321 -0
  3. package/.claude/agents/NEWS-README.md +353 -0
  4. package/.claude/agents/agent-backend.md +1 -1
  5. package/.claude/agents/agent-builder.md +220 -151
  6. package/.claude/agents/agent-clean.md +39 -31
  7. package/.claude/agents/agent-clone.md +107 -54
  8. package/.claude/agents/agent-designer.md +76 -71
  9. package/.claude/agents/agent-director.md +170 -7
  10. package/.claude/agents/agent-documenter.md +169 -132
  11. package/.claude/agents/agent-frontend.md +442 -446
  12. package/.claude/agents/agent-integrator.md +30 -23
  13. package/.claude/agents/agent-lawyer.md +145 -98
  14. package/.claude/agents/agent-news.md +363 -0
  15. package/.claude/agents/agent-onboard.md +107 -77
  16. package/.claude/agents/agent-ontology.md +585 -0
  17. package/.claude/agents/agent-ops.md +178 -171
  18. package/.claude/agents/agent-problem-solver.md +132 -115
  19. package/.claude/agents/agent-quality.md +94 -77
  20. package/.claude/agents/agent-sales.md +89 -67
  21. package/.claude/commands/cascade.md +49 -20
  22. package/.claude/commands/create.md +397 -0
  23. package/.claude/commands/npx.md +64 -113
  24. package/.claude/commands/one.md +10 -28
  25. package/.claude/commands/plan.md +65 -65
  26. package/.claude/commands/push.md +63 -452
  27. package/.claude/commands/release.md +26 -393
  28. package/.claude/hooks/README-knowledge-hooks.md +267 -81
  29. package/.claude/hooks/README-root-cleanup.md +200 -0
  30. package/.claude/hooks/README.md +284 -0
  31. package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
  32. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  33. package/.claude/hooks/check-filenames.py +169 -32
  34. package/.claude/hooks/clean-post.py +195 -28
  35. package/.claude/hooks/clean-pre.py +96 -11
  36. package/.claude/hooks/clean-root-markdown.sh +73 -0
  37. package/.claude/hooks/done.py +74 -13
  38. package/.claude/hooks/format-hook.sh +105 -17
  39. package/.claude/hooks/hook-logger.sh +121 -7
  40. package/.claude/hooks/knowledge-post.py +136 -32
  41. package/.claude/hooks/knowledge-pre.py +129 -34
  42. package/.claude/hooks/notification-hook.sh +184 -17
  43. package/.claude/hooks/root-cleanup.py +181 -39
  44. package/.claude/hooks/security-hook.sh +248 -8
  45. package/.claude/hooks/tag-all-docs.py +175 -49
  46. package/.claude/hooks/test-validate-ontology.sh +170 -0
  47. package/.claude/hooks/todo.py +92 -22
  48. package/.claude/hooks/track-changes.sh +101 -0
  49. package/.claude/hooks/validate-ontology-structure-summary.md +243 -0
  50. package/.claude/hooks/validate-ontology-structure.py +83 -20
  51. package/.claude/skills/ontology/README.md +1 -1
  52. package/AGENTS.md +60 -245
  53. package/CLAUDE.md +108 -26
  54. package/README.md +25 -0
  55. package/one/README.md +21 -3
  56. package/one/connections/a2a.md +49 -0
  57. package/one/connections/acp.md +47 -0
  58. package/one/connections/acps.md +18 -0
  59. package/one/connections/agentkit.md +18 -0
  60. package/one/connections/agui.md +18 -0
  61. package/one/connections/any-backend.md +39 -21
  62. package/one/connections/ap2.md +74 -0
  63. package/one/connections/api/queries-reference.md +18 -0
  64. package/one/connections/api-docs.md +18 -0
  65. package/one/connections/api-reference.md +18 -0
  66. package/one/connections/api.md +18 -0
  67. package/one/connections/architecture-diagram.md +18 -0
  68. package/one/connections/communications.md +18 -0
  69. package/one/connections/connections.md +18 -0
  70. package/one/connections/copilotkit.md +18 -0
  71. package/one/connections/cryptonetworks.md +18 -0
  72. package/one/connections/documentation.md +19 -1
  73. package/one/connections/effect.md +18 -0
  74. package/one/connections/elizaos.md +18 -0
  75. package/one/connections/groups.md +814 -0
  76. package/one/connections/inference.md +21 -3
  77. package/one/connections/integration-examples.md +18 -0
  78. package/one/connections/integration-guide.md +18 -0
  79. package/one/connections/integration-phase2.md +32 -14
  80. package/one/connections/kyc.md +18 -0
  81. package/one/connections/mcp.md +18 -0
  82. package/one/connections/membership.md +18 -0
  83. package/one/connections/middleware.md +18 -0
  84. package/one/connections/multitenant.md +18 -0
  85. package/one/connections/n8n.md +18 -0
  86. package/one/connections/patterns.md +18 -0
  87. package/one/connections/protocols.md +20 -2
  88. package/one/connections/relationships.md +18 -0
  89. package/one/connections/schema.md +18 -0
  90. package/one/connections/service-layer.md +18 -0
  91. package/one/connections/vectors.md +18 -0
  92. package/one/connections/wordpress.md +18 -0
  93. package/one/connections/workflow-copy.md +19 -1
  94. package/one/connections/workflow-examples.md +18 -0
  95. package/one/connections/workflow-onboarding.md +102 -84
  96. package/one/connections/workflow.md +19 -1
  97. package/one/connections/workflows/delegation.md +18 -0
  98. package/one/connections/workflows/frontend.md +18 -0
  99. package/one/connections/workflows/strategy.md +18 -0
  100. package/one/connections/workflows/tasks.md +18 -0
  101. package/one/connections/x402-baazar.md +131 -0
  102. package/one/connections/x402.md +268 -164
  103. package/one/groups/features.md +26 -0
  104. package/one/groups/groups.md +112 -68
  105. package/one/groups/one.md +71 -51
  106. package/one/groups/{strategy copy.md → strategy-copy.md} +23 -5
  107. package/one/knowledge/.obsidian/ecommerce-ontology.md +18 -0
  108. package/one/knowledge/100-inference-quick-reference.md +49 -31
  109. package/one/knowledge/agent-onboard-usage.md +18 -0
  110. package/one/knowledge/agentic-commerce.md +146 -0
  111. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +683 -0
  112. package/one/knowledge/ai-platform.md +18 -0
  113. package/one/knowledge/ai-token-crypto-analysis-framework.md +1191 -0
  114. package/one/knowledge/ai-token-paradigm-shift-2025.md +732 -0
  115. package/one/knowledge/altcoin-cycle-prediction-ontology.md +884 -0
  116. package/one/knowledge/altcoin-cycle-trading-strategy.md +642 -0
  117. package/one/knowledge/architecture-any-backend.md +265 -42
  118. package/one/knowledge/architecture-diagram.md +404 -94
  119. package/one/knowledge/architecture-frontend.md +130 -51
  120. package/one/knowledge/architecture.md +1496 -1831
  121. package/one/knowledge/{ontology.md.backup → archived/ontology.old.md} +28 -10
  122. package/one/knowledge/astro-effect-complete-vision.md +2148 -0
  123. package/one/knowledge/astro-effect-simple-architecture.md +717 -0
  124. package/one/knowledge/audit-agent-onboard-alignment.md +481 -0
  125. package/one/knowledge/audit-agent-sales-alignment.md +444 -0
  126. package/one/knowledge/backend-api-reference.md +18 -0
  127. package/one/knowledge/cli-claude-handoff.md +54 -36
  128. package/one/knowledge/context-engineering.md +610 -0
  129. package/one/knowledge/crypto-analysis-strategy.md +1276 -0
  130. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +44 -0
  131. package/one/knowledge/crypto.md +18 -0
  132. package/one/knowledge/docs.md +627 -0
  133. package/one/knowledge/dsl.md +18 -0
  134. package/one/knowledge/event-driven-documentation.md +270 -0
  135. package/one/knowledge/files.md +18 -0
  136. package/one/knowledge/frontend.md +18 -0
  137. package/one/knowledge/hono.md +18 -0
  138. package/one/knowledge/implementation-examples.md +18 -0
  139. package/one/knowledge/installation-folders.md +18 -0
  140. package/one/knowledge/institutional-cycle-paradigm-2025.md +555 -0
  141. package/one/knowledge/knowledge.md +44 -26
  142. package/one/knowledge/language.md +18 -0
  143. package/one/knowledge/lessons-learned.md +18 -0
  144. package/one/knowledge/lessons-website-building-focus.md +19 -1
  145. package/one/knowledge/merge-report.md +254 -0
  146. package/one/knowledge/metadata-system.md +11 -11
  147. package/one/knowledge/nine-padel-playbook.md +18 -0
  148. package/one/knowledge/ontology-blog.yaml +42 -26
  149. package/one/knowledge/ontology-cheatsheet.md +18 -0
  150. package/one/knowledge/ontology-community.yaml +60 -37
  151. package/one/knowledge/ontology-core-universal.md +19 -1
  152. package/one/knowledge/ontology-core.yaml +58 -45
  153. package/one/knowledge/ontology-courses.yaml +71 -48
  154. package/one/knowledge/ontology-creator.md +30 -4
  155. package/one/knowledge/ontology-crypto.md +1603 -0
  156. package/one/knowledge/ontology-developer-guide.md +18 -0
  157. package/one/knowledge/ontology-documentation.md +52 -31
  158. package/one/knowledge/ontology-ecommerce.md +24 -6
  159. package/one/knowledge/ontology-education.md +18 -0
  160. package/one/knowledge/ontology-engineering-specification.md +22 -4
  161. package/one/knowledge/ontology-engineering.md +70 -46
  162. package/one/knowledge/ontology-files.yaml +525 -0
  163. package/one/knowledge/ontology-frontend-master.md +2898 -0
  164. package/one/knowledge/ontology-frontend-specifications.md +57 -49
  165. package/one/knowledge/ontology-frontend.md +40 -22
  166. package/one/knowledge/ontology-index.md +18 -0
  167. package/one/knowledge/ontology-minimal.yaml +18 -16
  168. package/one/knowledge/ontology-portfolio.yaml +40 -26
  169. package/one/knowledge/ontology-quickstart.md +18 -0
  170. package/one/knowledge/ontology-release.md +317 -0
  171. package/one/knowledge/ontology-shop.yaml +146 -119
  172. package/one/knowledge/ontology-tokens.yaml +46 -27
  173. package/one/knowledge/ontology-tutorial.md +18 -0
  174. package/one/knowledge/ontology-video-script.md +18 -0
  175. package/one/knowledge/ontology-visual-guide.md +20 -2
  176. package/one/knowledge/ontology.md +1334 -309
  177. package/one/knowledge/ontology.yaml +766 -278
  178. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +48 -18
  179. package/one/knowledge/patterns/backend/convex-query-pattern.md +78 -23
  180. package/one/knowledge/patterns/backend/mutation-template.md +28 -10
  181. package/one/knowledge/patterns/backend/query-template.md +44 -25
  182. package/one/knowledge/patterns/backend/service-template.md +35 -14
  183. package/one/knowledge/patterns/design/component-architecture.md +45 -9
  184. package/one/knowledge/patterns/design/test-driven-design-pattern.md +37 -3
  185. package/one/knowledge/patterns/design/wireframe-template.md +36 -2
  186. package/one/knowledge/patterns/frontend/component-template.md +91 -40
  187. package/one/knowledge/patterns/frontend/form-template.md +131 -59
  188. package/one/knowledge/patterns/frontend/page-template.md +59 -28
  189. package/one/knowledge/patterns/frontend/react-component-pattern.md +87 -27
  190. package/one/knowledge/patterns/test/acceptance-criteria-template.md +28 -10
  191. package/one/knowledge/patterns/test/technical-test-template.md +48 -26
  192. package/one/knowledge/patterns/test/test-driven-pattern.md +25 -5
  193. package/one/knowledge/patterns/test/user-flow-template.md +18 -0
  194. package/one/knowledge/provider-agnostic-content.md +995 -0
  195. package/one/knowledge/provider-creation-guide.md +18 -0
  196. package/one/knowledge/quality-loop.md +18 -0
  197. package/one/knowledge/readme-architecture.md +158 -0
  198. package/one/knowledge/readme.md +18 -0
  199. package/one/knowledge/rules.md +18 -0
  200. package/one/knowledge/score.md +20 -2
  201. package/one/knowledge/specifications.md +18 -0
  202. package/one/knowledge/tags.md +18 -0
  203. package/one/knowledge/todo-template.md +71 -53
  204. package/one/knowledge/todo.md +71 -53
  205. package/one/knowledge/typescript-patterns.md +19 -1
  206. package/one/knowledge/universal-generation-language.md +827 -0
  207. package/one/knowledge/x402-research.md +104 -0
  208. package/one/license.md +18 -0
  209. package/one/people/anthony-o-connell.md +55 -26
  210. package/one/people/people.md +55 -32
  211. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +401 -0
  212. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +588 -0
  213. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +461 -0
  214. package/one/things/CHECKLIST.md +51 -0
  215. package/one/things/IMPLEMENTATION_STATUS.md +379 -0
  216. package/one/things/ONE.md +19 -1
  217. package/one/things/agents/agent-backend.md +202 -102
  218. package/one/things/agents/agent-builder.md +267 -158
  219. package/one/things/agents/agent-clean.md +56 -31
  220. package/one/things/agents/agent-clone.md +33 -50
  221. package/one/things/agents/agent-deploy.md +65 -17
  222. package/one/things/agents/agent-designer.md +274 -146
  223. package/one/things/agents/agent-director.md +20 -2
  224. package/one/things/agents/agent-documenter.md +126 -46
  225. package/one/things/agents/agent-frontend.md +104 -22
  226. package/one/things/agents/agent-integrator.md +153 -76
  227. package/one/things/agents/agent-lawyer.md +197 -92
  228. package/one/things/agents/agent-problem-solver.md +302 -224
  229. package/one/things/agents/agent-quality.md +149 -19
  230. package/one/things/agents/agent-sales.md +101 -13
  231. package/one/things/cascade/cascade.yaml +20 -3
  232. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +53 -0
  233. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +50 -0
  234. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +76 -0
  235. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +49 -3
  236. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +45 -0
  237. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +32 -0
  238. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +45 -3
  239. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +44 -0
  240. package/one/things/cascade/docs/examples/1-3-event-coordination.md +40 -1
  241. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +81 -25
  242. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +41 -0
  243. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +91 -16
  244. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +136 -73
  245. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +43 -0
  246. package/one/things/cascade/docs/examples/1-5-quality-loops.md +88 -4
  247. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +52 -3
  248. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +44 -1
  249. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +78 -14
  250. package/one/things/cascade/docs/examples/readme.md +37 -0
  251. package/one/things/cascade/docs/getting-started.md +18 -0
  252. package/one/things/cascade/docs/workflow.md +18 -12
  253. package/one/things/cascade/readme.md +43 -0
  254. package/one/things/cascade/templates/feature-template.md +28 -6
  255. package/one/things/claude/agents/advocacy-activation-manager.md +64 -39
  256. package/one/things/claude/agents/advocacy-campaign-designer.md +64 -39
  257. package/one/things/claude/agents/analyst.md +64 -39
  258. package/one/things/claude/agents/architect.md +64 -39
  259. package/one/things/claude/agents/brand-identity-specialist.md +64 -39
  260. package/one/things/claude/agents/bstp-token-strategist.md +48 -25
  261. package/one/things/claude/agents/builder-repo.md +69 -26
  262. package/one/things/claude/agents/bullstamp-community-builder.md +48 -25
  263. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +48 -25
  264. package/one/things/claude/agents/bulltilt-platform-growth.md +48 -25
  265. package/one/things/claude/agents/company-bullstamp-character.md +45 -30
  266. package/one/things/claude/agents/company-bullstamp-community.md +45 -30
  267. package/one/things/claude/agents/company-bullstamp-marketing.md +45 -30
  268. package/one/things/claude/agents/company-bullstamp-token.md +45 -30
  269. package/one/things/claude/agents/company-bulltilt-growth.md +45 -30
  270. package/one/things/claude/agents/content-bibliography-formatter.md +48 -25
  271. package/one/things/claude/agents/content-calendar-planner.md +59 -34
  272. package/one/things/claude/agents/content-chapter-formatter.md +60 -35
  273. package/one/things/claude/agents/content-formatter.md +59 -34
  274. package/one/things/claude/agents/content-hook-specialist.md +54 -31
  275. package/one/things/claude/agents/content-image-formatter.md +59 -34
  276. package/one/things/claude/agents/content-introduction-formatter.md +59 -34
  277. package/one/things/claude/agents/content-multiplication-engine.md +54 -31
  278. package/one/things/claude/agents/content-playbook-writer.md +60 -35
  279. package/one/things/claude/agents/content-team-manager.md +59 -34
  280. package/one/things/claude/agents/content-toc-formatter.md +60 -35
  281. package/one/things/claude/agents/convex-backend-specialist.md +380 -216
  282. package/one/things/claude/agents/core-manager.md +59 -34
  283. package/one/things/claude/agents/core-master.md +55 -32
  284. package/one/things/claude/agents/cross-functional-manager.md +46 -41
  285. package/one/things/claude/agents/crypto-airdrop-strategist.md +74 -54
  286. package/one/things/claude/agents/crypto-analytics-educator.md +73 -30
  287. package/one/things/claude/agents/crypto-architecture-specialist.md +70 -39
  288. package/one/things/claude/agents/crypto-community-analyst.md +47 -31
  289. package/one/things/claude/agents/crypto-community-psychologist.md +68 -31
  290. package/one/things/claude/agents/crypto-dex-optimization-expert.md +72 -31
  291. package/one/things/claude/agents/crypto-dex-optimizer.md +45 -30
  292. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +69 -30
  293. package/one/things/claude/agents/crypto-diamond-hands.md +45 -30
  294. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +73 -30
  295. package/one/things/claude/agents/crypto-engagement-specialist.md +71 -30
  296. package/one/things/claude/agents/crypto-market-researcher.md +45 -30
  297. package/one/things/claude/agents/crypto-marketing-orchestrator.md +74 -34
  298. package/one/things/claude/agents/crypto-network-effect-amplifier.md +75 -30
  299. package/one/things/claude/agents/crypto-optimization-analyst.md +73 -30
  300. package/one/things/claude/agents/crypto-strategic-synthesizer.md +69 -30
  301. package/one/things/claude/agents/crypto-team-manager.md +45 -40
  302. package/one/things/claude/agents/crypto-token-analyst.md +66 -25
  303. package/one/things/claude/agents/crypto-viral-content-creator.md +64 -61
  304. package/one/things/claude/agents/crypto-wallet-identification-expert.md +61 -51
  305. package/one/things/claude/agents/crypto-wallet-identifier.md +45 -30
  306. package/one/things/claude/agents/customer-journey-designer.md +51 -58
  307. package/one/things/claude/agents/customer-success-manager.md +51 -58
  308. package/one/things/claude/agents/dev.md +51 -58
  309. package/one/things/claude/agents/documenter.md +71 -69
  310. package/one/things/claude/agents/elevate-marketing-orchestrator.md +45 -52
  311. package/one/things/claude/agents/engagement-specialist.md +45 -52
  312. package/one/things/claude/agents/engineering-architect.md +54 -54
  313. package/one/things/claude/agents/engineering-business-analyst.md +46 -56
  314. package/one/things/claude/agents/engineering-developer.md +51 -52
  315. package/one/things/claude/agents/engineering-director.md +65 -25
  316. package/one/things/claude/agents/engineering-ingestor.md +110 -100
  317. package/one/things/claude/agents/engineering-product-manager.md +43 -55
  318. package/one/things/claude/agents/engineering-product-owner.md +46 -56
  319. package/one/things/claude/agents/engineering-project-coordinator.md +44 -56
  320. package/one/things/claude/agents/engineering-quality-assurance.md +53 -54
  321. package/one/things/claude/agents/engineering-team-manager.md +46 -43
  322. package/one/things/claude/agents/engineering-user-experience.md +51 -52
  323. package/one/things/claude/agents/framework-elevate-manager.md +45 -30
  324. package/one/things/claude/agents/improver.md +120 -78
  325. package/one/things/claude/agents/intelligence-team-manager.md +45 -40
  326. package/one/things/claude/agents/lead-capture-expert.md +45 -52
  327. package/one/things/claude/agents/lead-magnet-creator.md +45 -52
  328. package/one/things/claude/agents/market-research-analyst.md +48 -25
  329. package/one/things/claude/agents/marketing-brand-identity.md +57 -27
  330. package/one/things/claude/agents/marketing-content-hooks.md +45 -40
  331. package/one/things/claude/agents/marketing-content-multiplier.md +45 -40
  332. package/one/things/claude/agents/marketing-content-poster.md +71 -60
  333. package/one/things/claude/agents/marketing-customer-journey.md +45 -40
  334. package/one/things/claude/agents/marketing-director.md +46 -41
  335. package/one/things/claude/agents/marketing-engagement.md +45 -40
  336. package/one/things/claude/agents/marketing-lead-capture.md +45 -40
  337. package/one/things/claude/agents/marketing-lead-magnet.md +45 -40
  338. package/one/things/claude/agents/marketing-network-effects.md +45 -40
  339. package/one/things/claude/agents/marketing-nurture-campaigns.md +45 -40
  340. package/one/things/claude/agents/marketing-share-optimizer.md +45 -40
  341. package/one/things/claude/agents/marketing-team-manager.md +45 -40
  342. package/one/things/claude/agents/marketing-viral-growth.md +49 -18
  343. package/one/things/claude/agents/mission-commander.md +45 -40
  344. package/one/things/claude/agents/network-effect-analyst.md +48 -31
  345. package/one/things/claude/agents/nextjs-15-specialist.md +210 -123
  346. package/one/things/claude/agents/npx.md +126 -70
  347. package/one/things/claude/agents/nurture-campaign-manager.md +48 -25
  348. package/one/things/claude/agents/one-master.md +48 -25
  349. package/one/things/claude/agents/one-orchestrator.md +57 -27
  350. package/one/things/claude/agents/one.md +88 -31
  351. package/one/things/claude/agents/playbook-generator.md +48 -25
  352. package/one/things/claude/agents/pm.md +48 -25
  353. package/one/things/claude/agents/po.md +51 -26
  354. package/one/things/claude/agents/qa.md +50 -25
  355. package/one/things/claude/agents/research-foundation-analyst.md +48 -31
  356. package/one/things/claude/agents/research-intelligence-gatherer.md +59 -32
  357. package/one/things/claude/agents/research-market-analyst.md +47 -30
  358. package/one/things/claude/agents/research-team-manager.md +47 -40
  359. package/one/things/claude/agents/sales-environment-optimizer.md +50 -25
  360. package/one/things/claude/agents/sales-team-manager.md +47 -40
  361. package/one/things/claude/agents/sales-upsell-strategist.md +47 -30
  362. package/one/things/claude/agents/service-advocacy-campaigns.md +47 -30
  363. package/one/things/claude/agents/service-advocacy-manager.md +47 -30
  364. package/one/things/claude/agents/service-success-manager.md +47 -30
  365. package/one/things/claude/agents/service-team-manager.md +45 -40
  366. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +85 -30
  367. package/one/things/claude/agents/share-optimization-specialist.md +50 -25
  368. package/one/things/claude/agents/sm.md +50 -25
  369. package/one/things/claude/agents/story-teller.md +51 -26
  370. package/one/things/claude/agents/task-master.md +52 -27
  371. package/one/things/claude/agents/tauri-cross-platform-specialist.md +201 -116
  372. package/one/things/claude/agents/tester.md +85 -46
  373. package/one/things/claude/agents/the-bull-character-manager.md +48 -25
  374. package/one/things/claude/agents/tools-playbook-generator.md +43 -40
  375. package/one/things/claude/agents/turbo-repo-builder.md +57 -27
  376. package/one/things/claude/agents/upsell-strategist.md +48 -25
  377. package/one/things/claude/agents/ux-expert.md +50 -25
  378. package/one/things/claude/agents/viral-growth-orchestrator.md +50 -27
  379. package/one/things/claude/commands/agent.md +25 -5
  380. package/one/things/claude/commands/cascade-status.md +33 -8
  381. package/one/things/claude/commands/ingest.md +64 -11
  382. package/one/things/claude/commands/ingestor.md +29 -7
  383. package/one/things/claude/commands/mission.md +24 -4
  384. package/one/things/claude/commands/npx.md +30 -7
  385. package/one/things/claude/commands/one.md +114 -68
  386. package/one/things/claude/commands/quality-check.md +72 -24
  387. package/one/things/claude/commands/smart-route.md +45 -4
  388. package/one/things/claude/commands/start.md +22 -4
  389. package/one/things/claude/commands/story.md +25 -5
  390. package/one/things/claude/commands/task.md +21 -1
  391. package/one/things/cli/cli-code.md +244 -219
  392. package/one/things/cli/cli-compiler-code.md +244 -219
  393. package/one/things/cli/cli.md +30 -6
  394. package/one/things/components/card-shadcn.md +252 -228
  395. package/one/things/components/card.md +315 -324
  396. package/one/things/components.md +667 -593
  397. package/one/things/componets.md +16 -1
  398. package/one/things/creator-diagram.md +23 -5
  399. package/one/things/demo-accessibility-animations.md +73 -47
  400. package/one/things/demo-components.md +225 -219
  401. package/one/things/demo-design-summary.md +95 -32
  402. package/one/things/demo-design-system.md +184 -130
  403. package/one/things/demo-page-layouts.md +52 -25
  404. package/one/things/designs/accessibility-audit.md +153 -66
  405. package/one/things/designs/component-specifications.md +163 -65
  406. package/one/things/designs/design-overview.md +81 -22
  407. package/one/things/designs/design-tokens.md +127 -93
  408. package/one/things/designs/wireframes-dashboard.md +64 -7
  409. package/one/things/docs/api-requests.md +75 -11
  410. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +18 -0
  411. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +57 -0
  412. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +62 -6
  413. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +60 -5
  414. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +95 -27
  415. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +130 -62
  416. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +43 -19
  417. package/one/things/docs/ecommerce/QUICK-START.md +41 -4
  418. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +75 -6
  419. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +58 -24
  420. package/one/things/examples/children/lemonade-stand.md +52 -14
  421. package/one/things/examples/enterprise/crm-saas.md +66 -51
  422. package/one/things/features/1-1-agent-prompts.md +76 -0
  423. package/one/things/features/1-2-yaml-orchestrator.md +32 -0
  424. package/one/things/features/1-3-event-coordination.md +40 -1
  425. package/one/things/features/1-4-knowledge-management.md +91 -16
  426. package/one/things/features/1-5-quality-loops.md +88 -4
  427. package/one/things/features/1-6-numbering-structure.md +78 -14
  428. package/one/things/features/2-1-dataprovider-interface.md +317 -92
  429. package/one/things/features/2-2-config-system.md +307 -140
  430. package/one/things/features/2-3-effectts-services.md +266 -119
  431. package/one/things/features/2-4-react-hooks.md +221 -205
  432. package/one/things/features/2-5-auth-migration.md +406 -308
  433. package/one/things/features/2-6-dashboard-migration.md +112 -13
  434. package/one/things/features/2-7-alternative-providers.md +138 -65
  435. package/one/things/features/2-7-implementation-report.md +68 -24
  436. package/one/things/features/2-cli.md +91 -79
  437. package/one/things/features/2-design.md +114 -82
  438. package/one/things/features/2-tests.md +56 -0
  439. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +91 -36
  440. package/one/things/features/DECOUPLING.md +36 -18
  441. package/one/things/features/DEPLOYMENT.md +22 -4
  442. package/one/things/features/IMPLEMENTATION_SUMMARY.md +48 -2
  443. package/one/things/features/improve.md +47 -29
  444. package/one/things/features/remove-convex-deps.md +18 -0
  445. package/one/things/features/top-features.md +28 -20
  446. package/one/things/features/use-one-backend.md +212 -175
  447. package/one/things/features-in-english.md +19 -6
  448. package/one/things/files.yaml +721 -0
  449. package/one/things/ideas/1-create-workflow.md +18 -0
  450. package/one/things/ideas/2-backend-agnostic-frontend.md +57 -2
  451. package/one/things/implementation/backend-guide.md +65 -20
  452. package/one/things/interface.md +51 -8
  453. package/one/things/landing-page-implementation.md +455 -0
  454. package/one/things/legal/README.md +44 -0
  455. package/one/things/legal/privacy-policy.md +188 -25
  456. package/one/things/legal/terms-of-service.md +170 -9
  457. package/one/things/master-workflow-plan.md +806 -0
  458. package/one/things/plans/0-in-sync.md +136 -0
  459. package/one/things/plans/0-timeline.md +36 -0
  460. package/one/things/plans/1-create-workflow.md +19 -0
  461. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +333 -0
  462. package/one/things/plans/README-SIMPLIFICATION.md +349 -0
  463. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +16 -0
  464. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +455 -0
  465. package/one/things/plans/ai-elements.md +28 -9
  466. package/one/things/plans/ai-integration.md +111 -62
  467. package/one/things/plans/ai-sdk.md +92 -55
  468. package/one/things/plans/ai-tools.md +621 -0
  469. package/one/things/plans/app.md +142 -71
  470. package/one/things/plans/architecture-summary.md +34 -5
  471. package/one/things/plans/async-ai-agents.md +19 -1
  472. package/one/things/plans/backend-agnostic-frontend.md +70 -8
  473. package/one/things/plans/backend-cleanup-quickstart.md +55 -21
  474. package/one/things/plans/backend-ontology-conformance.md +150 -91
  475. package/one/things/plans/backend-status.md +64 -6
  476. package/one/things/plans/backend-structure.md +103 -55
  477. package/one/things/plans/backend-target-structure.md +63 -19
  478. package/one/things/plans/backend.md +61 -19
  479. package/one/things/plans/better-auth-any-backend-revised.md +325 -287
  480. package/one/things/plans/better-auth-any-backend.md +576 -532
  481. package/one/things/plans/better-auth-available-features.md +43 -5
  482. package/one/things/plans/big-plan.md +20 -6
  483. package/one/things/plans/cli-updates-required.md +44 -4
  484. package/one/things/plans/complete-step-by-step.md +223 -116
  485. package/one/things/plans/components.md +709 -0
  486. package/one/things/plans/convex-agents.md +87 -58
  487. package/one/things/plans/convex-better-auth.md +186 -154
  488. package/one/things/plans/convex-on-off.md +47 -29
  489. package/one/things/plans/crypto-token-researcher.md +629 -0
  490. package/one/things/plans/data-quality-metrics.md +745 -0
  491. package/one/things/plans/deep-researcher-agent.md +466 -0
  492. package/one/things/plans/deploy-to-cloudflare.md +55 -13
  493. package/one/things/plans/deployment-architecture.md +54 -11
  494. package/one/things/plans/desktop.md +21 -3
  495. package/one/things/plans/development-plan.md +233 -170
  496. package/one/things/plans/development-workflow-tldr.md +207 -0
  497. package/one/things/plans/development-workflow.md +959 -0
  498. package/one/things/plans/effect-components.md +667 -593
  499. package/one/things/plans/effect-patterns-reference.md +2235 -0
  500. package/one/things/plans/effect.md +209 -136
  501. package/one/things/plans/email.md +21 -8
  502. package/one/things/plans/enhance-auth.md +64 -41
  503. package/one/things/plans/execution-strategy.md +1291 -0
  504. package/one/things/plans/existing-infrastructure.md +712 -0
  505. package/one/things/plans/feature-based-sites.md +124 -51
  506. package/one/things/plans/frontend-effects.md +1276 -0
  507. package/one/things/plans/group-folder-multi-tenancy.md +187 -124
  508. package/one/things/plans/improve-codebase.md +498 -421
  509. package/one/things/plans/install-components.md +18 -1
  510. package/one/things/plans/integrate-frontend-and-backend.md +77 -53
  511. package/one/things/plans/landing.md +92 -0
  512. package/one/things/plans/layout.md +45 -1
  513. package/one/things/plans/mail-backend.md +546 -493
  514. package/one/things/plans/mail.md +379 -326
  515. package/one/things/plans/mcp-clear-context-prompt.md +21 -0
  516. package/one/things/plans/mcp-simple.md +20 -0
  517. package/one/things/plans/multi-ontology-architecture.md +115 -66
  518. package/one/things/plans/next-features.md +31 -0
  519. package/one/things/plans/onboarding.md +21 -2
  520. package/one/things/plans/one.md +18 -0
  521. package/one/things/plans/ontology-6-dimensions.md +31 -52
  522. package/one/things/plans/ontology-compliance-audit.md +315 -0
  523. package/one/things/plans/ontology-driven-strategy.md +19 -3
  524. package/one/things/plans/ontology-refine.md +586 -0
  525. package/one/things/plans/ontology-ui-approach.md +18 -0
  526. package/one/things/plans/open-agent.md +152 -97
  527. package/one/things/plans/performace.md +32 -0
  528. package/one/things/plans/phase-1-foundation.md +620 -0
  529. package/one/things/plans/phase-3-implementation.md +1037 -0
  530. package/one/things/plans/quick-wins.md +342 -187
  531. package/one/things/plans/readme-backend-cleanup.md +57 -16
  532. package/one/things/plans/release.md +55 -2
  533. package/one/things/plans/repos.md +22 -0
  534. package/one/things/plans/separate-copy-2.md +127 -71
  535. package/one/things/plans/separate-copy-3.md +35 -14
  536. package/one/things/plans/separate-copy.md +127 -71
  537. package/one/things/plans/separate-demo.md +37 -3
  538. package/one/things/plans/separate.md +24 -6
  539. package/one/things/plans/sequence.md +284 -141
  540. package/one/things/plans/shadcn-integration-summary.md +104 -44
  541. package/one/things/plans/sidebar.md +44 -10
  542. package/one/things/plans/skills.md +133 -30
  543. package/one/things/plans/small-fixes.md +19 -1
  544. package/one/things/plans/start-new.md +39 -13
  545. package/one/things/plans/switch-off-auth.md +22 -0
  546. package/one/things/plans/sync-checklist.md +34 -4
  547. package/one/things/plans/test-backend-connection.md +38 -0
  548. package/one/things/plans/unified-implementation-plan.md +145 -63
  549. package/one/things/plans/update-demos.md +156 -88
  550. package/one/things/plans/use-our-backend.md +572 -0
  551. package/one/things/plans/wave1-onboarding-100-inferences.md +1686 -0
  552. package/one/things/plans/wave1-onboarding-vision.md +744 -0
  553. package/one/things/plans/wave1-orchestration-summary.md +604 -0
  554. package/one/things/plans/wave1-specialist-assignments.md +1413 -0
  555. package/one/things/plans/workflow-files.md +28 -14
  556. package/one/things/plans/workflow.md +18 -12
  557. package/one/things/products/cascade-landing-page.md +150 -46
  558. package/one/things/products/cascade.md +185 -135
  559. package/one/things/products/context-engineering.md +411 -350
  560. package/one/things/products/onthology.md +15 -0
  561. package/one/things/products/ontology-ui-shadcn.md +375 -353
  562. package/one/things/products/ontology-ui.md +101 -59
  563. package/one/things/products/ontology.md +92 -20
  564. package/one/things/products/sdk.md +181 -165
  565. package/one/things/promptkit.md +70 -43
  566. package/one/things/repos/all-repos.md +0 -0
  567. package/one/things/service-providers-new.md +95 -25
  568. package/one/things/service-providers.md +231 -202
  569. package/one/things/structure.md +532 -0
  570. package/one/things/system.md +18 -0
  571. package/one/things/templates.md +40 -0
  572. package/one/things/tests/2-1-dataprovider-interface.md +105 -33
  573. package/one/things/tests/2-1-test-analysis.md +66 -18
  574. package/one/things/things.md +51 -16
  575. package/one/things/todo-acp-integration.md +744 -0
  576. package/one/things/todo-ai.md +933 -0
  577. package/one/things/todo-api.md +1078 -0
  578. package/one/things/todo-assignment.md +580 -0
  579. package/one/things/todo-buy-chatgpt.md +1450 -0
  580. package/one/things/todo-components.md +1683 -0
  581. package/one/things/todo-connections.md +278 -0
  582. package/one/things/todo-ecommerce-frontend.md +1313 -0
  583. package/one/things/todo-ecommerce.md +569 -0
  584. package/one/things/todo-effects.md +1075 -0
  585. package/one/things/todo-frontend-effects.md +977 -0
  586. package/one/things/todo-landing-page.md +1091 -0
  587. package/one/things/todo-mail.md +1160 -0
  588. package/one/things/todo-master-plan.md +490 -0
  589. package/one/things/todo-onboard.md +666 -0
  590. package/one/things/todo-one-ie.md +538 -0
  591. package/one/things/todo-page.md +606 -0
  592. package/one/things/todo-plans.md +282 -0
  593. package/one/things/todo-projects.md +241 -0
  594. package/one/things/todo-refactoring-plan.md +366 -0
  595. package/one/things/todo-sequence.md +1621 -0
  596. package/one/things/todo-use-our-backend.md +1908 -0
  597. package/one/things/todo-workflow.md +626 -0
  598. package/one/things/todo-x402.md +2047 -0
  599. package/one/things/todo.md +459 -1075
  600. package/one/things/video/scripts-crypto.md +835 -0
  601. package/one/things/video-script-ontology.md +334 -0
  602. package/package.json +7 -2
  603. package/.claude/commands/build.md +0 -293
  604. package/one/.obsidian/app.json +0 -8
  605. package/one/.obsidian/appearance.json +0 -1
  606. package/one/.obsidian/community-plugins.json +0 -3
  607. package/one/.obsidian/core-plugins.json +0 -33
  608. package/one/.obsidian/plugins/easy-bake/main.js +0 -361
  609. package/one/.obsidian/plugins/easy-bake/manifest.json +0 -11
  610. package/one/.obsidian/plugins/easy-bake/styles.css +0 -10
  611. package/one/.obsidian/workspace.json +0 -240
  612. package/one/events/2024-10-14-deployment-plan.md +0 -331
  613. package/one/events/2024-10-14-deployment-success.md +0 -448
  614. package/one/events/2024-10-14-final-sync-complete.md +0 -251
  615. package/one/events/2024-10-14-release-v2.0.6.md +0 -415
  616. package/one/events/2024-10-15-agent-clean-v2-summary.md +0 -496
  617. package/one/events/2024-10-15-handoff-to-clean.md +0 -348
  618. package/one/events/2024-10-15-package-manager-tests.md +0 -443
  619. package/one/events/2024-10-15-release-command-complete.md +0 -417
  620. package/one/events/2025-10-15-private-files-secured.md +0 -341
  621. package/one/events/2025-10-15-unignore-public-group-docs.md +0 -280
  622. package/one/events/API_ROUTES_FIXES_SUMMARY.md +0 -262
  623. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +0 -636
  624. package/one/events/BEFORE_AFTER_COMPARISON.md +0 -960
  625. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +0 -354
  626. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +0 -412
  627. package/one/events/CLEANUP-RELEASE-V2.0.8.md +0 -290
  628. package/one/events/CONNECTIONS_DEMO.md +0 -501
  629. package/one/events/CREATE-WEBSITE.md +0 -442
  630. package/one/events/CRITICAL-FIXES-COMPLETE.md +0 -504
  631. package/one/events/CUSTOM-DOMAIN.md +0 -357
  632. package/one/events/DELIVERABLES.md +0 -432
  633. package/one/events/DEMO-GROUPS-PAGE.md +0 -392
  634. package/one/events/DEMO-TESTING-SUMMARY.md +0 -518
  635. package/one/events/DEMO_COMPONENTS.md +0 -487
  636. package/one/events/DEMO_HOOKS_INDEX.md +0 -334
  637. package/one/events/DEMO_INFRASTRUCTURE.md +0 -905
  638. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +0 -570
  639. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +0 -431
  640. package/one/events/DEMO_QUICK_REFERENCE.md +0 -441
  641. package/one/events/DEMO_SETUP.md +0 -476
  642. package/one/events/DEPLOYMENT copy.md +0 -426
  643. package/one/events/DEPLOYMENT.md +0 -178
  644. package/one/events/ECOMMERCE-BEFORE-AFTER.md +0 -251
  645. package/one/events/ECOMMERCE-DEMO-PLAN.md +0 -225
  646. package/one/events/ECOMMERCE-ENHANCEMENTS.md +0 -576
  647. package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +0 -421
  648. package/one/events/ECOMMERCE-LIVE-DEMO.md +0 -363
  649. package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +0 -196
  650. package/one/events/ECOMMERCE-SETUP-SUMMARY.md +0 -396
  651. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +0 -735
  652. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +0 -923
  653. package/one/events/EFFECT_TS_API_PATTERN.md +0 -478
  654. package/one/events/FEATURE-2-4-COMPLETE.md +0 -302
  655. package/one/events/FEATURE_2_3_COMPLETE.md +0 -575
  656. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +0 -223
  657. package/one/events/GROUPS-MIGRATION.md +0 -625
  658. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +0 -414
  659. package/one/events/HANDOFF.md +0 -313
  660. package/one/events/HOOKS-DEMO.md +0 -441
  661. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +0 -503
  662. package/one/events/IMPLEMENTATION_SUMMARY.md +0 -529
  663. package/one/events/INSTALL-TESTS.md +0 -293
  664. package/one/events/INSTALLATION_FOLDERS.md +0 -516
  665. package/one/events/INSTALLATION_FOLDERS_FILES.md +0 -205
  666. package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +0 -419
  667. package/one/events/INTEGRATION-ARCHITECTURE.md +0 -561
  668. package/one/events/INTEGRATION-CHECKLIST.md +0 -1234
  669. package/one/events/INTEGRATION-ORCHESTRATION.md +0 -2623
  670. package/one/events/INTEGRATION-SUMMARY.md +0 -653
  671. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +0 -666
  672. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +0 -642
  673. package/one/events/LANDING-PAGE-QUICKSTART.md +0 -407
  674. package/one/events/LICENSE.md +0 -89
  675. package/one/events/MCP-CONFIGURATION.md +0 -336
  676. package/one/events/MCP-SETUP-COMPLETE.md +0 -205
  677. package/one/events/MIGRATION-REPORT.md +0 -435
  678. package/one/events/MIGRATION.md +0 -69
  679. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +0 -1627
  680. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +0 -573
  681. package/one/events/NODE-UPGRADE.md +0 -111
  682. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +0 -398
  683. package/one/events/ONTOLOGY-HOOKS-README.md +0 -700
  684. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +0 -365
  685. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +0 -525
  686. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +0 -455
  687. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +0 -486
  688. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +0 -203
  689. package/one/events/PACKAGE-STRUCTURE.md +0 -310
  690. package/one/events/PLAYBOOK-SETUP-SUMMARY.md +0 -331
  691. package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +0 -567
  692. package/one/events/QA-CHECKLIST.md +0 -674
  693. package/one/events/QUICK-START-ONTOLOGY.md +0 -408
  694. package/one/events/README-archived.md +0 -519
  695. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +0 -639
  696. package/one/events/SEARCH_DEMO_DELIVERY.md +0 -415
  697. package/one/events/SEARCH_DEMO_SUMMARY.md +0 -303
  698. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +0 -381
  699. package/one/events/SECURITY-AUDIT-FIXES.md +0 -376
  700. package/one/events/SECURITY-SCAN-COMPLETE.md +0 -281
  701. package/one/events/SHOP-BUILD-STATUS.md +0 -114
  702. package/one/events/SHOP-PREMIUM-UPDATE.md +0 -149
  703. package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +0 -262
  704. package/one/events/SITE-WIDE-GRADIENT-FIX.md +0 -299
  705. package/one/events/STORE-PRODUCTION-READY-STATUS.md +0 -359
  706. package/one/events/STRIPE-INTEGRATION.md +0 -414
  707. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +0 -429
  708. package/one/events/STRIPE-SETUP-GUIDE.md +0 -462
  709. package/one/events/TEST-PLAN-INDEX.md +0 -346
  710. package/one/events/TEST-PLAN.md +0 -1417
  711. package/one/events/TEST-SUMMARY.md +0 -393
  712. package/one/events/TESTING-DELIVERY.txt +0 -372
  713. package/one/events/TESTS-QUICK-REF.md +0 -262
  714. package/one/events/TRANSITIONS-QUICK-START.md +0 -141
  715. package/one/events/TRANSPARENCY-FIXES.md +0 -275
  716. package/one/events/TYPESCRIPT_FIXES.md +0 -152
  717. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +0 -412
  718. package/one/events/TYPESCRIPT_FIXES_INDEX.md +0 -341
  719. package/one/events/VIEW-TRANSITIONS.md +0 -428
  720. package/one/events/agent-director-enhancement-summary.md +0 -386
  721. package/one/events/agent-onboard-implementation-summary.md +0 -457
  722. package/one/events/backend-integration-tests.md +0 -606
  723. package/one/events/backend-structure-diagram.txt +0 -393
  724. package/one/events/backend-structure-summary.txt +0 -269
  725. package/one/events/clean-agent-ontology-cleanup-report.md +0 -353
  726. package/one/events/cloudflare-automation-complete.md +0 -332
  727. package/one/events/cloudflare-pages-infrastructure-setup.md +0 -264
  728. package/one/events/contact-page-complete.md +0 -298
  729. package/one/events/convex-analysis-index.md +0 -304
  730. package/one/events/convex-structure-analysis.md +0 -700
  731. package/one/events/deployment-installation-folders.md +0 -160
  732. package/one/events/deployment-ops-summary.md +0 -368
  733. package/one/events/deployment-verification.md +0 -348
  734. package/one/events/design-spec-complete.md +0 -208
  735. package/one/events/events.md +0 -545
  736. package/one/events/installation-folders-workflow-integration.md +0 -440
  737. package/one/events/landing-page-generator.md +0 -458
  738. package/one/events/legal-assessment-2025-10-16.md +0 -1899
  739. package/one/events/onboarding-implementation-complete.md +0 -505
  740. package/one/events/ontology-test-examples.md +0 -562
  741. package/one/events/phase1-backend-implementation-complete.md +0 -518
  742. package/one/events/release.md +0 -254
  743. package/one/events/separate-implementation-status.md +0 -537
  744. package/one/events/session-summary-2025-10-18.md +0 -348
  745. package/one/events/skills-complete.md +0 -333
  746. package/one/events/skills-infer-6-10-summary.md +0 -52
  747. package/one/events/skills-phase1-complete.md +0 -263
  748. package/one/events/test-dashboard.md +0 -345
  749. package/one/events/test-index.md +0 -361
  750. package/one/events/test-report-ontology.md +0 -582
  751. package/one/events/testing-summary.md +0 -344
  752. package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +0 -49
  753. package/one/knowledge/docs/flow.md +0 -0
  754. package/one/knowledge/documentation-summary.md +0 -285
  755. package/one/knowledge/inference-score.md +0 -159
  756. package/one/knowledge/ontology-frontend-copy-2.md +0 -1492
  757. package/one/knowledge/ontology-frontend-copy.md +0 -753
  758. package/one/knowledge/ontology-migration-guide.md +0 -811
  759. package/one/things/features/0 All Features.md +0 -2
  760. package/one/things/plans/1-create-workflow-status.md +0 -555
  761. package/one/things/plans/2-backend-agnostic-frontend.md +0 -546
  762. package/one/things/plans/2-sites.md +0 -895
  763. package/one/things/plans/3-groups.md +0 -735
  764. package/one/things/plans/5-build-frontend.md +0 -0
  765. package/one/things/plans/5-complete.md +0 -17
  766. package/one/things/plans/agent-director-100-inference-plans.md +0 -410
  767. package/one/things/plans/dual-website-strategy.md +0 -612
  768. package/one/things/plans/releases.md +0 -809
@@ -1,2623 +0,0 @@
1
- # Integration Orchestration Plan
2
-
3
- **Integration Specialist Deliverable**
4
- **Date:** 2025-10-13
5
- **Status:** Architecture Design & Implementation Roadmap
6
- **Version:** 1.0.0
7
-
8
- ---
9
-
10
- ## Executive Summary
11
-
12
- This document orchestrates the complete integration strategy for the ONE Platform transformation from monolithic frontend+backend to a layered **Frontend → DataProvider → Backend** architecture. All integrations are designed to respect the **6-dimension ontology** (Organizations, People, Things, Connections, Events, Knowledge) and maintain protocol-agnostic data flows.
13
-
14
- **Key Achievement:** Zero-downtime migration with complete test coverage across all 6 dimensions.
15
-
16
- ---
17
-
18
- ## Table of Contents
19
-
20
- 1. [Data Flow Orchestration (6 Dimensions)](#1-data-flow-orchestration-6-dimensions)
21
- 2. [Multi-Backend Federation](#2-multi-backend-federation)
22
- 3. [Real-Time Coordination](#3-real-time-coordination)
23
- 4. [Migration Coordination (7 Phases)](#4-migration-coordination-7-phases)
24
- 5. [Testing Integration](#5-testing-integration)
25
- 6. [Error Propagation](#6-error-propagation)
26
- 7. [Deployment Coordination](#7-deployment-coordination)
27
- 8. [Implementation Timeline](#8-implementation-timeline)
28
-
29
- ---
30
-
31
- ## 1. Data Flow Orchestration (6 Dimensions)
32
-
33
- ### Overview
34
-
35
- Every data flow respects the 6-dimension ontology. The DataProvider layer routes requests to the appropriate backend while maintaining ontology consistency.
36
-
37
- ### Architecture Layers
38
-
39
- ```
40
- ┌─────────────────────────────────────────────────────────────┐
41
- │ FRONTEND LAYER │
42
- │ Astro 5 SSR + React 19 Islands + shadcn/ui │
43
- │ Location: /frontend/src/ │
44
- └────────────────────┬────────────────────────────────────────┘
45
- │
46
- ↓ (Hooks: useQuery, useMutation)
47
- ┌─────────────────────────────────────────────────────────────┐
48
- │ DATA PROVIDER LAYER │
49
- │ Interface: IDataProvider (protocol-agnostic) │
50
- │ Implementations: │
51
- │ - ConvexProvider (primary) │
52
- │ - SupabaseProvider (alternative) │
53
- │ - WordPressProvider (CMS integration) │
54
- │ - CompositeProvider (multi-backend federation) │
55
- │ Location: /frontend/src/lib/providers/ │
56
- └────────────────────┬────────────────────────────────────────┘
57
- │
58
- ↓ (API calls, WebSocket subscriptions)
59
- ┌─────────────────────────────────────────────────────────────┐
60
- │ BACKEND LAYER │
61
- │ Convex: Real-time database + typed functions │
62
- │ Schema: 5 tables (entities, connections, events, │
63
- │ knowledge, thingKnowledge) │
64
- │ Auth: Better Auth + session management │
65
- │ Location: /backend/convex/ │
66
- └─────────────────────────────────────────────────────────────┘
67
- ```
68
-
69
- ---
70
-
71
- ### Dimension 1: Organizations (Multi-Tenant Isolation)
72
-
73
- **Data Flow:**
74
-
75
- ```typescript
76
- // Frontend Request
77
- const orgs = useQuery(api.organizations.list);
78
-
79
- // DataProvider Layer
80
- interface IDataProvider {
81
- organizations: {
82
- list(args: { userId: Id<"entities"> }): Promise<Organization[]>;
83
- get(args: { orgId: Id<"entities"> }): Promise<Organization>;
84
- create(args: CreateOrgArgs): Promise<Id<"entities">>;
85
- };
86
- }
87
-
88
- // ConvexProvider Implementation
89
- class ConvexProvider implements IDataProvider {
90
- organizations = {
91
- list: async (args) => {
92
- // Query entities table with type: "organization"
93
- return await this.client.query(api.queries.organizations.list, args);
94
- },
95
- get: async (args) => {
96
- return await this.client.query(api.queries.organizations.get, args);
97
- },
98
- create: async (args) => {
99
- return await this.client.mutation(api.mutations.organizations.create, args);
100
- },
101
- };
102
- }
103
-
104
- // Backend (Convex)
105
- export const list = query({
106
- args: { userId: v.id("entities") },
107
- handler: async (ctx, args) => {
108
- // Get user's organization memberships
109
- const memberships = await ctx.db
110
- .query("connections")
111
- .withIndex("from_type", (q) =>
112
- q.eq("fromThingId", args.userId).eq("relationshipType", "member_of")
113
- )
114
- .collect();
115
-
116
- // Get organization entities
117
- return await Promise.all(
118
- memberships.map((m) => ctx.db.get(m.toThingId))
119
- );
120
- },
121
- });
122
- ```
123
-
124
- **Validation:**
125
-
126
- - ✅ No cross-org data leakage
127
- - ✅ Organization boundaries enforced at backend
128
- - ✅ Provider-agnostic frontend code
129
- - ✅ Multi-tenant isolation maintained
130
-
131
- ---
132
-
133
- ### Dimension 2: People (Authorization & Governance)
134
-
135
- **Data Flow:**
136
-
137
- ```typescript
138
- // Frontend: Auth flow
139
- const { user, session } = useAuth(); // Better Auth client
140
-
141
- // DataProvider Layer
142
- interface IDataProvider {
143
- auth: {
144
- signIn(email: string, password: string): Promise<Session>;
145
- signOut(): Promise<void>;
146
- getCurrentUser(): Promise<Person | null>;
147
- verifyPermissions(userId: Id<"entities">, orgId: Id<"entities">, action: string): Promise<boolean>;
148
- };
149
- }
150
-
151
- // Backend: Auth + Authorization
152
- export const getCurrentUser = query({
153
- args: { token: v.string() },
154
- handler: async (ctx, args) => {
155
- // 1. Verify session token
156
- const session = await ctx.db
157
- .query("sessions")
158
- .withIndex("by_token", (q) => q.eq("token", args.token))
159
- .first();
160
-
161
- if (!session || session.expiresAt < Date.now()) {
162
- return null;
163
- }
164
-
165
- // 2. Get user from Better Auth
166
- const user = await ctx.db.get(session.userId);
167
-
168
- // 3. Get organization memberships
169
- const memberships = await ctx.db
170
- .query("connections")
171
- .withIndex("from_type", (q) =>
172
- q.eq("fromThingId", session.userId).eq("relationshipType", "member_of")
173
- )
174
- .collect();
175
-
176
- return {
177
- ...user,
178
- organizations: memberships.map((m) => ({
179
- orgId: m.toThingId,
180
- role: m.metadata?.role,
181
- permissions: m.metadata?.permissions || [],
182
- })),
183
- };
184
- },
185
- });
186
-
187
- // Authorization check
188
- export const verifyPermissions = query({
189
- args: {
190
- userId: v.id("entities"),
191
- orgId: v.id("entities"),
192
- action: v.string(),
193
- },
194
- handler: async (ctx, args) => {
195
- // Get user's membership in organization
196
- const membership = await ctx.db
197
- .query("connections")
198
- .withIndex("from_type", (q) =>
199
- q.eq("fromThingId", args.userId).eq("relationshipType", "member_of")
200
- )
201
- .filter((q) => q.eq(q.field("toThingId"), args.orgId))
202
- .first();
203
-
204
- if (!membership) return false;
205
-
206
- // Check role-based permissions
207
- const role = membership.metadata?.role;
208
- const permissions = membership.metadata?.permissions || [];
209
-
210
- // org_owner has all permissions
211
- if (role === "org_owner") return true;
212
-
213
- // Check explicit permissions
214
- return permissions.includes(args.action);
215
- },
216
- });
217
- ```
218
-
219
- **Validation:**
220
-
221
- - ✅ Session-based auth via Better Auth
222
- - ✅ Role-based authorization (platform_owner, org_owner, org_user, customer)
223
- - ✅ Permissions enforced at backend
224
- - ✅ Auth tests pass (50+ test cases)
225
-
226
- ---
227
-
228
- ### Dimension 3: Things (Entity Integration)
229
-
230
- **Data Flow:**
231
-
232
- ```typescript
233
- // Frontend Component
234
- export function ThingList({ type }: { type: ThingType }) {
235
- const things = useQuery(api.queries.things.list, { type });
236
-
237
- if (things === undefined) return <Skeleton />;
238
-
239
- return (
240
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
241
- {things.map((thing) => (
242
- <ThingCard key={thing._id} thing={thing} />
243
- ))}
244
- </div>
245
- );
246
- }
247
-
248
- // DataProvider Interface
249
- interface IDataProvider {
250
- things: {
251
- list(args: { type: ThingType; organizationId?: Id<"entities"> }): Promise<Thing[]>;
252
- get(id: Id<"entities">): Promise<Thing>;
253
- create(args: CreateThingArgs): Promise<Id<"entities">>;
254
- update(id: Id<"entities">, updates: Partial<Thing>): Promise<void>;
255
- delete(id: Id<"entities">): Promise<void>;
256
- };
257
- }
258
-
259
- // Generic ThingService (handles all 66 types)
260
- export class ThingService extends Effect.Service<ThingService>()(
261
- "ThingService",
262
- {
263
- effect: Effect.gen(function* () {
264
- const db = yield* ConvexDatabase;
265
-
266
- return {
267
- create: (args: CreateThingArgs) =>
268
- Effect.gen(function* () {
269
- // Validate thing type
270
- if (!isValidThingType(args.type)) {
271
- return yield* Effect.fail(new InvalidThingTypeError());
272
- }
273
-
274
- // Create thing entity
275
- const thingId = yield* Effect.tryPromise(() =>
276
- db.insert("entities", {
277
- type: args.type,
278
- name: args.name,
279
- properties: args.properties,
280
- status: args.status || "draft",
281
- createdAt: Date.now(),
282
- updatedAt: Date.now(),
283
- })
284
- );
285
-
286
- // Create ownership connection
287
- if (args.ownerId) {
288
- yield* Effect.tryPromise(() =>
289
- db.insert("connections", {
290
- fromThingId: args.ownerId,
291
- toThingId: thingId,
292
- relationshipType: "owns",
293
- createdAt: Date.now(),
294
- })
295
- );
296
- }
297
-
298
- // Log creation event
299
- yield* Effect.tryPromise(() =>
300
- db.insert("events", {
301
- type: "entity_created",
302
- actorId: args.ownerId,
303
- targetId: thingId,
304
- timestamp: Date.now(),
305
- metadata: {
306
- entityType: args.type,
307
- },
308
- })
309
- );
310
-
311
- return thingId;
312
- }),
313
-
314
- // Status lifecycle: draft → active → published → archived
315
- updateStatus: (thingId: Id<"entities">, status: ThingStatus) =>
316
- Effect.gen(function* () {
317
- const thing = yield* Effect.tryPromise(() => db.get(thingId));
318
-
319
- // Validate status transition
320
- const validTransitions = {
321
- draft: ["active", "archived"],
322
- active: ["published", "archived"],
323
- published: ["active", "archived"],
324
- archived: [], // Cannot transition from archived
325
- };
326
-
327
- if (!validTransitions[thing.status]?.includes(status)) {
328
- return yield* Effect.fail(new InvalidStatusTransitionError());
329
- }
330
-
331
- // Update status
332
- yield* Effect.tryPromise(() =>
333
- db.patch(thingId, {
334
- status,
335
- updatedAt: Date.now(),
336
- })
337
- );
338
-
339
- // Log status change event
340
- yield* Effect.tryPromise(() =>
341
- db.insert("events", {
342
- type: "entity_updated",
343
- targetId: thingId,
344
- timestamp: Date.now(),
345
- metadata: {
346
- action: "status_changed",
347
- oldStatus: thing.status,
348
- newStatus: status,
349
- },
350
- })
351
- );
352
- }),
353
- };
354
- }),
355
- dependencies: [ConvexDatabase.Default],
356
- }
357
- ) {}
358
- ```
359
-
360
- **Provider-Specific Transformations:**
361
-
362
- ```typescript
363
- // WordPress Provider: Posts → Things
364
- class WordPressProvider implements IDataProvider {
365
- async syncPosts(orgId: Id<"entities">): Promise<void> {
366
- // Fetch posts from WordPress API
367
- const posts = await fetch(`${this.wpUrl}/wp-json/wp/v2/posts`).then((r) =>
368
- r.json()
369
- );
370
-
371
- // Transform to things
372
- for (const post of posts) {
373
- await this.things.create({
374
- type: "blog_post",
375
- name: post.title.rendered,
376
- properties: {
377
- content: post.content.rendered,
378
- excerpt: post.excerpt.rendered,
379
- publishedAt: new Date(post.date).getTime(),
380
- wpId: post.id,
381
- },
382
- status: post.status === "publish" ? "published" : "draft",
383
- ownerId: orgId,
384
- });
385
- }
386
- }
387
- }
388
-
389
- // Notion Provider: Pages → Things
390
- class NotionProvider implements IDataProvider {
391
- async syncPages(orgId: Id<"entities">): Promise<void> {
392
- // Fetch pages from Notion API
393
- const pages = await this.notionClient.search({
394
- filter: { property: "object", value: "page" },
395
- });
396
-
397
- // Transform to things
398
- for (const page of pages.results) {
399
- await this.things.create({
400
- type: "document",
401
- name: page.properties.title?.title[0]?.plain_text || "Untitled",
402
- properties: {
403
- notionId: page.id,
404
- url: page.url,
405
- lastEditedAt: new Date(page.last_edited_time).getTime(),
406
- },
407
- status: "active",
408
- ownerId: orgId,
409
- });
410
- }
411
- }
412
- }
413
- ```
414
-
415
- **Validation:**
416
-
417
- - ✅ Generic ThingService handles all 66 types
418
- - ✅ Status lifecycle enforced (draft → active → published → archived)
419
- - ✅ External providers transform to ontology
420
- - ✅ No custom tables needed
421
-
422
- ---
423
-
424
- ### Dimension 4: Connections (Relationships)
425
-
426
- **Data Flow:**
427
-
428
- ```typescript
429
- // Frontend Component
430
- export function ConnectionGraph({ thingId }: { thingId: Id<"entities"> }) {
431
- const connections = useQuery(api.queries.connections.list, { thingId });
432
-
433
- return (
434
- <div className="relative h-96">
435
- <ForceGraph
436
- nodes={connections?.nodes}
437
- edges={connections?.edges}
438
- onNodeClick={(node) => router.push(`/things/${node.id}`)}
439
- />
440
- </div>
441
- );
442
- }
443
-
444
- // DataProvider Interface
445
- interface IDataProvider {
446
- connections: {
447
- list(args: { thingId: Id<"entities"> }): Promise<Connection[]>;
448
- create(args: CreateConnectionArgs): Promise<Id<"connections">>;
449
- delete(id: Id<"connections">): Promise<void>;
450
- count(args: { thingId: Id<"entities">; relationshipType?: string }): Promise<number>;
451
- };
452
- }
453
-
454
- // Backend: Bidirectional relationships
455
- export const list = query({
456
- args: { thingId: v.id("entities") },
457
- handler: async (ctx, args) => {
458
- // Get outgoing connections
459
- const outgoing = await ctx.db
460
- .query("connections")
461
- .withIndex("from_entity", (q) => q.eq("fromEntityId", args.thingId))
462
- .collect();
463
-
464
- // Get incoming connections
465
- const incoming = await ctx.db
466
- .query("connections")
467
- .withIndex("to_entity", (q) => q.eq("toEntityId", args.thingId))
468
- .collect();
469
-
470
- // Get connected things
471
- const thingIds = [
472
- ...outgoing.map((c) => c.toEntityId),
473
- ...incoming.map((c) => c.fromEntityId),
474
- ];
475
-
476
- const things = await Promise.all(thingIds.map((id) => ctx.db.get(id)));
477
-
478
- // Format for graph visualization
479
- return {
480
- nodes: [
481
- { id: args.thingId, type: "center" },
482
- ...things.map((t) => ({ id: t._id, type: t.type, name: t.name })),
483
- ],
484
- edges: [
485
- ...outgoing.map((c) => ({
486
- from: c.fromEntityId,
487
- to: c.toEntityId,
488
- type: c.relationshipType,
489
- metadata: c.metadata,
490
- })),
491
- ...incoming.map((c) => ({
492
- from: c.fromEntityId,
493
- to: c.toEntityId,
494
- type: c.relationshipType,
495
- metadata: c.metadata,
496
- })),
497
- ],
498
- };
499
- },
500
- });
501
-
502
- // Temporal validity (validFrom/validTo)
503
- export const createTimeLimitedConnection = mutation({
504
- args: {
505
- fromThingId: v.id("entities"),
506
- toThingId: v.id("entities"),
507
- relationshipType: v.string(),
508
- validFrom: v.number(),
509
- validTo: v.number(),
510
- },
511
- handler: async (ctx, args) => {
512
- const connectionId = await ctx.db.insert("connections", {
513
- fromEntityId: args.fromThingId,
514
- toEntityId: args.toThingId,
515
- relationshipType: args.relationshipType,
516
- validFrom: args.validFrom,
517
- validTo: args.validTo,
518
- createdAt: Date.now(),
519
- });
520
-
521
- // Schedule cleanup after validTo
522
- await ctx.scheduler.runAfter(
523
- args.validTo - Date.now(),
524
- internal.connections.expireConnection,
525
- { connectionId }
526
- );
527
-
528
- return connectionId;
529
- },
530
- });
531
-
532
- // Cross-backend connections (Convex person owns WordPress post)
533
- export const linkExternalContent = mutation({
534
- args: {
535
- userId: v.id("entities"),
536
- externalContentId: v.string(), // WordPress post ID
537
- platform: v.string(), // "wordpress"
538
- },
539
- handler: async (ctx, args) => {
540
- // Create external_connection thing
541
- const externalThingId = await ctx.db.insert("entities", {
542
- type: "external_connection",
543
- name: `${args.platform} content ${args.externalContentId}`,
544
- properties: {
545
- platform: args.platform,
546
- externalId: args.externalContentId,
547
- },
548
- status: "active",
549
- createdAt: Date.now(),
550
- updatedAt: Date.now(),
551
- });
552
-
553
- // Create ownership connection
554
- const connectionId = await ctx.db.insert("connections", {
555
- fromEntityId: args.userId,
556
- toEntityId: externalThingId,
557
- relationshipType: "owns",
558
- metadata: {
559
- platform: args.platform,
560
- syncedAt: Date.now(),
561
- },
562
- createdAt: Date.now(),
563
- });
564
-
565
- return { externalThingId, connectionId };
566
- },
567
- });
568
- ```
569
-
570
- **Validation:**
571
-
572
- - ✅ Bidirectional relationships
573
- - ✅ Temporal validity supported
574
- - ✅ Cross-backend connections (Convex ↔ WordPress ↔ Notion)
575
- - ✅ Connection counting and querying
576
-
577
- ---
578
-
579
- ### Dimension 5: Events (Action Tracking)
580
-
581
- **Data Flow:**
582
-
583
- ```typescript
584
- // Frontend Component
585
- export function AuditLog({ thingId }: { thingId: Id<"entities"> }) {
586
- const events = useQuery(api.queries.events.listForThing, { thingId });
587
-
588
- return (
589
- <Timeline>
590
- {events?.map((event) => (
591
- <TimelineItem key={event._id} timestamp={event.timestamp}>
592
- <EventBadge type={event.type} />
593
- <EventDescription event={event} />
594
- <ActorInfo actorId={event.actorId} />
595
- </TimelineItem>
596
- ))}
597
- </Timeline>
598
- );
599
- }
600
-
601
- // DataProvider Interface
602
- interface IDataProvider {
603
- events: {
604
- listForThing(args: { thingId: Id<"entities">; limit?: number }): Promise<Event[]>;
605
- listForActor(args: { actorId: Id<"entities">; limit?: number }): Promise<Event[]>;
606
- create(args: CreateEventArgs): Promise<Id<"events">>;
607
- };
608
- }
609
-
610
- // Backend: Complete audit trail
611
- export const listForThing = query({
612
- args: {
613
- thingId: v.id("entities"),
614
- limit: v.optional(v.number()),
615
- },
616
- handler: async (ctx, args) => {
617
- let query = ctx.db
618
- .query("events")
619
- .withIndex("by_target", (q) => q.eq("targetId", args.thingId))
620
- .order("desc");
621
-
622
- if (args.limit) {
623
- query = query.take(args.limit);
624
- }
625
-
626
- return await query.collect();
627
- },
628
- });
629
-
630
- // Protocol metadata tracking
631
- export const logProtocolEvent = mutation({
632
- args: {
633
- type: v.string(),
634
- actorId: v.id("entities"),
635
- targetId: v.optional(v.id("entities")),
636
- protocol: v.union(
637
- v.literal("a2a"),
638
- v.literal("acp"),
639
- v.literal("ap2"),
640
- v.literal("x402"),
641
- v.literal("ag-ui")
642
- ),
643
- metadata: v.any(),
644
- },
645
- handler: async (ctx, args) => {
646
- return await ctx.db.insert("events", {
647
- type: args.type,
648
- actorId: args.actorId,
649
- targetId: args.targetId,
650
- timestamp: Date.now(),
651
- metadata: {
652
- protocol: args.protocol,
653
- ...args.metadata,
654
- },
655
- });
656
- },
657
- });
658
-
659
- // Event logging spans provider boundaries
660
- class CompositeProvider implements IDataProvider {
661
- async syncData(orgId: Id<"entities">): Promise<void> {
662
- // Sync from WordPress
663
- await this.wordpressProvider.syncPosts(orgId);
664
-
665
- // Log sync event in Convex (central event log)
666
- await this.convexProvider.events.create({
667
- type: "data_synced",
668
- actorId: orgId,
669
- timestamp: Date.now(),
670
- metadata: {
671
- provider: "wordpress",
672
- syncedAt: Date.now(),
673
- },
674
- });
675
-
676
- // Sync from Notion
677
- await this.notionProvider.syncPages(orgId);
678
-
679
- // Log sync event
680
- await this.convexProvider.events.create({
681
- type: "data_synced",
682
- actorId: orgId,
683
- timestamp: Date.now(),
684
- metadata: {
685
- provider: "notion",
686
- syncedAt: Date.now(),
687
- },
688
- });
689
- }
690
- }
691
- ```
692
-
693
- **Validation:**
694
-
695
- - ✅ Complete audit trail for all operations
696
- - ✅ Event logging spans provider boundaries
697
- - ✅ Actor always recorded
698
- - ✅ Metadata includes provider information
699
- - ✅ Protocol events use metadata.protocol
700
-
701
- ---
702
-
703
- ### Dimension 6: Knowledge (Semantic Understanding)
704
-
705
- **Data Flow:**
706
-
707
- ```typescript
708
- // Frontend Component
709
- export function SemanticSearch({ orgId }: { orgId: Id<"entities"> }) {
710
- const [query, setQuery] = useState("");
711
- const results = useQuery(api.queries.knowledge.search, {
712
- query,
713
- orgId,
714
- limit: 20,
715
- });
716
-
717
- return (
718
- <div>
719
- <SearchInput value={query} onChange={setQuery} />
720
- <SearchResults results={results} />
721
- </div>
722
- );
723
- }
724
-
725
- // DataProvider Interface
726
- interface IDataProvider {
727
- knowledge: {
728
- search(args: {
729
- query: string;
730
- orgId: Id<"entities">;
731
- limit?: number;
732
- }): Promise<KnowledgeItem[]>;
733
- embed(text: string, model?: string): Promise<number[]>;
734
- linkToThing(
735
- thingId: Id<"entities">,
736
- knowledgeId: Id<"knowledge">,
737
- role: KnowledgeRole
738
- ): Promise<void>;
739
- };
740
- }
741
-
742
- // Backend-specific implementations
743
-
744
- // Convex: Native vector search
745
- class ConvexProvider implements IDataProvider {
746
- knowledge = {
747
- search: async (args) => {
748
- // Generate query embedding
749
- const queryEmbedding = await this.embed(args.query);
750
-
751
- // Vector search with Convex
752
- const results = await this.client.query(
753
- api.queries.knowledge.vectorSearch,
754
- {
755
- embedding: queryEmbedding,
756
- orgId: args.orgId,
757
- limit: args.limit || 20,
758
- }
759
- );
760
-
761
- return results;
762
- },
763
- };
764
- }
765
-
766
- // Supabase: pgvector
767
- class SupabaseProvider implements IDataProvider {
768
- knowledge = {
769
- search: async (args) => {
770
- // Generate query embedding
771
- const queryEmbedding = await this.embed(args.query);
772
-
773
- // Vector search with pgvector
774
- const { data } = await this.supabase.rpc("match_knowledge", {
775
- query_embedding: queryEmbedding,
776
- org_id: args.orgId,
777
- match_threshold: 0.7,
778
- match_count: args.limit || 20,
779
- });
780
-
781
- return data;
782
- },
783
- };
784
- }
785
-
786
- // RAG Pipeline Integration
787
- export const ingestDocument = internalAction({
788
- args: {
789
- thingId: v.id("entities"),
790
- fields: v.array(v.string()),
791
- },
792
- handler: async (ctx, args) => {
793
- // Get thing
794
- const thing = await ctx.runQuery(internal.things.get, {
795
- id: args.thingId,
796
- });
797
-
798
- // Extract text from fields
799
- const texts = args.fields.map((field) => thing.properties[field]);
800
-
801
- // Chunk text
802
- const chunks = chunkText(texts.join("\n\n"), {
803
- size: 800,
804
- overlap: 200,
805
- });
806
-
807
- // Generate embeddings
808
- for (const [index, chunk] of chunks.entries()) {
809
- const { embedding, model, dim } = await ctx.runAction(
810
- internal.knowledge.embedText,
811
- {
812
- text: chunk.text,
813
- }
814
- );
815
-
816
- // Store knowledge chunk
817
- const knowledgeId = await ctx.runMutation(
818
- internal.knowledge.upsert,
819
- {
820
- item: {
821
- knowledgeType: "chunk",
822
- text: chunk.text,
823
- embedding,
824
- embeddingModel: model,
825
- embeddingDim: dim,
826
- sourceThingId: args.thingId,
827
- sourceField: chunk.field,
828
- chunk: {
829
- index,
830
- tokenCount: chunk.tokens,
831
- overlap: 200,
832
- },
833
- },
834
- }
835
- );
836
-
837
- // Link to thing
838
- await ctx.runMutation(internal.knowledge.linkToThing, {
839
- thingId: args.thingId,
840
- knowledgeId,
841
- role: "chunk_of",
842
- });
843
- }
844
- },
845
- });
846
- ```
847
-
848
- **Unified Search Across Providers:**
849
-
850
- ```typescript
851
- class CompositeProvider implements IDataProvider {
852
- async search(args: SearchArgs): Promise<SearchResults> {
853
- // Search across all backends in parallel
854
- const [convexResults, supabaseResults, notionResults] = await Promise.all([
855
- this.convexProvider.knowledge.search(args),
856
- this.supabaseProvider.knowledge.search(args),
857
- this.notionProvider.knowledge.search(args),
858
- ]);
859
-
860
- // Merge and deduplicate results
861
- const allResults = [
862
- ...convexResults,
863
- ...supabaseResults,
864
- ...notionResults,
865
- ];
866
-
867
- // Sort by relevance score
868
- return allResults
869
- .sort((a, b) => b.score - a.score)
870
- .slice(0, args.limit || 20);
871
- }
872
- }
873
- ```
874
-
875
- **Validation:**
876
-
877
- - ✅ Embeddings and vector search
878
- - ✅ Backend-specific implementations (Convex vectors, Supabase pgvector)
879
- - ✅ Unified search across providers
880
- - ✅ RAG pipeline integration
881
-
882
- ---
883
-
884
- ## 2. Multi-Backend Federation
885
-
886
- ### CompositeProvider Architecture
887
-
888
- ```typescript
889
- // Central orchestrator
890
- export class CompositeProvider implements IDataProvider {
891
- constructor(
892
- private convex: ConvexProvider,
893
- private wordpress: WordPressProvider,
894
- private shopify: ShopifyProvider,
895
- private notion: NotionProvider
896
- ) {}
897
-
898
- // Route requests to appropriate backend
899
- things = {
900
- list: async (args) => {
901
- switch (args.type) {
902
- case "blog_post":
903
- return this.wordpress.things.list(args);
904
- case "product":
905
- return this.shopify.things.list(args);
906
- case "document":
907
- return this.notion.things.list(args);
908
- default:
909
- return this.convex.things.list(args);
910
- }
911
- },
912
-
913
- get: async (id) => {
914
- // Check metadata for provider hint
915
- const metadata = await this.convex.getThingMetadata(id);
916
-
917
- switch (metadata?.provider) {
918
- case "wordpress":
919
- return this.wordpress.things.get(id);
920
- case "shopify":
921
- return this.shopify.things.get(id);
922
- case "notion":
923
- return this.notion.things.get(id);
924
- default:
925
- return this.convex.things.get(id);
926
- }
927
- },
928
- };
929
-
930
- // Federated queries
931
- async searchAcrossBackends(query: string): Promise<Thing[]> {
932
- const results = await Promise.all([
933
- this.convex.search(query),
934
- this.wordpress.search(query),
935
- this.shopify.search(query),
936
- this.notion.search(query),
937
- ]);
938
-
939
- return results.flat();
940
- }
941
- }
942
- ```
943
-
944
- ### Backend Routing Rules
945
-
946
- | Thing Type | Primary Backend | Sync Strategy |
947
- |------------|----------------|---------------|
948
- | `creator`, `organization`, `agent`, `token` | Convex | Native |
949
- | `blog_post`, `social_post` | WordPress | Read-only sync to Convex |
950
- | `product`, `payment`, `subscription` | Shopify | Event-driven sync |
951
- | `document`, `knowledge_item` | Notion | Bidirectional sync |
952
-
953
- ### Cross-Backend Consistency
954
-
955
- ```typescript
956
- // Event-driven sync pattern
957
- export const syncWordPressPost = internalAction({
958
- args: { wpPostId: v.string() },
959
- handler: async (ctx, args) => {
960
- // 1. Fetch from WordPress
961
- const wpPost = await fetchWordPressPost(args.wpPostId);
962
-
963
- // 2. Create/update in Convex
964
- const thingId = await ctx.runMutation(internal.things.upsert, {
965
- externalId: args.wpPostId,
966
- type: "blog_post",
967
- name: wpPost.title.rendered,
968
- properties: {
969
- content: wpPost.content.rendered,
970
- wpId: wpPost.id,
971
- syncedAt: Date.now(),
972
- },
973
- });
974
-
975
- // 3. Log sync event
976
- await ctx.runMutation(internal.events.create, {
977
- type: "data_synced",
978
- targetId: thingId,
979
- timestamp: Date.now(),
980
- metadata: {
981
- provider: "wordpress",
982
- externalId: args.wpPostId,
983
- },
984
- });
985
-
986
- return thingId;
987
- },
988
- });
989
-
990
- // Webhook handler for real-time sync
991
- export const handleWordPressWebhook = httpAction(async (ctx, request) => {
992
- const payload = await request.json();
993
-
994
- // Schedule sync for updated post
995
- await ctx.scheduler.runAfter(0, internal.sync.syncWordPressPost, {
996
- wpPostId: payload.id,
997
- });
998
-
999
- return new Response("OK", { status: 200 });
1000
- });
1001
- ```
1002
-
1003
- ### Validation
1004
-
1005
- - ✅ Single frontend queries all backends transparently
1006
- - ✅ Cross-backend connections maintained
1007
- - ✅ Event-driven sync prevents stale data
1008
- - ✅ Webhook integration for real-time updates
1009
-
1010
- ---
1011
-
1012
- ## 3. Real-Time Coordination
1013
-
1014
- ### Real-Time Strategy by Backend
1015
-
1016
- | Backend | Native Support | Implementation |
1017
- |---------|---------------|----------------|
1018
- | **Convex** | Native WebSocket | `useQuery` hook (automatic subscriptions) |
1019
- | **Supabase** | PostgreSQL real-time | `realtime` subscriptions |
1020
- | **WordPress** | None | Polling fallback (30s intervals) |
1021
- | **Notion** | None | Webhook-based updates |
1022
-
1023
- ### Frontend Real-Time Coordination
1024
-
1025
- ```typescript
1026
- // useRealtimeData hook (provider-agnostic)
1027
- export function useRealtimeData<T>(
1028
- provider: IDataProvider,
1029
- query: Query,
1030
- options?: { pollInterval?: number }
1031
- ) {
1032
- const [data, setData] = useState<T | undefined>();
1033
- const [loading, setLoading] = useState(true);
1034
-
1035
- useEffect(() => {
1036
- // Check if provider supports real-time
1037
- if (provider.supportsRealtime) {
1038
- // Subscribe to real-time updates
1039
- const unsubscribe = provider.subscribe(query, (newData) => {
1040
- setData(newData);
1041
- setLoading(false);
1042
- });
1043
-
1044
- return unsubscribe;
1045
- } else {
1046
- // Fallback to polling
1047
- const fetchData = async () => {
1048
- const result = await provider.query(query);
1049
- setData(result);
1050
- setLoading(false);
1051
- };
1052
-
1053
- fetchData();
1054
- const interval = setInterval(fetchData, options?.pollInterval || 30000);
1055
-
1056
- return () => clearInterval(interval);
1057
- }
1058
- }, [provider, query]);
1059
-
1060
- return { data, loading };
1061
- }
1062
-
1063
- // Usage (works with any provider)
1064
- export function Dashboard() {
1065
- const provider = useDataProvider(); // Context
1066
- const stats = useRealtimeData<DashboardStats>(provider, {
1067
- type: "dashboard_stats",
1068
- orgId: currentOrgId,
1069
- });
1070
-
1071
- return <StatsDisplay data={stats.data} loading={stats.loading} />;
1072
- }
1073
- ```
1074
-
1075
- ### Convex Real-Time (Preferred)
1076
-
1077
- ```typescript
1078
- // Native Convex subscriptions
1079
- export function RealtimeDashboard({ orgId }: { orgId: Id<"entities"> }) {
1080
- // Automatic WebSocket subscription - no additional code needed
1081
- const stats = useQuery(api.queries.dashboard.getStats, { orgId });
1082
-
1083
- return <DashboardStats data={stats} />;
1084
- }
1085
- ```
1086
-
1087
- ### Supabase Real-Time
1088
-
1089
- ```typescript
1090
- // Supabase realtime subscriptions
1091
- class SupabaseProvider implements IDataProvider {
1092
- subscribe(query: Query, callback: (data: any) => void) {
1093
- const channel = this.supabase
1094
- .channel("db-changes")
1095
- .on(
1096
- "postgres_changes",
1097
- {
1098
- event: "*",
1099
- schema: "public",
1100
- table: query.table,
1101
- },
1102
- (payload) => {
1103
- callback(payload.new);
1104
- }
1105
- )
1106
- .subscribe();
1107
-
1108
- return () => {
1109
- channel.unsubscribe();
1110
- };
1111
- }
1112
- }
1113
- ```
1114
-
1115
- ### Polling Fallback (WordPress/Notion)
1116
-
1117
- ```typescript
1118
- // Polling for backends without real-time
1119
- class WordPressProvider implements IDataProvider {
1120
- supportsRealtime = false;
1121
-
1122
- async query(query: Query): Promise<any> {
1123
- // Fetch data from WordPress API
1124
- const response = await fetch(
1125
- `${this.wpUrl}/wp-json/wp/v2/${query.endpoint}`
1126
- );
1127
- return response.json();
1128
- }
1129
- }
1130
- ```
1131
-
1132
- ### Validation
1133
-
1134
- - ✅ Convex: Native WebSocket support
1135
- - ✅ Supabase: PostgreSQL real-time
1136
- - ✅ WordPress: Polling fallback (no native real-time)
1137
- - ✅ Notion: Webhook-based updates
1138
- - ✅ Frontend receives updates regardless of backend
1139
-
1140
- ---
1141
-
1142
- ## 4. Migration Coordination (7 Phases)
1143
-
1144
- ### Overview
1145
-
1146
- Zero-downtime migration with gradual rollout and complete test coverage.
1147
-
1148
- ### Phase 1: Interface Definition (Week 1)
1149
-
1150
- **Goal:** Define `IDataProvider` interface
1151
-
1152
- **Deliverables:**
1153
-
1154
- ```typescript
1155
- // /frontend/src/lib/providers/interface.ts
1156
- export interface IDataProvider {
1157
- // 6-Dimension Operations
1158
- organizations: OrganizationOperations;
1159
- people: PeopleOperations;
1160
- things: ThingOperations;
1161
- connections: ConnectionOperations;
1162
- events: EventOperations;
1163
- knowledge: KnowledgeOperations;
1164
-
1165
- // Metadata
1166
- name: string;
1167
- supportsRealtime: boolean;
1168
- capabilities: string[];
1169
-
1170
- // Lifecycle
1171
- initialize(): Promise<void>;
1172
- disconnect(): Promise<void>;
1173
-
1174
- // Real-time (optional)
1175
- subscribe?(query: Query, callback: (data: any) => void): () => void;
1176
- }
1177
-
1178
- // Complete type definitions
1179
- export interface ThingOperations {
1180
- list(args: ListThingsArgs): Promise<Thing[]>;
1181
- get(id: Id<"entities">): Promise<Thing>;
1182
- create(args: CreateThingArgs): Promise<Id<"entities">>;
1183
- update(id: Id<"entities">, updates: Partial<Thing>): Promise<void>;
1184
- delete(id: Id<"entities">): Promise<void>;
1185
- }
1186
-
1187
- // ... similar for other dimensions
1188
- ```
1189
-
1190
- **Tests:**
1191
-
1192
- - ✅ Interface compiles
1193
- - ✅ All method signatures defined
1194
- - ✅ Type safety enforced
1195
-
1196
- **Coordination:** Backend Specialist reviews interface
1197
-
1198
- ---
1199
-
1200
- ### Phase 2: ConvexProvider (Week 2)
1201
-
1202
- **Goal:** Implement ConvexProvider (maintain 100% backward compatibility)
1203
-
1204
- **Deliverables:**
1205
-
1206
- ```typescript
1207
- // /frontend/src/lib/providers/convex.ts
1208
- export class ConvexProvider implements IDataProvider {
1209
- constructor(private client: ConvexReactClient) {}
1210
-
1211
- name = "convex";
1212
- supportsRealtime = true;
1213
- capabilities = ["organizations", "people", "things", "connections", "events", "knowledge"];
1214
-
1215
- organizations = {
1216
- list: async (args) => {
1217
- return await this.client.query(api.queries.organizations.list, args);
1218
- },
1219
- // ... all operations
1220
- };
1221
-
1222
- // ... implement all 6 dimensions
1223
- }
1224
- ```
1225
-
1226
- **Tests:**
1227
-
1228
- ```typescript
1229
- // tests/integration/providers/convex.test.ts
1230
- describe("ConvexProvider", () => {
1231
- it("should implement all 6 dimensions", () => {
1232
- const provider = new ConvexProvider(mockClient);
1233
- expect(provider.organizations).toBeDefined();
1234
- expect(provider.people).toBeDefined();
1235
- expect(provider.things).toBeDefined();
1236
- expect(provider.connections).toBeDefined();
1237
- expect(provider.events).toBeDefined();
1238
- expect(provider.knowledge).toBeDefined();
1239
- });
1240
-
1241
- it("should query organizations correctly", async () => {
1242
- const provider = new ConvexProvider(mockClient);
1243
- const orgs = await provider.organizations.list({ userId: "user_123" });
1244
- expect(orgs).toBeInstanceOf(Array);
1245
- });
1246
-
1247
- // ... test all operations
1248
- });
1249
- ```
1250
-
1251
- **Coordination:**
1252
-
1253
- - Frontend Specialist reviews implementation
1254
- - Backend Specialist validates backend queries
1255
- - Quality Agent validates test coverage
1256
-
1257
- **Migration Validation:** No breaking changes to existing code
1258
-
1259
- ---
1260
-
1261
- ### Phase 3: Service Layer (Week 3)
1262
-
1263
- **Goal:** Implement Effect.ts services (pure business logic)
1264
-
1265
- **Deliverables:**
1266
-
1267
- ```typescript
1268
- // /backend/convex/services/organizations/organization-service.ts
1269
- export class OrganizationService extends Effect.Service<OrganizationService>()(
1270
- "OrganizationService",
1271
- {
1272
- effect: Effect.gen(function* () {
1273
- const db = yield* ConvexDatabase;
1274
-
1275
- return {
1276
- create: (args: CreateOrgArgs) =>
1277
- Effect.gen(function* () {
1278
- // Validate
1279
- if (!args.name) {
1280
- return yield* Effect.fail(new InvalidOrgNameError());
1281
- }
1282
-
1283
- // Create organization entity
1284
- const orgId = yield* Effect.tryPromise(() =>
1285
- db.insert("entities", {
1286
- type: "organization",
1287
- name: args.name,
1288
- properties: {
1289
- slug: slugify(args.name),
1290
- plan: args.plan || "starter",
1291
- status: "trial",
1292
- },
1293
- status: "active",
1294
- createdAt: Date.now(),
1295
- updatedAt: Date.now(),
1296
- })
1297
- );
1298
-
1299
- // Create ownership connection
1300
- yield* Effect.tryPromise(() =>
1301
- db.insert("connections", {
1302
- fromThingId: args.ownerId,
1303
- toThingId: orgId,
1304
- relationshipType: "owns",
1305
- metadata: { role: "org_owner" },
1306
- createdAt: Date.now(),
1307
- })
1308
- );
1309
-
1310
- // Log creation event
1311
- yield* Effect.tryPromise(() =>
1312
- db.insert("events", {
1313
- type: "organization_created",
1314
- actorId: args.ownerId,
1315
- targetId: orgId,
1316
- timestamp: Date.now(),
1317
- metadata: {
1318
- plan: args.plan || "starter",
1319
- },
1320
- })
1321
- );
1322
-
1323
- return orgId;
1324
- }),
1325
- };
1326
- }),
1327
- dependencies: [ConvexDatabase.Default],
1328
- }
1329
- ) {}
1330
- ```
1331
-
1332
- **Tests:**
1333
-
1334
- ```typescript
1335
- // tests/unit/services/organization.test.ts
1336
- describe("OrganizationService.create", () => {
1337
- it("should create organization with owner connection", async () => {
1338
- const MockDB = Layer.succeed(ConvexDatabase, mockDatabase);
1339
-
1340
- const result = await Effect.runPromise(
1341
- Effect.gen(function* () {
1342
- const service = yield* OrganizationService;
1343
- return yield* service.create({
1344
- name: "Acme Corp",
1345
- ownerId: "user_123",
1346
- plan: "pro",
1347
- });
1348
- }).pipe(Effect.provide(MockDB))
1349
- );
1350
-
1351
- expect(result).toBe("org_456");
1352
- expect(mockDatabase.insert).toHaveBeenCalledWith("entities", expect.objectContaining({
1353
- type: "organization",
1354
- name: "Acme Corp",
1355
- }));
1356
- });
1357
- });
1358
- ```
1359
-
1360
- **Coordination:**
1361
-
1362
- - Backend Specialist implements services
1363
- - Integration Specialist ensures ontology alignment
1364
- - Quality Agent validates unit tests
1365
-
1366
- ---
1367
-
1368
- ### Phase 4: Configuration (Week 4)
1369
-
1370
- **Goal:** Add provider configuration and selection
1371
-
1372
- **Deliverables:**
1373
-
1374
- ```typescript
1375
- // /frontend/src/lib/providers/config.ts
1376
- export interface ProviderConfig {
1377
- default: "convex" | "supabase" | "composite";
1378
- convex?: {
1379
- url: string;
1380
- };
1381
- supabase?: {
1382
- url: string;
1383
- anonKey: string;
1384
- };
1385
- wordpress?: {
1386
- url: string;
1387
- apiKey: string;
1388
- };
1389
- }
1390
-
1391
- export const providerConfig: ProviderConfig = {
1392
- default: import.meta.env.PUBLIC_DEFAULT_PROVIDER || "convex",
1393
- convex: {
1394
- url: import.meta.env.PUBLIC_CONVEX_URL,
1395
- },
1396
- supabase: {
1397
- url: import.meta.env.PUBLIC_SUPABASE_URL,
1398
- anonKey: import.meta.env.PUBLIC_SUPABASE_ANON_KEY,
1399
- },
1400
- };
1401
-
1402
- // Provider factory
1403
- export function createProvider(config: ProviderConfig): IDataProvider {
1404
- switch (config.default) {
1405
- case "convex":
1406
- return new ConvexProvider(
1407
- new ConvexReactClient(config.convex.url)
1408
- );
1409
- case "supabase":
1410
- return new SupabaseProvider(
1411
- createClient(config.supabase.url, config.supabase.anonKey)
1412
- );
1413
- case "composite":
1414
- return new CompositeProvider({
1415
- convex: new ConvexProvider(...),
1416
- wordpress: new WordPressProvider(...),
1417
- // ...
1418
- });
1419
- default:
1420
- throw new Error(`Unknown provider: ${config.default}`);
1421
- }
1422
- }
1423
-
1424
- // React Context
1425
- export const DataProviderContext = createContext<IDataProvider | null>(null);
1426
-
1427
- export function DataProviderProvider({ children }: { children: ReactNode }) {
1428
- const provider = useMemo(() => createProvider(providerConfig), []);
1429
-
1430
- useEffect(() => {
1431
- provider.initialize();
1432
- return () => provider.disconnect();
1433
- }, [provider]);
1434
-
1435
- return (
1436
- <DataProviderContext.Provider value={provider}>
1437
- {children}
1438
- </DataProviderContext.Provider>
1439
- );
1440
- }
1441
-
1442
- export function useDataProvider(): IDataProvider {
1443
- const provider = useContext(DataProviderContext);
1444
- if (!provider) throw new Error("DataProvider not initialized");
1445
- return provider;
1446
- }
1447
- ```
1448
-
1449
- **Tests:**
1450
-
1451
- ```typescript
1452
- // tests/integration/providers/config.test.ts
1453
- describe("Provider Configuration", () => {
1454
- it("should create ConvexProvider when configured", () => {
1455
- const config: ProviderConfig = { default: "convex", convex: { url: "https://test.convex.cloud" } };
1456
- const provider = createProvider(config);
1457
- expect(provider.name).toBe("convex");
1458
- });
1459
-
1460
- it("should switch providers via config", () => {
1461
- const convexProvider = createProvider({ default: "convex", convex: { url: "..." } });
1462
- const supabaseProvider = createProvider({ default: "supabase", supabase: { url: "...", anonKey: "..." } });
1463
-
1464
- expect(convexProvider.name).toBe("convex");
1465
- expect(supabaseProvider.name).toBe("supabase");
1466
- });
1467
- });
1468
- ```
1469
-
1470
- **Coordination:**
1471
-
1472
- - Frontend Specialist implements configuration
1473
- - Backend Specialist validates backend compatibility
1474
- - Integration Specialist ensures smooth switching
1475
-
1476
- ---
1477
-
1478
- ### Phase 5: Component Migration (Weeks 5-6)
1479
-
1480
- **Goal:** Migrate components to use DataProvider
1481
-
1482
- **Strategy:** Gradual page-by-page migration
1483
-
1484
- ```typescript
1485
- // Before (direct Convex usage)
1486
- export function OrganizationList() {
1487
- const orgs = useQuery(api.queries.organizations.list);
1488
- return <div>{orgs?.map(...)}</div>;
1489
- }
1490
-
1491
- // After (provider-agnostic)
1492
- export function OrganizationList() {
1493
- const provider = useDataProvider();
1494
- const [orgs, setOrgs] = useState([]);
1495
-
1496
- useEffect(() => {
1497
- provider.organizations.list({ userId: currentUserId }).then(setOrgs);
1498
- }, [provider]);
1499
-
1500
- return <div>{orgs.map(...)}</div>;
1501
- }
1502
-
1503
- // Or use custom hook
1504
- export function useOrganizations() {
1505
- const provider = useDataProvider();
1506
- return useRealtimeData(provider, { type: "organizations" });
1507
- }
1508
-
1509
- export function OrganizationList() {
1510
- const { data: orgs } = useOrganizations();
1511
- return <div>{orgs?.map(...)}</div>;
1512
- }
1513
- ```
1514
-
1515
- **Migration Checklist (Per Page):**
1516
-
1517
- - [ ] Replace `useQuery(api.*)` with `useDataProvider()`
1518
- - [ ] Replace `useMutation(api.*)` with `provider.*.create/update/delete`
1519
- - [ ] Update loading/error states
1520
- - [ ] Add real-time support via `useRealtimeData`
1521
- - [ ] Test with Convex (backward compatibility)
1522
- - [ ] Test with alternative provider (if available)
1523
- - [ ] Run integration tests
1524
-
1525
- **Migration Order:**
1526
-
1527
- 1. **Week 5:** Non-critical pages
1528
- - `/about`, `/docs`, `/blog` (static content)
1529
- - `/account/settings` (user preferences)
1530
- - `/tokens/[id]` (read-only)
1531
-
1532
- 2. **Week 6:** Critical pages
1533
- - `/dashboard` (organization stats)
1534
- - `/account` (auth flows)
1535
- - `/admin` (platform owner dashboard)
1536
-
1537
- **Validation:** Run auth tests after EVERY migration
1538
-
1539
- **Coordination:**
1540
-
1541
- - Frontend Specialist implements migrations
1542
- - Quality Agent validates tests after each page
1543
- - Integration Specialist monitors for regressions
1544
-
1545
- ---
1546
-
1547
- ### Phase 6: Cleanup (Week 7)
1548
-
1549
- **Goal:** Remove old dependencies and code
1550
-
1551
- **Tasks:**
1552
-
1553
- 1. Remove direct Convex imports from components:
1554
-
1555
- ```bash
1556
- # Find all direct Convex usage
1557
- grep -r "from \"convex/react\"" frontend/src/components/
1558
- grep -r "api.queries" frontend/src/components/
1559
- grep -r "api.mutations" frontend/src/components/
1560
-
1561
- # Remove unused imports
1562
- ```
1563
-
1564
- 2. Update package.json:
1565
-
1566
- ```json
1567
- {
1568
- "dependencies": {
1569
- "convex": "^1.16.5", // Keep for backend communication
1570
- // Remove any unused provider dependencies
1571
- }
1572
- }
1573
- ```
1574
-
1575
- 3. Consolidate provider exports:
1576
-
1577
- ```typescript
1578
- // /frontend/src/lib/providers/index.ts
1579
- export { IDataProvider } from "./interface";
1580
- export { ConvexProvider } from "./convex";
1581
- export { SupabaseProvider } from "./supabase";
1582
- export { CompositeProvider } from "./composite";
1583
- export { useDataProvider, DataProviderProvider } from "./config";
1584
- ```
1585
-
1586
- 4. Run comprehensive tests:
1587
-
1588
- ```bash
1589
- # Auth tests (must pass 100%)
1590
- bun test test/auth
1591
-
1592
- # Integration tests
1593
- bun test test/integration/providers
1594
-
1595
- # Build test
1596
- bun run build
1597
- ```
1598
-
1599
- **Coordination:**
1600
-
1601
- - Frontend Specialist performs cleanup
1602
- - Quality Agent validates all tests pass
1603
- - Integration Specialist approves final state
1604
-
1605
- ---
1606
-
1607
- ### Phase 7: Alternative Providers (Week 8+)
1608
-
1609
- **Goal:** Implement alternative providers (Supabase, WordPress, Notion)
1610
-
1611
- **SupabaseProvider:**
1612
-
1613
- ```typescript
1614
- // /frontend/src/lib/providers/supabase.ts
1615
- export class SupabaseProvider implements IDataProvider {
1616
- constructor(private client: SupabaseClient) {}
1617
-
1618
- name = "supabase";
1619
- supportsRealtime = true;
1620
- capabilities = ["organizations", "people", "things", "connections", "events", "knowledge"];
1621
-
1622
- organizations = {
1623
- list: async (args) => {
1624
- const { data, error } = await this.client
1625
- .from("entities")
1626
- .select("*")
1627
- .eq("type", "organization")
1628
- .in("_id", args.orgIds);
1629
-
1630
- if (error) throw error;
1631
- return data;
1632
- },
1633
- // ... all operations
1634
- };
1635
-
1636
- // Real-time subscriptions
1637
- subscribe(query: Query, callback: (data: any) => void) {
1638
- const channel = this.client
1639
- .channel("db-changes")
1640
- .on("postgres_changes", { event: "*", schema: "public", table: query.table }, callback)
1641
- .subscribe();
1642
-
1643
- return () => channel.unsubscribe();
1644
- }
1645
- }
1646
- ```
1647
-
1648
- **WordPressProvider:**
1649
-
1650
- ```typescript
1651
- // /frontend/src/lib/providers/wordpress.ts
1652
- export class WordPressProvider implements IDataProvider {
1653
- constructor(private wpUrl: string, private apiKey: string) {}
1654
-
1655
- name = "wordpress";
1656
- supportsRealtime = false;
1657
- capabilities = ["things"]; // Read-only blog posts
1658
-
1659
- things = {
1660
- list: async (args) => {
1661
- if (args.type !== "blog_post") {
1662
- throw new Error("WordPress only supports blog_post type");
1663
- }
1664
-
1665
- const response = await fetch(`${this.wpUrl}/wp-json/wp/v2/posts`, {
1666
- headers: { Authorization: `Bearer ${this.apiKey}` },
1667
- });
1668
-
1669
- const posts = await response.json();
1670
-
1671
- // Transform WordPress posts to things
1672
- return posts.map((post: any) => ({
1673
- _id: `wp_${post.id}`,
1674
- type: "blog_post",
1675
- name: post.title.rendered,
1676
- properties: {
1677
- content: post.content.rendered,
1678
- wpId: post.id,
1679
- },
1680
- status: post.status === "publish" ? "published" : "draft",
1681
- createdAt: new Date(post.date).getTime(),
1682
- updatedAt: new Date(post.modified).getTime(),
1683
- }));
1684
- },
1685
- };
1686
- }
1687
- ```
1688
-
1689
- **CompositeProvider:**
1690
-
1691
- ```typescript
1692
- // /frontend/src/lib/providers/composite.ts
1693
- export class CompositeProvider implements IDataProvider {
1694
- constructor(private providers: {
1695
- convex: ConvexProvider;
1696
- wordpress?: WordPressProvider;
1697
- shopify?: ShopifyProvider;
1698
- notion?: NotionProvider;
1699
- }) {}
1700
-
1701
- name = "composite";
1702
- supportsRealtime = true;
1703
- capabilities = ["organizations", "people", "things", "connections", "events", "knowledge"];
1704
-
1705
- things = {
1706
- list: async (args) => {
1707
- // Route to appropriate provider
1708
- switch (args.type) {
1709
- case "blog_post":
1710
- return this.providers.wordpress?.things.list(args) || [];
1711
- case "product":
1712
- return this.providers.shopify?.things.list(args) || [];
1713
- default:
1714
- return this.providers.convex.things.list(args);
1715
- }
1716
- },
1717
- };
1718
- }
1719
- ```
1720
-
1721
- **Tests:**
1722
-
1723
- ```typescript
1724
- // tests/integration/providers/supabase.test.ts
1725
- describe("SupabaseProvider", () => {
1726
- it("should implement all 6 dimensions", () => {
1727
- const provider = new SupabaseProvider(mockClient);
1728
- expect(provider.organizations).toBeDefined();
1729
- // ... test all dimensions
1730
- });
1731
-
1732
- it("should support real-time subscriptions", (done) => {
1733
- const provider = new SupabaseProvider(mockClient);
1734
- const unsubscribe = provider.subscribe({ table: "entities" }, (data) => {
1735
- expect(data).toBeDefined();
1736
- unsubscribe();
1737
- done();
1738
- });
1739
- });
1740
- });
1741
- ```
1742
-
1743
- **Coordination:**
1744
-
1745
- - Integration Specialist implements providers
1746
- - Backend Specialist validates backend compatibility
1747
- - Frontend Specialist validates frontend integration
1748
- - Quality Agent validates test coverage
1749
-
1750
- ---
1751
-
1752
- ## 5. Testing Integration
1753
-
1754
- ### Test Hierarchy
1755
-
1756
- ```
1757
- Unit Tests (services/)
1758
- ↓
1759
- Integration Tests (providers/)
1760
- ↓
1761
- E2E Tests (user journeys)
1762
- ↓
1763
- Performance Tests (context usage, latency)
1764
- ```
1765
-
1766
- ### Unit Tests (Services)
1767
-
1768
- **Location:** `/backend/tests/unit/services/`
1769
-
1770
- **Coverage:** Business logic in Effect.ts services
1771
-
1772
- ```typescript
1773
- // tests/unit/services/organization.test.ts
1774
- describe("OrganizationService", () => {
1775
- it("should create organization with owner connection and event", async () => {
1776
- const MockDB = Layer.succeed(ConvexDatabase, {
1777
- insert: vi.fn().mockResolvedValue("org_123"),
1778
- get: vi.fn().mockResolvedValue({ _id: "user_123", type: "creator" }),
1779
- });
1780
-
1781
- const result = await Effect.runPromise(
1782
- Effect.gen(function* () {
1783
- const service = yield* OrganizationService;
1784
- return yield* service.create({
1785
- name: "Acme Corp",
1786
- ownerId: "user_123",
1787
- plan: "pro",
1788
- });
1789
- }).pipe(Effect.provide(MockDB))
1790
- );
1791
-
1792
- expect(result).toBe("org_123");
1793
- });
1794
-
1795
- it("should fail with InvalidOrgNameError when name is empty", async () => {
1796
- const result = await Effect.runPromise(
1797
- Effect.gen(function* () {
1798
- const service = yield* OrganizationService;
1799
- return yield* service.create({ name: "", ownerId: "user_123" });
1800
- }).pipe(Effect.provide(TestLayer))
1801
- );
1802
-
1803
- expect(result).toBeInstanceOf(InvalidOrgNameError);
1804
- });
1805
- });
1806
- ```
1807
-
1808
- ### Integration Tests (Providers)
1809
-
1810
- **Location:** `/frontend/test/integration/providers/`
1811
-
1812
- **Coverage:** Frontend → Provider → Backend flows
1813
-
1814
- ```typescript
1815
- // test/integration/providers/convex.test.ts
1816
- describe("ConvexProvider Integration", () => {
1817
- it("should create organization and retrieve it", async () => {
1818
- const provider = new ConvexProvider(testClient);
1819
-
1820
- // Create organization
1821
- const orgId = await provider.organizations.create({
1822
- name: "Test Org",
1823
- ownerId: "user_123",
1824
- plan: "starter",
1825
- });
1826
-
1827
- expect(orgId).toBeDefined();
1828
-
1829
- // Retrieve organization
1830
- const org = await provider.organizations.get({ orgId });
1831
-
1832
- expect(org.name).toBe("Test Org");
1833
- expect(org.properties.plan).toBe("starter");
1834
- });
1835
-
1836
- it("should enforce organization boundaries", async () => {
1837
- const provider = new ConvexProvider(testClient);
1838
-
1839
- // User A creates org
1840
- const orgA = await provider.organizations.create({
1841
- name: "Org A",
1842
- ownerId: "user_a",
1843
- });
1844
-
1845
- // User B tries to access Org A's data
1846
- const things = await provider.things.list({
1847
- type: "blog_post",
1848
- organizationId: orgA,
1849
- userId: "user_b",
1850
- });
1851
-
1852
- expect(things).toEqual([]); // No access
1853
- });
1854
- });
1855
- ```
1856
-
1857
- ### E2E Tests (User Journeys)
1858
-
1859
- **Location:** `/frontend/test/e2e/`
1860
-
1861
- **Coverage:** Complete user workflows
1862
-
1863
- ```typescript
1864
- // test/e2e/organization-creation.test.ts
1865
- describe("Organization Creation Flow", () => {
1866
- it("should create organization from dashboard", async ({ page }) => {
1867
- // Sign in
1868
- await page.goto("/account/signin");
1869
- await page.fill('input[name="email"]', "test@example.com");
1870
- await page.fill('input[name="password"]', "password123");
1871
- await page.click('button[type="submit"]');
1872
-
1873
- // Navigate to create organization
1874
- await page.goto("/admin/organizations/new");
1875
-
1876
- // Fill form
1877
- await page.fill('input[name="name"]', "E2E Test Org");
1878
- await page.selectOption('select[name="plan"]', "pro");
1879
-
1880
- // Submit
1881
- await page.click('button[type="submit"]');
1882
-
1883
- // Verify creation
1884
- await page.waitForURL("/admin/organizations/*");
1885
- await expect(page.locator("h1")).toContainText("E2E Test Org");
1886
- });
1887
- });
1888
- ```
1889
-
1890
- ### Performance Tests
1891
-
1892
- **Location:** `/frontend/test/performance/`
1893
-
1894
- **Coverage:** Context usage, latency, throughput
1895
-
1896
- ```typescript
1897
- // test/performance/context-usage.test.ts
1898
- describe("Context Usage", () => {
1899
- it("should stay within token budget", async () => {
1900
- const provider = new ConvexProvider(testClient);
1901
-
1902
- // Measure request size
1903
- const request = await provider.things.list({ type: "creator" });
1904
- const requestSize = JSON.stringify(request).length;
1905
-
1906
- expect(requestSize).toBeLessThan(1500); // 1.5KB limit
1907
- });
1908
-
1909
- it("should respond within latency budget", async () => {
1910
- const provider = new ConvexProvider(testClient);
1911
-
1912
- const start = Date.now();
1913
- await provider.organizations.list({ userId: "user_123" });
1914
- const latency = Date.now() - start;
1915
-
1916
- expect(latency).toBeLessThan(100); // 100ms limit
1917
- });
1918
- });
1919
- ```
1920
-
1921
- ### Auth Test Preservation
1922
-
1923
- **Critical:** Run auth tests after EVERY migration step
1924
-
1925
- ```bash
1926
- # Run all auth tests
1927
- bun test test/auth
1928
-
1929
- # Specific auth method tests
1930
- bun test test/auth/email-password.test.ts
1931
- bun test test/auth/oauth.test.ts
1932
- bun test test/auth/magic-link.test.ts
1933
- bun test test/auth/password-reset.test.ts
1934
-
1935
- # Watch mode during migration
1936
- bun test --watch test/auth
1937
- ```
1938
-
1939
- **Auth Test Categories:**
1940
-
1941
- 1. ✅ Email & Password (signup, signin, validation)
1942
- 2. ✅ OAuth (GitHub, Google, account linking)
1943
- 3. ✅ Magic Links (passwordless, one-time use)
1944
- 4. ✅ Password Reset (token expiry, security)
1945
- 5. ✅ Email Verification (24h expiry)
1946
- 6. ✅ 2FA/TOTP (setup, backup codes)
1947
-
1948
- **Test Coverage Goals:**
1949
-
1950
- - Unit tests: 90%+ coverage
1951
- - Integration tests: All 6 dimensions covered
1952
- - E2E tests: Critical user journeys (auth, org creation, data CRUD)
1953
- - Performance tests: Context < 1.5KB, Latency < 100ms
1954
- - Auth tests: 100% pass rate (50+ test cases)
1955
-
1956
- **Coordination:**
1957
-
1958
- - Quality Agent owns test execution
1959
- - Integration Specialist validates integration tests
1960
- - Frontend Specialist validates E2E tests
1961
- - Backend Specialist validates unit tests
1962
-
1963
- ---
1964
-
1965
- ## 6. Error Propagation
1966
-
1967
- ### Error Flow Architecture
1968
-
1969
- ```
1970
- Backend Error → Provider Error → Frontend Display
1971
- ```
1972
-
1973
- ### Backend Errors (Effect.ts)
1974
-
1975
- ```typescript
1976
- // /backend/convex/services/errors.ts
1977
- import { Data } from "effect";
1978
-
1979
- // Base error with protocol support
1980
- export class ServiceError extends Data.TaggedError("ServiceError")<{
1981
- message: string;
1982
- code: string;
1983
- protocol?: string;
1984
- details?: any;
1985
- }> {}
1986
-
1987
- // Specific errors
1988
- export class OrganizationNotFoundError extends Data.TaggedError(
1989
- "OrganizationNotFoundError"
1990
- )<{
1991
- orgId: string;
1992
- }> {}
1993
-
1994
- export class InsufficientPermissionsError extends Data.TaggedError(
1995
- "InsufficientPermissionsError"
1996
- )<{
1997
- userId: string;
1998
- action: string;
1999
- required: string[];
2000
- }> {}
2001
-
2002
- export class RateLimitExceededError extends Data.TaggedError(
2003
- "RateLimitExceededError"
2004
- )<{
2005
- limit: number;
2006
- period: string;
2007
- retryAfter: number;
2008
- }> {}
2009
-
2010
- // Service implementation
2011
- export class OrganizationService extends Effect.Service<OrganizationService>()(
2012
- "OrganizationService",
2013
- {
2014
- effect: Effect.gen(function* () {
2015
- const db = yield* ConvexDatabase;
2016
-
2017
- return {
2018
- get: (orgId: string) =>
2019
- Effect.gen(function* () {
2020
- const org = yield* Effect.tryPromise(() => db.get(orgId));
2021
-
2022
- if (!org) {
2023
- return yield* Effect.fail(
2024
- new OrganizationNotFoundError({ orgId })
2025
- );
2026
- }
2027
-
2028
- return org;
2029
- }),
2030
- };
2031
- }),
2032
- }
2033
- ) {}
2034
- ```
2035
-
2036
- ### Provider Errors
2037
-
2038
- ```typescript
2039
- // /frontend/src/lib/providers/errors.ts
2040
- export class ProviderError extends Error {
2041
- constructor(
2042
- public message: string,
2043
- public code: string,
2044
- public provider: string,
2045
- public retryable: boolean = false,
2046
- public details?: any
2047
- ) {
2048
- super(message);
2049
- this.name = "ProviderError";
2050
- }
2051
- }
2052
-
2053
- // ConvexProvider error handling
2054
- export class ConvexProvider implements IDataProvider {
2055
- organizations = {
2056
- get: async (args) => {
2057
- try {
2058
- return await this.client.query(api.queries.organizations.get, args);
2059
- } catch (error) {
2060
- // Transform backend error to provider error
2061
- if (error.message.includes("OrganizationNotFoundError")) {
2062
- throw new ProviderError(
2063
- `Organization not found: ${args.orgId}`,
2064
- "ORGANIZATION_NOT_FOUND",
2065
- "convex",
2066
- false,
2067
- { orgId: args.orgId }
2068
- );
2069
- }
2070
-
2071
- // Generic error
2072
- throw new ProviderError(
2073
- error.message,
2074
- "UNKNOWN_ERROR",
2075
- "convex",
2076
- true
2077
- );
2078
- }
2079
- },
2080
- };
2081
- }
2082
- ```
2083
-
2084
- ### Frontend Error Display
2085
-
2086
- ```typescript
2087
- // /frontend/src/components/ErrorBoundary.tsx
2088
- export function ErrorBoundary({ children }: { children: ReactNode }) {
2089
- return (
2090
- <ReactErrorBoundary
2091
- fallbackRender={({ error, resetErrorBoundary }) => (
2092
- <Alert variant="destructive">
2093
- <AlertCircle className="h-4 w-4" />
2094
- <AlertTitle>Error</AlertTitle>
2095
- <AlertDescription>
2096
- {error instanceof ProviderError ? (
2097
- <>
2098
- <p>{error.message}</p>
2099
- <p className="text-xs text-muted-foreground mt-2">
2100
- Provider: {error.provider} | Code: {error.code}
2101
- </p>
2102
- {error.retryable && (
2103
- <Button onClick={resetErrorBoundary} className="mt-4">
2104
- Retry
2105
- </Button>
2106
- )}
2107
- </>
2108
- ) : (
2109
- <p>{error.message}</p>
2110
- )}
2111
- </AlertDescription>
2112
- </Alert>
2113
- )}
2114
- >
2115
- {children}
2116
- </ReactErrorBoundary>
2117
- );
2118
- }
2119
-
2120
- // Usage in components
2121
- export function OrganizationPage({ orgId }: { orgId: string }) {
2122
- const provider = useDataProvider();
2123
- const [org, setOrg] = useState<Organization | null>(null);
2124
- const [error, setError] = useState<ProviderError | null>(null);
2125
- const [loading, setLoading] = useState(true);
2126
-
2127
- useEffect(() => {
2128
- provider.organizations
2129
- .get({ orgId })
2130
- .then(setOrg)
2131
- .catch((err) => {
2132
- if (err instanceof ProviderError) {
2133
- setError(err);
2134
- } else {
2135
- setError(
2136
- new ProviderError(err.message, "UNKNOWN_ERROR", "unknown", false)
2137
- );
2138
- }
2139
- })
2140
- .finally(() => setLoading(false));
2141
- }, [provider, orgId]);
2142
-
2143
- if (loading) return <Skeleton />;
2144
- if (error) return <ErrorDisplay error={error} />;
2145
- if (!org) return <NotFound />;
2146
-
2147
- return <OrganizationDetails org={org} />;
2148
- }
2149
- ```
2150
-
2151
- ### Retry Strategies
2152
-
2153
- ```typescript
2154
- // /frontend/src/lib/providers/retry.ts
2155
- export async function withRetry<T>(
2156
- fn: () => Promise<T>,
2157
- options: {
2158
- maxRetries?: number;
2159
- backoff?: "exponential" | "linear";
2160
- initialDelay?: number;
2161
- } = {}
2162
- ): Promise<T> {
2163
- const {
2164
- maxRetries = 3,
2165
- backoff = "exponential",
2166
- initialDelay = 1000,
2167
- } = options;
2168
-
2169
- let lastError: Error;
2170
-
2171
- for (let attempt = 0; attempt < maxRetries; attempt++) {
2172
- try {
2173
- return await fn();
2174
- } catch (error) {
2175
- lastError = error;
2176
-
2177
- // Don't retry non-retryable errors
2178
- if (error instanceof ProviderError && !error.retryable) {
2179
- throw error;
2180
- }
2181
-
2182
- // Calculate delay
2183
- const delay =
2184
- backoff === "exponential"
2185
- ? initialDelay * Math.pow(2, attempt)
2186
- : initialDelay * (attempt + 1);
2187
-
2188
- // Wait before retry
2189
- await new Promise((resolve) => setTimeout(resolve, delay));
2190
- }
2191
- }
2192
-
2193
- throw lastError;
2194
- }
2195
-
2196
- // Usage
2197
- const org = await withRetry(() => provider.organizations.get({ orgId }), {
2198
- maxRetries: 3,
2199
- backoff: "exponential",
2200
- });
2201
- ```
2202
-
2203
- ### Fallback Strategies
2204
-
2205
- ```typescript
2206
- // /frontend/src/lib/providers/fallback.ts
2207
- export class FallbackProvider implements IDataProvider {
2208
- constructor(
2209
- private primary: IDataProvider,
2210
- private fallback: IDataProvider
2211
- ) {}
2212
-
2213
- organizations = {
2214
- get: async (args) => {
2215
- try {
2216
- return await this.primary.organizations.get(args);
2217
- } catch (error) {
2218
- console.warn("Primary provider failed, falling back", error);
2219
- return await this.fallback.organizations.get(args);
2220
- }
2221
- },
2222
- };
2223
- }
2224
-
2225
- // Configuration
2226
- const provider = new FallbackProvider(
2227
- new ConvexProvider(convexClient),
2228
- new CachedProvider(localStorage) // Fallback to cache
2229
- );
2230
- ```
2231
-
2232
- **Validation:**
2233
-
2234
- - ✅ Backend errors use tagged unions with `_tag`
2235
- - ✅ Provider errors include retry flag
2236
- - ✅ Frontend displays user-friendly messages
2237
- - ✅ Retries with exponential backoff for transient failures
2238
- - ✅ Fallback to cache for offline support
2239
-
2240
- ---
2241
-
2242
- ## 7. Deployment Coordination
2243
-
2244
- ### Deployment Architecture
2245
-
2246
- ```
2247
- ┌────────────────────────────────────────────────┐
2248
- │ FRONTEND DEPLOYMENT │
2249
- │ Platform: Cloudflare Pages │
2250
- │ Runtime: Astro SSR + React 19 │
2251
- │ CDN: Global edge network │
2252
- └────────────────────────────────────────────────┘
2253
- ↓ API Calls
2254
- ┌────────────────────────────────────────────────┐
2255
- │ BACKEND DEPLOYMENT │
2256
- │ Platform: Convex Cloud │
2257
- │ Region: Auto (global replication) │
2258
- │ Database: Convex (real-time) │
2259
- └────────────────────────────────────────────────┘
2260
- ```
2261
-
2262
- ### Deployment Strategy
2263
-
2264
- #### Independent Deployments
2265
-
2266
- **Backend (Convex):**
2267
-
2268
- ```bash
2269
- # Deploy backend independently
2270
- cd /backend
2271
- npx convex deploy --prod
2272
-
2273
- # Verify deployment
2274
- npx convex status
2275
- ```
2276
-
2277
- **Frontend (Cloudflare Pages):**
2278
-
2279
- ```bash
2280
- # Deploy frontend independently
2281
- cd /frontend
2282
- bun run build
2283
- wrangler pages deploy dist --project-name=one-platform
2284
- ```
2285
-
2286
- **Validation:**
2287
-
2288
- - ✅ Backend deployments independent of frontend
2289
- - ✅ Frontend deployments independent of backend
2290
- - ✅ No coordinated releases required
2291
-
2292
- #### Zero-Downtime Migration
2293
-
2294
- **Strategy:** Gradual rollout with feature flags
2295
-
2296
- ```typescript
2297
- // /frontend/src/lib/providers/config.ts
2298
- export interface ProviderConfig {
2299
- default: "convex" | "supabase" | "composite";
2300
- featureFlags: {
2301
- useDataProvider: boolean; // Gradual rollout
2302
- providers: {
2303
- convex: boolean;
2304
- supabase: boolean;
2305
- wordpress: boolean;
2306
- };
2307
- };
2308
- }
2309
-
2310
- // Feature flag check
2311
- export function shouldUseDataProvider(): boolean {
2312
- // Check feature flag
2313
- if (!providerConfig.featureFlags.useDataProvider) {
2314
- return false; // Use old direct Convex
2315
- }
2316
-
2317
- // Check rollout percentage (from backend)
2318
- const rolloutPercentage = getRolloutPercentage();
2319
- const userHash = hashUserId(currentUserId);
2320
-
2321
- return userHash % 100 < rolloutPercentage;
2322
- }
2323
-
2324
- // Component with feature flag
2325
- export function OrganizationList() {
2326
- if (shouldUseDataProvider()) {
2327
- // New: Use DataProvider
2328
- const provider = useDataProvider();
2329
- const orgs = useRealtimeData(provider, { type: "organizations" });
2330
- return <div>{orgs?.map(...)}</div>;
2331
- } else {
2332
- // Old: Direct Convex
2333
- const orgs = useQuery(api.queries.organizations.list);
2334
- return <div>{orgs?.map(...)}</div>;
2335
- }
2336
- }
2337
- ```
2338
-
2339
- **Rollout Plan:**
2340
-
2341
- 1. **Week 1:** 0% (feature flag off, deploy code)
2342
- 2. **Week 2:** 5% (internal testing)
2343
- 3. **Week 3:** 10% (early adopters)
2344
- 4. **Week 4:** 25% (monitoring for issues)
2345
- 5. **Week 5:** 50% (half of users)
2346
- 6. **Week 6:** 75% (most users)
2347
- 7. **Week 7:** 100% (full rollout)
2348
-
2349
- **Rollback Procedure:**
2350
-
2351
- ```bash
2352
- # Instant rollback via feature flag
2353
- # Set featureFlags.useDataProvider = false
2354
-
2355
- # Or rollback deployment
2356
- wrangler pages rollback one-platform
2357
- ```
2358
-
2359
- #### Monitoring and Alerting
2360
-
2361
- **Metrics to Track:**
2362
-
2363
- ```typescript
2364
- // /frontend/src/lib/providers/monitoring.ts
2365
- export class MonitoredProvider implements IDataProvider {
2366
- constructor(private provider: IDataProvider) {}
2367
-
2368
- organizations = {
2369
- list: async (args) => {
2370
- const start = Date.now();
2371
- try {
2372
- const result = await this.provider.organizations.list(args);
2373
-
2374
- // Track success
2375
- trackMetric({
2376
- metric: "provider.organizations.list.success",
2377
- duration: Date.now() - start,
2378
- provider: this.provider.name,
2379
- });
2380
-
2381
- return result;
2382
- } catch (error) {
2383
- // Track failure
2384
- trackMetric({
2385
- metric: "provider.organizations.list.error",
2386
- duration: Date.now() - start,
2387
- provider: this.provider.name,
2388
- error: error.message,
2389
- });
2390
-
2391
- throw error;
2392
- }
2393
- },
2394
- };
2395
- }
2396
- ```
2397
-
2398
- **Alerts:**
2399
-
2400
- ```yaml
2401
- # alerts.yaml
2402
- alerts:
2403
- - name: provider_error_rate_high
2404
- condition: provider.*.error > 5%
2405
- severity: critical
2406
- notification: pagerduty
2407
-
2408
- - name: provider_latency_high
2409
- condition: provider.*.duration > 1000ms
2410
- severity: warning
2411
- notification: slack
2412
-
2413
- - name: auth_failure_rate_high
2414
- condition: auth.*.failure > 2%
2415
- severity: critical
2416
- notification: pagerduty
2417
- ```
2418
-
2419
- **Validation:**
2420
-
2421
- - ✅ Gradual rollout with feature flags
2422
- - ✅ Instant rollback capability
2423
- - ✅ Comprehensive monitoring
2424
- - ✅ Automated alerts
2425
-
2426
- ---
2427
-
2428
- ## 8. Implementation Timeline
2429
-
2430
- ### Week 1: Interface Definition
2431
-
2432
- **Deliverables:**
2433
-
2434
- - ✅ `IDataProvider` interface complete
2435
- - ✅ Type definitions for all 6 dimensions
2436
- - ✅ Interface compiles successfully
2437
- - ✅ Backend Specialist review complete
2438
-
2439
- **Tests:**
2440
-
2441
- - ✅ Interface type safety validated
2442
- - ✅ All method signatures defined
2443
-
2444
- **Coordination:** Backend Specialist + Integration Specialist
2445
-
2446
- ---
2447
-
2448
- ### Week 2: ConvexProvider
2449
-
2450
- **Deliverables:**
2451
-
2452
- - ✅ ConvexProvider implements IDataProvider
2453
- - ✅ 100% backward compatibility maintained
2454
- - ✅ All 6 dimensions operational
2455
- - ✅ Real-time support working
2456
-
2457
- **Tests:**
2458
-
2459
- - ✅ Unit tests for all operations
2460
- - ✅ Integration tests with backend
2461
- - ✅ Auth tests pass (50+ test cases)
2462
-
2463
- **Coordination:** Frontend Specialist + Backend Specialist + Quality Agent
2464
-
2465
- ---
2466
-
2467
- ### Week 3: Service Layer
2468
-
2469
- **Deliverables:**
2470
-
2471
- - ✅ Effect.ts services for all 6 dimensions
2472
- - ✅ Pure business logic (no UI, no Convex-specific code)
2473
- - ✅ Typed errors with `_tag` pattern
2474
- - ✅ Dependency injection via Effect.Service
2475
-
2476
- **Tests:**
2477
-
2478
- - ✅ Unit tests with mocked dependencies
2479
- - ✅ Error handling validated
2480
- - ✅ 90%+ code coverage
2481
-
2482
- **Coordination:** Backend Specialist + Integration Specialist + Quality Agent
2483
-
2484
- ---
2485
-
2486
- ### Week 4: Configuration
2487
-
2488
- **Deliverables:**
2489
-
2490
- - ✅ Provider configuration system
2491
- - ✅ Provider factory
2492
- - ✅ React Context for DataProvider
2493
- - ✅ Feature flag system
2494
-
2495
- **Tests:**
2496
-
2497
- - ✅ Provider switching validated
2498
- - ✅ Configuration loading tested
2499
- - ✅ Feature flags working
2500
-
2501
- **Coordination:** Frontend Specialist + Integration Specialist
2502
-
2503
- ---
2504
-
2505
- ### Weeks 5-6: Component Migration
2506
-
2507
- **Week 5: Non-critical pages**
2508
-
2509
- - ✅ `/about`, `/docs`, `/blog`
2510
- - ✅ `/account/settings`
2511
- - ✅ `/tokens/[id]`
2512
- - ✅ Auth tests pass after each migration
2513
-
2514
- **Week 6: Critical pages**
2515
-
2516
- - ✅ `/dashboard`
2517
- - ✅ `/account` (auth flows)
2518
- - ✅ `/admin`
2519
- - ✅ Auth tests pass after each migration
2520
-
2521
- **Tests:**
2522
-
2523
- - ✅ E2E tests for migrated pages
2524
- - ✅ Auth tests pass (50+ test cases)
2525
- - ✅ Performance tests (context < 1.5KB, latency < 100ms)
2526
-
2527
- **Coordination:** Frontend Specialist + Integration Specialist + Quality Agent
2528
-
2529
- ---
2530
-
2531
- ### Week 7: Cleanup
2532
-
2533
- **Deliverables:**
2534
-
2535
- - ✅ Old dependencies removed
2536
- - ✅ Direct Convex imports removed from components
2537
- - ✅ Provider exports consolidated
2538
- - ✅ Documentation updated
2539
-
2540
- **Tests:**
2541
-
2542
- - ✅ All tests pass (unit, integration, E2E, auth)
2543
- - ✅ Build successful
2544
- - ✅ No regressions
2545
-
2546
- **Coordination:** Frontend Specialist + Quality Agent
2547
-
2548
- ---
2549
-
2550
- ### Week 8+: Alternative Providers
2551
-
2552
- **SupabaseProvider:**
2553
-
2554
- - ✅ Implements IDataProvider
2555
- - ✅ All 6 dimensions operational
2556
- - ✅ Real-time subscriptions working
2557
- - ✅ Integration tests passing
2558
-
2559
- **WordPressProvider:**
2560
-
2561
- - ✅ Read-only blog posts
2562
- - ✅ Polling fallback (no real-time)
2563
- - ✅ Sync to Convex for search
2564
-
2565
- **CompositeProvider:**
2566
-
2567
- - ✅ Multi-backend federation
2568
- - ✅ Transparent routing
2569
- - ✅ Cross-backend queries
2570
- - ✅ Event-driven sync
2571
-
2572
- **Tests:**
2573
-
2574
- - ✅ Provider-specific tests
2575
- - ✅ Cross-provider integration tests
2576
- - ✅ Performance benchmarks
2577
-
2578
- **Coordination:** Integration Specialist + Backend Specialist + Quality Agent
2579
-
2580
- ---
2581
-
2582
- ## Summary
2583
-
2584
- ### Key Achievements
2585
-
2586
- 1. **Data Flow Orchestration:** All 6 dimensions respect ontology
2587
- 2. **Multi-Backend Federation:** Seamless integration across Convex, WordPress, Shopify, Notion
2588
- 3. **Real-Time Coordination:** Native WebSocket (Convex), PostgreSQL real-time (Supabase), polling fallback (WordPress/Notion)
2589
- 4. **Zero-Downtime Migration:** 7-phase gradual rollout with feature flags
2590
- 5. **Comprehensive Testing:** Unit, integration, E2E, performance, auth tests
2591
- 6. **Robust Error Handling:** Backend → Provider → Frontend with retries and fallbacks
2592
- 7. **Independent Deployments:** Frontend and backend deploy separately
2593
-
2594
- ### Validation Checklist
2595
-
2596
- - ✅ All 6 dimensions mapped correctly
2597
- - ✅ Multi-tenant isolation enforced
2598
- - ✅ Authorization verified (role-based)
2599
- - ✅ Status lifecycle enforced (draft → active → published → archived)
2600
- - ✅ Real-time subscriptions working
2601
- - ✅ Cross-backend connections maintained
2602
- - ✅ Complete audit trail
2603
- - ✅ Vector search operational
2604
- - ✅ Auth tests pass (50+ test cases)
2605
- - ✅ Performance within budget (context < 1.5KB, latency < 100ms)
2606
-
2607
- ### Next Steps
2608
-
2609
- 1. **Week 1:** Define IDataProvider interface
2610
- 2. **Week 2:** Implement ConvexProvider
2611
- 3. **Week 3:** Implement Effect.ts services
2612
- 4. **Week 4:** Add configuration system
2613
- 5. **Weeks 5-6:** Migrate components page-by-page
2614
- 6. **Week 7:** Cleanup old code
2615
- 7. **Week 8+:** Implement alternative providers
2616
-
2617
- ---
2618
-
2619
- **Integration Specialist: Connect systems. Map protocols. Respect the ontology. Make integrations seamless.**
2620
-
2621
- ---
2622
-
2623
- **End of Integration Orchestration Plan**