前言¶
DSH 的理念是「一切皆插件」,插件可以加入指定 profile,用於擴展 agent 行爲。DSH 社區目錄是獨立站點,不與 DeepSeek 或幻方構成官方從屬關係。對於需要跨會話保留信息的使用者,單個會話結束後的信息不會自動進入後續會話。
@asherliner/dsh-memory-connect 是一個面向 DSH 的跨會話記憶插件,覆蓋 auto-extraction、semantic recall、scheduled maintenance、LLM-powered consolidation 等能力。該插件 package.json 版本爲 0.6.1,許可證爲 MIT,Node.js 要求爲 >=18。
這是什麼¶
@asherliner/dsh-memory-connect 提供跨會話記憶與全局身份能力。它列出的能力包括:
- Global Soul
- Auto Extraction
- Cross-Session Recall
- Context Explosion Prevention
- Scheduled Maintenance
- LLM Consolidation
- Memory Decay
- Smart Prioritization
- Memory Compression
- Temporal Context Graph
- Trust Model
- Turn-End Summarization
- Semantic Recall
- Zero-config
- SQLite FTS5
倉庫地址:
https://github.com/Asher-2000/dsh-memory-connect
核心功能¶
- Global Soul:通過
~/.dsh/soul.md提供 persistent global identity。 - Auto Extraction:從會話中提取信息。
- Cross-Session Recall:跨會話召回記憶,並列出 SQLite FTS5 能力。
- Context Explosion Prevention:控制記憶上下文膨脹。
- Scheduled Maintenance:提供 scheduled maintenance。
- LLM Consolidation:提供 LLM-powered consolidation。
- Memory Decay、Smart Prioritization、Memory Compression:分別用於記憶衰減、優先級處理和壓縮。
- Temporal Context Graph:列出的記憶能力之一。
- Trust Model:recalled history 作爲 untrusted reference 注入,current instruction always wins。
- Turn-End Summarization:列出的 turn-end summary 能力。
- Semantic Recall:可選語義召回;如果本地 embedding server 不可用,會退化爲 keyword-only recall。
安裝與啓用¶
先安裝到 DSH profile:
dsh plugin --profile <你的profile> add @asherliner/dsh-memory-connect
這條命令會把 @asherliner/dsh-memory-connect 加入指定 profile。
也可以用 npm 直接安裝:
npm install @asherliner/dsh-memory-connect
如果使用本地源碼調試,先克隆倉庫,再用 link: 方式加入 profile:
git clone https://github.com/Asher-2000/dsh-memory-connect.git
cd dsh-memory-connect
dsh plugin --profile <你的profile> add link:/path/to/dsh-memory-connect
在 DSH composition 中,path 是 required 配置項。可以寫成:
config:
path: ~/.dsh/memory.db
enableSoul: true
這裏配置了 SQLite 數據庫路徑,並開啓 Soul 注入。
插件會注入 systemPrompt,所以加載該插件的 profile 需要 systemPrompt service 可用。
典型用法¶
創建全局身份¶
創建 ~/.dsh/soul.md,用於提供 persistent global identity:
~/.dsh/soul.md
如果插件配置中啓用 Soul,可以在 DSH composition 中設置:
enableSoul: true
查詢記憶¶
插件暴露的 API 示例如下:
ctx.crossSessionMemory.searchMemories({
query: 'TypeScript configuration',
types: ['fact', 'decision'],
limit: 5
})
這個調用會按查詢詞和記憶類型召回記憶,並限制返回數量。
可選語義召回¶
語義召回是可選能力。先啓動本地 embedding server:
pip install sentence-transformers
python3 node_modules/@asherliner/dsh-memory-connect/scripts/embed_server.py --port 8765
這兩條命令用於安裝 Python 模型依賴,並在 8765 端口啓動 embedding server。
然後開啓語義召回:
embeddingEnabled: true
如果 embedding server 不可達,插件會退化爲 keyword-only recall。
適用場景與注意¶
適合需要 DSH agent 跨會話記憶、全局身份、定時維護、LLM consolidation 或可選語義召回的場景。
使用前注意:
- 插件以當前 dsh 進程權限運行,安裝前應檢查源碼與許可證。
- Node.js 要求爲
>=18。 - 插件配置中
path必填。 - 插件會注入
systemPrompt,profile 需要systemPromptservice 可用。 - semantic recall 是 optional,需要本地 embedding server。
- recalled history 以 untrusted reference 形式注入,current instruction always wins。
- peerDependencies include
@deepseek-ai/cordis ^4.0.1and several@deepseek-ai/dsh-*rc packages;@deepseek-ai/dsh-session-queryand@deepseek-ai/dsh-scopeare optional。
結尾¶
經過上面的安裝、配置和用法,@asherliner/dsh-memory-connect 可以把 auto-extraction、cross-session recall、scheduled maintenance、LLM consolidation 和可選 semantic recall 接入 DSH。
倉庫地址:
https://github.com/Asher-2000/dsh-memory-connect