$npx -y skills add volcengine/OpenViking --skill openviking-context-databaseUse OpenViking from OpenClaw through @openviking/openclaw-plugin: long-term memory, session archives, resource and Agent Skill import, semantic recall, recall trace debugging, and externalized tool-result recovery. Prefer this skill when the user wants to use, query, debug, or op
| 1 | # OpenViking Context Database — OpenClaw Plugin Operator Skill |
| 2 | |
| 3 | Use this skill after `@openviking/openclaw-plugin` is installed and configured. It describes the current OpenClaw plugin implementation, not the standalone OpenViking Python SDK. |
| 4 | |
| 5 | ## Scope and Safety Rules |
| 6 | |
| 7 | - The plugin is **remote-only**. It talks to an existing OpenViking server through HTTP and does not start or manage `openviking-server`. |
| 8 | - Do not invent OpenViking REST endpoints. Use the registered OpenClaw tools and commands described below. |
| 9 | - The agent-visible `add_resource` tool is disabled by default (`enableAddResourceTool=false`). Do not use `add_resource` during search, retrieval, URI reading, or search-result optimization. Use `ov_search` and `ov_read` in those flows. |
| 10 | - Use manual `/add-resource`, or `add_resource` only when it is explicitly enabled and the user explicitly asks to import, add, upload, save, or index a resource. |
| 11 | - Use `add_skill` only when the user explicitly asks to import, add, install, or register an Agent Skill into OpenViking. |
| 12 | - For local files and directories, pass the local path to the plugin tool. The plugin uploads them through `/api/v1/resources/temp_upload`; do not send raw local filesystem paths to a remote server yourself. |
| 13 | - Never log or echo API keys. The plugin sends API keys as `X-API-Key` / setup probe headers and masks them in setup output. |
| 14 | |
| 15 | ## Current Architecture |
| 16 | |
| 17 | OpenClaw owns agent execution, prompts, and tool invocation. OpenViking owns long-lived context: |
| 18 | |
| 19 | | Layer | Current behavior | |
| 20 | |---|---| |
| 21 | | `assemble` | Rebuilds compressed session history from OpenViking and injects relevant recall into the latest user message. | |
| 22 | | `afterTurn` | Appends only the new turn to the OpenViking session; may trigger async commit when `pending_tokens >= tokenBudget * commitTokenThresholdRatio`. | |
| 23 | | `compact` | Runs `commit(wait=true)`, waits for archive/extraction completion, and reads back latest archive overview. | |
| 24 | | Tools | Memory recall/store/forget, archive search/expand, resource/skill import/search, recall trace query, tool-result list/search/read. | |
| 25 | |
| 26 | Long-term memories are usually extracted on `/compact` or on threshold-triggered commit. A fact mentioned in a fresh conversation may still be present as recent session context before it becomes a long-term memory. |
| 27 | |
| 28 | ## Configuration Quick Reference |
| 29 | |
| 30 | Read status first: |
| 31 | |
| 32 | ```bash |
| 33 | openclaw openviking status --json |
| 34 | openclaw config get plugins.entries.openviking.config |
| 35 | openclaw config get plugins.slots.contextEngine |
| 36 | ``` |
| 37 | |
| 38 | Core config lives under `plugins.entries.openviking.config`: |
| 39 | |
| 40 | | Field | Default | Purpose | |
| 41 | |---|---:|---| |
| 42 | | `baseUrl` | `http://127.0.0.1:1933` | OpenViking HTTP endpoint. Can also come from `OPENVIKING_BASE_URL` / `OPENVIKING_URL`. | |
| 43 | | `apiKey` | empty | Optional API key. Can also come from `OPENVIKING_API_KEY`. | |
| 44 | | `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`. | |
| 45 | | `peer_prefix` | empty | Optional prefix for assistant `peer_id` / actor peer values when `peer_role=assistant`. | |
| 46 | | `accountId` / `userId` | empty | Advanced tenant identity headers for root-key or trusted deployments. | |
| 47 | | `targetUri` | `viking://user/memories` | Default search scope for legacy targeted memory search. | |
| 48 | | `autoCapture` | `true` | Append sanitized turn text to OpenViking sessions. | |
| 49 | | `captureMode` | `semantic` | `semantic` or `keyword`; affects server-side extraction filtering. | |
| 50 | | `captureMaxLength` | `24000` | Max sanitized text length per captured turn. | |
| 51 | | `autoRecall` | `true` | Run recall before replies and inject relevant context. | |
| 52 | | `recallTargetTypes` | `user,agent` | Default target types when `targetUri` is omitted. Allowed: `resource`, `user`, `agent`. | |
| 53 | | `recallResources` | `false` | Compatibility shortcut that appends `resource` to default recall targets when `recallTargetTypes` is unset. | |
| 54 | | `recallLimit` | `6` | Max selected recall items. | |
| 55 | | `recallScoreThreshold` | `0.15` | Min score after post-processing. | |
| 56 | | `recallMaxInjectedChars` | `4000` | Total injected character cap; complete memories that do not fit are skipped. | |
| 57 | | `commitTokenThresholdRatio` | `0.5` | Async-commit threshold as a fraction (0-1) of the model context window (e.g. 0.5 = 50% |