Overview

DeepSeek Harness (DSH) uses a plugin-based architecture. When developing agents, conversation history grows over turns, and it is difficult to extract persistent key facts from it. This plugin is designed to provide DSH with structured long-term memory capabilities, using plain-text storage and a dynamic injection mechanism to allow agents to maintain long-term state about users or projects.

Plugin Introduction

deepseek-memory is a curated long-term memory plugin for DeepSeek Harness. It provides two-level plain-text fact storage, memory tools, and post-turn consolidation. The stored content consists of bounded curated facts rather than a conversation log index, and per-request dynamic injection is used to keep the context current.

Core Features

Two-Level Storage

The plugin supports two-level directory storage for different dimensions of memory:
* User-level: stored in $DSH_HOME/memory/ and records identity information about users.
* Project-level: stored in <cwd>/.dsh-memory/ and records project conventions and decisions.

Memory Tools

The plugin provides the following memory management tools:
* memory_add: add a memory
* memory_update: update a memory
* memory_delete: delete a memory
* memory_list: list memories
* memory_search: search memories
* memory_status: view status

Request Injection

Via the systemPrompt service, the plugin dynamically injects memory content into every request. This process occurs during request assembly and does not write memories into the session history.

Post-Turn Consolidation

The plugin uses a restricted subagent to perform memory consolidation. It defaults to gated mode and runs only when specific conditions are triggered; it can also be configured as always mode.

Installation and Activation

Run the following command in the terminal to install the plugin:

dsh plugin --profile <name> add deepseek-memory

After installation, the configuration file must be restarted for the plugin to take effect.

Configuration

Override memory.config in cordis.patch.yml to adjust behavior:

- id: memory
  config:
    maxEntries: 80
    consolidation: always

Key configuration options:
* maxEntries: defaults to 50, the maximum number of entries per storage level.
* consolidation: defaults to gated, with options off, gated, and always. Controls when consolidation is triggered.
* injectChars: defaults to 4000, the maximum number of characters injected per request.

Storage Format

The storage file is in JSON format with version 1. IDs are generated from the text, so repeatedly adding the same text is treated as a no-op.

{
  "format": 1,
  "tier": "project",
  "revision": 3,
  "updatedAt": 1790000000000,
  "entries": [
    {
      "id": "m1a2b3c4",
      "text": "The build uses tsc, not a bundler.",
      "tags": ["build"],
      "createdAt": 1789990000000,
      "updatedAt": 1790000000000,
      "origin": "consolidator"
    }
  ]
}

Notes

  • Dependency Injection: The plugin relies on the inject field to register the systemPrompt service. If this field is missing, the service will be unavailable.
  • Build Artifacts: The repository includes a compiled lib/ directory, so no build step or allowlist is required.
  • Consolidation Mode: Consolidation defaults to gated to avoid consuming model resources on every turn.

Summary

This plugin solves the persistence problem of long-term memory in DSH through two-level plain-text storage and a dynamic injection mechanism. If you plan to use it, make sure to restart the configuration after installation and review the source code license.