wang-jie-git
dsh-memory
DSH 插件:AI-memory 语义记忆系统完整集成(含设置 UI)| 14 个记忆管理工具 + 设置页面 + 符合官方规范
- Stars
- 0
- Language
- TypeScript
- Created
- Aug 16, 2026
- Updated
- Aug 16, 2026
Introduction
🧠 DSH Memory 插件
基于 One Memory v0.6.0 的 DSH 语义记忆插件,提供完整的记忆管理能力和可视化配置界面。
✨ 功能特性
1. 14 个记忆管理工具
| 工具 | 描述 |
|---|---|
memory_query | 语义检索记忆库(向量 + 图谱混合检索) |
memory_write | 写入单条记忆 |
memory_write_batch | 批量写入记忆 |
memory_dream | 梦境整理(合并冗余 + 聚类洞察) |
memory_compress | 会话压缩(提取关键决策) |
memory_nudge | 智能提醒(检测重复模式) |
memory_profile | 用户画像分析 |
memory_health | 健康检查 |
memory_stats | 统计信息 |
memory_logs | 系统日志 |
memory_errors | 错题本(错误日志分析) |
memory_prune | 清理低价值记忆 |
memory_consistency | 图库与向量库一致性检查 |
memory_rebuild_index | 重建向量索引 |
2. 🎨 设置页面 UI
在 DSH 设置中添加 🧠 Memory AI 标签页,提供:
- ✅ 当前配置概览
- ✅ CodeGraph 目录配置
- ✅ Embedder 类型选择(Simple / API)
- ✅ API 配置(Key / Model / Base URL)
- ✅ 快速操作指南
3. 🔌 API 端点
提供 REST API 供外部调用:
GET /plugins/@wangjiezhong/dsh-memory/health- 健康检查
🚀 快速开始
安装
# 克隆仓库
cd ~/Desktop/dsh-memory-plugin
# 安装依赖
npm install
# 构建
npm run build
# 安装到 DSH
dsh plugin --profile web add .
配置
编辑 ~/.dsh/memory-config.json:
{
"codegraphDir": "~/.codegraph",
"embedder": "simple"
}
或使用 Embedder API 模式:
{
"codegraphDir": "~/.codegraph",
"embedder": "api",
"embedderApiKey": "your-api-key",
"embedderModel": "text-embedding-ada-002",
"embedderBaseUrl": "https://api.openai.com/v1"
}
🛠️ 开发
项目结构
dsh-memory-plugin/
├── src/
│ └── plugin/
│ └── index.ts # 插件主入口
├── dist/
│ ├── plugin/ # 编译输出
│ ├── memory-orchestrator/ # One Memory 核心(混合查询)
│ ├── memory-vector/ # One Memory 向量存储
│ └── memory-graph/ # One Memory 图数据库
├── scripts/
│ └── post-build.mjs # 构建后处理脚本
├── package.json
└── tsconfig.json
构建
npm run build
构建流程:
tsc- 编译 TypeScriptnode scripts/post-build.mjs- 修复相对路径导入
测试
# 启动 DSH Web
dsh web
# 在浏览器中访问 http://127.0.0.1:3080
# 进入设置 → 🧠 Memory AI 标签页
📖 使用示例
在 DSH 对话中使用
用户: 帮我查找关于"项目架构"的记忆
AI: 使用 memory_query 工具检索...
用户: 记录这个决策:采用微服务架构
AI: 使用 memory_write 工具写入记忆...
用户: 检查记忆系统健康状态
AI: 使用 memory_health 工具检查...
配置 API Embedder
{
"embedder": "api",
"embedderApiKey": "sk-xxx",
"embedderModel": "text-embedding-3-small",
"embedderBaseUrl": "https://api.openai.com/v1"
}
支持的 Embedder:
- Simple: 本地纯算法,128 维,零依赖
- API: 外部 embedding 服务(OpenAI、Jina AI 等)
🔧 核心能力
向量 + 图谱混合检索
- 向量粗召回: 快速筛选 Top-K 候选
- 图精排序: 利用图关系优化排序
- 融合打分: 综合向量相似度 + 图结构权重
梦境整理(Dream)
自动执行熵减过程:
- 合并冗余记忆
- 聚类生成洞察
- 清理低价值条目
- 归档重要历史
会话压缩(Compress)
将长会话压缩为结构化摘要:
- 提取关键决策
- 识别未解决问题
- 保留重要上下文
智能提醒(Nudge)
基于模式检测的主动建议:
- 重复错误提醒
- 项目健康检查
- 最佳实践建议
📚 技术栈
- TypeScript 5.4 - 类型安全
- One Memory v0.6.0 - 记忆系统核心
memory-orchestrator- 混合查询编排memory-vector- 向量存储(IVF 索引 + 暴力搜索)memory-graph- 图数据库(SQLite + WAL)
- DeepSeek Harness - DSH 插件系统
- SimpleEmbedder - 纯算法 Embedder(Mulberry32 种子投影)
📄 License
MIT
🙏 致谢
基于 One Memory 项目开发。