@memclaw/plugin 0.9.1 → 0.9.3
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/dist/index.d.ts +100 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-impl.d.ts +40 -0
- package/dist/plugin-impl.d.ts.map +1 -0
- package/dist/plugin-impl.js +445 -0
- package/dist/plugin-impl.js.map +1 -0
- package/dist/src/binaries.d.ts +29 -0
- package/dist/src/binaries.d.ts.map +1 -0
- package/dist/src/binaries.js +292 -0
- package/dist/src/binaries.js.map +1 -0
- package/dist/src/client.d.ts +88 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +131 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/config.d.ts +50 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +257 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/migrate.d.ts +26 -0
- package/dist/src/migrate.d.ts.map +1 -0
- package/dist/src/migrate.js +287 -0
- package/dist/src/migrate.js.map +1 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/skill/SKILL.md +21 -3
- package/skill/references/setup.md +199 -54
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemClaw - Layered Semantic Memory for OpenClaw
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - L0/L1/L2 tiered memory retrieval
|
|
6
|
+
* - Automatic service startup (Qdrant + cortex-mem-service)
|
|
7
|
+
* - Migration from OpenClaw native memory
|
|
8
|
+
*
|
|
9
|
+
* Installation:
|
|
10
|
+
* openclaw plugins install memclaw
|
|
11
|
+
*
|
|
12
|
+
* Configuration (in openclaw.json):
|
|
13
|
+
* {
|
|
14
|
+
* "plugins": {
|
|
15
|
+
* "entries": {
|
|
16
|
+
* "memclaw": {
|
|
17
|
+
* "enabled": true,
|
|
18
|
+
* "config": {
|
|
19
|
+
* "serviceUrl": "http://127.0.0.1:8085",
|
|
20
|
+
* "tenantId": "tenant_claw",
|
|
21
|
+
* "autoStartServices": true
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
export type { CortexMemClient } from './src/client.js';
|
|
29
|
+
export type { MemClawConfig } from './src/config.js';
|
|
30
|
+
interface PluginLogger {
|
|
31
|
+
debug?: (msg: string, ...args: unknown[]) => void;
|
|
32
|
+
info: (msg: string, ...args: unknown[]) => void;
|
|
33
|
+
warn: (msg: string, ...args: unknown[]) => void;
|
|
34
|
+
error: (msg: string, ...args: unknown[]) => void;
|
|
35
|
+
}
|
|
36
|
+
interface ToolDefinition {
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
parameters: object;
|
|
40
|
+
execute: (_id: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
41
|
+
optional?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface PluginAPI {
|
|
44
|
+
pluginConfig?: Record<string, unknown>;
|
|
45
|
+
registerTool(tool: ToolDefinition, opts?: {
|
|
46
|
+
optional?: boolean;
|
|
47
|
+
}): void;
|
|
48
|
+
registerService(service: {
|
|
49
|
+
id: string;
|
|
50
|
+
start: () => Promise<void>;
|
|
51
|
+
stop: () => Promise<void>;
|
|
52
|
+
}): void;
|
|
53
|
+
logger: PluginLogger;
|
|
54
|
+
}
|
|
55
|
+
export default function memclawPlugin(api: PluginAPI): {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
version: string;
|
|
59
|
+
};
|
|
60
|
+
export declare const plugin: {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
version: string;
|
|
64
|
+
configSchema: {
|
|
65
|
+
type: string;
|
|
66
|
+
properties: {
|
|
67
|
+
serviceUrl: {
|
|
68
|
+
type: string;
|
|
69
|
+
default: string;
|
|
70
|
+
};
|
|
71
|
+
defaultSessionId: {
|
|
72
|
+
type: string;
|
|
73
|
+
default: string;
|
|
74
|
+
};
|
|
75
|
+
searchLimit: {
|
|
76
|
+
type: string;
|
|
77
|
+
default: number;
|
|
78
|
+
};
|
|
79
|
+
minScore: {
|
|
80
|
+
type: string;
|
|
81
|
+
default: number;
|
|
82
|
+
};
|
|
83
|
+
tenantId: {
|
|
84
|
+
type: string;
|
|
85
|
+
default: string;
|
|
86
|
+
};
|
|
87
|
+
autoStartServices: {
|
|
88
|
+
type: string;
|
|
89
|
+
default: boolean;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
required: never[];
|
|
93
|
+
};
|
|
94
|
+
register(api: PluginAPI): {
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
version: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,UAAU,YAAY;IACrB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACjD;AAED,UAAU,cAAc;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,SAAS;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,eAAe,CAAC,OAAO,EAAE;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC1B,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,YAAY,CAAC;CACrB;AAGD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,GAAG,EAAE,SAAS;;;;EAEnD;AAGD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgBJ,SAAS;;;;;CAGvB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MemClaw - Layered Semantic Memory for OpenClaw
|
|
4
|
+
*
|
|
5
|
+
* Provides:
|
|
6
|
+
* - L0/L1/L2 tiered memory retrieval
|
|
7
|
+
* - Automatic service startup (Qdrant + cortex-mem-service)
|
|
8
|
+
* - Migration from OpenClaw native memory
|
|
9
|
+
*
|
|
10
|
+
* Installation:
|
|
11
|
+
* openclaw plugins install memclaw
|
|
12
|
+
*
|
|
13
|
+
* Configuration (in openclaw.json):
|
|
14
|
+
* {
|
|
15
|
+
* "plugins": {
|
|
16
|
+
* "entries": {
|
|
17
|
+
* "memclaw": {
|
|
18
|
+
* "enabled": true,
|
|
19
|
+
* "config": {
|
|
20
|
+
* "serviceUrl": "http://127.0.0.1:8085",
|
|
21
|
+
* "tenantId": "tenant_claw",
|
|
22
|
+
* "autoStartServices": true
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.plugin = void 0;
|
|
31
|
+
exports.default = memclawPlugin;
|
|
32
|
+
const plugin_impl_js_1 = require("./plugin-impl.js");
|
|
33
|
+
// Default export - main plugin function
|
|
34
|
+
function memclawPlugin(api) {
|
|
35
|
+
return (0, plugin_impl_js_1.createPlugin)(api);
|
|
36
|
+
}
|
|
37
|
+
// Named export - object style registration
|
|
38
|
+
exports.plugin = {
|
|
39
|
+
id: 'memclaw',
|
|
40
|
+
name: 'MemClaw',
|
|
41
|
+
version: '0.9.3',
|
|
42
|
+
configSchema: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
properties: {
|
|
45
|
+
serviceUrl: { type: 'string', default: 'http://localhost:8085' },
|
|
46
|
+
defaultSessionId: { type: 'string', default: 'default' },
|
|
47
|
+
searchLimit: { type: 'integer', default: 10 },
|
|
48
|
+
minScore: { type: 'number', default: 0.6 },
|
|
49
|
+
tenantId: { type: 'string', default: 'tenant_claw' },
|
|
50
|
+
autoStartServices: { type: 'boolean', default: true }
|
|
51
|
+
},
|
|
52
|
+
required: []
|
|
53
|
+
},
|
|
54
|
+
register(api) {
|
|
55
|
+
return (0, plugin_impl_js_1.createPlugin)(api);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAoCH,gCAEC;AApCD,qDAAgD;AAiChD,wCAAwC;AACxC,SAAwB,aAAa,CAAC,GAAc;IACnD,OAAO,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,2CAA2C;AAC9B,QAAA,MAAM,GAAG;IACrB,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACX,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,uBAAuB,EAAE;YAChE,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE;YACxD,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;YAC7C,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;YAC1C,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE;YACpD,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;SACrD;QACD,QAAQ,EAAE,EAAE;KACZ;IACD,QAAQ,CAAC,GAAc;QACtB,OAAO,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemClaw Plugin Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides layered semantic memory for OpenClaw with:
|
|
5
|
+
* - Automatic service startup
|
|
6
|
+
* - Memory tools (search, recall, add, list, close)
|
|
7
|
+
* - Migration from OpenClaw native memory
|
|
8
|
+
*/
|
|
9
|
+
interface PluginLogger {
|
|
10
|
+
debug?: (msg: string, ...args: unknown[]) => void;
|
|
11
|
+
info: (msg: string, ...args: unknown[]) => void;
|
|
12
|
+
warn: (msg: string, ...args: unknown[]) => void;
|
|
13
|
+
error: (msg: string, ...args: unknown[]) => void;
|
|
14
|
+
}
|
|
15
|
+
interface ToolDefinition {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
parameters: object;
|
|
19
|
+
execute: (_id: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
20
|
+
optional?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface PluginAPI {
|
|
23
|
+
pluginConfig?: Record<string, unknown>;
|
|
24
|
+
registerTool(tool: ToolDefinition, opts?: {
|
|
25
|
+
optional?: boolean;
|
|
26
|
+
}): void;
|
|
27
|
+
registerService(service: {
|
|
28
|
+
id: string;
|
|
29
|
+
start: () => Promise<void>;
|
|
30
|
+
stop: () => Promise<void>;
|
|
31
|
+
}): void;
|
|
32
|
+
logger: PluginLogger;
|
|
33
|
+
}
|
|
34
|
+
export declare function createPlugin(api: PluginAPI): {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
version: string;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=plugin-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-impl.d.ts","sourceRoot":"","sources":["../plugin-impl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8BH,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CAClD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,SAAS;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,eAAe,CAAC,OAAO,EAAE;QACvB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC3B,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,YAAY,CAAC;CACtB;AAuJD,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS;;;;EAiW1C"}
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MemClaw Plugin Implementation
|
|
4
|
+
*
|
|
5
|
+
* Provides layered semantic memory for OpenClaw with:
|
|
6
|
+
* - Automatic service startup
|
|
7
|
+
* - Memory tools (search, recall, add, list, close)
|
|
8
|
+
* - Migration from OpenClaw native memory
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.createPlugin = createPlugin;
|
|
12
|
+
const client_js_1 = require("./src/client.js");
|
|
13
|
+
const config_js_1 = require("./src/config.js");
|
|
14
|
+
const binaries_js_1 = require("./src/binaries.js");
|
|
15
|
+
const migrate_js_1 = require("./src/migrate.js");
|
|
16
|
+
// Tool schemas
|
|
17
|
+
const toolSchemas = {
|
|
18
|
+
cortex_search: {
|
|
19
|
+
name: "cortex_search",
|
|
20
|
+
description: `Layered semantic search across memory using L0/L1/L2 tiered retrieval.
|
|
21
|
+
Returns relevant memories ranked by relevance score.
|
|
22
|
+
|
|
23
|
+
Use this tool when you need to:
|
|
24
|
+
- Find past conversations or decisions
|
|
25
|
+
- Search for specific information across all sessions
|
|
26
|
+
- Discover related memories by semantic similarity`,
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
query: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "The search query - can be natural language or keywords",
|
|
33
|
+
},
|
|
34
|
+
scope: {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Optional session/thread ID to limit search scope",
|
|
37
|
+
},
|
|
38
|
+
limit: {
|
|
39
|
+
type: "integer",
|
|
40
|
+
description: "Maximum number of results to return (default: 10)",
|
|
41
|
+
default: 10,
|
|
42
|
+
},
|
|
43
|
+
min_score: {
|
|
44
|
+
type: "number",
|
|
45
|
+
description: "Minimum relevance score threshold (0-1, default: 0.6)",
|
|
46
|
+
default: 0.6,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
required: ["query"],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
cortex_recall: {
|
|
53
|
+
name: "cortex_recall",
|
|
54
|
+
description: `Recall memories using L0/L1/L2 tiered retrieval.
|
|
55
|
+
|
|
56
|
+
The search engine internally performs tiered retrieval:
|
|
57
|
+
- L0 (Abstract): Quick filtering by summary
|
|
58
|
+
- L1 (Overview): Context refinement
|
|
59
|
+
- L2 (Full): Precise matching with full content
|
|
60
|
+
|
|
61
|
+
Returns results with snippet (summary) and content (if available).
|
|
62
|
+
|
|
63
|
+
Use this when you need memories with more context than a simple search.`,
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
query: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "The search query",
|
|
70
|
+
},
|
|
71
|
+
scope: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Optional session/thread ID to limit search scope",
|
|
74
|
+
},
|
|
75
|
+
limit: {
|
|
76
|
+
type: "integer",
|
|
77
|
+
description: "Maximum number of results (default: 10)",
|
|
78
|
+
default: 10,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
required: ["query"],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
cortex_add_memory: {
|
|
85
|
+
name: "cortex_add_memory",
|
|
86
|
+
description: `Add a message to memory for a specific session.
|
|
87
|
+
This stores the message and automatically triggers:
|
|
88
|
+
- Vector embedding for semantic search
|
|
89
|
+
- L0/L1 layer generation (async)
|
|
90
|
+
|
|
91
|
+
Use this to persist important information that should be searchable later.`,
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
content: {
|
|
96
|
+
type: "string",
|
|
97
|
+
description: "The content to store in memory",
|
|
98
|
+
},
|
|
99
|
+
role: {
|
|
100
|
+
type: "string",
|
|
101
|
+
enum: ["user", "assistant", "system"],
|
|
102
|
+
description: "Role of the message sender (default: user)",
|
|
103
|
+
default: "user",
|
|
104
|
+
},
|
|
105
|
+
session_id: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "Session/thread ID (uses default if not specified)",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
required: ["content"],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
cortex_list_sessions: {
|
|
114
|
+
name: "cortex_list_sessions",
|
|
115
|
+
description: `List all memory sessions with their status.
|
|
116
|
+
Shows session IDs, message counts, and creation/update times.`,
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
cortex_close_session: {
|
|
123
|
+
name: "cortex_close_session",
|
|
124
|
+
description: `Close a memory session and trigger full memory extraction.
|
|
125
|
+
|
|
126
|
+
This triggers the complete memory processing pipeline:
|
|
127
|
+
1. Extracts structured memories (user preferences, entities, decisions)
|
|
128
|
+
2. Generates complete L0/L1 layer summaries
|
|
129
|
+
3. Indexes all extracted memories into the vector database
|
|
130
|
+
|
|
131
|
+
Note: This is a potentially long-running operation (may take 30-60s).`,
|
|
132
|
+
inputSchema: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
session_id: {
|
|
136
|
+
type: "string",
|
|
137
|
+
description: "Session/thread ID to close (uses default if not specified)",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
cortex_migrate: {
|
|
143
|
+
name: "cortex_migrate",
|
|
144
|
+
description: `Migrate memories from OpenClaw's native memory system to MemClaw.
|
|
145
|
+
|
|
146
|
+
This will:
|
|
147
|
+
1. Find your OpenClaw memory files (memory/*.md and MEMORY.md)
|
|
148
|
+
2. Convert them to MemClaw's L2 format
|
|
149
|
+
3. Generate L0/L1 layers and vector index
|
|
150
|
+
|
|
151
|
+
Use this once during initial setup to preserve your existing memories.`,
|
|
152
|
+
inputSchema: {
|
|
153
|
+
type: "object",
|
|
154
|
+
properties: {},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
function createPlugin(api) {
|
|
159
|
+
const config = (api.pluginConfig ?? {});
|
|
160
|
+
const serviceUrl = config.serviceUrl ?? "http://localhost:8085";
|
|
161
|
+
const defaultSessionId = config.defaultSessionId ?? "default";
|
|
162
|
+
const searchLimit = config.searchLimit ?? 10;
|
|
163
|
+
const minScore = config.minScore ?? 0.6;
|
|
164
|
+
const tenantId = config.tenantId ?? "tenant_claw";
|
|
165
|
+
const autoStartServices = config.autoStartServices ?? true;
|
|
166
|
+
const client = new client_js_1.CortexMemClient(serviceUrl);
|
|
167
|
+
let servicesStarted = false;
|
|
168
|
+
const log = (msg) => api.logger.info(`[memclaw] ${msg}`);
|
|
169
|
+
log("Initializing MemClaw plugin...");
|
|
170
|
+
// Ensure config file exists
|
|
171
|
+
const { created, path: configPath } = (0, config_js_1.ensureConfigExists)();
|
|
172
|
+
if (created) {
|
|
173
|
+
log(`Created configuration file: ${configPath}`);
|
|
174
|
+
log("Opening configuration file for editing...");
|
|
175
|
+
(0, config_js_1.openConfigFile)(configPath).catch((err) => {
|
|
176
|
+
api.logger.warn(`Could not open config file: ${err}`);
|
|
177
|
+
api.logger.warn(`Please manually edit: ${configPath}`);
|
|
178
|
+
});
|
|
179
|
+
api.logger.info(`
|
|
180
|
+
╔══════════════════════════════════════════════════════════╗
|
|
181
|
+
║ MemClaw First Run ║
|
|
182
|
+
║ ║
|
|
183
|
+
║ A configuration file has been created: ║
|
|
184
|
+
║ ${configPath.padEnd(52)}║
|
|
185
|
+
║ ║
|
|
186
|
+
║ Please fill in the required fields: ║
|
|
187
|
+
║ - llm.api_key (your LLM API key) ║
|
|
188
|
+
║ - embedding.api_key (your embedding API key) ║
|
|
189
|
+
║ ║
|
|
190
|
+
║ Save the file and restart OpenClaw to apply changes. ║
|
|
191
|
+
╚══════════════════════════════════════════════════════════╝
|
|
192
|
+
`);
|
|
193
|
+
}
|
|
194
|
+
// Register service lifecycle
|
|
195
|
+
api.registerService({
|
|
196
|
+
id: "memclaw",
|
|
197
|
+
start: async () => {
|
|
198
|
+
// Skip service startup if config was just created (first run)
|
|
199
|
+
// User needs to fill in API keys first
|
|
200
|
+
if (created) {
|
|
201
|
+
log("First run detected. Please complete configuration and restart OpenClaw.");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (!autoStartServices) {
|
|
205
|
+
log("Auto-start disabled, skipping service startup");
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
// Check if binaries are available
|
|
209
|
+
const hasQdrant = (0, binaries_js_1.isBinaryAvailable)("qdrant");
|
|
210
|
+
const hasService = (0, binaries_js_1.isBinaryAvailable)("cortex-mem-service");
|
|
211
|
+
if (!hasQdrant || !hasService) {
|
|
212
|
+
log("Some binaries are missing. Services may need manual setup.");
|
|
213
|
+
log(`Run 'memclaw setup' or check the admin skill for installation instructions.`);
|
|
214
|
+
}
|
|
215
|
+
// Validate config
|
|
216
|
+
const parsedConfig = (0, config_js_1.parseConfig)(configPath);
|
|
217
|
+
const validation = (0, config_js_1.validateConfig)(parsedConfig);
|
|
218
|
+
if (!validation.valid) {
|
|
219
|
+
api.logger.warn(`Configuration incomplete: ${validation.errors.join(", ")}`);
|
|
220
|
+
api.logger.warn(`Please edit: ${configPath}`);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
// Start services
|
|
224
|
+
try {
|
|
225
|
+
log("Starting services...");
|
|
226
|
+
await (0, binaries_js_1.ensureAllServices)(log);
|
|
227
|
+
servicesStarted = true;
|
|
228
|
+
// Switch tenant
|
|
229
|
+
await client.switchTenant(tenantId);
|
|
230
|
+
log(`Switched to tenant: ${tenantId}`);
|
|
231
|
+
log("MemClaw services started successfully");
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
api.logger.error(`Failed to start services: ${err}`);
|
|
235
|
+
api.logger.warn("Memory features may not work correctly");
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
stop: async () => {
|
|
239
|
+
log("Stopping MemClaw...");
|
|
240
|
+
servicesStarted = false;
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
// Helper to check if services are ready
|
|
244
|
+
const ensureServicesReady = async () => {
|
|
245
|
+
if (!servicesStarted) {
|
|
246
|
+
const status = await (0, binaries_js_1.checkServiceStatus)();
|
|
247
|
+
if (!status.cortexMemService) {
|
|
248
|
+
throw new Error("cortex-mem-service is not running. Please start the service first.");
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
// Register tools
|
|
253
|
+
// cortex_search
|
|
254
|
+
api.registerTool({
|
|
255
|
+
name: toolSchemas.cortex_search.name,
|
|
256
|
+
description: toolSchemas.cortex_search.description,
|
|
257
|
+
parameters: toolSchemas.cortex_search.inputSchema,
|
|
258
|
+
execute: async (_id, params) => {
|
|
259
|
+
const input = params;
|
|
260
|
+
try {
|
|
261
|
+
await ensureServicesReady();
|
|
262
|
+
const results = await client.search({
|
|
263
|
+
query: input.query,
|
|
264
|
+
thread: input.scope,
|
|
265
|
+
limit: input.limit ?? searchLimit,
|
|
266
|
+
min_score: input.min_score ?? minScore,
|
|
267
|
+
});
|
|
268
|
+
const formatted = results
|
|
269
|
+
.map((r, i) => `${i + 1}. [Score: ${r.score.toFixed(2)}] ${r.snippet}\n URI: ${r.uri}`)
|
|
270
|
+
.join("\n\n");
|
|
271
|
+
return {
|
|
272
|
+
content: `Found ${results.length} results for "${input.query}":\n\n${formatted}`,
|
|
273
|
+
results: results.map((r) => ({
|
|
274
|
+
uri: r.uri,
|
|
275
|
+
score: r.score,
|
|
276
|
+
snippet: r.snippet,
|
|
277
|
+
})),
|
|
278
|
+
total: results.length,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
283
|
+
api.logger.error(`cortex_search failed: ${message}`);
|
|
284
|
+
return { error: `Search failed: ${message}` };
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
// cortex_recall
|
|
289
|
+
api.registerTool({
|
|
290
|
+
name: toolSchemas.cortex_recall.name,
|
|
291
|
+
description: toolSchemas.cortex_recall.description,
|
|
292
|
+
parameters: toolSchemas.cortex_recall.inputSchema,
|
|
293
|
+
execute: async (_id, params) => {
|
|
294
|
+
const input = params;
|
|
295
|
+
try {
|
|
296
|
+
await ensureServicesReady();
|
|
297
|
+
const results = await client.recall(input.query, input.scope, input.limit ?? 10);
|
|
298
|
+
const formatted = results
|
|
299
|
+
.map((r, i) => {
|
|
300
|
+
let content = `${i + 1}. [Score: ${r.score.toFixed(2)}] URI: ${r.uri}\n`;
|
|
301
|
+
content += ` Snippet: ${r.snippet}\n`;
|
|
302
|
+
if (r.content) {
|
|
303
|
+
const preview = r.content.length > 300 ? r.content.substring(0, 300) + "..." : r.content;
|
|
304
|
+
content += ` Content: ${preview}\n`;
|
|
305
|
+
}
|
|
306
|
+
return content;
|
|
307
|
+
})
|
|
308
|
+
.join("\n");
|
|
309
|
+
return {
|
|
310
|
+
content: `Recalled ${results.length} memories:\n\n${formatted}`,
|
|
311
|
+
results,
|
|
312
|
+
total: results.length,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
317
|
+
api.logger.error(`cortex_recall failed: ${message}`);
|
|
318
|
+
return { error: `Recall failed: ${message}` };
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
// cortex_add_memory
|
|
323
|
+
api.registerTool({
|
|
324
|
+
name: toolSchemas.cortex_add_memory.name,
|
|
325
|
+
description: toolSchemas.cortex_add_memory.description,
|
|
326
|
+
parameters: toolSchemas.cortex_add_memory.inputSchema,
|
|
327
|
+
execute: async (_id, params) => {
|
|
328
|
+
const input = params;
|
|
329
|
+
try {
|
|
330
|
+
await ensureServicesReady();
|
|
331
|
+
const sessionId = input.session_id ?? defaultSessionId;
|
|
332
|
+
const result = await client.addMessage(sessionId, {
|
|
333
|
+
role: (input.role ?? "user"),
|
|
334
|
+
content: input.content,
|
|
335
|
+
});
|
|
336
|
+
return {
|
|
337
|
+
content: `Memory stored successfully in session "${sessionId}".\nResult: ${result}`,
|
|
338
|
+
success: true,
|
|
339
|
+
message_uri: result,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
344
|
+
api.logger.error(`cortex_add_memory failed: ${message}`);
|
|
345
|
+
return { error: `Failed to add memory: ${message}` };
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
// cortex_list_sessions
|
|
350
|
+
api.registerTool({
|
|
351
|
+
name: toolSchemas.cortex_list_sessions.name,
|
|
352
|
+
description: toolSchemas.cortex_list_sessions.description,
|
|
353
|
+
parameters: toolSchemas.cortex_list_sessions.inputSchema,
|
|
354
|
+
execute: async (_id, _params) => {
|
|
355
|
+
try {
|
|
356
|
+
await ensureServicesReady();
|
|
357
|
+
const sessions = await client.listSessions();
|
|
358
|
+
if (sessions.length === 0) {
|
|
359
|
+
return { content: "No sessions found." };
|
|
360
|
+
}
|
|
361
|
+
const formatted = sessions
|
|
362
|
+
.map((s, i) => {
|
|
363
|
+
const created = new Date(s.created_at).toLocaleDateString();
|
|
364
|
+
return `${i + 1}. ${s.thread_id} (${s.status}, ${s.message_count} messages, created ${created})`;
|
|
365
|
+
})
|
|
366
|
+
.join("\n");
|
|
367
|
+
return {
|
|
368
|
+
content: `Found ${sessions.length} sessions:\n\n${formatted}`,
|
|
369
|
+
sessions: sessions.map((s) => ({
|
|
370
|
+
thread_id: s.thread_id,
|
|
371
|
+
status: s.status,
|
|
372
|
+
message_count: s.message_count,
|
|
373
|
+
created_at: s.created_at,
|
|
374
|
+
})),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
catch (error) {
|
|
378
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
379
|
+
api.logger.error(`cortex_list_sessions failed: ${message}`);
|
|
380
|
+
return { error: `Failed to list sessions: ${message}` };
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
});
|
|
384
|
+
// cortex_close_session
|
|
385
|
+
api.registerTool({
|
|
386
|
+
name: toolSchemas.cortex_close_session.name,
|
|
387
|
+
description: toolSchemas.cortex_close_session.description,
|
|
388
|
+
parameters: toolSchemas.cortex_close_session.inputSchema,
|
|
389
|
+
execute: async (_id, params) => {
|
|
390
|
+
const input = params;
|
|
391
|
+
try {
|
|
392
|
+
await ensureServicesReady();
|
|
393
|
+
const sessionId = input.session_id ?? defaultSessionId;
|
|
394
|
+
const result = await client.closeSession(sessionId);
|
|
395
|
+
return {
|
|
396
|
+
content: `Session "${sessionId}" closed successfully.\nStatus: ${result.status}, Messages: ${result.message_count}\n\nMemory extraction pipeline triggered.`,
|
|
397
|
+
success: true,
|
|
398
|
+
session: {
|
|
399
|
+
thread_id: result.thread_id,
|
|
400
|
+
status: result.status,
|
|
401
|
+
message_count: result.message_count,
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
407
|
+
api.logger.error(`cortex_close_session failed: ${message}`);
|
|
408
|
+
return { error: `Failed to close session: ${message}` };
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
// cortex_migrate
|
|
413
|
+
api.registerTool({
|
|
414
|
+
name: toolSchemas.cortex_migrate.name,
|
|
415
|
+
description: toolSchemas.cortex_migrate.description,
|
|
416
|
+
parameters: toolSchemas.cortex_migrate.inputSchema,
|
|
417
|
+
execute: async (_id, _params) => {
|
|
418
|
+
try {
|
|
419
|
+
// Check if migration is possible
|
|
420
|
+
const { possible, reason } = (0, migrate_js_1.canMigrate)();
|
|
421
|
+
if (!possible) {
|
|
422
|
+
return { content: `Migration not possible: ${reason}` };
|
|
423
|
+
}
|
|
424
|
+
// Run migration
|
|
425
|
+
const result = await (0, migrate_js_1.migrateFromOpenClaw)((msg) => api.logger.info(`[migrate] ${msg}`));
|
|
426
|
+
return {
|
|
427
|
+
content: `Migration completed!\n- Daily logs migrated: ${result.dailyLogsMigrated}\n- MEMORY.md migrated: ${result.memoryMdMigrated}\n- Sessions created: ${result.sessionsCreated.length}\n${result.errors.length > 0 ? `- Errors: ${result.errors.length}` : ""}`,
|
|
428
|
+
result,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
catch (error) {
|
|
432
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
433
|
+
api.logger.error(`cortex_migrate failed: ${message}`);
|
|
434
|
+
return { error: `Migration failed: ${message}` };
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
});
|
|
438
|
+
log("MemClaw plugin initialized");
|
|
439
|
+
return {
|
|
440
|
+
id: "memclaw",
|
|
441
|
+
name: "MemClaw",
|
|
442
|
+
version: "0.1.0",
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
//# sourceMappingURL=plugin-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-impl.js","sourceRoot":"","sources":["../plugin-impl.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AA6MH,oCAiWC;AA5iBD,+CAAkD;AAClD,+CAMyB;AACzB,mDAI2B;AAC3B,iDAAmE;AAyCnE,eAAe;AACf,MAAM,WAAW,GAAG;IAClB,aAAa,EAAE;QACb,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE;;;;;;mDAMkC;QAC/C,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wDAAwD;iBACtE;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kDAAkD;iBAChE;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,mDAAmD;oBAChE,OAAO,EAAE,EAAE;iBACZ;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,uDAAuD;oBACpE,OAAO,EAAE,GAAG;iBACb;aACF;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB;KACF;IAED,aAAa,EAAE;QACb,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE;;;;;;;;;wEASuD;QACpE,WAAW,EAAE;YACX,IA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