RayYeung1989
dsh-memory-tencentdb
DeepSeek Harness (dsh) ↔ TencentDB Agent Memory (TAM) long-term memory bridge: L0 conversation capture + recall injection via TAM v3 data plane
- Stars
- 0
- Language
- JavaScript
- Created
- Aug 14, 2026
- Updated
- Aug 14, 2026
Introduction
dsh-memory-tencentdb
DeepSeek Harness (dsh) ↔ TencentDB Agent Memory (TAM) long-term memory bridge plugin.
A Cordis plugin that gives DeepSeek Harness Web UI sessions a read-write loop with
the TAM four-layer memory system (L0 conversation → L1 extraction → L2 scenes → L3 persona).
Mechanism is aligned with the Hermes memory_tencentdb provider: from TAM's perspective
a dsh session is just another agent session — same v3 data-plane API, same identity
tenancy, same record shape.
About
DeepSeek Harness is an agent harness with a Web UI where you talk to an agent. TAM (TencentDB Agent Memory) is a team-level long-term memory service that distills conversations into reusable memories. This plugin connects the two:
- Write: every finished turn is captured into TAM L0 (user + assistant), and the TAM pipeline automatically distills L1/L2/L3 — no extra work on the dsh side.
- Read: before every model call, the plugin recalls relevant L1 memories, the L3
persona and L2 scene navigation from TAM and injects them as
<memory-context>, so the agent "just remembers" past conversations and team doctrine.
Because it reuses the same identity as your existing agents (e.g. Hermes), memories accumulated from dsh conversations are visible to the rest of the team and vice versa — one unified memory view across tools.
Features
- L0 conversation capture (write) — per-turn user+assistant pairs via
POST /v3/conversation/add; asynchronous, never blocks the agent loop. - Recall injection (read) — on every prompt assembly, parallel
atomic/search(L1) +core/read(L3) +scenario/ls(L2), rendered into a<memory-context>block identical to Hermes'build_memory_context_block. - Connection lifecycle — probe on startup, reuse if running, optional auto-start
if not (Hermes
supervisor.pysemantics), watchdog keep-alive, circuit breaker. - Removable without side effects — pure HTTP client; removing the plugin never touches the TAM gateway process or accumulated data.
- Silent degradation — gateway down: writes are skipped, recall is skipped, the conversation is never blocked.
How it works
dsh Web UI session
├─ write: turn/end ──► POST /v3/conversation/add (user + assistant, ISO-8601)
├─ read: system-prompt/assemble ──► atomic/search + core/read + scenario/ls
│ └─► <memory-context> injected into the assembled prompt
└─ lifecycle: health probe → reuse → (optional) spawn → watchdog → dispose-only-own-child
All data-plane calls go to the same TAM gateway (default http://127.0.0.1:8420)
with Bearer auth and x-tdai-service-id: default, exactly like Hermes.
Installation
# 1. Install into a profile (web / headless)
dsh plugin --profile web add /path/to/dsh-memory-tencentdb
# 2. Mount in the profile's cordis.patch.yml
- insert:
- id: dsh-memory-tencentdb
name: '@dsh-local/dsh-memory-tencentdb'
config:
enabled: true
# 3. Restart dsh
systemctl restart dsh-web # or however you run dsh
Configuration
All connection parameters come from environment variables (env first, config fallback, defaults match Hermes):
| Env var | Purpose | Default |
|---|---|---|
MEMORY_TENCENTDB_GATEWAY_HOST / _PORT | TAM gateway address | 127.0.0.1:8420 |
MEMORY_TENCENTDB_GATEWAY_API_KEY / TDAI_GATEWAY_API_KEY | gateway Bearer key (takes precedence over keyFile) | — |
MEMORY_TENCENTDB_TEAM_ID / AGENT_ID / USER_ID | TAM tenancy identity (share the same values as Hermes for a unified memory view) | default |
MEMORY_TENCENTDB_GATEWAY_CMD | gateway start command (used only for optional auto-start) | auto-discovered |
Fallback key file: ~/.memory-tencentdb/biz-user-key.txt (600 perms, first non-empty line).
The plugin config supports enabled / granularity / recallEnabled / writeOnAbort
etc. — see the Config schema in lib/index.js.
Removal
# delete the insert block from cordis.patch.yml
dsh plugin --profile web remove @dsh-local/dsh-memory-tencentdb
# restart dsh
The TAM gateway service and all accumulated memories are unaffected.
Alignment with Hermes
| Aspect | Value |
|---|---|
| Write endpoint | POST /v3/conversation/add (same body, two messages per turn) |
| Read endpoints | atomic/search (L1), core/read (L3), scenario/ls (L2) |
| Identity | same team_id / agent_id / user_id resolution (env → config → default) |
| Injected text | <memory-context> block, byte-aligned with Hermes |
| Reliability | circuit breaker 5/60s, single-attempt writes, watchdog 10s |
| Session end | handled by the TAM pipeline automatically |
Compatibility
- DeepSeek Harness
0.1.0-rc.*(event/service signatures follow the installed.d.ts) - TAM Gateway v3 data-plane API
- Zero external runtime dependencies (Node built-in
fetch)