@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
@@ -1,15 +0,0 @@
1
- # marketing
2
-
3
- Marketing, content calendar, growth planning, brand strategy. Handles what CMO would do. Delegates to content, social, seo, newsletter agents.
4
-
5
- ## Rules
6
-
7
- - Load skills on demand
8
- - Draft before publish
9
- - Archive not delete (hidden=1)
10
- - Log every action to agent_memory
11
- - Push reports to agent_reports mid-session
12
-
13
- ## Skills
14
-
15
- See skills/marketing/SKILL.md and CLAUDE.md skills table.
@@ -1,109 +0,0 @@
1
- /**
2
- * NOVA — Chief Marketing Officer
3
- * "Content without strategy is noise. I make it signal."
4
- * Orchestrates: BLAKE, PEARL, COPY, HERMES, SCOUT
5
- * Reads: all analytics, all published content
6
- * Outputs: content calendar, campaign strategy, growth recommendations
7
- */
8
-
9
- import { BaseAgent, db } from '../_base.ts'
10
- import { analyticsAgent } from '../analytics/analytics.ts'
11
- import { blogWriter } from '../content/content.ts'
12
-
13
- export class CMO extends BaseAgent {
14
- readonly name = 'NOVA'
15
- readonly title = 'Chief Marketing Officer'
16
-
17
- async contentCalendar(weeksAhead = 4) {
18
- await this.init()
19
- const { profile, products } = await analyticsAgent.snapshot()
20
-
21
- const topProducts = products.slice(0, 3)
22
- const weeks: Array<{ week: number; items: CalendarItem[] }> = []
23
-
24
- for (let w = 1; w <= weeksAhead; w++) {
25
- const items: CalendarItem[] = []
26
-
27
- // Blog: 2 posts per week
28
- items.push({ day: 'Monday', type: 'blog', agent: 'BLAKE',
29
- suggestion: w % 2 === 0
30
- ? `How-to guide related to ${topProducts[0]?.title ?? 'your main product'}`
31
- : `Opinion/thought leadership in your niche` })
32
- items.push({ day: 'Thursday', type: 'blog', agent: 'BLAKE',
33
- suggestion: `Listicle or resource roundup for your audience` })
34
-
35
- // Newsletter: 1 per week
36
- items.push({ day: 'Wednesday', type: 'newsletter', agent: 'PEARL',
37
- suggestion: `Weekly digest + feature one product or win` })
38
-
39
- // Social: 3 posts per week via HERMES/n8n
40
- items.push({ day: 'Tuesday', type: 'social', agent: 'HERMES',
41
- suggestion: `Repurpose Monday blog post for LinkedIn/X` })
42
- items.push({ day: 'Friday', type: 'social', agent: 'HERMES',
43
- suggestion: `Behind-the-scenes or community engagement post` })
44
-
45
- weeks.push({ week: w, items })
46
- }
47
-
48
- return {
49
- business: this.ctx.profile.title,
50
- weeks_ahead: weeksAhead,
51
- calendar: weeks,
52
- strategy: this.growthStrategy(profile, products),
53
- }
54
- }
55
-
56
- async growthAudit() {
57
- await this.init()
58
- const snap = await analyticsAgent.snapshot()
59
- const drafts = await blogWriter.listDrafts()
60
-
61
- const totalTraffic = snap.profile?.total_clicks ?? 0
62
- const totalRevenue = snap.products.reduce((a, p) => a + p.revenue, 0)
63
- const conversionRate = totalTraffic > 0
64
- ? ((snap.profile?.total_sales ?? 0) / totalTraffic * 100).toFixed(2) + '%'
65
- : 'no data'
66
-
67
- return {
68
- traffic: totalTraffic,
69
- revenue: totalRevenue,
70
- conversion_rate: conversionRate,
71
- draft_count: drafts.length,
72
- top_referrers: snap.profile?.top_referrers ?? [],
73
- gaps: this.contentGaps(snap),
74
- }
75
- }
76
-
77
- private contentGaps(snap: Awaited<ReturnType<typeof analyticsAgent.snapshot>>): string[] {
78
- const gaps: string[] = []
79
- const types = new Set(snap.products.map(p => p.type))
80
-
81
- if (!types.has('course')) gaps.push('No course — add a course to build passive revenue')
82
- if (!types.has('service')) gaps.push('No services — add a service offering for quick revenue')
83
- if (!types.has('sponsorship')) gaps.push('Sponsorships page missing — monetize your audience directly')
84
- if ((snap.profile?.total_clicks ?? 0) < 100) gaps.push('Traffic too low — prioritize SEO content (ask SCOUT + BLAKE)')
85
- if (snap.links.length === 0) gaps.push('No link-in-bio links — add key links to drive traffic')
86
-
87
- return gaps
88
- }
89
-
90
- private growthStrategy(
91
- profile: Awaited<ReturnType<typeof analyticsAgent.snapshot>>['profile'],
92
- products: Awaited<ReturnType<typeof analyticsAgent.snapshot>>['products']
93
- ): string[] {
94
- const recs: string[] = []
95
- if ((profile?.total_clicks ?? 0) < 500)
96
- recs.push('Focus: publish 2 SEO-optimized blog posts per week for the next 30 days.')
97
- if (products.length === 0)
98
- recs.push('No products live. Launch your first paid product this week — even a $9 download.')
99
- if (products.length > 0 && (profile?.total_sales ?? 0) === 0)
100
- recs.push('Products exist but no sales. Review pricing, add social proof, drive traffic via HERMES.')
101
- return recs
102
- }
103
- }
104
-
105
- interface CalendarItem {
106
- day: string; type: 'blog' | 'newsletter' | 'social' | 'product'; agent: string; suggestion: string
107
- }
108
-
109
- export const cmo = new CMO()
@@ -1,11 +0,0 @@
1
- # newsletter
2
-
3
- Placeholder SOUL. See CLAUDE.md routing table and skills/newsletter/SKILL.md (if present) for scope.
4
-
5
- ## Rules
6
-
7
- - Load skills on demand
8
- - Draft before publish
9
- - Archive not delete (hidden=1)
10
- - Log every action to agent_memory
11
- - Push reports to agent_reports mid-session
@@ -1,91 +0,0 @@
1
- /**
2
- * PEARL — Newsletter Writer
3
- * "I turn your audience into a community."
4
- * Reads: subscribers table
5
- * Sends: via SES or Resend (credentials table)
6
- * Posts: via n8n webhook for scheduling
7
- */
8
-
9
- import { BaseAgent, db } from '../_base.ts'
10
-
11
- export interface NewsletterInput {
12
- subject: string
13
- preview_text?: string
14
- body_html: string
15
- body_text?: string // plain text fallback
16
- schedule_at?: string // ISO — pass to n8n for scheduled send
17
- }
18
-
19
- export class NewsletterWriter extends BaseAgent {
20
- readonly name = 'PEARL'
21
- readonly title = 'Newsletter Writer'
22
-
23
- async subscriberStats() {
24
- await this.init()
25
- const { rows: [r] } = await db.execute({
26
- sql: `SELECT COUNT(*) total,
27
- COUNT(CASE WHEN signup_timestamp > strftime('%s','now','-30 days') THEN 1 END) last_30d,
28
- COUNT(CASE WHEN country IS NOT NULL THEN 1 END) with_location
29
- FROM subscribers WHERE profile_id=?`,
30
- args: [this.profileId],
31
- })
32
- return { total: Number(r?.total ?? 0), last30d: Number(r?.last_30d ?? 0) }
33
- }
34
-
35
- async listSubscribers(limit = 100) {
36
- await this.init()
37
- const { rows } = await db.execute({
38
- sql: 'SELECT email,name,country,signup_timestamp FROM subscribers WHERE profile_id=? ORDER BY signup_timestamp DESC LIMIT ?',
39
- args: [this.profileId, limit],
40
- })
41
- return rows
42
- }
43
-
44
- /**
45
- * Send newsletter via n8n webhook.
46
- * n8n handles actual delivery via SES / Resend / any ESP.
47
- * Payload includes all subscriber data for n8n to iterate.
48
- */
49
- async send(input: NewsletterInput) {
50
- await this.init()
51
- const { n8n_webhook_url } = this.ctx.credentials
52
- if (!n8n_webhook_url) return { ok: false, reason: 'No n8n webhook configured' }
53
-
54
- const stats = await this.subscriberStats()
55
-
56
- try {
57
- const res = await fetch(n8n_webhook_url, {
58
- method: 'POST',
59
- headers: { 'Content-Type': 'application/json' },
60
- body: JSON.stringify({
61
- event: 'newsletter_send',
62
- business: this.ctx.profile.title,
63
- profile_id: this.profileId,
64
- subject: input.subject,
65
- preview_text: input.preview_text ?? null,
66
- body_html: input.body_html,
67
- body_text: input.body_text ?? null,
68
- schedule_at: input.schedule_at ?? null,
69
- subscriber_count: stats.total,
70
- timestamp: new Date().toISOString(),
71
- }),
72
- })
73
- return { ok: res.ok, status: res.status, subscriber_count: stats.total }
74
- } catch (e) {
75
- return { ok: false, reason: String(e) }
76
- }
77
- }
78
-
79
- /** Top countries for newsletter targeting */
80
- async audienceBreakdown() {
81
- await this.init()
82
- const { rows } = await db.execute({
83
- sql: `SELECT country, COUNT(*) n FROM subscribers WHERE profile_id=? AND country IS NOT NULL
84
- GROUP BY country ORDER BY n DESC LIMIT 10`,
85
- args: [this.profileId],
86
- })
87
- return rows
88
- }
89
- }
90
-
91
- export const newsletterWriter = new NewsletterWriter()
@@ -1,11 +0,0 @@
1
- # operations
2
-
3
- Placeholder SOUL. See CLAUDE.md routing table and skills/operations/SKILL.md (if present) for scope.
4
-
5
- ## Rules
6
-
7
- - Load skills on demand
8
- - Draft before publish
9
- - Archive not delete (hidden=1)
10
- - Log every action to agent_memory
11
- - Push reports to agent_reports mid-session
@@ -1,157 +0,0 @@
1
- /**
2
- * OTTO — Chief Operating Officer
3
- * "Pipelines don't run themselves. I make sure they do."
4
- * Manages: publish queue, draft pipeline, scheduling
5
- * Phase 3: becomes the CF Durable Object that runs everything autonomously
6
- */
7
-
8
- import { BaseAgent, db, now, iso } from '../_base.ts'
9
-
10
- interface ScheduledItem {
11
- table: string; id: string; title: string; scheduled_for: string | number
12
- }
13
-
14
- export class COO extends BaseAgent {
15
- readonly name = 'OTTO'
16
- readonly title = 'Chief Operating Officer'
17
-
18
- /** All drafts across every content type. Content lives in the unified
19
- * `content` table — we split it by cms.slug for the pipeline view. */
20
- async draftPipeline() {
21
- await this.init()
22
-
23
- const { rows: contentRows } = await db.execute({
24
- sql: `SELECT c.id, c.title, c.date AS scheduled_for, cms.slug AS kind
25
- FROM content c
26
- JOIN cms ON cms.id = c.cms_id
27
- WHERE c.profile_id=? AND c.published=0 AND c.hidden=0
28
- ORDER BY c.updated_at DESC`,
29
- args: [this.profileId],
30
- })
31
-
32
- const byKind: Record<string, { label: string; table: string; drafts: any[] }> = {}
33
- for (const r of contentRows) {
34
- const kind = String(r.kind ?? 'content')
35
- const entry = byKind[kind] ??= { label: titleCase(kind), table: kind, drafts: [] }
36
- entry.drafts.push({ id: r.id, title: r.title, scheduled_for: r.scheduled_for })
37
- }
38
-
39
- const others = await Promise.all(
40
- [
41
- { table: 'products', label: 'Products', dateCol: 'created_at' },
42
- { table: 'pages', label: 'Pages', dateCol: 'created_at' },
43
- { table: 'job_listings', label: 'Jobs', dateCol: 'created_at' },
44
- { table: 'forms', label: 'Forms', dateCol: 'created_at' },
45
- ].map(async ({ table, label, dateCol }) => {
46
- const { rows } = await db.execute({
47
- sql: `SELECT id, title, ${dateCol} AS scheduled_for
48
- FROM ${table} WHERE profile_id=? AND published=0 AND hidden=0
49
- ORDER BY created_at DESC`,
50
- args: [this.profileId],
51
- })
52
- return { label, table, drafts: rows }
53
- }),
54
- )
55
-
56
- return [...Object.values(byKind), ...others].filter(r => r.drafts.length > 0)
57
- }
58
-
59
- /** Content due for publish right now */
60
- async publishQueue(): Promise<ScheduledItem[]> {
61
- await this.init()
62
- const nowUnix = now()
63
- const nowISO = iso()
64
- const queue: ScheduledItem[] = []
65
-
66
- // content table: `date` is ISO TEXT
67
- const { rows: contentDue } = await db.execute({
68
- sql: `SELECT id, title, date AS scheduled_for
69
- FROM content
70
- WHERE profile_id=? AND published=0 AND hidden=0
71
- AND date IS NOT NULL AND date <= ?
72
- ORDER BY date ASC`,
73
- args: [this.profileId, nowISO],
74
- })
75
- contentDue.forEach(r => queue.push({
76
- table: 'content', id: r.id as string,
77
- title: r.title as string, scheduled_for: r.scheduled_for as string,
78
- }))
79
-
80
- // job_listings: ISO `date`
81
- const { rows: jobs } = await db.execute({
82
- sql: `SELECT id, title, date AS scheduled_for FROM job_listings
83
- WHERE profile_id=? AND published=0 AND hidden=0
84
- AND date IS NOT NULL AND date <= ? ORDER BY date ASC`,
85
- args: [this.profileId, nowISO],
86
- })
87
- jobs.forEach(r => queue.push({
88
- table: 'job_listings', id: r.id as string,
89
- title: r.title as string, scheduled_for: r.scheduled_for as string,
90
- }))
91
-
92
- // products: unix `published_at`
93
- const { rows: products } = await db.execute({
94
- sql: `SELECT id, title, published_at AS scheduled_for FROM products
95
- WHERE profile_id=? AND published=0 AND hidden=0
96
- AND published_at IS NOT NULL AND published_at <= ?
97
- ORDER BY published_at ASC`,
98
- args: [this.profileId, nowUnix],
99
- })
100
- products.forEach(r => queue.push({
101
- table: 'products', id: r.id as string,
102
- title: r.title as string, scheduled_for: r.scheduled_for as number,
103
- }))
104
-
105
- return queue
106
- }
107
-
108
- /**
109
- * Run the publish queue — flips published=1 on all due items.
110
- * Phase 1: call manually. Phase 3: called by CF Durable Object on cron.
111
- */
112
- async runPublishQueue(): Promise<ScheduledItem[]> {
113
- await this.init()
114
- const { n8n_webhook_url } = this.ctx.credentials
115
- const queue = await this.publishQueue()
116
- if (!queue.length) return []
117
-
118
- const isoTables = new Set(['content', 'job_listings'])
119
- const statements = queue.map(item => ({
120
- sql: `UPDATE ${item.table} SET published=1, updated_at=?
121
- WHERE id=? AND profile_id=?`,
122
- args: [isoTables.has(item.table) ? iso() : now(), item.id, this.profileId],
123
- }))
124
- await db.batch(statements)
125
-
126
- if (n8n_webhook_url) {
127
- fetch(n8n_webhook_url, {
128
- method: 'POST',
129
- headers: { 'Content-Type': 'application/json' },
130
- body: JSON.stringify({ event: 'content_published', business: this.ctx.profile.title, items: queue }),
131
- }).catch(() => { /* non-blocking */ })
132
- }
133
-
134
- return queue
135
- }
136
-
137
- /** Schedule any content for future publish. */
138
- async schedule(table: 'content' | 'products' | 'job_listings', id: string, at: Date) {
139
- await this.init()
140
- const isISO = table !== 'products'
141
- const dateCol = table === 'products' ? 'published_at' : 'date'
142
- const val = isISO ? at.toISOString().slice(0, 19) + 'Z' : Math.floor(at.getTime() / 1000)
143
- const updCol = isISO ? `updated_at='${iso()}'` : `updated_at=${now()}`
144
-
145
- await db.write({
146
- sql: `UPDATE ${table} SET published=0, ${dateCol}=?, ${updCol}
147
- WHERE id=? AND profile_id=?`,
148
- args: [val, id, this.profileId],
149
- })
150
- }
151
- }
152
-
153
- function titleCase(s: string): string {
154
- return s.charAt(0).toUpperCase() + s.slice(1)
155
- }
156
-
157
- export const coo = new COO()
@@ -1,44 +0,0 @@
1
- # sales
2
-
3
- Manages the full CRM pipeline — contacts, deals, outreach, proposals, invoices, tasks, inbox.
4
- Dashboard route: /dashboard/contacts/ (not /crm/).
5
-
6
- ## What I do
7
-
8
- - Contact management: add leads, enrich, score (0-100), track outreach status
9
- - Deal pipeline: stages (new → contacted → proposal → negotiation → won → lost)
10
- - Outreach: draft DMs and emails, queue for approval, log replies
11
- - Proposals: draft, send, track opens/clicks, collect signatures
12
- - Invoices: create, send, track payment
13
- - Tasks: follow-up reminders, due dates, priorities
14
- - Inbox: inbound replies, sentiment, next action
15
-
16
- ## Approval gate — non-negotiable
17
-
18
- ALL outbound activities (DMs, emails, proposals) start as:
19
- approval_status = 'pending_approval'
20
- Never set auto_sent unless contact.auto_approve = 1.
21
- Surface pending approvals at session start.
22
-
23
- ## Rules
24
-
25
- - crm_activities is APPEND-ONLY — never UPDATE, insert correcting row instead
26
- - crm_analytics is TRIGGER-managed — never write to it directly
27
- - Groups: use lib/groups.ts helpers, never LIKE '%grp_x%'
28
- - load_score must be 0-100 — use validate.leadScore() from lib/validate.ts
29
- - Proposals + invoices: email tracking columns written by triggers — don't touch
30
- - Archive contacts: hidden=1, never hard delete
31
- - Log every action to agent_memory after completion
32
-
33
- ## Tables I use
34
-
35
- crm_contacts, crm_deals, crm_activities, crm_tasks, crm_notes,
36
- crm_groups, crm_contact_groups, crm_templates, crm_proposals,
37
- crm_invoices, crm_imports, crm_analytics (read-only)
38
-
39
- ## Session start
40
-
41
- 1. Check crm_analytics.total_pending_approvals
42
- 2. Show pending activities needing approval
43
- 3. Show tasks due today
44
- 4. Show hot leads (lead_score DESC, outreach_status = 'outreach_ready')