跨会话长期记忆与上下文恢复:读取本机上其他四十五个(45+)编程智能体已经写下的会话文件,支持安装前历史找回与中断恢复(Claude Code、Codex、Cursor、Windsurf、Trae、Antigravity、VS Code Copilot Chat、opencode、OpenClaw、Hermes、Kimi、Qoder、Cline、Zed、Magpie 等):提供 deja_recall、deja_session、deja_blame、deja_fix、deja_how、deja_remember 六个工具与 /deja 命令,并可选地把召回结果加入运行时上下文。共享本地 BM25 CLI/MCP 索引,不用大模型,不用向量嵌入,不联网(dsh plugin --profile web add dsh-deja)。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-deja
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:vshulcz/deja-vu#path:/extensions/dsh
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Español | Português | Français | Deutsch | Русский | Türkçe | हिन्दी
Part of ★ vshulcz/deja-vu (97.2% R@5 on LongMemEval-S) · Full documentation · Website & live search · Browser demo
DeepSeek Harness (and DSH Desktop, anywhere-labs/dsh-desktop, which bundles the dsh runtime and web UI) can already search its own sessions — that is what the built-in
session-query subsystem does. This plugin answers the other question: what you
did in the other agents on this machine.
deja indexes the session files that fifty other coding agents — Claude Code, Codex, Cursor, opencode, Antigravity, Grok Build, Kimi, Cline and Zed among them — already write to disk. Nothing has to have been recorded ahead of time: the history is already there, including the months before deja was installed. If you moved to dsh last week, everything you did before last week is still reachable from inside it.

Install
dsh plugin --profile web add dsh-deja
From the repository instead of npm — the root manifest re-exports this directory, so either form works:
dsh plugin --profile web add github:vshulcz/deja-vu#path:extensions/dsh
The plugin runs the deja binary. It is pulled in as a dependency, so npm
installs it with the plugin; a deja already on PATH is used as-is, and
DEJA_BIN overrides both.
If you have the CLI, deja install --auto wires dsh and every other coding agent on this machine (Claude Code, Codex, Cursor, opencode, Kimi, Cline, Zed and more) in one step — it adds deja's MCP server and a /deja command to your profile — and that is the shorter path:
curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh
deja install --auto
Or with Homebrew: brew install deja-vu && deja install --auto · Try without installing: npx @vshulcz/deja-vu sources.
Having both is fine: this plugin looks for what the installer wrote in
$DSH_HOME/plugins/deja/ and contributes only what is missing, so the tools and
the command are never registered twice.
What it adds
Six tools the model can call:
| Tool | Answers |
|---|---|
deja_recall |
Sessions matching an error string, function name, file path or flag. |
deja_session |
The full digest of one past session, when the reasoning behind it matters. |
deja_blame |
The sessions that discussed a file, before you edit or delete it. |
deja_fix |
What this machine ran after that same error before. |
deja_how |
The real invocation for a build, test or deploy, from what ran here. |
deja_remember |
Stores one settled decision for later recall. |
One command: /deja <what to look for>.
And, unless you turn it off, automatic recall: once per session the plugin adds what past sessions settled in this project, and before each step it asks deja whether this machine's history answers the prompt and adds the answer to the runtime context. Silence is the common case — it speaks only when there is something to say.
The same recall also wires what deja install dsh-auto wires: after a read,
edit or write the model gets what past sessions said about that file, after a
command that failed it gets what this machine ran after the same error before,
a compaction keeps what the session was in the middle of, and a session that
ends drops its live stamp.
In dsh web you also see the lines deja prints for the person in Claude Code:
the receipt naming the agent a prompt's answer came from, and
at session start what was recalled, the first-build note and the weekly note.
They sit in a small panel above the input until the next prompt, or until you
close it. The model gets exactly what it got before; these lines never reach
it. tui, headless and sdk profiles have no page, so nothing changes there:
the notes still come with the reply to /deja. A line that waits more than
ten minutes for the page is dropped. deja install dsh-auto writes the same
panel from these files; with both installed you get one panel.
- insert:
- id: deja
name: dsh-deja
config:
autoRecall: false # keep tools, /deja and manual search
Search controls
Open Settings → Deja for three switches, all enabled by default and grouped in two sections.
In-conversation search
- Mod+F in conversations writes a real
/dejacommand into the message input —/deja --session <bare session UUID> -- <your draft>— and focuses it. Sending it runs deja against that one conversation, so the search actually happens instead of arriving as an ordinary message; reference chips in the draft are kept and move with the prefix. The shortcut does not send the draft; you send it when you choose. A draft that already starts with another command is left untouched. The default is Mod+F — in this documentModmeansCtrlon Windows/Linux andCmdon macOS, and the defaults below are written in the registry's ownprimaryform, which the framework expands per platform. In a browser the default is Mod+Alt+F (on macOS, Cmd+Option+F), because DSH reserves the browser's ordinary Find shortcut.
Deja full-text search (two switches)
- Mod+Shift+K opens Deja full-text search is the direct cross-session shortcut. It opens DSH's sidebar search and starts it in Deja full-text mode instead of the title search. The magnifying glass returns the native search for that opening. DSH's own Mod+K is left untouched: the shortcut registry rejects a second binding for the same key, so Deja uses Mod+Shift+K (Cmd+Shift+K on macOS), the same default on desktop and in a browser. Turn the switch off to restore the official behaviour completely.
- Deja search in the sidebar controls the magnifying-glass path. It adds a full-text mode to sidebar search: open sidebar search, then click its magnifying glass again to switch to Deja. Enter a query to search the local index of DSH conversations only, see up to 20 hits with matching snippets, and click a hit to open its session. Click the magnifying glass again to return to regular sidebar results. If more matches exist, narrow the query. Missing Deja, failed searches and sessions that cannot be opened are shown as errors.
Linux browsers get no default binding for either shortcut: the browser
service admits only Mod+/, Mod+Shift+, and Mod+Shift+.. Mod+/ already
belongs to DSH's own shortcuts.open (the keyboard settings), so apart from the
other two (Mod+Shift+, and Mod+Shift+.) every combination is rejected.
Record one of those two in the settings below.
These preferences are saved separately in this browser/profile's local storage;
changing one does not change the other, and they do not sync between browsers
or devices. Manual search remains available with autoRecall: false.
Customizing the shortcuts
Open Settings → Deja → Customize shortcuts to change the actual key
combinations. Three rows show the current binding for conversation search,
Deja cross-session search, and DSH's sidebar opener (session.search). Click
Change shortcut, press and release the desired combination, and it saves
immediately. Restore default restores that command's default; Remove
unbinds it. Escape or moving focus away cancels recording. Conflicts and save
failures are displayed without replacing the accepted binding. If a combination
is occupied, first change or remove the other command's binding.
The controls use DSH's native keybinding service, with the same platform-specific persistence, conflict validation and live catalog as Settings → General → Shortcuts. Edits survive plugin updates. Browser/system reserved combinations remain subject to DSH's validation. Older DSH versions without the editing service show an upgrade notice. The switches above enable the features; the keybinding rows determine which keys invoke them.
Sidebar full-text search needs the dsh-deja package host plugin, which
registers its endpoint. The CLI's deja install dsh-auto copies the browser
panel but not that endpoint, so the panel probes it once at startup:
- Settings → Deja → Search endpoint always says what it found — the
installed package and its version, or that
/api/deja-searchis missing. Missing means the sidebar mode, its switch, the cross-session shortcut and its keybinding rows stand down, DSH's sidebar stays exactly as the host drew it, and the page offers the install command (dsh plugin --profile web add dsh-deja, with the profile swapped for yours) to copy instead of leaving a dead switch. - The probe is the route's own
?probe=1ping: only a JSON payload withok: trueandplugin: "dsh-deja"counts as a working endpoint. A 500, a proxy error or an HTML fallback is treated as missing. It names the plugin's version, starts nodeja search, and a declared state (used by tests) wins over a late answer.
Install the package as above to enable the sidebar search; the existing CLI tools and command can coexist with the package.
How it is wired
Recall arrives through ctx.systemPrompt.context, evaluated on every assembly.
The obvious alternative — a middleware on agent/pre-step that splices a
message into the step — loads fine, completes the turn, and never reaches the
model: a later listener in that waterfall rebuilds its answer from the payload
and the added message is dropped with nothing reported. This was settled by
reading the requests dsh 0.1.1-rc.2 actually sent.
The person's lines take one deja call with the recall, not two: where dsh
serves the page, the plugin asks for the hook's JSON reply, hands additionalContext to the model and keeps
systemMessage on the host until the page asks for it at /api/deja-notes,
behind dsh's own login. Anywhere else it keeps asking for --plain, because
deja marks a note shown when it prints it. The browser half is client.js,
plain JS in dsh's module wrapper, so the package has no build step.
Manual sidebar search uses GET /api/deja-search on the same authenticated DSH
API mount. It runs an asynchronous, shell-free
deja search --harness deepseek --json --limit 20 -- <query> call, bounded to
20 seconds and 2 MiB of output. Empty queries launch no process; queries longer
than 500 characters are rejected. The route returns compact session metadata
and snippets rather than complete transcripts.
DSH currently exposes no sidebar-search provider API. The browser adapter stays
inside the data-slot="sidebar.workspaces" anchor and finds the semantic
aria-expanded search button and the _listArea CSS class suffix. This markup
was inspected in DSH 0.2.1-rc.5. If those elements are absent in an older or
changed layout, the adapter leaves the regular sidebar alone. These internal
markup dependencies may need updating for future DSH versions.
Testing the search controls
Run node --test extensions/dsh/test/*.test.js from the repository root for the
synthetic host, preferences, shortcut and composition tests. For the DOM/React
adapter check, serve the repository with a static HTTP server and open
extensions/dsh/test/search-browser.html. That optional fixture loads React
18 from a CDN and uses synthetic history; it does not connect to DSH or read a
local index. A passing report covers mode switching, session opening, host
errors, empty queries, disabling the feature and cleanup.
Benchmarks
| Recall | Tokens | Index & lookup |
|---|---|---|
| 97.2% R@5 on LongMemEval-S (88.9% hit@1, 470 questions) | 58% fewer tokens (on repeated repo tasks) | 13.6 s to index 19,195 sessions / 0.7 ms lookup across 51 coding agents |
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 disables hook injection). More.
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.
Permissions and boundaries
- Host integration: Registers via
cordis.patch.ymlto add six MCP tools (deja_recall,deja_session,deja_blame,deja_fix,deja_how,deja_remember), the/dejacommand, optional lifecycle hooks (autoRecall), and the authenticatedGET /api/deja-searchroute plus sidebar and shortcut UI bindings onweb. - Execution and bounds: Invokes the local
dejabinary with direct argument arrays (no shell);GET /api/deja-searchrejects queries longer than 500 characters and bounds calls to 20 seconds and 2 MiB of output. - Filesystem and network: Reads local agent session stores and
~/.cache/deja/index.db(DEJA_INDEX_DIRoverrides), writes recall state only inside the plugin data directory, and makes no outbound network requests unless you explicitly rundeja embed. - Credential redaction: Strips common secret patterns (
sk-*,ghp_*,AKIA*,Bearer, private keys, and URL credentials) during indexing before snippets reachdsh.
What it does not do
No LLM, no embeddings. The index is a local BM25 store under ~/.cache/deja/index.db (DEJA_INDEX_DIR overrides) built over transcript files that already exist, so a query answers in about a millisecond with no network path unless you explicitly run semantic search (deja embed). Common secrets and tokens (sk-*, ghp_*, AKIA*, Bearer, private keys, URL credentials) are redacted at index time before any snippet reaches dsh.
Part of deja-vu. MIT.
链接
同类插件
vectorize-io/hindsight#coding-agents★ 62276
Hindsight:会学习的 Agent 长期记忆系统,自动召回/保存、知识页、深度反思与按仓库隔离的记忆银行。
volcengine/OpenViking#examples/dsh-memory-plugin★ 42543
面向 DeepSeek Harness 的 OpenViking 记忆与上下文插件:pre-step 自动召回与画像注入、会话捕获、`viking://` URI 防护,以及对接 OpenViking 服务端的 recall/write 记忆工具。
MemTensor/MemOS#memos-local-plugin★ 12467
DeepSeek Harness 本地记忆插件:分层 L1/L2/L3 记忆,自动沉淀与手动 memos_* 检索工具并存,内置记忆浏览器。
agentscope-ai/ReMe#dsh★ 3827
将 DeepSeek Harness 接入 ReMe 本地优先、自进化的个人知识库:自动把已完成的主 Agent 对话沉淀为用户掌控的 Markdown 记忆,通过 reme_search 结合 BM25、可选向量检索和 wikilink 展开搜索对话与资料,并按日整理长期记忆。
zilliztech/memsearch#MemSearch★ 2915
供 DSH 与其他编程 Agent 共享的 Markdown 记忆,支持自动捕获、步骤前上下文注入、搜索召回,以及通过审阅面板实现 memory-to-skill 自进化。
omdsh-dev/dsh-mnemon★ 1070
由 Mnemon 驱动的 DeepSeek Harness(DSH)跨 Agent、本地优先的持久记忆插件。它可在支持 Mnemon 的 Agent 之间共享长期记忆,并提供运行时记忆、可检索项目档案、语义召回、知识图谱和 Sidebar UI。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。