dsh-mem0-plugins
Mem0 persistent memory for the DeepSeek Harness web profile — automatic recall injection, tidal-coalesced memory writes, and mem0_search/add/update/delete tools against a self-hosted Mem0 server (X-API-Key). Zero-intrusion bundle plugin; no dsh source changes.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:runfali/dsh-mem0-plugins说明文档
阅读完整 README ↗Configuration
All settings live in the dsh settings page under the mem0 namespace. Values
saved there override profile-layer defaults.
Connection & identity
| Key | Default | Description |
|---|---|---|
enabled | true | Master switch. When off: no recall, no writes, tools report "plugin disabled". |
host | http://127.0.0.1:8888 | Base URL of the self-hosted mem0-graph server. |
apiKey | (empty) | Sent as the X-API-Key header. Leave empty for AUTH_DISABLED deployments. |
userId | dsh-user | Owner of the memories; shared across sessions. |
agentId | dsh | Attached as agent_id on writes. |

Automatic recall & query distillation
| Key | Default | Description |
|---|---|---|
forceRecallStep | true | Force-recall step (Plan B): inject a "must call mem0_search first" notice every turn (trivial turns skipped). Off = rely on usage guidance only. |
topK | 10 | Max results per search (1–50). |
rerank | false | Request full-depth reranking (server needs a reranker configured). |
distillEnabled | true | Master switch for query distillation (see below). |
distillMinChars | 500 | Queries up to this length go straight to /search unchanged — zero loss, zero extra calls. |
distillInputMaxChars | 8000 | Truncation cap for text sent to the distillation model. |
distillBaseUrl | author's private endpoint | OpenAI-compatible endpoint used to distill long queries. Empty = skip distillation. The shipped default points at the author's internal deployment — override it with your own endpoint. |
distillApiKey | author's private key | Bearer token for the distillation endpoint. |
distillModel | Qwen3.5-9B | Distillation model id (a small local model is plenty). |
distillTimeoutMs | 90000 | Per-request distillation timeout. |
distillRetryAfterMs | 20000 | Hedged-request threshold: if the first request is still silent after this delay, fire a second concurrent one; first response wins. |


Automatic write-back (tidal coalescing)
| Key | Default | Description |
|---|---|---|
syncEnabled | true | End-of-turn write-back master switch. |
coalesceEnabled | true | Bucket short turns and flush merged writes; off = one request per turn. |
coalesceIdleMs | 5000 | Flush a bucket after this much inactivity. |
coalesceWindowMs | 15000 | Flush a bucket after this much wall time. |
coalesceMaxTurns | 5 | Max turns per bucket. |
coalesceMaxChars | 4000 | Max characters per bucket. |
fastpathChars | 2000 | Turns longer than this skip the bucket and write immediately. |
feedbackEnabled | true | Report evolve feedback after successful update/delete. |

Reliability & timeouts
| Key | Default | Description |
|---|---|---|
queueMaxLen | 50 | Pending-write queue cap; oldest entry dropped when full. |
breakerThreshold | 5 | Consecutive failures that open the circuit breaker. |
breakerCooldownMs | 120000 | Breaker cooldown before half-open retry. |
requestTimeoutMs | 300000 | Hard per-request cap shared by search/add (mirrors hermes httpx timeout=300.0; worst-case server-side LLM fallback is ~180 s). There is deliberately no second tool-level timeout. |

To change profile-layer defaults (applies to all users of the machine), append
to ~/.dsh/profiles/web/cordis.patch.yml:
- id: mem0
config:
enabled: true
host: http://mem0.internal:8888
apiKey: your-admin-api-key