dsh-flymemory: Local Long-Term Memory for DeepSeek Harness

Introduction

When building agents in DeepSeek Harness (DSH), limited context windows and difficulty persisting state are common pain points. Starting a new session requires re-explaining background information, or relying on external services to store sensitive data, which does not meet the needs of localized development. DSH’s plugin mechanism allows extending core capabilities, and dsh-flymemory is a solution to this problem.

Overview

dsh-flymemory is a DSH Bundle plugin. It runs a FlyMemory MCP service locally and integrates 15 memory tools and two automatic hooks into DSH. Data is stored in the local file system, the service listens on 127.0.0.1:8791, and it does not involve remote network transmission.

Core Features

The plugin exposes tools to the model with the prefix mcp__flymemory__ and runs two hook scripts to implement automatic memory management.

Memory Tools

Provides 15 tools for memory create, read, update, and delete operations:

  • Storage and retrieval: flymemory_remember stores decisions or findings and supports grouping by compartment; flymemory_recall searches by combining dense vector retrieval and keyword matching; flymemory_auto is the core called by hooks and completes “retrieve” and “store” in one call.
  • State management: flymemory_state_lookup and flymemory_state_history track current values or history for specific keys, suitable for managing state such as “current value X”.
  • Conflict and cleanup: flymemory_find_conflicts finds contradictory entries; flymemory_forget and flymemory_cleanup delete entries or clean expired data.
  • Session assistance: flymemory_session_pack packages summaries of recent activity; flymemory_stats outputs statistics.
  • Other: flymemory_supersede marks old entries as superseded by new entries; flymemory_consolidate merges multiple records.

Automatic Hooks

Two hook scripts are triggered automatically on DSH events:
- Capture: runs after each conversation and writes the current prompt to memory.
- Recall: runs before each conversation, retrieves relevant memories, and appends them to the context.
Hook scripts fall back silently when the service is unavailable and do not block the conversation.

Local Supervision Engine

The engine is Python-based and depends on torch and sentence-transformers. On first run, it needs to download a multilingual embedding model (approximately 470 MB). After the download is complete, it supports offline operation.

Installation and Activation

Prerequisites:
- Node.js 20+
- Python 3.10+
- Python dependencies: torch, sentence-transformers, “mcp>=1.30,<2”, numpy

Installation command:

plugin_manager(action: "install_bundle", target: "/absolute/path/to/dsh-flymemory")

After installation, check the service status:

node bin/flymemory.mjs status
node bin/flymemory.mjs doctor

Data and Configuration

Data Storage

Memory data is stored in $DSH_HOME/flymemory-data/flymemory_v3.pkl. The environment variable FLYMEMORY_DATA_DIR can change this directory.

Service Configuration

The service listens on 127.0.0.1:8791 by default. It can be adjusted with FLYMEMORY_MCP_PORT and FLYMEMORY_MCP_URL.

Cold Start

Because it needs to load PyTorch models, the first startup and cold start take longer, typically around 15-20 seconds.

Notes

  • The plugin runs with the permissions of the current DSH process. Before installation, it is recommended to review the source code and license (MIT).
  • Credential-like text (such as gh token) is not stored.
  • When removing the plugin, data files are not automatically deleted and must be handled manually.
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye