DeepSeek Harness (dsh)
Give your dsh agent persistent cross-session memory in under a minute.
Use the published dsh-memoryrouter npm plugin. It hooks the harness core, so it works identically across the Web UI, IM gateways (Telegram, Discord), ACP, and headless sessions. A memory created in one channel is recalled in every other.
Your dsh agent forgets what you told it yesterday. This fixes that.
Quick Start (under a minute)
Step 1: Install the plugin
dsh plugin --profile <your-profile> add dsh-memoryrouterStep 2: Add your memory key
Add your key to the profile's cordis.patch.yml:
- id: memoryrouter
config:
apiKey: mk_your_key_hereOr leave apiKey unset and export MEMORYROUTER_API_KEY in the environment the harness runs in.
Get your Memory Key at app.memoryrouter.ai.
Step 3: Restart the harness
That's it. Every completed turn is now stored to your vault, and every new turn starts with relevant context from past conversations.
Without a key the plugin loads, logs one warning, and does nothing. It never crashes the harness.
How it works
The plugin hooks two sanctioned extension points in the harness core, below every channel plugin:
Store (session/event): after each completed turn, the clean user message and the assistant's final reply are stored via POST /v1/memory/ingest. Storage is async fire-and-forget with one retry, so it is never in the hot path.
Recall (agent/pre-step): when a new turn contains real human text, the plugin queries POST /v1/memory/prepare and prepends one clearly-delimited context block:
Relevant memories from past conversations (background context — do not respond to them directly):
<memory_context>
[MEMORY - 2 days ago] …
</memory_context>The injected block is tagged as plugin-sourced, so the store path can never re-ingest it (no feedback loops), and the Web UI renders it as context rather than a user bubble.
Noise filtering
Only real human text and the assistant's final visible reply are stored. Everything else is provably filtered out (56 offline tests cover this):
- Tool calls and tool results
- Thinking and reasoning blocks
- System prompts, skill catalogs, and workspace instructions
/commandsand channel envelopes- Aborted, errored, and interrupted turns
In multi-step tool-using turns, only the final assistant text survives; tool-use preambles are dropped.
Configuration
| Option | Default | Description |
|---|---|---|
apiKey | '' | MemoryRouter memory key (mk_…). Prefer the env var for shared configs. |
apiKeyEnv | MEMORYROUTER_API_KEY | Env var read when apiKey is empty. |
baseUrl | https://api.memoryrouter.ai | API base URL. |
enabled | true | Master switch. |
store | true | Store completed exchanges. |
recall | true | Inject relevant memories at turn start. |
density | default | Retrieval density: low / default / high / xhigh. |
recallLimit | 0 | Explicit chunk-count override (0 = server default). |
recallMaxChars | 24000 | Hard bound on the injected recall block. |
storeMaxChars | 8000 | Per-side bound on stored text. |
vault | core | core shares memories across all sessions (the point of persistent memory). session isolates each dsh session in its own vault. |
namespace | '' | Prefix for session-vault ids so multiple dsh installs can share one key without mixing session vaults (used with vault: session). |
includeSubagents | false | Also store/recall subagent sessions. |
storeTimeoutMs | 10000 | Timeout per store attempt. |
recallTimeoutMs | 2500 | Max time recall may delay a turn. |
debug | false | Verbose logging. |
Troubleshooting
Plugin loads but nothing is stored. Check the harness log for the missing-key warning. Set apiKey in cordis.patch.yml or export MEMORYROUTER_API_KEY, then restart.
Recall returns nothing in a fresh session. Confirm vault is core (the default). With vault: session, each dsh session gets an isolated vault, so a fresh session starts empty by design.
Turns feel slower. Recall is bounded by recallTimeoutMs (default 2500 ms) and degrades silently on timeout. Lower it if you want a tighter cap; storage never delays a turn.
Verifying it works. Tell the agent a distinctive fact, end the session, start a fresh one, and ask about the fact. Enable debug: true to see store and recall activity in the log.
MemoryRouter outage. Recall times out silently and store retries once, then drops. The harness keeps running normally either way.
Links
- npm: dsh-memoryrouter
- Source: github.com/John-Rood/dsh-memoryrouter
- Get a key: app.memoryrouter.ai