dsh-plugin-clm: Mirror DSH Context Window to Disk and Make It Editable

Introduction

When engaging in long conversations or tool-intensive tasks in DeepSeek Harness (DSH), the context often only grows rather than shrinks: terminal outputs, retrieval results, and debug snippets pile up in the same append-only history. This causes token counts to balloon quickly, which subsequently affects the quality of reasoning. A common workaround is manually clearing the session or switching topics, but it is difficult to finely control the balance between “retaining decisions and conclusions” and “deleting noise.”

Here we introduce the community plugin dsh-plugin-clm (Context Language Models for DeepSeek Harness). On the DSH side, it synchronizes active session context to a local Markdown mirror and supports trimming and compression before generation. The approach is inspired by Meta CLM and pi-clm. The maintainer is GitHub user maxeone (Maximiliano Roldán). It is categorized under “Model Inference” in the SkillHub directory. The repository maxeone/dsh-plugin-clm is licensed under MIT.

What is this

dsh-plugin-clm transforms DSH’s default “block-based, append-only” context into an active, editable, disk-synchronized context document, with the default path being .dsh/clm/LIVE_CONTEXT.md. Once enabled, the agent and user can actively prune, compress, and organize the current session state before each generation, rather than passively accepting a constantly lengthening raw history.

Core Features

The capabilities explicitly listed in the documentation are as follows:

  1. Real-time Context Synchronization: Ongoing session context is written to a structured Markdown file (.dsh/clm/LIVE_CONTEXT.md).
  2. Proactive Context Trimming: Facilitates compressing lengthy terminal dumps and tool results into brief summary notes.
  3. Interface Toggle: A [ CLM ON / CLM OFF ] toggle is integrated into the chat input bar, running in the background.
  4. Token Overflow Protection: Automatically enforces a context budget (budgetTokens: 64000, reserveTokens: 4096) to reduce the risk of suddenly maxing out the context.
  5. Per-session Persistence: Remembers the enabled/disabled state for each conversation after the application is reloaded.

Installation and Activation

The DSH ecosystem adopts an “everything is a plugin” approach; SkillHub (Plugin Directory Page) is an independent community site and has no official affiliation with DeepSeek / High-Flyer. Please review the repository source code and the MIT license yourself before installing; the plugin runs with the permissions of the current dsh process, and mirror files will be written to relevant paths within the workspace.

Method 1: Edit the desktop profile’s package.json

Path: ~/.dsh/profiles/desktop/package.json. Add the plugin to dependencies and dsh.profile.bundles (the version in the README example is ^1.0.2):

{
  "dependencies": {
    "dsh-plugin-clm": "^1.0.2"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "dsh-plugin-clm"
      ]
    }
  }
}

Method 2: CLI

dsh plugin add dsh-plugin-clm

After completing the dependency and bundle configuration, simply load the profile using your usual DSH startup method.

Typical Usage

Slash Commands

Command Description
/clm on Enable the editable context mirror for the current session
/clm off Turn off CLM, reverting to the standard append-only context
/clm status Display estimated context tokens, revision count, and mirror file path
/clm reset Clear and regenerate a clean mirror state for this session

You can also use the CLM toggle button in the input bar to switch states without needing to memorize commands.

Mirror Document Structure

In .dsh/clm/LIVE_CONTEXT.md, apart from the free notes block [[CTX_NOTES]], [[CTX_TURN ...]] fragments are recorded by turn. The structure example in the README is as follows:

# CONTEXT LANGUAGE MODEL (CLM) - ACTIVE MIRROR

[[CTX_NOTES]]
- Objective: Refactor authentication architecture.
- Decisions: Retain JWT tokens in protected in-memory store.

[[CTX_TURN document=sess-1 index=1 role=user]]
Check the server logs for recent authentication errors.

[[CTX_TURN document=sess-1 index=2 role=assistant]]
Examining logs:
[Tool output summarized to the 3 relevant failure entries]

Actual file names and block content vary by session; use /clm status to verify the path and token estimates.

Scenarios and Cautions

Suitable for: DSH users engaging in long-chain debugging, dealing with massive tool outputs, and needing to retain “goals / decisions” across multiple turns while wanting to delete stale dumps.

Cautions:

  • The mirror and trimming logic depend on the plugin implementation; check GitHub Releases / package.json versions before upgrading.
  • Do not assume CLM will perform business-level auditing for you; sensitive information may still enter the mirror file, so workspace permissions and .gitignore must be handled by yourself.
  • After turning off CLM (/clm off or via UI), the behavior reverts to DSH’s default append-only context.

Conclusion

dsh-plugin-clm lands DSH session context into an editable .dsh/clm/LIVE_CONTEXT.md. Combined with budget guards and per-session toggles, it is geared towards token optimization and proactive context organization. For further information, please visit the SkillHub Directory Page and the GitHub Repository.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye