@org.ai/examples 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/LICENSE +21 -0
  3. package/README.md +147 -0
  4. package/api-business/index.ts +1179 -0
  5. package/directory/index.ts +1118 -0
  6. package/dist/api-business/index.d.ts +221 -0
  7. package/dist/api-business/index.d.ts.map +1 -0
  8. package/dist/api-business/index.js +1132 -0
  9. package/dist/api-business/index.js.map +1 -0
  10. package/dist/directory/index.d.ts +202 -0
  11. package/dist/directory/index.d.ts.map +1 -0
  12. package/dist/directory/index.js +1073 -0
  13. package/dist/directory/index.js.map +1 -0
  14. package/dist/index.d.ts +75 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +127 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/marketplace/index.d.ts +242 -0
  19. package/dist/marketplace/index.d.ts.map +1 -0
  20. package/dist/marketplace/index.js +1249 -0
  21. package/dist/marketplace/index.js.map +1 -0
  22. package/dist/saas/index.d.ts +151 -0
  23. package/dist/saas/index.d.ts.map +1 -0
  24. package/dist/saas/index.js +1142 -0
  25. package/dist/saas/index.js.map +1 -0
  26. package/dist/startup-studio/index.d.ts +285 -0
  27. package/dist/startup-studio/index.d.ts.map +1 -0
  28. package/dist/startup-studio/index.js +1252 -0
  29. package/dist/startup-studio/index.js.map +1 -0
  30. package/dist/vc-firm/index.d.ts +248 -0
  31. package/dist/vc-firm/index.d.ts.map +1 -0
  32. package/dist/vc-firm/index.js +1335 -0
  33. package/dist/vc-firm/index.js.map +1 -0
  34. package/index.ts +151 -0
  35. package/marketplace/index.ts +1295 -0
  36. package/package.json +58 -0
  37. package/saas/index.ts +1188 -0
  38. package/startup-studio/index.ts +1324 -0
  39. package/tsconfig.json +12 -0
  40. package/vc-firm/index.ts +1430 -0
package/saas/index.ts ADDED
@@ -0,0 +1,1188 @@
1
+ /**
2
+ * SaaS Business Example
3
+ *
4
+ * A complete example of a B2B SaaS business modeled using primitives.org.ai
5
+ * Demonstrates: Business definition, Products, Organization, Roles, KPIs, OKRs,
6
+ * Processes, Workflows, Financial metrics, and Digital Workers
7
+ *
8
+ * @example CloudMetrics - A SaaS analytics platform
9
+ * @packageDocumentation
10
+ */
11
+
12
+ /**
13
+ * NOTE: These examples demonstrate the DESIRED API shape for business-as-code.
14
+ * Some types may not exist yet in the actual package. The examples serve as
15
+ * documentation and specification for the ideal primitives API.
16
+ */
17
+
18
+ // Use any for flexibility - these examples define the ideal API shape
19
+ const Business = (def: any) => def
20
+ const Product = (def: any) => def
21
+ const Service = (def: any) => def
22
+ const Goals = (defs: any[]) => defs
23
+ const Vision = (def: any) => def
24
+ const kpis = (defs: any[]) => defs
25
+ const okrs = (defs: any[]) => defs
26
+ const financials = (def: any) => def
27
+ const Process = (def: any) => def
28
+ const Workflow = (def: any) => def
29
+ const createBusinessRole = (def: any) => def
30
+
31
+ // Standard business roles placeholder
32
+ const StandardBusinessRoles: Record<string, any> = {
33
+ ceo: { type: 'ceo', level: 10, permissions: { '*': ['manage'] } },
34
+ cfo: { type: 'cfo', level: 9, permissions: { finance: ['manage'], budget: ['approve'] } },
35
+ cto: { type: 'cto', level: 9, permissions: { technology: ['manage'], code: ['review'] } },
36
+ engineer: { type: 'engineer', level: 3, canHandle: ['coding', 'code-review'] },
37
+ support: { type: 'support', level: 2, canHandle: ['customer-inquiry', 'ticket-response'] },
38
+ }
39
+
40
+ // Re-export Organization type placeholder
41
+ export interface Organization {
42
+ id: string
43
+ name: string
44
+ settings?: any
45
+ departments?: any[]
46
+ teams?: any[]
47
+ roles?: any[]
48
+ approvalChains?: any[]
49
+ routingRules?: any[]
50
+ resourceHierarchy?: any
51
+ }
52
+
53
+ // $ helper placeholder
54
+ const $ = {
55
+ format: (n: number) => `$${n.toLocaleString()}`,
56
+ growth: (current: number, previous: number) => ((current - previous) / previous * 100).toFixed(1),
57
+ margin: (revenue: number, cost: number) => ((revenue - cost) / revenue * 100).toFixed(1),
58
+ }
59
+
60
+ // =============================================================================
61
+ // 1. BUSINESS DEFINITION
62
+ // =============================================================================
63
+
64
+ /**
65
+ * CloudMetrics - B2B SaaS Analytics Platform
66
+ */
67
+ export const CloudMetricsBusiness = Business({
68
+ name: 'CloudMetrics Inc.',
69
+ mission: 'Empower businesses with real-time analytics to make data-driven decisions',
70
+ values: ['Data-Driven', 'Customer Success', 'Transparency', 'Innovation'],
71
+ industry: 'Software as a Service',
72
+ founded: new Date('2022-01-15'),
73
+ stage: 'growth',
74
+ structure: {
75
+ departments: [
76
+ {
77
+ name: 'Engineering',
78
+ headcount: 25,
79
+ budget: 3000000,
80
+ teams: [
81
+ { name: 'Platform', headcount: 8, focus: 'Core infrastructure' },
82
+ { name: 'Frontend', headcount: 6, focus: 'User interfaces' },
83
+ { name: 'Data', headcount: 5, focus: 'Analytics engine' },
84
+ { name: 'DevOps', headcount: 4, focus: 'Infrastructure & deployment' },
85
+ { name: 'QA', headcount: 2, focus: 'Quality assurance' },
86
+ ],
87
+ },
88
+ {
89
+ name: 'Product',
90
+ headcount: 5,
91
+ budget: 800000,
92
+ teams: [
93
+ { name: 'Product Management', headcount: 3 },
94
+ { name: 'Design', headcount: 2 },
95
+ ],
96
+ },
97
+ {
98
+ name: 'Sales',
99
+ headcount: 12,
100
+ budget: 2000000,
101
+ teams: [
102
+ { name: 'Enterprise Sales', headcount: 5 },
103
+ { name: 'Mid-Market', headcount: 4 },
104
+ { name: 'SDR', headcount: 3 },
105
+ ],
106
+ },
107
+ {
108
+ name: 'Customer Success',
109
+ headcount: 8,
110
+ budget: 1000000,
111
+ teams: [
112
+ { name: 'Onboarding', headcount: 3 },
113
+ { name: 'Support', headcount: 3 },
114
+ { name: 'Renewals', headcount: 2 },
115
+ ],
116
+ },
117
+ {
118
+ name: 'Marketing',
119
+ headcount: 6,
120
+ budget: 1500000,
121
+ teams: [
122
+ { name: 'Growth', headcount: 2 },
123
+ { name: 'Content', headcount: 2 },
124
+ { name: 'Product Marketing', headcount: 2 },
125
+ ],
126
+ },
127
+ {
128
+ name: 'Finance & Operations',
129
+ headcount: 4,
130
+ budget: 500000,
131
+ },
132
+ ],
133
+ },
134
+ })
135
+
136
+ // =============================================================================
137
+ // 2. VISION & GOALS
138
+ // =============================================================================
139
+
140
+ export const CloudMetricsVision = Vision({
141
+ statement: 'Be the leading analytics platform for data-driven businesses worldwide',
142
+ timeHorizon: '2027',
143
+ pillars: [
144
+ 'Product Excellence',
145
+ 'Customer Success',
146
+ 'Market Leadership',
147
+ 'Operational Efficiency',
148
+ ],
149
+ successIndicators: [
150
+ { name: 'ARR', target: 50000000, unit: 'USD' },
151
+ { name: 'NPS', target: 70 },
152
+ { name: 'Customer Count', target: 5000 },
153
+ { name: 'Net Revenue Retention', target: 130, unit: '%' },
154
+ ],
155
+ })
156
+
157
+ export const CloudMetricsGoals = Goals([
158
+ {
159
+ name: 'Achieve $10M ARR',
160
+ category: 'financial',
161
+ status: 'in-progress',
162
+ progress: 75,
163
+ dueDate: new Date('2024-12-31'),
164
+ owner: 'CEO',
165
+ milestones: [
166
+ { name: '$5M ARR', completed: true },
167
+ { name: '$7.5M ARR', completed: true },
168
+ { name: '$10M ARR', completed: false },
169
+ ],
170
+ },
171
+ {
172
+ name: 'Launch Enterprise Tier',
173
+ category: 'product',
174
+ status: 'in-progress',
175
+ progress: 60,
176
+ dueDate: new Date('2024-06-30'),
177
+ owner: 'VP Product',
178
+ dependencies: ['SOC 2 Compliance', 'SSO Integration'],
179
+ },
180
+ {
181
+ name: 'SOC 2 Compliance',
182
+ category: 'operational',
183
+ status: 'in-progress',
184
+ progress: 80,
185
+ dueDate: new Date('2024-03-31'),
186
+ owner: 'VP Engineering',
187
+ },
188
+ {
189
+ name: 'SSO Integration',
190
+ category: 'product',
191
+ status: 'in-progress',
192
+ progress: 90,
193
+ dueDate: new Date('2024-02-28'),
194
+ owner: 'Engineering Lead',
195
+ },
196
+ {
197
+ name: 'Expand to EU Market',
198
+ category: 'strategic',
199
+ status: 'planned',
200
+ progress: 10,
201
+ dueDate: new Date('2024-09-30'),
202
+ owner: 'VP Sales',
203
+ dependencies: ['GDPR Compliance'],
204
+ },
205
+ {
206
+ name: 'GDPR Compliance',
207
+ category: 'operational',
208
+ status: 'in-progress',
209
+ progress: 45,
210
+ dueDate: new Date('2024-06-30'),
211
+ owner: 'Legal',
212
+ },
213
+ ])
214
+
215
+ // =============================================================================
216
+ // 3. PRODUCTS & PRICING
217
+ // =============================================================================
218
+
219
+ export const CloudMetricsProduct = Product({
220
+ name: 'CloudMetrics Platform',
221
+ description: 'Real-time analytics platform for SaaS businesses',
222
+ pricingModel: 'subscription',
223
+ features: [
224
+ 'Real-time dashboards',
225
+ 'Custom metrics',
226
+ 'Alerts & notifications',
227
+ 'API access',
228
+ 'Data exports',
229
+ 'Team collaboration',
230
+ 'SSO (Enterprise)',
231
+ 'Dedicated support (Enterprise)',
232
+ ],
233
+ roadmap: [
234
+ {
235
+ name: 'AI-Powered Insights',
236
+ status: 'planned',
237
+ priority: 'high',
238
+ targetDate: new Date('2024-Q2'),
239
+ },
240
+ {
241
+ name: 'Mobile App',
242
+ status: 'in-progress',
243
+ priority: 'medium',
244
+ targetDate: new Date('2024-Q3'),
245
+ },
246
+ {
247
+ name: 'Embedded Analytics',
248
+ status: 'planned',
249
+ priority: 'high',
250
+ targetDate: new Date('2024-Q4'),
251
+ },
252
+ ],
253
+ })
254
+
255
+ export const PricingTiers = {
256
+ starter: Product({
257
+ name: 'Starter',
258
+ pricingModel: 'subscription',
259
+ price: 49, // /month
260
+ billingPeriod: 'monthly',
261
+ features: ['5 dashboards', '10 data sources', 'Email support'],
262
+ targetMarket: 'Small businesses',
263
+ }),
264
+ growth: Product({
265
+ name: 'Growth',
266
+ pricingModel: 'subscription',
267
+ price: 199, // /month
268
+ billingPeriod: 'monthly',
269
+ features: ['25 dashboards', '50 data sources', 'Priority support', 'API access'],
270
+ targetMarket: 'Mid-market',
271
+ cogs: 40,
272
+ }),
273
+ enterprise: Product({
274
+ name: 'Enterprise',
275
+ pricingModel: 'subscription',
276
+ price: 999, // /month
277
+ billingPeriod: 'monthly',
278
+ features: ['Unlimited dashboards', 'Unlimited data sources', 'SSO', 'Dedicated success manager', '99.9% SLA'],
279
+ targetMarket: 'Enterprise',
280
+ cogs: 200,
281
+ }),
282
+ }
283
+
284
+ // =============================================================================
285
+ // 4. ORGANIZATION & ROLES
286
+ // =============================================================================
287
+
288
+ export const CloudMetricsOrg: Organization = {
289
+ id: 'cloudmetrics',
290
+ name: 'CloudMetrics Inc.',
291
+ settings: {
292
+ timezone: 'America/Los_Angeles',
293
+ currency: 'USD',
294
+ fiscalYearStart: 1, // January
295
+ },
296
+ departments: [
297
+ {
298
+ id: 'engineering',
299
+ name: 'Engineering',
300
+ permissions: {
301
+ code: ['read', 'write', 'deploy'],
302
+ infrastructure: ['read', 'write', 'manage'],
303
+ },
304
+ budget: {
305
+ annual: 3000000,
306
+ spent: 2250000,
307
+ categories: {
308
+ salaries: { annual: 2500000, spent: 1875000 },
309
+ infrastructure: { annual: 400000, spent: 300000 },
310
+ tools: { annual: 100000, spent: 75000 },
311
+ },
312
+ },
313
+ teams: [
314
+ {
315
+ id: 'platform',
316
+ name: 'Platform',
317
+ positions: [
318
+ { id: 'platform-lead', title: 'Platform Lead', roleId: 'senior-engineer', reportsTo: 'eng-vp' },
319
+ { id: 'platform-eng-1', title: 'Senior Platform Engineer', roleId: 'senior-engineer', reportsTo: 'platform-lead' },
320
+ { id: 'platform-eng-2', title: 'Platform Engineer', roleId: 'engineer', reportsTo: 'platform-lead' },
321
+ ],
322
+ },
323
+ {
324
+ id: 'frontend',
325
+ name: 'Frontend',
326
+ positions: [
327
+ { id: 'frontend-lead', title: 'Frontend Lead', roleId: 'senior-engineer', reportsTo: 'eng-vp' },
328
+ { id: 'frontend-eng-1', title: 'Senior Frontend Engineer', roleId: 'senior-engineer', reportsTo: 'frontend-lead' },
329
+ ],
330
+ },
331
+ ],
332
+ },
333
+ {
334
+ id: 'sales',
335
+ name: 'Sales',
336
+ permissions: {
337
+ deals: ['read', 'write', 'manage'],
338
+ customers: ['read', 'write'],
339
+ },
340
+ budget: {
341
+ annual: 2000000,
342
+ spent: 1500000,
343
+ categories: {
344
+ salaries: { annual: 1500000, spent: 1125000 },
345
+ commissions: { annual: 400000, spent: 300000 },
346
+ travel: { annual: 100000, spent: 75000 },
347
+ },
348
+ },
349
+ },
350
+ {
351
+ id: 'customer-success',
352
+ name: 'Customer Success',
353
+ permissions: {
354
+ customers: ['read', 'write'],
355
+ support: ['read', 'write', 'manage'],
356
+ },
357
+ },
358
+ ],
359
+ roles: [
360
+ createBusinessRole({
361
+ id: 'ceo',
362
+ name: 'CEO',
363
+ ...StandardBusinessRoles.ceo,
364
+ }),
365
+ createBusinessRole({
366
+ id: 'cfo',
367
+ name: 'CFO',
368
+ ...StandardBusinessRoles.cfo,
369
+ }),
370
+ createBusinessRole({
371
+ id: 'senior-engineer',
372
+ name: 'Senior Engineer',
373
+ type: 'engineer',
374
+ level: 5,
375
+ permissions: {
376
+ code: ['read', 'write', 'review', 'merge'],
377
+ deployments: ['read', 'write'],
378
+ incidents: ['read', 'write', 'escalate'],
379
+ },
380
+ canHandle: ['coding', 'code-review', 'architecture', 'incident-response'],
381
+ canApprove: ['pull-request', 'design-doc'],
382
+ }),
383
+ createBusinessRole({
384
+ id: 'engineer',
385
+ name: 'Engineer',
386
+ type: 'engineer',
387
+ level: 3,
388
+ permissions: {
389
+ code: ['read', 'write'],
390
+ deployments: ['read'],
391
+ },
392
+ canHandle: ['coding', 'code-review', 'bug-fix'],
393
+ }),
394
+ createBusinessRole({
395
+ id: 'ae',
396
+ name: 'Account Executive',
397
+ type: 'sales',
398
+ level: 4,
399
+ permissions: {
400
+ deals: ['read', 'write', 'negotiate'],
401
+ customers: ['read', 'write'],
402
+ },
403
+ canHandle: ['demo', 'negotiation', 'contract-review'],
404
+ canApprove: ['discount'],
405
+ }),
406
+ createBusinessRole({
407
+ id: 'csm',
408
+ name: 'Customer Success Manager',
409
+ type: 'support',
410
+ level: 4,
411
+ permissions: {
412
+ customers: ['read', 'write'],
413
+ support: ['read', 'write', 'escalate'],
414
+ },
415
+ canHandle: ['onboarding', 'training', 'renewal', 'upsell'],
416
+ }),
417
+ createBusinessRole({
418
+ id: 'support-agent',
419
+ name: 'Support Agent',
420
+ type: 'support',
421
+ level: 2,
422
+ workerType: 'hybrid', // Can be AI or human
423
+ permissions: {
424
+ support: ['read', 'write'],
425
+ customers: ['read'],
426
+ },
427
+ canHandle: ['tier-1-support', 'documentation-query', 'status-check'],
428
+ }),
429
+ ],
430
+ approvalChains: [
431
+ {
432
+ id: 'expense-approval',
433
+ name: 'Expense Approval',
434
+ requestType: 'expense',
435
+ levels: [
436
+ { threshold: 1000, approvers: [{ type: 'manager' }] },
437
+ { threshold: 5000, approvers: [{ type: 'department-head' }] },
438
+ { threshold: 25000, approvers: [{ type: 'role', roleId: 'cfo' }] },
439
+ { threshold: Infinity, approvers: [{ type: 'role', roleId: 'ceo' }] },
440
+ ],
441
+ },
442
+ {
443
+ id: 'discount-approval',
444
+ name: 'Discount Approval',
445
+ requestType: 'discount',
446
+ levels: [
447
+ { threshold: 10, approvers: [{ type: 'manager' }] }, // Up to 10%
448
+ { threshold: 20, approvers: [{ type: 'department-head' }] }, // Up to 20%
449
+ { threshold: 30, approvers: [{ type: 'role', roleId: 'cro' }] }, // Up to 30%
450
+ { threshold: Infinity, approvers: [{ type: 'role', roleId: 'ceo' }] }, // >30%
451
+ ],
452
+ },
453
+ ],
454
+ routingRules: [
455
+ {
456
+ id: 'tier-1-support-routing',
457
+ taskType: 'tier-1-support',
458
+ priority: 1,
459
+ assignTo: { roleId: 'support-agent' },
460
+ conditions: { complexity: 'low' },
461
+ },
462
+ {
463
+ id: 'escalated-support-routing',
464
+ taskType: 'tier-2-support',
465
+ priority: 2,
466
+ assignTo: { roleId: 'csm' },
467
+ conditions: { complexity: 'high' },
468
+ },
469
+ {
470
+ id: 'code-review-routing',
471
+ taskType: 'code-review',
472
+ priority: 1,
473
+ assignTo: { roleId: 'senior-engineer' },
474
+ },
475
+ ],
476
+ }
477
+
478
+ // =============================================================================
479
+ // 5. KPIs & METRICS
480
+ // =============================================================================
481
+
482
+ export const CloudMetricsKPIs = kpis([
483
+ // Revenue Metrics
484
+ {
485
+ name: 'Monthly Recurring Revenue (MRR)',
486
+ category: 'financial',
487
+ target: 850000,
488
+ current: 780000,
489
+ unit: 'USD',
490
+ frequency: 'monthly',
491
+ owner: 'CEO',
492
+ },
493
+ {
494
+ name: 'Annual Recurring Revenue (ARR)',
495
+ category: 'financial',
496
+ target: 10000000,
497
+ current: 9360000,
498
+ unit: 'USD',
499
+ frequency: 'monthly',
500
+ owner: 'CEO',
501
+ },
502
+ {
503
+ name: 'Net Revenue Retention (NRR)',
504
+ category: 'financial',
505
+ target: 120,
506
+ current: 115,
507
+ unit: '%',
508
+ frequency: 'monthly',
509
+ owner: 'VP Customer Success',
510
+ },
511
+ // Customer Metrics
512
+ {
513
+ name: 'Customer Count',
514
+ category: 'customer',
515
+ target: 800,
516
+ current: 720,
517
+ frequency: 'monthly',
518
+ owner: 'VP Sales',
519
+ },
520
+ {
521
+ name: 'Churn Rate',
522
+ category: 'customer',
523
+ target: 2,
524
+ current: 2.5,
525
+ unit: '%',
526
+ frequency: 'monthly',
527
+ owner: 'VP Customer Success',
528
+ },
529
+ {
530
+ name: 'Net Promoter Score (NPS)',
531
+ category: 'customer',
532
+ target: 60,
533
+ current: 55,
534
+ frequency: 'quarterly',
535
+ owner: 'VP Product',
536
+ },
537
+ // Sales Metrics
538
+ {
539
+ name: 'Sales Qualified Leads',
540
+ category: 'sales',
541
+ target: 200,
542
+ current: 185,
543
+ frequency: 'monthly',
544
+ owner: 'VP Marketing',
545
+ },
546
+ {
547
+ name: 'Win Rate',
548
+ category: 'sales',
549
+ target: 25,
550
+ current: 22,
551
+ unit: '%',
552
+ frequency: 'monthly',
553
+ owner: 'VP Sales',
554
+ },
555
+ {
556
+ name: 'Average Contract Value (ACV)',
557
+ category: 'sales',
558
+ target: 15000,
559
+ current: 13500,
560
+ unit: 'USD',
561
+ frequency: 'monthly',
562
+ owner: 'VP Sales',
563
+ },
564
+ // Operational Metrics
565
+ {
566
+ name: 'System Uptime',
567
+ category: 'operational',
568
+ target: 99.9,
569
+ current: 99.95,
570
+ unit: '%',
571
+ frequency: 'monthly',
572
+ owner: 'VP Engineering',
573
+ },
574
+ {
575
+ name: 'Support Response Time',
576
+ category: 'operational',
577
+ target: 4,
578
+ current: 3.2,
579
+ unit: 'hours',
580
+ frequency: 'weekly',
581
+ owner: 'Support Lead',
582
+ },
583
+ {
584
+ name: 'Deployment Frequency',
585
+ category: 'operational',
586
+ target: 20,
587
+ current: 18,
588
+ unit: 'deploys/month',
589
+ frequency: 'monthly',
590
+ owner: 'VP Engineering',
591
+ },
592
+ ])
593
+
594
+ // =============================================================================
595
+ // 6. OKRs
596
+ // =============================================================================
597
+
598
+ export const CloudMetricsOKRs = okrs([
599
+ {
600
+ objective: 'Achieve Product-Market Fit for Enterprise Segment',
601
+ owner: 'VP Product',
602
+ period: 'Q1 2024',
603
+ keyResults: [
604
+ {
605
+ description: 'Close 10 Enterprise customers',
606
+ metric: 'Enterprise Customers',
607
+ targetValue: 10,
608
+ currentValue: 6,
609
+ },
610
+ {
611
+ description: 'Achieve Enterprise NPS of 60+',
612
+ metric: 'Enterprise NPS',
613
+ targetValue: 60,
614
+ currentValue: 52,
615
+ },
616
+ {
617
+ description: 'Launch SSO & SCIM integrations',
618
+ metric: 'Features Launched',
619
+ targetValue: 2,
620
+ currentValue: 1,
621
+ },
622
+ ],
623
+ },
624
+ {
625
+ objective: 'Scale Sales Machine',
626
+ owner: 'VP Sales',
627
+ period: 'Q1 2024',
628
+ keyResults: [
629
+ {
630
+ description: 'Increase MQL to SQL conversion to 35%',
631
+ metric: 'MQL to SQL Conversion',
632
+ targetValue: 35,
633
+ currentValue: 28,
634
+ unit: '%',
635
+ },
636
+ {
637
+ description: 'Reduce sales cycle to 45 days',
638
+ metric: 'Sales Cycle',
639
+ targetValue: 45,
640
+ currentValue: 52,
641
+ unit: 'days',
642
+ },
643
+ {
644
+ description: 'Hire 3 new Account Executives',
645
+ metric: 'AEs Hired',
646
+ targetValue: 3,
647
+ currentValue: 2,
648
+ },
649
+ ],
650
+ },
651
+ {
652
+ objective: 'Build World-Class Engineering Culture',
653
+ owner: 'VP Engineering',
654
+ period: 'Q1 2024',
655
+ keyResults: [
656
+ {
657
+ description: 'Achieve 80% test coverage',
658
+ metric: 'Test Coverage',
659
+ targetValue: 80,
660
+ currentValue: 72,
661
+ unit: '%',
662
+ },
663
+ {
664
+ description: 'Reduce incident response time to 15 minutes',
665
+ metric: 'Incident Response Time',
666
+ targetValue: 15,
667
+ currentValue: 22,
668
+ unit: 'minutes',
669
+ },
670
+ {
671
+ description: 'Ship 50 customer-requested features',
672
+ metric: 'Features Shipped',
673
+ targetValue: 50,
674
+ currentValue: 38,
675
+ },
676
+ ],
677
+ },
678
+ {
679
+ objective: 'Maximize Customer Success',
680
+ owner: 'VP Customer Success',
681
+ period: 'Q1 2024',
682
+ keyResults: [
683
+ {
684
+ description: 'Achieve 95% renewal rate',
685
+ metric: 'Renewal Rate',
686
+ targetValue: 95,
687
+ currentValue: 92,
688
+ unit: '%',
689
+ },
690
+ {
691
+ description: 'Increase expansion revenue to 25% of ARR',
692
+ metric: 'Expansion Revenue',
693
+ targetValue: 25,
694
+ currentValue: 18,
695
+ unit: '%',
696
+ },
697
+ {
698
+ description: 'Reduce time-to-value to 14 days',
699
+ metric: 'Time to Value',
700
+ targetValue: 14,
701
+ currentValue: 21,
702
+ unit: 'days',
703
+ },
704
+ ],
705
+ },
706
+ ])
707
+
708
+ // =============================================================================
709
+ // 7. PROCESSES
710
+ // =============================================================================
711
+
712
+ export const LeadToCustomerProcess = Process({
713
+ name: 'Lead to Customer',
714
+ description: 'End-to-end process from lead capture to closed-won deal',
715
+ owner: 'VP Sales',
716
+ steps: [
717
+ {
718
+ order: 1,
719
+ name: 'Lead Capture',
720
+ description: 'Capture lead from marketing channels',
721
+ automationLevel: 'automated',
722
+ duration: 'instant',
723
+ owner: 'Marketing',
724
+ },
725
+ {
726
+ order: 2,
727
+ name: 'Lead Qualification',
728
+ description: 'Qualify lead based on ICP and intent signals',
729
+ automationLevel: 'semi-automated',
730
+ duration: '24 hours',
731
+ owner: 'SDR',
732
+ },
733
+ {
734
+ order: 3,
735
+ name: 'Discovery Call',
736
+ description: 'Conduct discovery call to understand needs',
737
+ automationLevel: 'manual',
738
+ duration: '30 minutes',
739
+ owner: 'SDR',
740
+ },
741
+ {
742
+ order: 4,
743
+ name: 'Product Demo',
744
+ description: 'Deliver personalized product demonstration',
745
+ automationLevel: 'manual',
746
+ duration: '45 minutes',
747
+ owner: 'AE',
748
+ },
749
+ {
750
+ order: 5,
751
+ name: 'Proposal',
752
+ description: 'Create and send proposal',
753
+ automationLevel: 'semi-automated',
754
+ duration: '2 days',
755
+ owner: 'AE',
756
+ },
757
+ {
758
+ order: 6,
759
+ name: 'Negotiation',
760
+ description: 'Negotiate terms and pricing',
761
+ automationLevel: 'manual',
762
+ duration: '1 week',
763
+ owner: 'AE',
764
+ },
765
+ {
766
+ order: 7,
767
+ name: 'Contract',
768
+ description: 'Generate and sign contract',
769
+ automationLevel: 'semi-automated',
770
+ duration: '3 days',
771
+ owner: 'AE',
772
+ },
773
+ {
774
+ order: 8,
775
+ name: 'Handoff',
776
+ description: 'Hand off to Customer Success',
777
+ automationLevel: 'automated',
778
+ duration: '1 hour',
779
+ owner: 'AE',
780
+ },
781
+ ],
782
+ metrics: [
783
+ { name: 'Conversion Rate', target: 25, unit: '%' },
784
+ { name: 'Average Sales Cycle', target: 45, unit: 'days' },
785
+ { name: 'Win Rate', target: 25, unit: '%' },
786
+ ],
787
+ })
788
+
789
+ export const CustomerOnboardingProcess = Process({
790
+ name: 'Customer Onboarding',
791
+ description: 'Onboard new customers to achieve time-to-value',
792
+ owner: 'VP Customer Success',
793
+ steps: [
794
+ {
795
+ order: 1,
796
+ name: 'Welcome',
797
+ description: 'Send welcome email with access credentials',
798
+ automationLevel: 'automated',
799
+ duration: 'instant',
800
+ },
801
+ {
802
+ order: 2,
803
+ name: 'Kickoff Call',
804
+ description: 'Conduct kickoff call to set expectations',
805
+ automationLevel: 'manual',
806
+ duration: '1 hour',
807
+ owner: 'CSM',
808
+ },
809
+ {
810
+ order: 3,
811
+ name: 'Data Integration',
812
+ description: 'Help customer connect data sources',
813
+ automationLevel: 'semi-automated',
814
+ duration: '2 days',
815
+ owner: 'CSM',
816
+ },
817
+ {
818
+ order: 4,
819
+ name: 'Dashboard Setup',
820
+ description: 'Configure initial dashboards',
821
+ automationLevel: 'semi-automated',
822
+ duration: '1 day',
823
+ owner: 'CSM',
824
+ },
825
+ {
826
+ order: 5,
827
+ name: 'Training',
828
+ description: 'Conduct product training session',
829
+ automationLevel: 'manual',
830
+ duration: '2 hours',
831
+ owner: 'CSM',
832
+ },
833
+ {
834
+ order: 6,
835
+ name: 'First Value',
836
+ description: 'Ensure customer achieves first value milestone',
837
+ automationLevel: 'manual',
838
+ duration: '1 week',
839
+ owner: 'CSM',
840
+ },
841
+ {
842
+ order: 7,
843
+ name: 'Graduation',
844
+ description: 'Move customer to steady-state support',
845
+ automationLevel: 'automated',
846
+ duration: '1 day',
847
+ },
848
+ ],
849
+ metrics: [
850
+ { name: 'Time to Value', target: 14, unit: 'days' },
851
+ { name: 'Onboarding Completion Rate', target: 95, unit: '%' },
852
+ { name: 'CSAT', target: 90, unit: '%' },
853
+ ],
854
+ })
855
+
856
+ export const SupportTicketProcess = Process({
857
+ name: 'Support Ticket Resolution',
858
+ description: 'Handle customer support tickets efficiently',
859
+ owner: 'Support Lead',
860
+ steps: [
861
+ {
862
+ order: 1,
863
+ name: 'Intake',
864
+ description: 'Receive and categorize ticket',
865
+ automationLevel: 'automated',
866
+ duration: 'instant',
867
+ },
868
+ {
869
+ order: 2,
870
+ name: 'Triage',
871
+ description: 'Assess priority and assign to appropriate agent',
872
+ automationLevel: 'semi-automated',
873
+ duration: '15 minutes',
874
+ },
875
+ {
876
+ order: 3,
877
+ name: 'Initial Response',
878
+ description: 'Provide initial response to customer',
879
+ automationLevel: 'semi-automated',
880
+ duration: '1 hour',
881
+ owner: 'Support Agent',
882
+ },
883
+ {
884
+ order: 4,
885
+ name: 'Investigation',
886
+ description: 'Investigate and diagnose issue',
887
+ automationLevel: 'manual',
888
+ duration: '2 hours',
889
+ owner: 'Support Agent',
890
+ },
891
+ {
892
+ order: 5,
893
+ name: 'Resolution',
894
+ description: 'Resolve issue or escalate',
895
+ automationLevel: 'manual',
896
+ duration: '4 hours',
897
+ owner: 'Support Agent',
898
+ },
899
+ {
900
+ order: 6,
901
+ name: 'Verification',
902
+ description: 'Verify resolution with customer',
903
+ automationLevel: 'semi-automated',
904
+ duration: '1 hour',
905
+ },
906
+ {
907
+ order: 7,
908
+ name: 'Closure',
909
+ description: 'Close ticket and request feedback',
910
+ automationLevel: 'automated',
911
+ duration: 'instant',
912
+ },
913
+ ],
914
+ metrics: [
915
+ { name: 'First Response Time', target: 1, unit: 'hours' },
916
+ { name: 'Resolution Time', target: 8, unit: 'hours' },
917
+ { name: 'First Contact Resolution', target: 70, unit: '%' },
918
+ { name: 'CSAT', target: 90, unit: '%' },
919
+ ],
920
+ })
921
+
922
+ // =============================================================================
923
+ // 8. WORKFLOWS (Automated)
924
+ // =============================================================================
925
+
926
+ export const LeadScoringWorkflow = Workflow({
927
+ name: 'Lead Scoring',
928
+ description: 'Automatically score and qualify leads',
929
+ trigger: { type: 'event', event: 'lead.created' },
930
+ actions: [
931
+ {
932
+ order: 1,
933
+ type: 'compute',
934
+ name: 'Calculate Firmographic Score',
935
+ config: {
936
+ factors: ['company_size', 'industry', 'location'],
937
+ weights: [0.4, 0.35, 0.25],
938
+ },
939
+ },
940
+ {
941
+ order: 2,
942
+ type: 'compute',
943
+ name: 'Calculate Behavioral Score',
944
+ config: {
945
+ factors: ['page_views', 'content_downloads', 'email_opens'],
946
+ weights: [0.3, 0.4, 0.3],
947
+ },
948
+ },
949
+ {
950
+ order: 3,
951
+ type: 'compute',
952
+ name: 'Combine Scores',
953
+ config: {
954
+ formula: '(firmographic * 0.6) + (behavioral * 0.4)',
955
+ },
956
+ },
957
+ {
958
+ order: 4,
959
+ type: 'condition',
960
+ name: 'Check MQL Threshold',
961
+ condition: 'score >= 70',
962
+ },
963
+ {
964
+ order: 5,
965
+ type: 'notification',
966
+ name: 'Notify SDR',
967
+ config: {
968
+ channel: 'slack',
969
+ template: 'new_mql_alert',
970
+ },
971
+ },
972
+ ],
973
+ })
974
+
975
+ export const ChurnPredictionWorkflow = Workflow({
976
+ name: 'Churn Prediction Alert',
977
+ description: 'Alert CSM when customer shows churn signals',
978
+ trigger: { type: 'schedule', cron: '0 9 * * *' }, // Daily at 9 AM
979
+ actions: [
980
+ {
981
+ order: 1,
982
+ type: 'compute',
983
+ name: 'Calculate Health Score',
984
+ config: {
985
+ factors: ['usage_trend', 'support_tickets', 'login_frequency', 'feature_adoption'],
986
+ weights: [0.3, 0.2, 0.25, 0.25],
987
+ },
988
+ },
989
+ {
990
+ order: 2,
991
+ type: 'condition',
992
+ name: 'Check At-Risk Threshold',
993
+ condition: 'healthScore < 60',
994
+ },
995
+ {
996
+ order: 3,
997
+ type: 'notification',
998
+ name: 'Alert CSM',
999
+ config: {
1000
+ channel: 'email',
1001
+ template: 'at_risk_customer',
1002
+ priority: 'high',
1003
+ },
1004
+ },
1005
+ {
1006
+ order: 4,
1007
+ type: 'task',
1008
+ name: 'Create Save Play Task',
1009
+ config: {
1010
+ type: 'customer-save-play',
1011
+ assignTo: 'csm',
1012
+ dueIn: '48 hours',
1013
+ },
1014
+ },
1015
+ ],
1016
+ })
1017
+
1018
+ export const TrialConversionWorkflow = Workflow({
1019
+ name: 'Trial Conversion Nurture',
1020
+ description: 'Nurture trial users towards conversion',
1021
+ trigger: { type: 'event', event: 'trial.started' },
1022
+ actions: [
1023
+ {
1024
+ order: 1,
1025
+ type: 'notification',
1026
+ name: 'Welcome Email',
1027
+ config: { template: 'trial_welcome', channel: 'email' },
1028
+ },
1029
+ {
1030
+ order: 2,
1031
+ type: 'wait',
1032
+ name: 'Wait 3 Days',
1033
+ duration: '3 days',
1034
+ },
1035
+ {
1036
+ order: 3,
1037
+ type: 'condition',
1038
+ name: 'Check Activation',
1039
+ condition: 'user.hasConnectedDataSource == false',
1040
+ },
1041
+ {
1042
+ order: 4,
1043
+ type: 'notification',
1044
+ name: 'Activation Nudge',
1045
+ config: { template: 'connect_data_source', channel: 'email' },
1046
+ },
1047
+ {
1048
+ order: 5,
1049
+ type: 'wait',
1050
+ name: 'Wait Until Day 7',
1051
+ duration: '4 days',
1052
+ },
1053
+ {
1054
+ order: 6,
1055
+ type: 'task',
1056
+ name: 'Schedule Demo Call',
1057
+ config: {
1058
+ type: 'demo-call',
1059
+ assignTo: 'sdr',
1060
+ },
1061
+ },
1062
+ {
1063
+ order: 7,
1064
+ type: 'wait',
1065
+ name: 'Wait Until Day 12',
1066
+ duration: '5 days',
1067
+ },
1068
+ {
1069
+ order: 8,
1070
+ type: 'condition',
1071
+ name: 'Check Not Converted',
1072
+ condition: 'user.plan == "trial"',
1073
+ },
1074
+ {
1075
+ order: 9,
1076
+ type: 'notification',
1077
+ name: 'Final Offer Email',
1078
+ config: { template: 'trial_ending_offer', channel: 'email' },
1079
+ },
1080
+ ],
1081
+ })
1082
+
1083
+ // =============================================================================
1084
+ // 9. FINANCIALS
1085
+ // =============================================================================
1086
+
1087
+ export const CloudMetricsFinancials = financials({
1088
+ revenue: 9360000, // ARR
1089
+ cogs: 1872000, // 20% of revenue
1090
+ operatingExpenses: 6500000, // Salaries, marketing, etc.
1091
+ depreciation: 200000,
1092
+ interestExpense: 50000,
1093
+ otherIncome: 25000,
1094
+ taxes: 300000,
1095
+ })
1096
+
1097
+ // Additional SaaS-specific metrics
1098
+ export const SaaSMetrics = {
1099
+ mrr: 780000,
1100
+ arr: 9360000,
1101
+ customers: 720,
1102
+ arpu: 1083, // MRR / customers
1103
+ cac: 8500,
1104
+ ltv: 32500, // ARPU * 30 months avg
1105
+ ltvToCac: 3.8,
1106
+ paybackPeriod: 7.8, // months
1107
+ nrr: 115,
1108
+ grr: 97,
1109
+ quickRatio: 3.2, // (new + expansion) / (churn + contraction)
1110
+ burnMultiple: 1.8,
1111
+ ruleOf40: 52, // Growth rate + profit margin
1112
+ }
1113
+
1114
+ // =============================================================================
1115
+ // 10. UTILITY FUNCTIONS
1116
+ // =============================================================================
1117
+
1118
+ /**
1119
+ * Get full business summary
1120
+ */
1121
+ export function getBusinessSummary() {
1122
+ return {
1123
+ company: CloudMetricsBusiness,
1124
+ vision: CloudMetricsVision,
1125
+ goals: CloudMetricsGoals,
1126
+ product: CloudMetricsProduct,
1127
+ kpis: CloudMetricsKPIs,
1128
+ okrs: CloudMetricsOKRs,
1129
+ financials: CloudMetricsFinancials,
1130
+ metrics: SaaSMetrics,
1131
+ }
1132
+ }
1133
+
1134
+ /**
1135
+ * Calculate runway based on current metrics
1136
+ */
1137
+ export function calculateRunway() {
1138
+ const monthlyBurn = (CloudMetricsFinancials.operatingExpenses - CloudMetricsFinancials.revenue) / 12
1139
+ const cashOnHand = 5000000 // Assume $5M in bank
1140
+ return monthlyBurn > 0 ? cashOnHand / monthlyBurn : Infinity
1141
+ }
1142
+
1143
+ /**
1144
+ * Format key metrics for dashboard
1145
+ */
1146
+ export function getDashboardMetrics() {
1147
+ return {
1148
+ revenue: {
1149
+ mrr: $.format(SaaSMetrics.mrr),
1150
+ arr: $.format(SaaSMetrics.arr),
1151
+ growth: `${$.growth(SaaSMetrics.mrr, 700000)}%`, // vs last period
1152
+ },
1153
+ customers: {
1154
+ total: SaaSMetrics.customers,
1155
+ arpu: $.format(SaaSMetrics.arpu),
1156
+ nrr: `${SaaSMetrics.nrr}%`,
1157
+ },
1158
+ efficiency: {
1159
+ ltvToCac: `${SaaSMetrics.ltvToCac}x`,
1160
+ paybackPeriod: `${SaaSMetrics.paybackPeriod} months`,
1161
+ ruleOf40: SaaSMetrics.ruleOf40,
1162
+ },
1163
+ }
1164
+ }
1165
+
1166
+ // Export everything
1167
+ export default {
1168
+ business: CloudMetricsBusiness,
1169
+ vision: CloudMetricsVision,
1170
+ goals: CloudMetricsGoals,
1171
+ product: CloudMetricsProduct,
1172
+ pricing: PricingTiers,
1173
+ organization: CloudMetricsOrg,
1174
+ kpis: CloudMetricsKPIs,
1175
+ okrs: CloudMetricsOKRs,
1176
+ processes: {
1177
+ leadToCustomer: LeadToCustomerProcess,
1178
+ onboarding: CustomerOnboardingProcess,
1179
+ support: SupportTicketProcess,
1180
+ },
1181
+ workflows: {
1182
+ leadScoring: LeadScoringWorkflow,
1183
+ churnPrediction: ChurnPredictionWorkflow,
1184
+ trialConversion: TrialConversionWorkflow,
1185
+ },
1186
+ financials: CloudMetricsFinancials,
1187
+ metrics: SaaSMetrics,
1188
+ }