@businesskit/agent 1.0.4 → 1.0.7
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-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +25 -0
- package/.cursorrules +10 -0
- package/.superconsole-plugin/plugin.json +62 -0
- package/AGENTS.md +105 -63
- package/CLAUDE.md +11 -84
- package/GEMINI.md +11 -34
- package/README.md +95 -154
- package/assets/logo.svg +3 -0
- package/bin/businesskit.js +45 -18
- package/commands/add-contact.md +47 -0
- package/commands/add-inventory-from-invoice.md +80 -0
- package/commands/adjust-stock.md +46 -0
- package/commands/brief.md +12 -0
- package/commands/capabilities.md +33 -0
- package/commands/chase.md +12 -0
- package/commands/check-stock.md +43 -0
- package/commands/create-component.md +109 -0
- package/commands/create-invoice.md +69 -0
- package/commands/create-new-bill.md +65 -0
- package/commands/create-page.md +124 -0
- package/commands/crm.md +13 -0
- package/commands/followups.md +13 -0
- package/commands/list-components.md +41 -0
- package/commands/list-content.md +46 -0
- package/commands/list-pages.md +45 -0
- package/commands/pipeline.md +13 -0
- package/commands/publish-page.md +64 -0
- package/commands/send-invoice.md +42 -0
- package/commands/seo-audit.md +36 -0
- package/commands/update-agent.md +33 -0
- package/commands/update-contact.md +46 -0
- package/commands/update-content.md +48 -0
- package/commands/update-page.md +56 -0
- package/commands/update-price.md +47 -0
- package/commands/write-blog.md +56 -0
- package/commands/write-docs.md +90 -0
- package/commands/write-guide.md +51 -0
- package/commands/write-newsletter.md +50 -0
- package/dist/server.js +4099 -0
- package/mcp_config.json +12 -0
- package/package.json +54 -25
- package/plugin.json +32 -0
- package/scripts/setup.sh +169 -0
- package/scripts/setup.ts +129 -0
- package/scripts/update.sh +56 -0
- package/server.json +21 -0
- package/skills/README.md +20 -27
- package/skills/billing/SKILL.md +64 -0
- package/skills/brand/SKILL.md +30 -86
- package/skills/cms/SKILL.md +111 -0
- package/skills/cms/references/cms-hubs.md +84 -0
- package/skills/cms/references/html-blocks.md +177 -0
- package/skills/copywriting/SKILL.md +1 -1
- package/skills/crm/SKILL.md +24 -0
- package/skills/docs/SKILL.md +65 -0
- package/skills/docs/references/how-to.md +155 -0
- package/skills/inbox/SKILL.md +49 -0
- package/skills/inventory/SKILL.md +69 -0
- package/skills/pages/SKILL.md +214 -0
- package/skills/pages/references/sections-catalog.json +1183 -0
- package/skills/social/SKILL.md +84 -211
- package/skills/social/evals/evals.json +66 -0
- package/skills/social/evals/rubric.md +26 -0
- package/skills/social/examples/repurposing-blog-to-social.md +93 -0
- package/skills/social/examples/weekly-content-calendar.md +30 -0
- package/skills/social/linkedin/SKILL.md +107 -0
- package/skills/social/linkedin/evals/evals.json +106 -0
- package/skills/social/linkedin/evals/rubric.md +28 -0
- package/skills/social/linkedin/examples/gasp-weekly-sprint.md +24 -0
- package/skills/social/linkedin/examples/growth-posts-by-format.md +140 -0
- package/skills/social/linkedin/references/gasp-funnel-and-calibration.md +90 -0
- package/skills/social/linkedin/references/six-growth-formats.md +114 -0
- package/skills/social/references/platforms.md +76 -0
- package/skills/social/references/post-templates.md +105 -0
- package/skills/social/references/reverse-engineering.md +62 -0
- package/src/data/sections-catalog.json +950 -0
- package/src/db.ts +170 -0
- package/src/server.ts +75 -0
- package/src/tools/content.ts +326 -0
- package/src/tools/crm.ts +1416 -0
- package/src/tools/domains.ts +89 -0
- package/src/tools/inbox.ts +270 -0
- package/src/tools/index.ts +116 -0
- package/src/tools/pages.ts +1217 -0
- package/src/tools/shop.ts +771 -0
- package/src/tools/system.ts +94 -0
- package/src/tools/types.ts +17 -0
- package/templates/antigravity.json +8 -0
- package/templates/claude-code.mcp.json +8 -0
- package/templates/cursor.mcp.json +8 -0
- package/templates/vscode.mcp.json +9 -0
- package/.claude/commands/analytics.md +0 -7
- package/.claude/commands/blog-writer.md +0 -9
- package/.claude/commands/cbo.md +0 -7
- package/.claude/commands/ceo.md +0 -10
- package/.claude/commands/cmo.md +0 -7
- package/.claude/commands/compress.md +0 -73
- package/.claude/commands/coo.md +0 -11
- package/.claude/commands/copywriter.md +0 -15
- package/.claude/commands/course-creator.md +0 -9
- package/.claude/commands/crm.md +0 -591
- package/.claude/commands/deep.md +0 -50
- package/.claude/commands/docs-writer.md +0 -8
- package/.claude/commands/forms-builder.md +0 -10
- package/.claude/commands/ingest.md +0 -110
- package/.claude/commands/jobs-manager.md +0 -8
- package/.claude/commands/kb.md +0 -107
- package/.claude/commands/newsletter-writer.md +0 -9
- package/.claude/commands/preserve.md +0 -64
- package/.claude/commands/resume.md +0 -67
- package/.claude/commands/scheduler.md +0 -8
- package/.claude/commands/seo.md +0 -60
- package/.claude/commands/social.md +0 -51
- package/.claude/commands/store-manager.md +0 -11
- package/.claude/settings.json +0 -16
- package/.claude/settings.local.json +0 -11
- package/.env.example +0 -12
- package/.mcp.json +0 -3
- package/HEARTBEAT.md +0 -105
- package/PLAN.md +0 -345
- package/PRD-Agent-Composition.md +0 -149
- package/PRD-Agent-Harness.md +0 -316
- package/REFERENCE.md +0 -160
- package/SOUL.md +0 -148
- package/SYSTEM.md +0 -71
- package/agents/_base.ts +0 -371
- package/agents/analytics/SOUL.md +0 -11
- package/agents/analytics/analytics.ts +0 -405
- package/agents/business/SOUL.md +0 -11
- package/agents/business/business.ts +0 -109
- package/agents/ceo/SOUL.md +0 -15
- package/agents/ceo/ceo.ts +0 -146
- package/agents/content/SOUL.md +0 -11
- package/agents/content/content.ts +0 -379
- package/agents/copywriting/SOUL.md +0 -11
- package/agents/copywriting/copywriting.ts +0 -89
- package/agents/courses/SOUL.md +0 -11
- package/agents/courses/courses.ts +0 -451
- package/agents/docs/SOUL.md +0 -11
- package/agents/docs/docs.ts +0 -77
- package/agents/forms/SOUL.md +0 -11
- package/agents/forms/forms.ts +0 -364
- package/agents/hiring/SOUL.md +0 -11
- package/agents/hiring/hiring.ts +0 -314
- package/agents/marketing/SOUL.md +0 -15
- package/agents/marketing/marketing.ts +0 -109
- package/agents/newsletter/SOUL.md +0 -11
- package/agents/newsletter/newsletter.ts +0 -91
- package/agents/operations/SOUL.md +0 -11
- package/agents/operations/operations.ts +0 -157
- package/agents/sales/SOUL.md +0 -44
- package/agents/sales/sales.ts +0 -883
- package/agents/scheduler/SOUL.md +0 -11
- package/agents/scheduler/scheduler.ts +0 -68
- package/agents/seo/SOUL.md +0 -11
- package/agents/seo/seo.ts +0 -288
- package/agents/social/SOUL.md +0 -11
- package/agents/social/social.ts +0 -744
- package/agents/store/SOUL.md +0 -11
- package/agents/store/store.ts +0 -514
- package/cli.ts +0 -144
- package/context/about-me.md +0 -96
- package/context/brand-voice.md +0 -127
- package/context/brand.md +0 -80
- package/context/business.md +0 -66
- package/context/working-style.md +0 -87
- package/lib/analytics.ts +0 -81
- package/lib/cms.ts +0 -88
- package/lib/db.adapter.ts +0 -30
- package/lib/db.ts +0 -63
- package/lib/enums.ts +0 -25
- package/lib/groups.ts +0 -122
- package/lib/id.ts +0 -43
- package/lib/kb.ts +0 -337
- package/lib/memory.ts +0 -219
- package/lib/pattern-detector.ts +0 -169
- package/lib/profile.ts +0 -155
- package/lib/schema.ts +0 -2015
- package/lib/slug.ts +0 -30
- package/lib/validate.ts +0 -33
- package/setup.ts +0 -141
- package/skills/agents/SKILL.md +0 -56
- package/skills/analytics/SKILL.md +0 -52
- package/skills/blog-writer/SKILL.md +0 -452
- package/skills/ceo/SKILL.md +0 -25
- package/skills/cmo/SKILL.md +0 -8
- package/skills/schema/SKILL.md +0 -86
- package/skills/store/SKILL.md +0 -62
- package/tsconfig.json +0 -14
package/agents/scheduler/SOUL.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# scheduler
|
|
2
|
-
|
|
3
|
-
Placeholder SOUL. See CLAUDE.md routing table and skills/scheduler/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,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CRON — Scheduler
|
|
3
|
-
* "I wake up so you don't have to."
|
|
4
|
-
*
|
|
5
|
-
* Phase 1: run manually via `npx tsx agents/growth/cron.ts`
|
|
6
|
-
* Phase 3: export as CF Durable Object, called by wrangler cron trigger
|
|
7
|
-
*
|
|
8
|
-
* Design: thin orchestrator — delegates to OTTO (publish queue),
|
|
9
|
-
* ARIA (weekly briefing), NOVA (content calendar drafts), PEARL (newsletter).
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { coo } from '../operations/operations.ts'
|
|
13
|
-
import { ceo } from '../ceo/ceo.ts'
|
|
14
|
-
|
|
15
|
-
export class Scheduler {
|
|
16
|
-
readonly name = 'CRON'
|
|
17
|
-
readonly title = 'Scheduler'
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Hourly job — publish any content scheduled for now
|
|
21
|
-
* CF Workflow cron: "0 * * * *"
|
|
22
|
-
*/
|
|
23
|
-
async hourly() {
|
|
24
|
-
const published = await coo.runPublishQueue()
|
|
25
|
-
return { published_count: published.length, published }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Daily job — lightweight ops check
|
|
30
|
-
* CF Workflow cron: "0 9 * * *"
|
|
31
|
-
*/
|
|
32
|
-
async daily() {
|
|
33
|
-
const pipeline = await coo.draftPipeline()
|
|
34
|
-
const totalDrafts = pipeline.reduce((a, p) => a + p.drafts.length, 0)
|
|
35
|
-
return { draft_count: totalDrafts, pipeline_summary: pipeline.map(p => `${p.label}: ${p.drafts.length} drafts`) }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Weekly job — full briefing sent to n8n
|
|
40
|
-
* CF Workflow cron: "0 8 * * 1" (Monday 8am)
|
|
41
|
-
*/
|
|
42
|
-
async weekly() {
|
|
43
|
-
const result = await ceo.sendBriefing()
|
|
44
|
-
return { briefing_sent: result.ok, ...result }
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const scheduler = new Scheduler()
|
|
49
|
-
|
|
50
|
-
// ─── CF Durable Object export (Phase 3) ──────────────────────────────────────
|
|
51
|
-
// Uncomment when deploying as a Durable Object on Cloudflare Workers:
|
|
52
|
-
//
|
|
53
|
-
// import { DurableObject } from 'cloudflare:workers'
|
|
54
|
-
// export class CronAgent extends DurableObject {
|
|
55
|
-
// async fetch(req: Request) {
|
|
56
|
-
// const { pathname } = new URL(req.url)
|
|
57
|
-
// if (pathname === '/hourly') return Response.json(await cron.hourly())
|
|
58
|
-
// if (pathname === '/daily') return Response.json(await cron.daily())
|
|
59
|
-
// if (pathname === '/weekly') return Response.json(await cron.weekly())
|
|
60
|
-
// return new Response('Not found', { status: 404 })
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
|
|
64
|
-
// ─── CLI runner (Phase 1) ─────────────────────────────────────────────────────
|
|
65
|
-
if (process.argv[2]) {
|
|
66
|
-
const job = process.argv[2] as 'hourly' | 'daily' | 'weekly'
|
|
67
|
-
scheduler[job]?.().then(r => console.log(JSON.stringify(r, null, 2))).catch(console.error)
|
|
68
|
-
}
|
package/agents/seo/SOUL.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# seo
|
|
2
|
-
|
|
3
|
-
Placeholder SOUL. See CLAUDE.md routing table and skills/seo/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
|
package/agents/seo/seo.ts
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SEO Agent
|
|
3
|
-
*
|
|
4
|
-
* Google SEO + LLM Visibility (Arvow insight).
|
|
5
|
-
* Tracks brand mentions in ChatGPT, Claude, Gemini, Perplexity.
|
|
6
|
-
* Audits all content tables for SEO issues and fixes them.
|
|
7
|
-
*
|
|
8
|
-
* Tables read: posts, compare, alternative, prompt, guides, collections
|
|
9
|
-
* Tables written: posts (seo_title, seo_description, seo_keywords)
|
|
10
|
-
* profiles (llm_visibility)
|
|
11
|
-
* collections (seo_title, seo_description)
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { BaseAgent, db, iso } from '../_base.ts'
|
|
15
|
-
import { logMemory } from '../../lib/memory.ts'
|
|
16
|
-
|
|
17
|
-
export interface SEOIssue {
|
|
18
|
-
table: string
|
|
19
|
-
id: string
|
|
20
|
-
title: string
|
|
21
|
-
slug: string
|
|
22
|
-
problems: string[]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface LLMVisibility {
|
|
26
|
-
chatgpt: number // mention count or 0
|
|
27
|
-
claude: number
|
|
28
|
-
gemini: number
|
|
29
|
-
perplexity: number
|
|
30
|
-
last_checked: string
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class SEOAgent extends BaseAgent {
|
|
34
|
-
readonly name = 'SEO Agent'
|
|
35
|
-
readonly title = 'SEO Agent'
|
|
36
|
-
|
|
37
|
-
// ── Full audit across all content tables ─────────────────────────────────
|
|
38
|
-
|
|
39
|
-
async audit(): Promise<{ issues: SEOIssue[]; score: number; summary: string }> {
|
|
40
|
-
await this.init()
|
|
41
|
-
|
|
42
|
-
// All content lives in the unified `content` table; filter by the cms
|
|
43
|
-
// kinds we care about. See businesskit-files/content.ts for the schema.
|
|
44
|
-
const kinds = ['blog', 'compare', 'alternative', 'guides'] as const
|
|
45
|
-
const allIssues: SEOIssue[] = []
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
const { rows } = await db.execute({
|
|
49
|
-
sql: `SELECT c.id, c.title, c.slug, c.excerpt, c.seo_title,
|
|
50
|
-
c.seo_description, c.word_count, cms.slug AS kind
|
|
51
|
-
FROM content c
|
|
52
|
-
JOIN cms ON cms.id = c.cms_id
|
|
53
|
-
WHERE c.profile_id=? AND c.published=1 AND c.hidden=0
|
|
54
|
-
AND cms.slug IN ('blog','compare','alternative','guides')`,
|
|
55
|
-
args: [this.profileId],
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
for (const r of rows) {
|
|
59
|
-
const problems: string[] = []
|
|
60
|
-
if (!r.excerpt) problems.push('missing excerpt')
|
|
61
|
-
if (!r.seo_title) problems.push('missing seo_title')
|
|
62
|
-
if (!r.seo_description) problems.push('missing seo_description')
|
|
63
|
-
if (r.seo_title && String(r.seo_title).length > 60) problems.push('seo_title >60 chars')
|
|
64
|
-
if (r.seo_description && String(r.seo_description).length > 160) problems.push('seo_description >160 chars')
|
|
65
|
-
if (Number(r.word_count ?? 0) < 300) problems.push('thin content <300 words')
|
|
66
|
-
if (!r.slug || String(r.slug).includes(' ')) problems.push('slug has spaces')
|
|
67
|
-
if (String(r.slug ?? '').length > 80) problems.push('slug too long >80 chars')
|
|
68
|
-
|
|
69
|
-
if (problems.length) {
|
|
70
|
-
allIssues.push({
|
|
71
|
-
table: String(r.kind ?? 'content'),
|
|
72
|
-
id: r.id as string,
|
|
73
|
-
title: r.title as string,
|
|
74
|
-
slug: r.slug as string,
|
|
75
|
-
problems,
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
} catch { /* content table may not exist on pre-migration DBs */ }
|
|
80
|
-
|
|
81
|
-
const score = allIssues.length === 0 ? 100 : Math.max(0, 100 - allIssues.length * 5)
|
|
82
|
-
const summary = allIssues.length === 0
|
|
83
|
-
? 'All content passes SEO checks.'
|
|
84
|
-
: `${allIssues.length} issues found across ${kinds.join(', ')}.`
|
|
85
|
-
|
|
86
|
-
await logMemory('seo', `SEO audit: score ${score}/100, ${allIssues.length} issues`, { issues: allIssues.length, score })
|
|
87
|
-
|
|
88
|
-
return { issues: allIssues, score, summary }
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// ── Fix a specific post's SEO fields ─────────────────────────────────────
|
|
92
|
-
|
|
93
|
-
/** Fix SEO fields on any content row (blog, guides, compare, …). */
|
|
94
|
-
async fixPost(id: string, fixes: {
|
|
95
|
-
seo_title?: string
|
|
96
|
-
seo_description?: string
|
|
97
|
-
seo_keywords?: string[]
|
|
98
|
-
excerpt?: string
|
|
99
|
-
slug?: string
|
|
100
|
-
}) {
|
|
101
|
-
await this.init()
|
|
102
|
-
const sets: string[] = ['updated_at=?']
|
|
103
|
-
const args: unknown[] = [iso()]
|
|
104
|
-
|
|
105
|
-
if (fixes.seo_title) { sets.push('seo_title=?'); args.push(fixes.seo_title.slice(0, 60)) }
|
|
106
|
-
if (fixes.seo_description) { sets.push('seo_description=?'); args.push(fixes.seo_description.slice(0, 160)) }
|
|
107
|
-
if (fixes.seo_keywords) { sets.push('seo_keywords=?'); args.push(JSON.stringify(fixes.seo_keywords)) }
|
|
108
|
-
if (fixes.excerpt) { sets.push('excerpt=?'); args.push(fixes.excerpt) }
|
|
109
|
-
if (fixes.slug) { sets.push('slug=?'); args.push(this.toSlug(fixes.slug)) }
|
|
110
|
-
|
|
111
|
-
await db.write({
|
|
112
|
-
sql: `UPDATE content SET ${sets.join(',')} WHERE id=? AND profile_id=?`,
|
|
113
|
-
args: [...args, id, this.profileId],
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// ── Collection SEO ────────────────────────────────────────────────────────
|
|
118
|
-
|
|
119
|
-
async setCollectionSEO(categorySlug: string, opts: {
|
|
120
|
-
seo_title: string
|
|
121
|
-
seo_description: string
|
|
122
|
-
seo_robots?: string
|
|
123
|
-
}) {
|
|
124
|
-
await this.init()
|
|
125
|
-
await db.execute({
|
|
126
|
-
sql: `UPDATE collections SET
|
|
127
|
-
seo_title=?,seo_description=?,seo_robots=?,updated_at=?
|
|
128
|
-
WHERE profile_id=? AND category_slug=?`,
|
|
129
|
-
args: [
|
|
130
|
-
opts.seo_title.slice(0, 60),
|
|
131
|
-
opts.seo_description.slice(0, 160),
|
|
132
|
-
opts.seo_robots ?? 'index,follow',
|
|
133
|
-
iso(), this.profileId, categorySlug,
|
|
134
|
-
],
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// ── Slug suggestions ──────────────────────────────────────────────────────
|
|
139
|
-
|
|
140
|
-
suggestSlug(title: string, keyword?: string): string {
|
|
141
|
-
const base = (keyword ?? title)
|
|
142
|
-
.toLowerCase()
|
|
143
|
-
.replace(/[^a-z0-9\s-]/g, '')
|
|
144
|
-
.replace(/\s+/g, '-')
|
|
145
|
-
.replace(/-+/g, '-')
|
|
146
|
-
.replace(/^-|-$/g, '')
|
|
147
|
-
return base.slice(0, 80)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// ── LLM Visibility (Arvow-inspired) ──────────────────────────────────────
|
|
151
|
-
//
|
|
152
|
-
// Tracks whether ChatGPT, Claude, Gemini, Perplexity mention your brand.
|
|
153
|
-
// This is the "AI SEO" layer on top of Google SEO.
|
|
154
|
-
// Strategy: write content that gets cited by LLMs (detailed, factual, well-structured).
|
|
155
|
-
|
|
156
|
-
async checkLLMVisibility(): Promise<LLMVisibility> {
|
|
157
|
-
await this.init()
|
|
158
|
-
const { rows: [r] } = await db.execute({
|
|
159
|
-
sql: `SELECT llm_visibility FROM profiles WHERE id=? LIMIT 1`,
|
|
160
|
-
args: [this.profileId],
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
const current: LLMVisibility = safeJSON(r?.llm_visibility, {
|
|
164
|
-
chatgpt: 0, claude: 0, gemini: 0, perplexity: 0, last_checked: '',
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
return current
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
async updateLLMVisibility(counts: Partial<Omit<LLMVisibility, 'last_checked'>>) {
|
|
171
|
-
await this.init()
|
|
172
|
-
const current = await this.checkLLMVisibility()
|
|
173
|
-
const updated: LLMVisibility = {
|
|
174
|
-
...current,
|
|
175
|
-
...counts,
|
|
176
|
-
last_checked: iso(),
|
|
177
|
-
}
|
|
178
|
-
await db.execute({
|
|
179
|
-
sql: `UPDATE profiles SET llm_visibility=? WHERE id=?`,
|
|
180
|
-
args: [JSON.stringify(updated), this.profileId],
|
|
181
|
-
})
|
|
182
|
-
await logMemory('seo', 'Updated LLM visibility', updated as unknown as Record<string, unknown>)
|
|
183
|
-
return updated
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
llmVisibilityAdvice(visibility: LLMVisibility): string[] {
|
|
187
|
-
const advice: string[] = []
|
|
188
|
-
const allZero = !visibility.chatgpt && !visibility.claude && !visibility.gemini && !visibility.perplexity
|
|
189
|
-
|
|
190
|
-
if (allZero) {
|
|
191
|
-
advice.push('No LLM mentions detected yet. Publish more detailed, factual, well-structured content.')
|
|
192
|
-
advice.push('Write ultimate guides and how-to articles — LLMs prefer citing comprehensive sources.')
|
|
193
|
-
advice.push('Include data, statistics, and clear definitions — these get cited more often.')
|
|
194
|
-
advice.push('Use your brand name consistently in titles, headings, and the first paragraph.')
|
|
195
|
-
} else {
|
|
196
|
-
if (!visibility.perplexity) advice.push('Not visible in Perplexity. Add more cited sources and data to your content.')
|
|
197
|
-
if (!visibility.chatgpt) advice.push('Not visible in ChatGPT. Publish FAQ-style content around your core topic.')
|
|
198
|
-
if (visibility.chatgpt > 0) advice.push(`ChatGPT mentions: ${visibility.chatgpt} — keep publishing in this area.`)
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return advice
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// ── Content gap analysis ──────────────────────────────────────────────────
|
|
205
|
-
|
|
206
|
-
async contentGaps(): Promise<{
|
|
207
|
-
missing_types: string[]
|
|
208
|
-
thin_posts: number
|
|
209
|
-
no_compare: boolean
|
|
210
|
-
no_alternative: boolean
|
|
211
|
-
advice: string[]
|
|
212
|
-
}> {
|
|
213
|
-
await this.init()
|
|
214
|
-
// content_type is no longer a column on the new `content` schema —
|
|
215
|
-
// without it we can only detect missing kinds, not missing styles.
|
|
216
|
-
// We infer style presence from titles as a heuristic.
|
|
217
|
-
const [{ rows: kindCounts }, { rows: [thin] }] = await Promise.all([
|
|
218
|
-
db.execute({
|
|
219
|
-
sql: `SELECT cms.slug AS kind, COUNT(*) cnt, MAX(c.title) title_sample
|
|
220
|
-
FROM content c
|
|
221
|
-
JOIN cms ON cms.id = c.cms_id
|
|
222
|
-
WHERE c.profile_id=? AND c.published=1 AND c.hidden=0
|
|
223
|
-
GROUP BY cms.slug`,
|
|
224
|
-
args: [this.profileId],
|
|
225
|
-
}),
|
|
226
|
-
db.execute({
|
|
227
|
-
sql: `SELECT COUNT(*) cnt FROM content
|
|
228
|
-
WHERE profile_id=? AND published=1 AND word_count < 500`,
|
|
229
|
-
args: [this.profileId],
|
|
230
|
-
}),
|
|
231
|
-
])
|
|
232
|
-
|
|
233
|
-
const byKind = new Map(kindCounts.map(r => [String(r.kind), Number(r.cnt ?? 0)]))
|
|
234
|
-
const highValueTypes = ['listicle', 'how-to', 'ultimate-guide', 'qa']
|
|
235
|
-
// Best-effort: if there's no blog content at all, assume nothing of that
|
|
236
|
-
// style exists yet. Otherwise leave format-specific gaps to the content agent.
|
|
237
|
-
const missingTypes = (byKind.get('blog') ?? 0) === 0 ? highValueTypes : []
|
|
238
|
-
|
|
239
|
-
const noCompare = (byKind.get('compare') ?? 0) === 0
|
|
240
|
-
const noAlternative = (byKind.get('alternative') ?? 0) === 0
|
|
241
|
-
const thinPosts = Number(thin?.cnt ?? 0)
|
|
242
|
-
|
|
243
|
-
const advice: string[] = []
|
|
244
|
-
if (missingTypes.includes('listicle')) advice.push('Write a "Top 10 X" listicle — high traffic format.')
|
|
245
|
-
if (missingTypes.includes('how-to')) advice.push('Write a "How to X" guide — high search intent.')
|
|
246
|
-
if (missingTypes.includes('ultimate-guide')) advice.push('Write an ultimate guide — best for LLM citations.')
|
|
247
|
-
if (missingTypes.includes('qa')) advice.push('Write an FAQ article — targets long-tail queries.')
|
|
248
|
-
if (noCompare) advice.push('Create compare pages (X vs Y) — high buying intent.')
|
|
249
|
-
if (noAlternative) advice.push('Create "alternatives to X" pages — high buying intent.')
|
|
250
|
-
if (thinPosts > 0) advice.push(`${thinPosts} thin posts (<500 words) need expanding.`)
|
|
251
|
-
|
|
252
|
-
return { missing_types: missingTypes, thin_posts: thinPosts, no_compare: noCompare, no_alternative: noAlternative, advice }
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
private toSlug(s: string): string {
|
|
256
|
-
return s.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, 80)
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// ── llms.txt awareness ───────────────────────────────────────────────────────
|
|
260
|
-
// Your live app generates llms.txt at /llms.txt — agent checks it exists
|
|
261
|
-
// and advises on content. Generation is server-side, not agent's job.
|
|
262
|
-
|
|
263
|
-
async checkLLMSTxt(): Promise<{ exists: boolean; url: string; advice: string[] }> {
|
|
264
|
-
await this.init()
|
|
265
|
-
const url = `https://${this.ctx.profile.slug}.businesskit.io/llms.txt`
|
|
266
|
-
let exists = false
|
|
267
|
-
try {
|
|
268
|
-
const res = await fetch(url, { method: 'HEAD' })
|
|
269
|
-
exists = res.ok
|
|
270
|
-
} catch { /* network error */ }
|
|
271
|
-
|
|
272
|
-
const advice: string[] = []
|
|
273
|
-
if (!exists) {
|
|
274
|
-
advice.push('llms.txt not reachable at ' + url)
|
|
275
|
-
advice.push('Ensure the live app is generating it at /llms.txt')
|
|
276
|
-
} else {
|
|
277
|
-
advice.push('llms.txt exists — AI crawlers (GPTBot, ClaudeBot, PerplexityBot) can discover your content')
|
|
278
|
-
advice.push('Review it includes your latest products and top published posts')
|
|
279
|
-
}
|
|
280
|
-
return { exists, url, advice }
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function safeJSON(v: unknown, fb: unknown) {
|
|
285
|
-
try { return JSON.parse(v as string) } catch { return fb }
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
export const seoAgent = new SEOAgent()
|
package/agents/social/SOUL.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# social
|
|
2
|
-
|
|
3
|
-
Placeholder SOUL. See CLAUDE.md routing table and skills/social/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
|