Noelune/unified-agent-memory

DeepSeek Harness 的统一车队级代理内存系统——为 dsh、Codex、Claude Code 和 Hermes 提供共享的 Obsidian Vault,并配备无依赖的 Python FTS5 核心。

Project Overview项目介绍

This is a unified cross-agent persistent memory system designed for multiple agent runtimes, including DSH, Codex, Claude Code, and Hermes. It follows the Obsidian Vault storage standard for human-readable knowledge management that lets users directly edit and audit knowledge with Obsidian. It uses SQLite FTS5 to build a local full-text search index for fast, privacy-first retrieval that keeps all data on your local machine. The system delivers a complete closed-loop lifecycle for knowledge, covering ingestion from agent sessions, promotion of confirmed facts, adjudication of conflicting information, and decay/forgetting of stale low-value knowledge. It automatically redacts sensitive credentials like API keys before knowledge ingestion to prevent credential leaks.

The core of the system is implemented entirely with Python standard library, so there are no third-party dependencies to install and it offers millisecond cold start times. You can run it as a standalone command-line tool without binding it to any specific agent runtime, or integrate it into a custom agent framework with just a few simple API calls. It supports hybrid retrieval that combines BM25 lexical search with optional local semantic embeddings, automatic session digesting that extracts persistent facts from chat history, and intelligent forgetting that preserves high-value knowledge while decaying low-priority facts.

To run the full system including the DSH plugin integration, you need Python 3.10 or newer and Node.js 20 or newer. Obsidian is recommended to browse and edit the generated knowledge vault, but it is not required as all knowledge is stored as standard Markdown files. The project is released under the open-source MIT license, which allows free commercial use and modification. It is community maintained, and contributions via issue and pull request are welcome from external developers. Compatibility is primarily tested against DSH 0.1.5-rc.2.

这是一个跨多代理运行时的统一持久化记忆系统,支持DSH、Codex、Claude Code、Hermes等多个主流AI代理开发平台。它遵循Obsidian Vault存储规范,使用SQLite FTS5构建本地全文检索索引,提供涵盖知识摄取、晋升、冲突裁决和衰减遗忘全流程的闭环知识生命周期管理能力。

系统核心完全基于Python标准库实现,无额外第三方依赖,冷启动性能优异。它提供了从知识提交、索引更新、审核晋升到检索召回的完整工具链,支持混合检索、语义向量嵌入、会话自动提炼和智能遗忘等功能,所有数据都存储在本地宿主机,充分保障用户数据隐私安全。

它同时也支持作为独立命令行工具使用,无需绑定任何特定代理运行时,开发者可以方便地将其集成到自定义代理框架中。项目采用MIT许可证开源,允许免费商业使用,运行要求Python版本不低于3.10,DSH插件部分额外要求Node.js版本不低于20。

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

把 Noelune/unified-agent-memory 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

🧠 unified-agent-memory

Unified Fleet-Wide Agent Memory System for DeepSeek Harness & Multi-Agent Runtimes

跨 Agent 统一持久化记忆系统 — 基于 Obsidian Vault 存储规范与 SQLite FTS5 本地索引的知识生命周期管理基座

npm version License: MIT Python Stdlib Obsidian Native Search Engine

产品定位与问题定义 • 核心技术优势 • Obsidian 存储规范 • Agent 全流程自动部署 • 生命周期控制流 • 安全隔离与防护机制


📌 产品定位与问题定义

传统 Agent 记忆插件多数绑定于特定的 Agent 运行时(Single-Agent Scope),其存储空间与会话相互隔离,缺乏统一的状态持久化与跨代理知识共享能力。

unified-agent-memory 架构旨在为多 Agent 舰队提供统一的知识管理基座:它允许 dsh、Codex、Claude Code 与 Hermes 等多个独立代理共享基于 Markdown 规范的 Obsidian Vault 知识仓库,配合纯 Python 标准库核心与 SQLite FTS5 本地索引,构建涵盖知识摄取 (Ingestion)、知识晋升 (Promotion)、冲突裁决 (Adjudication) 与衰减遗忘 (Decay/Retention) 的全闭环生命周期管理系统。

核心与 DSH 适配器分层维护,具体职责和写入边界见 docs/DSH-MEMORY-ADAPTERS.md。该文档明确区分 unified-agent-memory、dsh-hermes-memory 与 dsh-memory-discipline。


🚀 核心技术优势

  • 统一单一真理来源 (Shared Source of Truth)
    全 Fleet 代理共享一致的 Markdown 知识库规范。开发者与用户可直接借助 Obsidian 等编辑器可视化审计、人工校验或修改代理积累的知识节点。
  • 纯 Python 标准库核心 (Zero-Dependency Engine)
    core/ 模块完全基于 Python 标准库(sqlite3, json, hashlib, argparse, os)实现,无外部依赖开销,具备毫秒级冷启动性能。
  • SQLite FTS5 本地全文索引 (Local-First High-Performance Search)
    检索索引持久化存储于本地 ~/.unified-memory/index-<vault-hash>.db,按 Vault 隔离;基于 SQLite FTS5 引擎实现毫秒级全文匹配与相关度计算,数据隐私完全归属于本地宿主机。
  • 提示词隔离防护与凭据脱敏 (Prompt Injection Defense & Redaction)
    检索输出强制采用 <memory-data> 安全隔离标记包装,明确提示 LLM 区分数据上下文与系统指令;知识摄取前自动对敏感凭据(API Keys/Tokens)执行掩码清洗。
  • 完整知识生命周期控制 (Full Lifecycle Pipeline)
    内置完整的状态流转机制:包含写收件箱暂存、Promoter 知识审核归纳、Adjudicator 冲突事实裁决、Atomic Lock 并发文件锁与 Forgetter 定期记忆衰减归档。
  • 混合检索 (Hybrid Retrieval)
    memory search --hybrid 融合三重流:BM25 词法 + 语义向量 + 概念图谱,加权 RRF 融合、同文档多样化、Token 预算裁剪。无向量时自动回退纯 BM25。
  • 语义向量层 (Semantic Embeddings, 可选)
    memory embed 用 SiliconFlow Qwen/Qwen3-Embedding-4B(1024 维)给每条记忆生成向量,本地 SQLite 存储;搜索“换措辞”也能命中同义事实。API key 存于 ~/.unified-memory/secrets.yaml(0600/用户 ACL),失败静默降级。
  • 会话自动提炼 (Session Digest, 默认开启)
    memory digest 用轻量 LLM 从历史会话归档提炼持久事实,脱敏后写入提交区,经 Promoter 正常晋升;按日期游标幂等,可 --dry-run 预览、--off 关闭。
  • 版本化取代 (Supersession)
    Promoter 识别“改用/迁移到/instead of”等取代信号时,把旧事实移入该笔记 已取代 小节并保留历史,索引标记旧行 superseded,检索只返回最新。
  • 智能遗忘评分 (Salience × Decay × Reinforcement)
    Forgetter 从“90 天未用”升级为 重要性 × (持久地板 + 时间衰减) + 访问强化:偏好/架构/规则等高价值记忆长期保留,普通事实随时间衰减,始终可逆。

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-wanghong-handwritten-ppt 下一个 Next dsh-desktop →