gezi-wen/sage-mem 预览 preview

gezi-wen/sage-mem

File-based cross-session memory for DeepSeek Harness (DSH) — every memory is a plain Markdown file. 纯 Markdown 存储,无数据库、无 worker、无端口;从 Claude Code 无损迁移记忆与人格,带记忆星图与可选的记忆整理。

Project Overview项目介绍

sage-mem is a native long-term cross-session memory plugin built exclusively for DeepSeek Harness (DSH). It adds persistent memory capabilities to DSH agents, allowing them to recall information from past sessions in new conversations. Unlike most competing memory solutions that rely on SQLite databases and persistent worker processes, sage-mem stores all memory entries as individual local Markdown files, with metadata in frontmatter and content in the file body. To install sage-mem, add it as a dependency to your DSH profile’s package.json, run pnpm install, and restart DSH to activate it, or clone the repository and link it locally for development.

sage-mem supports lossless migration of agent memory and personality from Claude Code. Claude Code’s CLAUDE.md personality file can be directly reused as DSH’s native AGENTS.md without any changes, and existing Claude Code memory can be imported just by copying the files over to sage-mem’s memory directory. On each new user query, the plugin scans the memory directory, matches relevant memory using the entry’s description and filename, and injects relevant memory into the agent’s context. Entries marked as baseline for things like agent identity or todo lists are automatically injected at the start of every new session, with a hard cap of 5 baseline entries.

sage-mem is released under the open-source Apache 2.0 license, and requires Node.js 18 or newer to run. It is currently officially compatible with multiple DSH versions, ranging from 0.1.2-rc.1 to 0.1.5-rc.1. Users can set a custom memory directory path via the SAGE_MEM_DIR environment variable; the default memory directory path is ~/.sage-mem/memory. When you uninstall sage-mem, your existing Markdown memory files are kept in place and not deleted. The plugin does not require any persistent worker, SQLite database, or open network port to operate.

sage-mem 是专为 DeepSeek Harness(DSH)开发的原生跨会话记忆插件,用来为 DSH 添加长期记忆能力,让 AI 代理能在不同会话之间保留和调用已获取的信息。和市面上大多数依赖 SQLite 数据库和常驻进程的记忆方案不同,它将所有记忆存储在本地 Markdown 文件中,用 frontmatter 存元数据,正文存内容,透明可检查还能有效防止记忆无意义膨胀。

这款插件支持从 Claude Code 无损迁移记忆和人格,Claude Code 的 CLAUDE.md 人格可以直接改成 DSH 原生的 AGENTS.md 一字不改使用,原有记忆只需拷贝文件就能导入到插件的记忆目录,适合已经在 Claude Code 积累了代理记忆想要迁移到 DSH 的用户。每次用户提问时,插件会检索记忆目录,匹配相关记忆注入上下文,标记为 baseline 的记忆会在新会话开始时自动注入。

sage-mem 遵循 Apache-2.0 开源许可,要求 Node.js 版本不低于 18,兼容多个已发布版本的 DSH。安装时只需在 DSH profile 的 package.json 中添加依赖,执行 pnpm install 后重启 DSH 即可,也可以 clone 仓库后本地链接安装。用户可通过环境变量指定自定义记忆目录,卸载后原记忆 Markdown 文件会保留,插件限制最多只能有 5 条 baseline 类型的记忆。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 7 stars - very few users, little community feedback星标只有 7,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add sage-mem

把 gezi-wen/sage-mem 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

sage-mem · DSH 的文件式记忆插件

npm version npm downloads license DSH

给 DeepSeek Harness(DSH)装上跨会话记忆。纯 Markdown 存储,透明、可检查。

如果这个工具帮到了你,欢迎给个 ⭐️ Star 支持一下!

记忆就是本地的一堆 Markdown 文件(frontmatter + 正文)——不是数据库,没有私有格式。agent 今天记住的事,明天的新会话自动想起来。

English — file-based cross-session memory for DeepSeek Harness: every memory is a plain markdown file you can open, edit and delete; no database, no worker, no port.

为什么需要 sage-mem

DSH 原生没有记忆系统。每个新会话都是一张白纸——agent 不记得你是谁,不记得你们昨天做到哪,不记得项目进行到哪一步。你只能每次重新交代一遍。

市面上的记忆方案大多走 SQLite + 常驻 worker:记忆写进数据库就不透明(想看看存了什么得去查表),事件全捕获又会让库膨胀(「用户打了个招呼」也算一条),还得额外养一个进程和一个端口。

sage-mem 换一条路:每条记忆就是一个 Markdown 文件。用编辑器打开就能看、能改、能删;存不存由 agent 按规则判断,不做无差别捕获。让 agent 真正记住你和你的项目,而这份记忆始终握在你自己手里。

核心特性

特性 说明
文件式存储 每条记忆一个 .md:frontmatter 存元数据,正文存内容。无数据库、无隐藏格式,VS Code 直接打开就能改
跨会话记忆 每轮提问自动扫记忆目录、按相关度挑出最相关的几条注入上下文。agent 第一轮就「想起来」,不需要它自己去翻文件
Claude Code 无损迁移 CC 的记忆与人格都是 Markdown——直接拷文件就完成迁移,不写转换脚本。详见下一节
零额外服务 无 worker、无 SQLite、无端口、无常驻进程,不需要额外的 API key 或云服务(运行时唯一的依赖是普通 npm 库 zod)
防膨胀 靠规则引导 agent 判断「值不值得存」:无实质内容的不存,靠读代码 / git 能推出来的不存

界面上还有三块附加能力(都可以不用):

  • 记忆管理页(v0.4)——DSH 设置页里的「记忆管理」:浏览、查看、编辑、删除、新建记忆,不用离开 GUI
  • 类型与标签筛选(v0.6)——文件列表顶部一排 chip,按四类 + 自定义标签筛;标签从全库自动聚合计数,与搜索框是 AND 关系
  • 记忆星图(v0.4 起,v0.6 重做)——把记忆画成星空:按类型着色、按体积分级、按新鲜度分亮度,还支持时间线与「诞生回放」。渲染是按需重绘,画面静止时不发起任何绘制

记忆星图

记忆星图:每颗星是一条记忆 —— 颜色对应类型、大小对应体积、亮度对应新鲜度,底部是四类计数与库总体积。全部 94 条记忆的文件名不会出现在图里,星图只画关系与分布。

快速开始

需要 DSH 0.1.2-rc.1 或更高(见兼容性),Node.js >= 18。

# 把 web 换成你自己的 profile 名
dsh plugin --profile web add sage-mem

dsh plugin add 一步做两件事:把 sage-mem 装进这个 profile 的依赖,并自动把它的 bundle 追加进 dsh.profile.bundles——不用手改 package.json。

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-skillport 下一个 Next dsh-flash-presets →