LittleBlackTong/dsh-plugin-memory

Plugin插件 Native原生 ⭐ 4 MIT Memory & Knowledge记忆与知识库

Project Overview项目介绍

This is a native Cordis plugin built exclusively for DeepSeek Harness (DSH), packaged with a valid DSH bundle manifest that can be installed directly via DSH's built-in plugin command. To install it, users just run dsh plugin add dsh-plugin-memory and restart their DSH profile to activate it. It adds persistent cross-session long-term memory to DSH agents, following the LLM Wiki markdown memory pattern first popularized by Andrej Karpathy. It automatically injects compiled memory blocks into the system prompt context on session start, so agents do not have to rely on chance to retrieve memory.

When first installed, the plugin automatically starts a guided "soul forging" workflow, which asks the user to define the agent's personality, name, relationship to the user, and core values, and saves these to a SOUL.md file in the memory library. It includes four core operations: remember to distill content into the memory library, recall to retrieve memory on demand, consolidate to clean up and organize old entries, and forget to explicitly remove or archive outdated memory. A built-in CLI tool supports initializing the memory scaffold, searching for content, checking memory health, and packing/unpacking memory for migration across devices or agents.

The plugin supports hot configuration of core settings like total enable/disable, memory directory location, injection behavior, and active recall parameters via a custom settings panel in DSH, so users can adjust all common settings without manually editing configuration files. Changes take effect immediately without requiring a full DSH restart. All memory is stored as plain markdown files, so it is fully portable and can be accessed by any agent that can read markdown, even outside of DSH. It is written in pure ESM JavaScript with no build step required, and released under the permissive MIT open source license.

这是专门为DeepSeek Harness(DSH)打造的原生长期记忆插件,以Cordis插件形式开发,遵循DSH插件打包规范。它基于纯markdown记忆库模式为DSH Agent提供跨会话的持久记忆,会话启动时自动向系统提示词上下文注入记忆块,保障记忆加载不依赖模型主动调用,还自带一套可独立使用的便携CLI工具用于记忆管理。

插件支持记忆目录自定义配置,提供开机注入开关、礼貌闸门(用户发言后才注入、仅注入当前激活会话)、主动追忆、防懒沉淀提醒等功能,还自带引导式铸魂流程,首次安装后会自动引导用户定义Agent人格,完成后才进入常规工作流,记忆可通过打包命令跨设备迁移。

安装方式十分简便,通过DSH插件管理命令即可完成安装,内置DSH bundle manifest,会自动挂载到配置文件,无需手动修改。插件使用纯ESM JavaScript开发,无需构建步骤,安装即可使用,采用MIT开源许可,记忆本体为纯markdown格式,任何支持读取markdown的Agent都能读取迁移。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 4 stars - very few users, little community feedback星标只有 4,几乎没人在用,遇到问题缺少社区反馈
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 dsh-plugin-memory

把 LittleBlackTong/dsh-plugin-memory 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-plugin-memory

GitHub npm license node

DeepSeek Harness 长期记忆插件:跨会话、可迁移、带「灵魂」的 markdown 记忆库。

English TL;DR — A Cordis plugin for DeepSeek Harness that gives agents a persistent, cross-session, migratable long-term memory: a markdown + git store (inspired by Karpathy's LLM Wiki pattern) with a SOUL.md persona file, auto-injected at every session start via the system-prompt runtime context, plus remember / recall / consolidate / forget workflows and portable CLI tooling.

特性

  • 开机强制注入(带路由表保护):插件通过 ctx.systemPrompt.context() 把记忆 boot 块(SOUL.md 人格 + MEMORY.md 协议 + index.md 目录 + 最近动态)注入会话上下文。宿主按投影去重:记忆不变就不重复注入,变化时新快照自动取代旧的——这是"新会话必先加载记忆"的硬保障,不需要模型碰运气调技能。总预算是 bootMaxChars,按文件分配:每个文件先拿一份均分(受实际大小封顶),剩余额度优先给 index.md、再给尚有内容未注入的文件——所以记忆库长大时,目录的尾部不会先被截掉(详见「boot 预算分配」)。默认还带两道礼貌闸门:deferUntilUserSpeaks(用户开口后才注入)与 activeSessionOnly(只注入当前激活会话),见「配置」。
  • last_access 自动戳记:MEMORY.md 的 salience 衰减规则依赖 last_access,而它以前纯粹靠自觉——模板里有字段、规则里提到它,但没有任何代码去写它,于是每个页面都原地变老、衰减表形同虚设。现在会话收到第一条真实用户消息时,插件会把 boot 块实际注入过的页面(SOUL.md / MEMORY.md / index.md + 目录里被引用到的页)戳成当天,每会话一次、按天幂等,只改 last_access 一行;dsh-memory touch <pages...> 可手动补记,trackPageAccess: false 可关闭。
  • SOUL.md 铸魂:安装后首要任务是和用户对话定义灵魂(名字、性格、价值观、语气、边界)、确认身份与关系(BOOTSTRAP.md 清单驱动,complete 前优先于常规任务)。
  • 铸魂自动引导:记忆库还没有灵魂(BOOTSTRAP.md 非 complete,或 SOUL.md 仍是占位模板)时,boot 块会自动前置一段第一人称引导词——「我的首要任务是确认我是谁,还有你是谁:我叫什么名字、怎么称呼你、你我是什么关系、我该是什么样的性格」——像 OpenClaw 初始化那样,由 agent 在对话里主动发起铸魂,逐项问、逐项写回,而不是等用户来喂。铸魂完成后引导词自动消失,零开销。
  • 复利记忆:遵循 Karpathy 的 LLM Wiki 约定——记忆是"一次编译、持续保鲜"的持久产物,不是每次查询重新 RAG。remember / recall / consolidate / forget 四操作 + salience 三级衰减。
  • 可迁移:记忆本体是纯 markdown + git + 自描述 schema,任何能读 markdown 的 agent 都能接手。dsh-memory pack/unpack 打包迁移。
  • 内嵌技能:通过 ctx.skills.register() 注册 memory 技能(操作协议随插件分发);项目级 .dsh/skills/memory 文件技能仍可覆盖它。
  • 防懒 digest 唤醒:每轮结束后,若 agent 空闲且记忆库超过 digestNudgeAfterMinutes 未写入,插件注入一条 digest 提醒(合成消息,走 agent.followup),把"会话收尾沉淀"从靠自觉变成有机制兜底;带冷却与每会话限次,不骚扰。独立于 dsh-plugin-heartbeat,两插件各自可装、互不依赖。
  • 主动追忆(拟人化):对话空下来时,插件会以第一人称主动提起一件真实记得的、关于用户或你们之间的事(偏好、往事、未了的决定、最近的进展),把记忆从"只写回"变成"也用起来"——像老友自然想起那样,而非报状态。间隔在最短/最长之间随机取值(不固定节奏),配合每会话限次,不骚扰、不编造、不硬聊;纯对话行为,不写记忆库。同样独立于 heartbeat。
  • git 自动提交:记忆库变更静默 autoCommitQuietSeconds 后自动 git add -A && git commit(无 .git 则跳过)——历史可回滚不再依赖 agent 记得 commit。
  • 设置面板:在 DSH 设置页提供「记忆 Memory」区块——总开关、记忆目录、开机注入、技能注册、主动追忆(开关 + 随机间隔范围 + 每会话次数)均可热改,立即生效,无需重启。
  • index 自动整理(声明式编译):索引行不再手写。页面在 frontmatter 里声明 summary:,dsh-memory index --write 把行重写为它的投影(标签 ≤32 / 摘要 ≤48 / 整行 ≤132 字符),只改行内容,分节与顺序逐字节保留,且幂等。index --check 给机器判定(有漂移退出码非 0),index --sync-frontmatter 把已写在 index 里的摘要回填进页面(老库一次性迁移)。digest 提醒会在索引漂移时附一句提示,agent 顺手就能修。
  • 互链成为默认动作:index.md 是目录(谁存在),页间互链才是关系(谁和谁有关)——实测一个真实记忆库里 29 页只有 1 条真互链,而图谱与跨页综合全都建立在这层关系上。现在三处一起推:skills/memory.md 的 remember 流程、MEMORY.md 模板的工作流、以及 digest 提醒的收尾指令,都明确要求"给这次碰过的页面各补 1–3 条相关页链接"。
  • 补链建议:dsh-memory graph --suggest 列出「只有索引入口、没有任何内容关系」的页面该引用谁——按共享主题 tag、标题词、同类型打分,并说明理由(共享 #dsh / 标题词 dsh / 同类型)。只报告不写入:是否连、怎么连由 agent 决定。GET /api/memory/graph?suggest=1 同源。
  • 记忆图谱:设置页里一张只读关系图 —— 不只是 index.md 那种"索引连着所有页"的星形,而是把页面已经编码但没人画出来的关系画出来:索引路由(index.md 指向每一页——这是全库最大的边集,43 条;先前版本跳过了元文件,导致 index 在图上孤立无援)、页间显式 markdown 链接(含相对路径解析)、共享 frontmatter tag(通用容器 tag 如 project/skill 会被忽略,稠密 tag 走锚点链而非全连接)。坐标由服务端 lib/graph-layout.js 一次性算好(确定性、无随机、无依赖),客户端只负责画 SVG。可交互:滚轮缩放(以光标为中心,缩放范围 0.4×–2.5×,非 passive 监听所以不会连带滚动设置页)、拖空白处平移、重置视图 回到全图;按住节点即可拖走,直接邻居按距离轻微跟随,松手后带缓动滑回原布局——拖动期间暂停过渡做到 1:1 跟手,用 O(邻居数) 的局部松弛而不是逐帧全量力导向(后者在几百页时会卡)。悬停高亮邻里,首次渲染从中心绽开(尊重 prefers-reduced-motion)。图谱每 25 秒自动刷新(面板开着时记忆变更会自己出现,副标题显示「更新于 HH:MM:SS」);取数失败保留上一张图而不是清空。视图数学(zoomAt/panBy/toGraphPoint)在 lib/graph-view.js 里是纯函数并有测试——缩放中心不漂移这件事必须被钉住。GET /api/memory/graph(只读、实时,?types=1 追加同类型弱边)。三类边在图上可区分:页间互链=实线蓝、索引路由=灰色虚线、共享 tag=细线。
  • dsh-memory checkup:把四个读者(lint 的完整性、status 的计数、看板的体量与新鲜度、graph 的关系)合成一份带优先级的报告 —— 体量、新鲜度条形图、连接度、一致性检查,最后给出"最该做的 N 件事"。四个数字是诊断,"做这三件事"才是产品。有活干时退出码非 0,可被脚本消费。--boot=N 用于按你的 boot 预算计算索引占比。
  • 记忆健康看板:同一区块下方是一张只读看板——记忆页数 / index 路由数 / 记忆字数、访问新鲜度条形图(今天 / ≤7 / ≤30 / ≤90 / >90 天)、四项体检结论(index 链接、孤儿页、frontmatter、新鲜度)与健康分、陈旧页候选、最近 5 条动态。数据来自新增的 GET /api/memory/insights(每次请求实时统计,不缓存),体检口径与 dsh-memory lint 同源,所以看板与 CLI 不会互相打脸。
  • 零构建:纯 ESM JavaScript,无编译步骤,pnpm add 即用。

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

← 上一个 Prev DeepSeek-harness-lark 下一个 Next dsh-plugin-manager →