@businesskit/agent 1.0.1 → 1.0.2

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.
@@ -1,17 +1,23 @@
1
1
  #!/usr/bin/env node
2
+ // bin/businesskit.js — npm global install entry point
3
+ // Compiled shim that launches cli.ts via tsx
4
+ // Cursor is right: bin entries must be .js for npm to execute them correctly
2
5
 
3
- import { spawnSync } from 'child_process';
4
- import { fileURLToPath } from 'url';
5
- import { dirname, resolve } from 'path';
6
+ import { createRequire } from 'module'
7
+ import { fileURLToPath } from 'url'
8
+ import { dirname, join } from 'path'
9
+ import { spawn } from 'child_process'
6
10
 
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const rootDir = resolve(__dirname, '..');
9
- const cliTs = resolve(rootDir, 'cli.ts');
11
+ const __dirname = dirname(fileURLToPath(import.meta.url))
12
+ const root = join(__dirname, '..')
13
+ const cli = join(root, 'cli.ts')
10
14
 
11
- // Run the cli.ts file using tsx
12
- const result = spawnSync('npx', ['tsx', cliTs, ...process.argv.slice(2)], {
15
+ // Find tsx — from local node_modules or global
16
+ const tsx = process.execPath.replace('node', 'tsx')
17
+ const proc = spawn(tsx, [cli, ...process.argv.slice(2)], {
13
18
  stdio: 'inherit',
14
- cwd: process.cwd()
15
- });
19
+ cwd: root,
20
+ env: { ...process.env }
21
+ })
16
22
 
17
- process.exit(result.status ?? 0);
23
+ proc.on('exit', code => process.exit(code ?? 0))
package/brand-voice.md ADDED
@@ -0,0 +1,127 @@
1
+ # Brand Voice
2
+
3
+ > This is the agent's writing bible. Fill it in once, update when your voice evolves.
4
+ > Agents load this before writing any content — blog, social, email, copy.
5
+
6
+ ---
7
+
8
+ ## Voice in three words
9
+
10
+ <!--
11
+ Pick three adjectives. Then prove each one with an example of what it sounds like.
12
+ Bad: "Professional, friendly, innovative"
13
+ Good: "Direct, generous, human"
14
+ -->
15
+
16
+ [Word 1]: [What it means in practice]
17
+ [Word 2]: [What it means in practice]
18
+ [Word 3]: [What it means in practice]
19
+
20
+ ## How I actually write
21
+
22
+ <!--
23
+ Paste 2-3 real examples of your best writing — a tweet, a paragraph, an email.
24
+ This is the most important part. Agents learn more from examples than descriptions.
25
+ -->
26
+
27
+ ### Example 1 — Short form (tweet / LinkedIn post)
28
+
29
+ [Paste a real post you wrote that you're proud of]
30
+
31
+ ### Example 2 — Medium form (email / newsletter intro)
32
+
33
+ [Paste a real paragraph or intro]
34
+
35
+ ### Example 3 — Long form (blog post intro or section)
36
+
37
+ [Optional — paste if you write long form]
38
+
39
+ ---
40
+
41
+ ## What I sound like vs what I don't
42
+
43
+ | I sound like this | Not like this |
44
+ |---|---|
45
+ | "Here's what worked for me" | "In today's digital landscape..." |
46
+ | Short sentences. Direct. | Long, hedge-y sentences with qualifiers |
47
+ | Specific numbers and examples | Vague generalities |
48
+ | First person, conversational | Corporate third person |
49
+ | [Add your own] | [Add your own] |
50
+
51
+ ---
52
+
53
+ ## Topics I own
54
+
55
+ <!--
56
+ What subjects do you have genuine authority on?
57
+ Agents use this to stay in your lane and not write outside your expertise.
58
+ -->
59
+
60
+ - [Topic 1]
61
+ - [Topic 2]
62
+ - [Topic 3]
63
+
64
+ ## Topics I avoid
65
+
66
+ <!--
67
+ Things you don't cover. Agents won't write about these.
68
+ -->
69
+
70
+ - [Topic to avoid]
71
+
72
+ ---
73
+
74
+ ## Audience
75
+
76
+ <!--
77
+ Who reads your content? Be specific.
78
+ Bad: "entrepreneurs and marketers"
79
+ Good: "solo creators who make $50-200k/year, mostly from courses and newsletters,
80
+ who are tired of doing everything themselves but can't afford a team"
81
+ -->
82
+
83
+ **Primary reader:** [Describe them specifically]
84
+
85
+ **What they're struggling with:** [The main problem]
86
+
87
+ **What they want:** [The transformation they're after]
88
+
89
+ **What they already know:** [Don't over-explain this]
90
+
91
+ ---
92
+
93
+ ## Platform-specific rules
94
+
95
+ <!--
96
+ How your voice shifts per platform. Keep it brief.
97
+ -->
98
+
99
+ **Twitter/X:** [e.g. punchy, no threads unless the idea earns it]
100
+ **LinkedIn:** [e.g. slightly more professional, lead with the lesson]
101
+ **Newsletter:** [e.g. personal, like writing to one person]
102
+ **Blog:** [e.g. practical, skimmable, always has a TL;DR]
103
+ **Instagram:** [e.g. visual-first, caption is secondary]
104
+
105
+ ---
106
+
107
+ ## Phrases I use
108
+
109
+ <!--
110
+ Things you actually say. Agents use these to match your voice.
111
+ -->
112
+
113
+ - [Phrase you use]
114
+ - [Phrase you use]
115
+
116
+ ## Phrases to avoid
117
+
118
+ <!--
119
+ Things that sound like AI slop or that you never say.
120
+ -->
121
+
122
+ - "In today's fast-paced world..."
123
+ - "It's important to note that..."
124
+ - "Dive deep"
125
+ - "Unlock your potential"
126
+ - "Leverage" (unless you mean actual leverage)
127
+ - [Add your own]
package/ingest.md ADDED
@@ -0,0 +1,110 @@
1
+ # /ingest — Process Inbox Into Knowledge Base
2
+
3
+ Process everything in `agent_notes` with `status='inbox'` into the knowledge base.
4
+ This is the magic moment: raw captures → structured, cross-linked wiki pages.
5
+
6
+ Run this periodically — not every session. Daily or weekly depending on how much you capture.
7
+
8
+ ---
9
+
10
+ ## What it does
11
+
12
+ 1. Fetch unprocessed notes from `agent_notes` (status='inbox')
13
+ 2. For each note, decide: new KB entry OR update existing one
14
+ 3. Cross-reference with existing KB index (slug + summary scan — no full content load)
15
+ 4. Write or update KB entry with cross-links
16
+ 5. If new note contradicts existing entry → mark existing stale first
17
+ 6. File the note as processed
18
+
19
+ ---
20
+
21
+ ## Steps
22
+
23
+ ```ts
24
+ import { getInboxNotes, getIndex, searchKB, getEntry,
25
+ upsertEntry, markStale, markNoteProcessed } from './lib/kb.ts'
26
+
27
+ // 1. Load index — cheap, summaries only
28
+ const index = await getIndex({ limit: 200 })
29
+ console.log(`KB has ${index.length} entries`)
30
+
31
+ // 2. Get inbox
32
+ const notes = await getInboxNotes(20)
33
+ if (!notes.length) {
34
+ console.log('Inbox empty — nothing to process')
35
+ return
36
+ }
37
+ console.log(`Processing ${notes.length} notes...`)
38
+
39
+ // 3. For each note:
40
+ for (const note of notes) {
41
+ // a. Search for related existing entries
42
+ const term = extractKeyTerm(note.content) // first meaningful phrase
43
+ const hits = await searchKB(term, 5)
44
+
45
+ // b. Decide: update existing or create new?
46
+ if (hits.length && isSameConcept(note.content, hits[0])) {
47
+ // Load the full entry only for the one we're updating
48
+ const existing = await getEntry(hits[0].slug)
49
+ // Check for contradiction
50
+ if (contradicts(note.content, existing?.content)) {
51
+ await markStale(hits[0].slug)
52
+ }
53
+ // Integrate new info into existing entry
54
+ await upsertEntry({
55
+ ...existing,
56
+ content: integrate(existing.content, note.content),
57
+ summary: refreshSummary(existing.content, note.content),
58
+ source_note_ids: [...existing.source_note_ids, note.id],
59
+ version: existing.version + 1,
60
+ })
61
+ await markNoteProcessed(note.id, `Integrated into: ${hits[0].slug}`)
62
+ } else {
63
+ // New entity or concept
64
+ const slug = generateSlug(note.content)
65
+ await upsertEntry({
66
+ entry_type: classifyNote(note.content), // entity/concept/source/synthesis
67
+ title: extractTitle(note.content),
68
+ slug,
69
+ content: compileWikiPage(note.content),
70
+ summary: oneSentenceSummary(note.content),
71
+ source_note_ids: [note.id],
72
+ tags: extractTags(note.content),
73
+ })
74
+ await markNoteProcessed(note.id, `Compiled into new KB entry: ${slug}`)
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## After each ingest
80
+
81
+ - Log to `agent_memory`: how many notes processed, how many new entries, how many updated
82
+ - Run stale check: show any entries marked stale that need updating
83
+ - Push summary to `agent_reports` if batch was large (10+ notes)
84
+
85
+ ## Stale handling
86
+
87
+ After processing inbox, check for stale entries:
88
+
89
+ ```ts
90
+ const stale = await getStaleEntries()
91
+ if (stale.length) {
92
+ console.log(`${stale.length} entries need updating:`)
93
+ stale.forEach(e => console.log(` - ${e.slug}: ${e.summary}`))
94
+ // Offer to update them or leave for next /ingest run
95
+ }
96
+ ```
97
+
98
+ ## When to run /ingest
99
+
100
+ - After a batch of notes have been added to inbox
101
+ - Before a deep research session (so KB is fresh)
102
+ - Weekly at minimum if you capture regularly
103
+ - Run by Scheduler agent on a weekly cron
104
+
105
+ ## One new source can ripple through 10-15 pages
106
+
107
+ That's the Karpathy insight. When you ingest a new article about email deliverability,
108
+ the agent updates not just the deliverability entry — it checks every entry that
109
+ references it (SES setup, ConvertKit comparison, newsletter strategy) and updates
110
+ the cross-links. That's what makes the KB compound over time.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@businesskit/agent",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "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.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,87 @@
1
+ # Working Style
2
+
3
+ > Fill this in. Agents adapt to how you actually work.
4
+ > Be honest — the more specific, the better the output.
5
+
6
+ ---
7
+
8
+ ## How I like to work with agents
9
+
10
+ <!--
11
+ Examples:
12
+ - Show me drafts before publishing anything
13
+ - Always give me 3 options, I'll pick one
14
+ - Just do it, don't ask — I'll review at the end
15
+ - Morning is my review time, schedule posts for afternoon
16
+ -->
17
+
18
+ [How you prefer to work with agents]
19
+
20
+ ## Approval preferences
21
+
22
+ <!--
23
+ What needs my sign-off? What can agents do automatically?
24
+ Examples:
25
+ - Blog posts: always show me draft first
26
+ - Social posts: auto-publish on LinkedIn, show me Twitter first
27
+ - Emails/newsletters: never send without approval
28
+ - CRM outreach: draft and queue, I'll approve in batches
29
+ -->
30
+
31
+ | Action | Auto | Draft first | Always ask |
32
+ |---|---|---|---|
33
+ | Blog post | | ✓ | |
34
+ | Social post | | ✓ | |
35
+ | Newsletter | | | ✓ |
36
+ | CRM outreach | | ✓ | |
37
+ | Product update | | | ✓ |
38
+
39
+ ## Publishing schedule
40
+
41
+ <!--
42
+ When do you publish what? Agents use this for scheduling.
43
+ Examples:
44
+ - Blog: Tuesday and Thursday
45
+ - Newsletter: every Friday 9am
46
+ - Social: daily 8am, 12pm, 6pm
47
+ - YouTube: Sunday
48
+ -->
49
+
50
+ [Your publishing schedule]
51
+
52
+ ## Review windows
53
+
54
+ <!--
55
+ When do you actually check and approve things?
56
+ Example: I review drafts every morning 9-10am. Don't schedule outside that.
57
+ -->
58
+
59
+ [When you review and approve]
60
+
61
+ ## Things agents should never do without asking
62
+
63
+ <!--
64
+ Hard stops. Examples:
65
+ - Never delete content — archive it instead
66
+ - Never change prices without asking
67
+ - Never publish to LinkedIn on weekends
68
+ - Never send emails to more than 100 people without approval
69
+ -->
70
+
71
+ - Never delete — archive instead
72
+ - [Add your own]
73
+
74
+ ## Things agents can always do without asking
75
+
76
+ <!--
77
+ Safe defaults. Examples:
78
+ - Can always save drafts
79
+ - Can always add to agent_notes for later
80
+ - Can always generate options/variants
81
+ - Can always push reports to agent_reports
82
+ -->
83
+
84
+ - Can always save to drafts
85
+ - Can always push to agent_reports
86
+ - Can always add to agent_notes inbox
87
+ - [Add your own]