DeepSeek Harness integration for OpenContext with durable cross-session memory, automatic prompt capture and recall, session summaries, structured insights, and document retrieval.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-opencontext
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:melandlabs/opencontext#path:/plugins/dsh-opencontext
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 plugin that gives any DSH agent durable memory +
retrieval-augmented context by plugging into
@melandlabs/opencontext.
- Package name:
dsh-opencontext - License: Apache-2.0
- Engine: Node
^22.19.0 || >=24.0.0 - Tool prefix:
oc_* - Skill:
opencontext - Command:
/oc doctor
Install
From npm (recommended)
# Install directly from npm
dsh plugin --profile web add dsh-opencontext
# Confirm it's mounted
dsh --profile web --dump-config | grep dsh-opencontext
# ... should contain `id: dsh-opencontext`
# Start DSH web and verify
dsh web
# Visit http://127.0.0.1:3080/plugins and confirm dsh-opencontext shows "Enabled"
From source (for development)
# 1. Clone the repo and navigate to the plugin directory
cd /path/to/opencontext/plugins/dsh-opencontext
# 2. Build the plugin (emits lib/)
pnpm install
pnpm build
# 3. Register it with your DSH
dsh plugin --profile web add /path/to/opencontext/plugins/dsh-opencontext
# 4. Confirm it's mounted
dsh --profile web --dump-config | grep dsh-opencontext
# ... should contain `id: dsh-opencontext`
# 5. Start DSH web and verify
dsh web
# Visit http://127.0.0.1:3080/plugins and confirm dsh-opencontext shows "Enabled"
Plugin view

Slash command

What you get
Core Tools (8)
| Tool | Purpose |
|---|---|
oc_search |
Search long-term memory (unified across memory + insights + knowledge). |
oc_remember |
Persist one durable memory when the user explicitly asks. |
oc_memory_list |
List recent memory entries in the current scope. |
oc_memory_get |
Read one or more entries by id. |
oc_memory_revise |
Soft-deprecate an entry and store a successor. |
oc_memory_retire |
Soft-deprecate an entry. |
oc_prepare_context |
Manually build a bounded <opencontext_evidence> block. |
oc_capture_source |
Capture an arbitrary content source for later retrieval. |
Summary & Outcome Tools (3)
| Tool | Purpose |
|---|---|
oc_session_summary |
Generate and store a session summary at natural breakpoints. |
oc_task_outcome |
Record task outcomes, decisions, and achievements. |
oc_recent_summaries |
List recent session summaries and task outcomes. |
Insights Tools (2, opt-in)
| Tool | Purpose |
|---|---|
oc_insights_search |
Search structured insights (decisions, preferences, outcomes). |
oc_insight_capture |
Capture a structured insight from conversation. |
Knowledge/RAG Tools (3, opt-in)
| Tool | Purpose |
|---|---|
oc_knowledge_search |
RAG search over uploaded documents. |
oc_document_upload |
Upload documents to the knowledge base. |
oc_document_list |
List all documents in the knowledge base. |
All tools return { ok: true, value } on success and
{ ok: false, error: { code, message } } on failure — they never throw to
the model.
Recall waterfall
Every agent/pre-step event runs a recall waterfall:
- Derive a query from the last user message (truncated to 256 chars).
backend.search({ query, limit: maxRecallItems, ... })with arequestTimeoutMs-bounded timeout.- Format hits as a fenced
<opencontext_evidence>block, byte-capped tomaxBytes(default 8000). - The block is appended as a plugin-sourced user message with a header that flags it as untrusted historical evidence.
- On any backend error, the listener logs a warning and the turn continues without context.
Auto-capture
A second agent/pre-step listener runs after recall and writes each
user message into the memory store under sourceType: "user_input".
Gated by config.capturePrompts (default true; set
OPENCONTEXT_DSH_CAPTURE_PROMPTS=0 to disable). Fire-and-forget by
default so the turn is not blocked; opt into flushOnCapture: true if
you need strict ordering.
Turn-end summarization
When autoSummarize is enabled, a turn/end listener:
- Generates a simple summary of the turn
- Stores it as a
turn-summarymemory - Captures tool outcomes if
captureToolOutcomesis enabled
Tool result capture
When captureToolResults is enabled, a tool/result listener captures
tool call results as tool-interaction memories, creating a searchable
log of all tool interactions.
Skill: opencontext
Loaded at plugin-apply time. Primes the model on the recall / capture
contract, the trust model, and all available oc_* tools.
Command: /oc doctor
Prints a JSON status payload:
{
"ok": true,
"plugin": "dsh-opencontext",
"backend": "lib",
"scope": "local:9cd22c419df9",
"db": "/Users/you/.opencontext/memory/store.db",
"probe": { "ok": true, "mode": "lib", "details": "db=/Users/you/.opencontext/memory/store.db" },
"recentCount": 0,
"features": ["insights", "knowledge", "prompt-capture"]
}
Configuration
Resolved in this order (highest first):
cordis.patch.ymlrow underid: dsh-opencontextOPENCONTEXT_DSH_*environment variables- Defaults declared in
ConfigSchema
| Field | Type | Default | Env var |
|---|---|---|---|
baseUrl |
string | http://127.0.0.1:8000 |
OPENCONTEXT_DSH_BASE_URL |
authorization |
string | "" |
OPENCONTEXT_DSH_AUTHORIZATION |
scopeId |
string | "" (auto) |
OPENCONTEXT_DSH_SCOPE_ID |
timeoutMs |
number | 4000 |
OPENCONTEXT_DSH_TIMEOUT_MS |
requestTimeoutMs |
number | 1000 |
OPENCONTEXT_DSH_REQUEST_TIMEOUT |
maxBytes |
number | 8000 |
OPENCONTEXT_DSH_MAX_BYTES |
capturePrompts |
bool | true |
OPENCONTEXT_DSH_CAPTURE_PROMPTS (1/0) |
flushOnCapture |
bool | false |
OPENCONTEXT_DSH_FLUSH_ON_CAPTURE (1/0) |
maxRecallItems |
number | 8 |
OPENCONTEXT_DSH_MAX_RECALL_ITEMS |
autoSummarize |
bool | false |
OPENCONTEXT_DSH_AUTO_SUMMARIZE (1/0) |
captureToolResults |
bool | false |
OPENCONTEXT_DSH_CAPTURE_TOOL_RESULTS (1/0) |
enableInsights |
bool | true |
OPENCONTEXT_DSH_ENABLE_INSIGHTS (1/0) |
enableKnowledge |
bool | true |
OPENCONTEXT_DSH_ENABLE_KNOWLEDGE (1/0) |
Presence-only switch:
OPENCONTEXT_DSH_HTTP_URL— flip to HTTP mode (any non-empty value).
Trust model
The <opencontext_evidence> block surfaced by the recall waterfall is
host-supplied context, not instructions. It is explicitly framed as
untrusted historical evidence; if it ever contradicts the user, the
user wins. The block is never placed in the system-prompt role — it is
appended as a plugin-sourced user message, so the model can ignore it
without breaking the system contract.
Development
pnpm install
pnpm typecheck
pnpm test # 59 unit tests
pnpm build # tsc → lib/
Architecture
┌──────────────────────────────────────────────────────────────────────────┐
│ DSH Agent │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ agent/pre-step pipeline │ │
│ │ ┌───────────────────────────┐ ┌───────────────────────────┐ │ │
│ │ │ Recall │ │ Capture │ │ │
│ │ │ (search history) │ │ (store user input) │ │ │
│ │ └───────────────────────────┘ └───────────────────────────┘ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ v │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ turn/end & tool/result listeners │ │
│ │ ┌───────────────────────────┐ ┌───────────────────────────┐ │ │
│ │ │ Session Summ. │ │ Tool Capture │ │ │
│ │ │ (session summary) │ │ (tool output capture) │ │ │
│ │ └───────────────────────────┘ └───────────────────────────┘ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ v │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ dsh-opencontext plugin (16 tools) │ │
│ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │
│ │ │ Core │ │ Summary │ │ Insights │ │ Knowledge │ │ │
│ │ │ (8) │ │ (3) │ │ (2) │ │ (3) │ │ │
│ │ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ v │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ OpenContext Backend │ │
│ │ ┌───────────────────────────┐ ┌───────────────────────────┐ │ │
│ │ │ Lib Mode │ │ HTTP Mode │ │ │
│ │ │ (in-process) │ │ (daemon) │ │ │
│ │ └───────────────────────────┘ └───────────────────────────┘ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────┘
License
Apache-2.0. See LICENSE.
Links
More in this category
vectorize-io/hindsight#coding-agents★ 62472
Hindsight, agent memory that learns: long-term project memory with auto recall and retain, knowledge pages, deep reflection, and per-repo memory banks.
volcengine/OpenViking#examples/dsh-memory-plugin★ 42572
OpenViking memory and context bundle for DeepSeek Harness: pre-step auto-recall and profile injection, session capture, `viking://` URI guarding, and recall/write memory tools backed by an OpenViking server.
MemTensor/MemOS#memos-local-plugin★ 12475
Local-first memory plugin for DeepSeek Harness: layered L1/L2/L3 memory with automatic capture, manual memos_* retrieval tools, and a built-in memory viewer.
agentscope-ai/ReMe#dsh★ 3828
Connects DeepSeek Harness to ReMe's local-first, self-evolving personal knowledge base: automatically captures completed main-agent conversations as user-owned Markdown memory, searches conversations and source material through reme_search with BM25, optional embeddings, and wikilink expansion, and schedules daily memory consolidation.
zilliztech/memsearch#MemSearch★ 2917
Shared Markdown memory for DSH and other coding agents, with automatic capture, pre-step context injection, searchable recall, and memory-to-skill self-evolution through a review panel.
vshulcz/deja-vu#extensions/dsh★ 1645
Cross-session memory and context recovery across forty-five other coding agents (45+) on this machine, reading session files they already wrote before install (Claude Code, Codex, Cursor, Windsurf, Trae, Antigravity, VS Code Copilot Chat, opencode, OpenClaw, Hermes, Kimi, Qoder, Cline, Zed, Magpie and more): six tools (deja_recall, deja_session, deja_blame, deja_fix, deja_how, deja_remember), a /deja command, and optional automatic recall injected into runtime context. Local BM25 CLI/MCP index, no LLM, no embeddings, no network (dsh plugin --profile web add dsh-deja).
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.