Skip to main content

dsh-tdai-memory

6Stars0Forks0Issues0Watchers

Ported Tencent Cloud's open-source 4-layer memory system (TDAI Agent Memory) into DSH: automatically captures conversations and uses LLM to extract facts, preferences, and profiles; during next conversation, automatically recalls and injects relevant memories based on current message; legacy memory directory remains functional.

Categories◆ Memory
Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
License
MIT
Branch
main
deepseek-harnessdsh-plugin

Install

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

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin Scorp1o117/dsh-tdai-memory for me: review the repository at https://github.com/Scorp1o117/dsh-tdai-memory first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Sentence Positioning

Port Tencent Cloud's four-layer memory system (TencentDB Agent Memory, formerly OpenClaw plugin) into DeepSeek Harness: automatically save every conversation round, use LLM to extract facts/preferences/profiles, and automatically inject relevant memories into the prompt based on the current message when asking questions again—so the model can "recall" past events out of thin air.

Core Capabilities

  • Automatically save every conversation round to local SQLite + JSONL + FTS + vector index (L0 raw capture)
  • Background LLM extracts facts, preferences, and events from conversations, writing to structured memory (L1) + auto-generating user profiles and scene blocks (L2/L3)
  • Before each message is sent, automatically retrieve relevant memories based on current user input and inject as dynamic context into the prompt (no manual search needed)
  • Model can actively call tdai_memory_search (structured memory search) and tdai_conversation_search (raw conversation search) two tools
  • Web UI settings page has a dedicated "Memory" section for visual editing of all configurations (data directory, extraction model, Embedding, toggles), leaving key empty preserves original value
  • Data directory reuses ~/.memory-tencentdb/memory-tdai, Tencent Cloud version legacy memories can be directly migrated for use

Technical Implementation

  • Language: JavaScript (ESM, Node native, TypeScript only used for vendored core)
  • Key Dependencies: @deepseek-ai/schemastery (config schema), @deepseek-ai/dsh-tools (tool registration), @tencentdb-agent-memory/tcvdb-text (vector DB binding), sqlite-vec (local vector search), @node-rs/jieba (Chinese word segmentation)
  • Architecture Pattern: Cordis plugin (profile bundle). index.js listens to session/event+session/flush for capture, listens to system-prompt/assemble for recall injection; client.js renders Web UI settings section; recall-inject.js serves as preset line-level fallback recall injector. Underlying core TdaiCore comes from vendored Tencent Cloud version, zero changes via StandaloneHostAdapter directly connects to OpenAI-compatible LLM/Embedding
  • Entry Files: index.js (host-side Cordis plugin) + client.js (browser-side ModuleLoader plugin) + recall-inject.js (fallback line in agent preset)

Use Cases

For users who use the same conversation/Agent in DSH for a long time and want the model to remember facts you've mentioned (project background, personal preferences, historical decisions); or those who want to "ask one question and recall what was discussed last time" instead of restating the background every time. This plugin is not needed for one-off Q&A scenarios—you need a long-running session/Agent to notice its value.

Prerequisites and Compatibility

DependencyMinimum VersionDescription
DSH0.1.0-rc.7+peerDependencies declared, tested on rc.7 / rc.8 / 0.1.1-rc.1 (README.md:112-115); use rc.6 requires pinning plugin version to 0.2.11
Node>=22.18engines.node
PlatformCross-platformPure JS + optional native build, no OS restrictions
Native Modulenode-llama-cpp (optional)Only needed when choosing fully local embedding backend; default package install does not trigger native build (package.json:70-74)
Web UIReact 18.2+peerDependencies declared, provided by DSH host

Installation

dsh plugin --profile web add github:Scorp1o117/dsh-tdai-memory

Configuration Options

ConfigTypeDescriptionDefault
Data DirectoryStringMemory database storage path. Empty uses ~/.memory-tencentdb/memory-tdai, compatible with Tencent Cloud versionEmpty (default above path)
Extraction LLM Base URLStringOpenAI-compatible interface address for L1/L2/L3 extractionEmpty (falls back to TDAI_LLM_BASE_URL env var)
Extraction LLM API KeyString (password)Key for above interface, empty keeps original valueEmpty
Extraction LLM ModelStringModel name; deepseek-v4-flash output is often non-compliant, mimo-v2.5 recommendeddeepseek-v4-flash
Extraction LLM Max Output TokensNumberSingle extraction response limit4096
Extraction LLM Timeout (ms)NumberSingle LLM call timeout120000
Embedding Base URLStringVector interface address (OpenAI-compatible /v1/embeddings)http://127.0.0.1:8088/v1
Embedding API KeyString (password)Vector interface keyEmpty
Embedding ModelStringVector model nameQwen3-Embedding-0.6B
Vector DimensionNumberEmbedding output dimension1024
Request with dimensions paramBooleanWhether to include dimensions field in request (some services require)false
Capture Conversations (L0)BooleanWhether to write each conversation round to raw storagetrue
Structured Extraction (L1)BooleanWhether to enable LLM auto-extraction of facts/preferences/eventstrue
Conflict DetectionBooleanUse LLM to check duplicates before writing; extra LLM calls and unstable parsing, off by defaultfalse
Recall InjectionBooleanWhether to automatically inject relevant memories during prompt assemblytrue
Max Recall ItemsNumberMaximum memory items returned per recall5
Similarity ThresholdNumberMinimum similarity score for recall; results below this are discarded0.3
Recall Timeout (ms)NumberSingle recall timeout3000
Register Search ToolsBooleanWhether to register tdai_memory_search and tdai_conversation_search for model to calltrue

FAQ

Q: Do I need to manually modify cordis.patch.yml after the installation command finishes?

A: No. The - insert declaration in cordis.patch.yml has already registered tdai-memory as a profile bundle; dsh plugin automatically merges and mounts it during package installation.

Q: Why don't changes to the settings page take effect?

A: TdaiCore is built once at plugin startup; runtime changes to settings don't rebuild it. You must restart dsh web after modifying for changes to actually take effect (there's also a warn in index.js:380).

Q: Can I use deepseek-v4-flash as the extraction model?

A: Not recommended. Its JSON output is often non-compliant, which can cause L1 extraction to yield zero items; README defaults to mimo-v2.5, which takes 20-30s per run but executes in the background without blocking conversations.

Q: Do I have to install node-llama-cpp?

A: No, it's not required. It's only an optional peer for the "fully local embedding" backend; using OpenAI-compatible remote embedding (default) doesn't need it.

Q: Will memories accumulated with the Tencent Cloud version on old machines be lost?

A: No. The data directory is fixed at ~/.memory-tencentdb/memory-tdai; content written by the Tencent Cloud version is preserved as-is, and the new plugin reuses it directly.

Q: Can the model actively search old memories?

A: Yes. After registration, tdai_memory_search (L1 structured search) and tdai_conversation_search (L0 raw search) will appear in the tools list for the model to actively call.

Q: Will data remain after uninstalling the plugin?

A: Yes. dsh plugin remove only uninstalls the package and unmounts it; ~/.memory-tencentdb/memory-tdai won't be cleared; to completely delete, manually rm that directory.

Difficulty Level

Advanced — requires you to select and integrate an OpenAI-compatible extraction LLM and embedding service yourself (the default http://127.0.0.1:8088 Qwen3-Embedding may not exist), and understand the four-layer memory architecture's L0/L1/L2/L3 to tune parameters properly; it runs out of the box, but to extract value you need to choose the right model and embedding backend.

Known Issues and Limitations

  • Extraction model deepseek-v4-flash outputs non-compliant JSON, which can cause L1 to extract zero items; mimo-v2.5 is recommended by default (20-30s/run, executes in background) (README.md:125-127)
  • Conflict detection (dedup) LLM output parsing is unstable, has caused stored=0, off by default; enabling requires a more reliable model (README.md:128-129 / index.js:63)
  • Single mimo-v2.5 extraction takes 20-30s; with multiple rounds in long sessions, overall L1 extraction time is considerable (README.md:125)
  • L0 vector writes go through background tasks; in headless one-shot tasks, destroy() drains them on exit, and excessive task volume may lose tail items (README.md:130-131)
  • The seed-runtime.js in vendored core has a FIXME: teardown waits for L1 to finish then destroys, but L2/L3 pipelines may be interrupted before completion (vendor/tdai/core/seed/seed-runtime.js:8-14)
  • The tcvdb.js in vendored core has a TODO: vector collection creation is not delayed to first use, which may block plugin initialization during startup (vendor/tdai/core/store/tcvdb.js:178)
  • Web settings page configuration changes require restarting dsh web to take effect; runtime settings changes only write to disk without rebuilding the core (README.md:111 / index.js:379-382)
  • After upgrading if pulling new upstream code, need to re-run npx tsc -p dsh-tsconfig.json in the tdai project directory (README.md:132-133)

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/Scorp1o117/dsh-tdai-memory)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory