dsh-long-memory: DSH Ultra-Long Memory Package

Preface

When running agents in DSH (DeepSeek Harness), no matter how large the context window is, previous conclusions, preferences, and project details are still easily lost when switching sessions or compressing history. Relying solely on the model to “remember” the previous conversation is neither queryable nor transferable; stuffing the entire chat history into the prompt causes costs to rise rapidly.

The following introduces the community plugin dsh-long-memory (Maintainer: Tangcuyu4, Category: Memory): It performs hybrid retrieval in pure JavaScript locally, consolidating four capabilities—cross-session long-term memory, long-document chunk retrieval, chat history extraction and refinement, and context summary archiving—into a single toolkit. Data is stored in $DSH_HOME, with no dependency on third-party npm retrieval libraries.

What is this

dsh-long-memory is a “super long memory pack” installed for DSH. The README positions it as: Cross-session long-term memory + Long document lookup + Chat history extraction and refinement + Context summary recording and review. The retrieval side uses a hybrid of BM25 and Chinese Bigram tokenization, and the plugin claims zero third-party dependencies.

The current version in package.json is 1.1.0, licensed under MIT. The plugin registers tools, system prompts, and a Skill (long-memory) via Cordis patches. Permissions include tool registration, system prompt injection, Skill registration, and read/write access to the DSH storages data directory.

Core Features

Long-term Memory

Provides memory_store, memory_search, memory_get, memory_list, memory_forget, memory_stats, as well as the runtime configuration tool memory_config (auto-injects switches, limits, chunking parameters, etc.; changes take effect immediately).

  • Retrieval supports mixed Chinese-English, exact phrase matching ("..."), and tag / kind filtering.
  • Similar memories are automatically merged while retaining historical versions; soft deletes are recoverable, while hard deletes go to trash.jsonl.
  • Memories with importance≥4 can be automatically injected into the context at the start of every session (configurable).

Long Document Lookup

doc_ingest splits files by lines (chunk size and overlap are adjustable). doc_search / doc_read / doc_list perform chunk-level retrieval, read raw text by chunk or line, and list documents. Retrieval results include line number citations, and raw text can be read by line across chunks. Duplicate ingestion is automatically skipped if content hasn’t changed; chat histories can also enter the same document index via chat_extract { ingest: true }.

Chat History Extraction and Refinement

chat_list, chat_extract, and chat_digest read the DSH session projection cache (storages/session_projcache/sessions/session-*.json), extracting “User Query + Assistant Reply” turn by turn, and can be sliced by turn ranges.

chat_digest produces a deterministic skeleton (per-turn gist, files, commands, URLs, conclusion signal sentences); semantic-level refinement is completed by the agent on top of the skeleton, followed by calling memory_store to archive it. The plugin intentionally does not embed LLM calls, keeping extraction and skeleton steps visible and controllable.

Context Summary (Recording and Review)

summary_save, summary_list, and summary_read are used to archive progress summaries of large amounts of work along with session and turn ranges; the latest summary can be automatically injected into the prompt block to facilitate continuation after compression or session switching. The ledger can be reviewed by session or keyword; summaries also act as digest memories and can be found via memory_search. If no body text is provided, a deterministic skeleton can be auto-generated by session turns as a fallback.

Tool Overview

The README lists a total of 17 tools (including the memory, doc, chat, and summary series mentioned above, plus memory_config). The system prompt and the long-memory Skill teach the agent when to store, when to query, and how to cite; the Skill can be invoked manually or automatically.

Installation and Activation

The installation instructions in the materials target the local DSH Desktop, not commands like dsh plugin add github:.... The steps are as follows:

  1. Place the plugin source code in %APPDATA%\dsh-desktop\harness\plugins\dsh-long-memory\.
  2. Register it in the profile %APPDATA%\dsh-desktop\harness\profiles\web\package.json:
    - Add "dsh-long-memory": "file:../../plugins/dsh-long-memory" to dependencies;
    - Add "dsh-long-memory" to the dsh.profile.bundles array.
  3. Ensure a copy of the plugin exists at profiles\web\node_modules\dsh-long-memory\ (via pnpm install or direct copy).
  4. Restart DSH Desktop and trigger a memory_stats call in a session to verify successful loading.

Data Location and Configuration

Default data directory:

$DSH_HOME/storages/dsh-long-memory/
├── memories.json      # Memory bank (atomic write)
├── trash.jsonl        # Hard delete trash bin
├── config.json        # Runtime configuration
└── docs/              # Long document index (index.json + one json per document)

The entire directory can be backed up or migrated. The environment variable DSH_LONG_MEMORY_DIR can move the data to a different path.

Retrieval is implemented in lib/search.js: ASCII words and CJK sliding Bigram tokenization, BM25 (k1=1.4, b=0.75) combined with phrase hits and coverage rates; the memory layer adds a small bonus based on importance / recency. Chat parsing is fault-tolerant to skip bad files to avoid crashing the session list.

Typical Usage Patterns

Once installation is verified, you can use it layer by layer according to the README’s capabilities (refer to the tool schema within the session for specific parameters):

  1. Record Conclusions and Preferences: Before a task ends, use memory_store to write key points, adding tag / kind if necessary; use memory_search or automatically injected high-importance memories at startup to connect context next time.
  2. Tackle Long Documents or Repo Docs: Use doc_ingest to build the index, doc_search to locate chunks, and doc_read to read raw text by line and cite line numbers.
  3. Extract Insights from Old Sessions: Use chat_list to find sessions and chat_extract to get raw text for a range; use chat_digest when a structured skeleton is needed, then have the agent refine it before calling memory_store.
  4. Resume Long Tasks: Save periodic progress with summary_save; use summary_read / the auto-injected latest summary to continue writing after switching sessions or compressing context; use summary_list to browse the ledger by session or keyword.

Use Cases and Caveats

Suitable for DSH users who need to keep information local, searchable, and backup-able in scenarios involving multiple sessions, long documents, and long conversations. The DSH ecosystem emphasizes “Everything is a plugin”; the community catalog SkillHub Plugin Page is an independent site and has no official affiliation with DeepSeek / High-Flyer.

Please review the GitHub Source Code and LICENSE yourself before installing. The plugin reads and writes storages and session projection caches with the current DSH process permissions; you should only install from sources you trust. If the README does not provide a one-click CLI installation command, do not construct undocumented installation methods based on the plugin name.

Conclusion

dsh-long-memory consolidates long-term memory, long-document retrieval, chat extraction, and context summaries into a single local storage solution with zero third-party retrieval dependencies, using 17 tools and a Skill to guide the agent on when to store and when to query. For details and updates, please refer to the repository README.

  • Directory Page: https://www.skillhub.cn/plugins/Tangcuyu4/dsh-long-memory
  • GitHub: https://github.com/Tangcuyu4/dsh-long-memory
羽毛球分组比赛记分
小程序二维码

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

Xiaoye