Qinling-Melon-Farmers/dsh-memoir8

dsh-memoir

Project persistent memory and session-lessons distillation for DeepSeek Harness (DSH): an agent records a session's work summary, lessons learned, and next-action guide (memoir_record) into a per-project PROJECT_MEMORY.md plus a cross-project index (~/.dsh/dsh-memoir.json), reads it back on demand (memoir_read), auto-distills each worked turn at turn end, and has the project memory auto-injected into the system prompt of future sessions. Ships a web-GUI 'Memory' panel (project/global tabs, search, manual record/delete) over /api/dsh-memoir routes. TypeScript, mounted via the dsh.bundle.patch manifest, no dsh source changes.

AI Analysis

核心用途是为智能体提供跨会话的项目级持久记忆与经验积累。适合需要长期跟进复杂项目、避免AI遗忘历史设定或重复犯错的开发与写作任务。

Package
dsh-memoir
Version
0.4.1
License
Apache-2.0
Last updated
Aug 16, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Qinling-Melon-Farmers/dsh-memoir

配置

cordis.patch.yml 的行上可加 config(全部可省略,默认值如下):

- insert:
    - id: memoir
      name: dsh-memoir
      config:
        enabled: true            # 总开关(工具、路由、注入段)
        announceToAgent: true    # system prompt 公告段
        autoDistill: true        # 每轮有实际工作的回合结束自动提醒归纳
        hotMemoryTokens: 900     # v0.4 注入 Hot Memory 的目标 token 数
        hotMemoryMaxTokens: 1200 # v0.4 注入的硬上限(永不超过)
        readDefaultLimit: 8      # memoir_read 默认返回条数
        readMaxLimit: 30         # memoir_read 最大返回条数
        sessionSnapshotMax: 128  # 每会话快照的 LRU 上限
        queryCacheSize: 128      # v0.4.1 memoir_read 排序查询的 LRU 缓存大小

使用约定

  • 自动模式(默认):插件在每轮有实际工作的回合结束自动提醒归纳;agent 按提示调用 memoir_record 即可。
  • 手动模式(autoDistill: false:任务收尾时,归纳「做了什么 / 踩了什么坑 / 下一步怎么走」,分三条调用 memoir_recordworklessonsactions)。
  • 接手项目:新会话开始时先用 memoir_read(默认 project)读取项目记忆与行动指南;跨项目检索用 memoir_read(scope: 'global', query: ...) 或面板的全局 tab。
  • 人工维护:面板里可随时手动补录、检索、删除。

使用情况:它能解决什么,不能解决什么

以「反复遇到控制台中文乱码、某种终端反复报转义错误」为例:

能解决「反复踩同一个坑」。第一次解决后,把诊断结论与修复步骤记成一条 lessons(例如:先 chcp 65001,脚本里设 $OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8;写文件一律 UTF-8 无 BOM)。此后本项目的每一个新会话都会自动注入这条经验,agent 直接照做,不再重新踩、重新查;跨项目也能用 memoir_read(scope: 'global', query: '乱码') 检索到。这正是本项目实际发生过的例子(见本仓库开发时沉淀的 PROJECT_MEMORY.md:PowerShell 管道中文乱码、终端 ANSI 转义错误、Get-Content 读无 BOM UTF-8 文件乱码三条 lessons 都来自真实踩坑)。

不能「根治」终端或控制台本身的编码缺陷。乱码的根因是终端代码页(GBK)与输出编码(UTF-8)不匹配、或终端不支持 ANSI 转义——这些由终端、shell、控制台宿主的配置决定,记忆插件不会去改它们。插件做的是把「根因 + 修复命令」沉淀为项目知识,让 agent 每次都能直接套用正确解法;若某台机器/某个终端的配置本身就坏了,仍需要按经验里的命令修一次。

其它典型使用场景:

场景怎么用
反复出现的环境坑(乱码 / 转义 / 路径 / 权限)解决后记一条 lessons,附可复制的修复命令
项目红线与约定(禁 emoji、发布前跑测试、分支规范)记入 actions,自动注入给接手者
难查 bug 的根因与结论记入 lessons / work,避免重复排查
部署 / 上线的固定步骤清单记入 actions,新会话照单执行
跨项目复用经验面板全局 tab 或 memoir_read(scope: 'global', query: ...) 检索