@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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"autocompact_percentage_override": 75,
|
|
3
|
+
"env": {
|
|
4
|
+
"BASH_MAX_OUTPUT_LENGTH": "150000"
|
|
5
|
+
},
|
|
6
|
+
"permissions": {
|
|
7
|
+
"deny": [
|
|
8
|
+
"Read(node_modules/**)",
|
|
9
|
+
"Read(dist/**)",
|
|
10
|
+
"Read(.next/**)",
|
|
11
|
+
"Read(coverage/**)",
|
|
12
|
+
"Read(*.lock)",
|
|
13
|
+
"Read(.git/**)"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "businesskit",
|
|
3
|
+
"description": "Autonomous business agent team for creators — CEO, CRM, Social, SEO, Blog Writer and more. Powered by your own Turso database.",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "BusinessKit",
|
|
6
|
+
"email": "hello@businesskit.io",
|
|
7
|
+
"url": "https://businesskit.io"
|
|
8
|
+
},
|
|
9
|
+
"plugins": [
|
|
10
|
+
{
|
|
11
|
+
"name": "businesskit",
|
|
12
|
+
"description": "Full business agent team — 17 agents reading and writing directly to your Turso database. CEO briefings, CRM pipeline, social scheduling, SEO audits, blog writing, newsletter, store management and more.",
|
|
13
|
+
"source": {
|
|
14
|
+
"source": "github",
|
|
15
|
+
"repo": "businesskitai/businesskit-agent"
|
|
16
|
+
},
|
|
17
|
+
"version": "1.0.0",
|
|
18
|
+
"category": "productivity",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"business",
|
|
21
|
+
"agent",
|
|
22
|
+
"crm",
|
|
23
|
+
"social",
|
|
24
|
+
"seo",
|
|
25
|
+
"blog",
|
|
26
|
+
"newsletter",
|
|
27
|
+
"analytics",
|
|
28
|
+
"turso",
|
|
29
|
+
"creator"
|
|
30
|
+
],
|
|
31
|
+
"homepage": "https://github.com/businesskitai/businesskit-agent",
|
|
32
|
+
"requires_setup": true,
|
|
33
|
+
"setup_instructions": "Run: cp .env.example .env — then paste TURSO_URL and TURSO_TOKEN from BusinessKit → Settings → Credentials. Then: npm run setup"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"description": "Autonomous business agent team
|
|
2
|
+
"name": "businesskit",
|
|
3
|
+
"description": "Autonomous business agent team — CEO, CRM, Social, SEO, Blog Writer and more. Powered by your own Turso database. Works with Claude Code, Claude Cowork, Gemini CLI, and Codex.",
|
|
4
4
|
"version": "1.0.0",
|
|
5
|
-
"author":
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "BusinessKit",
|
|
7
|
+
"email": "hello@businesskit.io"
|
|
8
|
+
},
|
|
6
9
|
"homepage": "https://businesskit.io",
|
|
7
10
|
"repository": "https://github.com/businesskitai/businesskit-agent",
|
|
8
|
-
"
|
|
9
|
-
"commands": [
|
|
10
|
-
{ "name": "ceo", "description": "CEO — weekly briefing, cross-agent orchestration, priority setting" },
|
|
11
|
-
{ "name": "cmo", "description": "CMO — content calendar, campaign strategy, growth recommendations" },
|
|
12
|
-
{ "name": "coo", "description": "COO — content pipeline, publish queue, scheduling oversight" },
|
|
13
|
-
{ "name": "cbo", "description": "CBO — revenue analysis, product strategy, pricing recommendations" },
|
|
14
|
-
{ "name": "blog-writer", "description": "Blog Writer — create and publish blog posts" },
|
|
15
|
-
{ "name": "newsletter-writer", "description": "Newsletter Writer — write and send newsletters to subscribers" },
|
|
16
|
-
{ "name": "copywriter", "description": "Copywriter — landing pages, product descriptions, profile bio and tagline" },
|
|
17
|
-
{ "name": "course-creator", "description": "Course Creator — build courses with lessons and manage students" },
|
|
18
|
-
{ "name": "store-manager", "description": "Store Manager — add downloads, meetings, webinars, events, listings, sponsorships, services" },
|
|
19
|
-
{ "name": "jobs-manager", "description": "Jobs Manager — post job listings and view applications" },
|
|
20
|
-
{ "name": "forms-builder", "description": "Forms Builder — build forms with questions and view submissions" },
|
|
21
|
-
{ "name": "docs-writer", "description": "Docs Writer — write knowledge base articles and manage collections" },
|
|
22
|
-
{ "name": "crm", "description": "CRM Agent — contacts, deals, outreach pipeline, tasks, approval flow" },
|
|
23
|
-
{ "name": "social", "description": "Social Agent — schedule and publish to 13 platforms via Zernio" },
|
|
24
|
-
{ "name": "analytics", "description": "Analytics Agent — full snapshot of traffic, revenue, links and forms" },
|
|
25
|
-
{ "name": "seo", "description": "SEO Agent — audit slugs, meta descriptions and category SEO" },
|
|
26
|
-
{ "name": "scheduler", "description": "Scheduler — run publish queue and manage scheduled content" },
|
|
27
|
-
{ "name": "deep", "description": "Deep Mode — CEO takes over, plans and delegates to full team" }
|
|
28
|
-
],
|
|
29
|
-
"setup": {
|
|
30
|
-
"env_required": ["TURSO_URL", "TURSO_TOKEN"],
|
|
31
|
-
"instructions": "Copy .env.example to .env and paste your Turso credentials from BusinessKit → Settings → Credentials"
|
|
32
|
-
}
|
|
11
|
+
"license": "MIT"
|
|
33
12
|
}
|
package/.env.example
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
TURSO_URL=libsql://your-db.turso.io
|
|
2
2
|
TURSO_TOKEN=your-token
|
|
3
|
+
|
|
4
|
+
# Optional: pick one profile when your UserDB has more than one.
|
|
5
|
+
# Agents auto-detect the single profile when this is unset (normal case).
|
|
6
|
+
# Get the id from BusinessKit → Settings → Credentials, or via:
|
|
7
|
+
# SELECT id, slug, title FROM profiles;
|
|
8
|
+
# PROFILE_ID=
|
|
9
|
+
|
|
10
|
+
# Optional: read replica URL for faster agent briefings (Turso embedded replica).
|
|
11
|
+
# When set, db.execute (reads) hits the replica; writes always go to TURSO_URL.
|
|
12
|
+
# TURSO_REPLICA_URL=libsql://your-db-replica.turso.io
|
package/CLAUDE.md
CHANGED
|
@@ -1,226 +1,87 @@
|
|
|
1
|
-
# BusinessKit Agent
|
|
1
|
+
# BusinessKit Agent
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Read and write directly to their Turso database.
|
|
5
|
-
Credentials in `.env` — `TURSO_URL` + `TURSO_TOKEN`.
|
|
3
|
+
Run an entire business from your database. 18 agents — CEO, Sales, Marketing, Social, SEO, Content and more.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
Credentials in `.env`: `TURSO_URL` + `TURSO_TOKEN` (BusinessKit → Settings → Credentials)
|
|
8
6
|
|
|
9
7
|
---
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## Start here — every session
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
| `SYSTEM.md` | How to work — cost, efficiency | Every session (auto) |
|
|
17
|
-
| `SOUL.md` | Non-negotiables — never break these | Every session (auto) |
|
|
18
|
-
| `HEARTBEAT.md` | Live business pulse — CEO writes this | Session start, CEO only |
|
|
19
|
-
| `memory.md` | User preferences (auto-written by agents) | Every session (auto) |
|
|
20
|
-
| `context/about-me.md` | Who the user is — background, credibility | CRM, SEO, Social agents |
|
|
21
|
-
| `context/brand-voice.md` | Voice bible — examples, rules, audience | Any content writing |
|
|
22
|
-
| `context/working-style.md` | How they work — approvals, schedule | Scheduler, any publishing |
|
|
23
|
-
| `context/brand.md` | Brand overview + live DB loading code | Content agents |
|
|
24
|
-
| `context/business.md` | Goals, revenue model, 90-day targets | CEO briefings only |
|
|
25
|
-
|
|
26
|
-
From Turso (live, always fresh):
|
|
27
|
-
|
|
28
|
-
- `agent_memory` — last 20 agent actions across all sessions
|
|
29
|
-
- `agent_skills` — live skill instructions, editable from dashboard
|
|
11
|
+
1. Read `HEARTBEAT.md` — live business state, one read, no DB calls needed
|
|
12
|
+
2. Check `memory.md` — user preferences from past sessions
|
|
13
|
+
3. Load skills only when the task needs them (see table below)
|
|
30
14
|
|
|
31
15
|
---
|
|
32
16
|
|
|
33
|
-
##
|
|
17
|
+
## What to do when asked
|
|
34
18
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| Task | Load |
|
|
19
|
+
| User says | Agent |
|
|
38
20
|
|---|---|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// 2. Load brand context from DB
|
|
60
|
-
const { profile, settings, credentials } = await getBrandContext()
|
|
61
|
-
|
|
62
|
-
// 3. Read memory.md for preferences
|
|
63
|
-
// (Claude Code reads this automatically as a project file)
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
After every significant action:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
import { logMemory } from './lib/memory.ts'
|
|
70
|
-
await logMemory('blog-writer', 'Published "Email Tips" (listicle, 2100 words)', { id, slug })
|
|
71
|
-
await logMemory('crm', 'Drafted DMs for 5 hot leads', { count: 5 })
|
|
72
|
-
await logMemory('social', 'Scheduled post to LinkedIn + X', { post_id })
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
When user states a preference:
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
User: "Stop signing newsletters with Cheers"
|
|
79
|
-
→ Add to memory.md: "Newsletter sign-off: use 'Best,' not 'Cheers'"
|
|
80
|
-
→ Apply immediately to current task
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## The One Rule
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
profile_id = one business = one isolated universe
|
|
89
|
-
Every INSERT needs profile_id. Every SELECT filters by profile_id. No exceptions.
|
|
90
|
-
```
|
|
21
|
+
| "brief me" / "what's happening" / "priorities" | **ceo** — load HEARTBEAT.md first |
|
|
22
|
+
| "marketing" / "content calendar" / "growth strategy" | **marketing** |
|
|
23
|
+
| "revenue" / "pricing" / "business performance" | **business** |
|
|
24
|
+
| "operations" / "publish queue" / "task management" | **operations** |
|
|
25
|
+
| "leads" / "contacts" / "outreach" / "deals" | **sales** — approval gate on all sends |
|
|
26
|
+
| "write a post" / "blog" / "guide" / "listicle" | **content** — load brand-voice.md first |
|
|
27
|
+
| "newsletter" / "email subscribers" | **newsletter** — approval before send |
|
|
28
|
+
| "copy" / "landing page copy" / "bio" | **copywriting** |
|
|
29
|
+
| "post to Twitter/LinkedIn" / "social" | **social** |
|
|
30
|
+
| "SEO" / "meta" / "LLM visibility" | **seo** |
|
|
31
|
+
| "analytics" / "traffic" / "how many clicks" | **analytics** — read-only |
|
|
32
|
+
| "product" / "launch" / "store item" | **store** |
|
|
33
|
+
| "course" / "lessons" / "module" | **courses** |
|
|
34
|
+
| "job listing" / "hiring" / "applications" | **hiring** |
|
|
35
|
+
| "form" / "intake" / "waitlist" | **forms** |
|
|
36
|
+
| "docs" / "knowledge base" / "help article" | **docs** |
|
|
37
|
+
| "schedule" / "cron" / "queue" | **scheduler** |
|
|
38
|
+
| "page" / "design" / "page builder" | **design** |
|
|
39
|
+
| "process my notes" / "update KB" | `/ingest` command |
|
|
40
|
+
| don't know → check | `skills/ceo/SKILL.md` |
|
|
91
41
|
|
|
92
42
|
---
|
|
93
43
|
|
|
94
|
-
##
|
|
95
|
-
|
|
96
|
-
Read the request → route to the right agent. Don't do the work in the wrong agent.
|
|
97
|
-
|
|
98
|
-
| Request | Agent |
|
|
99
|
-
|---|---|
|
|
100
|
-
| "brief me" / "weekly update" / "what's happening" | `/ceo` |
|
|
101
|
-
| "revenue" / "pricing" / "sales breakdown" | `/cbo` |
|
|
102
|
-
| "content calendar" / "what should I write next" | `/cmo` |
|
|
103
|
-
| "publish queue" / "what's scheduled" | `/coo` |
|
|
104
|
-
| "write a post" / "blog" / "listicle" / "guide" / "vs article" | `/blog-writer` |
|
|
105
|
-
| "newsletter" / "email subscribers" | `/newsletter-writer` |
|
|
106
|
-
| "product description" / "landing page" / "bio" | `/copywriter` |
|
|
107
|
-
| "course" / "lessons" / "module" | `/course-creator` |
|
|
108
|
-
| "add product" / "launch" / "store item" | `/store-manager` |
|
|
109
|
-
| "job listing" / "hiring" / "applications" | `/jobs-manager` |
|
|
110
|
-
| "form" / "intake" / "survey" | `/forms-builder` |
|
|
111
|
-
| "docs" / "knowledge base" / "help article" | `/docs-writer` |
|
|
112
|
-
| "lead" / "contact" / "deal" / "outreach" / "CRM" | `/crm` |
|
|
113
|
-
| "post to" / "social" / "tweet" / "LinkedIn" / "schedule post" | `/social` |
|
|
114
|
-
| "analytics" / "traffic" / "how many clicks" | `/analytics` |
|
|
115
|
-
| "SEO" / "meta" / "keyword" / "LLM visibility" / "content gaps" | `/seo` |
|
|
116
|
-
| "schedule" / "publish queue" / "cron" | `/scheduler` |
|
|
117
|
-
| complex multi-step / "do everything" / "take over" | `/deep` |
|
|
118
|
-
|
|
119
|
-
**Rule: agents → skills direction only.** C-Suite delegates to Creators. Creators never call C-Suite.
|
|
44
|
+
## Skills — load on demand only
|
|
120
45
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
## Skills Directory — `.agents/skills/`
|
|
124
|
-
|
|
125
|
-
All tools read these. Universal. Not Claude-specific.
|
|
126
|
-
|
|
127
|
-
| File | Contents |
|
|
46
|
+
| Task | Load |
|
|
128
47
|
|---|---|
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## Agent Roster
|
|
48
|
+
| Writing anything | `context/brand-voice.md` + `skills/brand/SKILL.md` |
|
|
49
|
+
| Products / pricing | `skills/store/SKILL.md` |
|
|
50
|
+
| Analytics columns | `skills/analytics/SKILL.md` |
|
|
51
|
+
| DB table structure | `skills/schema/SKILL.md` |
|
|
52
|
+
| Agent routing | `skills/agents/SKILL.md` |
|
|
138
53
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
CEO → CMO → COO → CBO
|
|
142
|
-
C-Suite reads data, makes decisions, delegates. Never writes content directly.
|
|
143
|
-
|
|
144
|
-
### Creators — `agents/creators/`
|
|
145
|
-
|
|
146
|
-
blog-writer, newsletter-writer, copywriter, course-creator, store-manager,
|
|
147
|
-
jobs-manager, forms-builder, docs-writer, crm-agent
|
|
148
|
-
|
|
149
|
-
### Growth — `agents/growth/`
|
|
150
|
-
|
|
151
|
-
analytics-agent, seo-agent, social-agent, scheduler
|
|
54
|
+
Never load all skills. Never load "just in case."
|
|
152
55
|
|
|
153
56
|
---
|
|
154
57
|
|
|
155
|
-
##
|
|
156
|
-
|
|
157
|
-
### Content tables (all: profile_id, slug, title, content, excerpt, published, hidden, collection_id)
|
|
158
|
-
|
|
159
|
-
posts (+seo_title, seo_description, content_type, word_count) | newsletter | notes | guides
|
|
160
|
-
compare | alternative | prompt | skills (published skill articles, NOT agent skills)
|
|
161
|
-
doc_collections (INT AUTOINCREMENT) | doc_articles (INT AUTOINCREMENT)
|
|
162
|
-
|
|
163
|
-
### Products
|
|
58
|
+
## The one rule
|
|
164
59
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
crm_contacts: lead_score, icp_match, outreach_status, agent_status, agent_context JSON, auto_approve
|
|
171
|
-
crm_activities: approval_status (pending→approved|auto_sent|rejected) — append-only
|
|
172
|
-
crm_deals: stage (new|contacted|proposal|negotiation|won|lost)
|
|
173
|
-
crm_analytics: DB triggers keep this in sync — NEVER update manually
|
|
174
|
-
|
|
175
|
-
### Social
|
|
176
|
-
|
|
177
|
-
social_accounts: connection_mode (zernio_byok|zernio_platform|direct|n8n)
|
|
178
|
-
social_posts: status, scheduled_for, scheduled_via, zernio_post_id
|
|
179
|
-
Platform key (ZERNIO_API_KEY) NEVER used by agents — only via Worker /api/social/schedule
|
|
180
|
-
|
|
181
|
-
### Memory (Turso)
|
|
182
|
-
|
|
183
|
-
memory_log: rolling 20 rows per profile
|
|
184
|
-
agent_skills: UNIQUE(profile_id,slug) — upsert safe
|
|
185
|
-
|
|
186
|
-
### Analytics — READ ONLY
|
|
187
|
-
|
|
188
|
-
Never write to profile_analytics, product_analytics, link_analytics, form_analytics
|
|
189
|
-
|
|
190
|
-
### Key IDs and timestamps
|
|
191
|
-
|
|
192
|
-
ulid() for most tables | omit id for doc_* (AUTOINCREMENT)
|
|
193
|
-
now() = Math.floor(Date.now()/1000) for INT cols
|
|
194
|
-
iso() = new Date().toISOString().slice(0,19)+'Z' for TEXT cols (posts, jobs, forms)
|
|
195
|
-
|
|
196
|
-
### categories (seeded — never insert)
|
|
197
|
-
|
|
198
|
-
cat_1=links | cat_15=startups | cat_18=courses | cat_19=downloads
|
|
199
|
-
Cat_31=jobs | Cat_32=docs | Cat_34=forms | Cat_35=blog
|
|
60
|
+
Every DB read and write filters by `profile_id`. No exceptions.
|
|
61
|
+
Never hard delete — always `hidden=1`.
|
|
62
|
+
Never write to analytics tables.
|
|
63
|
+
Never send or publish without user approval.
|
|
200
64
|
|
|
201
65
|
---
|
|
202
66
|
|
|
203
|
-
##
|
|
67
|
+
## After every action
|
|
204
68
|
|
|
205
69
|
```ts
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const ceo = new CEO(createAgentDB(event)) // inject from sharedMap
|
|
70
|
+
import { logMemory } from './lib/memory.ts'
|
|
71
|
+
await logMemory('agent-name', 'what was done', { id, slug })
|
|
209
72
|
```
|
|
210
73
|
|
|
211
|
-
|
|
74
|
+
User states a preference → add to `memory.md` → apply immediately.
|
|
212
75
|
|
|
213
76
|
---
|
|
214
77
|
|
|
215
|
-
##
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
- Use `ZERNIO_API_KEY` directly — platform key only goes via Worker endpoint
|
|
226
|
-
- Assume `progress.md` exists — memory is now in `memory_log` Turso table
|
|
78
|
+
## Deeper context — read on demand
|
|
79
|
+
|
|
80
|
+
| Need | File |
|
|
81
|
+
|---|---|
|
|
82
|
+
| How the repo wires to UserDB, BaseAgent contract, invariants | `ARCHITECTURE.md` |
|
|
83
|
+
| Per-file inventory: agents/, lib/, skills/, commands | `CODEBASE.md` |
|
|
84
|
+
| Which agent writes to which tables + trigger map | `DOMAINS.md` |
|
|
85
|
+
| Code patterns — profile_id, idempotency, enums, soft-delete | `CONVENTIONS.md` |
|
|
86
|
+
| Full schema + agent roster + Phase 2 swap | `REFERENCE.md` |
|
|
87
|
+
| Roadmap, folder map, Phase 1/2/3 | `PLAN.md` |
|
package/HEARTBEAT.md
CHANGED
|
@@ -1,81 +1,105 @@
|
|
|
1
1
|
# Heartbeat
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
3
|
+
> Written by CEO agent each session. Machine-readable — agents parse this in one read.
|
|
4
|
+
> No DB calls needed to know current business state. Surface it upfront, not on demand.
|
|
5
|
+
> (Nainsi principle: treat the backend as part of the agent's context window.)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Last updated: [ISO timestamp]
|
|
7
|
+
Last updated: —
|
|
10
8
|
Updated by: CEO agent
|
|
11
9
|
|
|
12
10
|
---
|
|
13
11
|
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
12
|
+
## Revenue snapshot
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
30d_revenue_cents: 0
|
|
16
|
+
7d_revenue_cents: 0
|
|
17
|
+
top_product: —
|
|
18
|
+
top_product_rev: 0
|
|
19
|
+
open_deals: 0
|
|
20
|
+
open_deal_value: 0
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Audience
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
total_subscribers: 0
|
|
27
|
+
new_7d: 0
|
|
28
|
+
unsubscribed_7d: 0
|
|
29
|
+
total_crm_contacts: 0
|
|
30
|
+
new_crm_7d: 0
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Content pipeline
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
posts_published_7d: 0
|
|
37
|
+
posts_draft: 0
|
|
38
|
+
newsletter_last_sent: —
|
|
39
|
+
social_posts_7d: 0
|
|
40
|
+
social_accounts_live: 0
|
|
41
|
+
```
|
|
40
42
|
|
|
41
43
|
## Pending approvals
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
```yaml
|
|
46
|
+
# Items waiting for owner decision — surface at session start
|
|
47
|
+
approvals: []
|
|
48
|
+
# - id: xxx
|
|
49
|
+
# type: social_post | crm_outreach | newsletter | product_update
|
|
50
|
+
# agent: blog-writer
|
|
51
|
+
# title: "Draft: 5 email tools compared"
|
|
52
|
+
# created: 2026-04-22
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Agent status
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
agents:
|
|
59
|
+
- type: ceo status: idle last_run: — heartbeat: 3600s
|
|
60
|
+
- type: blog-writer status: idle last_run: —
|
|
61
|
+
- type: social status: idle last_run: —
|
|
62
|
+
- type: crm status: idle last_run: —
|
|
63
|
+
- type: newsletter status: idle last_run: —
|
|
64
|
+
- type: seo status: idle last_run: weekly
|
|
65
|
+
- type: scheduler status: idle last_run: daily
|
|
66
|
+
```
|
|
50
67
|
|
|
51
|
-
##
|
|
52
|
-
|
|
53
|
-
<!-- What agents are actively working on. -->
|
|
54
|
-
|
|
55
|
-
- —
|
|
56
|
-
|
|
57
|
-
---
|
|
68
|
+
## Flags
|
|
58
69
|
|
|
59
|
-
|
|
70
|
+
```yaml
|
|
71
|
+
# Issues requiring attention — cleared when resolved
|
|
72
|
+
flags: []
|
|
73
|
+
# - level: warn | critical
|
|
74
|
+
# message: "SES bounce rate above 5%"
|
|
75
|
+
# since: 2026-04-20
|
|
76
|
+
```
|
|
60
77
|
|
|
61
|
-
|
|
78
|
+
## This week — CEO recommended priorities
|
|
62
79
|
|
|
80
|
+
```
|
|
63
81
|
1. —
|
|
64
82
|
2. —
|
|
65
83
|
3. —
|
|
84
|
+
```
|
|
66
85
|
|
|
67
|
-
|
|
86
|
+
## CEO note
|
|
68
87
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<!-- Things that need attention. Auto-cleared when resolved. -->
|
|
72
|
-
|
|
73
|
-
- —
|
|
88
|
+
—
|
|
74
89
|
|
|
75
90
|
---
|
|
76
91
|
|
|
77
|
-
|
|
92
|
+
<!-- HOW TO UPDATE:
|
|
93
|
+
CEO agent runs this query on session start:
|
|
78
94
|
|
|
79
|
-
|
|
95
|
+
SELECT
|
|
96
|
+
(SELECT COALESCE(SUM(amount_cents),0) FROM purchases
|
|
97
|
+
WHERE created_at > strftime('%s','now')-2592000) AS rev_30d,
|
|
98
|
+
(SELECT COUNT(*) FROM subscribers WHERE is_blocked=0 AND is_unsubscribed=0) AS subscribers,
|
|
99
|
+
(SELECT COUNT(*) FROM posts WHERE hidden=0) AS total_posts,
|
|
100
|
+
(SELECT COUNT(*) FROM crm_contacts WHERE archived=0) AS contacts,
|
|
101
|
+
(SELECT COUNT(*) FROM social_accounts WHERE is_active=1 AND is_connected=1) AS social_live
|
|
80
102
|
|
|
81
|
-
|
|
103
|
+
Then writes the result back into the code blocks above.
|
|
104
|
+
One query. One write. No exploration needed.
|
|
105
|
+
-->
|