Back to Mem0

DeepSeek Harness

docs/integrations/dsh-mem0.mdx

2.0.193.3 KB
Original Source

Add persistent memory to the DeepSeek Harness with @mem0/dsh-mem0. The Harness agent forgets everything between sessions. This plugin gives it two Mem0-backed tools so recall and writes persist across runs, sharing the same memory bank you already use from Claude Code, Codex, and other agents.

Overview

The plugin registers two agent-callable tools:

ToolDoes
search_memoryRecall facts from Mem0 relevant to a query
add_memoryStore a fact in Mem0 for future sessions

Unlike file-based memory plugins, Mem0 is a managed backend: server-side extraction, semantic dedup, and conflict resolution, with the same memory reusable across every agent you connect.

How it works

A Cordis plugin is a module exporting apply(ctx, config). This one declares inject = ['tools'] so it waits for the harness tool registry, then registers the two tools via ctx.tools.register(...). When the plugin unmounts, the tools are removed automatically (Cordis revertible effects).

Prerequisites

  1. A Mem0 Platform account and API key:

    • <a href="https://app.mem0.ai?utm_source=oss&utm_medium=integration-dsh-mem0" rel="nofollow">Sign up at app.mem0.ai</a>
    • <a href="https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=integration-dsh-mem0" rel="nofollow">Get your API key</a> (starts with m0-)
  2. The DeepSeek Harness installed.

  3. Your API key exported in your shell:

<CodeGroup> ```bash zsh echo 'export MEM0_API_KEY="m0-your-api-key"' >> ~/.zshrc source ~/.zshrc ```
bash
echo 'export MEM0_API_KEY="m0-your-api-key"' >> ~/.bashrc
source ~/.bashrc
</CodeGroup>

Try it locally

  1. Build the plugin:

    sh
    cd integrations/dsh-mem0
    pnpm install
    pnpm build
    
  2. Point the Harness at it. Copy cordis.example.yml, set the absolute path to dist/index.js and your userId, then load it:

    sh
    pnpm dsh web --patch ./integrations/dsh-mem0/cordis.example.yml
    
  3. Open the web UI and ask the agent to remember something, then recall it in a later turn.

The cordis.yml entry looks like this:

yaml
- name: "@deepseek-ai/dsh-system-prompt"
- name: "@deepseek-ai/dsh-tools"
- insert:
    - id: mem0
      name: "/absolute/path/to/integrations/dsh-mem0/dist/index.js"
      config:
        # apiKey is read from MEM0_API_KEY when omitted here.
        userId: "your-user-id"
        # host: "https://your-onprem.mem0.ai"   # optional: Platform on-prem / dedicated base URL

For a Mem0 Platform on-prem or dedicated deployment, point config.host at that base URL (defaults to api.mem0.ai). host is a Platform base-URL override, not a switch to self-hosted Mem0 OSS.

Configuration

FieldRequiredDefaultNotes
apiKeyno$MEM0_API_KEYMem0 platform API key
userIdyesDefault entity that owns the memories
hostnoapi.mem0.aiPlatform base URL (on-prem / dedicated)

Both tools also accept optional per-call userId, agentId, and runId params so a single install can partition memory by entity, agent, or session; when omitted they fall back to the configured userId.

Telemetry

Writes are tagged source="DEEPSEEK_HARNESS" so Mem0's backend can attribute usage to this integration.