docs/en/agent-integrations/02-claude-code.md
Give Claude Code a cross-project, cross-session memory that grows smarter over time. Install once — recall and capture happen automatically on every conversation, no MCP tool calls required from the model.
Source: examples/claude-code-memory-plugin | Blog: motivation & demo
bash <(curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/claude-code-memory-plugin/setup-helper/install.sh)
The installer checks dependencies, configures your OpenViking connection, and installs the plugin. Every step is idempotent — re-running is safe.
After install, start Claude Code and ask it something from a previous session. It remembers.
<details> <summary><b>Manual setup</b></summary>If you prefer to set things up by hand:
Shell function wrapper — append a claude() function to ~/.zshrc or ~/.bashrc that injects OPENVIKING_URL and OPENVIKING_API_KEY from ~/.openviking/ovcli.conf at each invocation. This keeps the API key scoped to the claude process tree. See the plugin README for the full function and security rationale.
Install the plugin from the OpenViking repo root:
claude plugin marketplace add "$(pwd)/examples"
claude plugin install claude-code-memory-plugin@openviking-plugins-local
Start Claude Code and run /mcp to confirm the OpenViking entry shows your server URL.
</details>Don't have
ovcli.confyet? See Deployment Guide → CLI.Pure local mode (
http://127.0.0.1:1933, no auth)? Skip step 1 — the plugin uses the local default.Claude Code < 2.0? See the plugin README's Legacy mode section.
type claude # expect: claude is a shell function
Inside Claude Code:
/plugins → find openviking-memory in Installed (with openviking MCP connected underneath)/mcp → the OpenViking entry should show your server URL with valid auth/openviking-memory:ov → shows server health, identity, recall/injection stats, and toggle statesIf the plugin doesn't seem to fire, set OPENVIKING_DEBUG=1 and check ~/.openviking/logs/cc-hooks.log.
The plugin hooks into Claude Code's lifecycle: it searches OpenViking and injects relevant memories before every prompt, captures new conversation turns after each response, injects your profile and memory index on session start, commits pending messages before compaction and on session end, and gives each subagent an isolated memory session. All write operations run asynchronously so you never wait for OpenViking.
<details> <summary><b>Configuration</b></summary>Config priority: env vars > ovcli.conf > ov.conf > built-in defaults (http://127.0.0.1:1933, no auth).
| Env Var | Default | Description |
|---|---|---|
OPENVIKING_AUTO_RECALL | true | Auto-recall on every user prompt |
OPENVIKING_RECALL_LIMIT | 6 | Max memories to inject per turn |
OPENVIKING_RECALL_TOKEN_BUDGET | 2000 | Token budget for inline content |
OPENVIKING_AUTO_CAPTURE | true | Auto-capture after each turn |
OPENVIKING_BYPASS_SESSION | false | Skip all hooks for this session |
OPENVIKING_BYPASS_SESSION_PATTERNS | "" | CSV glob patterns to auto-bypass |
OPENVIKING_MEMORY_ENABLED | (auto) | Force on/off |
OPENVIKING_DEBUG | false | Write logs to ~/.openviking/logs/cc-hooks.log |
For multi-tenant deployments, set OPENVIKING_ACCOUNT, OPENVIKING_USER, and OPENVIKING_AGENT_ID. Full env-var list in the plugin README.
The plugin renders an OpenViking status indicator under your Claude Code input box — connection health, recall count, capture progress, and session state at a glance. See STATUSLINE.md for the full segment glossary and personalization recipes.
| Symptom | Cause | Fix |
|---|---|---|
| Plugin not activating | No ov.conf / ovcli.conf found | Run the installer, or set OPENVIKING_MEMORY_ENABLED=1 plus URL/API_KEY env vars |
| Hooks fire but recall is empty | Server not running or wrong URL | curl "$(jq -r '.url' ~/.openviking/ovcli.conf)/health" |
MCP tools hit 127.0.0.1 instead of remote | Missing function wrapper | Ensure type claude says "shell function"; see Manual setup |
| Remote auth 401 / 403 | Wrong API key or missing tenant headers | Check OPENVIKING_API_KEY; for multi-tenant also check OPENVIKING_ACCOUNT / OPENVIKING_USER |
ovcli.conf setup