dsh-context-control: DSH Context Usage Ring and Recoverable Compression

Preface

When developing long sessions in DeepSeek Harness (DSH), the context quickly piles up with tool outputs, file diffs, and conversation turns. Once the window approaches its limit, you either have to interrupt the current task and switch sessions, or rely on the host or third-party plugins for compaction—but if compaction cannot trace back to the original text, or the trigger conditions are opaque, troubleshooting and recovering the user’s original intent become difficult.

Below is the community plugin dsh-context-control (maintainer sxwer001, categorized as “Memory” on SkillHub): it displays a context usage ring next to the model selector, performs automatic or manual compaction based on configurable character thresholds, and preserves original conversation events that can be paginated for retrieval. The first version targets DSH 0.2.0-rc.2, reusing that version’s native Session, TokenMeter, StorageDomain, and compaction transactions, rather than being a standalone Node program.

What Is This

dsh-context-control is a context compaction and usage visualization plugin for DSH. In one sentence: it loads a usage ring and a compact panel into the right side of the input area (the conversation.input.right slot), measures effective characters using Unicode code points (including the current message and visible text of tool definitions, excluding image bytes), shows the window ratio from DSH’s token projection/estimation separately from the character trigger line; compaction goes through the official persistence transaction, and the original text remains retrievable after summarization.

The plugin’s current release version is v0.1.2 (MIT), with 0 GitHub stars. The DeepSeek Harness ecosystem emphasizes “everything is a plugin”; the SkillHub catalog page is a community site with no official affiliation with DeepSeek / High-Flyer.

Core Features

Usage and Thresholds

  • Displays a context usage ring next to the model selector; clicking expands a compact card where you can see window occupancy, effective characters, window capacity, recent compaction, and so on. Window measurement uses concise numbers like “used 53k, total 1M”; no fake percentage is shown when the model capacity is unknown.
  • Automatically compacts by default when the effective context reaches 400,000 characters; the threshold can be configured in the range 10,000–5,000,000, supports disabling auto-compaction, and distinguishes between “current session settings” and “global default”.
  • Early safety compaction triggers when approaching the model window limit; when auto-compaction is off, this early trigger is off as well. Context overflow recovery is controlled by the host-side overflowRecoveryEnabled (not a separate switch of this plugin).

Compaction Behavior and Original Text Preservation

  • Supports manual “compact now”; tasks in progress are queued to execute at a safe boundary, and pending requests can be cancelled.
  • Preserves the latest user message and recent work; the original text of replaced real user requirements is written to a checkpoint, and history revisions are sorted by time.
  • Structured summaries cover tasks, constraints, decisions, file changes, verification evidence, failures, and to-dos.
  • Uses the official persistent compaction transaction, preserving tool call pairing; does not replace the original context on failure, cancellation, output truncation, or concurrent history changes.
  • Original conversation events are preserved and can be paginated through the UI or the context_control tool; successful shell output only collapses consecutive fully duplicate long logs, saving the original text first; if saving fails, the output is preserved.
  • Rejects replacement when the original user requirement exceeds 64,000 characters, to avoid protective content actually bloating the summary.

Interface and Integration

  • Chinese and English, plus DSH native themes; the panel operates silently through native authenticated RPC, leaving no command records in the chat; context-control lines left by older panel versions are hidden from display, with raw data still preserved.
  • Technically, it reuses the selection/transaction implementation of @deepseek-ai/dsh-compaction-basic (see vendor/upstream.json in the package for the upstream version and hash); summarization by default calls the model of the session’s most recent request, and you can specify summarizationProvider and summarizationModel as a pair in the Host configuration. Summarization incurs regular model API charges.

Installation and Activation

Before installing, confirm the host is DSH 0.2.0-rc.2. The peer dependencies declared in the package are provided by a matching version of DSH; the plugin will not install another copy of the Harness; do not run this plugin directly in a standalone Node program. The plugin runs with the current DSH process permissions; before installing, review the GitHub source code and license yourself.

Download the pre-built .tgz from GitHub Releases, or install using a pinned version:

dsh plugin --profile web add https://github.com/sxwer001/dsh-context-control/releases/download/v0.1.2/dsh-context-control-0.1.2.tgz
dsh --profile web

Local package path example (PowerShell, adjust paths as needed):

dsh plugin --profile web add 'D:\path\dsh-context-control-0.1.2.tgz'
dsh --profile web

The desktop profile can be installed via the plugin manager inside Electron, or, after fully quitting the app, via the official CLI entry in the installation directory, for example:

resources/runtime/cli/bin/dsh.cmd plugin --profile desktop add <package path>

Do not manually rewrite the desktop app’s dependencies and configuration. The package’s cordis.patch.yml registers the plugin; after reloading, when an existing conversation is present and the model selector is visible, a usage ring will appear next to the model in the input area. Settings can be saved when no model is configured, but executing summarization requires valid model routing.

If billion-context or other compaction plugins are already installed, it is recommended to verify in an isolated profile first before deciding which auto-compaction strategy to keep. This package does not replace the native compaction service; the order and benefits of multiple auto strategies enabled simultaneously need real-world testing.

Typical Usage

UI

  1. Click the usage ring to view the compact usage card, and you can directly choose “compact now”.
  2. Expand “Settings and details”, modify the character threshold and click “Apply” to save to the current session; “Set as global default” applies to sessions that do not override individually.
  3. After disabling auto-compaction, manual compaction is still available. A running task will show “compact at safe boundary”; when there is no safe old history, the original context is preserved and a hint is given.

Commands and Tools

Commands and the model tool share the same Host operations, for example:

/context-control status
/context-control compact
/context-control {"action":"configure","scope":"session","settings":{"triggerChars":600000,"autoEnabled":true}}
/context-control {"action":"cancel"}
/context-control {"action":"history"}

The tool context_control accepts the same JSON; large original text responses contain a next field, and you continue paging requests with it. Only the current session’s original text can be retrieved; the original text belongs to historical material and should be understood together with the current request.

Applicable Scenarios and Cautions

Who it’s for: developers running long tasks on DSH 0.2.0-rc.2, who want to see window occupancy and character counts at a glance, want controllable auto-compaction by a character line, and still want to be able to flip through the original text after compaction.

Limitations you must know:

  • Summarization is lossy compression; the original text can be retrieved and explicitly requiring preservation in the prompt can reduce the risk of loss, but no guarantee can be made that subsequent model work is completely unaffected; shorter context also does not mean the bill will necessarily drop, as costs depend on cache hits, summarization calls, and subsequent turn counts.
  • Only the target DSH version is verified; other versions need re-verification, do not assume full-version compatibility.
  • When coexisting with similar compaction plugins, test strategies yourself in an isolated profile to avoid multiple auto-compaction mechanisms interfering with each other.

The maintainer’s notes from 2026-10-12 record UI and RPC verification for local and web/desktop profiles (including character changes from manual/auto compaction and original text retrieval), without making general conclusions about the quality of real work tasks or bill savings ratios; for details, see the “Development and verification” section of the repository README.

Conclusion

dsh-context-control brings context occupancy visualization, character thresholds, and manual compaction right next to the model selector, and relies on the native compaction transactions of DSH 0.2.0-rc.2 to preserve recoverable original text and structured summaries, making it suitable for controllable, auditable long-session scenarios.

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

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

Xiaoye