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
fix(openclaw): make peer scope optional again and default to none (#4546)
Zayn Jarvis58139b46ad8f
diff --git a/docs/en/agent-integrations/03-openclaw.md b/docs/en/agent-integrations/03-openclaw.mdindex 7566d7cd2..cd269e020 100644--- a/docs/en/agent-integrations/03-openclaw.md+++ b/docs/en/agent-integrations/03-openclaw.md@@ -53,12 +53,35 @@ Key parameters:| `--plugin-version=VER` | Plugin version: npm version, dist-tag, or Git ref || `--base-url URL` | OpenViking server URL || `--api-key KEY` | OpenViking API key |+| `--peer-role ROLE` | Memory scope: `none`, `assistant`, or `sender` (`person` is a legacy alias) || `--uninstall` | Uninstall the plugin |Full parameter list in the [install guide](https://github.com/volcengine/OpenViking/blob/main/examples/openclaw-plugin/INSTALL.md).</details>+## Choose the Memory Scope++`peer_role` decides whether long-term memory is shared at the OpenViking user level or attributed to a concrete peer:++| Value | Memory layout | Use case |+| --- | --- | --- |+| `none` (default) | Shared memory at `viking://user/<user_id>/memories/...`; no peer-specific memory subtree is used | General-purpose setup where all conversations for this OpenViking user share user-level memory |+| `assistant` | Assistant-attributed peer memory at `viking://user/<user_id>/peers/<assistant_id>/memories/...` | **Human as OpenViking user**: separate the peer memories of assistants such as `main` and `research` |+| `sender` | Sender-attributed peer memory at `viking://user/<user_id>/peers/<sender_id>/memories/...` | **Agent as OpenViking user**: separate the peer memories of senders such as `customer-42` and `customer-99` |++For example:++```bash+# Alice is the OpenViking user; separate memories by OpenClaw assistant.+openclaw openviking setup --base-url http://your-server:1933 --api-key sk-xxx --peer-role assistant --json++# support-agent is the OpenViking user; separate memories by human sender.+openclaw openviking setup --base-url http://your-server:1933 --api-key sk-xxx --peer-role sender --json+```++New configuration should use `sender`; existing `peer_role=person` configurations remain compatible and are treated as `sender`. OpenViking initializes the managed `peers/` container for every user, so `none` means that no concrete `peers/<peer_id>/memories` subtree is used. Actor-peer recall includes shared user memory plus the current peer memory, and changing the scope does not move existing memories.+## Verify```bash@@ -96,6 +119,7 @@ Plugin config lives under `plugins.entries.openviking.config`. Setup usually wri| --- | --- | --- || `baseUrl` | `http://127.0.0.1:1933` | OpenViking server endpoint || `apiKey` | empty | OpenViking API key |+| `peer_role` | `none` | `none`, `assistant`, or `sender`; legacy `person` is accepted as `sender` || `peer_prefix` | empty | Optional prefix for assistant peer identity when `peer_role=assistant` || `autoRecallTimeoutMs` | `5000` | Outer timeout (ms) for the whole auto-recall flow; increase for slow local embedding hardware (clamped 1000–300000) |diff --git a/docs/en/agent-integrations/16-capability-reference.md b/docs/en/agent-integrations/16-capability-reference.mdindex ce7002dd4..fcf2febbf 100644--- a/docs/en/agent-integrations/16-capability-reference.md+++ b/docs/en/agent-integrations/16-capability-reference.md@@ -229,7 +229,7 @@ To give a directory that is not a repository its own peer under claude-code or c**Migration** (no user action required): The pre-git peer id is a pure function of the cwd, so the client can always recompute it locally and recall still reaches memories written under it. Under the default `peer_scope: "all"`, the server's existing cross-peer sweep already covers it at zero cost; under `peer_scope: "actor"`, the plugin asks that peer separately and appends whatever it returns. There is no deadline on this.-For `openclaw`, the peer is derived from `peer_role`/`peer_prefix` (note that if `peer_role=person`, sender information must be available, otherwise tool calls will fail). The `hermes` peer defaults to `OPENVIKING_AGENT` (defaulting to `hermes`).+For `openclaw`, the peer is derived from `peer_role`/`peer_prefix` (note that if `peer_role=sender`, sender information must be available, otherwise tool calls will fail; legacy `person` is accepted as an alias). The `hermes` peer defaults to `OPENVIKING_AGENT` (defaulting to `hermes`).### 3.1.4 Configuration layersdiff --git a/docs/zh/agent-integrations/03-openclaw.md b/docs/zh/agent-integrations/03-openclaw.mdindex 6799d394f..a2c1141a7 100644--- a/docs/zh/agent-integrations/03-openclaw.md+++ b/docs/zh/agent-integrations/03-openclaw.md@@ -53,12 +53,35 @@ ov-install --base-url http://your-server:1933| `--plugin-version=VER` | 插件版本:npm 版本、dist-tag 或 Git ref || `--base-url URL` | OpenViking 服务地址 || `--api-key KEY` | OpenViking API Key |+| `--peer-role ROLE` | 记忆归属:`none`、`assistant` 或 `sender`(`person` 是旧别名) || `--uninstall` | 卸载插件 |完整参数列表见 [安装指南](https://github.com/volcengine/OpenViking/blob/main/examples/openclaw-plugin/INSTALL.md)。</details>+## 选择记忆归属++`peer_role` 决定长期记忆是在 OpenViking user 层共享,还是归属到具体 peer:++| 值 | 记忆路径 | 适用场景 |+| --- | --- | --- |+| `none`(默认) | 共享记忆位于 `viking://user/<user_id>/memories/...`;不使用具体 peer 的记忆子树 | 通用场景:该 OpenViking 用户下的所有对话共享 user-level 记忆 |+| `assistant` | assistant 归因的 peer 记忆位于 `viking://user/<user_id>/peers/<assistant_id>/memories/...` | **人是 OpenViking user**:让 `main`、`research` 等不同助手的 peer 记忆分开 |+| `sender` | sender 归因的 peer 记忆位于 `viking://user/<user_id>/peers/<sender_id>/memories/...` | **Agent 是 OpenViking user**:让 `customer-42`、`customer-99` 等不同发送者的 peer 记忆分开 |++例如:++```bash+# Alice 是 OpenViking user;按 OpenClaw 助手分开 peer 记忆。+openclaw openviking setup --base-url http://your-server:1933 --api-key sk-xxx --peer-role assistant --json++# support-agent 是 OpenViking user;按给它发消息的人分开 peer 记忆。+openclaw openviking setup --base-url http://your-server:1933 --api-key sk-xxx --peer-role sender --json+```++新配置请使用 `sender`;已有的 `peer_role=person` 配置仍兼容,并按 `sender` 处理。OpenViking 会为每个用户初始化受管的 `peers/` 容器,因此 `none` 的含义是不使用具体的 `peers/<peer_id>/memories` 子树。Actor-peer 召回同时包含用户共享记忆和当前 peer 记忆;切换 scope 不会搬迁已有记忆。+## 验证```bash@@ -96,6 +119,7 @@ python examples/openclaw-plugin/health_check_tools/ov-healthcheck.py| --- | --- | --- || `baseUrl` | `http://127.0.0.1:1933` | OpenViking 服务端点 || `apiKey` | 空 | OpenViking API Key |+| `peer_role` | `none` | `none`、`assistant` 或 `sender`;旧值 `person` 作为 `sender` 的别名兼容 || `peer_prefix` | 空 | `peer_role=assistant` 时 assistant peer 身份的可选前缀 || `autoRecallTimeoutMs` | `5000` | 整个 auto-recall 流程的外层超时(毫秒);本地嵌入硬件较慢时可调大(取值范围 1000–300000) |diff --git a/docs/zh/agent-integrations/16-capability-reference.md b/docs/zh/agent-integrations/16-capability-reference.mdindex 7aecd4884..d94ca98ee 100644--- a/docs/zh/agent-integrations/16-capability-reference.md+++ b/docs/zh/agent-integrations/16-capability-reference.md@@ -231,7 +231,7 @@ per-harness 章节(档案卡)只写差异;所有共享事实均在本章**迁移**(无需用户操作):旧 peer id 是 cwd 的纯函数,客户端随时可以本地重算,召回仍能覆盖到写在它名下的记忆。默认 `peer_scope: "all"` 下,服务端本就有的跨 peer 扫描零成本地把它包含在内;`peer_scope: "actor"` 下插件会另外向该 peer 发一次召回并拼接结果。此事没有截止期限。-openclaw 的 peer 由 `peer_role`/`peer_prefix` 推导(`peer_role=person` 时需保证 sender 信息可用,否则工具调用报错);hermes 的 peer 就是 `OPENVIKING_AGENT`(默认 `hermes`)。+openclaw 的 peer 由 `peer_role`/`peer_prefix` 推导(`peer_role=sender` 时需保证 sender 信息可用,否则工具调用报错;旧值 `person` 作为别名兼容);hermes 的 peer 就是 `OPENVIKING_AGENT`(默认 `hermes`)。### 3.1.4 配置体系分层diff --git a/examples/openclaw-plugin/INSTALL-AGENT.md b/examples/openclaw-plugin/INSTALL-AGENT.mdindex a20fc2d5f..527078fd3 100644--- a/examples/openclaw-plugin/INSTALL-AGENT.md+++ b/examples/openclaw-plugin/INSTALL-AGENT.md@@ -42,6 +42,7 @@ Before setup, determine:| --- | --- | --- || OpenViking base URL | Yes | Ask user or read `OPENVIKING_BASE_URL` || API key | Usually | Ask user or read `OPENVIKING_API_KEY` |+| Memory scope | Optional; default `none` | Ask whether memory is shared, separated by assistant, or separated by sender. Use `sender`; accept legacy `person` as an alias. || Account ID | Only for root API keys | Ask user if setup reports root-key tenant context is needed || User ID | Only for root API keys | Ask user if setup reports root-key tenant context is needed || Slot replacement approval | Only if another context engine owns the slot | Ask user before using `--force-slot` |@@ -73,6 +74,23 @@ Run setup with `--json` whenever possible:openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json```+Choose memory scope before building that command:++| Value | Concrete layout | Use when |+| --- | --- | --- |+| `none` (default; omit the flag) | Shared `viking://user/<user_id>/memories/...`; no concrete peer memory subtree | General case |+| `assistant` | Assistant-attributed peer memory under `.../peers/<assistant_id>/memories/...` | A human is the OpenViking user and uses multiple OpenClaw assistants |+| `sender` | Sender-attributed peer memory under `.../peers/<sender_id>/memories/...` | An agent is the OpenViking user and receives messages from multiple humans |++`person` is a legacy alias for `sender`. Accept it from existing config or user input, but write `sender` in new setup commands. OpenViking initializes the managed `peers/` container for every user; `none` only means that no concrete `peers/<peer_id>/memories` subtree is used. Actor-peer recall includes shared user memory plus the current peer memory, and changing the scope does not move existing memories.++Examples:++```bash+openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-role assistant --json+openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-role sender --json+```+Branch on the result:| JSON result | Meaning | Agent action |@@ -96,10 +114,10 @@ openclaw openviking setup \--json```-Custom agent routing prefix (optional; only when the user explicitly requests a prefix):+Custom assistant routing prefix (optional; only with `peer_role=assistant` and when the user explicitly requests a prefix):```bash-openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-prefix <PREFIX> --json+openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-role assistant --peer-prefix <PREFIX> --json```Slot replacement retry, only after user approval:@@ -139,6 +157,7 @@ Also inspect:| `health.version` | Records server version || `health.compatibility` | Determines whether to warn || `config.hasApiKey` | Confirms whether an API key was saved |+| `config.peer_role` | Confirms `none`, `assistant`, or canonical `sender` scope || `config.peer_prefix` | Confirms configured peer prefix when present |## Environment Detection@@ -267,7 +286,8 @@ Core fields:| `mode` | Legacy compatibility field. Expected value: `remote`. || `baseUrl` | OpenViking HTTP endpoint || `apiKey` | OpenViking API key |-| `peer_prefix` | Optional; prefix for OpenClaw agent IDs when set. Interactive setup accepts only letters, digits, `_`, and `-`. If unset, the plugin follows session agent IDs. |+| `peer_role` | `none` (shared user memory), `assistant` (`peers/<assistant_id>`), or `sender` (`peers/<sender_id>`). Legacy `person` is accepted as `sender`. |+| `peer_prefix` | Optional only with `peer_role=assistant`; prefix for OpenClaw agent IDs. Interactive setup accepts only letters, digits, `_`, and `-`. If unset, the plugin follows session agent IDs. || `accountId` | Required for root API keys || `userId` | Required for root API keys |@@ -329,7 +349,8 @@ Existing config fields are preserved during migration. The new plugin reads old- `baseUrl`- `apiKey`-- `peer_prefix`: optional; interactive setup accepts only letters, digits, `_`, and `-`+- `peer_role`: optional; `none`, `assistant`, or `sender`; legacy `person` is accepted as `sender`+- `peer_prefix`: optional only with `peer_role=assistant`; interactive setup accepts only letters, digits, `_`, and `-`## Backup Path: ov-installdiff --git a/examples/openclaw-plugin/INSTALL-ZH.md b/examples/openclaw-plugin/INSTALL-ZH.mdindex 271d539a6..995d179cb 100644--- a/examples/openclaw-plugin/INSTALL-ZH.md+++ b/examples/openclaw-plugin/INSTALL-ZH.md@@ -197,12 +197,30 @@ openclaw openviking setup \openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --force-slot --json```-如需给默认 assistant peer 路由增加前缀,可以额外传:+根据 OpenViking user 代表谁来选择 `--peer-role`:++| 值 | 存储示例 | 适用场景 |+| --- | --- | --- |+| `none`(默认) | `viking://user/alice/memories/...` | 该 OpenViking 用户下的所有对话共享 user-level 记忆,不使用具体 peer 的记忆子树。 |+| `assistant` | `viking://user/alice/peers/main/memories/...` | OpenViking user 代表人,并希望把 assistant 归因的 peer 记忆按不同 OpenClaw 助手分开。 |+| `sender` | `viking://user/support-agent/peers/customer-42/memories/...` | OpenViking user 代表 agent,并希望把 sender 归因的 peer 记忆按不同发送者分开。 |++`person` 仍作为 `sender` 的旧配置别名被兼容;新配置请使用 `sender`。++例如,让每个助手使用独立的 peer 记忆,并可选给 assistant id 加前缀:```bashopenclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-role assistant --peer-prefix <PREFIX> --json```+如果 OpenViking user 是 agent,按给它发消息的 sender 分开 peer 记忆:++```bash+openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-role sender --json+```++OpenViking 会为每个用户初始化受管的 `peers/` 容器。`none` 表示插件不创建、也不路由到具体的 `peers/<peer_id>/memories` 子树。Actor-peer 召回同时包含用户共享记忆和当前 peer 记忆;切换配置不会搬迁已有记忆。+#### 无法执行 CLI 时直接配置文件如果容器内无法执行 `openclaw` CLI,可以把以下字段合并到 OpenClaw 实际读取的配置文件。设置了 `OPENCLAW_CONFIG_PATH` 时使用该路径;否则通常是 `$OPENCLAW_STATE_DIR/openclaw.json`(默认 `~/.openclaw/openclaw.json`)。@@ -300,7 +318,7 @@ plugins.entries.openviking.config| `mode` | `remote` | 兼容旧配置的字段。当前只支持 remote。 || `baseUrl` | `http://127.0.0.1:1933` | OpenViking HTTP 地址 || `apiKey` | 空 | OpenViking API key |-| `peer_role` | `assistant` | Peer 身份模式:`none`、`assistant` 或 `person`。Session message 使用 body `peer_id`;数据面 recall/search 使用 `X-OpenViking-Actor-Peer`。 |+| `peer_role` | `none` | 记忆归属:`none`(共享 `viking://user/<user_id>/memories`)、`assistant`(`.../peers/<assistant_id>/memories`)或 `sender`(`.../peers/<sender_id>/memories`)。旧值 `person` 作为 `sender` 的别名兼容。Session message 使用 body `peer_id`;数据面 recall/search 使用 `X-OpenViking-Actor-Peer`。 || `peer_prefix` | 空 | `peer_role=assistant` 时 assistant `peer_id` / actor peer 值的可选前缀。 || `accountId` | 空 | 使用 root API key 时需要 || `userId` | 空 | 使用 root API key 时需要 |@@ -325,7 +343,7 @@ openclaw config get plugins.entries.openviking.config| --- | --- | --- || `baseUrl` | `http://127.0.0.1:1933` | 远端 OpenViking 服务地址 || `apiKey` | 空 | 远端 OpenViking API Key;服务端未开启认证时可不填 |-| `peer_role` | `assistant` | Peer 身份模式:`none`、`assistant` 或 `person`;session message 使用 body `peer_id`,数据面 recall/search 使用 `X-OpenViking-Actor-Peer` |+| `peer_role` | `none` | 记忆归属:`none`、`assistant` 或 `sender`;旧值 `person` 作为 `sender` 的别名兼容。Session message 使用 body `peer_id`,数据面 recall/search 使用 `X-OpenViking-Actor-Peer` || `peer_prefix` | 空 | `peer_role=assistant` 时 assistant `peer_id` / actor peer 值的可选前缀 |常见设置:@@ -387,7 +405,7 @@ ov-install| `--current-version` | 查看 helper 记录的当前版本 || `--base-url URL` | OpenViking 服务器地址(启用非交互模式) || `--api-key KEY` | OpenViking API key |-| `--peer-role ROLE` | Peer role:`none`、`assistant` 或 `person` |+| `--peer-role ROLE` | 记忆归属:`none`、`assistant` 或 `sender`;旧值 `person` 作为 `sender` 的别名兼容 || `--peer-prefix PREFIX` | assistant `peer_id` / actor peer 值的前缀 || `--update` | 更新 helper 管理的安装 |diff --git a/examples/openclaw-plugin/INSTALL.md b/examples/openclaw-plugin/INSTALL.mdindex 2aea1d7b6..ac8893f6a 100644--- a/examples/openclaw-plugin/INSTALL.md+++ b/examples/openclaw-plugin/INSTALL.md@@ -141,12 +141,30 @@ If another context engine already owns the slot, setup will not replace it by deopenclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --force-slot --json```-If you want assistant messages to carry a prefixed `peer_id` and data-plane recall/search requests to use the matching actor peer view, pass a prefix explicitly:+Choose `--peer-role` from what the OpenViking user represents:++| Value | Storage example | Use when |+| --- | --- | --- |+| `none` (default) | `viking://user/alice/memories/...` | All conversations for this OpenViking user share user-level memory. No peer-specific memory subtree is used. |+| `assistant` | `viking://user/alice/peers/main/memories/...` | The OpenViking user is a human and assistant-attributed peer memory should be separated by OpenClaw assistant. |+| `sender` | `viking://user/support-agent/peers/customer-42/memories/...` | The OpenViking user is an agent and sender-attributed peer memory should be separated by human sender. |++`person` is still accepted as a legacy alias for `sender`. New configuration should use `sender`.++For example, give each assistant its own peer memory and optionally namespace the assistant id:```bashopenclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-role assistant --peer-prefix <PREFIX> --json```+Or scope peer memory by the sender talking to an agent:++```bash+openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --peer-role sender --json+```++OpenViking initializes the managed `peers/` container for every user. `none` means the plugin does not create or route into a concrete `peers/<peer_id>/memories` subtree. Actor-peer recall includes shared user memory plus the current peer memory, and changing the setting does not move existing memories.+#### Configure The File Directly When The CLI Is UnavailableIf the `openclaw` CLI cannot run inside the container, merge the following fields into the config file that OpenClaw actually reads. Use `OPENCLAW_CONFIG_PATH` when it is set; otherwise the file is usually `$OPENCLAW_STATE_DIR/openclaw.json` (default: `~/.openclaw/openclaw.json`).@@ -244,7 +262,7 @@ Core fields:| `mode` | `remote` | Legacy compatibility field. Only remote mode is supported. || `baseUrl` | `http://127.0.0.1:1933` | OpenViking HTTP endpoint || `apiKey` | empty | OpenViking API key |-| `peer_role` | `assistant` | Peer identity mode: `none`, `assistant`, or `person`. Session messages use body `peer_id`; data-plane recall/search uses `X-OpenViking-Actor-Peer`. |+| `peer_role` | `none` | Memory scope: `none` (shared `viking://user/<user_id>/memories`), `assistant` (`.../peers/<assistant_id>/memories`), or `sender` (`.../peers/<sender_id>/memories`). Legacy `person` is accepted as `sender`. Session messages use body `peer_id`; data-plane recall/search uses `X-OpenViking-Actor-Peer`. || `peer_prefix` | empty | Optional prefix for assistant `peer_id` / actor peer values when `peer_role=assistant`. || `accountId` | empty | Required when using a root API key || `userId` | empty | Required when using a root API key |@@ -311,7 +329,7 @@ Useful backup/source flags:| `--current-version` | Print the version tracked by the helper || `--base-url URL` | OpenViking server URL (enables non-interactive mode) || `--api-key KEY` | OpenViking API key |-| `--peer-role ROLE` | Peer role: `none`, `assistant`, or `person` |+| `--peer-role ROLE` | Memory scope: `none`, `assistant`, or `sender`; legacy `person` is accepted as `sender` || `--peer-prefix PREFIX` | Prefix for assistant `peer_id` / actor peer values || `--update` | Update an existing helper-managed install |@@ -356,7 +374,7 @@ The plugin connects to an existing remote OpenViking server.| --- | --- | --- || `baseUrl` | `http://127.0.0.1:1933` | Remote OpenViking HTTP endpoint || `apiKey` | empty | Optional OpenViking API key |-| `peer_role` | `assistant` | Peer identity mode: `none`, `assistant`, or `person`; session messages use body `peer_id`, while data-plane recall/search uses `X-OpenViking-Actor-Peer` |+| `peer_role` | `none` | Memory scope: `none`, `assistant`, or `sender`; legacy `person` is accepted as `sender`. Session messages use body `peer_id`, while data-plane recall/search uses `X-OpenViking-Actor-Peer` || `peer_prefix` | empty | Optional prefix for assistant `peer_id` / actor peer values when `peer_role=assistant` |Common settings:diff --git a/examples/openclaw-plugin/README.md b/examples/openclaw-plugin/README.mdindex fbcab2878..f84feee85 100644--- a/examples/openclaw-plugin/README.md+++ b/examples/openclaw-plugin/README.md@@ -124,15 +124,26 @@ The main rules are:- reuse `sessionId` directly when it is already a UUID- prefer `sessionKey` when deriving a stable `ovSessionId`- normalize unsafe path characters, or fall back to a stable SHA-256 when needed-- `peer_role=assistant` is the default and writes assistant messages with `peer_id=<sessionAgent>`; if `peer_prefix` is set, the value becomes `<peer_prefix>_<sessionAgent>`-- `peer_role=none` disables peer message attribution and actor-peer routing-- `peer_role=person` writes user messages with `peer_id` derived from OpenClaw sender identity; assistant messages do not get `peer_id`-- data-plane recall/search/read/import/delete sends the same resolved peer identity as `X-OpenViking-Actor-Peer` when `peer_role` is `assistant` or `person`+- `peer_role=none` is the default: messages have no peer attribution and memory stays in the shared user scope, for example `viking://user/alice/memories/...`; no peer-specific memory subtree is used+- `peer_role=assistant` writes assistant messages with `peer_id=<sessionAgent>` and uses peer-scoped memory such as `viking://user/alice/peers/main/memories/...`; if `peer_prefix` is set, the peer id becomes `<peer_prefix>_<sessionAgent>`+- `peer_role=sender` writes user messages with the OpenClaw sender identity as `peer_id` and uses peer-scoped memory such as `viking://user/support-agent/peers/customer-42/memories/...`; assistant messages do not get `peer_id`+- `person` remains accepted as a legacy config alias for `sender`, but new configuration and documentation use `sender`+- data-plane recall/search/read/import/delete sends the same resolved peer identity as `X-OpenViking-Actor-Peer` when `peer_role` is `assistant` or `sender`- when OpenClaw does not provide a session agent, use its default agent `main` for local session and assistant peer metadata- only add `X-OpenViking-Account` / `X-OpenViking-User` when `accountId` / `userId` are explicitly configuredThis matters because OpenViking tenant identity is account/user-scoped, while OpenClaw agent identity is runtime metadata.+Choose the scope from what `viking://user/<user_id>` represents:++| Model | Example | Result |+| --- | --- | --- |+| General/shared (`none`) | `user_id=alice` uses any OpenClaw assistant | Shared user memory under `viking://user/alice/memories/...` |+| Human is the OpenViking user (`assistant`) | Alice uses OpenClaw assistants `main` and `research` | Assistant-scoped memories are separated under `.../peers/main/memories/...` and `.../peers/research/memories/...` |+| Agent is the OpenViking user (`sender`) | `user_id=support-agent` receives messages from `customer-42` and `customer-99` | Sender-scoped memories are separated under `.../peers/customer-42/memories/...` and `.../peers/customer-99/memories/...` |++OpenViking creates the managed `peers/` container as part of the user namespace. `none` means that the plugin does not create or route into a specific `peers/<peer_id>/memories` subtree. With `assistant` or `sender`, actor-peer recall includes the shared user memory plus the current peer's memory; changing the setting does not move existing memories.+The recommended remote-mode configuration only needs:- `baseUrl`@@ -143,7 +154,7 @@ The recommended remote-mode configuration only needs:In this setup:- `apiKey` should usually be a user key-- new installs default to `peer_role=assistant`+- new installs default to `peer_role=none`- `accountId` / `userId` are advanced options only when the deployment needs explicit identity headers, such as root-key or trusted-server flows### User namespacediff --git a/examples/openclaw-plugin/README_CN.md b/examples/openclaw-plugin/README_CN.mdindex 4c6ee0ed0..6d72cc258 100644--- a/examples/openclaw-plugin/README_CN.md+++ b/examples/openclaw-plugin/README_CN.md@@ -152,15 +152,26 @@ openclaw config get plugins.slots.contextEngine # 应输出:openviking- `sessionId` 是 UUID 时直接复用。- `sessionKey` 存在时优先用它生成稳定的 `ovSessionId`。- 非安全路径字符会被规整或退化成稳定的 SHA-256。-- `peer_role=assistant` 是默认值,assistant message 写入 `peer_id=<sessionAgent>`;如果配置了 `peer_prefix`,则写入 `<peer_prefix>_<sessionAgent>`。-- `peer_role=none` 会关闭 peer message 归因和 actor-peer 路由。-- `peer_role=person` 时,user message 使用 OpenClaw sender 身份派生 `peer_id`;assistant message 不写 `peer_id`。-- 数据面的 recall/search/read/import/delete 会在 `peer_role=assistant` 或 `peer_role=person` 时把同一个解析后的 peer 身份作为 `X-OpenViking-Actor-Peer` 发送。+- `peer_role=none` 是默认值:消息不写 peer 归因,记忆留在用户共享空间,例如 `viking://user/alice/memories/...`;不使用具体 peer 的记忆子树。+- `peer_role=assistant` 会让 assistant message 写入 `peer_id=<sessionAgent>`,并使用例如 `viking://user/alice/peers/main/memories/...` 的 peer 记忆;如果配置了 `peer_prefix`,peer id 为 `<peer_prefix>_<sessionAgent>`。+- `peer_role=sender` 会让 user message 用 OpenClaw sender 身份派生 `peer_id`,并使用例如 `viking://user/support-agent/peers/customer-42/memories/...` 的 peer 记忆;assistant message 不写 `peer_id`。+- `person` 仍作为 `sender` 的旧配置别名被兼容;新配置和文档统一使用 `sender`。+- 数据面的 recall/search/read/import/delete 会在 `peer_role=assistant` 或 `peer_role=sender` 时把同一个解析后的 peer 身份作为 `X-OpenViking-Actor-Peer` 发送。- OpenClaw 没有提供 session agent 时,使用其默认 agent `main` 作为本地 session 和 assistant peer metadata。- 只有显式配置了 `accountId` / `userId` 时才发送 `X-OpenViking-Account` / `X-OpenViking-User`。这样做是因为 OpenViking 的租户身份是 account/user 级,OpenClaw agent 身份只作为运行时 metadata 使用。+选择 scope 时,先看 `viking://user/<user_id>` 代表谁:++| 模型 | 案例 | 结果 |+| --- | --- | --- |+| 通用/共享(`none`) | `user_id=alice` 使用任意 OpenClaw 助手 | 共享用户记忆位于 `viking://user/alice/memories/...` |+| 人是 OpenViking user(`assistant`) | Alice 同时使用 `main` 和 `research` 两个 OpenClaw 助手 | 助手 peer 记忆分别位于 `.../peers/main/memories/...` 和 `.../peers/research/memories/...` |+| Agent 是 OpenViking user(`sender`) | `user_id=support-agent` 接收 `customer-42` 和 `customer-99` 的消息 | 发送者 peer 记忆分别位于 `.../peers/customer-42/memories/...` 和 `.../peers/customer-99/memories/...` |++OpenViking 会把受管的 `peers/` 容器作为用户 namespace 的一部分初始化。`none` 表示插件不创建、也不路由到具体的 `peers/<peer_id>/memories` 子树。使用 `assistant` 或 `sender` 时,actor-peer 召回同时包含用户共享记忆和当前 peer 记忆;切换配置不会搬迁已有记忆。+默认推荐的远程模式配置只有:- `baseUrl`@@ -171,7 +182,7 @@ openclaw config get plugins.slots.contextEngine # 应输出:openviking其中:- `apiKey` 推荐使用某个 user 的 user key-- 新安装默认 `peer_role=assistant`+- 新安装默认 `peer_role=none`- `accountId` / `userId` 仅在部署需要显式身份 header 时作为高级选项使用,例如 root key 或 trusted server 流程### User namespacediff --git a/examples/openclaw-plugin/commands/setup.ts b/examples/openclaw-plugin/commands/setup.tsindex 576c642a5..b9d64f7b8 100644--- a/examples/openclaw-plugin/commands/setup.ts+++ b/examples/openclaw-plugin/commands/setup.ts@@ -84,8 +84,8 @@ const CONFIG_KEYS_TO_PRESERVE = ["logFindRequests",] as const;-type PeerRole = "none" | "assistant" | "person";-const DEFAULT_SETUP_PEER_ROLE: PeerRole = "assistant";+type PeerRole = "none" | "assistant" | "sender";+const DEFAULT_SETUP_PEER_ROLE: PeerRole = "none";type RecallTargetType = "resource" | "user" | "agent";const ALLOWED_RECALL_TARGET_TYPES = ["resource", "user", "agent"] as const;@@ -126,7 +126,8 @@ function isValidPeerPrefixInput(value: string): boolean {function normalizePeerRole(value: unknown): PeerRole | undefined {if (typeof value !== "string") return undefined;const role = value.trim().toLowerCase();- if (role === "none" || role === "assistant" || role === "person") return role;+ if (role === "person") return "sender";+ if (role === "none" || role === "assistant" || role === "sender") return role;return undefined;}@@ -147,7 +148,7 @@ function resolveSetupPeerRole(value: unknown): PeerRole {if (value === undefined) return DEFAULT_SETUP_PEER_ROLE;const role = normalizePeerRole(value);if (role) return role;- throw new Error('peer_role must be "none", "assistant", or "person"');+ throw new Error('peer_role must be "none", "assistant", or "sender" (legacy alias: "person")');}function normalizeSetupRecallTargetTypes(value: unknown): RecallTargetType[] | undefined {@@ -206,9 +207,20 @@ async function askPeerRole(q: (prompt: string, def?: string) => Promise<string>,defaultValue: PeerRole,): Promise<PeerRole> {+ console.log(+ ` ${tr(+ zh,+ "Memory scope — none (default): viking://user/<user_id>/memories, shared across all conversations; " ++ "assistant: viking://user/<user_id>/peers/<assistant_id>/memories; " ++ "sender: viking://user/<user_id>/peers/<sender_id>/memories (legacy alias: person).",+ "记忆归属 —— none(默认):viking://user/<user_id>/memories,所有对话共享;" ++ "assistant:viking://user/<user_id>/peers/<assistant_id>/memories;" ++ "sender:viking://user/<user_id>/peers/<sender_id>/memories(兼容旧值 person)。",+ )}`,+ );while (true) {const value = await q(- tr(zh, "Peer Role (none/assistant/person)", "Peer Role(none/assistant/person)"),+ tr(zh, "Memory scope (none/assistant/sender)", "记忆归属(none/assistant/sender)"),defaultValue,);const role = normalizePeerRole(value);@@ -216,8 +228,8 @@ async function askPeerRole(console.log(` ✗ ${tr(zh,- 'Peer Role must be "none", "assistant", or "person".',- 'Peer Role 必须是 "none"、"assistant" 或 "person"。',+ 'Memory scope must be "none", "assistant", or "sender" (legacy "person" is also accepted).',+ '记忆归属必须是 "none"、"assistant" 或 "sender"(也兼容旧值 "person")。',)}`,);}@@ -605,7 +617,7 @@ export function registerSetupCli(api: any): void {.option("--zh", "Chinese prompts").option("--base-url <url>", "OpenViking server URL (enables non-interactive mode)").option("--api-key <key>", "API key for authentication")- .option("--peer-role <role>", "Peer ID role: none, assistant, or person")+ .option("--peer-role <role>", "Memory scope: none (shared), assistant (per assistant), or sender (per sender); person is a legacy alias").option("--peer-prefix <prefix>", "Prefix for assistant peer_id values").option("--account-id <id>", "Account ID (required for root API keys)").option("--user-id <id>", "User ID (required for root API keys)")@@ -1182,6 +1194,8 @@ async function setupRemote(export const __test__ = {isLegacyLocalMode,isValidPeerPrefixInput,+ normalizePeerRole,+ resolveSetupPeerRole,normalizeSetupRecallTargetTypes,activateContextEngineSlot,isContextEngineSlotActive,diff --git a/examples/openclaw-plugin/config.ts b/examples/openclaw-plugin/config.tsindex fa4c2fdac..5c70f8c90 100644--- a/examples/openclaw-plugin/config.ts+++ b/examples/openclaw-plugin/config.ts@@ -30,7 +30,8 @@ export type OpenVikingSecretRef =export type MemoryOpenVikingConfig = {mode?: "remote";baseUrl?: string;- peer_role?: "none" | "assistant" | "person";+ /** `person` is a legacy alias for `sender`. */+ peer_role?: "none" | "assistant" | "sender" | "person";peer_prefix?: string;apiKey?: string | OpenVikingSecretRef;/** Optional HTTP headers merged into every OpenViking request. */@@ -127,10 +128,12 @@ export type MemoryOpenVikingConfig = {/** Runtime config after memoryOpenVikingConfigSchema.parse() has applied defaults. */export type ParsedMemoryOpenVikingConfig = Required<- Omit<MemoryOpenVikingConfig, "agentExperience" | "recallTargetTypes" | "apiKey">+ Omit<MemoryOpenVikingConfig, "agentExperience" | "recallTargetTypes" | "apiKey" | "peer_role">> & {/** parse() resolves SecretRef values, so the runtime shape is always a plain string. */apiKey: string;+ /** Runtime uses the canonical name; legacy `person` input normalizes to `sender`. */+ peer_role: "none" | "assistant" | "sender";agentExperience: Required<NonNullable<MemoryOpenVikingConfig["agentExperience"]>>;recallTargetTypes: Array<"resource" | "user" | "agent">;};@@ -152,7 +155,7 @@ const DEFAULT_COMMIT_TOKEN_THRESHOLD_RATIO = 0.5;const DEFAULT_COMMIT_KEEP_RECENT_COUNT = 10;const DEFAULT_BYPASS_SESSION_PATTERNS: string[] = [];const DEFAULT_EMIT_STANDARD_DIAGNOSTICS = false;-const DEFAULT_PEER_ROLE = "assistant" as const;+const DEFAULT_PEER_ROLE = "none" as const;const DEFAULT_PEER_PREFIX = "";const DEFAULT_TRACE_RECALL_DIR = "~/.openclaw/openviking/recall-traces";const DEFAULT_TRACE_RECALL_RETENTION_DAYS = 14;@@ -292,16 +295,23 @@ function resolveSecret(}}-function resolvePeerRole(configured: unknown) {+function resolvePeerRole(configured: unknown): "none" | "assistant" | "sender" {if (typeof configured === "string") {const role = configured.trim().toLowerCase();- if (role === "none" || role === "assistant" || role === "person") {+ if (role === "none" || role === "assistant" || role === "sender") {return role;}- throw new Error(`openviking peer_role must be "none", "assistant", or "person"`);+ if (role === "person") {+ return "sender";+ }+ throw new Error(+ `openviking peer_role must be "none", "assistant", or "sender" (legacy alias: "person")`,+ );}if (configured !== undefined) {- throw new Error(`openviking peer_role must be "none", "assistant", or "person"`);+ throw new Error(+ `openviking peer_role must be "none", "assistant", or "sender" (legacy alias: "person")`,+ );}return DEFAULT_PEER_ROLE;}@@ -776,14 +786,17 @@ export const memoryOpenVikingConfigSchema = {help: "HTTP URL when mode is remote (or use ${OPENVIKING_BASE_URL})",},peer_role: {- label: "Peer Role",+ label: "Memory Scope (peer_role)",placeholder: DEFAULT_PEER_ROLE,- help: 'Controls which session messages get peer_id: "none", "assistant", or "person".',+ help:+ 'Where peer-scoped memories are stored. "none" (default): viking://user/<user_id>/memories. ' ++ '"assistant": viking://user/<user_id>/peers/<assistant_id>/memories. ' ++ '"sender": viking://user/<user_id>/peers/<sender_id>/memories. Legacy "person" is accepted as "sender".',},peer_prefix: {label: "Peer Prefix",placeholder: "optional-prefix",- help: "Optional prefix applied to assistant peer_id values derived from OpenClaw runtime agent IDs.",+ help: 'Only used when Memory Scope is "assistant". Prefix added to the peer id derived from the OpenClaw agent id.',},apiKey: {label: "OpenViking API Key",diff --git a/examples/openclaw-plugin/docs/openviking-openclaw-plugin-guide.md b/examples/openclaw-plugin/docs/openviking-openclaw-plugin-guide.mdindex a44e3e2c4..5b3a1ec85 100644--- a/examples/openclaw-plugin/docs/openviking-openclaw-plugin-guide.md+++ b/examples/openclaw-plugin/docs/openviking-openclaw-plugin-guide.md@@ -715,6 +715,7 @@ openclaw config get plugins.slots.contextEngine| `apiKey` | 环境变量或空 | OpenViking API Key || `accountId` | 空 | Root key/trusted 部署需要 || `userId` | 空 | Root key/trusted 部署需要 |+| `peer_role` | `none` | 记忆归属:`none`、`assistant` 或 `sender`;旧值 `person` 作为 `sender` 的别名兼容 || `peer_prefix` | 空 | Peer 路由前缀;非空时形成 `<prefix>_<ctx.agentId>` || `targetUri` | `viking://user/memories` | 默认 memory search 目标 || `timeoutMs` | `15000` | HTTP 请求超时 |@@ -748,6 +749,16 @@ openclaw config get plugins.slots.contextEngine环境变量解析逻辑在 `config.ts:139`、`config.ts:147`。+`peer_role` 决定 `viking://user/<user_id>` 下是否按交互对象建立 peer 记忆:++| 值 | 归因与路径 | 案例 |+| --- | --- | --- |+| `none`(默认) | user / assistant message 都不写 `peer_id`;新增长期记忆位于 `viking://user/<user_id>/memories/...` | 通用场景,所有对话共享 user-level 记忆 |+| `assistant` | assistant message 写入 `peer_id=<assistant_id>`;助手归因记忆位于 `.../peers/<assistant_id>/memories/...` | **人是 OpenViking user**:Alice 使用 `main` 和 `research` 两个助手,分别使用 `.../peers/main/...` 和 `.../peers/research/...` |+| `sender` | user message 写入 `peer_id=<sender_id>`;发送者归因记忆位于 `.../peers/<sender_id>/memories/...` | **Agent 是 OpenViking user**:`support-agent` 面向 `customer-42` 和 `customer-99`,将两人的 peer 记忆分开 |++`person` 是 `sender` 的旧别名;新配置统一使用 `sender`。OpenViking 会为每个用户初始化受管的 `peers/` 容器,`none` 只表示不使用具体的 `peers/<peer_id>/memories` 子树。在 peer 模式下,共享/自身记忆仍位于用户根记忆目录,召回范围是共享记忆 + 当前 peer 记忆,不包含其他 peer。切换 scope 不会搬迁已有记忆。Session 路径不受影响,始终位于 `viking://user/<user_id>/sessions/<session_id>`。+### 9.1 搜索 / 召回相关配置总表如果你关注的是“插件里的搜索能力可以怎么从外部设定”,可以按下面这张表看。这里的“搜索”包括三类:@@ -762,7 +773,7 @@ openclaw config get plugins.slots.contextEngine| `apiKey` | 所有搜索/召回请求 | 空 | 是 | 是 | `OPENVIKING_API_KEY` | HTTP 认证 key;不配通常只能访问关闭认证的本地服务:`config.ts:202` || `accountId` | 多租户搜索路由 | 空 | 是 | 是 | `OPENVIKING_ACCOUNT_ID` | Root key / trusted 部署下显式指定 account,影响搜索命中空间:`config.ts:212` || `userId` | 多租户搜索路由 | 空 | 是 | 是 | `OPENVIKING_USER_ID` | Root key / trusted 部署下显式指定 user,影响 user memory 检索范围:`config.ts:216` |-| `peer_role` | session peer 归因和 actor-peer 路由 | `assistant` | 是 | 安装脚本/setup 参数支持 | `OPENVIKING_PEER_ROLE`(安装脚本写入 setup 参数) | `none` 关闭 peer 路由;`assistant` 使用 runtime agent;`person` 使用 sender 身份 |+| `peer_role` | session peer 归因和 actor-peer 路由 | `none` | 是 | 安装脚本/setup 参数支持 | `OPENVIKING_PEER_ROLE`(安装脚本写入 setup 参数) | `none` 使用共享 user memory(默认);`assistant` 用 runtime agent 归因到 `peers/<assistant_id>`;`sender` 用 sender 身份归因到 `peers/<sender_id>`;旧值 `person` 等价于 `sender` || `peer_prefix` | assistant peer 前缀 | 空 | 是 | 间接支持 | 可通过配置值写 `${ENV}` | 非空时拼成 `<prefix>_<ctx.agentId>`,用于 assistant `peer_id` 与 `X-OpenViking-Actor-Peer` || `targetUri` | `memory_recall` / `memory_forget` 默认搜索范围 | `viking://user/memories` | 是 | 否 | — | 未显式传 `targetUri` 时的默认 memory 搜索位置:`config.ts:275`、`index.ts:1366` || `timeoutMs` | 所有搜索/读取请求超时 | `15000` | 是 | 否 | — | 控制 context search、`find/read/grep/session` 等 HTTP 请求超时:`config.ts:276` |@@ -794,7 +805,7 @@ openclaw config get plugins.slots.contextEngine| `OPENVIKING_API_KEY` | `apiKey` | 指定 OpenViking API key || `OPENVIKING_ACCOUNT_ID` | `accountId` | 指定租户 account || `OPENVIKING_USER_ID` | `userId` | 指定租户 user |-| `OPENVIKING_PEER_ROLE` | `peer_role` | 安装脚本/setup 写入的 peer 身份模式 |+| `OPENVIKING_PEER_ROLE` | `peer_role` | 安装脚本/setup 写入的记忆归属(`none` / `assistant` / `sender`;兼容旧值 `person`) || `OPENVIKING_PEER_PREFIX` | `peer_prefix` | 安装脚本/setup 写入的 assistant peer 前缀 || `OPENVIKING_RECALL_RESOURCES` | `recallResources` | 是否把 resources 纳入自动召回和默认 memory_recall || `OPENVIKING_LOG_ROUTING` | `logFindRequests` | 打开检索/路由日志 |diff --git a/examples/openclaw-plugin/docs/openviking-plugin-reference.md b/examples/openclaw-plugin/docs/openviking-plugin-reference.mdindex a421eb43e..b744b9572 100644--- a/examples/openclaw-plugin/docs/openviking-plugin-reference.md+++ b/examples/openclaw-plugin/docs/openviking-plugin-reference.md@@ -75,7 +75,7 @@ $OPENCLAW_STATE_DIR/openclaw.json| 参数 | 类型 | 默认值 | 环境变量 | 说明 || --- | --- | --- | --- | --- |-| `peer_role` | `"none"` \| `"assistant"` \| `"person"` | `assistant` | — | Peer 身份模式。Session message 使用 body `peer_id`;数据面 recall/search 使用 `X-OpenViking-Actor-Peer`。 |+| `peer_role` | `"none"` \| `"assistant"` \| `"sender"` \| `"person"` (legacy) | `none` | — | 记忆归属。`none`:共享 `viking://user/<user_id>/memories`(默认);`assistant`:assistant 归因记忆位于 `.../peers/<assistant_id>/memories`;`sender`:sender 归因记忆位于 `.../peers/<sender_id>/memories`。旧值 `person` 作为 `sender` 的别名兼容。Session message 使用 body `peer_id`;数据面 recall/search 使用 `X-OpenViking-Actor-Peer`。 || `peer_prefix` | string | 空 | — | `peer_role=assistant` 时 assistant `peer_id` / actor peer 值的可选前缀。交互式 setup 仅允许字母、数字、`_`、`-`。 |### 3.3 自动捕获与提交@@ -231,6 +231,7 @@ openclaw openviking setup [options]| `--zh` | 使用中文提示。 || `--base-url <url>` | OpenViking Server URL。传入后进入非交互模式。 || `--api-key <key>` | API Key。 |+| `--peer-role <role>` | 记忆归属:`none`、`assistant` 或 `sender`;旧值 `person` 作为 `sender` 的别名兼容。 || `--peer-prefix <prefix>` | Peer 路由前缀。 || `--account-id <id>` | Root API Key 场景下的 Account ID。 || `--user-id <id>` | Root API Key 场景下的 User ID。 |diff --git a/examples/openclaw-plugin/openclaw.plugin.json b/examples/openclaw-plugin/openclaw.plugin.jsonindex 7a3d29684..c7e78efd1 100644--- a/examples/openclaw-plugin/openclaw.plugin.json+++ b/examples/openclaw-plugin/openclaw.plugin.json@@ -80,14 +80,14 @@"help": "HTTP URL when mode is remote (or ${OPENVIKING_BASE_URL})"},"peer_role": {- "label": "Peer Role",- "placeholder": "assistant",- "help": "Controls which messages include peer_id: none, assistant, or person. New installs default to assistant."+ "label": "Memory Scope (peer_role)",+ "placeholder": "none",+ "help": "Where peer-scoped memories are stored. none (default): viking://user/<user_id>/memories. assistant: viking://user/<user_id>/peers/<assistant_id>/memories. sender: viking://user/<user_id>/peers/<sender_id>/memories. Legacy person is accepted as sender."},"peer_prefix": {"label": "Peer Prefix","placeholder": "optional-prefix",- "help": "Optional prefix for assistant peer_id values derived from OpenClaw runtime agent IDs."+ "help": "Only used when Memory Scope is assistant. Prefix added to the peer id derived from the OpenClaw agent id."},"apiKey": {"label": "OpenViking API Key",@@ -279,10 +279,11 @@"enum": ["none","assistant",+ "sender","person"],- "default": "assistant",- "description": "Controls which session messages include peer_id."+ "default": "none",+ "description": "Memory scope. none: shared user memory. assistant: peer memory keyed by OpenClaw assistant id. sender: peer memory keyed by sender id. person is a legacy alias for sender. Also controls which session messages include peer_id."},"peer_prefix": {"type": "string",diff --git a/examples/openclaw-plugin/plugin/openviking-client-runtime.ts b/examples/openclaw-plugin/plugin/openviking-client-runtime.tsindex 5ebbed654..71a259e0f 100644--- a/examples/openclaw-plugin/plugin/openviking-client-runtime.ts+++ b/examples/openclaw-plugin/plugin/openviking-client-runtime.ts@@ -9,7 +9,7 @@ type Logger = {type ClientRuntimeConfig = {baseUrl: string;apiKey: string;- peer_role: "none" | "assistant" | "person";+ peer_role: "none" | "assistant" | "sender";peer_prefix: string;timeoutMs: number;accountId?: string;diff --git a/examples/openclaw-plugin/plugin/openviking-memory-tools.ts b/examples/openclaw-plugin/plugin/openviking-memory-tools.tsindex bfa7e64b9..c8cc6ea7f 100644--- a/examples/openclaw-plugin/plugin/openviking-memory-tools.ts+++ b/examples/openclaw-plugin/plugin/openviking-memory-tools.ts@@ -114,7 +114,7 @@ export function registerOpenVikingMemoryTools(deps: OpenVikingMemoryToolsDeps):const peerId = resolveOpenVikingMessagePeerId({peerRole: deps.peerRole,role,- personPeerId: session.actorPeerId,+ senderPeerId: session.actorPeerId,assistantPeerId: session.actorPeerId,});await client.addSessionMessage(diff --git a/examples/openclaw-plugin/plugin/openviking-session-routing-runtime.ts b/examples/openclaw-plugin/plugin/openviking-session-routing-runtime.tsindex f6b8cd4ef..767bb85e1 100644--- a/examples/openclaw-plugin/plugin/openviking-session-routing-runtime.ts+++ b/examples/openclaw-plugin/plugin/openviking-session-routing-runtime.ts@@ -34,7 +34,7 @@ export function createOpenVikingSessionRoutingRuntime(options: {logFindRequests: boolean;logger: Logger;}) {- const peerRole = options.peerRole ?? "assistant";+ const peerRole = options.peerRole ?? "none";const sessionAgentResolver = createSessionAgentResolver(options.peerPrefix);const rememberSessionAgentId = (ctx: SessionAgentLookup) => {@@ -97,7 +97,7 @@ export function createOpenVikingSessionRoutingRuntime(options: {agentId,actorPeerId: resolveOpenVikingActorPeerId({peerRole,- personPeerId: sanitizeOpenVikingPeerId(ctx?.requesterSenderId ?? ctx?.senderId),+ senderPeerId: sanitizeOpenVikingPeerId(ctx?.requesterSenderId ?? ctx?.senderId),assistantPeerId: agentId,}),};diff --git a/examples/openclaw-plugin/routing/identity-routing.ts b/examples/openclaw-plugin/routing/identity-routing.tsindex 8a075aaca..b50b4c770 100644--- a/examples/openclaw-plugin/routing/identity-routing.ts+++ b/examples/openclaw-plugin/routing/identity-routing.ts@@ -15,7 +15,7 @@ export type SessionAgentLookup = {ovSessionId?: string;};-export type OpenVikingPeerRole = "none" | "assistant" | "person";+export type OpenVikingPeerRole = "none" | "assistant" | "sender";export function sanitizeOpenVikingPeerId(raw?: string): string | undefined {const normalized = raw@@ -29,11 +29,11 @@ export function sanitizeOpenVikingPeerId(raw?: string): string | undefined {export function resolveOpenVikingMessagePeerId(params: {peerRole: OpenVikingPeerRole;role?: string;- personPeerId?: string;+ senderPeerId?: string;assistantPeerId?: string;}): string | undefined {- if (params.peerRole === "person" && params.role === "user") {- return params.personPeerId;+ if (params.peerRole === "sender" && params.role === "user") {+ return params.senderPeerId;}if (params.peerRole === "assistant" && params.role === "assistant") {return params.assistantPeerId;@@ -43,15 +43,15 @@ export function resolveOpenVikingMessagePeerId(params: {export function resolveOpenVikingActorPeerId(params: {peerRole: OpenVikingPeerRole;- personPeerId?: string;+ senderPeerId?: string;assistantPeerId?: string;}): string | undefined {const actorPeerId = resolveOpenVikingMessagePeerId({...params,- role: params.peerRole === "person" ? "user" : "assistant",+ role: params.peerRole === "sender" ? "user" : "assistant",});- if (params.peerRole === "person" && !actorPeerId) {- throw new Error("openviking: peer_role=person requires a sender identity");+ if (params.peerRole === "sender" && !actorPeerId) {+ throw new Error("openviking: peer_role=sender requires a sender identity");}return actorPeerId;}diff --git a/examples/openclaw-plugin/services/context-lifecycle-service.ts b/examples/openclaw-plugin/services/context-lifecycle-service.tsindex 4884f83e3..b6757744b 100644--- a/examples/openclaw-plugin/services/context-lifecycle-service.ts+++ b/examples/openclaw-plugin/services/context-lifecycle-service.ts@@ -497,8 +497,8 @@ export async function assembleOpenVikingSession({const routingRef = sessionId ?? sessionKey ?? ovSessionId;const agentId = resolveAgentId(routingRef, sessionKey, ovSessionId);const actorPeerId = resolveOpenVikingActorPeerId({- peerRole: cfg.peer_role ?? "assistant",- personPeerId: sanitizeOpenVikingPeerId(sender.senderId),+ peerRole: cfg.peer_role ?? "none",+ senderPeerId: sanitizeOpenVikingPeerId(sender.senderId),assistantPeerId: agentId,});const queryConfig = await queryConfigStore?.getEffective({@@ -910,9 +910,9 @@ export async function afterTurnOpenVikingSession({undefined,createdAt,resolveOpenVikingMessagePeerId({- peerRole: cfg.peer_role ?? "assistant",+ peerRole: cfg.peer_role ?? "none",role: msg.role,- personPeerId: senderRoleId,+ senderPeerId: senderRoleId,assistantPeerId: agentId,}),);diff --git a/examples/openclaw-plugin/services/setup/setup-flow.ts b/examples/openclaw-plugin/services/setup/setup-flow.tsindex 7aa467a34..f7ad3098a 100644--- a/examples/openclaw-plugin/services/setup/setup-flow.ts+++ b/examples/openclaw-plugin/services/setup/setup-flow.ts@@ -13,6 +13,8 @@ import {export type { SetupIO, SlotActivationResult };+type SetupPeerRole = "none" | "assistant" | "sender" | "person";+export type VersionCompatibility = "compatible" | "server_too_old" | "server_too_new" | "unknown";export type HealthResult = {@@ -38,7 +40,7 @@ export type SetupResult = {mode: string;baseUrl: string;apiKey?: string;- peer_role?: "none" | "assistant" | "person";+ peer_role?: SetupPeerRole;peer_prefix?: string;accountId?: string;userId?: string;@@ -57,7 +59,7 @@ export type StatusResult = {mode: string;baseUrl: string;hasApiKey: boolean;- peer_role?: "none" | "assistant" | "person";+ peer_role?: SetupPeerRole;peer_prefix?: string;hasAccountId: boolean;hasUserId: boolean;@@ -71,7 +73,7 @@ export type SetupParams = {baseUrl: string;apiKey?: string;headers?: OpenVikingRequestHeaders;- peerRole?: "none" | "assistant" | "person";+ peerRole?: SetupPeerRole;peerPrefix?: string;accountId?: string;userId?: string;@@ -85,7 +87,7 @@ export type InteractiveRemoteConfigParams = {baseUrl: string;apiKey?: string;headers?: OpenVikingRequestHeaders;- peerRole?: "none" | "assistant" | "person";+ peerRole?: SetupPeerRole;peerPrefix?: string;accountId?: string;userId?: string;@@ -315,7 +317,7 @@ export function createOpenVikingSetupService({baseUrl,...(apiKey ? { apiKey: maskKey(apiKey) } : {}),...(headers ? { headers } : {}),- ...(existing.peer_role ? { peer_role: String(existing.peer_role) as "none" | "assistant" | "person" } : {}),+ ...(existing.peer_role ? { peer_role: String(existing.peer_role) as SetupPeerRole } : {}),...(existing.peer_prefix ? { peer_prefix: String(existing.peer_prefix) } : {}),...(existing.accountId ? { accountId: String(existing.accountId) } : {}),...(existing.userId ? { userId: String(existing.userId) } : {}),@@ -346,7 +348,7 @@ export function createOpenVikingSetupService({mode: String(existing.mode ?? "remote"),baseUrl,hasApiKey: !!existing.apiKey,- ...(existing.peer_role ? { peer_role: String(existing.peer_role) as "none" | "assistant" | "person" } : {}),+ ...(existing.peer_role ? { peer_role: String(existing.peer_role) as SetupPeerRole } : {}),...(existing.peer_prefix ? { peer_prefix: String(existing.peer_prefix) } : {}),hasAccountId: !!existing.accountId,hasUserId: !!existing.userId,diff --git a/examples/openclaw-plugin/setup-helper/install.js b/examples/openclaw-plugin/setup-helper/install.jsindex 6df189020..cca2c42c0 100755--- a/examples/openclaw-plugin/setup-helper/install.js+++ b/examples/openclaw-plugin/setup-helper/install.js@@ -125,7 +125,7 @@ let remoteApiKey = (process.env.OPENVIKING_API_KEY || "").trim();let remotePeerRole = (process.env.OPENVIKING_PEER_ROLE || "").trim().toLowerCase();let remotePeerPrefix = (process.env.OPENVIKING_PEER_PREFIX || "").trim();let peerRoleExplicit = !!process.env.OPENVIKING_PEER_ROLE;-if (!remotePeerRole) remotePeerRole = "assistant";+if (!remotePeerRole) remotePeerRole = "none";let remoteAccountId = (process.env.OPENVIKING_ACCOUNT_ID || "").trim();let remoteUserId = (process.env.OPENVIKING_USER_ID || "").trim();let baseUrlExplicit = baseUrlFromEnv;@@ -291,7 +291,7 @@ for (let i = 0; i < argv.length; i++) {const val = argv[i + 1]?.trim();if (!val) { console.error("--peer-role requires a value"); process.exit(1); }const role = normalizePeerRole(val);- if (!role) { console.error('--peer-role must be "none", "assistant", or "person"'); process.exit(1); }+ if (!role) { console.error('--peer-role must be "none", "assistant", or "sender" (legacy alias: "person")'); process.exit(1); }remotePeerRole = role;peerRoleExplicit = true;i += 1;@@ -299,7 +299,7 @@ for (let i = 0; i < argv.length; i++) {}if (arg.startsWith("--peer-role=")) {const role = normalizePeerRole(arg.slice("--peer-role=".length));- if (!role) { console.error('--peer-role must be "none", "assistant", or "person"'); process.exit(1); }+ if (!role) { console.error('--peer-role must be "none", "assistant", or "sender" (legacy alias: "person")'); process.exit(1); }remotePeerRole = role;peerRoleExplicit = true;continue;@@ -343,7 +343,7 @@ for (let i = 0; i < argv.length; i++) {}}-remotePeerRole = normalizePeerRole(remotePeerRole) || "assistant";+remotePeerRole = normalizePeerRole(remotePeerRole) || "none";if (!isValidPeerPrefixInput(remotePeerPrefix)) {console.error("--peer-prefix may only contain letters, digits, underscores, and hyphens");process.exit(1);@@ -373,7 +373,7 @@ function printHelp() {console.log(" --uninstall, --remove Uninstall OpenViking plugin from OpenClaw (backup config, remove plugin entries)");console.log(" --base-url=URL OpenViking server URL (default: $OPENVIKING_BASE_URL or http://127.0.0.1:1933)");console.log(" --api-key=KEY OpenViking API key (default: $OPENVIKING_API_KEY)");- console.log(" --peer-role=ROLE Peer role: none, assistant, or person (default: $OPENVIKING_PEER_ROLE or assistant)");+ console.log(" --peer-role=ROLE Memory scope: none (shared), assistant (per assistant), sender (per sender); person is a legacy alias (default: $OPENVIKING_PEER_ROLE or none)");console.log(" --peer-prefix=PREFIX Prefix for assistant peer_id values (default: $OPENVIKING_PEER_PREFIX)");console.log(" --account-id=ID Account ID for root API key (default: $OPENVIKING_ACCOUNT_ID)");console.log(" --user-id=ID User ID for root API key (default: $OPENVIKING_USER_ID)");@@ -521,7 +521,8 @@ function isValidPeerPrefixInput(value) {function normalizePeerRole(value) {const role = String(value || "").trim().toLowerCase();- return role === "none" || role === "assistant" || role === "person" ? role : null;+ if (role === "person") return "sender";+ return role === "none" || role === "assistant" || role === "sender" ? role : null;}function parseJsonObjectFromOutput(output) {@@ -545,17 +546,25 @@ function parseJsonObjectFromOutput(output) {return null;}-async function questionPeerRole(defaultValue = "assistant") {+async function questionPeerRole(defaultValue = "none") {+ info(tr(+ "Memory scope — none (default): viking://user/<user_id>/memories, shared across all conversations; "+ + "assistant: viking://user/<user_id>/peers/<assistant_id>/memories; "+ + "sender: viking://user/<user_id>/peers/<sender_id>/memories (legacy alias: person).",+ "记忆归属 —— none(默认):viking://user/<user_id>/memories,所有对话共享;"+ + "assistant:viking://user/<user_id>/peers/<assistant_id>/memories;"+ + "sender:viking://user/<user_id>/peers/<sender_id>/memories(兼容旧值 person)。",+ ));while (true) {const answer = await question(- tr("Peer Role (none/assistant/person)", "Peer Role(none/assistant/person)"),+ tr("Memory scope (none/assistant/sender)", "记忆归属(none/assistant/sender)"),defaultValue,);const role = normalizePeerRole(answer);if (role) return role;warn(tr(- 'Peer Role must be "none", "assistant", or "person".',- 'Peer Role 必须是 "none"、"assistant" 或 "person"。',+ 'Memory scope must be "none", "assistant", or "sender" (legacy "person" is also accepted).',+ '记忆归属必须是 "none"、"assistant" 或 "sender"(也兼容旧值 "person")。',));}}@@ -1757,7 +1766,7 @@ async function prepareStrongPluginUpgrade() {);remoteBaseUrl = upgradeRuntimeConfig.baseUrl || remoteBaseUrl;remoteApiKey = upgradeRuntimeConfig.apiKey || "";- remotePeerRole = upgradeRuntimeConfig.peer_role || remotePeerRole || "assistant";+ remotePeerRole = upgradeRuntimeConfig.peer_role || remotePeerRole || "none";remotePeerPrefix = upgradeRuntimeConfig.peer_prefix || "";remoteAccountId = upgradeRuntimeConfig.accountId || "";remoteUserId = upgradeRuntimeConfig.userId || "";@@ -2630,7 +2639,7 @@ async function configureOpenClawPlugin({}} catch { /* ignore parse errors, write all fields */ }- const peerRole = normalizePeerRole(effectiveRuntimeConfig.peer_role) || "assistant";+ const peerRole = normalizePeerRole(effectiveRuntimeConfig.peer_role) || "none";const peerVal = effectiveRuntimeConfig.peer_prefix || "";const usePeerFields = !allowedProps || allowedProps.has("peer_role") || allowedProps.has("peer_prefix");const candidates = {diff --git a/examples/openclaw-plugin/skills/install-openviking-memory/SKILL.md b/examples/openclaw-plugin/skills/install-openviking-memory/SKILL.mdindex ff897a50f..f07c33b9c 100644--- a/examples/openclaw-plugin/skills/install-openviking-memory/SKILL.md+++ b/examples/openclaw-plugin/skills/install-openviking-memory/SKILL.md@@ -106,7 +106,7 @@ Send this message:> 我需要 3 条信息,不知道的可以问你的管理员:> 1. **OpenViking 服务地址** —— 例如 `https://ov.example.com` 或 `http://192.168.1.100:1933`,本机服务可以直接说"本机"> 2. **API Key** —— 用来鉴权;服务没开认证可以说"没有"-> 3. **Agent 标识前缀**(可选) —— 用于区分多个 agent 的记忆命名空间,留空就用默认+> 3. **记忆归属**(可选) —— 所有对话共用 user 记忆(默认),还是在 `peers/<assistant_id>` 或 `peers/<sender_id>` 下分开存放>> 先告诉我服务地址吧?@@ -115,7 +115,7 @@ Send this message:> I need 3 things (ask your admin if unsure):> 1. **OpenViking server URL** — e.g. `https://ov.example.com` or `http://192.168.1.100:1933`. For a local server, just say "local".> 2. **API Key** — for auth. Say "none" if the server has no auth.-> 3. **peer prefix** (optional) — used to namespace memories across agents. Leave blank for default.+> 3. **Memory scope** (optional) — shared user memory (default), or peer memory under `peers/<assistant_id>` / `peers/<sender_id>`.>> What's the server URL?@@ -141,15 +141,36 @@ Collect 3 values through natural conversation. Be flexible: if the user gives se- "no" / "none" / "没有" / "空" / empty → `API_KEY=""` (you will skip the flag later).- Otherwise store as-is.-### 4c. `PEER_PREFIX` (OPTIONAL)+### 4c. `PEER_ROLE` (OPTIONAL)++> (CN) 记忆要存在哪一层?默认共享在 `viking://user/<user_id>/memories`(`none`)。也可以按 OpenClaw 助手存到 `.../peers/<assistant_id>/memories`(`assistant`),或按发送者存到 `.../peers/<sender_id>/memories`(`sender`)。+> (EN) Where should memory live? The default is shared `viking://user/<user_id>/memories` (`none`). You can instead use `.../peers/<assistant_id>/memories` (`assistant`) or `.../peers/<sender_id>/memories` (`sender`).++Default to `none`. **Never silently pick another value** — the three options mean different storage layouts and are awkward to change later:++| Value | Concrete layout | Choose it when |+|---|---|---|+| `none` (default) | Shared memory under `viking://user/<user_id>/memories/...`; no concrete `peers/<peer_id>/memories` subtree is used. | General case. All conversations for this OpenViking user share user-level memory. |+| `assistant` | Assistant-attributed peer memory under `viking://user/<user_id>/peers/<assistant_id>/memories/...`, keyed by the resolved OpenClaw agent id (fallback `main`; optional prefix supported). | **Human as OpenViking user**: one human uses multiple assistants and wants their peer memories separated. Example: Alice's `main` and `research` assistants use `.../peers/main/...` and `.../peers/research/...`. |+| `sender` | Sender-attributed peer memory under `viking://user/<user_id>/peers/<sender_id>/memories/...`, keyed by the sender identity supplied by OpenClaw. | **Agent as OpenViking user**: one agent talks to multiple humans and wants their peer memories separated. Example: `support-agent` stores `customer-42` and `customer-99` under different peer subtrees. |++`person` is a legacy alias for `sender`. Accept it from an existing config or explicit user input, but normalize/write new setup values as `sender`.++OpenViking initializes the managed `peers/` container for every user. Do not tell the user that `none` removes that container: it only avoids a concrete peer memory subtree. With `assistant` or `sender`, actor-peer recall includes shared user memory plus the current peer memory; it hides other peer subtrees. Changing this setting does not move existing memories.++- Empty / "default" / "默认" / "共用" → leave unset (plugin defaults to `none`).+- Otherwise pass `--peer-role none|assistant|sender`. Treat explicit legacy `person` as `sender`. Any other value → ask again.++### 4d. `PEER_PREFIX` (OPTIONAL, only when `PEER_ROLE=assistant`)> (CN) 想给这个 agent 一个记忆前缀吗?留空就用默认。只能用字母、数字、`_`、`-`。> (EN) Want to set an peer prefix? Leave blank for the default. Letters, digits, `_`, `-` only.+- Only meaningful when `PEER_ROLE=assistant`; skip the question otherwise.- Empty / "default" / "默认" → leave unset (plugin defaults to `""`).- Otherwise validate against `/^[A-Za-z0-9_-]+$/`. If invalid, ask again.-### 4d. (Conditional) Multi-Tenant Root-Key Fields+### 4e. (Conditional) Multi-Tenant Root-Key FieldsOnly ask for these if STEP 7 detects a root key (`Root API key detected. Missing: --account-id, --user-id`). Don't ask up front.@@ -259,14 +280,15 @@ Tell the user:Run the installer with `npx` (no global install needed):```bash-npx -y openclaw-openviking-setup-helper@latest --base-url BASE_URL [--api-key API_KEY] [--peer-prefix PEER_PREFIX] [--account-id ACCOUNT_ID] [--user-id USER_ID]+npx -y openclaw-openviking-setup-helper@latest --base-url BASE_URL [--api-key API_KEY] [--peer-role PEER_ROLE] [--peer-prefix PEER_PREFIX] [--account-id ACCOUNT_ID] [--user-id USER_ID]```Build the flag list according to what the user gave you:- Always pass `--base-url BASE_URL`.- Pass `--api-key API_KEY` only if `API_KEY` is non-empty.-- Pass `--peer-prefix PEER_PREFIX` only if the user gave one.+- Pass `--peer-role PEER_ROLE` only if the user chose `assistant` or `sender`; omit it for the `none` default. Normalize legacy `person` to `sender` first.+- Pass `--peer-prefix PEER_PREFIX` only if the user gave one and `PEER_ROLE=assistant`.- `--account-id` / `--user-id` only if the root-key path requires them.`ov-install` will, in one shot:@@ -287,14 +309,15 @@ If `ov-install` exits non-zero, capture the last 30 lines of its output, show thRun the setup wizard non-interactively. Build flags from collected values:```bash-openclaw openviking setup --base-url BASE_URL --json [--api-key API_KEY] [--peer-prefix PEER_PREFIX] [--account-id ACCOUNT_ID] [--user-id USER_ID] [--allow-offline] [--force-slot]+openclaw openviking setup --base-url BASE_URL --json [--api-key API_KEY] [--peer-role PEER_ROLE] [--peer-prefix PEER_PREFIX] [--account-id ACCOUNT_ID] [--user-id USER_ID] [--allow-offline] [--force-slot]```Rules:- `--base-url BASE_URL` is **required** under `--json`. Without it, the wizard prints `--json requires --base-url for non-interactive mode`.- `--api-key` only if `API_KEY` is non-empty.-- `--peer-prefix` only if the user gave one. Use **`--peer-prefix`** for assistant peer prefixes; the old ID-style setup flag is no longer supported.+- `--peer-role` only if the user chose `assistant` or `sender`; omit it for the `none` default. Normalize legacy `person` to `sender` first.+- `--peer-prefix` only if the user gave one and `--peer-role assistant` is in play. Use **`--peer-prefix`** for assistant peer prefixes; the old ID-style setup flag is no longer supported.- `--account-id` / `--user-id` only after STEP 7 root-key detection (see below).- `--allow-offline` only if the user explicitly approved it in STEP 5.- `--force-slot` **never** in the first attempt. Add only after the user confirms (see slot_blocked handling below).@@ -583,8 +606,8 @@ These are the keys under `plugins.entries.openviking.config` in `openclaw.json`.| `mode` | `"remote"` (forced by plugin) | Always remote in this skill. Don't set manually. || `baseUrl` | `http://127.0.0.1:1933` | OpenViking server URL. || `apiKey` | — | API key. Optional if server has no auth. |-| `peer_role` | `assistant` | Peer identity mode: `none`, `assistant`, or `person`. Session messages use body `peer_id`; data-plane recall/search uses `X-OpenViking-Actor-Peer`. |-| `peer_prefix` | `""` | Optional prefix for assistant `peer_id` / actor peer values when `peer_role=assistant`. Letters / digits / `_` / `-`. |+| `peer_role` | `none` | Memory scope: `none` (shared `viking://user/<user_id>/memories`), `assistant` (`.../peers/<assistant_id>/memories`), or `sender` (`.../peers/<sender_id>/memories`). Legacy `person` is accepted as `sender`. Session messages use body `peer_id`; data-plane recall/search uses `X-OpenViking-Actor-Peer`. |+| `peer_prefix` | `""` | Optional prefix for assistant `peer_id` / actor peer values. Only used when `peer_role=assistant`. Letters / digits / `_` / `-`. || `accountId` | — | Required when `apiKey` is a root key. || `userId` | — | Required when `apiKey` is a root key. || `targetUri` | `viking://~/memories` | Default search scope URI. |diff --git a/examples/openclaw-plugin/skills/openviking-context-database/SKILL.md b/examples/openclaw-plugin/skills/openviking-context-database/SKILL.mdindex 4a557291e..478d194e5 100644--- a/examples/openclaw-plugin/skills/openviking-context-database/SKILL.md+++ b/examples/openclaw-plugin/skills/openviking-context-database/SKILL.md@@ -64,7 +64,7 @@ Core config lives under `plugins.entries.openviking.config`:|---|---:|---|| `baseUrl` | `http://127.0.0.1:1933` | OpenViking HTTP endpoint. Can also come from `OPENVIKING_BASE_URL` / `OPENVIKING_URL`. || `apiKey` | empty | Optional API key. Can also come from `OPENVIKING_API_KEY`. |-| `peer_role` | `assistant` | Peer identity mode: `none`, `assistant`, or `person`. Session messages use body `peer_id`; data-plane recall/search uses `X-OpenViking-Actor-Peer`. |+| `peer_role` | `none` | Memory scope: `none` (shared `viking://user/<user_id>/memories`), `assistant` (assistant-attributed memory under `.../peers/<assistant_id>/memories`), or `sender` (sender-attributed memory under `.../peers/<sender_id>/memories`). Legacy `person` is accepted as `sender`. || `peer_prefix` | empty | Optional prefix for assistant `peer_id` / actor peer values when `peer_role=assistant`. || `accountId` / `userId` | empty | Advanced tenant identity headers for root-key or trusted deployments. || `targetUri` | `viking://~/memories` | Default search scope for legacy targeted memory search. |@@ -95,7 +95,7 @@ openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --jsonUseful variants:```bash-openclaw openviking setup --base-url <URL> --api-key <KEY> --peer-prefix openclaw-prod --json+openclaw openviking setup --base-url <URL> --api-key <KEY> --peer-role assistant --peer-prefix openclaw-prod --jsonopenclaw openviking setup --base-url <URL> --api-key <ROOT_KEY> --account-id <ACCOUNT_ID> --user-id <USER_ID> --jsonopenclaw openviking setup --base-url <URL> --api-key <KEY> --recall-target-types resource --jsonopenclaw openviking setup --base-url <URL> --api-key <KEY> --allow-offline --jsondiff --git a/examples/openclaw-plugin/tests/ut/config.test.ts b/examples/openclaw-plugin/tests/ut/config.test.tsindex e06f578bc..70ef9f927 100644--- a/examples/openclaw-plugin/tests/ut/config.test.ts+++ b/examples/openclaw-plugin/tests/ut/config.test.ts@@ -24,7 +24,7 @@ describe("memoryOpenVikingConfigSchema.parse()", () => {expect(cfg.captureMaxLength).toBe(24000);expect(cfg.autoRecallTimeoutMs).toBe(15000);expect(cfg.recallMaxContentChars).toBe(5000);- expect(cfg.peer_role).toBe("assistant");+ expect(cfg.peer_role).toBe("none");expect(cfg.peer_prefix).toBe("");expect(cfg.emitStandardDiagnostics).toBe(false);expect(cfg.traceRecall).toBe(false);@@ -320,18 +320,22 @@ describe("memoryOpenVikingConfigSchema.parse()", () => {it("accepts explicit peer_role values", () => {expect(memoryOpenVikingConfigSchema.parse({ peer_role: "none" }).peer_role).toBe("none");expect(memoryOpenVikingConfigSchema.parse({ peer_role: "assistant" }).peer_role).toBe("assistant");- expect(memoryOpenVikingConfigSchema.parse({ peer_role: "person" }).peer_role).toBe("person");+ expect(memoryOpenVikingConfigSchema.parse({ peer_role: "sender" }).peer_role).toBe("sender");+ });++ it("normalizes the legacy person peer_role alias to sender", () => {+ expect(memoryOpenVikingConfigSchema.parse({ peer_role: "person" }).peer_role).toBe("sender");});it("throws on invalid peer_role", () => {expect(() =>memoryOpenVikingConfigSchema.parse({ peer_role: "agent" }),- ).toThrow('peer_role must be "none", "assistant", or "person"');+ ).toThrow('peer_role must be "none", "assistant", or "sender"');});it("resolves peer_prefix from configured value", () => {const cfg = memoryOpenVikingConfigSchema.parse({ peer_prefix: " my-agent " });- expect(cfg.peer_role).toBe("assistant");+ expect(cfg.peer_role).toBe("none");expect(cfg.peer_prefix).toBe("my-agent");});diff --git a/examples/openclaw-plugin/tests/ut/identity-routing.test.ts b/examples/openclaw-plugin/tests/ut/identity-routing.test.tsindex e1a06f885..81dbbc143 100644--- a/examples/openclaw-plugin/tests/ut/identity-routing.test.ts+++ b/examples/openclaw-plugin/tests/ut/identity-routing.test.ts@@ -4,6 +4,8 @@ import {createSessionAgentResolver,openClawSessionRefToOvStorageId,openClawSessionToOvStorageId,+ resolveOpenVikingActorPeerId,+ resolveOpenVikingMessagePeerId,sanitizeOpenVikingAgentIdHeader,} from "../../routing/identity-routing.js";@@ -32,6 +34,26 @@ describe("identity routing registry", () => {expect(sanitizeOpenVikingAgentIdHeader("@#$%")).toBe("ov_agent");});+ it("routes sender scope to the sender peer for messages and data-plane requests", () => {+ expect(resolveOpenVikingMessagePeerId({+ peerRole: "sender",+ role: "user",+ senderPeerId: "sender-42",+ })).toBe("sender-42");+ expect(resolveOpenVikingMessagePeerId({+ peerRole: "sender",+ role: "assistant",+ senderPeerId: "sender-42",+ })).toBeUndefined();+ expect(resolveOpenVikingActorPeerId({+ peerRole: "sender",+ senderPeerId: "sender-42",+ })).toBe("sender-42");+ expect(() => resolveOpenVikingActorPeerId({ peerRole: "sender" })).toThrow(+ "peer_role=sender requires a sender identity",+ );+ });+it("resolves session-scoped agents with aliases and config prefix unchanged", () => {const resolver = createSessionAgentResolver("prefix");resolver.remember({ sessionId: "s1", sessionKey: "agent:worker:session123", agentId: "agent-abc" });diff --git a/examples/openclaw-plugin/tests/ut/manifest-contracts.test.ts b/examples/openclaw-plugin/tests/ut/manifest-contracts.test.tsindex f9d5727fc..55feac24a 100644--- a/examples/openclaw-plugin/tests/ut/manifest-contracts.test.ts+++ b/examples/openclaw-plugin/tests/ut/manifest-contracts.test.ts@@ -129,6 +129,22 @@ describe("OpenClaw 5.2 manifest contracts", () => {});describe("OpenClaw 5.5 package runtime contract", () => {+ it("publishes sender as the canonical peer role while accepting legacy person configs", () => {+ const peerRoleSchema = manifest.configSchema?.properties?.peer_role as {+ enum?: string[];+ description?: string;+ };+ expect(peerRoleSchema.enum).toEqual([+ "none",+ "assistant",+ "sender",+ "person",+ ]);+ expect(peerRoleSchema.description).toContain(+ "person is a legacy alias for sender",+ );+ });+it("builds and publishes compiled runtime output for TypeScript entries", () => {expect(packageJson.scripts?.build).toContain("rmSync('dist'");expect(packageJson.scripts?.build).toContain("tsc -p tsconfig.build.json");diff --git a/examples/openclaw-plugin/tests/ut/package-install-contract.test.ts b/examples/openclaw-plugin/tests/ut/package-install-contract.test.tsindex cd2a47209..190768e45 100644--- a/examples/openclaw-plugin/tests/ut/package-install-contract.test.ts+++ b/examples/openclaw-plugin/tests/ut/package-install-contract.test.ts@@ -121,6 +121,7 @@ describe("OpenClaw plugin package and install contract", () => {expect(installHelper).toContain(`slot: "${installManifest.plugin.slot}"`);expect(installHelper).toContain("OPENVIKING_PEER_ROLE");expect(installHelper).toContain("OPENVIKING_PEER_PREFIX");+ expect(installHelper).toContain('if (role === "person") return "sender"');expect(installHelper).not.toContain("OPENVIKING_AGENT_PREFIX");});});diff --git a/examples/openclaw-plugin/tests/ut/plugin-modules.test.ts b/examples/openclaw-plugin/tests/ut/plugin-modules.test.tsindex dbb776752..7576bf847 100644--- a/examples/openclaw-plugin/tests/ut/plugin-modules.test.ts+++ b/examples/openclaw-plugin/tests/ut/plugin-modules.test.ts@@ -816,7 +816,7 @@ describe("plugin module seams", () => {getClient: async () => ({ addSessionMessage, commitSession, deleteUri, find }),normalizeSessionId: (sessionId: string) => `normalized:${sessionId}`,createTempSessionId: () => "memory-store-temp",- peerRole: "person" as const,+ peerRole: "sender" as const,resolvePluginSessionRouting: () => ({ agentId: "agent-main", actorPeerId: "ou_01_abc" }),isBypassedSession: () => false,makeBypassedToolResult: (toolName: string) => ({ content: [{ type: "text" as const, text: `bypassed ${toolName}` }], details: { toolName } }),diff --git a/examples/openclaw-plugin/tests/ut/setup-command.test.ts b/examples/openclaw-plugin/tests/ut/setup-command.test.tsindex 05bea4033..072ad8c30 100644--- a/examples/openclaw-plugin/tests/ut/setup-command.test.ts+++ b/examples/openclaw-plugin/tests/ut/setup-command.test.ts@@ -3,6 +3,7 @@ import * as os from "node:os";import * as path from "node:path";import { afterEach, describe, expect, it, vi } from "vitest";+import { __test__ as setupCommandTest } from "../../commands/setup.js";import { defaultSetupIO } from "../../services/setup/config-writer.js";import { createOpenVikingSetupService } from "../../services/setup/setup-flow.js";@@ -30,6 +31,12 @@ describe("openviking setup agent prefix validation", () => {},);+ it("uses sender as the canonical setup value and accepts legacy person input", () => {+ expect(setupCommandTest.normalizePeerRole("sender")).toBe("sender");+ expect(setupCommandTest.normalizePeerRole("person")).toBe("sender");+ expect(setupCommandTest.resolveSetupPeerRole("person")).toBe("sender");+ });+it("non-interactive setup can persist resource-only recallTargetTypes for post-install opt-in", async () => {const dir = fs.mkdtempSync(path.join(os.tmpdir(), "openviking-setup-"));tempDirs.push(dir);diff --git a/examples/openclaw-plugin/tests/ut/tools.test.ts b/examples/openclaw-plugin/tests/ut/tools.test.tsindex 0cbf774d8..95c8ad878 100644--- a/examples/openclaw-plugin/tests/ut/tools.test.ts+++ b/examples/openclaw-plugin/tests/ut/tools.test.ts@@ -473,7 +473,7 @@ describe("Tool: memory_store (behavioral)", () => {return okResponse({});});- const { factoryTools, api } = setupPlugin(undefined, { peer_role: "person" });+ const { factoryTools, api } = setupPlugin(undefined, { peer_role: "sender" });(api as any).openVikingTransport = openVikingTransport;contextEnginePlugin.register(api as any);const factory = factoryTools.get("memory_store");@@ -2098,7 +2098,7 @@ describe("Plugin registration", () => {return okResponse({});});- const { commands, api } = setupPlugin();+ const { commands, api } = setupPlugin(undefined, { peer_role: "assistant" });(api as any).openVikingTransport = openVikingTransport;contextEnginePlugin.register(api as any);@@ -2115,7 +2115,7 @@ describe("Plugin registration", () => {expect(headers.get("X-OpenViking-Actor-Peer")).toBe("worker");});- it("search command propagates configured tenant headers", async () => {+ it("search command omits actor peer identity with the default memory scope", async () => {const openVikingTransport = vi.fn(async (url: string) => {if (url.endsWith("/api/v1/search/find")) {return okResponse({ memories: [], resources: [], skills: [], total: 0 });@@ -2125,6 +2125,31 @@ describe("Plugin registration", () => {const { commands, api } = setupPlugin();(api as any).openVikingTransport = openVikingTransport;+ contextEnginePlugin.register(api as any);++ await commands.get("ov-search")!.handler({+ args: "test query --uri viking://resources",+ commandBody: "/ov-search",+ agentId: "worker",+ sessionId: "session-1",+ sessionKey: "agent:worker:session-1",+ });++ const [, init] = openVikingTransport.mock.calls.find((call) => String(call[0]).endsWith("/api/v1/search/find")) as [string, RequestInit];+ const headers = new Headers(init.headers);+ expect(headers.get("X-OpenViking-Actor-Peer")).toBeNull();+ });++ it("search command propagates configured tenant headers", async () => {+ const openVikingTransport = vi.fn(async (url: string) => {+ if (url.endsWith("/api/v1/search/find")) {+ return okResponse({ memories: [], resources: [], skills: [], total: 0 });+ }+ return okResponse({});+ });++ const { commands, api } = setupPlugin(undefined, { peer_role: "assistant" });+ (api as any).openVikingTransport = openVikingTransport;api.pluginConfig = {...api.pluginConfig,accountId: "acct-shared",