Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ import { analyzeIntent, applyCategoryBoost } from "./src/intent-analyzer.js";

interface PluginConfig {
embedding: {
provider: "openai-compatible";
provider: "openai-compatible" | "azure-openai" | "dashscope";
apiKey: string | string[];
model?: string;
baseURL?: string;
dimensions?: number;
timeoutMs?: number;
omitDimensions?: boolean;
taskQuery?: string;
taskPassage?: string;
normalized?: boolean;
chunking?: boolean;
enableFusion?: boolean;
};
dbPath?: string;
autoCapture?: boolean;
Expand Down Expand Up @@ -1659,16 +1661,18 @@ const memoryLanceDBProPlugin = {
// Initialize core components
const store = new MemoryStore({ dbPath: resolvedDbPath, vectorDim });
const embedder = createEmbedder({
provider: "openai-compatible",
provider: config.embedding.provider,
apiKey: config.embedding.apiKey,
model: config.embedding.model || "text-embedding-3-small",
baseURL: config.embedding.baseURL,
dimensions: config.embedding.dimensions,
timeoutMs: config.embedding.timeoutMs,
omitDimensions: config.embedding.omitDimensions,
taskQuery: config.embedding.taskQuery,
taskPassage: config.embedding.taskPassage,
normalized: config.embedding.normalized,
chunking: config.embedding.chunking,
enableFusion: config.embedding.enableFusion,
});
// Initialize decay engine
const decayEngine = createDecayEngine({
Expand Down Expand Up @@ -2014,7 +2018,7 @@ const memoryLanceDBProPlugin = {

// Dual-memory model warning: help users understand the two-layer architecture
// Runs synchronously and logs warnings; does NOT block gateway startup.
api.logger.info(
logReg(
`[memory-lancedb-pro] memory_recall queries the plugin store (LanceDB), not MEMORY.md.\n` +
` - Plugin memory (LanceDB) = primary recall source for semantic search\n` +
` - MEMORY.md / memory/YYYY-MM-DD.md = startup context / journal only\n` +
Expand Down Expand Up @@ -3658,9 +3662,14 @@ const memoryLanceDBProPlugin = {
// Service Registration
// ========================================================================

api.registerService({
id: "memory-lancedb-pro",
start: async () => {
if (isCliMode()) {
api.logger.debug(
"memory-lancedb-pro: skipping background service registration in CLI mode",
);
} else {
api.registerService({
id: "memory-lancedb-pro",
start: async () => {
// IMPORTANT: Do not block gateway startup on external network calls.
// If embedding/retrieval tests hang (bad network / slow provider), the gateway
// may never bind its HTTP port, causing restart timeouts.
Expand Down Expand Up @@ -3749,15 +3758,16 @@ const memoryLanceDBProPlugin = {
// Run initial backup after a short delay, then schedule daily
setTimeout(() => void runBackup(), 60_000); // 1 min after start
backupTimer = setInterval(() => void runBackup(), BACKUP_INTERVAL_MS);
},
stop: async () => {
if (backupTimer) {
clearInterval(backupTimer);
backupTimer = null;
}
api.logger.info("memory-lancedb-pro: stopped");
},
});
},
stop: async () => {
if (backupTimer) {
clearInterval(backupTimer);
backupTimer = null;
}
api.logger.info("memory-lancedb-pro: stopped");
},
});
}
},
};

Expand Down Expand Up @@ -3832,7 +3842,10 @@ export function parsePluginConfig(value: unknown): PluginConfig {

return {
embedding: {
provider: "openai-compatible",
provider:
embedding.provider === "azure-openai" || embedding.provider === "dashscope"
? embedding.provider
: "openai-compatible",
apiKey,
model:
typeof embedding.model === "string"
Expand Down Expand Up @@ -3865,6 +3878,10 @@ export function parsePluginConfig(value: unknown): PluginConfig {
typeof embedding.chunking === "boolean"
? embedding.chunking
: undefined,
enableFusion:
typeof embedding.enableFusion === "boolean"
? embedding.enableFusion
: undefined,
},
dbPath: typeof cfg.dbPath === "string" ? cfg.dbPath : undefined,
autoCapture: cfg.autoCapture !== false,
Expand Down
96 changes: 82 additions & 14 deletions openclaw.plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "Enhanced LanceDB-backed long-term memory with hybrid retrieval, multi-scope isolation, long-context chunking, and management CLI",
"version": "1.1.0-beta.10",
"kind": "memory",
"skills": ["./skills"],
"skills": [
"./skills"
],
"configSchema": {
"type": "object",
"additionalProperties": false,
Expand All @@ -17,7 +19,8 @@
"type": "string",
"enum": [
"openai-compatible",
"azure-openai"
"azure-openai",
"dashscope"
]
},
"apiKey": {
Expand Down Expand Up @@ -71,6 +74,11 @@
"apiVersion": {
"type": "string",
"description": "API version for Azure OpenAI (e.g. 2024-02-01). Only used when provider is azure-openai."
},
"enableFusion": {
"type": "boolean",
"default": true,
"description": "DashScope multimodal embedding option. When true, each single input call returns one fused vector."
}
},
"required": [
Expand Down Expand Up @@ -161,7 +169,12 @@
},
"recallMode": {
"type": "string",
"enum": ["full", "summary", "adaptive", "off"],
"enum": [
"full",
"summary",
"adaptive",
"off"
],
"default": "full",
"description": "Auto-recall depth mode. 'full': inject with configured per-item budget. 'summary': L0 abstracts only (compact). 'adaptive': analyze query intent to auto-select category and depth. 'off': disable auto-recall injection."
},
Expand Down Expand Up @@ -260,23 +273,78 @@
"type": "object",
"additionalProperties": false,
"properties": {
"utility": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
"confidence": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
"novelty": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
"recency": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
"typePrior": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.6 }
"utility": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.1
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.1
},
"novelty": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.1
},
"recency": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.1
},
"typePrior": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.6
}
}
},
"typePriors": {
"type": "object",
"additionalProperties": false,
"properties": {
"profile": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.95 },
"preferences": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.9 },
"entities": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.75 },
"events": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.45 },
"cases": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.8 },
"patterns": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.85 }
"profile": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.95
},
"preferences": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.9
},
"entities": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.75
},
"events": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.45
},
"cases": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.8
},
"patterns": {
"type": "number",
"minimum": 0,
"maximum": 1,
"default": 0.85
}
}
}
}
Expand Down
27 changes: 25 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
"version": "node scripts/sync-plugin-version.mjs openclaw.plugin.json package.json && git add openclaw.plugin.json"
},
"optionalDependencies": {
"@lancedb/lancedb-darwin-x64": "^0.26.2",
"@lancedb/lancedb-darwin-arm64": "^0.26.2",
"@lancedb/lancedb-linux-x64-gnu": "^0.26.2",
"@lancedb/lancedb-darwin-x64": "0.22.3",
"@lancedb/lancedb-linux-arm64-gnu": "^0.26.2",
"@lancedb/lancedb-linux-x64-gnu": "^0.26.2",
"@lancedb/lancedb-win32-x64-msvc": "^0.26.2"
},
"devDependencies": {
Expand Down
Loading