Introduction¶
During session development in DeepSeek Harness (DSH), context window boundaries and actual token costs are often unclear. Developers need an intuitive context overview and cost estimates to make decisions before compression or retry. The dsh-context-governor plugin provides a session-level context chip that displays prompt size, cache hit rate, and cost multiplier in real time.
Plugin Positioning¶
dsh-context-governor is a DeepSeek Harness plugin that acts as a session context indicator. It does not generate content; it only reads DSH projection data, calculates key session metrics, and displays them.
Core Features¶
The plugin provides the following data displays:
-
Cost and Size
- Prompt size (uncached input + cached tokens) and estimated cost per step (USD).
- Cost multiplier relative to the base rate (fresh input = 1.0, cache reads = cacheReadRate/freshRate).
-
Caching and Performance
- Total session cache hit percentage (partial hits are not rounded up to 100%).
- Cold input per step (fresh tokens in the last request).
-
Context Pressure and Rates
- Pressure indicator (0 = normal, 1 = warning, 2 = high, 3 = critical).
- Compression threshold (calculated based on the model window).
- DeepSeek balance (numeric value only).
- Peak/off-peak rates and a countdown to rate switching.
Installation and Activation¶
Install via the package manager:
dsh plugin --profile web add dsh-context-governor
Local development or source installation:
dsh plugin --profile web add github:mpinaev/dsh-context-governor
Version Support¶
The plugin has specific DSH version requirements:
0.1.7-rc.2…<0.2.00.2.0-rc.1…<0.3.0
DSH automatically disables plugins that are not compatible with the current runtime version.
Technical Implementation and Limitations¶
- No token consumption: The plugin does not send generation requests to the model and does not spend any tokens. It only reads token usage data from
ctx.sessionProjections. - Data sources:
- Token data comes from the
tokenUsageprojection (uncachedInputTokens,cacheReadTokens, etc.). - Context window and pressure come from the
contextPressureprojection.
- Token data comes from the
- Immutability: The plugin does not modify history, system prompts, or prefix caches.
- Network usage: The network is used only to fetch the DeepSeek balance.
- Price display: Prices are displayed only when the plugin has rate data configured for the provider (DeepSeek is supported by default).
Notes¶
- Cost information is displayed only when the plugin has rate data; price-related data may not be displayed for other providers.
- This is a client-side plugin and requires
dsh webto be running and the plugin to be loaded.
Summary¶
dsh-context-governor provides DSH users with a tool to monitor session context and costs without invoking the model. It shows key metrics through arithmetic calculations, helping developers manage context pressure and budget.