Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

feat(install-mcp): add DeepSeek Harness (DSH) client

Elder Alves Pereira Coutoaa25a0564384
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b43a8edc..19eb93ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+- Added `install-mcp --client dsh` for the DeepSeek Harness (aliases
+ `deepseek-harness` and `deepseek_harness`). DSH keeps its MCP client in
+ a Cordis profile patch rather than a fixed config file, so the command prints a
+ ready-to-merge `- insert:` fragment for `@deepseek-ai/dsh-mcp-client` and
+ refuses `--apply`.
+
### Fixed
- Fixed Cursor tool calls being stored with no title or content: Cursor's own
hooks, and the Claude Code hooks Cursor also runs, send Claude's
diff --git a/README.md b/README.md
index 91b4cb28..e4e21f66 100644
--- a/README.md
+++ b/README.md
@@ -143,6 +143,7 @@ caveats is in [`docs/support-matrix.md`](docs/support-matrix.md).
| VS Code Copilot | MCP-only |
| Zed | MCP-only |
| Muse Code | MCP-only |
+| DeepSeek Harness (DSH) | MCP-only |
| Hermes Agent | Supported |
| GrizzyBot | Supported |
| LLM/auth providers | Supported |
diff --git a/crates/ai-memory-cli/src/cli.rs b/crates/ai-memory-cli/src/cli.rs
index 326a7d0f..fc4a9bef 100644
--- a/crates/ai-memory-cli/src/cli.rs
+++ b/crates/ai-memory-cli/src/cli.rs
@@ -2656,6 +2656,14 @@ pub enum McpClient {
/// `SessionStart` output contract is not, so lifecycle capture and
/// managed workstreams are not claimed. See `install-mcp --client muse`.
Muse,
+ /// DeepSeek Harness (DSH) - MCP-only. DSH has no fixed JSON/TOML MCP
+ /// config: the client is a Cordis plugin entry
+ /// (@deepseek-ai/dsh-mcp-client) inside a profile's cordis.patch.yml.
+ /// This integration is print-only (--apply is refused); merge the
+ /// rendered insert list into the profile patch. Pair it with DSH's
+ /// @deepseek-ai/dsh-hooks-claude-code bridge for lifecycle capture.
+ #[value(alias = "deepseek-harness", alias = "deepseek_harness")]
+ Dsh,
}
/// Arguments for `commit`.
diff --git a/crates/ai-memory-cli/src/commands/install_hooks.rs b/crates/ai-memory-cli/src/commands/install_hooks.rs
index ed236460..a8f52832 100644
--- a/crates/ai-memory-cli/src/commands/install_hooks.rs
+++ b/crates/ai-memory-cli/src/commands/install_hooks.rs
@@ -1483,6 +1483,9 @@ fn infer_installed_mcp_config(
"url",
)),
McpClient::Pi => Ok(None),
+ // DeepSeek Harness has no fixed MCP config file; no AgentChoice
+ // counterpart routes here, so this arm only satisfies exhaustiveness.
+ McpClient::Dsh => Ok(None),
McpClient::AntigravityCli => Ok(infer_json_mcp_config(
&content,
&["mcpServers", "ai-memory"],
diff --git a/crates/ai-memory-cli/src/commands/install_mcp.rs b/crates/ai-memory-cli/src/commands/install_mcp.rs
index 477db531..c2fd69ca 100644
--- a/crates/ai-memory-cli/src/commands/install_mcp.rs
+++ b/crates/ai-memory-cli/src/commands/install_mcp.rs
@@ -135,6 +135,7 @@ pub(crate) fn run_with_opencode_dialect(
McpClient::VsCodeCopilot => render_vscode_copilot(&args)?,
McpClient::Zed => render_zed(&args)?,
McpClient::Muse => render_muse(&args)?,
+ McpClient::Dsh => render_dsh(&args)?,
};
println!("{snippet}");
Ok(())
@@ -172,6 +173,24 @@ fn validate_args(args: &InstallMcpArgs) -> Result<()> {
if matches!(args.client, McpClient::KiroCli) {
validate_kiro_remote_url(args.server_url.as_deref().unwrap_or(DEFAULT_MCP_URL))?;
}
+ if matches!(args.client, McpClient::Dsh) {
+ validate_dsh_server_name(&args.name)?;
+ }
+ Ok(())
+}
+
+/// DSH's `serverName` must match `[A-Za-z0-9_-]{1,32}`, and the
+/// rendered entry reuses the entry name for it, so reject an unusable
+/// `--name` before printing a snippet DSH would refuse.
+fn validate_dsh_server_name(name: &str) -> Result<()> {
+ let valid = !name.is_empty()
+ && name.len() <= 32
+ && name
+ .bytes()
+ .all(|b| b.is_ascii_alphanumeric() || b == b'_' || b == b'-');
+ if !valid {
+ bail!("DSH serverName must be 1-32 characters of [A-Za-z0-9_-]; got {name:?}");
+ }
Ok(())
}
@@ -282,6 +301,9 @@ pub(crate) fn mcp_config_path_with(
McpClient::Pi => bail!(
"Pi has no native mcp.json; use `ai-memory install-hooks --agent pi --apply` to install the generated MCP bridge extension."
),
+ McpClient::Dsh => bail!(
+ "DeepSeek Harness has no fixed MCP config file; merge the printed snippet into $DSH_HOME/profiles/<profile>/cordis.patch.yml."
+ ),
// OMP reads mcp.json from its agent dir, the one its extensions live
// in, so a profile, PI_CODING_AGENT_DIR or PI_CONFIG_DIR moves it too.
McpClient::Omp => {
@@ -600,6 +622,9 @@ fn apply_to_config_file(args: &InstallMcpArgs) -> Result<()> {
if matches!(args.client, McpClient::Pi) {
bail!(pi_mcp_apply_guidance(args));
}
+ if matches!(args.client, McpClient::Dsh) {
+ bail!(dsh_mcp_apply_guidance(args));
+ }
let path = resolve_config_file(args)?;
let outcome = match args.client {
McpClient::Codex => apply_atomic(&path, |existing| {
@@ -690,7 +715,7 @@ fn json_mcp_location(client: McpClient) -> Option<JsonMcpLocation> {
McpClient::VsCodeCopilot => Some(JsonMcpLocation::RootServers),
McpClient::Zed => Some(JsonMcpLocation::RootContextServers),
McpClient::Muse => Some(JsonMcpLocation::RootMcpServersSnake),
- McpClient::Codex | McpClient::Grok | McpClient::Pi => None,
+ McpClient::Codex | McpClient::Grok | McpClient::Pi | McpClient::Dsh => None,
}
}
@@ -706,6 +731,9 @@ fn build_json_mcp_entry(args: &InstallMcpArgs) -> Result<serde_json::Value> {
McpClient::Codex | McpClient::Grok => {
bail!("internal: Codex/Grok MCP config is TOML, not JSON")
}
+ McpClient::Dsh => {
+ bail!("internal: DeepSeek Harness MCP config is a Cordis YAML patch, not JSON")
+ }
_ => build_mcp_entry(args),
}
}
@@ -1702,6 +1730,56 @@ fn render_muse(args: &InstallMcpArgs) -> Result<String> {
))
}
+/// DeepSeek Harness (DSH) has no fixed JSON/TOML MCP config: the client is a
+/// Cordis plugin entry inside a profile's cordis.patch.yml. Render the
+/// patch-list fragment the operator merges by hand; --apply is refused.
+fn render_dsh(args: &InstallMcpArgs) -> Result<String> {
+ Ok(format!(
+ "# DeepSeek Harness (DSH) - merge the entry below into the DSH\n\
+ # profile patch at $DSH_HOME/profiles/<profile>/cordis.patch.yml,\n\
+ # then reload the profile (the web profile reloads live).\n\
+ #\n\
+ # DSH has no fixed MCP config file: the client is a Cordis plugin\n\
+ # entry, so this integration is print-only. A new top-level\n\
+ # - insert: item is fine - patch row order carries no load\n\
+ # semantics. Pair it with DSH's @deepseek-ai/dsh-hooks-claude-code\n\
+ # bridge if you want lifecycle capture.\n\
+ {snippet}\n",
+ snippet = render_dsh_snippet(args),
+ ))
+}
+
+fn render_dsh_snippet(args: &InstallMcpArgs) -> String {
+ let url = args.server_url.as_deref().unwrap_or(DEFAULT_MCP_URL);
+ let mut out = String::new();
+ out.push_str("- insert:\n");
+ out.push_str(&format!(" - id: {}\n", args.name));
+ out.push_str(" name: '@deepseek-ai/dsh-mcp-client'\n");
+ out.push_str(" config:\n");
+ out.push_str(&format!(" serverName: {}\n", args.name));
+ out.push_str(" transport: streamable-http\n");
+ out.push_str(&format!(" url: \"{url}\"\n"));
+ if let Some(value) = bearer_header_value(args.auth_token.as_deref()) {
+ out.push_str(" headers:\n");
+ out.push_str(&format!(" Authorization: {value}\n"));
+ }
+ // Fixed at the value validated against DSH. Pending: candidate for a CLI
+ // parameter (e.g. --tool-call-timeout-ms) if demand appears.
+ out.push_str(" toolCallTimeoutMs: 120000");
+ out
+}
+
+fn dsh_mcp_apply_guidance(args: &InstallMcpArgs) -> String {
+ format!(
+ "DeepSeek Harness has no fixed MCP config file; refusing to write MCP config. Re-run without --apply to print the Cordis patch fragment, then merge it into $DSH_HOME/profiles/<profile>/cordis.patch.yml{}",
+ if args.auth_token.is_some() {
+ " (the printed entry carries the auth header)."
+ } else {
+ "."
+ }
+ )
+}
+
fn render_pi(args: &InstallMcpArgs) -> Result<String> {
Ok(pi_mcp_render_guidance(args))
}
@@ -2312,6 +2390,45 @@ mod tests {
assert!(out.contains("http://127.0.0.1:49374/mcp"));
}
+ #[test]
+ fn dsh_render_uses_cordis_patch_insert_shape() {
+ let rendered = render_dsh(&args_for(McpClient::Dsh)).expect("render");
+ assert!(rendered.contains("- insert:"));
+ assert!(rendered.contains("name: '@deepseek-ai/dsh-mcp-client'"));
+ assert!(rendered.contains("transport: streamable-http"));
+ assert!(rendered.contains("url: \"http://127.0.0.1:49374/mcp\""));
+ assert!(rendered.contains("toolCallTimeoutMs: 120000"));
+ }
+
+ #[test]
+ fn dsh_render_carries_the_bearer_header_when_a_token_is_present() {
+ let rendered = render_dsh(&args_with_token(McpClient::Dsh)).expect("render");
+ assert!(rendered.contains("Authorization: Bearer test-token-deadbeef"));
+ }
+
+ #[test]
+ fn dsh_rejects_an_unusable_server_name() {
+ let mut args = args_for(McpClient::Dsh);
+ args.name = "not a name".into();
+ let error = validate_args(&args).expect_err("name must be rejected");
+ assert!(format!("{error}").contains("serverName"));
+ }
+
+ #[test]
+ fn dsh_accepts_a_valid_server_name() {
+ let mut args = args_for(McpClient::Dsh);
+ args.name = "ai-memory_2".into();
+ validate_args(&args).expect("valid name");
+ }
+
+ #[test]
+ fn dsh_apply_is_refused_with_the_patch_pointer() {
+ let mut args = args_for(McpClient::Dsh);
+ args.apply = true;
+ let error = apply_to_config_file(&args).expect_err("apply must be refused");
+ assert!(format!("{error}").contains("cordis.patch.yml"));
+ }
+
#[test]
fn claude_desktop_render_lists_packaged_and_unpacked_windows_paths() {
let rendered = render_claude_desktop(&args_for(McpClient::ClaudeDesktop)).unwrap();
@@ -2880,6 +2997,7 @@ mod tests {
McpClient::VsCodeCopilot => render_vscode_copilot(&args).unwrap(),
McpClient::Zed => render_zed(&args).unwrap(),
McpClient::Muse => render_muse(&args).unwrap(),
+ McpClient::Dsh => render_dsh(&args).unwrap(),
}
}
@@ -2909,6 +3027,7 @@ mod tests {
McpClient::Swival,
McpClient::VsCodeCopilot,
McpClient::Zed,
+ McpClient::Dsh,
] {
let out = render_with_token(client);
// Every client embeds the token as `Authorization:
@@ -2953,6 +3072,7 @@ mod tests {
McpClient::VsCodeCopilot,
McpClient::Zed,
McpClient::Muse,
+ McpClient::Dsh,
] {
let out = render_for_test(client);
assert!(
@@ -2990,6 +3110,7 @@ mod tests {
McpClient::VsCodeCopilot => render_vscode_copilot(&args).unwrap(),
McpClient::Zed => render_zed(&args).unwrap(),
McpClient::Muse => render_muse(&args).unwrap(),
+ McpClient::Dsh => render_dsh(&args).unwrap(),
}
}
diff --git a/crates/ai-memory-cli/src/commands/uninstall.rs b/crates/ai-memory-cli/src/commands/uninstall.rs
index 87c9aa99..e6c5fa2b 100644
--- a/crates/ai-memory-cli/src/commands/uninstall.rs
+++ b/crates/ai-memory-cli/src/commands/uninstall.rs
@@ -1258,7 +1258,7 @@ fn mcp_servers_path(client: McpClient) -> Option<&'static [&'static str]> {
// Muse Code spells the key snake_case; the camelCase spelling the
// clients above use would leave the entry behind.
McpClient::Muse => Some(&["mcp_servers"]),
- McpClient::Codex | McpClient::Grok | McpClient::Pi => None,
+ McpClient::Codex | McpClient::Grok | McpClient::Pi | McpClient::Dsh => None,
}
}
diff --git a/docs/install.md b/docs/install.md
index a89bb289..b819e7c1 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -1696,6 +1696,10 @@ docker run --rm akitaonrails/ai-memory:latest \
docker run --rm akitaonrails/ai-memory:latest \
install-mcp --client zcode --auth-token "$TOKEN" \
--server-url "http://homelab:49374/mcp"
+
+docker run --rm akitaonrails/ai-memory:latest \
+ install-mcp --client dsh --auth-token "$TOKEN" \
+ --server-url "http://homelab:49374/mcp"
```
Cursor, Gemini CLI, Antigravity CLI, Grok Build CLI, Kiro CLI, Command Code, and OpenClaw support both
@@ -1708,10 +1712,9 @@ so those hooks do not accept the handoff. The first `PostToolUse` prints
`hookSpecificOutput.additionalContext` (pending handoff, plus an opted-in
`[briefing]`). The model sees it after that tool result, not before the
first prompt. A session with no tool call leaves the handoff for
-`memory_handoff_accept`. Claude Desktop, VS Code Copilot, Zed,
-and ZCode
-are MCP-only here, so you'll need to nudge the model to call
-`memory_query` / `memory_handoff_accept` itself.
+`memory_handoff_accept`. Claude Desktop, VS Code Copilot, Zed, ZCode, and
+DeepSeek Harness (DSH) are MCP-only here, so you'll need to nudge the model
+to call `memory_query` / `memory_handoff_accept` itself.
For clients with `install-hooks` support, the capture path handles
handoff injection at session start or the client's closest equivalent, except
for Zero's no-stdout SessionStart behavior. Grok delivers on the first
diff --git a/docs/mcp-install.md b/docs/mcp-install.md
index 46f06fd9..ac20725c 100644
--- a/docs/mcp-install.md
+++ b/docs/mcp-install.md
@@ -152,7 +152,7 @@ metadata.
> **One-shot tip:** every snippet below is also reachable from the
> CLI:
> ```bash
-> ai-memory install-mcp --client gemini-cli # or cursor / claude-desktop / openclaw / omp / pi / antigravity-cli / grok / kimi-code / kiro-cli / command-code / swival / devin / zero / zcode / copilot-cli / vscode-copilot / zed / muse
+> ai-memory install-mcp --client gemini-cli # or cursor / claude-desktop / openclaw / omp / pi / antigravity-cli / grok / kimi-code / kiro-cli / command-code / swival / devin / zero / zcode / copilot-cli / vscode-copilot / zed / muse / dsh
> ```
---
@@ -495,6 +495,37 @@ Sources: <https://dev.meta.ai/docs/muse-code/configuration>,
---
+## DeepSeek Harness (DSH)
+
+**Status:** MCP supported (print-only). No lifecycle hooks or managed workstream claimed.
+
+DSH has no fixed JSON/TOML MCP config: the MCP client is a Cordis plugin entry
+(`@deepseek-ai/dsh-mcp-client`) inside a profile's `cordis.patch.yml`.
+`install-mcp` therefore prints a ready-to-merge patch fragment and **refuses
+`--apply`**:
+
+```bash
+ai-memory install-mcp --client dsh
+```
+
+Merge the printed `- insert:` item into
+`$DSH_HOME/profiles/<profile>/cordis.patch.yml` — the `web` profile
+reloads its patch live — then reload or restart the profile. The fragment registers
+the default stateless HTTP endpoint and carries `Authorization: Bearer <token>`
+when `--auth-token` (or a configured server token) is present.
+
+DSH ships a bridge that runs an existing Claude Code `hooks.json` or settings
+file (`@deepseek-ai/dsh-hooks-claude-code`), so lifecycle capture for a DSH
+session is possible by pointing that bridge at a Claude Code hook config. ai-memory
+does not install or manage it, and the bridge delivers only seven Claude Code events
+(`SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`,
+`Stop`, `SubagentStart`, `SubagentStop`) — `PreCompact` and
+`SessionEnd` are not delivered, and its `SessionStart` injection runs
+detached. Treat DSH as MCP-only here and recover handoffs explicitly with
+`memory_handoff_list` then `memory_handoff_accept` when continuity matters.
+
+---
+
## Claude Desktop
**Status:** ✅ MCP supported (via stdio shim for HTTP). ❌ No lifecycle hooks
diff --git a/docs/support-matrix.md b/docs/support-matrix.md
index 515354c5..d2bd05d6 100644
--- a/docs/support-matrix.md
+++ b/docs/support-matrix.md
@@ -39,6 +39,7 @@
| VS Code Copilot | MCP-only | `.vscode/mcp.json` for Copilot agent mode; no lifecycle hooks (Copilot does not expose them yet). |
| Zed | MCP-only | Native remote MCP under `context_servers` in Zed's user `settings.json`; no lifecycle hooks or managed-workstream support. |
| Muse Code | MCP-only | `install-mcp --client muse` merges a native streamable-HTTP entry with bearer `headers` into the snake_case `mcp_servers` map of `~/.config/muse/settings.json`, preserving sibling servers. The writer adds the mandatory `"schema_version": 1` when absent (without it every `muse` command fails at startup) and never rewrites an existing value, and it sets `"mode": "optional"` because Muse's default `required` aborts the whole run when the server is unreachable. Skills need no extra step: Muse reads `~/.agents/skills`, which `install-skills` already writes. Lifecycle capture and managed workstreams are not claimed — Muse documents a hook surface, but the output contract of its `SessionStart` event is not specified. |
+| DeepSeek Harness (DSH) | MCP-only | `install-mcp --client dsh` prints a Cordis patch fragment (a `- insert:` item for `@deepseek-ai/dsh-mcp-client`) to merge into `$DSH_HOME/profiles/<profile>/cordis.patch.yml`; DSH has no fixed MCP config file, so `--apply` is refused. Pair the snippet with DSH's `@deepseek-ai/dsh-hooks-claude-code` bridge to reuse an existing Claude Code hook config for capture, but ai-memory does not install it and only seven Claude Code events are delivered (`PreCompact` and `SessionEnd` are not), with a detached `SessionStart`. No managed workstream. |
| Hermes Agent | Supported | `install-hooks --agent hermes` (alias `hermes-agent`) prints a ready-to-paste `hooks:` block for `~/.hermes/config.yaml`. Hermes splits each configured `command` with `shlex.split` and runs it with no shell, passing the event JSON on stdin, so the entries invoke the native `ai-memory hook` command (exec form, like Zero and ZCode — no script bundle is staged); ai-memory never writes that YAML file, which is yours to edit and which Hermes itself gates behind its hook-acceptance prompt (`hooks_auto_accept`). Two tool events are wired, `pre_tool_call` → `pre-tool-use` and `post_tool_call` → `post-tool-use`; their `tool_name` / `tool_input` payload drives concrete session attribution, tool-family titles, and capture exclusions. Session lifecycle (recall, prompt capture, session-end, automatic handoff) is owned by the community-maintained [`ai-memory-hermes-plugin`](https://github.com/MrLuciano/ai-memory-hermes-plugin) memory provider, so no hook-driven `session-end` is installed and nothing is duplicated; review that plugin's compatibility matrix, install/uninstall scripts, and secret handling before enabling it. No first-party `install-mcp` client and no managed workstream are claimed yet, and because Hermes ignores session-start hook stdout a pending handoff is recovered through MCP (`memory_handoff_list` then `memory_handoff_accept`). |
| GrizzyBot | Supported | [GrizzyBot](https://github.com/Foscoe63/GrizzyBot), a native macOS agent app, ships its own ai-memory bridge: it posts lifecycle events to `/hook` with `agent=grizzybot` (alias `grizzy-bot`) and talks to `/mcp` directly, so there is nothing for `install-hooks` or `install-mcp` to write. Sessions are attributed to `grizzybot`, and its Claude Code-shaped tool payloads (`tool_name`/`tool_input`/`tool_use_id`) are stored as closed-schema tool families, never tool names or arguments. The bridge is maintained in the GrizzyBot repository; review it before pointing it at a shared server. No managed workstream. |
| LLM/auth providers | Supported | Anthropic, OpenAI, OpenAI OAuth/Codex, GitHub Copilot, Gemini, OpenCode (Go and Zen), OpenAI-compatible endpoints, and generic OIDC device auth for native hooks. |