通过 ETAPI 把 Trilium 笔记库接入 agent,提供 20 个工具:记忆读写(remember/recall + 自动注入索引)、笔记管理(CRUD/克隆/属性/修订)、全文搜索、周报工作流、附件、日历笔记、备份导入,独立设置卡片,配置 0600 落盘。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-trilium
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:MineRPi/dsh-trilium
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。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
DSH Web GUI 的 Trilium 记忆知识库插件:通过 ETAPI 把 Trilium 笔记库接入 agent, 提供记忆读写、笔记管理、全文搜索、周报工作流、附件、日历笔记、备份导入等能力, 并在设置页提供独立配置卡片。
特性
- 记忆库:
trilium_remember写入(自动归入记忆目录、标题带日期)、trilium_recall检索(限定记忆子树)、会话开始自动注入记忆索引(可开关) - 笔记管理:
trilium_*工具集——创建/读取/更新/删除/恢复、树浏览、克隆(多目录复用)、 属性(label/relation)、修订历史 - 搜索:Trilium 全文语法(
"精确短语"、#标签、子树限定、排序) - 周报工作流:
trilium_weekly_report收集本周素材 → 按《周报撰写规范》成文 → 存档并打startDate/endDate标签 - 附件:
trilium_attachment上传/下载/列出笔记附件(图片、文件) - 日历笔记:
trilium_calendar获取(自动创建)day/week/month/year/inbox 日记笔记 - 备份与迁移:
trilium_backup数据库备份、trilium_export/trilium_import子树导出导入 - 独立设置卡片:设置 → 插件 → 可配置(服务器地址、token、记忆目录、行为开关、测试连接)
- 安全:配置落盘
~/.dsh/dsh-trilium.json(权限 0600),token 不进入 cordis.yml、 不回显给模型;删除笔记需 confirm 确认(软删进回收站可恢复)
验证安装
# agent 工具应出现在会话中(或直接问 agent)
# 连接测试:
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:3080/api/dsh-trilium/config
兼容性
- DSH:
>=0.1.0-rc.7 <0.2.0(Profile Bundle + 嵌套dsh.client契约) - Node.js:
^22.19.0 || >=24.0.0 - Trilium:ETAPI 服务(TriliumNext 0.10x+,普通 Trilium 亦可)
安装
从 npm(推荐)
dsh plugin --profile web add dsh-trilium
从 GitHub
dsh plugin --profile web add github:MineRPi/dsh-trilium
仓库提交了构建产物
lib/,git 安装通常无需构建授权;pnpm ≥10 若仍要求 allowBuilds,按提示把包键加入 profile 的pnpm-workspace.yaml。
激活:重启 dsh web。插件通过 dsh.bundle.patch 自动挂进插件树,
客户端 bundle 由 dsh.client 声明 + exports["./client"] 自动加载。
使用
- 配置:打开 设置 → 插件 → 可配置 → Trilium 记忆库,填入服务器地址
(如
https://your-host/etapi)与 ETAPI token(Trilium 的 Options → ETAPI 生成), 点「测试连接」验证,再「保存」。 - 记忆:告诉 agent「记住 XXX」或直接使用
trilium_remember;回忆时 agent 会先查 自动注入的记忆索引,需要细节时调用trilium_recall/trilium_get_note。 - 浏览笔记:通过 agent 工具
trilium_list_children/trilium_search/trilium_get_note完成。
配置
设置卡片(存 ~/.dsh/dsh-trilium.json,0600)
| 项 | 默认 | 说明 |
|---|---|---|
| baseUrl | (空) | ETAPI 基础地址,如 https://your-host/etapi |
| token | (空) | ETAPI token(GUI 填写,0600 落盘,不回显) |
| memoryNoteId | (空=root) | 默认记忆目录(trilium_remember 写入位置) |
| timeoutMs | 15000 | 请求超时 |
| autoInject | true | 会话开始自动注入记忆索引 |
| deleteConfirm | true | 删除笔记需 confirm 确认 |
cordis.yml config(插件开关)
| 项 | 默认 | 说明 |
|---|---|---|
| enabled | true | 总开关(工具、路由、提示段) |
| announceToAgent | true | 系统提示中声明插件 |
工具清单
trilium_app_info trilium_search trilium_get_note trilium_list_children
trilium_create_note trilium_update_note trilium_delete_note trilium_undelete_note
trilium_clone trilium_attribute trilium_attachment trilium_calendar
trilium_remember trilium_recall trilium_weekly_report trilium_revisions
trilium_backup trilium_export trilium_import trilium_history
开发
npm install
npm run typecheck # tsc --noEmit
npm run build # tsc + tsdown(host lib/ + client bundle)
npm test # node --test tests/
- host 半:
src/index.ts(ETAPI 客户端、工具、路由、记忆注入) - 客户端:
src/client/(独立设置卡片) - 配置存储:
src/store.ts(~/.dsh/dsh-trilium.json,原子写 + 0600) - ETAPI 坑位处理:
src/etapi.ts(PATCH 不含 content、PUT text/plain、子节点逐级 GET、 附件 base64 上传、ZIP multipart 导入)
隐私与卸载
- token 只存本机
~/.dsh/dsh-trilium.json(0600);工具输出原样返回,可能含笔记内容 - 卸载:
dsh plugin --profile web remove dsh-trilium
上架状态
- npm:
dsh-trilium@0.1.2已发布 ✅ - awesome-dsh-plugin PR:#1045 已提交,等待合并(收录中)
- 收录流程:发布 npm → 在
data/plugins/加 YAML 条目 → 运行node scripts/generate-readme.mjs生成双 README → 提 PR → 合并后 dshmarket 自动收录
License
链接
同类插件
vectorize-io/hindsight#coding-agents★ 44359
Hindsight:会学习的 Agent 长期记忆系统,自动召回/保存、知识页、深度反思与按仓库隔离的记忆银行。
volcengine/OpenViking#examples/dsh-memory-plugin★ 39101
面向 DeepSeek Harness 的 OpenViking 记忆与上下文插件:pre-step 自动召回与画像注入、会话捕获、`viking://` URI 防护,以及对接 OpenViking 服务端的 recall/write 记忆工具。
agentscope-ai/ReMe#dsh★ 3545
将 DeepSeek Harness 接入 ReMe 本地优先、自进化的个人知识库:自动把已完成的主 Agent 对话沉淀为用户掌控的 Markdown 记忆,通过 reme_search 结合 BM25、可选向量检索和 wikilink 展开搜索对话与资料,并按日整理长期记忆。
zilliztech/memsearch#MemSearch★ 2691
供 DSH 与其他编程 Agent 共享的 Markdown 记忆,支持自动捕获、步骤前上下文注入、搜索召回,以及通过审阅面板实现 memory-to-skill 自进化。
vshulcz/deja-vu#extensions/dsh★ 1116
读取本机上其他三十三个编程智能体已经写下的会话文件——Claude Code、Codex、Cursor、VS Code Copilot Chat、opencode、OpenClaw、Hermes、Kimi、Cline、Zed 等,包括安装之前的历史:提供 deja_recall、deja_session、deja_blame、deja_fix、deja_how、deja_remember 六个工具与 /deja 命令,并可选地把召回结果加入运行时上下文。本地 BM25 索引,不用大模型,不用向量嵌入,不联网(dsh plugin --profile web add dsh-deja)。
adoresever/graph-memory★ 633
DeepSeek Harness 的可追溯、可检索跨会话记忆:把对话知识沉淀为带类型的图节点(任务/技能/事件)与关系边。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。