Introduction

DeepSeek Harness provides a framework for agent development, but it does not natively include long-term cross-session memory. When handling multi-turn conversations or long-running tasks, the context window is limited and cannot retain key information. The wwskills/dsh-long-memory plugin provides DSH with a persistent memory layer through SQLite and full-text search technology.

Plugin Overview

The plugin is maintained by wwskills and is open-sourced under the MIT license. It addresses the memory loss problem in DSH during long-term conversations, supporting memory management through SQLite storage, FTS5 full-text search, and optional Embedding vector recall. The plugin uses a single-package, dual-surface packaging architecture and simultaneously includes Node.js server-side logic and browser UI components.

Core Features

The plugin’s core capabilities focus on three aspects: memory storage, automatic extraction, and rule evolution.

Storage and Recall

  • SQLite database storage: Uses SQLite as the underlying storage for persistent data.
  • FTS5 full-text search: The built-in FTS5 extension natively supports Chinese full-text search and can be used without additional configuration.
  • Embedding vector recall: Supports optional Embedding models and can work with Ollama (local with zero cost) or OpenAI-compatible APIs. When enabled, it uses BM25 + vector + RRF fused ranking.
  • File tracking: Automatically generates MEMORY.md session markers and memory/YYYY-MM-DD.md journal files.

Automatic Memory Extraction

  • L7 automatic extraction: Uses DSH’s LLM provider to automatically extract memories from conversations. It supports a configurable confidence threshold, and items below the threshold enter the confirmation queue.
  • Keyword fallback mechanism: When the LLM is unavailable, it automatically switches to regex-based keyword extraction mode.
  • Confirm Queue: Low-confidence memories are not written directly; instead, they enter the queue and wait for user confirmation.
  • Supersession: When newly extracted memories overlap with existing ones, the older memories are automatically marked as superseded.

Self-Evolving Learning

  • Signal word detection: Listens in real time for signal words such as “not right”, “wrong”, and “it should be” to capture user corrections.
  • Error capture: Automatically captures tool execution errors (tools/result) and Harness-level errors (agent/error) as learning material.
  • Rule lifecycle: Correction information can be extracted into rules and pass through the full lifecycle of “proposed -> approved -> rejected -> archived -> promoted to the Agent”.
  • Rule injection: Approved rules are injected into the Agent context through the agent/pre-step event, limited to a budget of 800 tokens.
  • User profile construction: Automatically builds user profiles—such as tech stack and coding style—based on USER-type memories.

Browser Interface and API

  • Sidebar and tabs: Provides an adjustable-width sidebar (160-360 px) containing four tabs for memories, rules, profiles, and more.
  • Web API: Provides RESTful endpoints for creating, reading, updating, and deleting memories, rules, and confirmation queue entries.

Installation and Configuration

Installation requires the system environment to meet the following requirements: Node.js >= 22.5 and DeepSeek Harness >= 0.1.0-rc.2.

Installation

Run the following command to install the plugin:

dsh plugin --profile web add @wwskills/dsh-long-memory

Configuration Examples

The plugin has many configuration options, and the defaults are usually sufficient. The following are examples of key configurations:

Embedding Configuration

- id: long-memory
  config:
    embedding:
      provider: 'ollama'          # 'none' | 'ollama' | 'openai-compatible'
      model: 'bge-m3'
      dimension: 1024
      ollama:
        base_url: 'http://127.0.0.1:11434'

L7 Automatic Extraction Configuration

- id: long-memory
  config:
    l7:
      enabled: true               # 启用自动记忆提取
      auto_extract: true          # 使用 LLM + 关键词回退
      confirm_threshold: 0.6      # 低于此置信度的记忆进入确认队列

Self-Evolving Learning Configuration

- id: long-memory
  config:
    corrections:
      signal_words:               # 触发纠正捕获的关键词
        - '不对'
        - '错了'
        - '应该是'
      promote_threshold: 5        # 提取规则的最小纠正次数
      rule_token_budget: 800      # 规则注入上下文的 Token 预算

Storage Path

Data is stored by default in the ${DSH_HOME}/long-memory/ directory, including the database file and a directory for Markdown documents.

Tool List

The plugin provides eight command-line tools for managing memories:

Tool Name Description
mem_search Performs FTS5 or hybrid search in the memory store
mem_record Manually persists a memory and automatically detects the scope
mem_status Views storage and retrieval status
mem_stats Views memory statistics
mem_forget Archives or deletes a memory and writes an audit log
mem_confirm Processes sensitive memories pending confirmation
mem_scope_list Lists all scopes
mem_scope_set_active Sets the currently active scope filter

Web API Endpoints

The RESTful API can be used to manage the plugin without the browser interface. The main endpoints are as follows:

Method Path Description
GET /plugins/dsh-long-memory/api/memories List memories
PUT /plugins/dsh-long-memory/api/memories/:id Archive a memory
DELETE /plugins/dsh-long-memory/api/memories Delete memories
GET /plugins/dsh-long-memory/api/memories/stats Memory count statistics
GET /plugins/dsh-long-memory/api/confirm-queue Get the confirmation queue
POST /plugins/dsh-long-memory/api/confirm-queue Confirm/reject memories
GET/POST /plugins/dsh-long-memory/api/config Get/save configuration
GET /plugins/dsh-long-memory/api/corrections List correction records
POST /plugins/dsh-long-memory/api/corrections/:id/extract Extract a correction into a rule
GET /plugins/dsh-long-memory/api/rules List rules
POST /plugins/dsh-long-memory/api/rules/:id/approve Approve a rule
POST /plugins/dsh-long-memory/api/rules/:id/reject Reject a rule
POST /plugins/dsh-long-memory/api/rules/:id/promote Promote a rule to AGENTS.md

Notes

  • Runtime environment: The plugin runs with the current DSH process permissions. It is recommended to review the source code and license before installation.
  • Dependency versions: The version requirements Node.js >= 22.5 and DeepSeek Harness >= 0.1.0-rc.2 must be met.
  • Single package, dual surface: The plugin packages Node.js server-side logic and the browser UI together, so the server side does not need to be deployed separately.

Conclusion

wwskills/dsh-long-memory provides a complete long-term memory solution for DeepSeek Harness through SQLite, FTS5, and the L7 extraction mechanism. Combined with self-evolving learning, it can not only store information but also continuously optimize the Agent’s behavior based on user corrections. For agent development scenarios that require long-running operation or handling complex context, this plugin is an essential component.

For more details, see: Plugin catalog page or GitHub repository.