[Idea] Long-term memory capability seam (dsh-memory + TencentDB Agent Memory provider + tools) #1638
Replies: 3 comments
|
This is a good fit for an optional capability seam, and the decision not to put an opaque reverse proxy in the model path is especially sound. I would tighten five contracts before treating the interface as stable.\n\n### 1. Isolation identity must not be model-controlled\n\nThe provider call needs an execution-owned scope such as tenant / principal / agent / workspace / session. Those identifiers should come from the host context, not from I turned this review into a reusable, source-backed checklist that also separates Session replay, compaction, Skills, and cross-session memory: handbook PR #12. Corrections against the proposed seam or current DSH Session/MCP behavior are welcome there. |
|
A useful implementation data point for this seam: DSH can already run an existing Pi memory package unchanged through the public plugin path. dsh plugin --profile web add pi2dsh@0.11.0
dsh plugin --profile web add pi-hermes-memoryWe verified the important persistence boundary on a real DSH runtime: process A wrote with That does not replace the proposed provider-neutral |
Uh oh!
There was an error while loading. Please reload this page.
What
A new optional capability seam —
ctx.memory— that lets a dsh agent explicitly save notes, recall them, and read a standing long-term profile, backed by TencentDB Agent Memory.Three packages, mirroring
dsh-web's existing Service Definition / Provider / Consumer split:@deepseek-ai/dsh-memory— thectx.memoryService Definition. One provider registry (unlikedsh-web's independent search/fetch registries —save/search/readProfileare three faces of one coherent memory backend, not independently swappable operations), execution-time provider selection with the same configured/auto-select/ambiguous rules asdsh-web, and aMemoryErrortaxonomy.@deepseek-ai/dsh-memory-tencentdb— a provider backed by the real, zero-dependency@tencentdb-agent-memory/memory-sdk-ts-v2client (v3 strict-isolation API).save()→POST /v3/conversation/add(L0),search()→POST /v3/atomic/search(L1 semantic recall),readProfile()→POST /v3/core/read(L3 persona).@deepseek-ai/dsh-tool-memory— the model-facingmemory_save/memory_search/memory_read_profiletools.Design choice: explicit tool calls, not automatic context injection
TencentDB Agent Memory's own Claude Code integration works as a reverse LLM-API proxy — it reroutes
ANTHROPIC_BASE_URLthrough a local proxy that auto-injects L2/L3 memory into every system prompt and uses a syntheticAskUserQuestiontool call at session start to pick Team/Agent/Task. That's a clean fit for Claude Code specifically, but it doesn't map onto dsh's architecture: dsh already owns its own LLM request assembly and system-prompt composition per session, and there's no dsh-side equivalent of "reroute the model endpoint through a middlebox."So this integration instead treats memory as an ordinary capability seam + tool, the same shape as
dsh-web: the agent decides when to save/recall, same as it decides when to search the web. No automatic system-prompt injection, no proxy, no session-init picker. This is also just less invasive — it doesn't touchagent-looporsystem-promptcomposition internals, and the seam is fully optional (a deployment that doesn't compose a memory provider simply doesn't have the tools do anything at execution time — they still register but fail with a structuredMemoryErrorcode).Testing
Per project policy for a fresh provider, unit and real-composition tests run against a mocked SDK client — I don't have a running TencentDB Agent Memory deployment (it's a 3-container Docker stack needing an LLM key) to verify end-to-end against. 72 new tests, all passing. Full workspace
typecheck,lint,build, anddoc-sync(28/28 gates, including the bilingual pairing and generated-catalog gates) are green. The existing repo test suite passes in full except one pre-existing, confirmed-flaky, unrelated subprocess test (passes cleanly in isolation).One real thing worth flagging: while integrating I discovered the SDK's published npm version (
1.0.0-beta.1) has a materially different export surface than what's on thefeat/server_teambranch's source — the v3 strict-isolation client is exported asV3MemoryClient, not the bareMemoryClient(that name is the older v2 client), and there's noParamErrorclass in the published version (client-side validation throws a plainError). The provider is built against what's actually published, not the docs.Known limitations (documented in each package's README)
AbortSignal, so an in-flight request can't be cancelled mid-flight — only an already-aborted signal is honored (fails fast before the call).Links
Per
CONTRIBUTING.md, not opening a PR — posting here instead, same as the earlier web-composer discussion.Fork branch: https://github.com/raktim-mondol/deepseek-harness/tree/feature/tencentdb-memory-integration
Diff: raktim-mondol/deepseek-harness@master...raktim-mondol:deepseek-harness:feature/tencentdb-memory-integration
Happy to expand on the design tradeoffs, split the seam into a separate proposal from the concrete provider, or adjust the tool surface if this is a direction the team is interested in.
All reactions