Overview
The ZCode integration gives your ZCode agent the same memory as Claude Code. The next ZCode session starts where the last one left off. It does four things:- Observation recording: ZCode’s lifecycle hooks send each tool call to the Claude-Mem worker, and the observer writes observations about it
- Context: the
SessionStarthook returns your memory ashookSpecificOutput.additionalContext, the same envelope Claude Code uses - Session summaries: the
Stophook writes a summary from the last assistant message ZCode sends - MCP search tools: the Claude-Mem MCP server gives ZCode the
mcp__claude-mem__*memory search tools
ZCode reads user hooks from
hooks.events and MCP servers from mcp.servers in ~/.zcode/cli/config.json. The installer adds Claude-Mem’s hooks and the claude-mem MCP server to that file. It keeps your other ZCode settings, hooks and MCP servers. See the ZCode docs for hooks and MCP services.Requirements
- ZCode Desktop 4.0.0 (the version tested). The integration was verified on macOS (Apple Silicon). Windows and Linux are untested.
- Any ZCode model plan. The hooks do not depend on the model ZCode uses.
- Claude-Mem runs on your computer. You do not need CMEM Pro.
Installation
~/.zcode/cli/config.json, saves a backup next to it (config.json.bak-YYYYMMDD, once per day, readable only by you), and writes the new file in one step. If the file is not valid JSON, or hooks, hooks.events, mcp or mcp.servers is not an object, the installer stops and changes nothing.
You do not need to restart ZCode. Start a new ZCode session, or run /reload, so ZCode reads the new config.
Verify
- Run
npx claude-mem zcode status. It printsZCode hooks: installed. It printsdisabledwhenhooks.enabledis nottrue, andincompletewhen a hook or theclaude-memMCP server is missing. See Troubleshooting. - Start a new ZCode session in a project and ask the agent to read a file.
- Watch the observation arrive in the viewer.
- In a new session, ask ZCode to search your memory. It uses the
mcp__claude-mem__*tools.
What is captured and sent
- Captured: your prompts, each tool call (name, input and result, including failed calls), and the last assistant message of each turn.
- Where it goes: the hooks send this to the Claude-Mem worker on your computer. The worker sends it to the observer you chose with
CLAUDE_MEM_PROVIDER(by default Claude, through your Claude account) to write observations and summaries. Memory is stored in~/.claude-mem/. - Opt out: wrap text in
<private>tags to keep it out of memory, list tools inCLAUDE_MEM_SKIP_TOOLSto skip them, or runnpx claude-mem zcode uninstall.
Event mapping
Each hook is a
process hook (the Bun runtime plus the worker script, with no shell), uses the matcher *, and has its own timeoutMs, so a low global hooks.timeoutMs does not cut the worker start. The installer sets hooks.enabled to true only when it is missing.
Limits
- No
PreToolUse: its output can block or rewrite tool calls, so Claude-Mem does not register it. - No
PermissionRequest: Claude-Mem has no handler for it. - No
SessionEnd: ZCode has no such event. TheStophook writes the summary. - No transcript: ZCode deletes the hook’s
transcript_pathfile after the hook runs, so Claude-Mem does not read it. - One switch for all hooks: ZCode runs hooks only when
hooks.enabledistrue, and a missing key means off. The installer sets it totrue, which also turns on any hooks of your own in that file, and it prints how many. If you have other hooks, uninstall leaveshooks.enabled: truein place. - User scope only: workspace configs (
<project>/.zcode/config.json,zcode.json) and ZCode plugins are not changed.
Troubleshooting
- Hooks do not run, or status says disabled: check that
hooks.enabledistruein~/.zcode/cli/config.json. A missing key means off. The installer keeps yourfalseand prints a warning. Set it totrue, then start a new session or run/reload. - Status says incomplete: a hook or the
claude-memMCP server was removed from~/.zcode/cli/config.json. The status line names what is missing. Runnpx claude-mem zcode installagain. - Bun not found: the hooks run Bun by its absolute path. If you moved or reinstalled Bun, run
npx claude-mem zcode installagain. - Changes do not load: start a new ZCode session or run
/reload. - More detail: ZCode writes its logs to
~/.zcode/v2/logs/. Claude-Mem writes its logs to~/.claude-mem/logs/.
Uninstall
claude-mem MCP server from ~/.zcode/cli/config.json. Your other settings, hooks and MCP servers stay. npx claude-mem uninstall does the same as part of a full uninstall. Your memory in ~/.claude-mem/ is not deleted.
