OpenViking

28.9kStars2.3kForks453Issues79Watchers

Provides OpenViking long-term semantic memory, automatic session capture, and viking:// context tools for DeepSeek Harness, enabling DSH sessions to automatically recall and write to persistent memory.

Language
Python
License
AGPL-3.0
Branch
main
agent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginself-evolving

Install

$ dsh plugin --profile web add github:volcengine/OpenViking

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

One-Line Positioning

Injects the OpenViking context database into DeepSeek Harness (DSH): automatically recalls relevant memories and user profiles before each agent step, writes user/assistant/tool messages in real-time to the viking:// virtual filesystem, and blocks viking:// URIs from DSH local tools.

Core Capabilities

  • In the agent/pre-step hook, perform semantic search using the current step input, append matched L0/L1/L2 memories as user messages with source: { kind: 'plugin' }
  • Listen to session/event to automatically collect user/assistant/tool result messages and write them to the OpenViking session; auto-commit when commitTokenThreshold is reached
  • Register 7 model-callable tools: viking_search / viking_read / viking_browse / viking_remember / viking_forget / viking_add_resource / viking_archive_expand
  • Intercept incorrect usage of viking:// URIs by local tools like read/glob/grep/bash/edit/write in tools/pre-execute, forcing them to go through OpenViking tools instead
  • Asynchronously ingest HTTP(S)/git remote resources via viking_add_resource, automatically deriving L0/L1/L2 hierarchy
  • When service is unreachable or write fails, enter the pending write queue in OPENVIKING_PENDING_DIR, with automatic replay on next session start
  • Each DSH session maps to dsh-<session-id> on the OpenViking side; defaults to deriving actor peer from workspace, but can be forcibly overridden

Technical Implementation

  • Language: JavaScript (Node.js, ESM *.mjs)
  • Key Dependencies: @deepseek-ai/dsh-llm (createUserMessage), @deepseek-ai/dsh-tools (defineTool); no third-party npm dependencies at runtime
  • Architecture Pattern: Cordis plugin group (@deepseek-ai/cordis-plugin-group) — apply(ctx, input) registers the openvikingMemory service, subscribes to lifecycle events via ctx.on including agent/session-start, agent/pre-step, session/event, session/flush, tools/pre-execute; runtime uses shared submodules like setup-wizard/profile-inject/recall-core/capture-utils/pending-queue
  • Entry Point: examples/dsh-memory-plugin/index.mjs (exports name/inject/apply), cordis.patch.yml declares Cordis loading entry

Use Cases

For developers or teams who need DSH to retain project knowledge, user preferences, and historical experience long-term: in multi-session, multi-workspace collaboration, let the agent automatically retrieve context from past decisions, code styles, and project documentation, avoiding repetitive instructions; meanwhile, asynchronously persist each dialogue turn to viking://user/<peer>/memories/ as the recall source for subsequent steps.

Installation

dsh plugin --profile web add github:volcengine/OpenViking

Configuration Options

ConfigTypeDescriptionDefault
endpointstringOpenViking service addresshttp://127.0.0.1:1933
apiKeystringBearer credential (also via OPENVIKING_API_KEY/OPENVIKING_BEARER_TOKEN or ~/.openviking/ovcli.conf)""
accountstringtrusted-mode account (X-OpenViking-Account)""
userstringtrusted-mode user (X-OpenViking-User)""
peerIdstringExplicit actor peer (overrides workspace derivation)""
workspacePeerbooleanWhether to derive actor peer from DSH workspacetrue
recallPeerScope"all" | "actor"Whether to recall across workspacesall
recallQueryExpansion"auto" | "off"Whether to perform query rewritingauto
recallTokenBudgetnumber (200–50000)Recall context token limit2000
recallMaxContentCharsnumber (100–5000)Recall entry abstract truncation length500
recallLimitnumber (1–50)Number of recall entries10
scoreThresholdnumber (0–1)Recall score threshold0.35
minQueryLengthnumber (1–64)Minimum query length to trigger recall3
profileTokenBudgetnumber (500–50000)Startup profile injection token limit10000
commitTokenThresholdnumber (1000–1000000)Pending token threshold to trigger session commit20000
commitKeepRecentCountnumber (0–1000)Number of recent messages to keep during commit10
captureMode"semantic" | "keyword"Capture modesemantic
captureAssistantTurnsbooleanWhether to capture assistant messagestrue
captureToolResultsbooleanWhether to capture tool resultsfalse
captureMaxLengthnumber (200–100000)Maximum single capture length24000
captureToolMaxCharsnumber (200–1000000)Maximum tool result characters1000000
requestTimeoutMsnumber (1000–120000)HTTP request timeout10000

Environment Variables (in addition to above): OPENVIKING_URL / OPENVIKING_BASE_URL / OPENVIKING_MCP_URL / OPENVIKING_CREDENTIAL_SOURCE / OPENVIKING_CONFIG_FILE / OPENVIKING_CLI_CONFIG_FILE / OPENVIKING_PENDING_DIR / OPENVIKING_PENDING_MAX_RETRIES / OPENVIKING_PENDING_TTL_DAYS / OPENVIKING_PENDING_REPLAY_LIMIT / OPENVIKING_RECALL_QUERY_EXPANSION / OPENVIKING_RECALL_LIMIT / OPENVIKING_RECALL_PEER_SCOPE / OPENVIKING_WORKSPACE_PEER.

Learning Curve

Advanced — requires first running an accessible OpenViking service (openviking-server) locally or remotely, then understanding concepts like viking:// URIs, L0/L1/L2 hierarchy, and actor peers; DSH installation itself is a single command, but tuning recall budgets, commit thresholds, peer isolation, etc. requires reading the configuration section in config.mjs and README.

Known Issues and Limitations

  • Strongly tied to DSH version: peerDependencies locks @deepseek-ai/dsh-llm and @deepseek-ai/dsh-tools both to 0.1.0-rc.6; out-of-sync pre-release dist-tags will cause loading failure
  • Strongly tied to Node engine: ^22.19.0 || >=24; earlier Node versions will be rejected outright
  • If DSH preset marks persona as complete: true, recall/profile injected in pre-step still appends as user message, bypassing system prompt override; however, if DSH has a strip-plugin-source filter after agent/pre-step, recalled context will be stripped along with it
  • When OpenViking service is unreachable, all writes fall back to queue in OPENVIKING_PENDING_DIR (default ~/.openviking/dsh-pending/); if queue repeatedly fails to replay and exceeds OPENVIKING_PENDING_MAX_RETRIES (default 3) or OPENVIKING_PENDING_TTL_DAYS, entries will be cleaned up
  • live-recall.test.mjs end-to-end test is skipped by default, only runs when OPENVIKING_E2E=1 and real service credentials are available, not covered in CI
  • viking_forget is irreversible hard deletion (explicitly noted in README), should only be called by the model when user explicitly requests deletion
OpenViking — DeepSeek Harness Plugin | deepseek-plugin.org