Introduction

When developing agents using DeepSeek Harness (dsh), the context window length is a hard limit, and after each session ends, the previous interaction history is usually lost. To solve this problem, you need to proactively retrieve relevant background before each request and save key information after the conversation ends. The dsh-memory plugin is designed for this purpose; it provides a complete long-term memory solution.

What This Is

dsh-memory is a long-term memory plugin for DeepSeek Harness (dsh). Through persistent storage mechanisms, it automatically recalls relevant memories before answering and saves facts worth remembering after answering. The plugin is maintained by doublehappy123, is released under the MIT License, and aims to solve the memory gap problem in multi-turn agent conversations.

Installation and Activation

Before installation, make sure your environment meets the following requirements:
* dsh version >= 0.1.1-rc.2
* Node.js version >= 20

The installation steps are as follows:

  1. Install the plugin using the npm source (recommended):
dsh plugin --profile web add dsh-memory
  1. After installation, restart the dsh process or reload the Web UI to activate the plugin.

Core Features

The plugin provides the following core capabilities:

  1. Persistent Storage
    All memory data is stored in a JSON file located at $DSH_HOME/memory-plugin/memories.json (i.e., ~/.dsh/memory-plugin/memories.json).

  2. Automatic Recall
    Through system prompt instructions, the plugin requires the model to call the memory_recall tool at the very beginning of answering a question to retrieve relevant contextual information.

  3. Automatic Saving
    The model is instructed that after completing the answer, if it identifies new facts worth remembering, it should call the memory_save tool to store the information in long-term memory.

  4. Full-Featured Tools
    The plugin registers five tools for the model to call:

    • memory_save: Save facts or preferences.
    • memory_recall: Search memories by keywords or tags and return ranked results.
    • memory_list: List all memories (supports pagination and tag filtering).
    • memory_update: Update an existing memory by ID.
    • memory_delete: Delete a memory by ID.
  5. Dynamic Context Injection
    The system automatically injects memories with an importance score of 3 stars or higher into the runtime context of each request.

  6. Visual Settings Page
    In the Web UI, go to Settings → Long-Term Memory to browse, search, add, edit, and delete memories. Search supports real-time debouncing (300ms).

  7. Intelligent Search
    The search function combines keyword matching and tag matching, and performs scoring and ranking based on importance and time.

  8. Import and Export
    Supports exporting the memory database as a JSON file for backup, and also supports importing from a JSON file (supports merge or replace mode).

Data Structure and Importance

Each memory record has the following structure:

{
  "id": "uuid",
  "content": "self-contained fact or preference",
  "tags": ["preference", "python"],
  "category": "technical",
  "importance": 4,
  "createdAt": "2026-09-01T12:00:00.000Z",
  "updatedAt": "2026-09-01T12:00:00.000Z",
  "source": "model"
}

Importance scores are divided into five levels:
* 1 star: Transient — likely to become irrelevant soon.
* 2 stars: Low — minor preferences or contextual information.
* 3 stars: Normal — default level, useful recurring information.
* 4 stars: High — important preferences or decisions.
* 5 stars: Critical — information that must always be remembered.

Import and Export

The exported file contains the version number, export time, total number of memories, and the memory array.

{
  "version": 1,
  "exportedAt": "2026-09-02T...",
  "count": 42,
  "memories": [ ... ]
}

The import function accepts either the full format above or a raw array of memory objects. Import modes support merging (deduplicating IDs, updating existing entries, adding new entries) or replacement.

Notes

  • Web Profile Dependency: The visual settings page is only available when using the Web profile. However, the five model tools described above also work in headless profile mode.
  • File Permissions: The plugin runs with the permissions of the current dsh process. Make sure the relevant directory has write permissions.

Concise Ending

By combining system prompts with tool calls, dsh-memory enables the model to manage its context autonomously. It not only addresses context window limitations but also lowers the usage barrier through a visual management interface. For agent development scenarios that require long-term memory, this is a practical tool. See the GitHub repository for more details and source code.