Quophic/dsh-persona-memory

Project Overview项目介绍

dsh-persona-memory is a native plugin built exclusively for DeepSeek Harness (DSH) that adds long-term persistent persona memory capabilities to DSH agents. It stores user facts, preferences, project context and lessons learned permanently on disk, and automatically injects relevant memory into every agent request context. The plugin supports automatic background learning, error correction tracking, failure memory logging and automatic memory consolidation to keep memory growing in a controlled way. Its disk format is fully byte-compatible with pi-hermes-memory, so DSH and Pi agents can read and write the same memory files interchangeably.

The plugin organizes memory by project, with each git repository getting its own isolated memory that is automatically injected based on the current working directory. It exposes a memory tool for reading, adding, updating, deleting and rewriting memory entries, and a memory_search tool that uses hybrid retrieval by default. Hybrid retrieval combines FTS5 full-text search and semantic vector search via reciprocal rank fusion (RRF), and gracefully falls back to FTS5-only or substring search if higher-level dependencies are unavailable. It also includes a built-in WebUI settings panel for managing memory, configuring plugin options, rebuilding indexes, and backing up or restoring memory data.

All new memory entries are scanned for security threats before being written to disk: prompt injection payloads, exposed API keys, tokens, private keys and invisible Unicode characters are all blocked to prevent malicious content and credential leaks. Standing instructions can only be added or modified by users via the /standing command or direct file editing, so the agent model cannot inject unauthorized rules into memory. Memory writes use atomic temporary file renaming and a single-lock serial queue to prevent concurrent writes from corrupting files, and it includes a pre-write fingerprint check to avoid overwriting changes made by external processes like Pi.

这是专为DeepSeek Harness(DSH)开发的原生持久化长期人格记忆插件。它可以让智能代理跨会话记住用户偏好、项目信息和过往经验教训,事实信息写入磁盘永久保存,每次请求会自动将记忆注入上下文。插件自带后台自动学习、错误检测纠正、失败记忆记录和容量自动合并功能,磁盘格式与pi-hermes-memory字节兼容,支持DSH和Pi共同读写同一份记忆文件。

插件支持按项目隔离记忆,每个git仓库项目独立保存记忆,会根据当前工作目录自动注入对应记忆内容。提供了memory工具用于增删改查记忆,支持混合检索,优先使用FTS5全文索引加语义向量RRF融合检索,向量检索未启用时回退到FTS5,SQLite不可用时进一步回退到子串扫描。还提供了WebUI管理界面,可配置插件、备份恢复记忆和管理索引。

插件具备内容安全扫描功能,会拦截提示注入、敏感凭据和不可见字符写入,防止恶意内容落盘。常驻指令仅支持用户通过命令或直接编辑文件写入,模型没有写入权限,避免模型偷偷注入规则。存储采用原子写和单锁串行队列,避免并发写入损坏文件,还支持跨进程写保护,检测到外部修改不会覆盖。

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

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

READMEREADME

dsh-persona-memory

持久化长期人格记忆插件 for DeepSeek Harness(DSH)。

让 agent 跨会话记住用户、项目与教训:事实写入磁盘永久保存,每次请求注入上下文;后台自动学习、纠正检测、失败记忆、容量合并让记忆"自己长出来且不失控";磁盘格式与 pi-hermes-memory 字节兼容,DSH 与 Pi 可读写同一份记忆文件。


功能清单

A. 存储与共享

功能 说明
跨会话持久记忆 MEMORY.md(事实/偏好/约定/环境)+ USER.md(用户画像),写入即永久保存
每请求上下文注入 每次请求自动把当前记忆注入系统提示词(memory:profile 段,按字符预算截断)
与 Pi 共用记忆 磁盘格式与 pi-hermes-memory 完全兼容,DSH 与 Pi 读写同一份文件(MEMORY/USER/STANDING/failures/projects)
项目级记忆 每个项目独立记忆(git 仓库根为身份,worktree 共享),按会话 cwd 自动注入(memory:project 段)
记忆老化 条目携带 created/last 日期,合并时据此判断陈旧条目

B. 读写与检索工具

功能 说明
memory 工具 read / add / update / delete / rewrite;which 选 memory/user/failure;project 参数操作项目记忆
memory_search(混合检索) 优先 FTS5 + 语义向量(RRF 融合):FTS5 全文索引(<dir>/.memory-index.sqlite,mtime 自动重建)+ 向量索引(vectorIndexDir 下 .memory-vec.sqlite,只存 embedding、指纹增量同步、纯 JS 余弦);向量未启用时走 FTS5,SQLite 不可用时回退子串扫描;结果始终 ≤searchMaxResults 条、只进工具输出,注入成本不随检索方式增加
用量提示 所有 memory 操作返回用量百分比;达 90%(usageNudgeThreshold)提醒用 rewrite 合并
/standing 命令 用户管理常驻指令(列出 / add / remove / clear)
WebUI 记忆管理页 设置页「记忆管理」区块(settings.section slot):常驻指令增删改、三记忆文件条目编辑/删除、项目记忆浏览/编辑、FTS5/向量索引状态与重建、向量搜索配置(开关/模型/下载源/缓存目录)、已下载模型扫描与缓存检测、插件配置卡(40 项 schema 驱动全量配置)、本地备份卡(立即备份/恢复、自动备份、Pi 丢失自动切换)

C. 自动学习机制

功能 说明
后台学习 每 learnIntervalTurns(默认 10)轮用会话自身 LLM 路由复习近期对话,自动提取持久事实存入记忆
纠正检测 /feedback 事件 + 对话内模式检测(强/弱/负向模式 + 指令词,仅直接人工消息,3 轮限频)→ 立即存 [correction] 失败条目
失败记忆 failures.md 结构化记录 [category] 内容 — Failed: 原因 — Corrected to: 修正;最近 7 天最多 5 条自动注入上下文(memory:failures 段),防止重蹈覆辙
自动合并 记忆超限时用 LLM 合并精简(>30 天无引用可删、偏好/纠正优先保留);只有结果严格更小、可解析且过扫描才提交,失败绝不损坏记忆

D. 安全与约束

功能 说明
内容扫描 每次写入过安检:提示注入/数据外泄载荷、API key/token/私钥、不可见 Unicode 字符一律拦截(防凭据落盘、防记忆被植入恶意指令)
常驻指令 STANDING.md 每行一条、硬预算(20 条/2000 字符)、始终注入(memory:standing 段,早于其他记忆);只有 /standing 命令或直接编辑能写——模型无写入口,防止模型把"常驻指令"偷偷注入

E. 工程与容错

功能 说明
原子写 + 单锁串行队列 临时文件 + rename,崩溃不留半截文件;add/update/remove 走单锁原子读-改-写(mutate),并发工具调用绝不互相覆盖;只读/纯写各自加锁
跨进程写保护 写前 sha256 指纹预检(对照 Pi 的 ExternalMemoryWriteConflict):外部(Pi/手动编辑)改过就不覆盖,重试一次后返回 conflict 提示
与 Pi 字节兼容 对齐 pi-hermes-memory v0.9.4 实测:无尾随换行、charCount 含分隔符、USER 上限 5000、超限拒绝写入、failure 去重按 (text, project)、注入 <memory-context> 围栏
优雅降级 FTS5 不可用回退子串搜索;SQLite 动态 import,插件绝不硬依赖
111 项冒烟测试 用真实 hermes 文件副本验证格式兼容、解析、读写、扫描、合并、项目、纠正、FTS、向量索引、溢出拒绝、字节格式、并发、围栏全链路

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-heartbeat 下一个 Next dsh-connect →