@basicmemory/openclaw-basic-memory 1.0.0 → 1.1.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 +4 -4
- package/bm-client.ts +180 -49
- package/config.ts +5 -0
- package/dist/bm-client.d.ts +40 -20
- package/dist/bm-client.js +118 -29
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -0
- package/dist/index.js +2 -3
- package/dist/memory/basic-memory-capability.js +7 -1
- package/dist/tools/schema-diff.js +5 -3
- package/dist/tools/schema-infer.js +1 -1
- package/dist/tools/schema-validate.js +5 -4
- package/index.ts +2 -3
- package/memory/basic-memory-capability.ts +7 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/setup-bm.sh +1 -4
- package/skills/manifest.json +5 -5
- package/skills/memory-agents/SKILL.md +12 -12
- package/skills/memory-capture/SKILL.md +1 -1
- package/skills/memory-comark/SKILL.md +1 -1
- package/skills/memory-continue/SKILL.md +8 -8
- package/skills/memory-curate/SKILL.md +2 -2
- package/skills/memory-defrag/SKILL.md +2 -2
- package/skills/memory-ingest/SKILL.md +4 -3
- package/skills/memory-lifecycle/SKILL.md +1 -1
- package/skills/memory-literary-analysis/SKILL.md +10 -10
- package/skills/memory-metadata-search/SKILL.md +1 -1
- package/skills/memory-notes/SKILL.md +1 -1
- package/skills/memory-okf/SKILL.md +1 -1
- package/skills/memory-quest/SKILL.md +9 -4
- package/skills/memory-reflect/SKILL.md +3 -3
- package/skills/memory-research/SKILL.md +1 -1
- package/skills/memory-schema/SKILL.md +14 -14
- package/skills/memory-start/SKILL.md +116 -0
- package/skills/memory-tasks/SKILL.md +5 -5
- package/tools/schema-diff.ts +7 -3
- package/tools/schema-infer.ts +1 -1
- package/tools/schema-validate.ts +5 -4
- package/skills/memory-onboarding/SKILL.md +0 -153
- package/skills/memory-onboarding/evals/evals.json +0 -29
- package/skills/memory-onboarding/references/assistant-setup.md +0 -72
- package/skills/memory-onboarding/references/conventions.md +0 -118
- package/skills/memory-onboarding/references/domain-playbooks.md +0 -159
- package/skills/memory-onboarding/references/schema-guide.md +0 -137
package/dist/bm-client.js
CHANGED
|
@@ -4,6 +4,20 @@ import { Client } from "@modelcontextprotocol/sdk/client";
|
|
|
4
4
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
5
5
|
import { log } from "./logger.js";
|
|
6
6
|
const DEFAULT_RETRY_DELAYS_MS = [500, 1000, 2000];
|
|
7
|
+
// Thrown for calls to the plugin's project after BM refused to create it.
|
|
8
|
+
// Deliberately not a BmToolError: note methods read a BmToolError's refusal
|
|
9
|
+
// payload as their own, and would report this ALREADY_EXISTS as an existing
|
|
10
|
+
// note.
|
|
11
|
+
export class ProjectUnavailableError extends Error {
|
|
12
|
+
project;
|
|
13
|
+
reason;
|
|
14
|
+
constructor(project, reason) {
|
|
15
|
+
super(`Basic Memory project "${project}" is unavailable: ${reason}`);
|
|
16
|
+
this.name = "ProjectUnavailableError";
|
|
17
|
+
this.project = project;
|
|
18
|
+
this.reason = reason;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
7
21
|
export class NoteAlreadyExistsError extends Error {
|
|
8
22
|
permalink;
|
|
9
23
|
constructor(title, permalink, message) {
|
|
@@ -45,10 +59,14 @@ const REQUIRED_TOOLS = [
|
|
|
45
59
|
"bm_write",
|
|
46
60
|
"bm_edit",
|
|
47
61
|
"bm_context",
|
|
48
|
-
"
|
|
62
|
+
"bm_project_list",
|
|
63
|
+
"bm_project_create",
|
|
64
|
+
"bm_recent",
|
|
49
65
|
"bm_delete",
|
|
50
66
|
"bm_move",
|
|
51
|
-
"
|
|
67
|
+
"bm_schema_validate",
|
|
68
|
+
"bm_schema_infer",
|
|
69
|
+
"bm_schema_diff",
|
|
52
70
|
];
|
|
53
71
|
/**
|
|
54
72
|
* The text to preview for a search hit. `content` is the start of the note,
|
|
@@ -142,6 +160,12 @@ function projectMatchesWorkspace(project, workspace) {
|
|
|
142
160
|
project.workspace_tenant_id,
|
|
143
161
|
].some((value) => typeof value === "string" && value.toLowerCase() === requested);
|
|
144
162
|
}
|
|
163
|
+
function parseProjectList(payload) {
|
|
164
|
+
if (isRecord(payload) && Array.isArray(payload.projects)) {
|
|
165
|
+
return payload.projects;
|
|
166
|
+
}
|
|
167
|
+
throw new Error("invalid bm_project_list response");
|
|
168
|
+
}
|
|
145
169
|
export class BmClient {
|
|
146
170
|
bmPath;
|
|
147
171
|
project;
|
|
@@ -158,6 +182,10 @@ export class BmClient {
|
|
|
158
182
|
startup = null;
|
|
159
183
|
startupRetry = null;
|
|
160
184
|
projectPath;
|
|
185
|
+
adoptExistingProject = false;
|
|
186
|
+
// BM's refusal to create the plugin's project, kept so calls to that
|
|
187
|
+
// project report it while listing and other projects still work.
|
|
188
|
+
projectSetupError = null;
|
|
161
189
|
prepare;
|
|
162
190
|
client = null;
|
|
163
191
|
transport = null;
|
|
@@ -190,6 +218,9 @@ export class BmClient {
|
|
|
190
218
|
if (options?.projectPath) {
|
|
191
219
|
this.projectPath = options.projectPath;
|
|
192
220
|
}
|
|
221
|
+
if (options?.adoptExistingProject !== undefined) {
|
|
222
|
+
this.adoptExistingProject = options.adoptExistingProject;
|
|
223
|
+
}
|
|
193
224
|
if (options?.prepare) {
|
|
194
225
|
this.prepare = options.prepare;
|
|
195
226
|
}
|
|
@@ -199,8 +230,60 @@ export class BmClient {
|
|
|
199
230
|
async runStartup() {
|
|
200
231
|
await this.prepare?.();
|
|
201
232
|
await this.connectWithRetries();
|
|
202
|
-
if (this.projectPath)
|
|
203
|
-
|
|
233
|
+
if (!this.projectPath)
|
|
234
|
+
return;
|
|
235
|
+
this.projectSetupError = null;
|
|
236
|
+
const projectPath = await this.startupProjectPath(this.projectPath);
|
|
237
|
+
try {
|
|
238
|
+
await this.createProject(projectPath);
|
|
239
|
+
}
|
|
240
|
+
catch (err) {
|
|
241
|
+
// Trigger: BM refused the project, e.g. a configured projectPath that
|
|
242
|
+
// differs from where a project of this name is stored (#1846).
|
|
243
|
+
// Why: a refusal is deterministic, so retrying startup cannot fix it,
|
|
244
|
+
// and failing startup would also fail project listing, the call a
|
|
245
|
+
// user needs to see the stored path. Other failures still fail
|
|
246
|
+
// startup so the next tool call retries them.
|
|
247
|
+
// Outcome: calls to the plugin's project throw this refusal; listing
|
|
248
|
+
// and calls naming another project still work.
|
|
249
|
+
if (!(err instanceof BmToolError) ||
|
|
250
|
+
parseRefusalPayload(err.toolMessage) === null) {
|
|
251
|
+
throw err;
|
|
252
|
+
}
|
|
253
|
+
this.projectSetupError = new ProjectUnavailableError(this.project, describeToolError(err));
|
|
254
|
+
log.error(this.projectSetupError.message);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// The folder startup creates the project at. Since #1846, BM refuses a
|
|
258
|
+
// create whose path differs from the stored one instead of reusing the
|
|
259
|
+
// project by name.
|
|
260
|
+
async startupProjectPath(configured) {
|
|
261
|
+
// Trigger: projectPath was not configured.
|
|
262
|
+
// Why: its default has changed between plugin releases ("." and
|
|
263
|
+
// ~/.basic-memory/openclaw/), and users create projects by hand, so an
|
|
264
|
+
// existing project may sit somewhere other than the default.
|
|
265
|
+
// Outcome: create at the stored folder, which BM treats as idempotent.
|
|
266
|
+
if (!this.adoptExistingProject)
|
|
267
|
+
return configured;
|
|
268
|
+
// With cloud credentials the listing holds one row per workspace for a
|
|
269
|
+
// name, and only the row attached to the local project carries
|
|
270
|
+
// local_path; a cloud-only row's path is tenant-relative. BM compares a
|
|
271
|
+
// local create against the local project, so only local_path qualifies.
|
|
272
|
+
const name = this.project.toLowerCase();
|
|
273
|
+
const localPath = parseProjectList(await this.callStructured("bm_project_list", {
|
|
274
|
+
output_format: "json",
|
|
275
|
+
})).find((project) => project.name.toLowerCase() === name && project.local_path)?.local_path;
|
|
276
|
+
if (!localPath)
|
|
277
|
+
return configured;
|
|
278
|
+
if (localPath !== configured) {
|
|
279
|
+
log.info(`using existing project "${this.project}" at ${localPath}; set projectPath to use another folder`);
|
|
280
|
+
}
|
|
281
|
+
return localPath;
|
|
282
|
+
}
|
|
283
|
+
// The refusal from the last project setup, or null when the project is
|
|
284
|
+
// usable. Status checks report it, since listing projects still succeeds.
|
|
285
|
+
projectUnavailableReason() {
|
|
286
|
+
return this.projectSetupError?.reason ?? null;
|
|
204
287
|
}
|
|
205
288
|
async waitForStartup() {
|
|
206
289
|
if (!this.startup)
|
|
@@ -393,6 +476,13 @@ export class BmClient {
|
|
|
393
476
|
}
|
|
394
477
|
async callTool(name, args) {
|
|
395
478
|
await this.waitForStartup();
|
|
479
|
+
// Trigger: BM refused the plugin's project at startup.
|
|
480
|
+
// Why: the refusal concerns that project only; a call that names another
|
|
481
|
+
// project by name or id must still reach BM.
|
|
482
|
+
// Outcome: only calls routed to the plugin's project report the refusal.
|
|
483
|
+
if (this.projectSetupError && this.targetsPluginProject(args)) {
|
|
484
|
+
throw this.projectSetupError;
|
|
485
|
+
}
|
|
396
486
|
return this.callStructured(name, args);
|
|
397
487
|
}
|
|
398
488
|
// Ungated: startup itself calls this to create the project.
|
|
@@ -407,6 +497,12 @@ export class BmClient {
|
|
|
407
497
|
}
|
|
408
498
|
return structuredPayload;
|
|
409
499
|
}
|
|
500
|
+
// Project names match case-insensitively in BM, so "Test-Project" routes
|
|
501
|
+
// to the plugin's "test-project" too.
|
|
502
|
+
targetsPluginProject(args) {
|
|
503
|
+
return (typeof args.project === "string" &&
|
|
504
|
+
args.project.toLowerCase() === this.project.toLowerCase());
|
|
505
|
+
}
|
|
410
506
|
routedProject(project) {
|
|
411
507
|
return project ?? this.project;
|
|
412
508
|
}
|
|
@@ -421,15 +517,14 @@ export class BmClient {
|
|
|
421
517
|
await this.createProject(projectPath);
|
|
422
518
|
}
|
|
423
519
|
async createProject(projectPath) {
|
|
424
|
-
const payload = await this.callStructured("
|
|
425
|
-
command: "create",
|
|
520
|
+
const payload = await this.callStructured("bm_project_create", {
|
|
426
521
|
name: this.project,
|
|
427
522
|
path: projectPath,
|
|
428
523
|
set_default: true,
|
|
429
524
|
output_format: "json",
|
|
430
525
|
});
|
|
431
526
|
if (!isRecord(payload)) {
|
|
432
|
-
throw new Error("invalid
|
|
527
|
+
throw new Error("invalid bm_project_create response");
|
|
433
528
|
}
|
|
434
529
|
}
|
|
435
530
|
async listWorkspaces() {
|
|
@@ -447,18 +542,16 @@ export class BmClient {
|
|
|
447
542
|
return [...workspaces.values()];
|
|
448
543
|
}
|
|
449
544
|
async listProjects(workspace) {
|
|
450
|
-
|
|
451
|
-
|
|
545
|
+
// Waits for startup but not for the plugin's project: when BM refused
|
|
546
|
+
// it, the listing is how the user finds where it is actually stored.
|
|
547
|
+
await this.waitForStartup();
|
|
548
|
+
const projects = parseProjectList(await this.callStructured("bm_project_list", {
|
|
452
549
|
output_format: "json",
|
|
453
|
-
});
|
|
454
|
-
if (
|
|
455
|
-
|
|
456
|
-
if (workspace) {
|
|
457
|
-
return projects.filter((project) => projectMatchesWorkspace(project, workspace));
|
|
458
|
-
}
|
|
459
|
-
return projects;
|
|
550
|
+
}));
|
|
551
|
+
if (workspace) {
|
|
552
|
+
return projects.filter((project) => projectMatchesWorkspace(project, workspace));
|
|
460
553
|
}
|
|
461
|
-
|
|
554
|
+
return projects;
|
|
462
555
|
}
|
|
463
556
|
async search(query, limit = 10, project, metadata) {
|
|
464
557
|
const args = {
|
|
@@ -581,16 +674,15 @@ export class BmClient {
|
|
|
581
674
|
}
|
|
582
675
|
async recentActivity(timeframe = "24h", project) {
|
|
583
676
|
const args = {
|
|
584
|
-
command: "recent",
|
|
585
677
|
since: timeframe,
|
|
586
678
|
output_format: "json",
|
|
587
679
|
project: this.routedProject(project),
|
|
588
680
|
};
|
|
589
|
-
const payload = await this.callTool("
|
|
681
|
+
const payload = await this.callTool("bm_recent", args);
|
|
590
682
|
if (isRecord(payload) && Array.isArray(payload.results)) {
|
|
591
683
|
return payload.results;
|
|
592
684
|
}
|
|
593
|
-
throw new Error("invalid
|
|
685
|
+
throw new Error("invalid bm_recent response");
|
|
594
686
|
}
|
|
595
687
|
async editNote(identifier, operation, content, options = {}, project) {
|
|
596
688
|
const args = {
|
|
@@ -669,7 +761,6 @@ export class BmClient {
|
|
|
669
761
|
}
|
|
670
762
|
async schemaValidate(noteType, identifier, project) {
|
|
671
763
|
const args = {
|
|
672
|
-
command: "validate",
|
|
673
764
|
output_format: "json",
|
|
674
765
|
project: this.routedProject(project),
|
|
675
766
|
};
|
|
@@ -677,36 +768,34 @@ export class BmClient {
|
|
|
677
768
|
args.note_type = noteType;
|
|
678
769
|
if (identifier)
|
|
679
770
|
args.identifier = identifier;
|
|
680
|
-
const payload = await this.callTool("
|
|
771
|
+
const payload = await this.callTool("bm_schema_validate", args);
|
|
681
772
|
if (!isRecord(payload)) {
|
|
682
|
-
throw new Error("invalid
|
|
773
|
+
throw new Error("invalid bm_schema_validate response");
|
|
683
774
|
}
|
|
684
775
|
return payload;
|
|
685
776
|
}
|
|
686
777
|
async schemaInfer(noteType, threshold = 0.25, project) {
|
|
687
778
|
const args = {
|
|
688
|
-
command: "infer",
|
|
689
779
|
note_type: noteType,
|
|
690
780
|
threshold,
|
|
691
781
|
output_format: "json",
|
|
692
782
|
project: this.routedProject(project),
|
|
693
783
|
};
|
|
694
|
-
const payload = await this.callTool("
|
|
784
|
+
const payload = await this.callTool("bm_schema_infer", args);
|
|
695
785
|
if (!isRecord(payload)) {
|
|
696
|
-
throw new Error("invalid
|
|
786
|
+
throw new Error("invalid bm_schema_infer response");
|
|
697
787
|
}
|
|
698
788
|
return payload;
|
|
699
789
|
}
|
|
700
790
|
async schemaDiff(noteType, project) {
|
|
701
791
|
const args = {
|
|
702
|
-
command: "diff",
|
|
703
792
|
note_type: noteType,
|
|
704
793
|
output_format: "json",
|
|
705
794
|
project: this.routedProject(project),
|
|
706
795
|
};
|
|
707
|
-
const payload = await this.callTool("
|
|
796
|
+
const payload = await this.callTool("bm_schema_diff", args);
|
|
708
797
|
if (!isRecord(payload)) {
|
|
709
|
-
throw new Error("invalid
|
|
798
|
+
throw new Error("invalid bm_schema_diff response");
|
|
710
799
|
}
|
|
711
800
|
return payload;
|
|
712
801
|
}
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -68,6 +68,7 @@ export function parseConfig(raw) {
|
|
|
68
68
|
projectPath: typeof cfg.projectPath === "string" && cfg.projectPath.length > 0
|
|
69
69
|
? cfg.projectPath
|
|
70
70
|
: ".",
|
|
71
|
+
projectPathConfigured: typeof cfg.projectPath === "string" && cfg.projectPath.length > 0,
|
|
71
72
|
bmPath: typeof cfg.bmPath === "string" && cfg.bmPath.length > 0
|
|
72
73
|
? cfg.bmPath
|
|
73
74
|
: "bm",
|
package/dist/index.js
CHANGED
|
@@ -46,9 +46,7 @@ async function installBasicMemoryIfMissing(bmBin) {
|
|
|
46
46
|
"then restart the gateway.");
|
|
47
47
|
}
|
|
48
48
|
log.info("installing basic-memory via uv (this may take a minute)...");
|
|
49
|
-
|
|
50
|
-
// installs the last release that had none (#1338).
|
|
51
|
-
const { stdout } = await execFileAsync("uv", ["tool", "install", "basic-memory", "--prerelease=allow", "--force"], { encoding: "utf-8", timeout: 120_000 });
|
|
49
|
+
const { stdout } = await execFileAsync("uv", ["tool", "install", "basic-memory", "--force"], { encoding: "utf-8", timeout: 120_000 });
|
|
52
50
|
log.info(`basic-memory installed: ${stdout.trim().split("\n").pop()}`);
|
|
53
51
|
if (!(await isCommandAvailable(bmBin))) {
|
|
54
52
|
throw new Error("bm installed but not found on PATH. You may need to add uv's bin directory to your PATH (typically ~/.local/bin).");
|
|
@@ -133,6 +131,7 @@ export default definePluginEntry({
|
|
|
133
131
|
.start({
|
|
134
132
|
cwd: workspace,
|
|
135
133
|
projectPath,
|
|
134
|
+
adoptExistingProject: !cfg.projectPathConfigured,
|
|
136
135
|
prepare: () => installBasicMemoryIfMissing(cfg.bmPath || "bm"),
|
|
137
136
|
})
|
|
138
137
|
.then(async () => {
|
|
@@ -117,7 +117,6 @@ export function openBasicMemoryReader(client, context) {
|
|
|
117
117
|
// any note content, so it is safe for status-only callers.
|
|
118
118
|
try {
|
|
119
119
|
await guarded(() => client.listProjects());
|
|
120
|
-
return { status: "ready" };
|
|
121
120
|
}
|
|
122
121
|
catch (err) {
|
|
123
122
|
log.warn(`memory health check failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -126,6 +125,13 @@ export function openBasicMemoryReader(client, context) {
|
|
|
126
125
|
message: "Basic Memory is not reachable",
|
|
127
126
|
};
|
|
128
127
|
}
|
|
128
|
+
// Listing works even when BM refused the plugin's project, so the
|
|
129
|
+
// refusal is checked separately; every search and read would fail.
|
|
130
|
+
const projectProblem = client.projectUnavailableReason();
|
|
131
|
+
if (projectProblem) {
|
|
132
|
+
return { status: "unavailable", message: projectProblem };
|
|
133
|
+
}
|
|
134
|
+
return { status: "ready" };
|
|
129
135
|
},
|
|
130
136
|
// In the gateway the BM MCP session is shared by the whole plugin and
|
|
131
137
|
// owned by its service, so closing one caller's reader releases nothing.
|
|
@@ -31,7 +31,7 @@ export function registerSchemaDiffTool(api, client) {
|
|
|
31
31
|
details: result,
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
const lines = [`**Type:** ${result.
|
|
34
|
+
const lines = [`**Type:** ${result.note_type}`];
|
|
35
35
|
if (result.new_fields.length === 0 &&
|
|
36
36
|
result.dropped_fields.length === 0 &&
|
|
37
37
|
result.cardinality_changes.length === 0) {
|
|
@@ -45,9 +45,11 @@ export function registerSchemaDiffTool(api, client) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
if (result.dropped_fields.length > 0) {
|
|
48
|
-
|
|
48
|
+
// A dropped field can still appear in a few notes, so report how
|
|
49
|
+
// often it does, as BM's own drift report does.
|
|
50
|
+
lines.push("", "### Dropped Fields (in schema, rare in notes)");
|
|
49
51
|
for (const f of result.dropped_fields) {
|
|
50
|
-
lines.push(`- **${f.name}** —
|
|
52
|
+
lines.push(`- **${f.name}** (${f.source}) — ${(f.percentage * 100).toFixed(0)}% (${f.count}/${f.total})`);
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
if (result.cardinality_changes.length > 0) {
|
|
@@ -23,7 +23,7 @@ export function registerSchemaInferTool(api, client) {
|
|
|
23
23
|
try {
|
|
24
24
|
const result = await client.schemaInfer(params.noteType, params.threshold, params.project);
|
|
25
25
|
const lines = [
|
|
26
|
-
`**Type:** ${result.
|
|
26
|
+
`**Type:** ${result.note_type}`,
|
|
27
27
|
`**Notes analyzed:** ${result.notes_analyzed}`,
|
|
28
28
|
];
|
|
29
29
|
if (result.suggested_required.length > 0) {
|
|
@@ -31,15 +31,16 @@ export function registerSchemaValidateTool(api, client) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
const lines = [];
|
|
34
|
-
if (result.
|
|
35
|
-
lines.push(`**Type:** ${result.
|
|
34
|
+
if (result.note_type) {
|
|
35
|
+
lines.push(`**Type:** ${result.note_type}`);
|
|
36
36
|
}
|
|
37
37
|
lines.push(`**Notes:** ${result.total_notes ?? 0} | **Valid:** ${result.valid_count ?? 0} | **Warnings:** ${result.warning_count ?? 0} | **Errors:** ${result.error_count ?? 0}`);
|
|
38
38
|
if (result.results && result.results.length > 0) {
|
|
39
39
|
lines.push("");
|
|
40
40
|
for (const r of result.results) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
// passed is true when there are no errors; warnings still pass.
|
|
42
|
+
const status = r.passed ? "valid" : "invalid";
|
|
43
|
+
lines.push(`- **${r.note_identifier}** — ${status}`);
|
|
43
44
|
for (const w of r.warnings) {
|
|
44
45
|
lines.push(` - warning: ${w}`);
|
|
45
46
|
}
|
package/index.ts
CHANGED
|
@@ -56,11 +56,9 @@ async function installBasicMemoryIfMissing(bmBin: string): Promise<void> {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
log.info("installing basic-memory via uv (this may take a minute)...")
|
|
59
|
-
// basic-memory pins a FastMCP pre-release; without this flag uv silently
|
|
60
|
-
// installs the last release that had none (#1338).
|
|
61
59
|
const { stdout } = await execFileAsync(
|
|
62
60
|
"uv",
|
|
63
|
-
["tool", "install", "basic-memory", "--
|
|
61
|
+
["tool", "install", "basic-memory", "--force"],
|
|
64
62
|
{ encoding: "utf-8", timeout: 120_000 },
|
|
65
63
|
)
|
|
66
64
|
log.info(`basic-memory installed: ${stdout.trim().split("\n").pop()}`)
|
|
@@ -166,6 +164,7 @@ export default definePluginEntry({
|
|
|
166
164
|
.start({
|
|
167
165
|
cwd: workspace,
|
|
168
166
|
projectPath,
|
|
167
|
+
adoptExistingProject: !cfg.projectPathConfigured,
|
|
169
168
|
prepare: () => installBasicMemoryIfMissing(cfg.bmPath || "bm"),
|
|
170
169
|
})
|
|
171
170
|
.then(async () => {
|
|
@@ -170,7 +170,6 @@ export function openBasicMemoryReader(
|
|
|
170
170
|
// any note content, so it is safe for status-only callers.
|
|
171
171
|
try {
|
|
172
172
|
await guarded(() => client.listProjects())
|
|
173
|
-
return { status: "ready" }
|
|
174
173
|
} catch (err) {
|
|
175
174
|
log.warn(
|
|
176
175
|
`memory health check failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
@@ -180,6 +179,13 @@ export function openBasicMemoryReader(
|
|
|
180
179
|
message: "Basic Memory is not reachable",
|
|
181
180
|
}
|
|
182
181
|
}
|
|
182
|
+
// Listing works even when BM refused the plugin's project, so the
|
|
183
|
+
// refusal is checked separately; every search and read would fail.
|
|
184
|
+
const projectProblem = client.projectUnavailableReason()
|
|
185
|
+
if (projectProblem) {
|
|
186
|
+
return { status: "unavailable", message: projectProblem }
|
|
187
|
+
}
|
|
188
|
+
return { status: "ready" }
|
|
183
189
|
},
|
|
184
190
|
|
|
185
191
|
// In the gateway the BM MCP session is shared by the whole plugin and
|
package/openclaw.plugin.json
CHANGED
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"skills/memory-metadata-search",
|
|
27
27
|
"skills/memory-notes",
|
|
28
28
|
"skills/memory-okf",
|
|
29
|
-
"skills/memory-onboarding",
|
|
30
29
|
"skills/memory-reflect",
|
|
31
30
|
"skills/memory-research",
|
|
32
31
|
"skills/memory-schema",
|
|
32
|
+
"skills/memory-start",
|
|
33
33
|
"skills/memory-tasks"
|
|
34
34
|
],
|
|
35
35
|
"uiHints": {
|
package/package.json
CHANGED
package/scripts/setup-bm.sh
CHANGED
|
@@ -16,17 +16,14 @@ if ! command -v uv >/dev/null 2>&1; then
|
|
|
16
16
|
fi
|
|
17
17
|
|
|
18
18
|
# ── install basic-memory ────────────────────────────────
|
|
19
|
-
# basic-memory pins a FastMCP pre-release; without --prerelease=allow uv
|
|
20
|
-
# silently installs the last release that had none (#1338).
|
|
21
19
|
if [[ -n "${BM_REF}" ]]; then
|
|
22
20
|
echo "Installing basic-memory from ${BM_REPO}@${BM_REF} ..."
|
|
23
21
|
uv tool install \
|
|
24
22
|
"basic-memory @ git+${BM_REPO}@${BM_REF}" \
|
|
25
|
-
--prerelease=allow \
|
|
26
23
|
--force
|
|
27
24
|
else
|
|
28
25
|
echo "Installing latest basic-memory from PyPI ..."
|
|
29
|
-
uv tool install basic-memory --
|
|
26
|
+
uv tool install basic-memory --force
|
|
30
27
|
fi
|
|
31
28
|
|
|
32
29
|
# ── verify ────────────────────────────────────────────────────────
|
package/skills/manifest.json
CHANGED
|
@@ -64,11 +64,6 @@
|
|
|
64
64
|
"name": "memory-okf",
|
|
65
65
|
"description": "Make a Basic Memory project ready for OKF v0.2 export by finding and fixing what blocks it. Use when preparing a project for OKF export, publishing, or handoff, or checking an OKF bundle."
|
|
66
66
|
},
|
|
67
|
-
{
|
|
68
|
-
"dir": "memory-onboarding",
|
|
69
|
-
"name": "memory-onboarding",
|
|
70
|
-
"description": "Help a new user design a Basic Memory knowledge system and set up their assistant to load it. Use when someone is getting started, has an empty or messy project, or wants context kept across sessions."
|
|
71
|
-
},
|
|
72
67
|
{
|
|
73
68
|
"dir": "memory-quest",
|
|
74
69
|
"name": "memory-quest",
|
|
@@ -89,6 +84,11 @@
|
|
|
89
84
|
"name": "memory-schema",
|
|
90
85
|
"description": "Manage Basic Memory schemas: find unschemaed notes, infer and edit schemas, validate notes, detect drift. Use when structured note types (Task, Person, Meeting) need consistency across the graph."
|
|
91
86
|
},
|
|
87
|
+
{
|
|
88
|
+
"dir": "memory-start",
|
|
89
|
+
"name": "memory-start",
|
|
90
|
+
"description": "Help a new user's first Basic Memory session: save one short note, show it, and explain how to get it back. Use when getting started, or when a project is new, empty, or holds only starter notes."
|
|
91
|
+
},
|
|
92
92
|
{
|
|
93
93
|
"dir": "memory-tasks",
|
|
94
94
|
"name": "memory-tasks",
|
|
@@ -11,12 +11,12 @@ short-lived agent in Cloud that reads the target, works through the Basic Memory
|
|
|
11
11
|
tools, and changes notes as its instructions say.
|
|
12
12
|
|
|
13
13
|
Agents run in Basic Memory Cloud only, on plans that include them. A local
|
|
14
|
-
Basic Memory has no agent tools. Confirm the connected server exposes `
|
|
15
|
-
before starting this workflow.
|
|
14
|
+
Basic Memory has no agent tools. Confirm the connected server exposes the `bm_agent_*`
|
|
15
|
+
tools before starting this workflow.
|
|
16
16
|
|
|
17
17
|
## Project scope
|
|
18
18
|
|
|
19
|
-
If the project is unknown, discover it with `
|
|
19
|
+
If the project is unknown, discover it with `bm_project_list()`.
|
|
20
20
|
Pass a nonempty `project` on every note, folder, context and schema call, even
|
|
21
21
|
with one project or a qualified `memory://` URL. Use the chosen project's name,
|
|
22
22
|
`workspace/project`, or external ID; `<project>` below is a placeholder for it.
|
|
@@ -36,11 +36,11 @@ returned paths, paginating, or recovering from a refusal.
|
|
|
36
36
|
|
|
37
37
|
| Tool | Does |
|
|
38
38
|
|---|---|
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
39
|
+
| `bm_agent_list(project="<project>")` | The project's agents and how their recent runs went; with `agent`, whether that agent can run |
|
|
40
|
+
| `bm_agent_run(agent="<agent>", project="<project>")` | Starts an agent on a note (`identifier`), a folder, or nothing; returns the run id |
|
|
41
|
+
| `bm_agent_get(run_id="<run id>")` | One run: status, notes changed, and the agent's last reply; `changes=True` shows the diffs |
|
|
42
|
+
| `bm_agent_runs(project="<project>")` | Recent runs, newest first, optionally for one agent; `whole_workspace=True` lists every run waiting for review |
|
|
43
|
+
| `bm_agent_mark(decision="kept", run_id="<run id>")` | Mark a run `kept` or `dismissed`; with no `run_id`, `kept` keeps every waiting run |
|
|
44
44
|
|
|
45
45
|
Create and edit agents with `bm_write` and `bm_edit`. There is no separate
|
|
46
46
|
agent tool for that.
|
|
@@ -125,10 +125,10 @@ Point the user to these before writing an agent from scratch.
|
|
|
125
125
|
## Run an Agent
|
|
126
126
|
|
|
127
127
|
```python
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
bm_agent_list(project="work")
|
|
129
|
+
bm_agent_run(agent="Curator", identifier="projects/Launch", project="work")
|
|
130
130
|
# -> run id. Runs usually take one to a few minutes.
|
|
131
|
-
|
|
131
|
+
bm_agent_get(run_id="<run id>", project="work")
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
An agent changes the user's notes. Ask before running one, unless the user has
|
|
@@ -141,7 +141,7 @@ on the version the person ended with. Notes written by agents, imports, or
|
|
|
141
141
|
|
|
142
142
|
## Check a Run
|
|
143
143
|
|
|
144
|
-
`
|
|
144
|
+
`bm_agent_get(run_id="<run id>", project="<project>")` shows the status, the notes the run created, edited, moved, or
|
|
145
145
|
deleted, and the agent's last reply. Every reply is also kept in a run log note, `agents/runs/<agent> run <id>`. Read it for the whole
|
|
146
146
|
conversation; do not edit it.
|
|
147
147
|
|
|
@@ -9,7 +9,7 @@ Capture the gist of a working thread — the decisions made, insights surfaced,
|
|
|
9
9
|
|
|
10
10
|
## Project scope
|
|
11
11
|
|
|
12
|
-
If the project is unknown, discover it with `
|
|
12
|
+
If the project is unknown, discover it with `bm_project_list()`.
|
|
13
13
|
Pass a nonempty `project` on every note, folder, context and schema call, even
|
|
14
14
|
with one project or a qualified `memory://` URL. Use the chosen project's name,
|
|
15
15
|
`workspace/project`, or external ID; `<project>` below is a placeholder for it.
|
|
@@ -21,7 +21,7 @@ component you have not used before.
|
|
|
21
21
|
|
|
22
22
|
## Project scope
|
|
23
23
|
|
|
24
|
-
If the project is unknown, discover it with `
|
|
24
|
+
If the project is unknown, discover it with `bm_project_list()`.
|
|
25
25
|
Pass a nonempty `project` on every note, folder, context and schema call, even
|
|
26
26
|
with one project or a qualified `memory://` URL. Use the chosen project's name,
|
|
27
27
|
`workspace/project`, or external ID; `<project>` below is a placeholder for it.
|
|
@@ -9,7 +9,7 @@ Resume previous work by reconstructing context from the Basic Memory knowledge g
|
|
|
9
9
|
|
|
10
10
|
## Project scope
|
|
11
11
|
|
|
12
|
-
If the project is unknown, discover it with `
|
|
12
|
+
If the project is unknown, discover it with `bm_project_list()`.
|
|
13
13
|
Pass a nonempty `project` on every note, folder, context and schema call, even
|
|
14
14
|
with one project or a qualified `memory://` URL. Use the chosen project's name,
|
|
15
15
|
`workspace/project`, or external ID; `<project>` below is a placeholder for it.
|
|
@@ -48,10 +48,10 @@ bm_context(
|
|
|
48
48
|
)
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
**No clear starting point — use `
|
|
51
|
+
**No clear starting point — use `bm_recent(project="<project>")`.** See what's changed and let it surface the thread:
|
|
52
52
|
|
|
53
53
|
```python
|
|
54
|
-
|
|
54
|
+
bm_recent(since="3d", project="<project>")
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
**Looking for something specific — use `bm_search`.** Find candidate notes by keyword:
|
|
@@ -101,7 +101,7 @@ Use a specific note URL to anchor on one starting point; use a wildcard to pull
|
|
|
101
101
|
|
|
102
102
|
## Timeframe Reference
|
|
103
103
|
|
|
104
|
-
`bm_context` and `
|
|
104
|
+
`bm_context` and `bm_recent(project="<project>")` accept natural-language timeframes:
|
|
105
105
|
|
|
106
106
|
| Timeframe | Meaning |
|
|
107
107
|
|-----------|---------|
|
|
@@ -130,7 +130,7 @@ Then summarize: the goals, what's completed, what's pending, and any blockers or
|
|
|
130
130
|
|
|
131
131
|
```python
|
|
132
132
|
# 1. Check recent activity
|
|
133
|
-
|
|
133
|
+
bm_recent(since="3d", project="<project>")
|
|
134
134
|
|
|
135
135
|
# 2. Read notes from the recent sessions it surfaces
|
|
136
136
|
bm_read(identifier="relevant-note", project="<project>")
|
|
@@ -155,7 +155,7 @@ Then present the full picture — the note plus its connected context.
|
|
|
155
155
|
Project names are user-specific. To discover what's available before scoping a search or `memory://` URL:
|
|
156
156
|
|
|
157
157
|
```python
|
|
158
|
-
|
|
158
|
+
bm_project_list()
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
A qualified `memory://` URL (e.g. `memory://research/papers/crdt`) must agree
|
|
@@ -170,9 +170,9 @@ bm_search(query="topic keywords", all_projects=True)
|
|
|
170
170
|
|
|
171
171
|
## Guidelines
|
|
172
172
|
|
|
173
|
-
1. **Start broad, then narrow.** Get an overview with `
|
|
173
|
+
1. **Start broad, then narrow.** Get an overview with `bm_recent(project="<project>")` or a wildcard `bm_context`, then drill into specific notes.
|
|
174
174
|
2. **Present incrementally.** Share what you find as you go rather than holding everything until the end.
|
|
175
175
|
3. **Follow relations.** The graph's connections are the point — `bm_context` with `depth` surfaces context you wouldn't find by reading one note.
|
|
176
|
-
4. **Check multiple projects.** Specs may live separately from implementation notes; discover projects with `
|
|
176
|
+
4. **Check multiple projects.** Specs may live separately from implementation notes; discover projects with `bm_project_list()`.
|
|
177
177
|
5. **Confirm understanding.** Verify the reconstructed context is what the user actually needs before acting on it.
|
|
178
178
|
6. **Capture new progress.** As the resumed work advances, write it back to the graph (see the **memory-notes** skill) so the next session can continue too.
|