DeepSeek Harness Context Details Plugin

Introduction

In DeepSeek Harness (DSH), context window management is a common pain point in agent development: tool calls, message history, and system prompts continuously accumulate, easily exceeding window limits and causing truncation or performance degradation. Developers often have no choice but to rely on token statistics returned by the model, making it difficult to know the specific distribution and occupancy ratio of context within the window. This article introduces a DSH plugin that provides a context strip above the message input box and opens a context detail panel in the right sidebar, presenting window occupancy, tool call chains, skill and cache usage, and more in a collapsible tree structure—facilitating real-time monitoring of context pressure and growth trends.

Plugin Overview

japr26/dsh-context-detail is a DSH client plugin developed by maintainer japr26. It adds a Context Strip and a Context Panel to DeepSeek Harness, used to display the current session’s token distribution, tool and MCP server invocations, skill occupancy, compression history, and cache hit rates. The plugin itself does not send model requests or modify prompt content—it only reads session logs and current session state in a read-only manner, and therefore consumes no additional tokens.

Core Features

Context Strip

The context strip is positioned above the message input box and displays the current model window utilization. The bar chart segments show the window occupancy ratio, a percentage display of ~used / window, and three sets of estimated values, using the same segmentation method as the right-side panel after the session log is read. To the right of the bar chart, a cache chip displays the previous turn’s prompt-cache hit rate and its session-level rate. The context strip is positioned using the host’s input box variables (--dsh-composer-side-clearance, --dsh-composer-card-max-width), so regardless of column width changes, sidebar collapse, or width adjustments, the context strip always remains left-aligned with the input box without requiring DOM measurement.

Clicking the context strip opens the context panel in the right sidebar; if the sidebar is collapsed, it will be expanded first before opening the panel.

Context Panel

The panel header displays the window occupancy ratio and a 20×5 dot grid (each dot representing 1% of the window), color-coded by category. Below are several collapsible sections, collapsed by default. The sections include:

  • Tools: Displays tool definitions, tool calls (with arguments), tool results, and tool tree statistics. Tool tree statistics break down tool size into three parts: definitions (catalog), calls (arguments), and results, and show their proportion in the window. Tool tree statistics are further grouped by MCP server, plugin, and skill, with each group/server/tool showing call counts and result entry counts.
  • Messages: Distinguishes between your prompts, assistant replies, and reasoning traces, each showing token counts and window proportion.
  • Skill Catalog: Parses the skill list from the system prompt, displaying each skill’s proportion of the total system prompt size.
  • Compression History: Lists compression events in reverse chronological order, including compression count, associated turn, date and time (without year), size and entry count of the replaced history, and size after compression. Compression history is read from the session log, so even if the session window has removed some history, compression records remain visible upon reopening.
  • System Prompt: Displays the system prompt’s description, size, and text content. If the current window still retains this prompt, the in-window version is loaded; otherwise, the latest recorded version from the session log is loaded; if none exists in the log, a copy saved by the panel for this session is loaded.
  • Attached Notifications: Groups system notifications attached during the session (such as MCP instruction updates, mode notifications), showing block counts and window proportion for each group.
  • Session Token Usage: Displays total input, uncached input, cache reads, cache writes, and output, with each part’s proportion of total input. Also displays the previous turn’s prompt cache hit rate and session-level cache hit rate, accompanied by progress bars.
  • Context Growth: Shows a line chart (sparkline) depicting the prompt size change for each request in the session (from old to new), along with request number and turn number. Below is a scrollable list showing each request’s number, progress bar, and token count. Requests where compression or history was trimmed are marked as “drop” in the list.

Data Sources and Calculation Methods

The context pressure (contextPressure), context breakdown (contextBreakdown), and token usage (tokenUsage) in the panel are sourced from @deepseek-ai/dsh-token-meter. The tool catalog and prompt text are provided by useTrajectory() upon window load; compression requests are also read within the window. Session events (session/events) are read backward through the client’s Remote page to access persisted logs, used to supplement compression history outside the window, separate system prompts from attached notifications, retain the tool catalog from the latest request header, and measure text lengths after message segmentation. Tool call and result attribution is determined by the same log scan, populating the total column in tool tree statistics. The latest turn’s provider usage sample comes from the log, while the session cache hit rate comes from tokenUsage. Each request’s prompt size is saved as the context growth sequence. The panel continuously monitors compression rows within the window; if a compression not found in the scan is detected, the log is read again to ensure the latest compression is visible.

For history outside the window, the plugin reads logs backward through the Remote page, so reopening long sessions still allows displaying compression history and system prompt separation. For initial loads or session restoration, the plugin employs an exponential backoff retry mechanism to ensure no blank data is displayed due to missing data before Remote or the session log is ready.

Installation

The plugin is integrated via DSH’s bundle mechanism. Reference the bundle in the host configuration, and the dsh process loads and runs it. Before installation, check the repository source code and license (MIT) to confirm compatibility with your use case.

Use Cases

This plugin is suitable for developers who need fine-grained monitoring of context window usage, analysis of tool and skill occupancy, and tracking of compression history and cache hit rates. It helps identify context growth bottlenecks in long conversations or tool-intensive sessions, and optimize prompt structure and tool call strategies. The plugin runs with the current DSH process permissions, involves no additional network requests or model calls, and can therefore be used safely in local sessions.

Conclusion

japr26/dsh-context-detail transforms DeepSeek Harness’s context management from opaque statistics into a visualized, collapsible tree detail view through the context strip and context panel, making it easy to understand window occupancy, tool call chains, compression history, and cache usage at runtime. For developers focused on context pressure and optimizing agent behavior, this plugin provides an intuitive way to view data.

Catalog Page
GitHub

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

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

Xiaoye