Skip to main content
Glama

dsh-memory-tree

English

给 DeepSeek Harness 保存本地项目记忆。主线记录约束、决策、成果和待解问题。用户确认后,将支线结论合并进主线,再用 Checkpoint 留下阶段快照。支线是记忆记录,DSH 会话与上下文压缩由宿主管理。

安装

DSH bundle

Bundle 的验证目标为 DSH 0.2.2-rc.3。在包含 MCP Manager 的 profile 中安装,例如:

dsh plugin --profile web add github:LeiTATng/dsh-memory-tree

桌面端可用 Desktop profile。若已有手工接入的 memory-tree,先停用并移除该条注册,再使用 bundle。两种入口共用同一工具命名空间。重载后调用 mt_status 检查连接。

独立 MCP

通过 DSH 的 MCP 设置添加一个 stdio 服务,名称为 memory-tree,命令为 Node 18 或更高版本的可执行文件,参数为仓库中 src/server.js 的绝对路径。在 Windows 桌面端也使用 Node 的绝对路径。

将 system-instruction.md 放入 DSH 自定义指令,供 Agent 按需使用工具。

Related MCP server: MemoSaver

工作流

  1. 用 mt_set_project 初始化项目。后续项目读取和写入都显式传 project。 mt_status 可查看项目名。

  2. 用 mt_branch 开支线。完成试验后,用 mt_merge 提交 entries。每项提供 category、text、date(YYYY-MM-DD)、source 和 verification(user-confirmed、tool-verified 或 unverified)。类别可用 constraints、decisions、results、openQuestions。未验证条目进入待解问题。兼容旧的结构化 Markdown summary,其条目以待验证材料导入。

  3. 若检测到疑似冲突,向用户展示新旧条目,通过 mt_merge_resolve 带回预览的 token,逐项提交 keepBoth、replace 或 drop。主线或预览变化后重新确认。相似度用于筛出值得审阅的条目。

  4. 用 mt_checkpoint 冻结阶段状态,用 mt_get_checkpoint 读取快照的 Markdown。日常续接用 mt_get_context 或 mt_search。检索使用中文字符、二元组与英文词的词频余弦。跨项目搜索需显式传 scope: "all",查看历史需显式传 includeHistorical: true。历史结果会标记被驳回、已替换、快照或旧版资料等状态。

存储与升级

默认使用 ~/.dsh/memory-tree。通过 bundle 加载时遵循 DSH 的 DSH_HOME,也可用 MEMORY_TREE_ROOT 指定独立存储。在需要与其他同类插件并用时设置不同的数据目录。

升级前备份整个记忆目录并停止旧服务。旧主线、支线、闲聊文件及 Markdown 快照仍保留。新版本读取旧主线、支线和快照,新项目更改写入项目的 .revisions/。旧主线文件保留为导入基线,当前主线请用 mt_get_context 读取。已归档的旧版摘要按历史参考资料检索。

合并的主线变化、冲突决议和归档状态在同一条修订中提交。存储目录需要支持硬链接(例如 NTFS 或 ext4)。两个进程基于同一修订写入时只有一个成功。状态变化时先重读再重试。备份和同步时包含隐藏的 .revisions/,请仅在服务停止后复制整个目录。

测试

运行 npm test,需要 Node 18+ 和 Python 3。测试在临时目录检查项目隔离、只读查询、合并决议、失败重试、并发写入检测、旧数据读取和两种 MCP stdio 帧格式。可用 DSH_TEST_NODE 选择不同的 Node 可执行文件。

Available Tools

13 tools
mt_branchC

为项目创建一条记忆支线

Inputs: project (required), title.

mt_chatB

显式保存一条闲聊到指定项目的独立记录,保留近期条目

Inputs: message (required), project (required), role.

mt_checkpointC

冻结项目状态为阶段快照,保留历史和会话

Inputs: project (required), title, review.

mt_get_checkpointB
Read-only

按 ID 读取阶段快照 Markdown

Inputs: id (required), project (required).

mt_get_contextC
Read-only

读取有长度上限的项目主线上下文

Inputs: project (required), maxRecent.

mt_helpB
Read-only

显示记忆树使用说明

Inputs: no named parameters.

mt_list_branchesB
Read-only

列出项目的活跃和已归档支线

Inputs: project (required).

mt_mergeB

提交结构化结论。entries 优先,旧 summary 作为待验证材料导入。冲突时先返回待确认决议

Inputs: project (required), branchId (required), entries, summary.

mt_merge_resolveC

使用预览 token 提交完整冲突决议

Inputs: token (required), project (required), branchId (required), resolutions (required).

mt_routeC
Read-only

返回关键词路由建议。显式传 project 时可返回该项目主线

Inputs: message (required), project.

mt_set_projectB

显式初始化项目,返回规范项目名

Inputs: project (required).

mt_statusB
Read-only

查看项目列表或指定项目的主线和支线状态

Inputs: project.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 13 tools

    Disambiguation4/5

    Most tools target a distinct resource and action (branch vs list_branches, checkpoint vs get_checkpoint, merge vs merge_resolve). However, mt_route can return a project's mainline when a project is passed, overlapping with mt_get_context, and mt_status partly overlaps with mt_list_branches by showing branch state.

    Naming Consistency3/5

    All names share the mt_ prefix and snake_case, but action conventions are mixed: some tools are bare verbs/nouns that imply creation (mt_checkpoint, mt_branch, mt_merge) while others use get_/list_/set_ prefixes. It remains readable but not a single predictable pattern.

    Tool Count4/5

    13 tools fit comfortably within the 3-15 range for a memory-tree server. The set includes useful meta tools (mt_help, mt_status) and a couple of potentially redundant entry points, but none feel grossly unnecessary.

    Completeness4/5

    The surface covers the core lifecycle: project initialization, context retrieval, search, branch creation/listing, checkpoint create/read, merge/conflict resolution, chat saving, and status. Minor gaps remain, such as listing checkpoints, deleting or archiving branches, and updating or removing entries.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that lets multiple AI coding agents share state, preserve context across sessions, and coordinate via a knowledge graph, messaging, and branch-preserving checkpoint/resume with conflict handling.
      62 npm
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Local-first MCP server that persists AI coding agent memory and session context, enabling seamless resume across sessions with searchable memories and checkpoints.
      5 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server providing persistent, local-first memory for AI agents via Markdown files in a git repo, with search, branching, and auditability.
      6 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A local-first MCP server providing persistent, layered memory (episodic, semantic, procedural, resource) for AI agents, with search, versioning, and session management via a single SQLite file.
      4
      MIT