create-bk-agent 0.17.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ npx create-bk-agent my-project
11
11
  The CLI asks three questions and generates a production-ready project:
12
12
 
13
13
  ```
14
- ✨ create-bk-agent v0.17.0
14
+ ✨ create-bk-agent v0.18.0
15
15
 
16
16
  ? Project name: my-project
17
17
  ? Architecture: Multi-agent (orchestrator + specialists)
@@ -109,6 +109,62 @@ All `add` commands are **idempotent** — running the same command twice won't d
109
109
 
110
110
  ---
111
111
 
112
+ ## Multi-project workspaces
113
+
114
+ Group related projects (e.g. microservices) into a workspace so the agent can navigate all of them from a single shared root — no more switching context manually.
115
+
116
+ ### Setup
117
+
118
+ Use the built-in `/workspace` slash commands from inside the running agent:
119
+
120
+ ```
121
+ /workspace create my-system
122
+ /workspace add my-system ~/dev/my-system/auth-service
123
+ /workspace add my-system ~/dev/my-system/api-gateway
124
+ /workspace add my-system ~/dev/my-system/user-service
125
+ ```
126
+
127
+ When a second project is added, a **common root** is auto-detected (`~/dev/my-system/`). The next `/workspace switch` sets that directory as the agent's working directory, giving it access to all services at once.
128
+
129
+ ### Commands
130
+
131
+ | Command | Description |
132
+ |---|---|
133
+ | `/workspace create <name>` | Create a workspace |
134
+ | `/workspace add <ws> <cwd> [name]` | Add a project |
135
+ | `/workspace import <cwd> [ws] [name]` | Add project (auto-creates workspace) |
136
+ | `/workspace switch <ws> [project]` | Switch to workspace (uses shared root if configured) |
137
+ | `/workspace set-root <ws> [path]` | Set shared root manually (auto-detected if no path) |
138
+ | `/workspace remove <ws> <project>` | Remove a project |
139
+ | `/workspace delete <name>` | Delete workspace |
140
+ | `/workspace list` | List all workspaces |
141
+
142
+ ### Shared root (microservices)
143
+
144
+ For a system with multiple services under a common parent:
145
+
146
+ ```
147
+ ~/dev/my-system/ ← shared root (agent workingDir)
148
+ ├── auth-service/
149
+ ├── api-gateway/
150
+ └── user-service/
151
+ ```
152
+
153
+ The agent can read and edit files across all services using relative paths:
154
+
155
+ ```
156
+ auth-service/src/middleware.ts
157
+ api-gateway/src/routes/auth.ts
158
+ ```
159
+
160
+ To override the auto-detected root:
161
+
162
+ ```
163
+ /workspace set-root my-system ~/dev/my-system
164
+ ```
165
+
166
+ ---
167
+
112
168
  ## Requirements
113
169
 
114
170
  - Node.js >= 20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bk-agent",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "Create a new BackendKit agent project",
5
5
  "main": "dist/src/index.js",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@backendkit-labs/agent-core": "^0.16.0",
14
+ "@backendkit-labs/agent-core": "^0.17.0",
15
15
  "dotenv": "^16.0.0"
16
16
  },
17
17
  "devDependencies": {
@@ -11,7 +11,7 @@
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@backendkit-labs/agent-core": "^0.16.0",
14
+ "@backendkit-labs/agent-core": "^0.17.0",
15
15
  "dotenv": "^16.0.0"
16
16
  },
17
17
  "devDependencies": {
@@ -1,5 +1,7 @@
1
1
  import 'dotenv/config';
2
- import { createAutonomousAgent } from '@backendkit-labs/agent-core';
2
+ import * as os from 'os';
3
+ import * as path from 'path';
4
+ import { createAutonomousAgent, createMemorySystem } from '@backendkit-labs/agent-core';
3
5
  import type { AgentProfile } from '@backendkit-labs/agent-core';
4
6
 
5
7
  // ── Agent definition ──────────────────────────────────────────────────────────
@@ -23,6 +25,18 @@ const apiKey = process.env.ANTHROPIC_API_KEY ?? process.env.OPENAI_API_KEY ??
23
25
 
24
26
  if (!apiKey) { console.error('Missing API key'); process.exit(1); }
25
27
 
28
+ // ── Memory — persists context between trigger executions ──────────────────────
29
+
30
+ const APP_DIR = path.join(os.homedir(), '.my-autonomous-agent');
31
+ const MEM_DIR = path.join(APP_DIR, 'memory');
32
+
33
+ const memory = createMemorySystem({
34
+ episodic: { provider: 'json', path: path.join(MEM_DIR, 'episodes.json') },
35
+ semantic: { provider: 'json', path: path.join(MEM_DIR, 'knowledge.json') },
36
+ procedural: { provider: 'json', path: path.join(MEM_DIR, 'patterns.json') },
37
+ retention: { maxEpisodes: 200 },
38
+ });
39
+
26
40
  // ── Autonomous agent ──────────────────────────────────────────────────────────
27
41
 
28
42
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -32,6 +46,7 @@ const agent = createAutonomousAgent({
32
46
  agents: [monitorAgent],
33
47
  defaultAgent: 'monitor',
34
48
  goal: 'TODO: describe the agent goal',
49
+ memorySystem: memory,
35
50
 
36
51
  triggers: [
37
52
  // Run every day at 9:00 AM
@@ -45,7 +60,7 @@ const agent = createAutonomousAgent({
45
60
  {
46
61
  type: 'webhook',
47
62
  path: '/events',
48
- // secret: process.env.WEBHOOK_SECRET, // uncomment to validate signatures
63
+ // secret: process.env.WEBHOOK_SECRET,
49
64
  },
50
65
 
51
66
  // TODO: add more triggers as needed
@@ -61,6 +76,7 @@ void (async () => {
61
76
  await agent.start();
62
77
  console.log('Autonomous agent started.');
63
78
  console.log('Webhook listening on port', process.env.WEBHOOK_PORT ?? 3000);
79
+ console.log(`Memory stored in: ${APP_DIR}`);
64
80
 
65
81
  process.on('SIGTERM', async () => { await agent.stop(); process.exit(0); });
66
82
  process.on('SIGINT', async () => { await agent.stop(); process.exit(0); });
@@ -11,8 +11,8 @@
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@backendkit-labs/agent-coding": "^0.16.0",
15
- "@backendkit-labs/agent-core": "^0.16.0",
14
+ "@backendkit-labs/agent-coding": "^0.17.0",
15
+ "@backendkit-labs/agent-core": "^0.17.0",
16
16
  "dotenv": "^16.0.0"
17
17
  },
18
18
  "devDependencies": {
@@ -11,7 +11,7 @@
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@backendkit-labs/agent-core": "^0.16.0",
14
+ "@backendkit-labs/agent-core": "^0.17.0",
15
15
  "dotenv": "^16.0.0"
16
16
  },
17
17
  "devDependencies": {
@@ -12,7 +12,7 @@
12
12
  "typecheck": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@backendkit-labs/agent-core": "^0.16.0",
15
+ "@backendkit-labs/agent-core": "^0.17.0",
16
16
  "dotenv": "^16.0.0",
17
17
  "openai": "^4.0.0",
18
18
  "zod": "^3.25.0"
@@ -1,9 +1,12 @@
1
+ import * as os from 'os';
2
+ import * as path from 'path';
1
3
  import {
2
4
  AgentEngine,
3
5
  AgentRegistry,
4
6
  ToolRegistry,
5
7
  ProviderRegistry,
6
8
  CallbackTransport,
9
+ createMemorySystem,
7
10
  } from '@backendkit-labs/agent-core';
8
11
  import { OpenAICompatibleProvider } from './providers/openai-compatible';
9
12
  import { loadConfig } from './config';
@@ -12,6 +15,24 @@ import { SPECIALIST_A_PROFILE } from './agents/specialist-a';
12
15
  import { SPECIALIST_B_PROFILE } from './agents/specialist-b';
13
16
  import { exampleAction, exampleQuery } from './tools/example-tools';
14
17
 
18
+ // ── Persistent storage paths ──────────────────────────────────────────────────
19
+ // All state lives in ~/.my-agent/ so it survives restarts.
20
+
21
+ const APP_DIR = path.join(os.homedir(), '.my-agent');
22
+ const HISTORY = path.join(APP_DIR, 'history.json');
23
+ const MEM_DIR = path.join(APP_DIR, 'memory');
24
+
25
+ // ── Memory system ─────────────────────────────────────────────────────────────
26
+ // Three-tier: episodic (past experiences) + semantic (knowledge) + procedural (patterns).
27
+ // buildContextBlock() auto-injects relevant memories into each agent turn.
28
+
29
+ const memory = createMemorySystem({
30
+ episodic: { provider: 'json', path: path.join(MEM_DIR, 'episodes.json') },
31
+ semantic: { provider: 'json', path: path.join(MEM_DIR, 'knowledge.json') },
32
+ procedural: { provider: 'json', path: path.join(MEM_DIR, 'patterns.json') },
33
+ retention: { maxEpisodes: 500 },
34
+ });
35
+
15
36
  export function createEngine(transport: CallbackTransport): AgentEngine {
16
37
  const config = loadConfig();
17
38
 
@@ -19,6 +40,8 @@ export function createEngine(transport: CallbackTransport): AgentEngine {
19
40
  tools
20
41
  .register(exampleAction)
21
42
  .register(exampleQuery);
43
+ // Register memory tools so agents can explicitly save/recall memories
44
+ for (const t of memory.getTools()) tools.register(t);
22
45
  // TODO: register more tools
23
46
 
24
47
  const agents = new AgentRegistry();
@@ -36,7 +59,7 @@ export function createEngine(transport: CallbackTransport): AgentEngine {
36
59
  }));
37
60
 
38
61
  return new AgentEngine({
39
- model: { provider: 'default', id: config.llmModel },
62
+ model: { provider: 'default', id: config.llmModel },
40
63
  agents,
41
64
  tools,
42
65
  providers,
@@ -45,5 +68,11 @@ export function createEngine(transport: CallbackTransport): AgentEngine {
45
68
  transport,
46
69
  maxIterations: 30,
47
70
  iterationMode: 'auto',
71
+ // Conversation history — persists between runs
72
+ historyPath: HISTORY,
73
+ maxContextMessages: 100,
74
+ // Long-term memory — injects relevant context each turn
75
+ memorySystem: memory,
76
+ additionalRoots: [APP_DIR],
48
77
  });
49
78
  }
@@ -12,7 +12,7 @@
12
12
  "typecheck": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@backendkit-labs/agent-core": "^0.16.0",
15
+ "@backendkit-labs/agent-core": "^0.17.0",
16
16
  "dotenv": "^16.0.0",
17
17
  "openai": "^4.0.0",
18
18
  "zod": "^3.25.0"
@@ -1,15 +1,33 @@
1
+ import * as os from 'os';
2
+ import * as path from 'path';
1
3
  import {
2
4
  AgentEngine,
3
5
  AgentRegistry,
4
6
  ToolRegistry,
5
7
  ProviderRegistry,
6
8
  CallbackTransport,
9
+ createMemorySystem,
7
10
  } from '@backendkit-labs/agent-core';
8
11
  import { OpenAICompatibleProvider } from './providers/openai-compatible';
9
12
  import { loadConfig } from './config';
10
13
  import { MY_AGENT_PROFILE } from './agents/my-agent';
11
14
  import { exampleAction, exampleQuery } from './tools/example-tools';
12
15
 
16
+ // ── Persistent storage paths ──────────────────────────────────────────────────
17
+
18
+ const APP_DIR = path.join(os.homedir(), '.my-agent');
19
+ const HISTORY = path.join(APP_DIR, 'history.json');
20
+ const MEM_DIR = path.join(APP_DIR, 'memory');
21
+
22
+ // ── Memory system ─────────────────────────────────────────────────────────────
23
+
24
+ const memory = createMemorySystem({
25
+ episodic: { provider: 'json', path: path.join(MEM_DIR, 'episodes.json') },
26
+ semantic: { provider: 'json', path: path.join(MEM_DIR, 'knowledge.json') },
27
+ procedural: { provider: 'json', path: path.join(MEM_DIR, 'patterns.json') },
28
+ retention: { maxEpisodes: 500 },
29
+ });
30
+
13
31
  export function createEngine(transport: CallbackTransport): AgentEngine {
14
32
  const config = loadConfig();
15
33
 
@@ -17,6 +35,7 @@ export function createEngine(transport: CallbackTransport): AgentEngine {
17
35
  tools
18
36
  .register(exampleAction)
19
37
  .register(exampleQuery);
38
+ for (const t of memory.getTools()) tools.register(t);
20
39
  // TODO: register more tools
21
40
 
22
41
  const agents = new AgentRegistry();
@@ -31,7 +50,7 @@ export function createEngine(transport: CallbackTransport): AgentEngine {
31
50
  }));
32
51
 
33
52
  return new AgentEngine({
34
- model: { provider: 'default', id: config.llmModel },
53
+ model: { provider: 'default', id: config.llmModel },
35
54
  agents,
36
55
  tools,
37
56
  providers,
@@ -40,5 +59,9 @@ export function createEngine(transport: CallbackTransport): AgentEngine {
40
59
  transport,
41
60
  maxIterations: 20,
42
61
  iterationMode: 'auto',
62
+ historyPath: HISTORY,
63
+ maxContextMessages: 100,
64
+ memorySystem: memory,
65
+ additionalRoots: [APP_DIR],
43
66
  });
44
67
  }
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@backendkit-labs/agent-coding": "^0.14.0",
15
- "@backendkit-labs/agent-core": "^0.16.0",
15
+ "@backendkit-labs/agent-core": "^0.17.0",
16
16
  "dotenv": "^16.0.0"
17
17
  },
18
18
  "devDependencies": {
@@ -11,7 +11,7 @@
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@backendkit-labs/agent-core": "^0.16.0",
14
+ "@backendkit-labs/agent-core": "^0.17.0",
15
15
  "dotenv": "^16.0.0",
16
16
  "openai": "^4.0.0",
17
17
  "zod": "^3.25.0"
@@ -12,7 +12,7 @@
12
12
  "typecheck": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@backendkit-labs/agent-core": "^0.16.0",
15
+ "@backendkit-labs/agent-core": "^0.17.0",
16
16
  "@modelcontextprotocol/sdk": "^1.12.0",
17
17
  "dotenv": "^16.0.0",
18
18
  "zod": "^3.25.0"
@@ -11,7 +11,7 @@
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@backendkit-labs/agent-core": "^0.16.0",
14
+ "@backendkit-labs/agent-core": "^0.17.0",
15
15
  "dotenv": "^16.0.0"
16
16
  },
17
17
  "devDependencies": {