@businesskit/agent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/agents.md +56 -0
- package/.agents/skills/analytics.md +47 -0
- package/.agents/skills/brand.md +87 -0
- package/.agents/skills/schema.md +45 -0
- package/.agents/skills/store.md +46 -0
- package/.claude/commands/analytics.md +7 -0
- package/.claude/commands/blog-writer.md +9 -0
- package/.claude/commands/cbo.md +7 -0
- package/.claude/commands/ceo.md +10 -0
- package/.claude/commands/cmo.md +7 -0
- package/.claude/commands/compress.md +73 -0
- package/.claude/commands/coo.md +11 -0
- package/.claude/commands/copywriter.md +15 -0
- package/.claude/commands/course-creator.md +9 -0
- package/.claude/commands/crm.md +82 -0
- package/.claude/commands/deep.md +50 -0
- package/.claude/commands/docs-writer.md +8 -0
- package/.claude/commands/forms-builder.md +10 -0
- package/.claude/commands/jobs-manager.md +8 -0
- package/.claude/commands/kb.md +107 -0
- package/.claude/commands/newsletter-writer.md +9 -0
- package/.claude/commands/preserve.md +64 -0
- package/.claude/commands/resume.md +67 -0
- package/.claude/commands/scheduler.md +8 -0
- package/.claude/commands/seo.md +60 -0
- package/.claude/commands/social.md +51 -0
- package/.claude/commands/store-manager.md +11 -0
- package/.claude/skills/README.md +33 -0
- package/.claude/skills/agents.md +56 -0
- package/.claude/skills/analytics.md +7 -0
- package/.claude/skills/blog-writing.md +452 -0
- package/.claude/skills/brand.md +44 -0
- package/.claude/skills/content-seo.md +0 -0
- package/.claude/skills/humanizer.md +474 -0
- package/.claude/skills/schema.md +45 -0
- package/.claude/skills/social-content.md +278 -0
- package/.claude/skills/store-copywriting.md +519 -0
- package/.claude/skills/store.md +62 -0
- package/.claude-plugin/plugin.json +33 -0
- package/.cursorrules +0 -0
- package/.env.example +2 -0
- package/.mcp.json +3 -0
- package/AGENTS.md +63 -0
- package/CLAUDE.md +221 -0
- package/GEMINI.md +37 -0
- package/LICENSE +21 -0
- package/PLAN.md +253 -0
- package/PRD-Agent-Harness.md +316 -0
- package/README.md +237 -0
- package/SYSTEM.md +49 -0
- package/agents/_base.ts +63 -0
- package/agents/creators/blog-writer.ts +347 -0
- package/agents/creators/copywriter.ts +89 -0
- package/agents/creators/course-creator.ts +106 -0
- package/agents/creators/crm-agent.ts +479 -0
- package/agents/creators/docs-writer.ts +77 -0
- package/agents/creators/forms-builder.ts +90 -0
- package/agents/creators/jobs-manager.ts +82 -0
- package/agents/creators/newsletter-writer.ts +91 -0
- package/agents/creators/store-manager.ts +138 -0
- package/agents/csuite/cbo.ts +109 -0
- package/agents/csuite/ceo.ts +121 -0
- package/agents/csuite/cmo.ts +109 -0
- package/agents/csuite/coo.ts +115 -0
- package/agents/growth/analytics-agent.ts +52 -0
- package/agents/growth/scheduler.ts +68 -0
- package/agents/growth/seo-agent.ts +282 -0
- package/agents/growth/social-agent.ts +346 -0
- package/bin/businesskit.js +17 -0
- package/cli.ts +125 -0
- package/context/brand.md +80 -0
- package/context/business.md +66 -0
- package/lib/analytics.ts +81 -0
- package/lib/db.adapter.ts +30 -0
- package/lib/db.ts +16 -0
- package/lib/id.ts +15 -0
- package/lib/kb.ts +337 -0
- package/lib/memory.ts +219 -0
- package/lib/pattern-detector.ts +169 -0
- package/lib/profile.ts +119 -0
- package/lib/slug.ts +30 -0
- package/package.json +50 -0
- package/setup.ts +127 -0
- package/tsconfig.json +13 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# BusinessKit Agent — Project Brain
|
|
2
|
+
|
|
3
|
+
You are an autonomous business agent team for a BusinessKit creator.
|
|
4
|
+
Read and write directly to their Turso database.
|
|
5
|
+
Credentials in `.env` — `TURSO_URL` + `TURSO_TOKEN`.
|
|
6
|
+
|
|
7
|
+
System prompt: see `SYSTEM.md` — loaded automatically by pi / agent tools.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The Five-File System
|
|
12
|
+
|
|
13
|
+
| File | What it is | When to read |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `CLAUDE.md` | This file — routing rules, schema, never-do list | Every session start (auto) |
|
|
16
|
+
| `SYSTEM.md` | System prompt — cost, efficiency, how to work | Every session start (auto) |
|
|
17
|
+
| `memory.md` | User preferences (never/always do X) | Every session start (auto) |
|
|
18
|
+
| `context/brand.md` | Brand voice, audience, tone | Only when writing content |
|
|
19
|
+
| `context/business.md` | Goals, revenue model, schedule | CEO briefings only |
|
|
20
|
+
|
|
21
|
+
From Turso (live, synced across all machines):
|
|
22
|
+
|
|
23
|
+
- `agent_memory` — last 20 agent actions
|
|
24
|
+
- `agent_skills` — live skill instructions, editable from dashboard
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Skills — Load On Demand, Not All At Once
|
|
29
|
+
|
|
30
|
+
Each skill costs tokens. Only load what the current task needs.
|
|
31
|
+
|
|
32
|
+
| Task | Load |
|
|
33
|
+
|---|---|
|
|
34
|
+
| Any content writing | `.agents/skills/brand.md` |
|
|
35
|
+
| SEO, meta, LLM visibility | `.agents/skills/brand.md` |
|
|
36
|
+
| Products, pricing, store | `.agents/skills/store.md` |
|
|
37
|
+
| Analytics JSON columns | `.agents/skills/analytics.md` |
|
|
38
|
+
| Routing / which agent | `.agents/skills/agents.md` |
|
|
39
|
+
| DB queries, table names | `.agents/skills/schema.md` |
|
|
40
|
+
|
|
41
|
+
Never load all skills. Never load a skill "just in case".
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Start of Every Session
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { sessionContext } from './lib/memory.ts'
|
|
49
|
+
import { getBrandContext } from './lib/profile.ts'
|
|
50
|
+
|
|
51
|
+
// 1. Load memory_log + agent_skills from Turso
|
|
52
|
+
const { memory, skills } = await sessionContext()
|
|
53
|
+
|
|
54
|
+
// 2. Load brand context from DB
|
|
55
|
+
const { profile, settings, credentials } = await getBrandContext()
|
|
56
|
+
|
|
57
|
+
// 3. Read memory.md for preferences
|
|
58
|
+
// (Claude Code reads this automatically as a project file)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
After every significant action:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { logMemory } from './lib/memory.ts'
|
|
65
|
+
await logMemory('blog-writer', 'Published "Email Tips" (listicle, 2100 words)', { id, slug })
|
|
66
|
+
await logMemory('crm', 'Drafted DMs for 5 hot leads', { count: 5 })
|
|
67
|
+
await logMemory('social', 'Scheduled post to LinkedIn + X', { post_id })
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
When user states a preference:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
User: "Stop signing newsletters with Cheers"
|
|
74
|
+
→ Add to memory.md: "Newsletter sign-off: use 'Best,' not 'Cheers'"
|
|
75
|
+
→ Apply immediately to current task
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## The One Rule
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
profile_id = one business = one isolated universe
|
|
84
|
+
Every INSERT needs profile_id. Every SELECT filters by profile_id. No exceptions.
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Agent Routing Rules
|
|
90
|
+
|
|
91
|
+
Read the request → route to the right agent. Don't do the work in the wrong agent.
|
|
92
|
+
|
|
93
|
+
| Request | Agent |
|
|
94
|
+
|---|---|
|
|
95
|
+
| "brief me" / "weekly update" / "what's happening" | `/ceo` |
|
|
96
|
+
| "revenue" / "pricing" / "sales breakdown" | `/cbo` |
|
|
97
|
+
| "content calendar" / "what should I write next" | `/cmo` |
|
|
98
|
+
| "publish queue" / "what's scheduled" | `/coo` |
|
|
99
|
+
| "write a post" / "blog" / "listicle" / "guide" / "vs article" | `/blog-writer` |
|
|
100
|
+
| "newsletter" / "email subscribers" | `/newsletter-writer` |
|
|
101
|
+
| "product description" / "landing page" / "bio" | `/copywriter` |
|
|
102
|
+
| "course" / "lessons" / "module" | `/course-creator` |
|
|
103
|
+
| "add product" / "launch" / "store item" | `/store-manager` |
|
|
104
|
+
| "job listing" / "hiring" / "applications" | `/jobs-manager` |
|
|
105
|
+
| "form" / "intake" / "survey" | `/forms-builder` |
|
|
106
|
+
| "docs" / "knowledge base" / "help article" | `/docs-writer` |
|
|
107
|
+
| "lead" / "contact" / "deal" / "outreach" / "CRM" | `/crm` |
|
|
108
|
+
| "post to" / "social" / "tweet" / "LinkedIn" / "schedule post" | `/social` |
|
|
109
|
+
| "analytics" / "traffic" / "how many clicks" | `/analytics` |
|
|
110
|
+
| "SEO" / "meta" / "keyword" / "LLM visibility" / "content gaps" | `/seo` |
|
|
111
|
+
| "schedule" / "publish queue" / "cron" | `/scheduler` |
|
|
112
|
+
| complex multi-step / "do everything" / "take over" | `/deep` |
|
|
113
|
+
|
|
114
|
+
**Rule: agents → skills direction only.** C-Suite delegates to Creators. Creators never call C-Suite.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Skills Directory — `.agents/skills/`
|
|
119
|
+
|
|
120
|
+
All tools read these. Universal. Not Claude-specific.
|
|
121
|
+
|
|
122
|
+
| File | Contents |
|
|
123
|
+
|---|---|
|
|
124
|
+
| `schema.md` | All 30+ tables — column names, types, rules |
|
|
125
|
+
| `brand.md` | Content quality bars, voice rules, what not to say |
|
|
126
|
+
| `agents.md` | Full roster, dependency direction, routing |
|
|
127
|
+
| `analytics.md` | How to read JSON analytics columns |
|
|
128
|
+
| `store.md` | Product types, required fields, pricing rules |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Agent Roster
|
|
133
|
+
|
|
134
|
+
### C-Suite — `agents/csuite/`
|
|
135
|
+
|
|
136
|
+
CEO → CMO → COO → CBO
|
|
137
|
+
C-Suite reads data, makes decisions, delegates. Never writes content directly.
|
|
138
|
+
|
|
139
|
+
### Creators — `agents/creators/`
|
|
140
|
+
|
|
141
|
+
blog-writer, newsletter-writer, copywriter, course-creator, store-manager,
|
|
142
|
+
jobs-manager, forms-builder, docs-writer, crm-agent
|
|
143
|
+
|
|
144
|
+
### Growth — `agents/growth/`
|
|
145
|
+
|
|
146
|
+
analytics-agent, seo-agent, social-agent, scheduler
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Full Schema Quick Reference
|
|
151
|
+
|
|
152
|
+
### Content tables (all: profile_id, slug, title, content, excerpt, published, hidden, collection_id)
|
|
153
|
+
|
|
154
|
+
posts (+seo_title, seo_description, content_type, word_count) | newsletter | notes | guides
|
|
155
|
+
compare | alternative | prompt | skills (published skill articles, NOT agent skills)
|
|
156
|
+
doc_collections (INT AUTOINCREMENT) | doc_articles (INT AUTOINCREMENT)
|
|
157
|
+
|
|
158
|
+
### Products
|
|
159
|
+
|
|
160
|
+
type: download|course|meeting|webinar|event|listing|sponsorship|service
|
|
161
|
+
price_cents INT | slug UNIQUE | published | hidden=1 to archive
|
|
162
|
+
|
|
163
|
+
### CRM
|
|
164
|
+
|
|
165
|
+
crm_contacts: lead_score, icp_match, outreach_status, agent_status, agent_context JSON, auto_approve
|
|
166
|
+
crm_activities: approval_status (pending→approved|auto_sent|rejected) — append-only
|
|
167
|
+
crm_deals: stage (new|contacted|proposal|negotiation|won|lost)
|
|
168
|
+
crm_analytics: DB triggers keep this in sync — NEVER update manually
|
|
169
|
+
|
|
170
|
+
### Social
|
|
171
|
+
|
|
172
|
+
social_accounts: connection_mode (zernio_byok|zernio_platform|direct|n8n)
|
|
173
|
+
social_posts: status, scheduled_for, scheduled_via, zernio_post_id
|
|
174
|
+
Platform key (ZERNIO_API_KEY) NEVER used by agents — only via Worker /api/social/schedule
|
|
175
|
+
|
|
176
|
+
### Memory (Turso)
|
|
177
|
+
|
|
178
|
+
memory_log: rolling 20 rows per profile
|
|
179
|
+
agent_skills: UNIQUE(profile_id,slug) — upsert safe
|
|
180
|
+
|
|
181
|
+
### Analytics — READ ONLY
|
|
182
|
+
|
|
183
|
+
Never write to profile_analytics, product_analytics, link_analytics, form_analytics
|
|
184
|
+
|
|
185
|
+
### Key IDs and timestamps
|
|
186
|
+
|
|
187
|
+
ulid() for most tables | omit id for doc_* (AUTOINCREMENT)
|
|
188
|
+
now() = Math.floor(Date.now()/1000) for INT cols
|
|
189
|
+
iso() = new Date().toISOString().slice(0,19)+'Z' for TEXT cols (posts, jobs, forms)
|
|
190
|
+
|
|
191
|
+
### categories (seeded — never insert)
|
|
192
|
+
|
|
193
|
+
cat_1=links | cat_15=startups | cat_18=courses | cat_19=downloads
|
|
194
|
+
Cat_31=jobs | Cat_32=docs | Cat_34=forms | Cat_35=blog
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Phase 2 (in-app, Cloudflare Worker)
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
// Only this line changes between local CLI and in-app:
|
|
202
|
+
import { createAgentDB } from '~/lib/db.adapter'
|
|
203
|
+
const ceo = new CEO(createAgentDB(event)) // inject from sharedMap
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`db.adapter.ts` is the only diff between Phase 1 (local) and Phase 2 (CF Worker).
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Never Do
|
|
211
|
+
|
|
212
|
+
- Write a row without `profile_id`
|
|
213
|
+
- Hard delete anything — always `hidden=1`
|
|
214
|
+
- Log or print values from `credentials` table
|
|
215
|
+
- Hardcode `profile_id` — always load from `getProfile()`
|
|
216
|
+
- Insert rows into `categories` — use existing seeded IDs
|
|
217
|
+
- Modify `users` or `sessions` tables
|
|
218
|
+
- Write to analytics tables (except seeding a new analytics row on create)
|
|
219
|
+
- Call C-Suite from within a Creator or Growth agent
|
|
220
|
+
- Use `ZERNIO_API_KEY` directly — platform key only goes via Worker endpoint
|
|
221
|
+
- Assume `progress.md` exists — memory is now in `memory_log` Turso table
|
package/GEMINI.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# BusinessKit Agent
|
|
2
|
+
|
|
3
|
+
Autonomous business agent team powered by the user's own Turso database.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cp .env.example .env # add TURSO_URL + TURSO_TOKEN
|
|
9
|
+
npm install
|
|
10
|
+
npx tsx setup.ts # verify connection
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Run agents
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx tsx cli.ts ceo
|
|
17
|
+
npx tsx cli.ts blog-writer
|
|
18
|
+
npx tsx cli.ts analytics
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## What an agent is
|
|
22
|
+
|
|
23
|
+
A TypeScript class. It runs a SQL query against Turso. Returns data. That's it.
|
|
24
|
+
|
|
25
|
+
## Agent roster + files
|
|
26
|
+
|
|
27
|
+
See `CLAUDE.md` for full schema and `PLAN.md` for complete agent list.
|
|
28
|
+
|
|
29
|
+
## Skills
|
|
30
|
+
Load `.agents/skills/` for full context:
|
|
31
|
+
- `schema.md`, `brand.md`, `store.md`, `analytics.md`, `agents.md`
|
|
32
|
+
|
|
33
|
+
## Key rules
|
|
34
|
+
|
|
35
|
+
- All writes require `profile_id`
|
|
36
|
+
- Never hard delete — set `hidden=1`
|
|
37
|
+
- Credentials table is read-only — never log values
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 businesskitai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PLAN.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# BusinessKit Agent — Master Build Plan
|
|
2
|
+
|
|
3
|
+
> One-man army. Autonomous. Profile-isolated. Turso-powered.
|
|
4
|
+
> Built to run locally (Phase 1), in-app via MCP (Phase 2), autonomous on CF Workflows (Phase 3).
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## The Mental Model
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
profile_id = one business = one isolated universe
|
|
12
|
+
Every agent operates within exactly one profile.
|
|
13
|
+
All reads/writes are scoped to profile_id. No exceptions.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Store** = all digital commerce:
|
|
17
|
+
digital downloads, courses, 1:1 meetings, webinars, events, listings, sponsorships, services.
|
|
18
|
+
These all live in the `products` table under different `type` values.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Agent Roster
|
|
23
|
+
|
|
24
|
+
### C-Suite (Intelligence + Strategy)
|
|
25
|
+
|
|
26
|
+
| Title | File | Role |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| CEO | `agents/csuite/ceo.ts` | Weekly briefing, cross-agent orchestration, priority setting |
|
|
29
|
+
| CMO | `agents/csuite/cmo.ts` | Campaign strategy, content calendar, growth recommendations |
|
|
30
|
+
| COO | `agents/csuite/coo.ts` | Content pipeline, publish queue, scheduling oversight |
|
|
31
|
+
| CBO | `agents/csuite/cbo.ts` | Revenue analysis, product strategy, pricing recommendations |
|
|
32
|
+
|
|
33
|
+
### Content Creators
|
|
34
|
+
|
|
35
|
+
| Title | File | Writes to |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| Blog Writer | `agents/creators/blog-writer.ts` | `posts` |
|
|
38
|
+
| Newsletter Writer | `agents/creators/newsletter-writer.ts` | `subscribers` + email via SES/Resend |
|
|
39
|
+
| Copywriter | `agents/creators/copywriter.ts` | `pages`, `products.description`, `links` |
|
|
40
|
+
| Course Creator | `agents/creators/course-creator.ts` | `products` (type=course) + lessons JSON |
|
|
41
|
+
| Store Manager | `agents/creators/store-manager.ts` | `products` (downloads, services, webinars, events, listings, sponsorships, meetings) |
|
|
42
|
+
| Jobs Manager | `agents/creators/jobs-manager.ts` | `job_listings` + `job_applications` |
|
|
43
|
+
| Forms Builder | `agents/creators/forms-builder.ts` | `forms` + `questions` |
|
|
44
|
+
| Docs Writer | `agents/creators/docs-writer.ts` | `doc_collections` + `doc_articles` |
|
|
45
|
+
|
|
46
|
+
### Growth & Intelligence
|
|
47
|
+
|
|
48
|
+
| Title | File | Role |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| SEO Agent | `agents/growth/seo-agent.ts` | `collections`, slugs, meta, OG tags |
|
|
51
|
+
| Analytics Agent | `agents/growth/analytics-agent.ts` | All analytics tables — reads only, never writes |
|
|
52
|
+
| Social Agent | `agents/growth/social-agent.ts` | `credentials.n8n_webhook_url` → social platforms |
|
|
53
|
+
| Scheduler | `agents/growth/scheduler.ts` | `published=0 + date <= now()` → flips published=1 |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Current Repository Structure
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
businesskit-agent/ ← clone this repo
|
|
61
|
+
│
|
|
62
|
+
├── CLAUDE.md ← 🧠 project brain — auto-loaded by Claude Code
|
|
63
|
+
├── AGENTS.md ← Codex entry point — auto-loaded by Codex
|
|
64
|
+
├── GEMINI.md ← Gemini CLI entry point — auto-loaded
|
|
65
|
+
├── README.md ← user guide
|
|
66
|
+
├── memory.md ← 📝 preferences (gitignored, never committed)
|
|
67
|
+
├── .env ← your Turso credentials (gitignored, you create this)
|
|
68
|
+
├── .env.example ← template — committed, shows what to fill in
|
|
69
|
+
├── .gitignore
|
|
70
|
+
├── .cursorrules ← Cursor IDE rules — auto-loaded by Cursor
|
|
71
|
+
├── .mcp.json ← MCP server config (Turso)
|
|
72
|
+
├── package.json
|
|
73
|
+
├── tsconfig.json
|
|
74
|
+
├── cli.ts ← npx tsx cli.ts <agent>
|
|
75
|
+
├── setup.ts ← npm run setup — verifies Turso connection
|
|
76
|
+
├── provision-migrations.ts ← ⚠️ copy entries into main app's provision.ts
|
|
77
|
+
├── PLAN.md ← phased build plan
|
|
78
|
+
├── PRD-Agent-Harness.md ← harness architecture reference
|
|
79
|
+
│
|
|
80
|
+
├── context/ ← 📖 brand docs — committed, fill in once
|
|
81
|
+
│ ├── brand.md ← brand voice, audience, tone, products
|
|
82
|
+
│ └── business.md ← goals, revenue model, publishing schedule
|
|
83
|
+
│
|
|
84
|
+
├── agents/
|
|
85
|
+
│ ├── _base.ts ← BaseAgent class — all agents extend this
|
|
86
|
+
│ ├── csuite/
|
|
87
|
+
│ │ ├── ceo.ts ← CEO — briefing, orchestration
|
|
88
|
+
│ │ ├── cmo.ts ← CMO — content calendar, growth
|
|
89
|
+
│ │ ├── coo.ts ← COO — publish queue, pipeline
|
|
90
|
+
│ │ └── cbo.ts ← CBO — revenue, pricing
|
|
91
|
+
│ ├── creators/
|
|
92
|
+
│ │ ├── blog-writer.ts ← 8 content types, all content tables
|
|
93
|
+
│ │ ├── newsletter-writer.ts ← newsletter + SES/Resend send
|
|
94
|
+
│ │ ├── copywriter.ts ← pages, product descriptions, bio
|
|
95
|
+
│ │ ├── course-creator.ts ← products (type=course) + lessons
|
|
96
|
+
│ │ ├── store-manager.ts ← all other product types
|
|
97
|
+
│ │ ├── jobs-manager.ts ← job_listings + applications
|
|
98
|
+
│ │ ├── forms-builder.ts ← forms + questions
|
|
99
|
+
│ │ ├── docs-writer.ts ← doc_collections + doc_articles
|
|
100
|
+
│ │ └── crm-agent.ts ← contacts, deals, outreach pipeline
|
|
101
|
+
│ └── growth/
|
|
102
|
+
│ ├── analytics-agent.ts ← read-only analytics snapshot
|
|
103
|
+
│ ├── seo-agent.ts ← audit, fix, LLM visibility
|
|
104
|
+
│ ├── social-agent.ts ← Zernio API → 13 platforms
|
|
105
|
+
│ └── scheduler.ts ← publish queue, cron
|
|
106
|
+
│
|
|
107
|
+
├── lib/
|
|
108
|
+
│ ├── db.ts ← Turso client (reads TURSO_URL + TURSO_TOKEN)
|
|
109
|
+
│ ├── db.adapter.ts ← Phase 2 bridge for CF Worker / sharedMap
|
|
110
|
+
│ ├── memory.ts ← memory_log + agent_skills Turso helpers
|
|
111
|
+
│ ├── profile.ts ← getBrandContext() — profile + credentials
|
|
112
|
+
│ ├── analytics.ts ← read-only analytics helpers
|
|
113
|
+
│ ├── id.ts ← ulid() + now() + iso()
|
|
114
|
+
│ └── slug.ts ← toSlug() + uniqueSlug()
|
|
115
|
+
│
|
|
116
|
+
├── .agents/skills/ ← 🌐 universal skills — all tools read this
|
|
117
|
+
│ ├── agents.md ← roster, routing rules, dependency direction
|
|
118
|
+
│ ├── schema.md ← all 30+ tables, columns, ID/timestamp rules
|
|
119
|
+
│ ├── brand.md ← content quality bars, voice rules
|
|
120
|
+
│ ├── analytics.md ← how to read JSON analytics columns
|
|
121
|
+
│ └── store.md ← product types, required fields, pricing
|
|
122
|
+
│
|
|
123
|
+
├── .claude/
|
|
124
|
+
│ ├── commands/ ← slash commands for Claude Code + Cowork
|
|
125
|
+
│ │ ├── ceo.md ← /ceo
|
|
126
|
+
│ │ ├── cmo.md ← /cmo
|
|
127
|
+
│ │ ├── coo.md ← /coo
|
|
128
|
+
│ │ ├── cbo.md ← /cbo
|
|
129
|
+
│ │ ├── blog-writer.md ← /blog-writer
|
|
130
|
+
│ │ ├── newsletter-writer.md ← /newsletter-writer
|
|
131
|
+
│ │ ├── copywriter.md ← /copywriter
|
|
132
|
+
│ │ ├── course-creator.md ← /course-creator
|
|
133
|
+
│ │ ├── store-manager.md ← /store-manager
|
|
134
|
+
│ │ ├── jobs-manager.md ← /jobs-manager
|
|
135
|
+
│ │ ├── forms-builder.md ← /forms-builder
|
|
136
|
+
│ │ ├── docs-writer.md ← /docs-writer
|
|
137
|
+
│ │ ├── crm.md ← /crm
|
|
138
|
+
│ │ ├── social.md ← /social
|
|
139
|
+
│ │ ├── analytics.md ← /analytics
|
|
140
|
+
│ │ ├── seo.md ← /seo
|
|
141
|
+
│ │ ├── scheduler.md ← /scheduler
|
|
142
|
+
│ │ └── deep.md ← /deep
|
|
143
|
+
│ └── skills/ ← Claude Code specific (mirrors .agents/skills/)
|
|
144
|
+
│ ├── README.md
|
|
145
|
+
│ ├── agents.md
|
|
146
|
+
│ ├── schema.md
|
|
147
|
+
│ ├── brand.md
|
|
148
|
+
│ ├── analytics.md
|
|
149
|
+
│ └── store.md
|
|
150
|
+
│
|
|
151
|
+
└── .claude-plugin/
|
|
152
|
+
└── plugin.json ← Claude Cowork plugin manifest
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Skills vs Commands
|
|
158
|
+
|
|
159
|
+
| Location | What | When it runs |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `.claude/skills/` | Background knowledge — schema, brand, store types, analytics patterns | Auto-loaded on every conversation |
|
|
162
|
+
| `.claude/commands/` | Step-by-step task instructions per agent | Only when user types `/command-name` |
|
|
163
|
+
|
|
164
|
+
Skills are **passive context**. Commands are **active triggers**.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Phase 1 — Local Repo ✅ Complete
|
|
169
|
+
|
|
170
|
+
**Goal**: Users clone → drop in `.env` → run any agent via Claude Code, Cowork, or terminal.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
git clone https://github.com/businesskit/businesskit-agent
|
|
174
|
+
cd businesskit-agent
|
|
175
|
+
npm install
|
|
176
|
+
cp .env.example .env # paste TURSO_URL + TURSO_TOKEN from BusinessKit dashboard
|
|
177
|
+
npm run setup # verify connection
|
|
178
|
+
# Open in Claude Code → type /ceo for first briefing
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**CLI**:
|
|
182
|
+
```bash
|
|
183
|
+
npx tsx cli.ts ceo # CEO weekly briefing
|
|
184
|
+
npx tsx cli.ts blog-writer # list posts
|
|
185
|
+
npx tsx cli.ts scheduler hourly # run publish queue
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Delivered**:
|
|
189
|
+
- [x] `CLAUDE.md` — full schema, brand rules, agent roster
|
|
190
|
+
- [x] `lib/` — db, db.adapter, **memory.ts** (memory_log + agent_skills), id, slug, profile, analytics
|
|
191
|
+
- [x] `provision-migrations.ts` — copy `NEW_TABLES_SQL` / `MIGRATIONS_SQL` into main app `src/lib/provision.ts`
|
|
192
|
+
- [x] `agents/_base.ts` — BaseAgent with profile isolation
|
|
193
|
+
- [x] Agents: 4 C-Suite + 9 Creators (incl. CRM) + 4 Growth
|
|
194
|
+
- [x] Slash commands in `.claude/commands/` (incl. `/crm`, `/deep`)
|
|
195
|
+
- [x] 5 skill files in `.claude/skills/` and `.agents/skills/`
|
|
196
|
+
- [x] `context/brand.md` + `context/business.md` — committed brand docs
|
|
197
|
+
- [x] `cli.ts` — universal terminal entry point
|
|
198
|
+
- [x] `.claude-plugin/plugin.json`
|
|
199
|
+
- [x] `README.md` + `.env.example` + `setup.ts`
|
|
200
|
+
|
|
201
|
+
**Not in repo (live in Turso after provision)**:
|
|
202
|
+
- `memory_log` — last 20 agent actions per profile (replaces `progress.md`)
|
|
203
|
+
- `agent_skills` — dashboard-editable skills (brand-voice, seo, store, analytics)
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Phase 2 — In-App (Qwik + CF Worker)
|
|
208
|
+
|
|
209
|
+
**Goal**: Same agents, same code, running inside the BusinessKit dashboard via MCP tool calls.
|
|
210
|
+
|
|
211
|
+
**The only change**: swap the DB client source.
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
// Phase 1 — local, reads from .env
|
|
215
|
+
const ceo = new CEO()
|
|
216
|
+
|
|
217
|
+
// Phase 2 — CF Worker, reads from sharedMap set by plugin.ts
|
|
218
|
+
import { createAgentDB } from '~/lib/db.adapter'
|
|
219
|
+
const ceo = new CEO(createAgentDB(event))
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Deliverables**:
|
|
223
|
+
- [ ] Copy `agents/` + `lib/` into `src/lib/agents/` in the Qwik app
|
|
224
|
+
- [ ] `/api/mcp` route in `src/routes/api/mcp/index.tsx`
|
|
225
|
+
- [ ] One MCP tool definition per agent action
|
|
226
|
+
- [ ] Session auth → `sharedMap["userClient"]` → `createAgentDB(event)`
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Phase 3 — Autonomous (CF Workflows + Durable Objects)
|
|
231
|
+
|
|
232
|
+
**Goal**: Agents run on cron with no user present.
|
|
233
|
+
|
|
234
|
+
**Deliverables**:
|
|
235
|
+
- [ ] `scheduler.ts` as CF Durable Object (stub already in file — uncomment to activate)
|
|
236
|
+
- [ ] Weekly CEO briefing → n8n → email/Slack (`0 8 * * 1`)
|
|
237
|
+
- [ ] Hourly publish queue → flips `published=1` + triggers Social Agent (`0 * * * *`)
|
|
238
|
+
- [ ] CMO auto-generates content calendar → creates drafts via Blog Writer / Store Manager
|
|
239
|
+
- [ ] Newsletter Writer sends on schedule via SES/Resend
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Design Rules
|
|
244
|
+
|
|
245
|
+
- **Minimal code** — raw libSQL, no ORM, no boilerplate beyond BaseAgent
|
|
246
|
+
- **profile_id on every write** — enforced in BaseAgent, never per-agent
|
|
247
|
+
- **No hard deletes** — always `hidden=1`
|
|
248
|
+
- **No credentials in logs** — credentials table is read-only, never output values
|
|
249
|
+
- **One file per agent** — file name = command name (kebab-case)
|
|
250
|
+
- **Composable** — C-Suite calls Growth calls Creators. Never reverse.
|
|
251
|
+
- **n8n = external integration layer** — social posting, email delivery
|
|
252
|
+
- **CF Workflows = cron layer** — Scheduler designed for Durable Objects from day one
|
|
253
|
+
- **Same codebase, two transports** — `db.adapter.ts` is the only diff between Phase 1 and 2
|