Files
OpenViking/examples/memory-plugin-shared
b7aa01d227 feat(plugins): add OpenViking memory integration for TRAE CLI (#4026)
* feat: add OpenViking memory integration for TRAE CLI

Add TRAE CLI lifecycle hooks and MCP proxy support, wire the integration into the shared installer, and cover idempotent install and uninstall behavior.

Co-authored-by: TRAE CLI <noreply@bytedance.com>

* fix(trae-cli): cover archive installs and hook payload aliases

* fix: keep TRAE CLI installation explicit

Leave TRAE Desktop detection unchanged and avoid auto-selecting TRAE CLI. TRAE CLI remains available through an explicit harness selection or --harness trae-cli.

Co-authored-by: TRAE CLI <noreply@bytedance.com>

* fix(trae-cli): auto-select installed CLI commands

Detect traecli and traex only when they are available in PATH, then mark and select the TRAE CLI harness automatically.

---------

Co-authored-by: “bianhaonan” <“bianhaonan@bytedance.com”>
Co-authored-by: TRAE CLI <noreply@bytedance.com>
2026-08-17 14:59:43 +08:00
..

Memory Plugin Shared Library

This directory contains shared JavaScript modules that are vendored into the Claude Code, Codex, OpenCode, and pi memory plugins by sync.mjs.

Workspace Peers

lib/workspace-peer.mjs derives the default actor peer from the current workspace path. The rule matches Claude's project-directory naming: every character outside A-Z, a-z, and 0-9 becomes -; paths are not normalized, folded, or trimmed. For example, /Users/x/Dev/OpenViking becomes -Users-x-Dev-OpenViking.

Resolution order is:

  1. Explicit peer: OPENVIKING_PEER_ID, actor_peer_id / peer_id in ovcli.conf, or the harness-specific legacy peer config.
  2. Workspace-derived peer when workspacePeer is not false.
  3. No peer.

Set OPENVIKING_WORKSPACE_PEER=0 or the harness config workspacePeer=false to disable workspace-derived peers.

Recall Peer Scope

lib/recall-core.mjs defaults to the broad recall mode and does not send a peer_scope field. In that mode, the server can recall global memory, the current workspace, and other workspace memories; other workspaces are penalized and rendered later.

When recallPeerScope is actor, the helper sends peer_scope:"actor". This is the isolation mode: recall only sees global memory plus the current workspace. If an older server rejects that field with 400 or 422, postRecall removes peer_scope and retries once.

For deployments where one bot serves multiple real people, such as zouk, vikingbot, or AstrBot, configure an explicit actor peer and use the isolation mode so one person's memories are not recalled into another person's session.