Introduction

In the plugin system of deepseek-harness (DSH), a model’s memory is typically not automatically retained from the previous session for confirmed information within a project. dsh-project-memory is a memory plugin maintained by JasperGuWP that writes stable project knowledge into the memory/ directory within the project so that subsequent sessions can read it.

It persists memory as ordinary Markdown files, which facilitates manual review and modification, and can be used for auditing and diffs via git. The following introduces its features, installation methods, and typical usage.

What is it

dsh-project-memory is a zero-dependency DSH plugin. It does not pre-load specific business knowledge; once installed into a project, it revolves around that project’s memory/ directory.

The plugin provides four tools:

  • memory_load_context
  • memory_upsert
  • memory_finalize
  • memory_forget

These are used to load relevant memory, write or update memory, consolidate task conclusions as reference memory, and delete expired or superseded memory, respectively.

Core Features

Files as Memory

The plugin writes memory as ordinary Markdown files:

  • memory/MEMORY.md serves as a pure index
  • memory/*.md stores the body content

This structure is suitable for manual review and facilitates version control.

Tool Descriptions

Tool Function
memory_load_context Loads relevant memory when a session or task starts, supporting keyword search and catalog lists
memory_upsert Writes or updates a memory entry
memory_finalize Consolidates a reference memory entry when finalizing a task
memory_forget Deletes the body file and corresponding index lines, but protects MEMORY.md and reference.md

Sensitive Information Interception

When the content to be written matches sensitive information such as token, cookie, password, secret keys, JWT, .env, the plugin will refuse to save and return ok:false.

Workspace-aware Root Directory

The plugin determines the memory root directory in the following order:

  1. Preferably use sandboxPolicy.resolve({ session })
  2. Fall back to config.memoryRoot
  3. Then fall back to process.cwd()

This ensures the plugin follows the workspace of the current session as closely as possible.

Retrieval and Reference Control

The plugin supports keyword search and catalog lists. For reference-type memory, the maximum number of entries can be set via maxReferenceEntries, and the oldest entries are automatically trimmed when the limit is exceeded.

Installation and Activation

Plugin Installation

The plugin installation command is as follows:

dsh plugin --profile web add dsh-project-memory

After installation, you need to restart the dsh process for it to take effect.

Verification and Removal

After installation, you can use the following command to confirm if the plugin configuration appears:

dsh --profile web --dump-config | grep -A2 project-memory

If you want to remove the plugin, you can use:

dsh plugin --profile web remove dsh-project-memory

Manual Local Plugin

If you do not use the plugin package installation, you can also place memory-plugin.ts locally and add an insert item to the profile’s cordis.patch.yml:

- insert:
    - id: project-memory
      name: '/absolute/path/to/memory-plugin.ts'

Restart the dsh process after saving.

The bundle entry is the pre-compiled memory-plugin.js; the local .ts method is loaded via Node’s native type-stripping and can be used with tsx in the development environment.

Typical Usage

You can verify if the plugin works as expected in the following two steps:

  1. Session A inputs:
   记住:这个项目用 pnpm 打包。

Expected behavior: The plugin calls memory_upsert and successfully writes it.

  1. Session B inputs:
   这个项目怎么打包?

Expected behavior: The plugin calls memory_load_context and repeats pnpm in the answer.

Applicable Scenarios and Notes

dsh-project-memory is suitable for DSH users who wish to solidify stable information within the project into auditable text. It is recommended to read the source code and the MIT license before installation, as the plugin runs with the permissions of the current dsh process.

Notes before use:

  • You need to restart the dsh process after installation or configuration.
  • The plugin was tested on deepseek-harness with Node >= 22.
  • Runtime only depends on node:fs and node:path, with no external npm runtime dependencies.
  • If you encounter an allowBuilds prompt when installing via pnpm’s git dependency method, add the corresponding configuration to pnpm-workspace.yaml in the profile and run it again as prompted.
  • memory_forget will delete the body file and corresponding index lines, but will protect MEMORY.md and reference.md.
  • Sensitive information interception happens during the write operation and cannot replace a complete security boundary design.

Links

GitHub:

https://github.com/JasperGuWP/dsh-project-memory