dsh-tdai-memory
Agent & WorkflowScorp1o117/dsh-tdai-memory
A port of TencentDB Agent Memory into DeepSeek Harness, providing four-layer memory (conversation capture, structured memory, scenes, persona) with automatic recall injection and search tools.
- deepseek-harness
- dsh-plugin
Verification and compatibility
This section shows evidence collected by the catalog. Undeclared information is labeled as unknown.
- Current-version compatibility
- Verified on the catalog Harness version
- Declared Harness range
- Not declared
- Declared platforms
- Not declared
- Profiles
- web
- Build approval
- Unknown
- Permissions
- Not declared
- External services
- Not declared
- Telemetry
- Unknown
This is not a security endorsement. Review source, permissions, and configuration before installing.
View evidence and scope
Verification covers only the named source, version, and Harness environment. It does not guarantee future compatibility.
dsh-tdai-memory@0.2.13- The manifest and static structure passed checks; a runtime load check has not completed.
README
dsh-tdai-memory
The plugin follows the DSH language setting (Chinese and English in DSH 0.2.0-rc.2), including configuration, status messages and plugin-list metadata. Language-pack locales use the host fallback chain. Switching languages preserves unsaved settings; there is no separate plugin language selector.
Configuration page (DSH 0.2.0-rc.2 and later)
Open Plugins → Installed → dsh-tdai-memory from the homepage sidebar to configure and save this plugin. The page uses the official plugins.bundle.config interface, without a duplicate entry in global Settings. Web and Desktop share the page. This version requires DSH 0.2.0-rc.2 or a later 0.2.x host; existing configuration is retained.
Choose Automatic memory for capture, extraction, recall and search together; Search existing memory only disables capture, extraction and automatic recall while keeping search tools; Pause memory features disables all four. The main page contains the two model connections. Individual switches, storage paths and tuning remain under Advanced. Existing mixed switch values appear as Custom combination and are preserved. Select a mode, Save, then restart DSH for pipeline changes (the search-tool switch applies immediately). Only edited fields are written; blank keys and untouched advanced options remain unchanged.
GitHub: Scorp1o117/dsh-tdai-memory · npm: dsh-tdai-memory
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.
Compatibility (v0.4.1)
Verified with DSH 0.1.7-rc.2 (Web) and 0.2.0-rc.2 (Desktop runtime) in isolated profiles. The Desktop app uses its own desktop profile. Other DSH prereleases remain unverified.
Desktop install
Use the Desktop-installed dsh command (Application → Manage dsh Command), or the app’s Plugins page. Then install into the Desktop profile:
dsh plugin --profile desktop add dsh-tdai-memory@0.3.6
Restart the Desktop app to load the client bundle. Desktop keeps its profile under $DSH_HOME/profiles/desktop.
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)
| Layer | Content |
|---|---|
| Core | The host-neutral core of tdai-memory-openclaw-plugin (src/core, src/utils), tsc-compiled to ESM (dist-dsh/), zero changes |
| Host adapter | StandaloneHostAdapter (official standalone mode, direct OpenAI-compatible calls) |
| dsh shell | index.js: config mapping, session/event + session/flush capture, system-prompt/assemble recall injection on agent.ctx, tool registration, lifecycle |
| Fallback | recall-inject.js: preset-row recall injection (used when mounted inside an agent preset) |
Recall caches expire after 30 seconds and retain at most 128 sessions per
injection instance. Failed or timed-out recalls are retried on the next assembly.
The preset row also accepts timeoutMs (default 4000); reaching this deadline
continues prompt assembly without memory context. Deadline timers are cleared
when recall settles early. Underlying recall work may continue after the deadline.
Hard-won wiring details:
- Capture:
session/flushlistener (await semantics; must complete before headless exits);turn/starttimestamps 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 aftersession/createdby resolving the agent from theagentsservice
Configuration (profile patch + settings)
Configuration is stored in the tdai-memory entry of the active Profile patch.
On first launch, DSH imports the old $DSH_HOME/settings.yaml values into that
entry. 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/profiles/web/cordis.patch.yml
- 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
sendSessionHeader: true # send x-opencode-session on LLM requests (required by OpenCode Go & similar gateways)
sessionId: '' # fixed session id; empty = persistent auto id under the data dir
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: {} # fill through Settings → 记忆
and restart dsh web. LLM/embedding API keys can be set in the Web UI
settings page (记忆 / Memory) or in the tdai-memory Profile patch entry.
Note for users
- This plugin is a standard profile bundle (
dsh.bundle.patch):dsh plugin --profile web add dsh-tdai-memoryinstalls and mounts it in one step — no manualcordis.patch.ymledits needed.- DSH exposes the registered
tdai-memorysettings 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.7or newer and are tested against0.1.0-rc.7,0.1.0-rc.8, and0.1.1-rc.1.- DSH
0.1.0-rc.6users must pindsh-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.5extracts correctly but takes 20-30s per call (background execution, does not block the conversation);deepseek-v4-flashis 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 - Search tools (
toolsEnabled, on by default): the switch lives in the Plugins page and applies in place — the row config isvolatile, so the plugin re-syncs its registration without a restart. If both tools are missing, look for the plugin's[tdai-memory] tools registered: tdai_memory_search, tdai_conversation_searchlog line (v0.4.1+). Before v0.4.1 it readconfig.toolsEnabledoff the Volatile wrapper cordis hands toapply— a property that never exists — so the failure was completely silent (issue #3) - Upgrades: after pulling new upstream code, rerun
npx tsc -p dsh-tsconfig.jsonin the tdai project dir (output indist-dsh/)
License
MIT
Saves use the configuration form API. Rejected writes retain the draft and show an error. Changing a model preserves credentials, and disabling a default-on option explicitly stores false.