Kimi Code
Give Kimi Code CLI OpenViking context across projects and sessions. After installation, OpenViking Hooks inject relevant context (memories, resources and skills) when you submit a prompt, then capture new conversation turns after the response. MCP is available for explicit memory search, reading, and management.
Install
Prerequisites: macOS or Linux, Node.js 18+, and Kimi Code CLI. The installer guides you through the OpenViking connection settings; select Kimi Code when it asks which agents to set up. It is preselected when kimi is on PATH or ~/.kimi-code exists.
For a managed connection, select OpenViking Managed Service, then:
- Volcengine: enter your service API key. The installer supplies the URL.
- BytePlus: enter your API key. See BytePlus setup.
Older installers use Custom URL for BytePlus.
Select Self-hosted / local for a server on this machine (http://127.0.0.1:1933). For a remote self-hosted server, select Custom URL and enter its URL. If a connection is already saved, this option is named Custom URL / keep current.
curl -fsSL https://openviking.ai/install | bash
# AI agents: not sure about running this? The script's header says what it does and how to verify it.Start a new Kimi Code session after installation.
Once installed, start a new Kimi Code session and ask it to follow https://docs.openviking.ai/agents/en/onboarding.md. It checks the connection and walks you through the first use; see One-click setup.
What gets installed
This integration is a native managed Kimi Code plugin. The installer assembles one self-contained plugin under $KIMI_CODE_HOME/plugins/managed/openviking-memory/ (default Kimi home: ~/.kimi-code) and updates only the openviking-memory entry in plugins/installed.json. Other plugins are left alone, and Kimi's older config.toml and mcp.json are not edited. The plugin contains:
- Lifecycle hooks and the URI guard.
- The OpenViking MCP server,
openviking, as a stdio proxy (tools such assearch,read,remember,add_skill). - The
openviking-memory,openviking-skills,ov-experience-memory,openviking-rule-search, andov-memory-doctorskills.
If you disable the plugin in Kimi Code, it stays disabled after an upgrade.
Hooks and MCP read the same credentials from ~/.openviking/ovcli.conf. OPENVIKING_URL and OPENVIKING_API_KEY override that file, and per-plugin settings live under plugin.kimicode (see Plugin Settings). Sessions are stored in OpenViking as kc-<session id>.
Verify
- Check that
plugins/installed.jsonunder the Kimi home has anopenviking-memoryentry and that the plugin is enabled in Kimi Code. - Start a new session and ask Kimi Code to run a check with the
ov-memory-doctorskill. - Tell Kimi Code a test preference and end the session normally. After memory extraction completes, start a new session in the same workspace and ask about it.
Host-specific behaviour
Kimi Code registers SessionStart, UserPromptSubmit, Stop, PreCompact, SessionEnd, Interrupt, and a PreToolUse URI guard on Read|Glob|Grep. Everything else works as on every shared-flow host; see the Capability Reference.
- The profile is injected at the first prompt. Only
UserPromptSubmitoutput reaches the model, so the session-start context arrives with the first prompt rather than at session start. Context is printed as plain text, not JSON. - The model passes the session to
session_history. The MCP server cannot tell which session calls it. - Cancelled turns commit too. Kimi fires
Interrupt, notStop, after a cancelled turn; the plugin captures and commits synchronously, like a session end, within a 2-second budget for all its OpenViking requests. If capture is slow, the commit waits for the next commit of the same session. - Session start replays at most 2 offline-queue entries. Kimi drops hook entries that carry extra fields, so this limit lives in the plugin rather than the hook manifest.
- The URI guard checks file reads only; shell commands and writes are not checked.
- Capture reads the session's
wire.jsonl. - Subagents are not captured.
The verified host contract and versions are recorded in hosts/kimicode/DESIGN.md.
Upgrade and uninstall
Re-run the install command to upgrade. To uninstall, run:
curl -fsSL https://openviking.ai/install | bash -s -- --uninstall --yes --harness kimicodeUninstall removes the managed plugin, its entry in installed.json, and the runtime files. Other plugins are left alone.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| No recall | The plugin may be disabled in Kimi Code. Enable openviking-memory in Kimi Code, then start a new session. |
| The installer reports an incomplete plugin install | Re-run the installer. |
| MCP does not connect | Check the URL/API key in ~/.openviking/ovcli.conf, then start a new session. |
| Detailed diagnostics are needed | Start Kimi Code with OPENVIKING_DEBUG=1 and inspect ~/.openviking/logs/kimicode-hooks.log. |