DeepSeek Harness 插件

dsh-tdai-memory

DeepSeek Harness 的 TencentDB Agent Memory 移植:L0 对话捕获 → L1 结构化记忆提取 → L2 场景/L3 画像,自动召回注入 + 记忆/对话搜索工具;复用现有 ~/.memory-tencentdb/memory-tdai 数据;附 Web UI 设置栏。(英文原文)

跳到安装方式

来源信息

GitHub 仓库
Scorp1o117/dsh-tdai-memory
最近更新
2026年8月21日
分类
自动化与任务
GitHub stars
6
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/Scorp1o117/dsh-tdai-memory
插件名:dsh-tdai-memory
作者:Scorp1o117

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-tdai-memory

![中文文档](README.zh.md)

GitHub: Scorp1o117/dsh-tdai-memory · npm: dsh-tdai-memory

![Enhancement Suite](https://github.com/Scorp1o117/dsh-enhancement-suite) ![npm](https://www.npmjs.com/package/dsh-enhancement-suite)

Part of the DeepSeek Harness Enhancement Suite — Vision · Soul/Persona · Long-term Memory · Plugin Marketplace.

A port of TencentDB Agent Memory (Tencent Cloud's open-source four-layer memory system, originally an OpenClaw plugin) into DeepSeek Harness.

Features

  • L0 conversation capture: every turn (turn end, request boundary) is

written to raw conversation storage (JSONL + SQLite + FTS + vectors)

  • L1 structured memory: a background pipeline uses an LLM to extract

facts / preferences / events (persona / episodic / instruction) from conversations, stored in records/ + SQLite + FTS + vectors

  • L2 scenes / L3 persona: scene blocks and user profile generation

(pipeline-scheduled)

  • Automatic recall injection: on every prompt assembly, relevant memories

and the user profile are retrieved by the current user message and injected as dynamic context (the model "just remembers")

  • Tools: tdai_memory_search (L1 structured search),

tdai_conversation_search (L0 raw-text search)

The data directory reuses the existing ~/.memory-tencentdb/memory-tdai, so previously accumulated memories carry over seamlessly.

Architecture (porting approach)

LayerContent
CoreThe host-neutral core of tdai-memory-openclaw-plugin (src/core, src/utils), tsc-compiled to ESM (dist-dsh/), zero changes
Host adapterStandaloneHostAdapter (official standalone mode, direct OpenAI-compatible calls)
dsh shellindex.js: config mapping, session/event + session/flush capture, system-prompt/assemble recall injection on agent.ctx, tool registration, lifecycle
Fallbackrecall-inject.js: preset-row recall injection (used when mounted inside an agent preset)

Hard-won wiring details:

  • Capture: session/flush listener (await semantics; must complete before

headless exits); turn/start timestamps as the L0 cursor floor; turn-id dedup

  • Headless one-shot runs: wait for core.handleSessionEnd() inside flush

(L1 extraction finishes before exit; otherwise the 5s shutdown timeout kills it)

  • Recall injection: must be registered on agent.ctx (assembly runs in

the agent scope; root listeners never see it); attach one tick after session/created by resolving the agent from the agents service

Configuration (profile patch + settings)

Configuration is settings-namespace driven: the profile patch is the base layer, and the tdai-memory: section of $DSH_HOME/settings.yaml overrides it (LLM/embedding keys live in settings.yaml). The Web UI Settings → 记忆 section edits every field (v0.2.0, write-only keys); TdaiCore is built at startup, so changes apply after a restart.

# $DSH_HOME/settings.yaml
tdai-memory:
  llm:
    apiKey: 'sk-...'
  embedding:
    apiKey: 'local-no-key'
# profile patch (base layer)
- id: tdai-memory
  name: 'dsh-tdai-memory'
  config:
    extraction:
      enabled: true
      enableDedup: false      # dedup LLM output parsing is flaky; off by default
    llm:                      # L1/L2/L3 extraction model (OpenAI-compatible)
      baseUrl: 'https://opencode.ai/zen/go/v1'
      model: 'mimo-v2.5'      # deepseek-v4-flash produces invalid extraction JSON
    embedding:                # vectors (OpenAI-compatible /v1/embeddings)
      baseUrl: 'http://127.0.0.1:8088/v1'
      model: 'Qwen3-Embedding-0.6B'
      dimensions: 1024
      sendDimensions: false

Install

dsh plugin --profile web add dsh-tdai-memory

then mount it in $DSH_HOME/profiles/web/cordis.patch.yml:

- insert:
    - id: tdai-memory
      name: 'dsh-tdai-memory'
      config: {}          # keys can live in settings.yaml instead

and restart dsh web. LLM/embedding API keys can be set in the Web UI settings page (记忆 / Memory) or directly in settings.yaml under tdai-memory:.

> Note for users > - This plugin is a standard profile bundle (dsh.bundle.patch): > dsh plugin --profile web add dsh-tdai-memory installs and mounts it in > one step — no manual cordis.patch.yml edits needed. > - DSH exposes the registered tdai-memory settings namespace directly; the > plugin does not modify files in the host installation. > - Settings changes apply after a restart (TdaiCore is built at startup). > - Version 0.2.13 and newer require DSH 0.1.0-rc.7 or newer and are tested > against 0.1.0-rc.7, 0.1.0-rc.8, and 0.1.1-rc.1. > - DSH 0.1.0-rc.6 users must pin dsh-tdai-memory@0.2.11, the last release > carrying the legacy settings-allowlist compatibility patch.

node-llama-cpp is an optional peer used only by the fully local embedding backend. It is intentionally not installed by default because its native build requires explicit pnpm build approval. Remote OpenAI-compatible embeddings do not need it. Users who select the local backend should install and approve node-llama-cpp in the target DSH profile separately.

Known trade-offs

  • Extraction model: mimo-v2.5 extracts correctly but takes 20-30s per

call (background execution, does not block the conversation); deepseek-v4-flash is fast but its JSON output is non-compliant (extracts 0)

  • dedup: LLM conflict-detection output parsing is unstable (once caused

stored=0); off by default; enable only with a more reliable model

  • L1 memory vectors: written with storage (8088 embedding is fast); L0

vectors run as a background task, drained by destroy() on headless exit

  • Upgrades: after pulling new upstream code, rerun

npx tsc -p dsh-tsconfig.json in the tdai project dir (output in dist-dsh/)

License

MIT