DeepSeek Harness Plugin

whalezhao/dsh-plugin-agent-memory

Stars ★ 0 Category Memory Added 2026-12-01

Selects an agent of a team from a self-hosted Tencent agent-memory Hub as the session expert, then recalls that agent's long-term memories into every turn and can write each turn back to its memory block. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Install

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:whalezhao/dsh-plugin-agent-memory

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

DeepSeek Harness (DSH) plugin that connects a self-hosted Tencent agent-memory Hub (the Memory Hub RPC service on port 8125) into the conversation.

It adds an expert selector to the left of the composer. An expert is one agent of one team in the Hub; that agent's long-term memories are recalled for each user message and appended to the step as an <agent-memory> block, so the model sees them without any tool call.

The rest of the agent's team assets are available as read-only tools: am_knowledge_resources (lists wiki and code-graph resources), am_knowledge_call (gets a resource's tool list, then runs explore / search / callers / impact / read_page …), am_skill_search, am_skill_read, and am_memory_search (on-demand L0/L1 lookup).

Requirements

  • DSH >=0.2.2-rc.5 (the plugin declares dsh.bundle and a Web client half).
  • A reachable agent-memory Hub: the RPC endpoint POST {hubUrl}/api/v1/... that accepts X-Tdai-Service-Id (instance id) and X-Tdai-User-Key (user key) headers.

Install

dsh plugin --profile <profile> add dsh-plugin-agent-memory

It is listed on the DSH plugin market too. Without npm access, install the prebuilt release asset or the checked-out source:

dsh plugin --profile <profile> add \
  https://github.com/whalezhao/dsh-plugin-agent-memory/releases/download/v0.1.0/dsh-plugin-agent-memory-0.1.0.tgz
dsh plugin --profile <profile> add /path/to/dsh-plugin-agent-memory

From a running DSH session, the plugin manager can install the same npm name or tarball URL.

Configure

Open the plugin's settings page (or the panel's gear button) and set:

Field Meaning
hubUrl Memory Hub base URL, e.g. http://10.0.0.10:8125
instanceId Hub instance id, sent as X-Tdai-Service-Id
userKey Hub user key, sent as X-Tdai-User-Key (stored as a secret field)
defaultAgentId Agent used before the user picks an expert; empty means "pick one"
injectMemory Recall memories and inject them before each step (default on)
writeMemory Write each turn back to the expert's memory (default off)
writeAssistant Include the assistant's reply in that write, matching the official L0 pairing of question + answer (default on)
topK Max memories per recall (1–10, default 4)
layers Memory layers injected each turn (default L3,L2, matching the official proxy)
timeoutMs Per-request timeout (default 6000)
refreshMs List cache / auto-refresh interval in ms (minimum 5000, default 10000); refresh pauses while the settings form is open, so it cannot overwrite what you are typing
kernelUrl Kernel API base for wiki / code-graph / skills (default: Hub host on port 8420). The knowledge service address is discovered from the kernel, and the proxy endpoint is not used
tools Register the read-only asset tools (default on)
skillLearning Send each finished turn to the kernel (/v3/skill/conversation/add) so agent-memory can archive it and extract skills (default off)
skillIndex Inject the catalogue of skills bound to the expert each turn, so the model knows what exists (default on)
respectBindings Narrow wiki / code-graph / skill access to the assets bound to the expert in the Hub (default on; falls back to the whole team when bindings cannot be read)
debug Append diagnostics to ~/.dsh/agent-memory-debug.log (default off, 256 KiB cap)

With no hubUrl or userKey the plugin stays idle: the selector is hidden and nothing is sent.

Where state lives

Unsaved settings input survives switching conversations (the draft lives in the plugin's client module), and after a save the panel retries the connection check while the plugin restarts.

  • The user key is stored in the DSH credentials store (dsh-plugin-agent-memory/user-key), not in the profile's cordis.patch.yml; the config field is only a fallback for headless setups. Saving a key from the panel migrates it there and blanks the config copy.
  • The chosen expert per session is persisted in ~/.dsh/agent-memory-selections.json (mode 0600), so a plugin reload or an app restart keeps the expert instead of dropping back to 「请选择专家」.
  • The panel shows the last recall / write-back / skill-learning outcome for the session, and a 记忆 tab browses the expert's L3 → L0 layers read-only.

Skill learning

agent-memory grows skills by reading finished conversations. With skillLearning on, each closed turn is posted to the kernel with its user message, the turn's tool calls and results, and the assistant's reply. The kernel buffers turns per session and archives them on its own thresholds (roughly ten tool calls or 40 KiB), which is what queues a skill-extraction task; a single short turn staying ok instead of archived is expected.

The plugin sends one turn per request, strictly ordered per session, and only when the session has an expert selected (the expert supplies the team and agent the skill belongs to).

What data leaves the machine

  • The Hub URL and user key are only used by the Host half; the browser talks to same-origin plugin routes and never sees the key.
  • With injectMemory, the last user message of a turn is sent to the Hub as a recall query.
  • With writeMemory, each turn is also sent to the Hub to be stored (plus the assistant reply unless writeAssistant is off).
  • With skillLearning, each finished turn is sent to the kernel as described above.
  • Nothing is sent to any third party.

Asset scope follows the Hub

Each agent in the Hub can have wiki, code-graph, skill and memory assets bound to it (the 「原子能力」 page). The plugin reads that binding list from the kernel (POST /v3/meta/agent-fixed-asset/list-with-detail) and uses it as the scope for every knowledge and skill tool, plus the per-turn skill catalogue. The panel gateway answers NOT_IN_SCOPE for the same action family, which is why the kernel is the source of truth here.

If the binding list cannot be read, the plugin falls back to the whole team and the tool output says so.

Limits

  • Only agents owned by the configured user key can be selected; selecting someone else's agent is rejected (403 NOT_YOUR_AGENT) because the Hub refuses cross-owner reads and writes.
  • The Hub's public RPC surface has no per-message delete endpoint, so memories are curated in the Hub's own memory UI, not from DSH.
  • Recalled memories are injected as a user-role message; a turn whose message has no relevant hit injects nothing.

中文说明

在输入框左侧点「选择专家」 → 右上角「设置」里填 Hub 地址、实例 ID 与 userkey → 保存后点 「检测连接」确认连通 → 回到列表选团队与 agent。选中后,该 agent 的长期记忆会在每轮对话前被 召回并注入上下文;打开写回后,每轮用户消息也会写入记忆库。插件默认保持空闲,直到你填好地址与 userkey。只允许选择自己 userkey 名下拥有的 agent。

License

MIT — see LICENSE.

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.