Adding memory to DeepSeek Harness

session-query answers about dsh; this is about everything else

dsh can already answer questions about its own conversations — that is what the built-in session-query subsystem is for. This page is about the other question: what you did in Claude Code, Codex, Cursor, opencode or Zed, on the same machine, before dsh existed on it.

The same question put to the same agent twice: without memory it has no record of it, with deja it answers with the decision from eight months earlier

same prompt before and after deja — local BM25 recall across past sessions on disk, zero LLM calls

What dsh already has

Sessions live under $DSH_HOME (~/.dsh by default) as zstd-framed JSONL, one file per session, and session-query searches them. Two limits: it is dsh's own history only, and a fresh session does not consult it unless you ask.

Adding recall

dsh plugin --profile web add dsh-deja

The plugin runs the deja binary, which does the indexing. npm installs a copy with the package, a deja already on your PATH wins over it, and DEJA_BIN overrides both — so your own deja update or brew upgrade is what decides the version, not whatever a plugin release froze.

With the CLI instead:

deja install dsh-auto

That writes the MCP server and the /deja command into the profile patch layer, and adds the plugin that puts recall in front of the model. In dsh web it also adds the panel above the input where you see deja's per-prompt receipt, which names the agent the memory came from, and its session-start notes, the same one the package draws. deja install --auto does the same for every other agent on the machine in one pass.

Both at once is fine: the package looks for what the installer wrote in $DSH_HOME/plugins/deja/ and contributes only what is missing, so you never get two /deja commands, two panels or the same recall twice.

If dsh plugin --profile <profile> add dsh-deja fails with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED under pnpm 10, pnpm is rejecting an existing git-hosted plugin in ~/.dsh/profiles/<profile>/package.json that declares a prepare script (such as dshmarket, named on the [allow build] line) — neither dsh-deja nor @vshulcz/deja-vu defines build scripts. Add that blocked package to pnpm.onlyBuiltDependencies in the profile's package.json, or bypass pnpm with deja install dsh-auto.

Fix: "format v4 message requires a producer-owned source kind"

A plugin written before this release sends its notices with the retired v3 source, which dsh v4 refuses with format v4 message requires a producer-owned source kind. deja doctor reports that plugin as stale. Reinstall the local plugin or update the npm package to replace it:

deja install dsh-auto

If you installed the npm plugin instead, update dsh-deja with dsh plugin --profile web add dsh-deja.

What arrives

Six tools the model can call — search past sessions, read one in full, see a file's history, ask what fixed an error, ask how a command is really run here, store a decision — a /deja command for asking directly, and recall that arrives on its own: before each assembly the plugin asks whether this machine's history answers the prompt, and adds it when it does. Silence is the common case. The same plugin speaks at the point of action too: after the agent reads or edits a file it adds what past sessions settled about that file, and after a command fails it adds what fixed the same error here before.

One implementation note worth knowing if you write dsh plugins: recall goes through ctx.systemPrompt.context, not through a middleware on agent/pre-step. The obvious alternative loads fine, completes the turn, and never reaches the model — a later listener in that waterfall rebuilds its answer from the payload and the spliced message is dropped with nothing reported. That was settled by reading the requests dsh actually sent.

The part that is not about this harness

The index covers every agent's transcripts on the machine — fifty-two of them today, each in its own format — so a fix found in one tool answers a question asked in another, including sessions from before any of this was installed. That is the reason to index rather than to capture.

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). An injection is capped at 1,536 bytes per prompt and about 4 KB per tool call — what memory costs has the measured comparison.

Repository memory & handoff

Share vetted project decisions and dead ends through git in .deja/memory.jsonl (deja repo candidates, deja repo add <id>). Entries are redacted on write, stored sorted with merge=union so parallel branches merge cleanly, and loaded for any teammate who clones the repository ({"activations":{"auto":{"repo":false}}} in the trust policy keeps them out of hooks). See repo memory.

Switching tools mid-task? Run deja handoff --to <agent> (or use handoff via MCP) to transfer the active session's goal, decisions, touched files, passed checks, and open work into another coding agent.

Getting started · Switching between agents · The DeepSeek Harness session format · The plugin source

Found this useful? Star deja-vu on GitHub.