Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
feat(openclaw-plugin 2.0): from memory plugin to context engine (#662)
Mingjian Quef93d10523bcd
diff --git a/examples/openclaw-memory-plugin/.gitignore b/examples/openclaw-plugin/.gitignoresimilarity index 100%rename from examples/openclaw-memory-plugin/.gitignorerename to examples/openclaw-plugin/.gitignorediff --git a/examples/openclaw-memory-plugin/INSTALL-AGENT.md b/examples/openclaw-plugin/INSTALL-AGENT.mdsimilarity index 86%rename from examples/openclaw-memory-plugin/INSTALL-AGENT.mdrename to examples/openclaw-plugin/INSTALL-AGENT.mdindex fec1d7c2c..7f89d4eed 100644--- a/examples/openclaw-memory-plugin/INSTALL-AGENT.md+++ b/examples/openclaw-plugin/INSTALL-AGENT.md@@ -16,7 +16,7 @@ ls -d ~/.openclaw* 2>/dev/nullIf multiple directories exist (e.g. `~/.openclaw`, `~/.openclaw-openclaw-second`), ask the user which instance to install to. Pass the chosen directory via `--workdir`:```bash-npx ./examples/openclaw-memory-plugin/setup-helper --workdir ~/.openclaw-openclaw-second+npx ./examples/openclaw-plugin/setup-helper --workdir ~/.openclaw-openclaw-second```If only `~/.openclaw` exists, proceed with the default.@@ -126,11 +126,11 @@ Wait for `Setup complete!`source ~/.openclaw/openviking.env && openclaw gateway```-- Pass: Output contains `memory-openviking: local server started`+- Pass: Output contains `openviking: local server started`- Fail with `port occupied`:The port is used by another process. Change port:```bash- openclaw config set plugins.entries.memory-openviking.config.port 1934+ openclaw config set plugins.entries.openviking.config.port 1934source ~/.openclaw/openviking.env && openclaw gateway```- Fail with `subprocess exited`: Check stderr for Python errors — usually wrong API Key or openviking not installed properly@@ -141,7 +141,7 @@ Verify:openclaw status```-Memory line should show `enabled (plugin memory-openviking)`.+ContextEngine line should show `enabled (plugin openviking)`.Tell user: "OpenViking memory is active. I'll automatically remember important facts from our conversations and recall them when relevant."@@ -193,12 +193,12 @@ Alternatively, configure manually (substitute user-provided values). If targetin```bashopenclaw config set plugins.enabled true --json-openclaw config set plugins.slots.memory memory-openviking-openclaw config set plugins.entries.memory-openviking.config.mode remote-openclaw config set plugins.entries.memory-openviking.config.baseUrl "<user's server URL>"-openclaw config set plugins.entries.memory-openviking.config.apiKey "<user's API Key>"-openclaw config set plugins.entries.memory-openviking.config.autoRecall true --json-openclaw config set plugins.entries.memory-openviking.config.autoCapture true --json+openclaw config set plugins.slots.contextEngine openviking+openclaw config set plugins.entries.openviking.config.mode remote+openclaw config set plugins.entries.openviking.config.baseUrl "<user's server URL>"+openclaw config set plugins.entries.openviking.config.apiKey "<user's API Key>"+openclaw config set plugins.entries.openviking.config.autoRecall true --json+openclaw config set plugins.entries.openviking.config.autoCapture true --json```If user has no API Key (server auth not enabled), skip the apiKey line.@@ -209,14 +209,14 @@ If user has no API Key (server auth not enabled), skip the apiKey line.openclaw gateway```-- Pass: Output contains `memory-openviking: initialized`+- Pass: Output contains `openviking: initialized`- Fail with connection error: Verify server is reachable — `curl <baseUrl>/health` should return `{"status":"ok"}````bashopenclaw status```-Memory line should show `enabled (plugin memory-openviking)`.+ContextEngine line should show `enabled (plugin openviking)`.Tell user: "OpenViking memory is connected to the remote server. I'll automatically remember important facts and recall them when relevant."@@ -241,7 +241,7 @@ Tell user: "OpenViking memory is connected to the remote server. I'll automatica| Error | Cause | Fix ||-------|-------|-----|-| `port occupied` | Port used by another process | Change port in config, e.g. `openclaw config set plugins.entries.memory-openviking.config.port 1934` |+| `port occupied` | Port used by another process | Change port in config, e.g. `openclaw config set plugins.entries.openviking.config.port 1934` || `extracted 0 memories` | Wrong API Key or model name | Check `api_key` and `model` in `~/.openviking/ov.conf` || `externally-managed-environment` | Python PEP 668 restriction | Install via venv || `ECONNREFUSED` | Remote server unreachable | Verify baseUrl and network connectivity |diff --git a/examples/openclaw-memory-plugin/INSTALL-ZH.md b/examples/openclaw-plugin/INSTALL-ZH.mdsimilarity index 87%rename from examples/openclaw-memory-plugin/INSTALL-ZH.mdrename to examples/openclaw-plugin/INSTALL-ZH.mdindex f1a52f270..b494faac1 100644--- a/examples/openclaw-memory-plugin/INSTALL-ZH.md+++ b/examples/openclaw-plugin/INSTALL-ZH.md@@ -48,13 +48,13 @@ ov-install --workdir ~/.openclaw-second### 方式 B:curl 一键安装(Linux / macOS)```bash-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash```非交互模式:```bash-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash -s -y+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -y```安装到指定 OpenClaw 实例:@@ -112,7 +112,7 @@ npm install -g openclaw-openviking-setup-helperov-install# 方式 B:curl 一键安装(Linux / macOS)-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash```安装助手会提示输入 Ark API Key 并自动生成配置文件。@@ -123,13 +123,13 @@ curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examplessource ~/.openclaw/openviking.env && openclaw gateway```-看到 `memory-openviking: local server started` 表示成功。+看到 `openviking: local server started` 表示成功。### Step 4: 验证```bashopenclaw status-# Memory 行应显示:enabled (plugin memory-openviking)+# Memory 行应显示:enabled (plugin openviking)```---@@ -160,13 +160,13 @@ openclaw status```bashopenclaw config set plugins.enabled true --json-openclaw config set plugins.slots.memory memory-openviking-openclaw config set plugins.entries.memory-openviking.config.mode remote-openclaw config set plugins.entries.memory-openviking.config.baseUrl "http://your-server:1933"-openclaw config set plugins.entries.memory-openviking.config.apiKey "your-api-key"-openclaw config set plugins.entries.memory-openviking.config.agentId "your-agent-id"-openclaw config set plugins.entries.memory-openviking.config.autoRecall true --json-openclaw config set plugins.entries.memory-openviking.config.autoCapture true --json+openclaw config set plugins.slots.contextEngine openviking+openclaw config set plugins.entries.openviking.config.mode remote+openclaw config set plugins.entries.openviking.config.baseUrl "http://your-server:1933"+openclaw config set plugins.entries.openviking.config.apiKey "your-api-key"+openclaw config set plugins.entries.openviking.config.agentId "your-agent-id"+openclaw config set plugins.entries.openviking.config.autoRecall true --json+openclaw config set plugins.entries.openviking.config.autoCapture true --json```</details>@@ -208,11 +208,11 @@ python -m openviking.console.bootstrap --host 0.0.0.0 --port 8020 --openviking-u即可开始体验 web console 🎉-你可以直接在web界面查询文件信息,验证OpenViking memory-plugin记忆写入是否生效;也可以可以在OpenClaw日志中验证memory-openviking是否读取记忆,验证方式:+你可以直接在web界面查询文件信息,验证OpenViking memory-plugin记忆写入是否生效;也可以可以在OpenClaw日志中验证openviking是否读取记忆,验证方式:```bash-grep -i inject /tmp/openclaw/openclaw-2026-03-13.log | awk -F'"' '{for(i=1;i<=NF;i++) if($i ~ /^[0-9]{2}:[0-9]{2}:[0-9]{2}/) {time=$i; break}} /injecting [0-9]+ memories/ {print time, "memory-openviking:", gensub(/.*(injecting [0-9]+ memories).*/, "\\1", "1")}'+grep -i inject /tmp/openclaw/openclaw-2026-03-13.log | awk -F'"' '{for(i=1;i<=NF;i++) if($i ~ /^[0-9]{2}:[0-9]{2}:[0-9]{2}/) {time=$i; break}} /injecting [0-9]+ memories/ {print time, "openviking:", gensub(/.*(injecting [0-9]+ memories).*/, "\\1", "1")}'```也可以直接运行grep "inject" /tmp/openclaw/openclaw-2026-03-13.log查看全部信息。@@ -262,7 +262,7 @@ grep -i inject /tmp/openclaw/openclaw-2026-03-13.log | awk -F'"' '{for(i=1;i<=NF```bash# 在插件配置中指定-openclaw config set plugins.entries.memory-openviking.config.agentId "my-agent"+openclaw config set plugins.entries.openviking.config.agentId "my-agent"```如果未配置,插件会自动生成一个随机唯一的 ID(格式:`openclaw-<hostname>-<random>`)。@@ -283,11 +283,15 @@ export OPENVIKING_PYTHON='/usr/local/bin/python3'# 启动source ~/.openclaw/openviking.env && openclaw gateway+# 检查当前 context-engine+openclaw status+openclaw config get plugins.slots.contextEngine+# 关闭记忆-openclaw config set plugins.slots.memory none+openclaw config set plugins.slots.contextEngine legacy# 开启记忆-openclaw config set plugins.slots.memory memory-openviking+openclaw config set plugins.slots.contextEngine openviking```---@@ -296,7 +300,7 @@ openclaw config set plugins.slots.memory memory-openviking| 症状 | 原因 | 修复 ||------|------|------|-| `port occupied` | 端口被其他进程占用 | 换端口:`openclaw config set plugins.entries.memory-openviking.config.port 1934` |+| `port occupied` | 端口被其他进程占用 | 换端口:`openclaw config set plugins.entries.openviking.config.port 1934` || `extracted 0 memories` | API Key 或模型名配置错误 | 检查 `ov.conf` 中 `api_key` 和 `model` 字段 || 插件未加载 | 未加载环境变量 | 启动前执行 `source ~/.openclaw/openviking.env` || `externally-managed-environment` | Python PEP 668 限制 | 使用 venv 或一键安装脚本 |diff --git a/examples/openclaw-memory-plugin/INSTALL.md b/examples/openclaw-plugin/INSTALL.mdsimilarity index 83%rename from examples/openclaw-memory-plugin/INSTALL.mdrename to examples/openclaw-plugin/INSTALL.mdindex 173253e92..9f1f52609 100644--- a/examples/openclaw-memory-plugin/INSTALL.md+++ b/examples/openclaw-plugin/INSTALL.md@@ -53,14 +53,14 @@ ov-install --workdir ~/.openclaw-second### Method B: curl One-Click Installation (Linux / macOS)```bash-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash```Non-interactive mode:```bash-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash -s -y+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -y```@@ -122,7 +122,7 @@ npm install -g openclaw-openviking-setup-helperov-install# Method B: curl one-click (Linux / macOS)-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash```The setup helper will prompt you to enter your Ark API Key and automatically generate a configuration file.@@ -134,13 +134,13 @@ source ~/.openclaw/openviking.env && openclaw gateway```-Seeing `memory-openviking: local server started` indicates success.+Seeing `openviking: local server started` indicates success.### Step 4: Verify```bashopenclaw status-# The Memory row should display: enabled (plugin memory-openviking)+# The ContextEngine row should display: enabled (plugin openviking)```@@ -171,14 +171,15 @@ openclaw status<summary>Manual configuration (without setup helper)</summary>```bash-openclaw config set plugins.enabled true --json-openclaw config set plugins.slots.memory memory-openviking-openclaw config set plugins.entries.memory-openviking.config.mode remote-openclaw config set plugins.entries.memory-openviking.config.baseUrl "http://your-server:1933"-openclaw config set plugins.entries.memory-openviking.config.apiKey "your-api-key"-openclaw config set plugins.entries.memory-openviking.config.agentId "your-agent-id"-openclaw config set plugins.entries.memory-openviking.config.autoRecall true --json-openclaw config set plugins.entries.memory-openviking.config.autoCapture true --json+openclaw plugins enable openviking+openclaw config set gateway.mode local+openclaw config set plugins.slots.contextEngine openviking+openclaw config set plugins.entries.openviking.config.mode remote+openclaw config set plugins.entries.openviking.config.baseUrl "http://your-server:1933"+openclaw config set plugins.entries.openviking.config.apiKey "your-api-key"+openclaw config set plugins.entries.openviking.config.agentId "your-agent-id"+openclaw config set plugins.entries.openviking.config.autoRecall true --json+openclaw config set plugins.entries.openviking.config.autoCapture true --json```</details>@@ -193,7 +194,7 @@ Please note that to protect the system Python from being corrupted, the ECS inst### Step 1: npm Installation-```python+```bashnpm install -g openclaw-openviking-setup-helperov-install@@ -212,14 +213,14 @@ source /root/.openclaw/openviking.envFirst, start the OpenViking Server:-```python+```bashpython -m openviking.server.bootstrap```Next, start the web console. Before starting, you need to confirm whether the instance's security group has opened TCP port 8020 in the inbound rules. If not, please configure the instance security group first:-```python+```bashpython -m openviking.console.bootstrap --host 0.0.0.0 --port 8020 --openviking-url http://127.0.0.1:1933```@@ -228,10 +229,10 @@ In the instance, find your server's public IP, and use it to access: `http://<yoYou can now start experiencing the web console 🎉-You can directly query file information on the web interface to verify whether the OpenViking `memory-plugin` memory write is effective; you can also verify if `memory-openviking` is reading memories in the OpenClaw logs. The verification method is as follows:+You can directly query file information on the web interface to verify whether the openclaw-plugin memory write is effective; you can also verify if openclaw-plugin is reading memories in the OpenClaw logs. The verification method is as follows:```bash-grep -i inject /tmp/openclaw/openclaw-2026-03-13.log | awk -F'"' '{for(i=1;i<=NF;i++) if($i ~ /^[0-9]{2}:[0-9]{2}:[0-9]{2}/) {time=$i; break}} /injecting [0-9]+ memories/ {print time, "memory-openviking:", gensub(/.*(injecting [0-9]+ memories).*/, "\\1", "1")}'+grep -i inject /tmp/openclaw/openclaw-2026-03-13.log | awk -F'"' '{for(i=1;i<=NF;i++) if($i ~ /^[0-9]{2}:[0-9]{2}:[0-9]{2}/) {time=$i; break}} /injecting [0-9]+ memories/ {print time, "openviking:", gensub(/.*(injecting [0-9]+ memories).*/, "\\1", "1")}'```@@ -282,11 +283,11 @@ Customization method:```bash# Specify in the plugin configuration-openclaw config set plugins.entries.memory-openviking.config.agentId "my-agent"+openclaw config set plugins.entries.openviking.config.agentId "my-agent"```-If not configured, the plugin will automatically generate a random, unique ID (format: `openclaw-<hostname>-<random>`).+If not configured, the plugin falls back to `default`. When OpenClaw provides a per-session `agentId` at runtime, the context engine will switch to that session-specific value automatically.### `~/.openclaw/openviking.env`@@ -305,11 +306,11 @@ export OPENVIKING_PYTHON='/usr/local/bin/python3'# Startsource ~/.openclaw/openviking.env && openclaw gateway-# Disable memory-openclaw config set plugins.slots.memory none+# Disable the context engine+openclaw config set plugins.slots.contextEngine none-# Enable memory-openclaw config set plugins.slots.memory memory-openviking+# Enable OpenViking as the context engine+openclaw config set plugins.slots.contextEngine openviking```@@ -319,7 +320,7 @@ openclaw config set plugins.slots.memory memory-openviking| Symptom | Cause | Fix || --- | --- | --- |-| `port occupied` | Port occupied by another process | Change port: `openclaw config set plugins.entries.memory-openviking.config.port 1934` |+| `port occupied` | Port occupied by another process | Change port: `openclaw config set plugins.entries.openviking.config.port 1934` || `extracted 0 memories` | API Key or model name configured incorrectly | Check the `api_key` and `model` fields in `ov.conf` || Plugin not loaded | Environment variables not loaded | Execute `source ~/.openclaw/openviking.env` before starting || `externally-managed-environment` | Python PEP 668 restriction | Use venv or the one-click installation script |@@ -338,6 +339,6 @@ python3 -m pip uninstall openviking -y && rm -rf ~/.openviking----**See also:** [INSTALL-ZH.md](https://github.com/volcengine/OpenViking/blob/main/examples/openclaw-memory-plugin/INSTALL-ZH.md) (Chinese) · [INSTALL-AGENT.md](https://www.google.com/search?q=./INSTALL-AGENT.md) (Agent Install Guide)+**See also:** [INSTALL-ZH.md](https://github.com/volcengine/OpenViking/blob/main/examples/openclaw-plugin/INSTALL-ZH.md) (Chinese) · [INSTALL-AGENT.md](https://www.google.com/search?q=./INSTALL-AGENT.md) (Agent Install Guide)---diff --git a/examples/openclaw-memory-plugin/README.md b/examples/openclaw-plugin/README.mdsimilarity index 87%rename from examples/openclaw-memory-plugin/README.mdrename to examples/openclaw-plugin/README.mdindex da84b3926..6feee23ce 100644--- a/examples/openclaw-memory-plugin/README.md+++ b/examples/openclaw-plugin/README.md@@ -1,6 +1,6 @@-# OpenClaw + OpenViking Memory Plugin+# OpenClaw + OpenViking Context-Engine Plugin-Use [OpenViking](https://github.com/volcengine/OpenViking) as the long-term memory backend for [OpenClaw](https://github.com/openclaw/openclaw). Once installed, OpenClaw will automatically **remember** important information from conversations and **recall** relevant context before responding.+Use [OpenViking](https://github.com/volcengine/OpenViking) as the long-term memory backend for [OpenClaw](https://github.com/openclaw/openclaw). In OpenClaw, this plugin is registered as the `openviking` context engine. Once installed, OpenClaw will automatically **remember** important information from conversations and **recall** relevant context before responding.> **⚠️ OpenClaw >= 2026.3.12 Compatibility Issue**>@@ -55,7 +55,7 @@ ov-install### Method B: curl One-Click (Linux / macOS)```bash-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash```The setup helper will walk you through:@@ -133,7 +133,7 @@ npm install -g openclaw-openviking-setup-helperov-install# Method B: curl one-click (Linux / macOS)-curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash+curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash```Select **local** mode, keep defaults, and enter your Ark API Key.@@ -154,7 +154,7 @@ source ~/.openclaw/openviking.env && openclaw gateway restart```bashopenclaw status-# Memory row should show: enabled (plugin memory-openviking)+# ContextEngine row should show: enabled (plugin openviking)```---@@ -238,14 +238,15 @@ curl -X POST http://localhost:1933/api/v1/admin/accounts/my-team/users \#### Step 3: Configure the OpenClaw Plugin```bash-openclaw config set plugins.enabled true --json-openclaw config set plugins.slots.memory memory-openviking-openclaw config set plugins.entries.memory-openviking.config.mode remote-openclaw config set plugins.entries.memory-openviking.config.baseUrl "http://your-server:1933"-openclaw config set plugins.entries.memory-openviking.config.apiKey "<user-api-key>"-openclaw config set plugins.entries.memory-openviking.config.agentId "<agent-id>"-openclaw config set plugins.entries.memory-openviking.config.autoRecall true --json-openclaw config set plugins.entries.memory-openviking.config.autoCapture true --json+openclaw plugins enable openviking+openclaw config set gateway.mode local+openclaw config set plugins.slots.contextEngine openviking+openclaw config set plugins.entries.openviking.config.mode remote+openclaw config set plugins.entries.openviking.config.baseUrl "http://your-server:1933"+openclaw config set plugins.entries.openviking.config.apiKey "<user-api-key>"+openclaw config set plugins.entries.openviking.config.agentId "<agent-id>"+openclaw config set plugins.entries.openviking.config.autoRecall true --json+openclaw config set plugins.entries.openviking.config.autoCapture true --json```#### Step 4: Start & Verify@@ -301,13 +302,13 @@ openclaw gateway restart```bashopenclaw status-# Memory row should show: enabled (plugin memory-openviking)+# ContextEngine row should show: enabled (plugin openviking)```### View Plugin Config```bash-openclaw config get plugins.entries.memory-openviking.config+openclaw config get plugins.entries.openviking.config```---@@ -384,14 +385,14 @@ source ~/.openclaw/openviking.env && openclaw gateway# Start (Remote mode — no env needed)openclaw gateway-# Disable memory-openclaw config set plugins.slots.memory none+# Disable the context engine+openclaw config set plugins.slots.contextEngine legacy-# Re-enable memory-openclaw config set plugins.slots.memory memory-openviking+# Re-enable OpenViking as the context engine+openclaw config set plugins.slots.contextEngine openviking```-> Restart the gateway after changing the memory slot.+> Restart the gateway after changing the context-engine slot.---@@ -418,12 +419,12 @@ Open http://127.0.0.1:8020 in your browser.| Symptom | Cause | Fix ||---------|-------|-----|| Conversation hangs, no response | OpenClaw >= 2026.3.12 compatibility issue | Downgrade to `2026.3.11`: `npm install -g [email protected]`. See [#591](https://github.com/volcengine/OpenViking/issues/591) |-| Agent hangs silently, no output | auto-recall missing timeout protection | Disable auto-recall temporarily: `openclaw config set plugins.entries.memory-openviking.config.autoRecall false --json`, or apply the patch in [#673](https://github.com/volcengine/OpenViking/issues/673) |-| Memory shows `disabled` / `memory-core` | Plugin slot not configured | `openclaw config set plugins.slots.memory memory-openviking` |+| Agent hangs silently, no output | auto-recall missing timeout protection | Disable auto-recall temporarily: `openclaw config set plugins.entries.openviking.config.autoRecall false --json`, or apply the patch in [#673](https://github.com/volcengine/OpenViking/issues/673) |+| ContextEngine is not `openviking` | Plugin slot not configured | `openclaw config set plugins.slots.contextEngine openviking` || `memory_store failed: fetch failed` | OpenViking not running | Check `ov.conf` and Python path; verify service is up || `health check timeout` | Port held by stale process | `lsof -ti tcp:1933 \| xargs kill -9`, then restart || `extracted 0 memories` | Wrong API Key or model name | Check `api_key` and `model` in `ov.conf` |-| `port occupied` | Port used by another process | Change port: `openclaw config set plugins.entries.memory-openviking.config.port 1934` |+| `port occupied` | Port used by another process | Change port: `openclaw config set plugins.entries.openviking.config.port 1934` || Plugin not loaded | Env file not sourced | Run `source ~/.openclaw/openviking.env` before starting || `externally-managed-environment` | Python PEP 668 restriction | Use venv or the one-click installer || `TypeError: unsupported operand type(s) for \|` | Python < 3.10 | Upgrade Python to 3.10+ |diff --git a/examples/openclaw-memory-plugin/client.ts b/examples/openclaw-plugin/client.tssimilarity index 100%rename from examples/openclaw-memory-plugin/client.tsrename to examples/openclaw-plugin/client.tsdiff --git a/examples/openclaw-memory-plugin/config.ts b/examples/openclaw-plugin/config.tssimilarity index 98%rename from examples/openclaw-memory-plugin/config.tsrename to examples/openclaw-plugin/config.tsindex 3fccd12ec..c7a465613 100644--- a/examples/openclaw-memory-plugin/config.ts+++ b/examples/openclaw-plugin/config.ts@@ -113,7 +113,7 @@ export const memoryOpenVikingConfigSchema = {"ingestReplyAssistMinSpeakerTurns","ingestReplyAssistMinChars",],- "memory-openviking config",+ "openviking config",);const mode = (cfg.mode === "local" || cfg.mode === "remote" ? cfg.mode : "local") as@@ -139,7 +139,7 @@ export const memoryOpenVikingConfigSchema = {captureMode !== "semantic" &&captureMode !== "keyword") {- throw new Error(`memory-openviking captureMode must be "semantic" or "keyword"`);+ throw new Error(`openviking captureMode must be "semantic" or "keyword"`);}return {diff --git a/examples/openclaw-plugin/context-engine.ts b/examples/openclaw-plugin/context-engine.tsnew file mode 100644index 000000000..cae34e694--- /dev/null+++ b/examples/openclaw-plugin/context-engine.ts@@ -0,0 +1,275 @@+import type { OpenVikingClient } from "./client.js";+import type { MemoryOpenVikingConfig } from "./config.js";+import {+ getCaptureDecision,+ extractNewTurnTexts,+} from "./text-utils.js";+import {+ trimForLog,+ toJsonLog,+ summarizeExtractedMemories,+} from "./memory-ranking.js";++type AgentMessage = {+ role?: string;+ content?: unknown;+};++type ContextEngineInfo = {+ id: string;+ name: string;+ version?: string;+};++type AssembleResult = {+ messages: AgentMessage[];+ estimatedTokens: number;+ systemPromptAddition?: string;+};++type IngestResult = {+ ingested: boolean;+};++type IngestBatchResult = {+ ingestedCount: number;+};++type CompactResult = {+ ok: boolean;+ compacted: boolean;+ reason?: string;+ result?: unknown;+};++type ContextEngine = {+ info: ContextEngineInfo;+ ingest: (params: { sessionId: string; message: AgentMessage; isHeartbeat?: boolean }) => Promise<IngestResult>;+ ingestBatch?: (params: {+ sessionId: string;+ messages: AgentMessage[];+ isHeartbeat?: boolean;+ }) => Promise<IngestBatchResult>;+ afterTurn?: (params: {+ sessionId: string;+ sessionFile: string;+ messages: AgentMessage[];+ prePromptMessageCount: number;+ autoCompactionSummary?: string;+ isHeartbeat?: boolean;+ tokenBudget?: number;+ runtimeContext?: Record<string, unknown>;+ }) => Promise<void>;+ assemble: (params: { sessionId: string; messages: AgentMessage[]; tokenBudget?: number }) => Promise<AssembleResult>;+ compact: (params: {+ sessionId: string;+ sessionFile: string;+ tokenBudget?: number;+ force?: boolean;+ currentTokenCount?: number;+ compactionTarget?: "budget" | "threshold";+ customInstructions?: string;+ runtimeContext?: Record<string, unknown>;+ }) => Promise<CompactResult>;+};++type Logger = {+ info: (msg: string) => void;+ warn?: (msg: string) => void;+ error: (msg: string) => void;+};++function estimateTokens(messages: AgentMessage[]): number {+ return Math.max(1, messages.length * 80);+}++async function tryLegacyCompact(params: {+ sessionId: string;+ sessionFile: string;+ tokenBudget?: number;+ force?: boolean;+ currentTokenCount?: number;+ compactionTarget?: "budget" | "threshold";+ customInstructions?: string;+ runtimeContext?: Record<string, unknown>;+}): Promise<CompactResult | null> {+ const candidates = [+ "openclaw/context-engine/legacy",+ "openclaw/dist/context-engine/legacy.js",+ ];++ for (const path of candidates) {+ try {+ const mod = (await import(path)) as {+ LegacyContextEngine?: new () => {+ compact: (arg: typeof params) => Promise<CompactResult>;+ };+ };+ if (!mod?.LegacyContextEngine) {+ continue;+ }+ const legacy = new mod.LegacyContextEngine();+ return legacy.compact(params);+ } catch {+ // continue+ }+ }++ return null;+}++function warnOrInfo(logger: Logger, message: string): void {+ if (typeof logger.warn === "function") {+ logger.warn(message);+ return;+ }+ logger.info(message);+}++export function createMemoryOpenVikingContextEngine(params: {+ id: string;+ name: string;+ version?: string;+ cfg: Required<MemoryOpenVikingConfig>;+ logger: Logger;+ getClient: () => Promise<OpenVikingClient>;+ resolveAgentId: (sessionId: string) => string;+}): ContextEngine {+ const {+ id,+ name,+ version,+ cfg,+ logger,+ getClient,+ resolveAgentId,+ } = params;++ const switchClientAgent = async (sessionId: string, phase: "assemble" | "afterTurn") => {+ const client = await getClient();+ const resolvedAgentId = resolveAgentId(sessionId);+ const before = client.getAgentId();+ if (resolvedAgentId && resolvedAgentId !== before) {+ client.setAgentId(resolvedAgentId);+ logger.info(`openviking: switched to agentId=${resolvedAgentId} for ${phase}`);+ }+ return client;+ };++ return {+ info: {+ id,+ name,+ version,+ },++ async ingest(): Promise<IngestResult> {+ // Keep canonical capture behavior in afterTurn (same semantics as old agent_end hook).+ return { ingested: false };+ },++ async ingestBatch(): Promise<IngestBatchResult> {+ // Keep canonical capture behavior in afterTurn (same semantics as old agent_end hook).+ return { ingestedCount: 0 };+ },++ async assemble(assembleParams): Promise<AssembleResult> {+ return {+ messages: assembleParams.messages,+ estimatedTokens: estimateTokens(assembleParams.messages),+ };+ },++ async afterTurn(afterTurnParams): Promise<void> {+ if (!cfg.autoCapture) {+ return;+ }++ try {+ await switchClientAgent(afterTurnParams.sessionId, "afterTurn");++ const messages = afterTurnParams.messages ?? [];+ if (messages.length === 0) {+ logger.info("openviking: auto-capture skipped (messages=0)");+ return;+ }++ const start =+ typeof afterTurnParams.prePromptMessageCount === "number" &&+ afterTurnParams.prePromptMessageCount >= 0+ ? afterTurnParams.prePromptMessageCount+ : 0;++ const { texts: newTexts, newCount } = extractNewTurnTexts(messages, start);++ if (newTexts.length === 0) {+ logger.info("openviking: auto-capture skipped (no new user/assistant messages)");+ return;+ }++ const turnText = newTexts.join("\n");+ const decision = getCaptureDecision(turnText, cfg.captureMode, cfg.captureMaxLength);+ const preview = turnText.length > 80 ? `${turnText.slice(0, 80)}...` : turnText;+ logger.info(+ "openviking: capture-check " ++ `shouldCapture=${String(decision.shouldCapture)} ` ++ `reason=${decision.reason} newMsgCount=${newCount} text=\"${preview}\"`,+ );++ if (!decision.shouldCapture) {+ logger.info("openviking: auto-capture skipped (capture decision rejected)");+ return;+ }++ const client = await getClient();+ const sessionId = await client.createSession();+ try {+ await client.addSessionMessage(sessionId, "user", decision.normalizedText);+ await client.getSession(sessionId).catch(() => ({}));+ const extracted = await client.extractSessionMemories(sessionId);++ logger.info(+ `openviking: auto-captured ${newCount} new messages, extracted ${extracted.length} memories`,+ );+ logger.info(+ `openviking: capture-detail ${toJsonLog({+ capturedCount: newCount,+ captured: [trimForLog(turnText, 260)],+ extractedCount: extracted.length,+ extracted: summarizeExtractedMemories(extracted),+ })}`,+ );+ if (extracted.length === 0) {+ warnOrInfo(+ logger,+ "openviking: auto-capture completed but extract returned 0 memories. " ++ "Check OpenViking server logs for embedding/extract errors.",+ );+ }+ } finally {+ await client.deleteSession(sessionId).catch(() => {});+ }+ } catch (err) {+ warnOrInfo(logger, `openviking: auto-capture failed: ${String(err)}`);+ }+ },++ async compact(compactParams): Promise<CompactResult> {+ const delegated = await tryLegacyCompact(compactParams);+ if (delegated) {+ return delegated;+ }++ warnOrInfo(+ logger,+ "openviking: legacy compaction delegation unavailable; skipping compact",+ );++ return {+ ok: true,+ compacted: false,+ reason: "legacy_compact_unavailable",+ };+ },+ };+}diff --git a/examples/openclaw-memory-plugin/demo-memory-ajie.py b/examples/openclaw-plugin/demo-memory-ajie.pysimilarity index 82%rename from examples/openclaw-memory-plugin/demo-memory-ajie.pyrename to examples/openclaw-plugin/demo-memory-ajie.pyindex 76fa6e605..5d006160d 100644--- a/examples/openclaw-memory-plugin/demo-memory-ajie.py+++ b/examples/openclaw-plugin/demo-memory-ajie.py@@ -1,10 +1,10 @@#!/usr/bin/env python3"""-OpenClaw Memory Plugin 演示脚本 — 用户: 阿杰(后端开发)+OpenClaw Plugin 演示脚本 — 用户: 阿杰(后端开发)通过 OpenClaw Gateway 的 Responses API (/v1/responses) 进行多轮对话,验证 OpenViking 记忆插件的端到端能力。消息经过完整 agent 流水线,-插件的 before_agent_start(记忆注入)和 agent_end(记忆抽取)自动触发。+插件的 before_prompt_build(记忆注入)和 afterTurn(记忆抽取)自动触发。前提: OpenClaw 配置中需开启 Responses API。在 openclaw.config.json 的 gateways 中添加:@@ -26,7 +26,6 @@ OpenClaw Memory Plugin 演示脚本 — 用户: 阿杰(后端开发)"""import argparse-import sysimport timeimport requests@@ -71,10 +70,22 @@ CHAT_MESSAGES = [# ── 验证数据 (5 轮) ──────────────────────────────────────────────────────VERIFY_QUESTIONS = [- {"question": "帮我回忆一下最近遇到的技术问题和解决方案,请简洁回答", "expected": "Redis 缓存击穿加互斥锁、MySQL 加索引、Kafka 削峰填谷"},- {"question": "我们的技术栈是什么?请简洁回答", "expected": "Spring Boot、Redis、MySQL、Kafka、K8s、Prometheus + Grafana"},- {"question": "我踩过哪些技术坑?请简洁回答", "expected": "Redis 过期时间设错、MySQL 连接池满了"},- {"question": "我的工作习惯是怎样的?请简洁回答", "expected": "早上看监控、上午写代码、下午开会/review,用 IDEA"},+ {+ "question": "帮我回忆一下最近遇到的技术问题和解决方案,请简洁回答",+ "expected": "Redis 缓存击穿加互斥锁、MySQL 加索引、Kafka 削峰填谷",+ },+ {+ "question": "我们的技术栈是什么?请简洁回答",+ "expected": "Spring Boot、Redis、MySQL、Kafka、K8s、Prometheus + Grafana",+ },+ {+ "question": "我踩过哪些技术坑?请简洁回答",+ "expected": "Redis 过期时间设错、MySQL 连接池满了",+ },+ {+ "question": "我的工作习惯是怎样的?请简洁回答",+ "expected": "早上看监控、上午写代码、下午开会/review,用 IDEA",+ },{"question": "最近在看什么技术书?请简洁回答", "expected": "Redis 设计与实现、高性能 MySQL"},]@@ -129,7 +140,9 @@ def run_chat(gateway_url, delay):for i, msg in enumerate(CHAT_MESSAGES, 1):console.rule(f"[dim]{i}/{total}[/dim]", style="dim")- console.print(Panel(msg, title=f"[bold cyan]用户 [{i}/{total}][/bold cyan]", border_style="cyan"))+ console.print(+ Panel(msg, title=f"[bold cyan]用户 [{i}/{total}][/bold cyan]", border_style="cyan")+ )try:data = send_message(gateway_url, msg, USER_ID, messages if messages else None)reply = extract_reply_text(data)@@ -153,7 +166,9 @@ def run_chat(gateway_url, delay):def run_verify(gateway_url, delay):console.print()- console.rule(f"[bold]Phase 2: 验证记忆召回 — {DISPLAY_NAME} 新 Session ({len(VERIFY_QUESTIONS)} 轮)[/bold]")+ console.rule(+ f"[bold]Phase 2: 验证记忆召回 — {DISPLAY_NAME} 新 Session ({len(VERIFY_QUESTIONS)} 轮)[/bold]"+ )# 用不同的 user 后缀确保 Gateway 派生出新 sessionverify_user = f"{USER_ID}-verify"@@ -165,11 +180,13 @@ def run_verify(gateway_url, delay):for i, item in enumerate(VERIFY_QUESTIONS, 1):q, expected = item["question"], item["expected"]console.rule(f"[dim]{i}/{total}[/dim]", style="dim")- console.print(Panel(- f"{q}\n[dim]期望召回: {expected}[/dim]",- title=f"[bold cyan]验证 [{i}/{total}][/bold cyan]",- border_style="cyan",- ))+ console.print(+ Panel(+ f"{q}\n[dim]期望召回: {expected}[/dim]",+ title=f"[bold cyan]验证 [{i}/{total}][/bold cyan]",+ border_style="cyan",+ )+ )try:# 每题独立发送,不带历史 → 回答正确 = 记忆召回生效@@ -201,7 +218,9 @@ def run_verify(gateway_url, delay):ok = sum(1 for r in results if r.get("success"))console.print(f"\n[yellow]成功: {ok}/{total}[/yellow]")- console.print("[yellow]验证方式: 每个问题在新 session 中独立发送(无对话历史),回答正确说明 before_agent_start hook 成功召回了记忆。[/yellow]")+ console.print(+ "[yellow]验证方式: 每个问题在新 session 中独立发送(无对话历史),回答正确说明 before_prompt_build 阶段成功召回了记忆。[/yellow]"+ )# ── 入口 ───────────────────────────────────────────────────────────────────@@ -209,16 +228,22 @@ def run_verify(gateway_url, delay):def main():parser = argparse.ArgumentParser(description=f"Memory 演示 — {DISPLAY_NAME}")- parser.add_argument("--gateway", default=DEFAULT_GATEWAY,- help=f"OpenClaw Gateway 地址 (默认: {DEFAULT_GATEWAY})")- parser.add_argument("--phase", choices=["all", "chat", "verify"], default="all",- help="all=全部, chat=仅对话, verify=仅验证 (默认: all)")- parser.add_argument("--delay", type=float, default=3.0,- help="轮次间等待秒数 (默认: 3)")+ parser.add_argument(+ "--gateway",+ default=DEFAULT_GATEWAY,+ help=f"OpenClaw Gateway 地址 (默认: {DEFAULT_GATEWAY})",+ )+ parser.add_argument(+ "--phase",+ choices=["all", "chat", "verify"],+ default="all",+ help="all=全部, chat=仅对话, verify=仅验证 (默认: all)",+ )+ parser.add_argument("--delay", type=float, default=3.0, help="轮次间等待秒数 (默认: 3)")args = parser.parse_args()gateway_url = args.gateway.rstrip("/")- console.print(f"[bold]OpenClaw Memory Plugin 演示 — {DISPLAY_NAME}[/bold]")+ console.print(f"[bold]OpenClaw Plugin 演示 — {DISPLAY_NAME}[/bold]")console.print(f"[yellow]Gateway:[/yellow] {gateway_url}")if args.phase in ("all", "chat"):diff --git a/examples/openclaw-memory-plugin/demo-memory-xiaomei.py b/examples/openclaw-plugin/demo-memory-xiaomei.pysimilarity index 82%rename from examples/openclaw-memory-plugin/demo-memory-xiaomei.pyrename to examples/openclaw-plugin/demo-memory-xiaomei.pyindex 8d2584436..2c3967763 100644--- a/examples/openclaw-memory-plugin/demo-memory-xiaomei.py+++ b/examples/openclaw-plugin/demo-memory-xiaomei.py@@ -1,10 +1,10 @@#!/usr/bin/env python3"""-OpenClaw Memory Plugin 演示脚本 — 用户: 小美(日常生活记录)+OpenClaw Plugin 演示脚本 — 用户: 小美(日常生活记录)通过 OpenClaw Gateway 的 Responses API (/v1/responses) 进行多轮对话,验证 OpenViking 记忆插件的端到端能力。消息经过完整 agent 流水线,-插件的 before_agent_start(记忆注入)和 agent_end(记忆抽取)自动触发。+插件的 before_prompt_build(记忆注入)和 afterTurn(记忆抽取)自动触发。前提: OpenClaw 配置中需开启 Responses API。在 openclaw.config.json 的 gateways 中添加:@@ -26,7 +26,6 @@ OpenClaw Memory Plugin 演示脚本 — 用户: 小美(日常生活记录)"""import argparse-import sysimport timeimport requests@@ -71,10 +70,22 @@ CHAT_MESSAGES = [# ── 验证数据 (5 轮) ──────────────────────────────────────────────────────VERIFY_QUESTIONS = [- {"question": "帮我回忆一下我最近的生活和工作情况,请简洁回答", "expected": "618 活动文案、同事小丽、健身计划、减肥中"},- {"question": "周末想跟男朋友出去,有什么建议吗?请简洁回答", "expected": "樱花花期快过了,看电影或探店,喜欢咖啡馆"},- {"question": "想吃点东西,有什么要注意的吗?请简洁回答", "expected": "对芒果过敏,喜欢麻辣烫多放醋和麻酱,减肥中少吃主食"},- {"question": "我平时有什么爱好?请简洁回答", "expected": "追甜宠剧、画画、看书(被讨厌的勇气)"},+ {+ "question": "帮我回忆一下我最近的生活和工作情况,请简洁回答",+ "expected": "618 活动文案、同事小丽、健身计划、减肥中",+ },+ {+ "question": "周末想跟男朋友出去,有什么建议吗?请简洁回答",+ "expected": "樱花花期快过了,看电影或探店,喜欢咖啡馆",+ },+ {+ "question": "想吃点东西,有什么要注意的吗?请简洁回答",+ "expected": "对芒果过敏,喜欢麻辣烫多放醋和麻酱,减肥中少吃主食",+ },+ {+ "question": "我平时有什么爱好?请简洁回答",+ "expected": "追甜宠剧、画画、看书(被讨厌的勇气)",+ },{"question": "我最近想买什么东西?请简洁回答", "expected": "富士 mini12 粉色拍立得、投影仪"},]@@ -129,7 +140,9 @@ def run_chat(gateway_url, delay):for i, msg in enumerate(CHAT_MESSAGES, 1):console.rule(f"[dim]{i}/{total}[/dim]", style="dim")- console.print(Panel(msg, title=f"[bold cyan]用户 [{i}/{total}][/bold cyan]", border_style="cyan"))+ console.print(+ Panel(msg, title=f"[bold cyan]用户 [{i}/{total}][/bold cyan]", border_style="cyan")+ )try:data = send_message(gateway_url, msg, USER_ID, messages if messages else None)reply = extract_reply_text(data)@@ -153,7 +166,9 @@ def run_chat(gateway_url, delay):def run_verify(gateway_url, delay):console.print()- console.rule(f"[bold]Phase 2: 验证记忆召回 — {DISPLAY_NAME} 新 Session ({len(VERIFY_QUESTIONS)} 轮)[/bold]")+ console.rule(+ f"[bold]Phase 2: 验证记忆召回 — {DISPLAY_NAME} 新 Session ({len(VERIFY_QUESTIONS)} 轮)[/bold]"+ )# 用不同的 user 后缀确保 Gateway 派生出新 sessionverify_user = f"{USER_ID}-verify"@@ -165,11 +180,13 @@ def run_verify(gateway_url, delay):for i, item in enumerate(VERIFY_QUESTIONS, 1):q, expected = item["question"], item["expected"]console.rule(f"[dim]{i}/{total}[/dim]", style="dim")- console.print(Panel(- f"{q}\n[dim]期望召回: {expected}[/dim]",- title=f"[bold cyan]验证 [{i}/{total}][/bold cyan]",- border_style="cyan",- ))+ console.print(+ Panel(+ f"{q}\n[dim]期望召回: {expected}[/dim]",+ title=f"[bold cyan]验证 [{i}/{total}][/bold cyan]",+ border_style="cyan",+ )+ )try:# 每题独立发送,不带历史 → 回答正确 = 记忆召回生效@@ -201,7 +218,9 @@ def run_verify(gateway_url, delay):ok = sum(1 for r in results if r.get("success"))console.print(f"\n[yellow]成功: {ok}/{total}[/yellow]")- console.print("[yellow]验证方式: 每个问题在新 session 中独立发送(无对话历史),回答正确说明 before_agent_start hook 成功召回了记忆。[/yellow]")+ console.print(+ "[yellow]验证方式: 每个问题在新 session 中独立发送(无对话历史),回答正确说明 before_prompt_build 阶段成功召回了记忆。[/yellow]"+ )# ── 入口 ───────────────────────────────────────────────────────────────────@@ -209,16 +228,22 @@ def run_verify(gateway_url, delay):def main():parser = argparse.ArgumentParser(description=f"Memory 演示 — {DISPLAY_NAME}")- parser.add_argument("--gateway", default=DEFAULT_GATEWAY,- help=f"OpenClaw Gateway 地址 (默认: {DEFAULT_GATEWAY})")- parser.add_argument("--phase", choices=["all", "chat", "verify"], default="all",- help="all=全部, chat=仅对话, verify=仅验证 (默认: all)")- parser.add_argument("--delay", type=float, default=3.0,- help="轮次间等待秒数 (默认: 3)")+ parser.add_argument(+ "--gateway",+ default=DEFAULT_GATEWAY,+ help=f"OpenClaw Gateway 地址 (默认: {DEFAULT_GATEWAY})",+ )+ parser.add_argument(+ "--phase",+ choices=["all", "chat", "verify"],+ default="all",+ help="all=全部, chat=仅对话, verify=仅验证 (默认: all)",+ )+ parser.add_argument("--delay", type=float, default=3.0, help="轮次间等待秒数 (默认: 3)")args = parser.parse_args()gateway_url = args.gateway.rstrip("/")- console.print(f"[bold]OpenClaw Memory Plugin 演示 — {DISPLAY_NAME}[/bold]")+ console.print(f"[bold]OpenClaw Plugin 演示 — {DISPLAY_NAME}[/bold]")console.print(f"[yellow]Gateway:[/yellow] {gateway_url}")if args.phase in ("all", "chat"):diff --git a/examples/openclaw-memory-plugin/index.ts b/examples/openclaw-plugin/index.tssimilarity index 57%rename from examples/openclaw-memory-plugin/index.tsrename to examples/openclaw-plugin/index.tsindex f4f82f9ab..2d773a590 100644--- a/examples/openclaw-memory-plugin/index.ts+++ b/examples/openclaw-plugin/index.ts@@ -1,47 +1,79 @@import { spawn } from "node:child_process";import { tmpdir } from "node:os";-import type { OpenClawPluginApi } from "openclaw/plugin-sdk";import { Type } from "@sinclair/typebox";import { memoryOpenVikingConfigSchema } from "./config.js";-import { OpenVikingClient, localClientCache, localClientPendingPromises, isMemoryUri } from "./client.js";-import type { PendingClientEntry } from "./client.js";+import { OpenVikingClient, localClientCache, isMemoryUri } from "./client.js";import type { FindResultItem } from "./client.js";import {- getCaptureDecision,isTranscriptLikeIngest,- extractNewTurnTexts,extractLatestUserText,} from "./text-utils.js";import {clampScore,postProcessMemories,formatMemoryLines,- trimForLog,toJsonLog,summarizeInjectionMemories,- summarizeExtractedMemories,pickMemoriesForInjection,} from "./memory-ranking.js";import {IS_WIN,waitForHealth,- withTimeout,quickRecallPrecheck,resolvePythonCommand,prepareLocalPort,} from "./process-manager.js";+import { createMemoryOpenVikingContextEngine } from "./context-engine.js";++type PluginLogger = {+ debug?: (message: string) => void;+ info: (message: string) => void;+ warn: (message: string) => void;+ error: (message: string) => void;+};++type HookAgentContext = {+ agentId?: string;+ sessionId?: string;+ sessionKey?: string;+};++type OpenClawPluginApi = {+ pluginConfig?: unknown;+ logger: PluginLogger;+ registerTool: (+ tool: {+ name: string;+ label: string;+ description: string;+ parameters: unknown;+ execute: (_toolCallId: string, params: Record<string, unknown>) => Promise<unknown>;+ },+ opts?: { name?: string; names?: string[] },+ ) => void;+ registerService: (service: {+ id: string;+ start: (ctx?: unknown) => void | Promise<void>;+ stop?: (ctx?: unknown) => void | Promise<void>;+ }) => void;+ registerContextEngine?: (id: string, factory: () => unknown) => void;+ on: (+ hookName: string,+ handler: (event: unknown, ctx?: HookAgentContext) => unknown,+ opts?: { priority?: number },+ ) => void;+};const MAX_OPENVIKING_STDERR_LINES = 200;const MAX_OPENVIKING_STDERR_CHARS = 256_000;-const AUTO_RECALL_TIMEOUT_MS = 5_000;-const memoryPlugin = {- id: "memory-openviking",- name: "Memory (OpenViking)",- description: "OpenViking-backed long-term memory with auto-recall/capture",- kind: "memory" as const,+const contextEnginePlugin = {+ id: "openviking",+ name: "Context Engine (OpenViking)",+ description: "OpenViking-backed context-engine memory with auto-recall/capture",+ kind: "context-engine" as const,configSchema: memoryOpenVikingConfigSchema,register(api: OpenClawPluginApi) {@@ -53,17 +85,16 @@ const memoryPlugin = {let resolveLocalClient: ((c: OpenVikingClient) => void) | null = null;let rejectLocalClient: ((err: unknown) => void) | null = null;let localUnavailableReason: string | null = null;-const markLocalUnavailable = (reason: string, err?: unknown) => {if (!localUnavailableReason) {localUnavailableReason = reason;api.logger.warn(- `memory-openviking: local mode marked unavailable (${reason})${err ? `: ${String(err)}` : ""}`,+ `openviking: local mode marked unavailable (${reason})${err ? `: ${String(err)}` : ""}`,);}if (rejectLocalClient) {rejectLocalClient(- err instanceof Error ? err : new Error(`memory-openviking unavailable: ${reason}`),+ err instanceof Error ? err : new Error(`openviking unavailable: ${reason}`),);rejectLocalClient = null;}@@ -76,18 +107,10 @@ const memoryPlugin = {localProcess = cached.process;clientPromise = Promise.resolve(cached.client);} else {- const existingPending = localClientPendingPromises.get(localCacheKey);- if (existingPending) {- clientPromise = existingPending.promise;- } else {- const entry = {} as PendingClientEntry;- entry.promise = new Promise<OpenVikingClient>((resolve, reject) => {- entry.resolve = resolve;- entry.reject = reject;- });- clientPromise = entry.promise;- localClientPendingPromises.set(localCacheKey, entry);- }+ clientPromise = new Promise<OpenVikingClient>((resolve, reject) => {+ resolveLocalClient = resolve;+ rejectLocalClient = reject;+ });}} else {clientPromise = Promise.resolve(new OpenVikingClient(cfg.baseUrl, cfg.apiKey, cfg.agentId, cfg.timeoutMs));@@ -215,7 +238,7 @@ const memoryPlugin = {const sessionIdIn = (params as { sessionId?: string }).sessionId;api.logger.info?.(- `memory-openviking: memory_store invoked (textLength=${text?.length ?? 0}, sessionId=${sessionIdIn ?? "temp"})`,+ `openviking: memory_store invoked (textLength=${text?.length ?? 0}, sessionId=${sessionIdIn ?? "temp"})`,);let sessionId = sessionIdIn;@@ -230,11 +253,11 @@ const memoryPlugin = {const extracted = await c.extractSessionMemories(sessionId);if (extracted.length === 0) {api.logger.warn(- `memory-openviking: memory_store completed but extract returned 0 memories (sessionId=${sessionId}). ` ++ `openviking: memory_store completed but extract returned 0 memories (sessionId=${sessionId}). ` +"Check OpenViking server logs for embedding/extract errors (e.g. 401 API key, or extraction pipeline).",);} else {- api.logger.info?.(`memory-openviking: memory_store extracted ${extracted.length} memories`);+ api.logger.info?.(`openviking: memory_store extracted ${extracted.length} memories`);}return {content: [@@ -246,7 +269,7 @@ const memoryPlugin = {details: { action: "stored", sessionId, extractedCount: extracted.length, extracted },};} catch (err) {- api.logger.warn(`memory-openviking: memory_store failed: ${String(err)}`);+ api.logger.warn(`openviking: memory_store failed: ${String(err)}`);throw err;} finally {if (createdTempSession && sessionId) {@@ -361,229 +384,188 @@ const memoryPlugin = {},{ name: "memory_forget" },);+ const sessionAgentIds = new Map<string, string>();+ const rememberSessionAgentId = (ctx: {+ agentId?: string;+ sessionId?: string;+ sessionKey?: string;+ }) => {+ if (!ctx?.agentId) {+ return;+ }+ if (ctx.sessionId) {+ sessionAgentIds.set(ctx.sessionId, ctx.agentId);+ }+ if (ctx.sessionKey) {+ sessionAgentIds.set(ctx.sessionKey, ctx.agentId);+ }+ };+ const resolveAgentId = (sessionId: string): string =>+ sessionAgentIds.get(sessionId) ?? cfg.agentId;- if (cfg.autoRecall || cfg.ingestReplyAssist) {- api.on("before_agent_start", async (event: { messages?: unknown[]; prompt: string }, ctx?: { agentId?: string }) => {- // Dynamically switch agent identity for multi-agent memory isolation.- // In multi-agent gateway deployments, the hook context carries the current- // agent's ID so we route memory operations to the correct agent_space.- const hookAgentId = ctx?.agentId;- if (hookAgentId) {- const client = await getClient();- client.setAgentId(hookAgentId);- api.logger.info?.(`memory-openviking: switched to agentId=${hookAgentId} for recall`);- }- const queryText = extractLatestUserText(event.messages) || event.prompt.trim();- if (!queryText) {- return;- }- const prependContextParts: string[] = [];+ api.on("session_start", async (_event: unknown, ctx?: HookAgentContext) => {+ rememberSessionAgentId(ctx ?? {});+ });+ api.on("session_end", async (_event: unknown, ctx?: HookAgentContext) => {+ rememberSessionAgentId(ctx ?? {});+ });+ api.on("before_prompt_build", async (event: unknown, ctx?: HookAgentContext) => {+ rememberSessionAgentId(ctx ?? {});++ const hookSessionId = ctx?.sessionId ?? ctx?.sessionKey ?? "";+ const resolvedAgentId = resolveAgentId(hookSessionId);+ const client = await getClient();+ if (resolvedAgentId && client.getAgentId() !== resolvedAgentId) {+ client.setAgentId(resolvedAgentId);+ api.logger.info(`openviking: switched to agentId=${resolvedAgentId} for before_prompt_build`);+ }++ const eventObj = (event ?? {}) as { messages?: unknown[]; prompt?: string };+ const queryText =+ extractLatestUserText(eventObj.messages) ||+ (typeof eventObj.prompt === "string" ? eventObj.prompt.trim() : "");+ if (!queryText) {+ return;+ }- if (cfg.autoRecall && queryText.length >= 5) {- const precheck = await quickRecallPrecheck(cfg.mode, cfg.baseUrl, cfg.port, localProcess);- if (!precheck.ok) {- api.logger.info?.(- `memory-openviking: skipping auto-recall because precheck failed (${precheck.reason})`,+ const prependContextParts: string[] = [];++ if (cfg.autoRecall && queryText.length >= 5) {+ const precheck = await quickRecallPrecheck(cfg.mode, cfg.baseUrl, cfg.port, localProcess);+ if (!precheck.ok) {+ api.logger.info(+ `openviking: skipping auto-recall because precheck failed (${precheck.reason})`,+ );+ } else {+ try {+ const candidateLimit = Math.max(cfg.recallLimit * 4, 20);+ const [userSettled, agentSettled] = await Promise.allSettled([+ client.find(queryText, {+ targetUri: "viking://user/memories",+ limit: candidateLimit,+ scoreThreshold: 0,+ }),+ client.find(queryText, {+ targetUri: "viking://agent/memories",+ limit: candidateLimit,+ scoreThreshold: 0,+ }),+ ]);++ const userResult = userSettled.status === "fulfilled" ? userSettled.value : { memories: [] };+ const agentResult = agentSettled.status === "fulfilled" ? agentSettled.value : { memories: [] };+ if (userSettled.status === "rejected") {+ api.logger.warn(`openviking: user memories search failed: ${String(userSettled.reason)}`);+ }+ if (agentSettled.status === "rejected") {+ api.logger.warn(`openviking: agent memories search failed: ${String(agentSettled.reason)}`);+ }++ const allMemories = [...(userResult.memories ?? []), ...(agentResult.memories ?? [])];+ const uniqueMemories = allMemories.filter((memory, index, self) =>+ index === self.findIndex((m) => m.uri === memory.uri));- } else {- try {- await withTimeout(- (async () => {- const candidateLimit = Math.max(cfg.recallLimit * 4, 20);- api.logger.info?.(`memory-openviking: autoRecall searching (query="${queryText.slice(0, 80)}", limit=${candidateLimit})`);- // 同时检索 user 和 agent 两个位置的记忆- const [userSettled, agentSettled] = await Promise.allSettled([- getClient().then((client) =>- client.find(queryText, {- targetUri: "viking://user/memories",- limit: candidateLimit,- scoreThreshold: 0,- }),- ),- getClient().then((client) =>- client.find(queryText, {- targetUri: "viking://agent/memories",- limit: candidateLimit,- scoreThreshold: 0,- }),- ),- ]);- const userResult = userSettled.status === "fulfilled" ? userSettled.value : { memories: [] };- const agentResult = agentSettled.status === "fulfilled" ? agentSettled.value : { memories: [] };- api.logger.info?.(`memory-openviking: autoRecall done (user=${userResult.memories?.length ?? 0}, agent=${agentResult.memories?.length ?? 0})`);-- if (userSettled.status === "rejected") {- api.logger.warn(`memory-openviking: user memories search failed: ${String(userSettled.reason)}`);- }- if (agentSettled.status === "rejected") {- api.logger.warn(`memory-openviking: agent memories search failed: ${String(agentSettled.reason)}`);- }- // 合并两个位置的结果,去重- const allMemories = [...(userResult.memories ?? []), ...(agentResult.memories ?? [])];- const uniqueMemories = allMemories.filter((memory, index, self) =>- index === self.findIndex((m) => m.uri === memory.uri)- );- const leafOnly = uniqueMemories.filter((m) => m.level === 2);- const processed = postProcessMemories(leafOnly, {- limit: candidateLimit,- scoreThreshold: cfg.recallScoreThreshold,- });- const memories = pickMemoriesForInjection(processed, cfg.recallLimit, queryText);- if (memories.length > 0) {- // 对 level 2 节点读取正文,其余用 abstract- const client = await getClient();- const memoryLines = await Promise.all(- memories.map(async (item: FindResultItem) => {- if (item.level === 2) {- try {- const content = await client.read(item.uri);- if (content && typeof content === "string" && content.trim()) {- return `- [${item.category ?? "memory"}] ${content.trim()}`;- }- } catch {- // fallback to abstract- }- }- return `- [${item.category ?? "memory"}] ${item.abstract ?? item.uri}`;- }),- );- const memoryContext = memoryLines.join("\n");- api.logger.info?.(- `memory-openviking: injecting ${memories.length} memories into context`,- );- api.logger.info?.(- `memory-openviking: inject-detail ${toJsonLog({ count: memories.length, memories: summarizeInjectionMemories(memories) })}`,- );- prependContextParts.push(- "<relevant-memories>\nThe following OpenViking memories may be relevant:\n" +- `${memoryContext}\n` +- "</relevant-memories>",- );+ const leafOnly = uniqueMemories.filter((m) => m.level === 2);+ const processed = postProcessMemories(leafOnly, {+ limit: candidateLimit,+ scoreThreshold: cfg.recallScoreThreshold,+ });+ const memories = pickMemoriesForInjection(processed, cfg.recallLimit, queryText);++ if (memories.length > 0) {+ const memoryLines = await Promise.all(+ memories.map(async (item: FindResultItem) => {+ if (item.level === 2) {+ try {+ const content = await client.read(item.uri);+ if (content && typeof content === "string" && content.trim()) {+ return `- [${item.category ?? "memory"}] ${content.trim()}`;+ }+ } catch {+ // fallback to abstract+ }}- })(),- AUTO_RECALL_TIMEOUT_MS,- `memory-openviking: auto-recall timed out after ${AUTO_RECALL_TIMEOUT_MS}ms`,+ return `- [${item.category ?? "memory"}] ${item.abstract ?? item.uri}`;+ }),+ );+ const memoryContext = memoryLines.join("\n");+ api.logger.info(`openviking: injecting ${memories.length} memories into context`);+ api.logger.info(+ `openviking: inject-detail ${toJsonLog({ count: memories.length, memories: summarizeInjectionMemories(memories) })}`,+ );+ prependContextParts.push(+ "<relevant-memories>\nThe following OpenViking memories may be relevant:\n" ++ `${memoryContext}\n` ++ "</relevant-memories>",);- } catch (err) {- api.logger.warn(`memory-openviking: auto-recall failed or timed out: ${String(err)}`);}+ } catch (err) {+ api.logger.warn(`openviking: auto-recall failed: ${String(err)}`);}}+ }- if (cfg.ingestReplyAssist) {- const decision = isTranscriptLikeIngest(queryText, {- minSpeakerTurns: cfg.ingestReplyAssistMinSpeakerTurns,- minChars: cfg.ingestReplyAssistMinChars,- });- if (decision.shouldAssist) {- api.logger.info?.(- `memory-openviking: ingest-reply-assist applied (reason=${decision.reason}, speakerTurns=${decision.speakerTurns}, chars=${decision.chars})`,- );- prependContextParts.push(- "<ingest-reply-assist>\n" +- "The latest user input looks like a multi-speaker transcript used for memory ingestion.\n" +- "Reply with 1-2 concise sentences to acknowledge or summarize key points.\n" +- "Do not output NO_REPLY or an empty reply.\n" +- "Do not fabricate facts beyond the provided transcript and recalled memories.\n" +- "</ingest-reply-assist>",- );- }- }-- if (prependContextParts.length > 0) {- return {- prependContext: prependContextParts.join("\n\n"),- };- }- });- }-- if (cfg.autoCapture) {- let lastProcessedMsgCount = 0;-- api.on("agent_end", async (event: { success?: boolean; messages?: unknown[] }, ctx?: { agentId?: string }) => {- // Dynamically switch agent identity for multi-agent memory isolation- const hookAgentId = ctx?.agentId;- if (hookAgentId) {- const client = await getClient();- client.setAgentId(hookAgentId);- api.logger.info?.(`memory-openviking: switched to agentId=${hookAgentId} for capture`);- }- if (!event.success || !event.messages || event.messages.length === 0) {+ if (cfg.ingestReplyAssist) {+ const decision = isTranscriptLikeIngest(queryText, {+ minSpeakerTurns: cfg.ingestReplyAssistMinSpeakerTurns,+ minChars: cfg.ingestReplyAssistMinChars,+ });+ if (decision.shouldAssist) {api.logger.info(- `memory-openviking: auto-capture skipped (success=${String(event.success)}, messages=${event.messages?.length ?? 0})`,+ `openviking: ingest-reply-assist applied (reason=${decision.reason}, speakerTurns=${decision.speakerTurns}, chars=${decision.chars})`,+ );+ prependContextParts.push(+ "<ingest-reply-assist>\n" ++ "The latest user input looks like a multi-speaker transcript used for memory ingestion.\n" ++ "Reply with 1-2 concise sentences to acknowledge or summarize key points.\n" ++ "Do not output NO_REPLY or an empty reply.\n" ++ "Do not fabricate facts beyond the provided transcript and recalled memories.\n" ++ "</ingest-reply-assist>",);- return;}- try {- const messages = event.messages;- const { texts: newTexts, newCount } = extractNewTurnTexts(messages, lastProcessedMsgCount);- lastProcessedMsgCount = messages.length;-- if (newTexts.length === 0) {- api.logger.info("memory-openviking: auto-capture skipped (no new user/assistant messages)");- return;- }-- // 合并当前轮的 user+assistant 为一个文本块- const turnText = newTexts.join("\n");+ }- // 对合并文本做 capture decision(主要检查长度和命令过滤)- const decision = getCaptureDecision(turnText, cfg.captureMode, cfg.captureMaxLength);- const preview = turnText.length > 80 ? `${turnText.slice(0, 80)}...` : turnText;- api.logger.info(- `memory-openviking: capture-check shouldCapture=${String(decision.shouldCapture)} reason=${decision.reason} newMsgCount=${newCount} text="${preview}"`,- );- if (!decision.shouldCapture) {- api.logger.info("memory-openviking: auto-capture skipped (capture decision rejected)");- return;- }+ if (prependContextParts.length > 0) {+ return {+ prependContext: prependContextParts.join("\n\n"),+ };+ }+ });+ api.on("agent_end", async (_event: unknown, ctx?: HookAgentContext) => {+ rememberSessionAgentId(ctx ?? {});+ });+ api.on("before_reset", async (_event: unknown, _ctx?: HookAgentContext) => {+ // Reserved hook registration for future memory flush/reset handling.+ });+ api.on("after_compaction", async (_event: unknown, _ctx?: HookAgentContext) => {+ // Reserved hook registration for future post-compaction memory integration.+ });- const c = await getClient();- const sessionId = await c.createSession();- try {- await c.addSessionMessage(sessionId, "user", decision.normalizedText);- // Force server to read session so storage (e.g. AGFS) sees the written messages before extract- await c.getSession(sessionId).catch(() => ({}));- const extracted = await c.extractSessionMemories(sessionId);- api.logger.info(- `memory-openviking: auto-captured ${newCount} new messages, extracted ${extracted.length} memories`,- );- api.logger.info(- `memory-openviking: capture-detail ${toJsonLog({- capturedCount: newCount,- captured: [trimForLog(turnText, 260)],- extractedCount: extracted.length,- extracted: summarizeExtractedMemories(extracted),- })}`,- );- if (extracted.length === 0) {- api.logger.warn(- "memory-openviking: auto-capture completed but extract returned 0 memories. Check OpenViking server logs for embedding/extract errors.",- );- }- } finally {- await c.deleteSession(sessionId).catch(() => {});- }- } catch (err) {- api.logger.warn(`memory-openviking: auto-capture failed: ${String(err)}`);- }- });+ if (typeof api.registerContextEngine === "function") {+ api.registerContextEngine(contextEnginePlugin.id, () =>+ createMemoryOpenVikingContextEngine({+ id: contextEnginePlugin.id,+ name: contextEnginePlugin.name,+ version: "0.1.0",+ cfg,+ logger: api.logger,+ getClient,+ resolveAgentId,+ }),+ );+ api.logger.info(+ "openviking: registered context-engine (before_prompt_build=auto-recall, afterTurn=auto-capture)",+ );+ } else {+ api.logger.warn(+ "openviking: registerContextEngine is unavailable; context-engine behavior will not run",+ );}api.registerService({- id: "memory-openviking",+ id: "openviking",start: async () => {- // Claim the pending entry — only the first start() call to claim it spawns the process.- // Subsequent start() calls (from other registrations sharing the same promise) fall through.- const pendingEntry = localClientPendingPromises.get(localCacheKey);- const isSpawner = cfg.mode === "local" && !!pendingEntry;- if (isSpawner) {- localClientPendingPromises.delete(localCacheKey);- resolveLocalClient = pendingEntry!.resolve;- rejectLocalClient = pendingEntry!.reject;- }- if (isSpawner) {+ if (cfg.mode === "local" && resolveLocalClient) {const timeoutMs = 60_000;const intervalMs = 500;@@ -641,7 +623,7 @@ const memoryPlugin = {: "";return `\n[openviking stderr]\n${truncated}${stderrChunks.join("\n")}`;};- child.on("error", (err: Error) => api.logger.warn(`memory-openviking: local server error: ${String(err)}`));+ child.on("error", (err: Error) => api.logger.warn(`openviking: local server error: ${String(err)}`));child.stderr?.on("data", (chunk: Buffer) => {const s = String(chunk).trim();pushStderrChunk(s);@@ -654,7 +636,7 @@ const memoryPlugin = {}if (code != null && code !== 0 || signal) {const out = formatStderrOutput();- api.logger.warn(`memory-openviking: subprocess exited (code=${code}, signal=${signal})${out}`);+ api.logger.warn(`openviking: subprocess exited (code=${code}, signal=${signal})${out}`);}});try {@@ -663,18 +645,16 @@ const memoryPlugin = {localClientCache.set(localCacheKey, { client, process: child });resolveLocalClient(client);rejectLocalClient = null;- localClientPendingPromises.delete(localCacheKey);api.logger.info(- `memory-openviking: local server started (${baseUrl}, config: ${cfg.configPath})`,+ `openviking: local server started (${baseUrl}, config: ${cfg.configPath})`,);} catch (err) {localProcess = null;child.kill("SIGTERM");- localClientPendingPromises.delete(localCacheKey);markLocalUnavailable("startup failed", err);if (stderrChunks.length) {api.logger.warn(- `memory-openviking: startup failed (health check timeout or error).${formatStderrOutput()}`,+ `openviking: startup failed (health check timeout or error).${formatStderrOutput()}`,);}throw err;@@ -682,23 +662,22 @@ const memoryPlugin = {} else {await (await getClient()).healthCheck().catch(() => {});api.logger.info(- `memory-openviking: initialized (url: ${cfg.baseUrl}, targetUri: ${cfg.targetUri}, search: hybrid endpoint)`,+ `openviking: initialized (url: ${cfg.baseUrl}, targetUri: ${cfg.targetUri}, search: hybrid endpoint)`,);}},stop: () => {- localClientPendingPromises.delete(localCacheKey);if (localProcess) {localProcess.kill("SIGTERM");localClientCache.delete(localCacheKey);localProcess = null;- api.logger.info("memory-openviking: local server stopped");+ api.logger.info("openviking: local server stopped");} else {- api.logger.info("memory-openviking: stopped");+ api.logger.info("openviking: stopped");}},});},};-export default memoryPlugin;+export default contextEnginePlugin;diff --git a/examples/openclaw-memory-plugin/install.ps1 b/examples/openclaw-plugin/install.ps1similarity index 91%rename from examples/openclaw-memory-plugin/install.ps1rename to examples/openclaw-plugin/install.ps1index 5f0aa488f..f7e84434a 100644--- a/examples/openclaw-memory-plugin/install.ps1+++ b/examples/openclaw-plugin/install.ps1@@ -36,7 +36,7 @@ $PipIndexUrl = if ($env:PIP_INDEX_URL) { $env:PIP_INDEX_URL } else { "https://py$HomeDir = if ($env:USERPROFILE) { $env:USERPROFILE } else { $HOME }$OpenClawDir = if ($Workdir) { $Workdir } else { Join-Path $HomeDir ".openclaw" }$OpenVikingDir = Join-Path $HomeDir ".openviking"-$PluginDest = Join-Path $OpenClawDir "extensions\memory-openviking"+$PluginDest = Join-Path $OpenClawDir "extensions\openviking"$SelectedMode = "local"$DefaultServerPort = 1933@@ -218,7 +218,7 @@ function Select-Workdir {Warn (T "Invalid selection, using default" "无效选择,使用默认")$script:OpenClawDir = $instances[0]}- $script:PluginDest = Join-Path $script:OpenClawDir "extensions\memory-openviking"+ $script:PluginDest = Join-Path $script:OpenClawDir "extensions\openviking"}}@@ -325,21 +325,22 @@ function Configure-OvConf {function Download-Plugin {$rawBase = "https://raw.githubusercontent.com/$Repo/$Branch"$files = @(- "examples/openclaw-memory-plugin/index.ts",- "examples/openclaw-memory-plugin/config.ts",- "examples/openclaw-memory-plugin/client.ts",- "examples/openclaw-memory-plugin/process-manager.ts",- "examples/openclaw-memory-plugin/memory-ranking.ts",- "examples/openclaw-memory-plugin/text-utils.ts",- "examples/openclaw-memory-plugin/openclaw.plugin.json",- "examples/openclaw-memory-plugin/package.json",- "examples/openclaw-memory-plugin/package-lock.json",- "examples/openclaw-memory-plugin/tsconfig.json",- "examples/openclaw-memory-plugin/.gitignore"+ "examples/openclaw-plugin/index.ts",+ "examples/openclaw-plugin/context-engine.ts",+ "examples/openclaw-plugin/config.ts",+ "examples/openclaw-plugin/client.ts",+ "examples/openclaw-plugin/process-manager.ts",+ "examples/openclaw-plugin/memory-ranking.ts",+ "examples/openclaw-plugin/text-utils.ts",+ "examples/openclaw-plugin/openclaw.plugin.json",+ "examples/openclaw-plugin/package.json",+ "examples/openclaw-plugin/package-lock.json",+ "examples/openclaw-plugin/tsconfig.json",+ "examples/openclaw-plugin/.gitignore")New-Item -ItemType Directory -Force -Path $PluginDest | Out-Null- Info (T "Downloading memory-openviking plugin..." "正在下载 memory-openviking 插件...")+ Info (T "Downloading openviking plugin..." "正在下载 openviking 插件...")Info ("{0} $Repo@$Branch" -f (T "Plugin source:" "插件来源:"))foreach ($rel in $files) {@@ -374,8 +375,9 @@ function Configure-OpenClawPlugin {try {# Enable plugin (files already deployed to extensions dir by Deploy-Plugin)- openclaw plugins enable memory-openviking+ openclaw plugins enable openvikingif ($LASTEXITCODE -ne 0) { throw "openclaw plugins enable failed (exit code $LASTEXITCODE)" }+ openclaw config set plugins.slots.contextEngine openviking# Set gateway modeopenclaw config set gateway.mode local@@ -383,17 +385,17 @@ function Configure-OpenClawPlugin {# Set plugin config for the selected modeif ($SelectedMode -eq "local") {$ovConfPath = Join-Path $OpenVikingDir "ov.conf"- openclaw config set plugins.entries.memory-openviking.config.mode local- openclaw config set plugins.entries.memory-openviking.config.configPath $ovConfPath- openclaw config set plugins.entries.memory-openviking.config.port $ServerPort+ openclaw config set plugins.entries.openviking.config.mode local+ openclaw config set plugins.entries.openviking.config.configPath $ovConfPath+ openclaw config set plugins.entries.openviking.config.port $ServerPort} else {- openclaw config set plugins.entries.memory-openviking.config.mode remote- openclaw config set plugins.entries.memory-openviking.config.baseUrl $RemoteBaseUrl+ openclaw config set plugins.entries.openviking.config.mode remote+ openclaw config set plugins.entries.openviking.config.baseUrl $RemoteBaseUrlif ($RemoteApiKey) {- openclaw config set plugins.entries.memory-openviking.config.apiKey $RemoteApiKey+ openclaw config set plugins.entries.openviking.config.apiKey $RemoteApiKey}if ($RemoteAgentId) {- openclaw config set plugins.entries.memory-openviking.config.agentId $RemoteAgentId+ openclaw config set plugins.entries.openviking.config.agentId $RemoteAgentId}}diff --git a/examples/openclaw-memory-plugin/install.sh b/examples/openclaw-plugin/install.shsimilarity index 92%rename from examples/openclaw-memory-plugin/install.shrename to examples/openclaw-plugin/install.shindex 7421e8d8b..425d7686a 100755--- a/examples/openclaw-memory-plugin/install.sh+++ b/examples/openclaw-plugin/install.sh@@ -1,7 +1,7 @@#!/bin/bash## OpenClaw + OpenViking one-click installer-# Usage: curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-memory-plugin/install.sh | bash+# Usage: curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash## Environment variables:# REPO=owner/repo - GitHub repository (default: volcengine/OpenViking)@@ -36,7 +36,7 @@ PIP_INDEX_URL="${PIP_INDEX_URL:-https://pypi.tuna.tsinghua.edu.cn/simple}"HOME_DIR="${HOME:-$USERPROFILE}"OPENCLAW_DIR="${HOME_DIR}/.openclaw"OPENVIKING_DIR="${HOME_DIR}/.openviking"-PLUGIN_DEST="${OPENCLAW_DIR}/extensions/memory-openviking"+PLUGIN_DEST="${OPENCLAW_DIR}/extensions/openviking"DEFAULT_SERVER_PORT=1933DEFAULT_AGFS_PORT=1833DEFAULT_VLM_MODEL="doubao-seed-2-0-pro-260215"@@ -50,7 +50,7 @@ _expect_workdir=""for arg in "$@"; doif [[ -n "$_expect_workdir" ]]; thenOPENCLAW_DIR="$arg"- PLUGIN_DEST="${OPENCLAW_DIR}/extensions/memory-openviking"+ PLUGIN_DEST="${OPENCLAW_DIR}/extensions/openviking"_expect_workdir=""continuefi@@ -181,7 +181,7 @@ select_workdir() {elseOPENCLAW_DIR="${instances[0]}"fi- PLUGIN_DEST="${OPENCLAW_DIR}/extensions/memory-openviking"+ PLUGIN_DEST="${OPENCLAW_DIR}/extensions/openviking"fi}@@ -291,7 +291,7 @@ print_install_hints() {fibold "$(tr "After installation, rerun this script." "安装完成后,请重新运行本脚本。")"- bold "$(tr "See details: https://github.com/${REPO}/blob/${BRANCH}/examples/openclaw-memory-plugin/INSTALL.md" "详细说明见: https://github.com/${REPO}/blob/${BRANCH}/examples/openclaw-memory-plugin/INSTALL-ZH.md")"+ bold "$(tr "See details: https://github.com/${REPO}/blob/${BRANCH}/examples/openclaw-plugin/INSTALL.md" "详细说明见: https://github.com/${REPO}/blob/${BRANCH}/examples/openclaw-plugin/INSTALL-ZH.md")"echo ""exit 1}@@ -560,23 +560,24 @@ EOFdownload_plugin() {local gh_raw="https://raw.githubusercontent.com/${REPO}/${BRANCH}"local files=(- "examples/openclaw-memory-plugin/index.ts"- "examples/openclaw-memory-plugin/config.ts"- "examples/openclaw-memory-plugin/client.ts"- "examples/openclaw-memory-plugin/process-manager.ts"- "examples/openclaw-memory-plugin/memory-ranking.ts"- "examples/openclaw-memory-plugin/text-utils.ts"- "examples/openclaw-memory-plugin/openclaw.plugin.json"- "examples/openclaw-memory-plugin/package.json"- "examples/openclaw-memory-plugin/package-lock.json"- "examples/openclaw-memory-plugin/tsconfig.json"- "examples/openclaw-memory-plugin/.gitignore"+ "examples/openclaw-plugin/index.ts"+ "examples/openclaw-plugin/context-engine.ts"+ "examples/openclaw-plugin/config.ts"+ "examples/openclaw-plugin/client.ts"+ "examples/openclaw-plugin/process-manager.ts"+ "examples/openclaw-plugin/memory-ranking.ts"+ "examples/openclaw-plugin/text-utils.ts"+ "examples/openclaw-plugin/openclaw.plugin.json"+ "examples/openclaw-plugin/package.json"+ "examples/openclaw-plugin/package-lock.json"+ "examples/openclaw-plugin/tsconfig.json"+ "examples/openclaw-plugin/.gitignore")local total=${#files[@]}local i=0mkdir -p "${PLUGIN_DEST}"- info "$(tr "Downloading memory-openviking plugin from ${REPO}@${BRANCH} (${total} files)..." "正在从 ${REPO}@${BRANCH} 下载 memory-openviking 插件(共 ${total} 个文件)...")"+ info "$(tr "Downloading openviking plugin from ${REPO}@${BRANCH} (${total} files)..." "正在从 ${REPO}@${BRANCH} 下载 openviking 插件(共 ${total} 个文件)...")"local max_retries=3for rel in "${files[@]}"; doi=$((i + 1))@@ -621,7 +622,8 @@ configure_openclaw_plugin() {fi# Enable plugin (files already deployed to extensions dir by deploy_plugin)- "${oc_env[@]}" openclaw plugins enable memory-openviking || { err "$(tr "openclaw plugins enable failed" "openclaw 插件启用失败")"; exit 1; }+ "${oc_env[@]}" openclaw plugins enable openviking || { err "$(tr "openclaw plugins enable failed" "openclaw 插件启用失败")"; exit 1; }+ "${oc_env[@]}" openclaw config set plugins.slots.contextEngine openviking# Set gateway mode"${oc_env[@]}" openclaw config set gateway.mode local@@ -629,17 +631,17 @@ configure_openclaw_plugin() {# Set plugin config for the selected modeif [[ "$SELECTED_MODE" == "local" ]]; thenlocal ov_conf_path="${OPENVIKING_DIR}/ov.conf"- "${oc_env[@]}" openclaw config set plugins.entries.memory-openviking.config.mode local- "${oc_env[@]}" openclaw config set plugins.entries.memory-openviking.config.configPath "${ov_conf_path}"- "${oc_env[@]}" openclaw config set plugins.entries.memory-openviking.config.port "${SELECTED_SERVER_PORT}"+ "${oc_env[@]}" openclaw config set plugins.entries.openviking.config.mode local+ "${oc_env[@]}" openclaw config set plugins.entries.openviking.config.configPath "${ov_conf_path}"+ "${oc_env[@]}" openclaw config set plugins.entries.openviking.config.port "${SELECTED_SERVER_PORT}"else- "${oc_env[@]}" openclaw config set plugins.entries.memory-openviking.config.mode remote- "${oc_env[@]}" openclaw config set plugins.entries.memory-openviking.config.baseUrl "${remote_base_url}"+ "${oc_env[@]}" openclaw config set plugins.entries.openviking.config.mode remote+ "${oc_env[@]}" openclaw config set plugins.entries.openviking.config.baseUrl "${remote_base_url}"if [[ -n "${remote_api_key}" ]]; then- "${oc_env[@]}" openclaw config set plugins.entries.memory-openviking.config.apiKey "${remote_api_key}"+ "${oc_env[@]}" openclaw config set plugins.entries.openviking.config.apiKey "${remote_api_key}"fiif [[ -n "${remote_agent_id}" ]]; then- "${oc_env[@]}" openclaw config set plugins.entries.memory-openviking.config.agentId "${remote_agent_id}"+ "${oc_env[@]}" openclaw config set plugins.entries.openviking.config.agentId "${remote_agent_id}"fifidiff --git a/examples/openclaw-memory-plugin/memory-ranking.ts b/examples/openclaw-plugin/memory-ranking.tssimilarity index 100%rename from examples/openclaw-memory-plugin/memory-ranking.tsrename to examples/openclaw-plugin/memory-ranking.tsdiff --git a/examples/openclaw-memory-plugin/openclaw.plugin.json b/examples/openclaw-plugin/openclaw.plugin.jsonsimilarity index 98%rename from examples/openclaw-memory-plugin/openclaw.plugin.jsonrename to examples/openclaw-plugin/openclaw.plugin.jsonindex 85e18ac85..ce8ee78b6 100644--- a/examples/openclaw-memory-plugin/openclaw.plugin.json+++ b/examples/openclaw-plugin/openclaw.plugin.json@@ -1,6 +1,6 @@{- "id": "memory-openviking",- "kind": "memory",+ "id": "openviking",+ "kind": "context-engine","uiHints": {"mode": {"label": "Mode",diff --git a/examples/openclaw-memory-plugin/package-lock.json b/examples/openclaw-plugin/package-lock.jsonsimilarity index 93%rename from examples/openclaw-memory-plugin/package-lock.jsonrename to examples/openclaw-plugin/package-lock.jsonindex 01bb6870c..624797df3 100644--- a/examples/openclaw-memory-plugin/package-lock.json+++ b/examples/openclaw-plugin/package-lock.json@@ -1,11 +1,11 @@{- "name": "@openclaw/memory-openviking",+ "name": "@openclaw/openviking","version": "2026.2.6-3","lockfileVersion": 3,"requires": true,"packages": {"": {- "name": "@openclaw/memory-openviking",+ "name": "@openclaw/openviking","version": "2026.2.6-3","dependencies": {"@sinclair/typebox": "0.34.48"diff --git a/examples/openclaw-memory-plugin/package.json b/examples/openclaw-plugin/package.jsonsimilarity index 89%rename from examples/openclaw-memory-plugin/package.jsonrename to examples/openclaw-plugin/package.jsonindex 790ae6bce..60bb946a3 100644--- a/examples/openclaw-memory-plugin/package.json+++ b/examples/openclaw-plugin/package.json@@ -1,5 +1,5 @@{- "name": "@openclaw/memory-openviking",+ "name": "@openclaw/openviking","version": "2026.2.6-3","description": "OpenClaw OpenViking-backed long-term memory plugin (install to ~/.openclaw/extensions)","type": "module",diff --git a/examples/openclaw-memory-plugin/process-manager.ts b/examples/openclaw-plugin/process-manager.tssimilarity index 92%rename from examples/openclaw-memory-plugin/process-manager.tsrename to examples/openclaw-plugin/process-manager.tsindex 7a4f36379..5ea090d2d 100644--- a/examples/openclaw-memory-plugin/process-manager.ts+++ b/examples/openclaw-plugin/process-manager.ts@@ -151,7 +151,7 @@ export async function prepareLocalPort(): Promise<number> {const isOpenViking = await quickHealthCheck(`http://127.0.0.1:${port}`, 2000);if (isOpenViking) {- logger.info?.(`memory-openviking: killing stale OpenViking on port ${port}`);+ logger.info?.(`openviking: killing stale OpenViking on port ${port}`);await killProcessOnPort(port, logger);return port;}@@ -162,17 +162,17 @@ export async function prepareLocalPort(}// Port occupied by non-OpenViking process — find next free port- logger.warn?.(`memory-openviking: port ${port} is occupied by another process, searching for a free port...`);+ logger.warn?.(`openviking: port ${port} is occupied by another process, searching for a free port...`);for (let candidate = port + 1; candidate <= port + maxRetries; candidate++) {if (candidate > 65535) break;const taken = await quickTcpProbe("127.0.0.1", candidate, 300);if (!taken) {- logger.info?.(`memory-openviking: using free port ${candidate} instead of ${port}`);+ logger.info?.(`openviking: using free port ${candidate} instead of ${port}`);return candidate;}}throw new Error(- `memory-openviking: port ${port} is occupied and no free port found in range ${port + 1}-${port + maxRetries}`,+ `openviking: port ${port} is occupied and no free port found in range ${port + 1}-${port + maxRetries}`,);}@@ -194,7 +194,7 @@ async function killProcessOnPortWin(port: number, logger: ProcessLogger): Promis}for (const pid of pids) {if (pid > 0) {- logger.info?.(`memory-openviking: killing pid ${pid} on port ${port}`);+ logger.info?.(`openviking: killing pid ${pid} on port ${port}`);try { execSync(`taskkill /PID ${pid} /F`, { shell: "cmd.exe" }); } catch { /* already gone */ }}}@@ -225,7 +225,7 @@ async function killProcessOnPortUnix(port: number, logger: ProcessLogger): Promi} catch { /* ss not available */ }}for (const pid of pids) {- logger.info?.(`memory-openviking: killing pid ${pid} on port ${port}`);+ logger.info?.(`openviking: killing pid ${pid} on port ${port}`);try { process.kill(pid, "SIGKILL"); } catch { /* already gone */ }}if (pids.length) await new Promise((r) => setTimeout(r, 500));@@ -286,7 +286,7 @@ export function resolvePythonCommand(logger: ProcessLogger): string {if (pythonCmd === defaultPy) {logger.info?.(- `memory-openviking: 未解析到 ${defaultPy} 路径,将用 "${defaultPy}"。若 openviking 在自定义 Python 下,请设置 OPENVIKING_PYTHON` ++ `openviking: 未解析到 ${defaultPy} 路径,将用 "${defaultPy}"。若 openviking 在自定义 Python 下,请设置 OPENVIKING_PYTHON` +(IS_WIN ? ' 或 call "%USERPROFILE%\\.openclaw\\openviking.env.bat"' : " 或 source ~/.openclaw/openviking.env"),);}diff --git a/examples/openclaw-memory-plugin/setup-helper/install.js b/examples/openclaw-plugin/setup-helper/install.jssimilarity index 94%rename from examples/openclaw-memory-plugin/setup-helper/install.jsrename to examples/openclaw-plugin/setup-helper/install.jsindex 2d196ca49..719595fd2 100644--- a/examples/openclaw-memory-plugin/setup-helper/install.js+++ b/examples/openclaw-plugin/setup-helper/install.js@@ -42,7 +42,7 @@ const HOME = process.env.HOME || process.env.USERPROFILE || "";const DEFAULT_OPENCLAW_DIR = join(HOME, ".openclaw");let OPENCLAW_DIR = DEFAULT_OPENCLAW_DIR;-let PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "memory-openviking");+let PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "openviking");const OPENVIKING_DIR = join(HOME, ".openviking");@@ -52,19 +52,20 @@ const DEFAULT_VLM_MODEL = "doubao-seed-2-0-pro-260215";const DEFAULT_EMBED_MODEL = "doubao-embedding-vision-251215";const REQUIRED_PLUGIN_FILES = [- "examples/openclaw-memory-plugin/index.ts",- "examples/openclaw-memory-plugin/config.ts",- "examples/openclaw-memory-plugin/openclaw.plugin.json",- "examples/openclaw-memory-plugin/package.json",- "examples/openclaw-memory-plugin/package-lock.json",- "examples/openclaw-memory-plugin/.gitignore",+ "examples/openclaw-plugin/index.ts",+ "examples/openclaw-plugin/context-engine.ts",+ "examples/openclaw-plugin/config.ts",+ "examples/openclaw-plugin/openclaw.plugin.json",+ "examples/openclaw-plugin/package.json",+ "examples/openclaw-plugin/package-lock.json",+ "examples/openclaw-plugin/.gitignore",];const OPTIONAL_PLUGIN_FILES = [- "examples/openclaw-memory-plugin/client.ts",- "examples/openclaw-memory-plugin/process-manager.ts",- "examples/openclaw-memory-plugin/memory-ranking.ts",- "examples/openclaw-memory-plugin/text-utils.ts",+ "examples/openclaw-plugin/client.ts",+ "examples/openclaw-plugin/process-manager.ts",+ "examples/openclaw-plugin/memory-ranking.ts",+ "examples/openclaw-plugin/text-utils.ts",];let installYes = process.env.OPENVIKING_INSTALL_YES === "1";@@ -120,7 +121,7 @@ const OPENVIKING_PIP_SPEC = openvikingVersion ? `openviking==${openvikingVersionfunction setOpenClawDir(dir) {OPENCLAW_DIR = dir;- PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "memory-openviking");+ PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "openviking");}function printHelp() {@@ -627,7 +628,7 @@ async function downloadPlugin() {...OPTIONAL_PLUGIN_FILES.map((relPath) => ({ relPath, required: false })),];- info(tr(`Downloading memory-openviking plugin from ${REPO}@${BRANCH}...`, `正在从 ${REPO}@${BRANCH} 下载 memory-openviking 插件...`));+ info(tr(`Downloading openviking plugin from ${REPO}@${BRANCH}...`, `正在从 ${REPO}@${BRANCH} 下载 openviking 插件...`));for (let i = 0; i < files.length; i++) {const file = files[i];await downloadPluginFile(file.relPath, file.required, i + 1, files.length);@@ -649,8 +650,9 @@ async function configureOpenClawPlugin(pluginPath = PLUGIN_DEST) {const oc = (args) => runCapture("openclaw", args, { env: ocEnv, shell: IS_WIN });// Enable plugin (files already deployed to extensions dir by deployPlugin)- const enableResult = await oc(["plugins", "enable", "memory-openviking"]);+ const enableResult = await oc(["plugins", "enable", "openviking"]);if (enableResult.code !== 0) throw new Error(`openclaw plugins enable failed (exit code ${enableResult.code})`);+ await oc(["config", "set", "plugins.slots.contextEngine", "openviking"]);// Set gateway modeawait oc(["config", "set", "gateway.mode", "local"]);@@ -658,17 +660,17 @@ async function configureOpenClawPlugin(pluginPath = PLUGIN_DEST) {// Set plugin config for the selected modeif (selectedMode === "local") {const ovConfPath = join(OPENVIKING_DIR, "ov.conf");- await oc(["config", "set", "plugins.entries.memory-openviking.config.mode", "local"]);- await oc(["config", "set", "plugins.entries.memory-openviking.config.configPath", ovConfPath]);- await oc(["config", "set", "plugins.entries.memory-openviking.config.port", String(selectedServerPort)]);+ await oc(["config", "set", "plugins.entries.openviking.config.mode", "local"]);+ await oc(["config", "set", "plugins.entries.openviking.config.configPath", ovConfPath]);+ await oc(["config", "set", "plugins.entries.openviking.config.port", String(selectedServerPort)]);} else {- await oc(["config", "set", "plugins.entries.memory-openviking.config.mode", "remote"]);- await oc(["config", "set", "plugins.entries.memory-openviking.config.baseUrl", remoteBaseUrl]);+ await oc(["config", "set", "plugins.entries.openviking.config.mode", "remote"]);+ await oc(["config", "set", "plugins.entries.openviking.config.baseUrl", remoteBaseUrl]);if (remoteApiKey) {- await oc(["config", "set", "plugins.entries.memory-openviking.config.apiKey", remoteApiKey]);+ await oc(["config", "set", "plugins.entries.openviking.config.apiKey", remoteApiKey]);}if (remoteAgentId) {- await oc(["config", "set", "plugins.entries.memory-openviking.config.agentId", remoteAgentId]);+ await oc(["config", "set", "plugins.entries.openviking.config.agentId", remoteAgentId]);}}@@ -761,7 +763,7 @@ async function main() {}let pluginPath;- const localPluginDir = openvikingRepo ? join(openvikingRepo, "examples", "openclaw-memory-plugin") : "";+ const localPluginDir = openvikingRepo ? join(openvikingRepo, "examples", "openclaw-plugin") : "";if (openvikingRepo && existsSync(join(localPluginDir, "index.ts"))) {pluginPath = localPluginDir;info(tr(`Using local plugin from repo: ${pluginPath}`, `使用仓库内插件: ${pluginPath}`));diff --git a/examples/openclaw-memory-plugin/setup-helper/package.json b/examples/openclaw-plugin/setup-helper/package.jsonsimilarity index 91%rename from examples/openclaw-memory-plugin/setup-helper/package.jsonrename to examples/openclaw-plugin/setup-helper/package.jsonindex ad5aa2502..f205d34d5 100644--- a/examples/openclaw-memory-plugin/setup-helper/package.json+++ b/examples/openclaw-plugin/setup-helper/package.json@@ -21,7 +21,7 @@"repository": {"type": "git","url": "git+https://github.com/volcengine/OpenViking.git",- "directory": "examples/openclaw-memory-plugin/setup-helper"+ "directory": "examples/openclaw-plugin/setup-helper"},"files": ["install.js"diff --git a/examples/openclaw-memory-plugin/skills/install-openviking-memory/SKILL.md b/examples/openclaw-plugin/skills/install-openviking-memory/SKILL.mdsimilarity index 87%rename from examples/openclaw-memory-plugin/skills/install-openviking-memory/SKILL.mdrename to examples/openclaw-plugin/skills/install-openviking-memory/SKILL.mdindex 545e2a0b8..011cd7848 100644--- a/examples/openclaw-memory-plugin/skills/install-openviking-memory/SKILL.md+++ b/examples/openclaw-plugin/skills/install-openviking-memory/SKILL.md@@ -7,10 +7,10 @@ description: OpenViking long-term memory plugin guide. Once installed, the plugi## How It Works-- **Auto-Capture**: At the end of a conversation, automatically extracts memories from user messages+- **Auto-Capture**: At `afterTurn` (end of one user turn run), automatically extracts memories from user/assistant messages- `semantic` mode: captures all qualifying user text, relying on OpenViking's extraction pipeline to filter- `keyword` mode: only captures text matching trigger words (e.g. "remember", "preference", etc.)-- **Auto-Recall**: Before a conversation starts, automatically searches for relevant memories and injects them into context+- **Auto-Recall**: At `before_prompt_build`, automatically searches for relevant memories and injects them into context## Available Tools@@ -83,12 +83,13 @@ openclaw gateway# Check statusopenclaw status+openclaw config get plugins.slots.contextEngine# Disable memory-openclaw config set plugins.slots.memory none+openclaw config set plugins.slots.contextEngine legacy# Enable memory-openclaw config set plugins.slots.memory memory-openviking+openclaw config set plugins.slots.contextEngine openviking```Restart the gateway after changing the slot.@@ -102,7 +103,7 @@ If you have multiple OpenClaw instances, use `--workdir` to target a specific oncurl -fsSL ... | bash -s -- --workdir ~/.openclaw-openclaw-second# Setup helper-npx ./examples/openclaw-memory-plugin/setup-helper --workdir ~/.openclaw-openclaw-second+npx ./examples/openclaw-plugin/setup-helper --workdir ~/.openclaw-openclaw-second# Manual config (prefix openclaw commands)OPENCLAW_STATE_DIR=~/.openclaw-openclaw-second openclaw config set ...@@ -113,6 +114,6 @@ OPENCLAW_STATE_DIR=~/.openclaw-openclaw-second openclaw config set ...| Symptom | Cause | Fix ||---------|-------|-----|| `extracted 0 memories` | Wrong API Key or model name | Check `api_key` and `model` in `ov.conf` |-| `port occupied` | Port used by another process | Change port: `openclaw config set plugins.entries.memory-openviking.config.port 1934` |+| `port occupied` | Port used by another process | Change port: `openclaw config set plugins.entries.openviking.config.port 1934` || Plugin not loaded | Env file not sourced or slot not configured | Check `openclaw status` output || Inaccurate recall | recallScoreThreshold too low | Increase threshold or adjust recallLimit |diff --git a/examples/openclaw-memory-plugin/text-utils.ts b/examples/openclaw-plugin/text-utils.tssimilarity index 100%rename from examples/openclaw-memory-plugin/text-utils.tsrename to examples/openclaw-plugin/text-utils.tsdiff --git a/examples/openclaw-memory-plugin/tsconfig.json b/examples/openclaw-plugin/tsconfig.jsonsimilarity index 100%rename from examples/openclaw-memory-plugin/tsconfig.jsonrename to examples/openclaw-plugin/tsconfig.json