ZCode
Give ZCode OpenViking context across projects and sessions. After installation, OpenViking Hooks inject relevant context (memories, resources and skills) at session start and 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 ZCode. The installer guides you through the OpenViking connection settings; select ZCode when it asks which agents to set up. It is preselected when zcode is on PATH or ~/.zcode 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.Restart ZCode after installation.
Once installed, start a new ZCode 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
ZCode reads hook and MCP configuration from ~/.zcode/cli/config.json, and the installer merges the OpenViking entries into it:
hooks.enabled: true, with the lifecycle hooks and the URI guard underhooks.events.mcp.servers.openviking: the OpenViking MCP server as a stdio proxy (tools such assearch,read,remember,add_skill). An existingopenvikingserver that OpenViking did not write is kept.~/.zcode/skills/: theopenviking-memory,openviking-skills,ov-experience-memory,openviking-rule-search, andov-memory-doctorskills. A skill you edited, or an existing unmanaged directory of the same name, is preserved on upgrade and uninstall.
The hooks and the MCP proxy run from the runtime under ~/.openviking/agent-integrations/zcode/.
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.zcode (see Plugin Settings). Sessions are stored in OpenViking as zc-<session id>.
Verify
- Run
node ~/.openviking/agent-integrations/zcode/scripts/ov-memory-doctor.mjsand check that the report has no ✗. - Restart ZCode, start a new session, and confirm that the
openvikingMCP server is connected. - Tell ZCode a test preference. After memory extraction completes, start a new session in the same workspace and ask about it.
Host-specific behaviour
ZCode registers SessionStart, UserPromptSubmit, Stop, and a PreToolUse URI guard on Read|Glob|Grep. Everything else works as on every shared-flow host; see the Capability Reference.
- No session-end or compaction event. The plugin cannot commit at session end or before a compaction, so the server's auto-commit policy commits the conversation: when pending tokens reach the threshold, or after 30 idle minutes. The idle commit needs
memory.session_auto_commit.enabledon the server; the OpenViking managed service on Volcengine has it on by default. - The URI guard checks file reads only. ZCode validates hook output against a strict schema and drops the whole output when it meets a field it does not know. Whether a shell notice passes that check has not been verified, so the matcher leaves out shell and write tools.
- Session-start context is capped at 20,000 bytes. ZCode drops hook output above 32 KB; above the cap, the memory index is dropped first, then the skill catalog.
- Capture reads the rollout file
~/.zcode/cli/rollout/model-io-<session id>.jsonl. When that file is missing, it falls back to the prompt and reply carried by the hook payloads. The first capture reads the whole rollout, so installing into a long-running session produces one large upload. - Subagents are not captured.
Upgrade and uninstall
Re-run the install command to upgrade. To uninstall, run:
curl -fsSL https://openviking.ai/install | bash -s -- --uninstall --yes --harness zcodeUninstall removes only the OpenViking hooks, the openviking MCP server, the skills it installed, and the runtime files. Other configuration is preserved.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Hooks do not run | The hook configuration is disabled or stale. Re-run the installer and restart ZCode. |
| MCP tools do not appear | The MCP proxy failed to start. Check the absolute mcp.servers.openviking command in ~/.zcode/cli/config.json. |
| A turn is captured twice | An older installation left duplicate hook entries. Uninstall, then reinstall. |
| MCP does not connect | Check the URL/API key in ~/.openviking/ovcli.conf, then restart ZCode. |
| Detailed diagnostics are needed | Start ZCode with OPENVIKING_DEBUG=1 and inspect ~/.openviking/logs/zcode-hooks.log. |