@businesskit/agent 1.0.2 → 1.0.4
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/.claude/settings.json +16 -0
- package/.claude/settings.local.json +11 -0
- package/.claude-plugin/marketplace.json +36 -0
- package/.claude-plugin/plugin.json +7 -28
- package/.env.example +10 -0
- package/CLAUDE.md +56 -195
- package/HEARTBEAT.md +81 -57
- package/PLAN.md +211 -119
- package/PRD-Agent-Composition.md +149 -0
- package/README.md +25 -11
- package/REFERENCE.md +160 -0
- package/SOUL.md +31 -0
- package/SYSTEM.md +22 -0
- package/agents/_base.ts +352 -44
- package/agents/analytics/SOUL.md +11 -0
- package/agents/analytics/analytics.ts +405 -0
- package/agents/business/SOUL.md +11 -0
- package/agents/{csuite/cbo.ts → business/business.ts} +2 -2
- package/agents/ceo/SOUL.md +15 -0
- package/agents/{csuite → ceo}/ceo.ts +33 -8
- package/agents/content/SOUL.md +11 -0
- package/agents/content/content.ts +379 -0
- package/agents/copywriting/SOUL.md +11 -0
- package/agents/courses/SOUL.md +11 -0
- package/agents/courses/courses.ts +451 -0
- package/agents/docs/SOUL.md +11 -0
- package/agents/forms/SOUL.md +11 -0
- package/agents/forms/forms.ts +364 -0
- package/agents/hiring/SOUL.md +11 -0
- package/agents/hiring/hiring.ts +314 -0
- package/agents/marketing/SOUL.md +15 -0
- package/agents/{csuite/cmo.ts → marketing/marketing.ts} +3 -3
- package/agents/newsletter/SOUL.md +11 -0
- package/agents/operations/SOUL.md +11 -0
- package/agents/operations/operations.ts +157 -0
- package/agents/sales/SOUL.md +44 -0
- package/agents/sales/sales.ts +883 -0
- package/agents/scheduler/SOUL.md +11 -0
- package/agents/{growth → scheduler}/scheduler.ts +2 -2
- package/agents/seo/SOUL.md +11 -0
- package/agents/{growth/seo-agent.ts → seo/seo.ts} +60 -54
- package/agents/social/SOUL.md +11 -0
- package/agents/social/social.ts +744 -0
- package/agents/store/SOUL.md +11 -0
- package/agents/store/store.ts +514 -0
- package/cli.ts +44 -25
- package/lib/cms.ts +88 -0
- package/lib/db.ts +58 -11
- package/lib/enums.ts +25 -0
- package/lib/groups.ts +122 -0
- package/lib/id.ts +38 -10
- package/lib/profile.ts +44 -8
- package/lib/schema.ts +2015 -0
- package/lib/validate.ts +33 -0
- package/package.json +1 -1
- package/scripts/generate-schema.ts +244 -0
- package/setup.ts +16 -2
- package/{.agents/skills/analytics.md → skills/analytics/SKILL.md} +6 -1
- package/{.agents/skills/brand.md → skills/brand/SKILL.md} +14 -1
- package/skills/ceo/SKILL.md +25 -0
- package/skills/cmo/SKILL.md +8 -0
- package/skills/humanizer/SKILL.md +270 -0
- package/skills/schema/SKILL.md +86 -0
- package/tsconfig.json +2 -1
- package/.agents/skills/schema.md +0 -45
- package/.agents/skills/store.md +0 -46
- package/.claude/skills/agents.md +0 -56
- package/.claude/skills/analytics.md +0 -7
- package/.claude/skills/brand.md +0 -44
- package/.claude/skills/humanizer.md +0 -474
- package/.claude/skills/schema.md +0 -45
- package/agents/creators/blog-writer.ts +0 -347
- package/agents/creators/course-creator.ts +0 -106
- package/agents/creators/crm-agent.ts +0 -479
- package/agents/creators/forms-builder.ts +0 -90
- package/agents/creators/jobs-manager.ts +0 -82
- package/agents/creators/store-manager.ts +0 -138
- package/agents/csuite/coo.ts +0 -115
- package/agents/growth/analytics-agent.ts +0 -52
- package/agents/growth/social-agent.ts +0 -346
- /package/{ingest.md → .claude/commands/ingest.md} +0 -0
- /package/agents/{creators/copywriter.ts → copywriting/copywriting.ts} +0 -0
- /package/agents/{creators/docs-writer.ts → docs/docs.ts} +0 -0
- /package/agents/{creators/newsletter-writer.ts → newsletter/newsletter.ts} +0 -0
- /package/{ABOUT-ME.md → context/about-me.md} +0 -0
- /package/{brand-voice.md → context/brand-voice.md} +0 -0
- /package/{working-style.md → context/working-style.md} +0 -0
- /package/{.claude/skills → skills}/README.md +0 -0
- /package/{.agents/skills/agents.md → skills/agents/SKILL.md} +0 -0
- /package/{.claude/skills/blog-writing.md → skills/blog-writer/SKILL.md} +0 -0
- /package/{.claude/skills/store-copywriting.md → skills/copywriting/SKILL.md} +0 -0
- /package/{.claude/skills/social-content.md → skills/social/SKILL.md} +0 -0
- /package/{.claude/skills → skills/social}/content-seo.md +0 -0
- /package/{.claude/skills/store.md → skills/store/SKILL.md} +0 -0
package/PLAN.md
CHANGED
|
@@ -23,133 +23,130 @@ These all live in the `products` table under different `type` values.
|
|
|
23
23
|
|
|
24
24
|
### C-Suite (Intelligence + Strategy)
|
|
25
25
|
|
|
26
|
-
| Title | File | Role |
|
|
26
|
+
| Title | Folder / File | Role |
|
|
27
27
|
|---|---|---|
|
|
28
|
-
| CEO | `agents/
|
|
29
|
-
| CMO | `agents/
|
|
30
|
-
| COO | `agents/
|
|
31
|
-
| CBO | `agents/
|
|
28
|
+
| CEO | `agents/ceo/ceo.ts` | Weekly briefing, cross-agent orchestration, priority setting |
|
|
29
|
+
| Marketing (CMO) | `agents/marketing/marketing.ts` | Campaign strategy, content calendar, growth recommendations |
|
|
30
|
+
| Operations (COO) | `agents/operations/operations.ts` | Content pipeline, publish queue, scheduling oversight |
|
|
31
|
+
| Business (CBO) | `agents/business/business.ts` | Revenue analysis, product strategy, pricing recommendations |
|
|
32
32
|
|
|
33
33
|
### Content Creators
|
|
34
34
|
|
|
35
|
-
| Title | File | Writes to |
|
|
35
|
+
| Title | Folder / File | Writes to |
|
|
36
36
|
|---|---|---|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
37
|
+
| Sales (CRM) | `agents/sales/sales.ts` | `crm_*` — contacts, deals, activities, proposals, invoices |
|
|
38
|
+
| Content (Blog Writer) | `agents/content/content.ts` | `posts`, `compare`, `alternative`, `prompt`, `notes`, `guides` |
|
|
39
|
+
| Newsletter | `agents/newsletter/newsletter.ts` | `subscribers` + email via SES/Resend |
|
|
40
|
+
| Copywriting | `agents/copywriting/copywriting.ts` | `pages`, `products.description`, `links` |
|
|
41
|
+
| Courses | `agents/courses/courses.ts` | `products` (type=course) + lessons JSON |
|
|
42
|
+
| Store | `agents/store/store.ts` | `products` (downloads, services, webinars, events, listings, sponsorships, meetings) |
|
|
43
|
+
| Hiring | `agents/hiring/hiring.ts` | `job_listings` + `job_applications` |
|
|
44
|
+
| Forms | `agents/forms/forms.ts` | `forms` + `questions` |
|
|
45
|
+
| Docs | `agents/docs/docs.ts` | `doc_collections` + `doc_articles` |
|
|
45
46
|
|
|
46
47
|
### Growth & Intelligence
|
|
47
48
|
|
|
48
|
-
| Title | File | Role |
|
|
49
|
+
| Title | Folder / File | Role |
|
|
49
50
|
|---|---|---|
|
|
50
|
-
| SEO
|
|
51
|
-
| Analytics
|
|
52
|
-
| Social
|
|
53
|
-
| Scheduler | `agents/
|
|
51
|
+
| SEO | `agents/seo/seo.ts` | `collections`, slugs, meta, OG tags |
|
|
52
|
+
| Analytics | `agents/analytics/analytics.ts` | All analytics tables — reads only, never writes |
|
|
53
|
+
| Social | `agents/social/social.ts` | `credentials.n8n_webhook_url` → social platforms |
|
|
54
|
+
| Scheduler | `agents/scheduler/scheduler.ts` | `published=0 + date <= now()` → flips published=1 |
|
|
54
55
|
|
|
55
56
|
---
|
|
56
57
|
|
|
57
58
|
## Current Repository Structure
|
|
58
59
|
|
|
60
|
+
One folder per agent. Each folder has `SOUL.md` (identity + rules) + `<agent>.ts` (implementation).
|
|
61
|
+
|
|
59
62
|
```
|
|
60
|
-
businesskit-agent/
|
|
63
|
+
businesskit-agent/ ← repo root
|
|
61
64
|
│
|
|
62
|
-
├──
|
|
63
|
-
├──
|
|
64
|
-
|
|
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
|
|
65
|
+
├── .claude-plugin/
|
|
66
|
+
│ ├── plugin.json
|
|
67
|
+
│ └── marketplace.json
|
|
79
68
|
│
|
|
80
|
-
├──
|
|
81
|
-
│ ├──
|
|
82
|
-
│
|
|
69
|
+
├── .claude/
|
|
70
|
+
│ ├── commands/ ← slash-command bodies (user-facing names kept stable)
|
|
71
|
+
│ │ ├── analytics.md blog-writer.md cbo.md
|
|
72
|
+
│ │ ├── ceo.md cmo.md compress.md
|
|
73
|
+
│ │ ├── coo.md copywriter.md course-creator.md
|
|
74
|
+
│ │ ├── crm.md deep.md docs-writer.md
|
|
75
|
+
│ │ ├── forms-builder.md ingest.md jobs-manager.md
|
|
76
|
+
│ │ ├── kb.md newsletter-writer.md
|
|
77
|
+
│ │ ├── preserve.md resume.md scheduler.md
|
|
78
|
+
│ │ ├── seo.md social.md store-manager.md
|
|
79
|
+
│ │ └── settings.json
|
|
80
|
+
│ └── skills/ ← auto-loaded skills (see also top-level skills/)
|
|
83
81
|
│
|
|
84
|
-
├── agents/
|
|
85
|
-
│ ├── _base.ts
|
|
86
|
-
│
|
|
87
|
-
│
|
|
88
|
-
│
|
|
89
|
-
│
|
|
90
|
-
│
|
|
91
|
-
│ ├──
|
|
92
|
-
│ │
|
|
93
|
-
│
|
|
94
|
-
│
|
|
95
|
-
│
|
|
96
|
-
│
|
|
97
|
-
│
|
|
98
|
-
│
|
|
99
|
-
│
|
|
100
|
-
│
|
|
101
|
-
│
|
|
102
|
-
│
|
|
103
|
-
│
|
|
104
|
-
│
|
|
105
|
-
│
|
|
82
|
+
├── agents/ ← one folder per agent, SOUL.md + <agent>.ts
|
|
83
|
+
│ ├── _base.ts ← BaseAgent — profile iso, idempotency, txn, audit
|
|
84
|
+
│ │
|
|
85
|
+
│ ├── ceo/ SOUL.md + ceo.ts
|
|
86
|
+
│ ├── marketing/ SOUL.md + marketing.ts (CMO role)
|
|
87
|
+
│ ├── operations/ SOUL.md + operations.ts (COO role)
|
|
88
|
+
│ ├── business/ SOUL.md + business.ts (CBO role)
|
|
89
|
+
│ ├── sales/ SOUL.md + sales.ts (CRM pipeline)
|
|
90
|
+
│ │
|
|
91
|
+
│ ├── content/ SOUL.md + content.ts (blog writer)
|
|
92
|
+
│ ├── newsletter/ SOUL.md + newsletter.ts
|
|
93
|
+
│ ├── copywriting/ SOUL.md + copywriting.ts
|
|
94
|
+
│ ├── courses/ SOUL.md + courses.ts
|
|
95
|
+
│ ├── store/ SOUL.md + store.ts
|
|
96
|
+
│ ├── hiring/ SOUL.md + hiring.ts (job listings)
|
|
97
|
+
│ ├── forms/ SOUL.md + forms.ts
|
|
98
|
+
│ ├── docs/ SOUL.md + docs.ts
|
|
99
|
+
│ │
|
|
100
|
+
│ ├── analytics/ SOUL.md + analytics.ts
|
|
101
|
+
│ ├── seo/ SOUL.md + seo.ts
|
|
102
|
+
│ ├── social/ SOUL.md + social.ts
|
|
103
|
+
│ └── scheduler/ SOUL.md + scheduler.ts
|
|
106
104
|
│
|
|
107
|
-
├──
|
|
108
|
-
│
|
|
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()
|
|
105
|
+
├── bin/
|
|
106
|
+
│ └── businesskit.js
|
|
115
107
|
│
|
|
116
|
-
├──
|
|
117
|
-
│ ├──
|
|
118
|
-
│ ├──
|
|
119
|
-
│ ├── brand.md
|
|
120
|
-
│ ├──
|
|
121
|
-
│ └──
|
|
108
|
+
├── context/ ← Brand Foundation — fill in once
|
|
109
|
+
│ ├── about-me.md
|
|
110
|
+
│ ├── brand-voice.md
|
|
111
|
+
│ ├── brand.md
|
|
112
|
+
│ ├── business.md
|
|
113
|
+
│ └── working-style.md
|
|
122
114
|
│
|
|
123
|
-
├──
|
|
124
|
-
│ ├──
|
|
125
|
-
│
|
|
126
|
-
│
|
|
127
|
-
│
|
|
128
|
-
│
|
|
129
|
-
│
|
|
130
|
-
│
|
|
131
|
-
│
|
|
132
|
-
│
|
|
133
|
-
│
|
|
134
|
-
│
|
|
135
|
-
│
|
|
136
|
-
│
|
|
137
|
-
|
|
138
|
-
│
|
|
139
|
-
│
|
|
140
|
-
│
|
|
141
|
-
│
|
|
142
|
-
│
|
|
143
|
-
│
|
|
144
|
-
│
|
|
145
|
-
│
|
|
146
|
-
│
|
|
147
|
-
│
|
|
148
|
-
│
|
|
149
|
-
│
|
|
115
|
+
├── lib/
|
|
116
|
+
│ ├── analytics.ts ← analytics summaries
|
|
117
|
+
│ ├── db.adapter.ts ← Phase 1↔2 swap point
|
|
118
|
+
│ ├── db.ts ← Turso client, withRetry, txn, reader/writer split (P0-2, P0-3, P1-4)
|
|
119
|
+
│ ├── enums.ts ← single source of truth for status strings (P0-5)
|
|
120
|
+
│ ├── groups.ts ← crm_contact_groups junction helpers (P0-4)
|
|
121
|
+
│ ├── id.ts ← ulid, iso, now, generateIdempotencyKey (P0-1)
|
|
122
|
+
│ ├── kb.ts ← KB query helpers
|
|
123
|
+
│ ├── memory.ts ← dual-write agent_memory + memory.md
|
|
124
|
+
│ ├── pattern-detector.ts ← Hermes skill-detection
|
|
125
|
+
│ ├── profile.ts ← BrandContext loader
|
|
126
|
+
│ ├── slug.ts ← slug utilities
|
|
127
|
+
│ └── validate.ts ← numeric bounds guards (P0-8)
|
|
128
|
+
│
|
|
129
|
+
├── skills/ ← on-demand domain skills
|
|
130
|
+
│ ├── agents/SKILL.md ← load for routing decisions
|
|
131
|
+
│ ├── analytics/SKILL.md ← load when reading analytics
|
|
132
|
+
│ ├── blog-writer/SKILL.md
|
|
133
|
+
│ ├── brand/SKILL.md ← load when writing content
|
|
134
|
+
│ ├── ceo/SKILL.md
|
|
135
|
+
│ ├── cmo/SKILL.md
|
|
136
|
+
│ ├── copywriting/SKILL.md
|
|
137
|
+
│ ├── humanizer/SKILL.md
|
|
138
|
+
│ ├── sales/ ← reserved (empty)
|
|
139
|
+
│ ├── schema/SKILL.md ← load for DB queries
|
|
140
|
+
│ ├── social/{SKILL.md, content-seo.md}
|
|
141
|
+
│ └── store/SKILL.md
|
|
150
142
|
│
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
├── memory/ ← per-session state (gitignored)
|
|
144
|
+
├── .cursorrules .env.example .gitignore .mcp.json
|
|
145
|
+
├── AGENTS.md CLAUDE.md GEMINI.md HEARTBEAT.md
|
|
146
|
+
├── PLAN.md PRD-Agent-Composition.md PRD-Agent-Harness.md
|
|
147
|
+
├── README.md REFERENCE.md SOUL.md SYSTEM.md
|
|
148
|
+
├── cli.ts setup.ts memory.md
|
|
149
|
+
├── package.json package-lock.json tsconfig.json
|
|
153
150
|
```
|
|
154
151
|
|
|
155
152
|
---
|
|
@@ -179,6 +176,7 @@ npm run setup # verify connection
|
|
|
179
176
|
```
|
|
180
177
|
|
|
181
178
|
**CLI**:
|
|
179
|
+
|
|
182
180
|
```bash
|
|
183
181
|
npx tsx cli.ts ceo # CEO weekly briefing
|
|
184
182
|
npx tsx cli.ts blog-writer # list posts
|
|
@@ -186,21 +184,16 @@ npx tsx cli.ts scheduler hourly # run publish queue
|
|
|
186
184
|
```
|
|
187
185
|
|
|
188
186
|
**Delivered**:
|
|
187
|
+
|
|
189
188
|
- [x] `CLAUDE.md` — full schema, brand rules, agent roster
|
|
190
|
-
- [x] `lib/` — db
|
|
191
|
-
- [x] `
|
|
192
|
-
- [x]
|
|
193
|
-
- [x]
|
|
194
|
-
- [x]
|
|
195
|
-
- [x]
|
|
196
|
-
- [x] `context/brand.md` + `context/business.md` — committed brand docs
|
|
197
|
-
- [x] `cli.ts` — universal terminal entry point
|
|
189
|
+
- [x] `lib/` — db (withRetry + txn + reader/writer), id (+ idempotency key), enums, groups junction, validate, memory, profile, kb, analytics, slug
|
|
190
|
+
- [x] `agents/_base.ts` — BaseAgent: profile iso, idempotency (P0-1), txn (P0-2), audit (P0-6), APPEND_ONLY guard (P0-7), logMemory retention (P1-2), single-profile factory (P1-7)
|
|
191
|
+
- [x] 17 agents, one folder each, SOUL.md + `<agent>.ts`
|
|
192
|
+
- [x] 22 slash commands in `.claude/commands/` (+ `settings.json`)
|
|
193
|
+
- [x] Skills in `skills/<domain>/SKILL.md` — loaded on demand
|
|
194
|
+
- [x] `cli.ts` — universal terminal entry point with legacy-name aliases
|
|
198
195
|
- [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)
|
|
196
|
+
- [x] `README.md` + `.env.example` (+ optional `TURSO_REPLICA_URL`) + `setup.ts`
|
|
204
197
|
|
|
205
198
|
---
|
|
206
199
|
|
|
@@ -220,6 +213,7 @@ const ceo = new CEO(createAgentDB(event))
|
|
|
220
213
|
```
|
|
221
214
|
|
|
222
215
|
**Deliverables**:
|
|
216
|
+
|
|
223
217
|
- [ ] Copy `agents/` + `lib/` into `src/lib/agents/` in the Qwik app
|
|
224
218
|
- [ ] `/api/mcp` route in `src/routes/api/mcp/index.tsx`
|
|
225
219
|
- [ ] One MCP tool definition per agent action
|
|
@@ -232,6 +226,7 @@ const ceo = new CEO(createAgentDB(event))
|
|
|
232
226
|
**Goal**: Agents run on cron with no user present.
|
|
233
227
|
|
|
234
228
|
**Deliverables**:
|
|
229
|
+
|
|
235
230
|
- [ ] `scheduler.ts` as CF Durable Object (stub already in file — uncomment to activate)
|
|
236
231
|
- [ ] Weekly CEO briefing → n8n → email/Slack (`0 8 * * 1`)
|
|
237
232
|
- [ ] Hourly publish queue → flips `published=1` + triggers Social Agent (`0 * * * *`)
|
|
@@ -250,4 +245,101 @@ const ceo = new CEO(createAgentDB(event))
|
|
|
250
245
|
- **Composable** — C-Suite calls Growth calls Creators. Never reverse.
|
|
251
246
|
- **n8n = external integration layer** — social posting, email delivery
|
|
252
247
|
- **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
|
|
248
|
+
- **Same codebase, two transports** — `db.adapter.ts` is the only diff between Phase 1 and 2
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Phase 2 Additions — Agent Infrastructure (from Hermes + Karpathy patterns)
|
|
253
|
+
|
|
254
|
+
### New tables (defined in agents.ts)
|
|
255
|
+
|
|
256
|
+
| Table | Purpose |
|
|
257
|
+
|---|---|
|
|
258
|
+
| `agents` | Registry — one row per agent type, tracks last_run, auto_approve, pending skill suggestions |
|
|
259
|
+
| `agent_skills` | Live instruction skills — editable from dashboard, version-tracked |
|
|
260
|
+
| `agent_memory` | Rolling 20-row session log — dual-write (Turso + memory.md) |
|
|
261
|
+
| `agent_notes` | Persistent knowledge artifacts — Karpathy wiki pattern (research, analysis, briefings) |
|
|
262
|
+
| `agent_files` | Files agent produces — SEO reports, blog exports, CRM data — visible in dashboard |
|
|
263
|
+
| `agent_tasks` | Tasks: manual + scheduled + auto-detected from patterns (Hermes pattern) |
|
|
264
|
+
| `agent_conversations` | Future agentic chat UI — table only, implementation deferred |
|
|
265
|
+
|
|
266
|
+
### Hermes pattern: auto-skill generation
|
|
267
|
+
|
|
268
|
+
When an agent performs the same action 3+ times in 7 days:
|
|
269
|
+
|
|
270
|
+
1. `detectAndSuggestSkill()` in `_base.ts` detects the pattern
|
|
271
|
+
2. Creates a pending `agent_tasks` row (status='detected')
|
|
272
|
+
3. Sets `pending_skill_suggestion` on the `agents` row
|
|
273
|
+
4. Dashboard surfaces it: "CEO detected you want Monday briefings — add as task?"
|
|
274
|
+
5. User approves → status='active', auto_run=1, skill is_active=1
|
|
275
|
+
6. Rejects → status='cancelled'
|
|
276
|
+
|
|
277
|
+
### Karpathy wiki pattern: agent_notes
|
|
278
|
+
|
|
279
|
+
Agents write persistent knowledge to `agent_notes`, not just ephemeral `agent_memory`.
|
|
280
|
+
|
|
281
|
+
- CEO briefing → saved as note (type='briefing')
|
|
282
|
+
- SEO audit findings → saved as note (type='analysis')
|
|
283
|
+
- CRM lead research → saved as note (type='research', source_id=contact_id)
|
|
284
|
+
- Notes link to each other via related_note_ids JSON
|
|
285
|
+
- Dashboard shows all notes, filterable by agent and type
|
|
286
|
+
|
|
287
|
+
### Dashboard routes (main Qwik app)
|
|
288
|
+
|
|
289
|
+
- `/dashboard/agents` — agent roster grid
|
|
290
|
+
- `/dashboard/agents/[agentType]` — agent detail (memory, skills, tasks, files, notes tabs)
|
|
291
|
+
- `/dashboard/agents/files` — all files across all agents
|
|
292
|
+
|
|
293
|
+
### Build order
|
|
294
|
+
|
|
295
|
+
See CURSOR-PLAN.md for step-by-step Cursor prompts.
|
|
296
|
+
Do Phase 0 → 1 → 2 in order. Phase 3–5 are optional enhancements.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Architecture Principles (learned from production)
|
|
301
|
+
|
|
302
|
+
### Backend-as-context (Nainsi principle)
|
|
303
|
+
|
|
304
|
+
Same app, same model, same prompt: 10.4M tokens vs 3.7M tokens.
|
|
305
|
+
The difference: treating the backend as part of the agent's context window.
|
|
306
|
+
|
|
307
|
+
**Applied to this repo:**
|
|
308
|
+
|
|
309
|
+
- `HEARTBEAT.md` is a structured snapshot — one read, no DB calls, full business state
|
|
310
|
+
- Skills load on demand, never all at once
|
|
311
|
+
- `agent_kb` index (slug+summary) loaded before content — never full content scan
|
|
312
|
+
- Every DB query returns only what's needed — no `SELECT *` on large tables
|
|
313
|
+
|
|
314
|
+
**The counterintuitive part:** better models make poor infrastructure MORE expensive.
|
|
315
|
+
A capable model explores more deeply when context is missing. Design for no exploration.
|
|
316
|
+
|
|
317
|
+
### Skillify every failure (Garry Tan principle)
|
|
318
|
+
|
|
319
|
+
Every agent mistake → permanent structural fix, not a re-prompt.
|
|
320
|
+
Deterministic work (date math, row counts, routing) → `lib/` functions, not LLM reasoning.
|
|
321
|
+
Every skill in `agent_skills` must be registered in `CLAUDE.md` skills table or it's dark.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Phase 2 — Dependencies to add when ready
|
|
326
|
+
|
|
327
|
+
### Spectrum (photon.codes)
|
|
328
|
+
|
|
329
|
+
`npm install spectrum-ts` — connects agents to iMessage, Telegram, WhatsApp, Slack, Discord, Instagram.
|
|
330
|
+
Edge-first, <1s latency. Use when users want to talk to their agents via messaging instead of terminal.
|
|
331
|
+
Add to `lib/channels/` — wrap Spectrum adapters per platform, route inbound messages to correct agent.
|
|
332
|
+
|
|
333
|
+
**Phase 2 channel architecture:**
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
User sends iMessage/WhatsApp/Telegram
|
|
337
|
+
→ Spectrum adapter receives
|
|
338
|
+
→ routes to correct agent based on message content
|
|
339
|
+
→ agent reads HEARTBEAT.md + relevant skills
|
|
340
|
+
→ writes response back via Spectrum
|
|
341
|
+
→ logs to agent_memory
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Not needed for Phase 1 (Claude Code / Cowork covers it).
|
|
345
|
+
Add when users ask for "talk to my CEO agent on WhatsApp."
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Agent Composition Pattern
|
|
2
|
+
|
|
3
|
+
> "Build your marketing assets template, then use that to build skills
|
|
4
|
+
> to further automate your workflow." — Claude Design tutorial
|
|
5
|
+
>
|
|
6
|
+
> "Once I have this design system skills, I can continue to build all
|
|
7
|
+
> the skills on top." — same
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The pattern
|
|
12
|
+
|
|
13
|
+
Single agents are useful. Composed agents are a system.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
User: "Launch the April product campaign"
|
|
17
|
+
↓
|
|
18
|
+
CEO agent (orchestrator)
|
|
19
|
+
├─ delegates to CMO → campaign strategy + brief
|
|
20
|
+
├─ delegates to Blog Writer → campaign blog post
|
|
21
|
+
├─ delegates to Social Agent → 3 platform posts from brief
|
|
22
|
+
├─ delegates to Newsletter Writer → launch email to subscribers
|
|
23
|
+
└─ delegates to Store Manager → product visibility + pricing check
|
|
24
|
+
|
|
25
|
+
Result: full campaign from one instruction
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## How it works technically
|
|
31
|
+
|
|
32
|
+
Each agent in `agents/` has a `runCommand()` method.
|
|
33
|
+
The CEO (orchestrator) calls those methods directly:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// CEO orchestrating a campaign launch
|
|
37
|
+
async launchCampaign(productId: string) {
|
|
38
|
+
// 1. Get product context
|
|
39
|
+
const product = await this.db.getProduct(productId)
|
|
40
|
+
|
|
41
|
+
// 2. Delegate to CMO for strategy
|
|
42
|
+
const brief = await this.cmo.campaignBrief(product)
|
|
43
|
+
|
|
44
|
+
// 3. Parallel: content + social + email
|
|
45
|
+
const [post, socialPosts, email] = await Promise.all([
|
|
46
|
+
this.blogWriter.writePost(brief),
|
|
47
|
+
this.socialAgent.createCampaignPosts(brief),
|
|
48
|
+
this.newsletterWriter.draftLaunchEmail(brief),
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
// 4. Push everything to agent_reports
|
|
52
|
+
await this.pushReport('campaign-launch', { brief, post, socialPosts, email })
|
|
53
|
+
|
|
54
|
+
// 5. Surface pending approvals
|
|
55
|
+
return { pending: [post.id, ...socialPosts.map(p => p.id), email.id] }
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Skill composition (from Claude Design tutorial)
|
|
62
|
+
|
|
63
|
+
Skills compose the same way:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
brand.md (foundation)
|
|
67
|
+
└─ campaign-planning skill (calls brand.md + analytics.md)
|
|
68
|
+
└─ carousel skill (calls brand.md + campaign brief)
|
|
69
|
+
└─ campaign manager agent (orchestrates all above)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The campaign manager in the tutorial took one brief and produced:
|
|
73
|
+
|
|
74
|
+
- Campaign planning deck (slides)
|
|
75
|
+
- Performance tracker (Excel with formulas)
|
|
76
|
+
- Social carousel posts (3 on-brand variations)
|
|
77
|
+
- Animated video (HTML motion graphics)
|
|
78
|
+
- Landing page (with embedded video)
|
|
79
|
+
|
|
80
|
+
In 25 minutes, unattended.
|
|
81
|
+
|
|
82
|
+
Your equivalent: `/ceo launch-campaign` → brief → blog post + social posts
|
|
83
|
+
- newsletter + product settings checked + pending approvals surfaced.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Three orchestration modes
|
|
88
|
+
|
|
89
|
+
### 1. Sequential (default)
|
|
90
|
+
|
|
91
|
+
Agent A finishes → result passes to Agent B.
|
|
92
|
+
Use for: workflows where each step depends on the last.
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
CMO brief → Blog Writer uses brief → Social Agent repurposes post
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. Parallel (faster, for independent tasks)
|
|
99
|
+
|
|
100
|
+
Agents run simultaneously. Use for: independent deliverables from same input.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Campaign brief → [Blog Writer + Social Agent + Newsletter Writer] in parallel
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. Human-gated (approval required)
|
|
107
|
+
|
|
108
|
+
Agent completes step → surfaces to user → user approves → next step.
|
|
109
|
+
Use for: anything that goes public (posts, emails, price changes).
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
Social Agent drafts → approval_status='pending' → user approves → publishes
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## What the Shopify video showed
|
|
118
|
+
|
|
119
|
+
The Shopify AI toolkit installs as a Claude Code plugin with slash commands.
|
|
120
|
+
Same pattern as your `.claude/commands/`:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
/shopify → SEO audit, conversion analysis, AOV report, bulk updates
|
|
124
|
+
/ceo → business briefing, campaign launch, pending approvals
|
|
125
|
+
/crm → contact management, deal pipeline, outreach
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The difference: Shopify connects to one external store.
|
|
129
|
+
Your repo connects to the user's entire business database.
|
|
130
|
+
|
|
131
|
+
Shopify's approach also validated: one tool (Claude Code) as the connective
|
|
132
|
+
tissue between all their tools (Klaviyo, Canva, Clarity). That's your model —
|
|
133
|
+
one `bk` command connecting all their business data.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Skills vs agents — the distinction
|
|
138
|
+
|
|
139
|
+
| | Skills | Agents |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| What | Instructions + rules | Executable code |
|
|
142
|
+
| Where | `.agents/skills/*.md` + `agent_skills` table | `agents/**/*.ts` |
|
|
143
|
+
| Load time | On demand | On demand |
|
|
144
|
+
| Can call other | Skills only | Agents + skills |
|
|
145
|
+
| Has memory | No | Via `agent_memory` |
|
|
146
|
+
| Persists output | No | Via `agent_reports` |
|
|
147
|
+
|
|
148
|
+
Skills teach agents *how* to approach something.
|
|
149
|
+
Agents *do* the thing and remember it.
|
package/README.md
CHANGED
|
@@ -18,30 +18,44 @@ Works with Claude Code, Claude Cowork, Gemini CLI, Codex, and any terminal.
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Install — two ways
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
### Option A — Claude Code plugin (recommended)
|
|
24
|
+
|
|
25
|
+
One command. Works across all projects. Auto-updates.
|
|
26
|
+
|
|
27
|
+
Open Claude Code terminal (`Ctrl+`` ` ``):
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
/plugin marketplace add businesskitai/businesskit-agent
|
|
31
|
+
/plugin install businesskit@businesskitai
|
|
32
|
+
/reload-plugins
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
Enter your credentials when prompted — `TURSO_URL` and `TURSO_TOKEN` from BusinessKit → Settings → Credentials.
|
|
36
|
+
|
|
37
|
+
Commands are namespaced: `/businesskit:ceo`, `/businesskit:crm`, `/businesskit:blog-writer` etc.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Option B — Clone for full access
|
|
42
|
+
|
|
43
|
+
Source code, all agents, customise everything.
|
|
32
44
|
|
|
33
45
|
```bash
|
|
46
|
+
git clone https://github.com/businesskitai/businesskit-agent
|
|
47
|
+
cd businesskit-agent
|
|
48
|
+
npm install
|
|
34
49
|
cp .env.example .env
|
|
35
50
|
# Paste TURSO_URL and TURSO_TOKEN from BusinessKit → Settings → Credentials
|
|
51
|
+
npm run setup
|
|
36
52
|
```
|
|
37
53
|
|
|
38
|
-
|
|
54
|
+
Commands are direct: `/ceo`, `/crm`, `/blog-writer` etc.
|
|
39
55
|
|
|
40
|
-
|
|
41
|
-
npm run setup
|
|
42
|
-
```
|
|
56
|
+
---
|
|
43
57
|
|
|
44
|
-
|
|
58
|
+
**Get credentials:** BusinessKit → Settings → Credentials → copy Turso URL and Token.
|
|
45
59
|
|
|
46
60
|
---
|
|
47
61
|
|