Skip to main content

dsh-memory

26Stars1Forks2Issues0Watchers

Integrates DSH with Lingshu (AEIS) long-term memory: automatically deposits user conversations into SQLite knowledge base, dynamically exposing Memory, Reasoning, Reflection, and Flywheel tools.

Categories◆ Memory
Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
TypeScript
License
MIT
Branch
main
agent-safetyagentic-aiagiai-agent-frameworkdeepseekdsh-pluginexplainable-aiguardrails

Install

cmdweb profile
$ dsh plugin --profile web add @furongjun1999/dsh-memory

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin FuRongJun-1999/dsh-memory for me: review the repository at https://github.com/FuRongJun-1999/dsh-memory first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Pitch

Connects DeepSeek Harness to the "Ling Shu (AEIS)" long-term memory engine: DSH conversations automatically precipitate into a local SQLite knowledge base, and Agents can also invoke nearly 40 tools for memory retrieval, reasoning, reflection, and knowledge flywheel, achieving cross-session self-continuity.

Core Features

  • Automatically writes real user messages to Ling Shu knowledge base (with deduplication and importance scoring); Agent responses and tool results can be optionally enabled
  • Cross-session retrieval: memory tools like remember / recall / search / timeline / session_recall / compact_context
  • Reasoning and cognition: think / reason / relate / predict_routes / self_check / cognition / cognition_report / emotional_bias / self_reliability / recursive_reflect
  • Learning and flywheel: blindspots / learn / induce / distill / flywheel_report / transfer_test / calibrate — gets stronger with use
  • Ingesting external knowledge: ingest_text / ingest_file / ingest_url / web_search
  • Process self-healing: Ling Shu Python subprocess automatically restarts with exponential backoff and re-handshakes after crash; optional mutual maintenance (heartbeat + guardian + dual-channel task verification)

Technical Implementation

  • Language: TypeScript (ESM)
  • Key Dependencies: @deepseek-ai/cordis (plugin framework), @deepseek-ai/dsh-tools (defineTool/ParameterSchemaSpec), @deepseek-ai/dsh-session (session/event event source)
  • Architecture Pattern: Plugin process spawns a Python Ling Shu subprocess (python -m aeis.mcp.server), communicates via stdio + line-by-line JSON-RPC (2024-11-05 protocol subset); runtime pulls Ling Shu tool清单, converts to DSH tools according to Schema and registers to ctx.tools, tool upgrades require no changes to DSH side
  • Entry Files: src/index.ts (exports name / inject / apply / Config), src/bridge.ts (Python subprocess + JSON-RPC bridge), src/tools.ts (tool registration), src/hooks.ts (automatic memory), src/mutual.ts (mutual maintenance, optional)

Use Cases

When you want the same Agent to remember user preferences and historical conversations across multiple restarts and different sessions, and can proactively retrieve relevant memories before responding, use this plugin. It transforms DSH from "losing memory with each new window" into an assistant with persistent personality and accumulated knowledge — especially suitable for long-term projects, companion roles, and knowledge management workflows that require cross-session context.

Prerequisites and Compatibility

DependencyMinimum VersionNotes
DeepSeek Harness>= 0.1.0-rc.6peer dependency locks @deepseek-ai/dsh-session and @deepseek-ai/dsh-tools ^0.1.0-rc.6
Ling Shu Python library (aeis)0.3.0Must be additionally pip installed, otherwise Python subprocess cannot start
Node.js>= 18(engines)README also states DSH host requires Node ≥ 22.19
PlatformCross-platformspawn uses windowsHide: true, macOS/Windows/Linux all supported
Native modulesNonePlugin itself has zero native dependencies; Ling Shu Python side also declares zero external dependencies

Installation

dsh plugin --profile web add @furongjun1999/dsh-memory

Must go through pnpm coordination entry via dsh plugin --profile <name> add, do not directly npm install into profile's node_modules, otherwise peer package versions will be polluted. After installing the plugin, you also need to independently run pip install aeis (offline wheel or git+ installation both acceptable).

Configuration Options

ConfigTypeDescriptionDefault
serverNamestringTool name prefix, registered in DSH as <prefix>_<toolName>lingshu
pythonstringPython executable pathpython
moduleArgsstring[]Startup parameters passed to python['-m', 'aeis.mcp.server']
dbPathstringLing Shu SQLite memory database path, directory created automatically if not existingdata/lingshu.db
identitystringLing Shu's identity identifier, written to self model灵枢
envobjectEnvironment variables appended to subprocess (API Keys and other secrets can be injected via !!js process.env.X){}
tools'core' | 'brain' | 'all' | tool name arrayTool set exposed to Agent; core is 12 handpicked, brain is 38 default, all is full quantitybrain
charterstringGuardrail charter version accepted upon joining (see docs/guardrail-charter.md for details)v2.0-published
memory.userMessagebooleanWhether to automatically write user messages to memorytrue
memory.assistantMessagebooleanWhether to write Agent responses to memory (off by default to prevent noise)false
memory.toolResultbooleanWhether to write tool call results to memory (off by default to prevent noise)false
memory.importancenumberImportance score for auto-written memories (0~1)0.6
toolCallTimeoutMsnumberTimeout for single tool call (milliseconds)60000
maxRetryDelayMsnumberMaximum backoff interval for Ling Shu process crash retry (milliseconds)30000
failOnStartupErrorbooleanWhether to fail DSH plugin activation on startup failure; if off, continues background retry after warningfalse
mutual.enabledbooleanWhether to enable mutual maintenance (heartbeat + guardian + dual-channel task verification, requires dual-sandbox deployment)false
mutual.heartbeatMsnumberMutual maintenance heartbeat interval (milliseconds)600000

FAQ

Q: Can I use it directly after installing the plugin?

A: Not quite. The plugin is merely a TypeScript-side bridge; Ling Shu itself is a Python program and must be installed again with pip install aeis (offline wheel or git+ installation both acceptable), otherwise the Python subprocess fails to start and the plugin will alert and retry in a loop.

Q: Can I directly npm install into the profile's node_modules?

A: Not recommended. README explicitly requires using dsh plugin --profile <name> add through pnpm + autoInstallPeers: false coordination entry, otherwise @deepseek-ai series peer packages will be installed with incorrect versions, causing plugin loading or browser errors.

Q: Where is memory stored? How to migrate or backup?

A: All in the SQLite file pointed to by dbPath (default data/lingshu.db, directory created automatically if not existing). Just copy this .db file for backup; uninstalling the plugin does not delete data, historical memory remains when re-enabled.

Q: What gets remembered by default? Do Agent responses enter the memory database?

A: Default only remembers real user messages (source.kind === 'user'), skipping system context like AGENTS.md and file change notifications injected by plugins. Agent responses and tool results are off by default; set memory.assistantMessage or memory.toolResult to true to enable writing.

Q: What happens if python or aeis is not found at startup?

A: The plugin won't cause DSH startup failure — failOnStartupError defaults to false, it will alert in logs and continuously retry with exponential backoff (max maxRetryDelayMs); set failOnStartupError to true if you want fast failure.

Q: 38 tools is too many, how to only expose a commonly used batch?

A: Change tools field from default 'brain' to 'core' (12 handpicked: remember / recall / search / timeline / think / relate / predict_routes / ingest_text / ingest_url / session_note / self_check / service_info), or directly pass a tool name array as whitelist.

Q: Does Ling Shu Python process self-heal when it crashes?

A: The bridging layer automatically restarts with exponential backoff and re-performs MCP handshake (initialize → notifications/initialized), but requests during the crash moment will fail in one go. If deployed in dual-sandbox, set mutual.enabled to true to additionally get 10-minute heartbeat timestamps, guardian process pulling, and dual-channel task verification.

Q: What's the difference between this plugin and DSH's built-in session-persistence?

A: session-persistence saves raw session logs for time-based replay; dsh-memory performs semantic precipitation — writing to Ling Shu's SQLite knowledge graph with importance scoring and deduplication, enabling cross-session semantic retrieval, relationship reasoning, and inductive distillation, not just replaying historical messages.

Learning Curve

Advanced — requires understanding DSH plugin mechanism, plus correctly installing and launching the Ling Shu Python backend on the host machine; for deep customization (like custom tool sets, adjusting charter, enabling mutual maintenance), also need to understand Schema configuration and documented guardrail charter.

Known Issues and Limitations

  • Strong dependency on Ling Shu Python backend: The plugin itself is merely a bridge; when Ling Shu Python library is not installed or version mismatched, it continuously retries startup; no automatic detection/installation means in source code, requires user to manually pip install
  • Requests during process crash moment fail: Auto-restart only applies to subsequent requests; tools/call in progress during restart window gets rejected
  • npm install direct installation pollutes peer packages: README repeatedly emphasizes must go through dsh plugin --profile <name> add entry, otherwise @deepseek-ai/dsh-session and other core packages get mismatched versions
  • Memory content source filtering depends on event structure: Automatic memory's "only remember real user messages" relies on event.data.source?.kind === 'user' determination; if upstream event stream structure changes, deduplication/filtering logic becomes invalid
  • Mutual maintenance only fully available under dual-sandbox deployment: Single instance running with mutual.enabled can only get heartbeat timestamp writing; guardian A and task verification need pairing with opposite guardian.py
  • Default tools: 'brain' has many tools: 38 tools increase Agent context size; change to 'core' or custom array when needing to streamline

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/FuRongJun-1999/dsh-memory)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory