Adding memory to ZCode

two stores hold the history, and one config file holds the wiring

ZCode keeps two stores: a JSONL log per project under ~/.zcode/projects/ and the CLI's own SQLite database at ~/.zcode/cli/db/db.sqlite. deja reads both — the database needs sqlite3 on PATH — and neither is read back by ZCode itself, so a new session starts from nothing. This page is about adding that.

What ZCode already has

The two stores, and one config file that holds every surface worth wiring: ~/.zcode/cli/setting.json, with servers under mcp.servers and hooks under hooks.events in Claude Code's shape, down to the nesting. The terminal client takes zcode --resume <sess_id> with the id its database stores, so deja resume on a CLI session prints that command, after a cd into the directory the session ran in.

Adding recall

deja install zcode-auto

One file is touched, and both halves are reversible with deja uninstall zcode-auto:

  • The server under mcp.servers — a level deeper than the mcpServers every other client here uses, which is why it gets its own writer rather than the shared one.
  • Two hooks under hooks.events, the two events deja has something to say at: SessionStart puts the project's memory in front of the model before the first prompt, and UserPromptSubmit answers the prompt that was just typed.

Three details about that hook block, taken from the surface a third-party memory plugin established against a live install rather than from guesswork:

  • Hooks declared in the config file run only with hooks.enabled set. ZCode writes it off; the install turns it on and says so, and the uninstall puts it back off.
  • There is no template expansion in a config hook, so the command carries an absolute path — deja writes its launcher, ~/.config/deja/bin/deja-hook, so the wiring survives the binary moving.
  • The output schema is strict enough to discard a whole response over one unrecognised key, which is what deja's --strict mode is for.

ZCode has no user-level skill directory anyone has found and no custom-command surface, so guidance reaches the model through the tool descriptions and the injected session block instead of a file.

What arrives

Before the first prompt, a short digest of what this machine has done on the project — decisions, the commands that worked, the errors that recurred. On each prompt, the history that prompt is about, when there is any. Silence is the common case, and an injection is capped at 1,536 bytes per prompt and about 4 KB per tool call. What memory costs has the measured comparison.

The part that is not about ZCode

The index covers every agent's transcripts on the machine — forty-three of them, each in its own format — so a fix found in Claude Code answers a question asked in ZCode, including sessions from before any of this was installed. A transcript a client later deletes stays searchable; only deja forget drops one on purpose. Nothing here writes memories, so there is nothing to hallucinate into your history; indexing and search are local, and credentials are stripped as the index is built (privacy).

Getting started · Switching between agents · The ZCode session format

Found this useful? Star deja-vu on GitHub.