Introduction

In the development practice of DeepSeek Harness (DSH), managing long conversation context is a common pain point. Traditional compression solutions often rely on an LLM to summarize, which can easily lead to detail loss or context distortion. dsh-context-rollover aims to solve this problem by providing a model-driven context-window rollover mechanism. Its core value is to allow the model to proactively end the current working context at an appropriate time, without using a summarizer, and restore persisted state (notes) and the original recent tail in the new window.

Core Features

This plugin is integrated into DSH as a bundle and primarily performs the following responsibilities:

  • Taking over the compression engine: Provides an active ctx.compaction engine and automatically disables the default dsh-compaction-basic.
  • Model toolset: Exposes four core tools to the model: new_context (request boundary), get_context_remaining (query remaining budget), notes (persistent notes), history (history restoration).
  • Local persistence: Writes markdown-formatted notes to the <dsh home>/notes/<session id>/ directory. It does not depend on cloud services, and all data remains on the local machine.
  • Raw data retention: Preserves original session events and a verbatim recent tail, ensuring history is not overwritten by LLM-generated content.

Installation

Install the plugin with npm:

dsh plugin --profile <profile> add dsh-context-rollover

If you need to install from GitHub:

dsh plugin --profile <profile> add github:athif23/dsh-context-rollover

After installation, the plugin’s cordis.patch.yml is applied automatically, disabling dsh-compaction-basic and mounting the context-rollover engine. Because the plugin declares dsh.bundle.patch, it takes effect without additional configuration.

Usage

Using this plugin requires following a specific workflow and preset configuration.

1. Select a Preset (Web Profile)

For Web profiles, the plugin is available only when operating under the standard-rollover preset. The default standard preset does not include the rollover tools.

Procedure:
1. Open a new session.
2. In the preset selector, choose “Standard + rollover (experimental)”.
3. Complete the selection before sending the first message; once the first round of the session begins, the preset is frozen and cannot be changed.

2. Manual Rollover

When idle, you can use the /compact command to manually trigger a standalone notes and tail rollover.

3. Automatic Rollover

The plugin has a built-in stress detection mechanism. When context stress exceeds the thresholdRatio threshold, the engine automatically performs a rollover, preserving notes and the verbatim tail.

4. Model-Driven Rollover

The model can save notes at phase boundaries (for example, transitioning from a research phase to an implementation phase), and call the new_context tool to initiate a rollover request, passing a short handoff instruction.

Notes

  • Peer dependency resolution: The plugin’s @deepseek-ai/* peer dependency items are resolved from the installation closure of the running host rather than from npm. This means you need to ensure that the corresponding DSH dependencies are already installed in the local environment.
  • Dependency requirements: Import support for @deepseek-ai/* is required to be available in the environment.
  • Windows path issues: If installation from Git Bash on Windows causes runtime import failures, it may be because pnpm created broken link: junctions. These links need to be rebuilt using cmd /c mklink /J (see the GitHub README for details).

Summary

dsh-context-rollover is a toolkit focused on context management. By returning state-management control back to the model and working with the local file system, it enables context extension without summarization. It is suitable for advanced users who need long-term, high-precision conversation management in local environments.

For more information, see: GitHub repository.