@businesskit/agent 1.0.4 → 1.0.5

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 (153) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.cursor-plugin/plugin.json +25 -0
  3. package/.cursorrules +10 -0
  4. package/.superconsole-plugin/plugin.json +32 -0
  5. package/AGENTS.md +94 -63
  6. package/CLAUDE.md +11 -84
  7. package/GEMINI.md +11 -34
  8. package/README.md +106 -153
  9. package/assets/logo.svg +3 -0
  10. package/bin/businesskit.js +11 -17
  11. package/commands/add-contact.md +47 -0
  12. package/commands/add-inventory-from-invoice.md +80 -0
  13. package/commands/adjust-stock.md +46 -0
  14. package/commands/capabilities.md +33 -0
  15. package/commands/check-stock.md +43 -0
  16. package/commands/create-component.md +109 -0
  17. package/commands/create-invoice.md +69 -0
  18. package/commands/create-new-bill.md +65 -0
  19. package/commands/create-page.md +96 -0
  20. package/commands/list-components.md +41 -0
  21. package/commands/list-content.md +46 -0
  22. package/commands/list-pages.md +45 -0
  23. package/commands/publish-page.md +64 -0
  24. package/commands/send-invoice.md +42 -0
  25. package/commands/seo-audit.md +36 -0
  26. package/commands/update-contact.md +46 -0
  27. package/commands/update-content.md +47 -0
  28. package/commands/update-page.md +55 -0
  29. package/commands/update-price.md +47 -0
  30. package/commands/write-blog.md +52 -0
  31. package/commands/write-docs.md +84 -0
  32. package/commands/write-guide.md +46 -0
  33. package/commands/write-newsletter.md +46 -0
  34. package/mcp_config.json +8 -0
  35. package/package.json +34 -23
  36. package/plugin.json +32 -0
  37. package/scripts/setup.sh +134 -0
  38. package/scripts/setup.ts +92 -0
  39. package/server.json +21 -0
  40. package/skills/README.md +19 -27
  41. package/skills/billing/SKILL.md +64 -0
  42. package/skills/brand/SKILL.md +30 -86
  43. package/skills/copywriting/SKILL.md +1 -1
  44. package/skills/crm/SKILL.md +38 -0
  45. package/skills/docs-cms/SKILL.md +53 -0
  46. package/skills/docs-cms/references/how-to.md +383 -0
  47. package/skills/inbox/SKILL.md +49 -0
  48. package/skills/inventory/SKILL.md +69 -0
  49. package/skills/pages/SKILL.md +169 -0
  50. package/skills/pages/references/sections-catalog.json +950 -0
  51. package/skills/social/SKILL.md +1 -1
  52. package/templates/antigravity.json +8 -0
  53. package/templates/claude-code.mcp.json +8 -0
  54. package/templates/cursor.mcp.json +8 -0
  55. package/templates/vscode.mcp.json +9 -0
  56. package/.claude/commands/analytics.md +0 -7
  57. package/.claude/commands/blog-writer.md +0 -9
  58. package/.claude/commands/cbo.md +0 -7
  59. package/.claude/commands/ceo.md +0 -10
  60. package/.claude/commands/cmo.md +0 -7
  61. package/.claude/commands/compress.md +0 -73
  62. package/.claude/commands/coo.md +0 -11
  63. package/.claude/commands/copywriter.md +0 -15
  64. package/.claude/commands/course-creator.md +0 -9
  65. package/.claude/commands/crm.md +0 -591
  66. package/.claude/commands/deep.md +0 -50
  67. package/.claude/commands/docs-writer.md +0 -8
  68. package/.claude/commands/forms-builder.md +0 -10
  69. package/.claude/commands/ingest.md +0 -110
  70. package/.claude/commands/jobs-manager.md +0 -8
  71. package/.claude/commands/kb.md +0 -107
  72. package/.claude/commands/newsletter-writer.md +0 -9
  73. package/.claude/commands/preserve.md +0 -64
  74. package/.claude/commands/resume.md +0 -67
  75. package/.claude/commands/scheduler.md +0 -8
  76. package/.claude/commands/seo.md +0 -60
  77. package/.claude/commands/social.md +0 -51
  78. package/.claude/commands/store-manager.md +0 -11
  79. package/.claude/settings.json +0 -16
  80. package/.claude/settings.local.json +0 -11
  81. package/.env.example +0 -12
  82. package/.mcp.json +0 -3
  83. package/HEARTBEAT.md +0 -105
  84. package/PLAN.md +0 -345
  85. package/PRD-Agent-Composition.md +0 -149
  86. package/PRD-Agent-Harness.md +0 -316
  87. package/REFERENCE.md +0 -160
  88. package/SOUL.md +0 -148
  89. package/SYSTEM.md +0 -71
  90. package/agents/_base.ts +0 -371
  91. package/agents/analytics/SOUL.md +0 -11
  92. package/agents/analytics/analytics.ts +0 -405
  93. package/agents/business/SOUL.md +0 -11
  94. package/agents/business/business.ts +0 -109
  95. package/agents/ceo/SOUL.md +0 -15
  96. package/agents/ceo/ceo.ts +0 -146
  97. package/agents/content/SOUL.md +0 -11
  98. package/agents/content/content.ts +0 -379
  99. package/agents/copywriting/SOUL.md +0 -11
  100. package/agents/copywriting/copywriting.ts +0 -89
  101. package/agents/courses/SOUL.md +0 -11
  102. package/agents/courses/courses.ts +0 -451
  103. package/agents/docs/SOUL.md +0 -11
  104. package/agents/docs/docs.ts +0 -77
  105. package/agents/forms/SOUL.md +0 -11
  106. package/agents/forms/forms.ts +0 -364
  107. package/agents/hiring/SOUL.md +0 -11
  108. package/agents/hiring/hiring.ts +0 -314
  109. package/agents/marketing/SOUL.md +0 -15
  110. package/agents/marketing/marketing.ts +0 -109
  111. package/agents/newsletter/SOUL.md +0 -11
  112. package/agents/newsletter/newsletter.ts +0 -91
  113. package/agents/operations/SOUL.md +0 -11
  114. package/agents/operations/operations.ts +0 -157
  115. package/agents/sales/SOUL.md +0 -44
  116. package/agents/sales/sales.ts +0 -883
  117. package/agents/scheduler/SOUL.md +0 -11
  118. package/agents/scheduler/scheduler.ts +0 -68
  119. package/agents/seo/SOUL.md +0 -11
  120. package/agents/seo/seo.ts +0 -288
  121. package/agents/social/SOUL.md +0 -11
  122. package/agents/social/social.ts +0 -744
  123. package/agents/store/SOUL.md +0 -11
  124. package/agents/store/store.ts +0 -514
  125. package/cli.ts +0 -144
  126. package/context/about-me.md +0 -96
  127. package/context/brand-voice.md +0 -127
  128. package/context/brand.md +0 -80
  129. package/context/business.md +0 -66
  130. package/context/working-style.md +0 -87
  131. package/lib/analytics.ts +0 -81
  132. package/lib/cms.ts +0 -88
  133. package/lib/db.adapter.ts +0 -30
  134. package/lib/db.ts +0 -63
  135. package/lib/enums.ts +0 -25
  136. package/lib/groups.ts +0 -122
  137. package/lib/id.ts +0 -43
  138. package/lib/kb.ts +0 -337
  139. package/lib/memory.ts +0 -219
  140. package/lib/pattern-detector.ts +0 -169
  141. package/lib/profile.ts +0 -155
  142. package/lib/schema.ts +0 -2015
  143. package/lib/slug.ts +0 -30
  144. package/lib/validate.ts +0 -33
  145. package/setup.ts +0 -141
  146. package/skills/agents/SKILL.md +0 -56
  147. package/skills/analytics/SKILL.md +0 -52
  148. package/skills/blog-writer/SKILL.md +0 -452
  149. package/skills/ceo/SKILL.md +0 -25
  150. package/skills/cmo/SKILL.md +0 -8
  151. package/skills/schema/SKILL.md +0 -86
  152. package/skills/store/SKILL.md +0 -62
  153. package/tsconfig.json +0 -14
package/lib/slug.ts DELETED
@@ -1,30 +0,0 @@
1
- import { db } from './db.ts'
2
-
3
- export const toSlug = (s: string) =>
4
- s.toLowerCase().trim()
5
- .replace(/[^\w\s-]/g, '').replace(/[\s_]+/g, '-')
6
- .replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, 100)
7
-
8
- /**
9
- * Generate a unique slug within a table.
10
- * Products use global uniqueness (no profile scope).
11
- * All other tables scope uniqueness to profile_id.
12
- */
13
- export async function uniqueSlug(
14
- table: string,
15
- title: string,
16
- profileId?: string
17
- ): Promise<string> {
18
- const base = toSlug(title)
19
- let slug = base, i = 0
20
- while (true) {
21
- const { rows } = await db.execute({
22
- sql: profileId
23
- ? `SELECT 1 FROM ${table} WHERE slug=? AND profile_id=? LIMIT 1`
24
- : `SELECT 1 FROM ${table} WHERE slug=? LIMIT 1`,
25
- args: profileId ? [slug, profileId] : [slug],
26
- })
27
- if (!rows.length) return slug
28
- slug = `${base}-${++i}`
29
- }
30
- }
package/lib/validate.ts DELETED
@@ -1,33 +0,0 @@
1
- // lib/validate.ts
2
- // Guard numeric fields before DB writes.
3
- // DB triggers will reject out-of-bounds — catch early for clearer errors.
4
-
5
- export function leadScore(n: number): number {
6
- if (!Number.isFinite(n) || n < 0 || n > 100)
7
- throw new Error(`lead_score must be 0–100, got ${n}`)
8
- return Math.round(n)
9
- }
10
-
11
- export function probability(n: number): number {
12
- if (!Number.isFinite(n) || n < 0 || n > 100)
13
- throw new Error(`probability must be 0–100, got ${n}`)
14
- return Math.round(n)
15
- }
16
-
17
- export function cents(n: number): number {
18
- if (!Number.isFinite(n) || n < 0 || !Number.isInteger(n))
19
- throw new Error(`cents must be non-negative integer, got ${n}`)
20
- return n
21
- }
22
-
23
- export function hotScore(n: number): number {
24
- if (!Number.isFinite(n) || n < 0)
25
- throw new Error(`hot_score must be >= 0, got ${n}`)
26
- return n
27
- }
28
-
29
- export function slug(s: string): string {
30
- if (!s || s.length > 200)
31
- throw new Error(`slug must be 1–200 chars, got "${s}"`)
32
- return s.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-')
33
- }
package/setup.ts DELETED
@@ -1,141 +0,0 @@
1
- /**
2
- * setup.ts — verify everything works after cloning.
3
- * Usage: npm run setup
4
- */
5
-
6
- import { existsSync } from 'fs'
7
- import { readFileSync } from 'fs'
8
- import { createClient } from '@libsql/client/web'
9
-
10
- const BOLD = '\x1b[1m'
11
- const GREEN = '\x1b[32m'
12
- const RED = '\x1b[31m'
13
- const DIM = '\x1b[2m'
14
- const RESET = '\x1b[0m'
15
-
16
- const ok = (msg: string) => console.log(`${GREEN}✓${RESET} ${msg}`)
17
- const err = (msg: string) => console.error(`${RED}✗${RESET} ${msg}`)
18
- const dim = (msg: string) => console.log(`${DIM} ${msg}${RESET}`)
19
-
20
- console.log(`\n${BOLD}BusinessKit Agent — Setup Check${RESET}\n`)
21
-
22
- // ── Step 1: .env exists ───────────────────────────────────────────────────────
23
- console.log('1. Checking .env file...')
24
- if (!existsSync('.env')) {
25
- err('.env not found')
26
- dim('Run: cp .env.example .env')
27
- dim('Then paste TURSO_URL and TURSO_TOKEN from BusinessKit → Settings → Credentials')
28
- process.exit(1)
29
- }
30
-
31
- // Parse .env manually (no dotenv dependency needed for setup)
32
- const env: Record<string, string> = {}
33
- readFileSync('.env', 'utf8').split('\n').forEach(line => {
34
- const [k, ...v] = line.split('=')
35
- if (k && v.length) env[k.trim()] = v.join('=').trim().replace(/^["']|["']$/g, '')
36
- })
37
-
38
- const TURSO_URL = env.TURSO_URL || process.env.TURSO_URL || ''
39
- const TURSO_TOKEN = env.TURSO_TOKEN || process.env.TURSO_TOKEN || ''
40
-
41
- if (!TURSO_URL) {
42
- err('TURSO_URL is missing from .env')
43
- dim('Find it at: BusinessKit → Settings → Credentials')
44
- process.exit(1)
45
- }
46
- if (!TURSO_TOKEN) {
47
- err('TURSO_TOKEN is missing from .env')
48
- dim('Find it at: BusinessKit → Settings → Credentials')
49
- process.exit(1)
50
- }
51
- if (!TURSO_URL.startsWith('libsql://')) {
52
- err(`TURSO_URL looks wrong: "${TURSO_URL}"`)
53
- dim('It should start with libsql://')
54
- process.exit(1)
55
- }
56
- ok('.env found with TURSO_URL and TURSO_TOKEN')
57
-
58
- // ── Step 2: Turso connection ──────────────────────────────────────────────────
59
- console.log('\n2. Testing Turso connection...')
60
- let db: ReturnType<typeof createClient>
61
- try {
62
- db = createClient({ url: TURSO_URL, authToken: TURSO_TOKEN })
63
- await db.execute('SELECT 1')
64
- ok('Turso connected')
65
- } catch (e: any) {
66
- err(`Turso connection failed: ${e.message}`)
67
- dim('Check TURSO_URL and TURSO_TOKEN — make sure they match exactly')
68
- dim('Token must not have extra spaces or quotes')
69
- process.exit(1)
70
- }
71
-
72
- // ── Step 3: Profile exists ────────────────────────────────────────────────────
73
- console.log('\n3. Loading your profile...')
74
- const PROFILE_ID = env.PROFILE_ID || process.env.PROFILE_ID || ''
75
- try {
76
- const { rows } = await db.execute('SELECT id, slug, title FROM profiles')
77
- if (!rows.length) {
78
- err('No profile found in your database')
79
- dim('Complete BusinessKit onboarding at businesskit.io first')
80
- dim('Then come back and run: npm run setup')
81
- process.exit(1)
82
- }
83
- if (rows.length > 1 && !PROFILE_ID) {
84
- err(`Found ${rows.length} profiles — set PROFILE_ID in .env to pick one:`)
85
- for (const r of rows) dim(` ${r.id} (${r.title} @${r.slug})`)
86
- process.exit(1)
87
- }
88
- const p = PROFILE_ID
89
- ? rows.find(r => r.id === PROFILE_ID)
90
- : rows[0]
91
- if (!p) {
92
- err(`PROFILE_ID=${PROFILE_ID} not found in your database`)
93
- dim('Available:')
94
- for (const r of rows) dim(` ${r.id} (${r.title} @${r.slug})`)
95
- process.exit(1)
96
- }
97
- ok(`Profile: ${p.title} (@${p.slug})`)
98
- dim(`Profile ID: ${p.id}`)
99
- } catch (e: any) {
100
- err(`Could not read profiles table: ${e.message}`)
101
- dim('Your database may not be provisioned yet')
102
- dim('Complete BusinessKit onboarding first')
103
- process.exit(1)
104
- }
105
-
106
- // ── Step 4: Key agent tables exist ───────────────────────────────────────────
107
- console.log('\n4. Checking database tables...')
108
- const requiredTables = ['profiles', 'posts', 'products', 'subscribers', 'crm_contacts', 'social_posts']
109
- const missing: string[] = []
110
-
111
- for (const table of requiredTables) {
112
- try {
113
- await db.execute(`SELECT 1 FROM ${table} LIMIT 0`)
114
- } catch {
115
- missing.push(table)
116
- }
117
- }
118
-
119
- if (missing.length) {
120
- err(`Missing tables: ${missing.join(', ')}`)
121
- dim('Your DB may not be fully provisioned')
122
- dim('Go to BusinessKit → Dashboard → Status and click "Provision"')
123
- process.exit(1)
124
- }
125
- ok(`All required tables found`)
126
-
127
- // ── Step 5: Node version ──────────────────────────────────────────────────────
128
- console.log('\n5. Checking Node.js version...')
129
- const [major] = process.versions.node.split('.').map(Number)
130
- if (major < 18) {
131
- err(`Node.js ${process.versions.node} is too old (need 18+)`)
132
- dim('Install Node.js 18+ from nodejs.org')
133
- process.exit(1)
134
- }
135
- ok(`Node.js ${process.versions.node}`)
136
-
137
- // ── Done ──────────────────────────────────────────────────────────────────────
138
- console.log(`\n${GREEN}${BOLD}✅ All checks passed.${RESET}\n`)
139
- console.log(`Open this folder in Claude Code and type ${BOLD}/ceo${RESET} to start.\n`)
140
- console.log(`Or run from terminal:`)
141
- console.log(` ${DIM}npx tsx cli.ts ceo${RESET}\n`)
@@ -1,56 +0,0 @@
1
- # Agent Roster
2
-
3
- Every agent has a name, title, and clear domain. C-Suite orchestrates. Creators write. Growth distributes.
4
-
5
- ## C-Suite — Strategy & Intelligence
6
-
7
- | Name | Title | Call when... |
8
- |---|---|---|
9
- | **ARIA** | CEO | Weekly briefing, cross-agent priorities, `aria.weeklyBriefing()` |
10
- | **NOVA** | CMO | Content calendar, growth gaps, `nova.contentCalendar()` |
11
- | **OTTO** | COO | Publish queue, draft pipeline, scheduling, `otto.draftPipeline()` |
12
- | **REX** | CBO | Revenue report, pricing audit, upsell strategy, `rex.revenueReport()` |
13
-
14
- ## Creators — Content Production
15
-
16
- | Name | Title | Table | Key method |
17
- |---|---|---|---|
18
- | **BLAKE** | Blog Writer | `posts` | `blake.create({ title, content })` |
19
- | **PEARL** | Newsletter Writer | `subscribers` | `pearl.send({ subject, body_html })` |
20
- | **COPY** | Copywriter | `pages`, `products.description` | `copy.createPage()`, `copy.updateProductCopy()` |
21
- | **SAGE** | Course Creator | `products` (type=course) | `sage.create()`, `sage.addLesson()` |
22
- | **LEO** | Store Manager | `products` (all other types) | `leo.create({ type, ... })` |
23
- | **JOB** | Jobs Manager | `job_listings` | `job.create()` |
24
- | **FELIX** | Forms Builder | `forms`, `questions` | `felix.create({ title, questions })` |
25
- | **DOC** | Docs Writer | `doc_collections`, `doc_articles` | `doc.createArticle()` |
26
-
27
- ## Growth — Distribution & Intelligence
28
-
29
- | Name | Title | Role |
30
- |---|---|---|
31
- | **SCOUT** | SEO Agent | Audits slugs/meta, sets collection SEO |
32
- | **ATLAS** | Analytics Agent | Read-only analytics across all tables |
33
- | **HERMES** | Social Agent | Posts to n8n → social platforms |
34
- | **CRON** | Scheduler | Runs hourly/daily/weekly jobs (Phase 3: CF Workflows) |
35
-
36
- ## Store — Product Types via LEO
37
-
38
- LEO handles all digital commerce. Pass `type` to select:
39
-
40
- | Type | What it is |
41
- |---|---|
42
- | `download` | Digital file (PDF, ZIP, video) |
43
- | `course` | Multi-lesson course — use SAGE instead for lesson management |
44
- | `meeting` | 1:1 call (calendar_link required) |
45
- | `webinar` | Live or recorded webinar |
46
- | `event` | Ticketed event |
47
- | `listing` | Platform listing (newsletter, community, etc.) |
48
- | `sponsorship` | Sponsor slot with billing_interval |
49
- | `service` | Custom or on-demand service |
50
-
51
- ## Composition Pattern
52
-
53
- Agents call each other. Example: `/ceo` calls `analyticsAgent.snapshot()` + `blogWriter.summary()` + `storeManager.storeOverview()`.
54
- NOVA calls BLAKE to draft posts. OTTO calls HERMES after publishing.
55
-
56
- Never call C-Suite methods inside Creator agents. Dependency direction: C-Suite → Growth → Creators.
@@ -1,52 +0,0 @@
1
- # Analytics Skill — Reading the Data
2
-
3
- ## How analytics columns work
4
-
5
- All analytics are stored as JSON in TEXT columns. Parse with JSON.parse().
6
-
7
- ### Time series arrays
8
-
9
- ```
10
- analytics_7d = [n, n, n, n, n, n, n] → last 7 days, oldest first
11
- analytics_30d = [n, n, ..., n] → last 30 days
12
- analytics_12m = [n, n, ..., n] → last 12 months
13
- analytics_24h = [n, n, ..., n] → last 24 hours (hourly)
14
- ```
15
-
16
- ### Lifetime object
17
-
18
- ```
19
- analytics_lifetime = { "2026-03": 142, "2026-04": 89, ... }
20
- revenue_lifetime = { "2026-03": 42000, "2026-04": 15000, ... }
21
- // values are counts (clicks) or cents (revenue)
22
- ```
23
-
24
- ### Breakdown objects (country, device, referrer)
25
-
26
- ```
27
- country_clicks = { "US": 420, "GB": 88, "IN": 45, ... }
28
- device_clicks = { "mobile": 312, "desktop": 201 }
29
- referrer_clicks = { "twitter.com": 88, "direct": 204, ... }
30
- ```
31
-
32
- ## Key metrics to surface in briefings
33
-
34
- **Traffic**: total_clicks, top country, top referrer, 30d trend (compare last 30d vs prior 30d)
35
- **Revenue**: total_earnings (cents → divide by 100), total_sales count, top product by revenue
36
- **Content**: posts published this month, drafts waiting, newsletter subscribers
37
- **Social**: posts published, scheduled, accounts connected
38
-
39
- ## Revenue trend calculation
40
-
41
- ```ts
42
- const months = Object.entries(revenue_lifetime).sort()
43
- const last = months.slice(-1)[0]?.[1] ?? 0
44
- const prior = months.slice(-2,-1)[0]?.[1] ?? 0
45
- const trend = prior > 0 ? ((last - prior) / prior * 100).toFixed(1) + '%' : 'N/A'
46
- ```
47
-
48
- ## Never write to analytics tables
49
-
50
- Analytics are updated by the app on user actions (clicks, purchases).
51
- Agents read analytics. The app writes analytics. Never reverse this.
52
- Exception: seed a product_analytics or link_analytics row when creating a new product/link.