Introduction

DeepSeek Harness (DSH) is an agent development framework based on a plugin ecosystem. When building long-running agents, context loss caused by session isolation is a common pain point. The disc0nct/dsh-memory-plugin introduced below aims to solve this problem. It provides DSH with cross-session persistent storage and retrieval, enabling agents to remember key information.

What Is This Plugin

This is a DSH memory plugin maintained by disc0nct. It supports saving information to disk and making it persist across sessions. It is released under the MIT license and includes modules for configuration, storage, and search, with deep integration into the native DSH environment.

Core Features

The plugin provides the following core capabilities:

  • Persistent storage: Memories are saved to disk and persist across sessions.
  • Flexible search: Supports hybrid keyword+semantic mode, including inverted indexing and numeric sorting optimizations.
  • Categorization: Supports optional categories for memories, defaulting to general.
  • Atomic writes: Uses a write+rename pattern with fault-tolerance recovery mechanisms.
  • Validation and safety: key and category must be validated as kebab-case; reads are concurrency-safe.
  • Seven tools: Provides memory_store, memory_search, memory_get, memory_list, memory_delete, memory_clear, and memory_stats.

Installation and Enablement

The installation process can be completed with the following command:

dsh plugin --profile <your-profile> add github:disc0nct/dsh-memory-plugin

The command performs the installation, after which the plugin takes effect in the configuration.

Typical Usage

After installation, agents can call the following tools via ctx.tools:

Storing Memory

Save user preferences or project information:

// 存储用户偏好
await ctx.tools.memory_store({
  key: 'user-name',
  value: 'Alice',
  category: 'preferences'
});

// 存储项目信息
await ctx.tools.memory_store({
  key: 'project-language',
  value: 'TypeScript',
  category: 'project'
});

Searching Memory

Hybrid search is supported, and a category can also be specified:

// 搜索所有包含 'Alice' 的记忆
const results = await ctx.tools.memory_search({ query: 'Alice' });

// 搜索特定分类
const results = await ctx.tools.memory_search({ category: 'preferences' });

// 组合搜索
const results = await ctx.tools.memory_search({
  query: 'API',
  category: 'decisions',
  limit: 5
});

Lookup and Listing

Quickly look up a single key or list all memories:

// 按键查找
const { found, fact } = await ctx.tools.memory_get({ key: 'user-name' });

// 列出记忆
const memories = await ctx.tools.memory_list();

Cleaning and Statistics

Manage memory data:

// 删除特定记忆
await ctx.tools.memory_delete({ key: 'user-name' });

// 清除所有记忆(需显式确认)
await ctx.tools.memory_clear({ confirm: true });

// 获取统计信息
const stats = await ctx.tools.memory_stats();

Use Cases and Notes

This plugin is suitable for agent scenarios that require maintaining context over the long term.

The following facts should be noted during configuration and use:

  • Configuration path: The default configuration file path is $DSH_HOME/memory. (i.e., ~/.dsh/memory.).
  • Safe cleanup: When running memory_clear, you must explicitly pass the confirm: true parameter.
  • Naming convention: key and category must use kebab-case.
  • Concurrency safety: Read operations are concurrency-safe; write operations are serialized through a locking mechanism.
  • Quantity limit: Supports a maximum limit of 5,000 memories (MAX_FACTS).
  • Data recovery: Includes data recovery mechanisms, such as automatic cleanup of orphaned temporary files (.tmp.*) and backup of corrupt files (.corrupt.*).

The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installation.

Short Conclusion

This plugin provides DSH agents with basic persistent memory capabilities. Combined with categorization and search functionality, it can effectively improve coherence in long conversations. For more details, refer to the community directory or the GitHub repository.