In the development workflow of DeepSeek Harness (DSH), model context is often a black box: system prompts, historical messages, tool results, and runtime-injected content are mixed together, making it difficult for developers to inspect or precisely modify them individually. The dsh-ctm plugin turns this context into a first-class object that is visible, editable, and scored for validity, addressing this pain point.
What It Is¶
dsh-ctm (Context Transparency Manager) is a DeepSeek Harness plugin maintained by developer ac0033. It is built with pure TypeScript and Zod, communicates with the DSH main process through a loosely coupled HTTP protocol, and provides full context visibility, MECE token accounting, real-time editing, and validity scoring.
Core Features¶
-
Global visibility and segmented stream view
The plugin provides a flow view from Turn to Segment. Content is color-coded by role, token count, cache status, and validity score, with Markdown rendering and pagination support. You can clearly see the position and state of each segment within the context stream. -
MECE token accounting
The KPI strip uses MECE (Mutually Exclusive, Collectively Exhaustive) bucketing to aggregate tokens, including uncached input, cache hits, and output. The data is drawn preferentially from provider-measuredtokenUsage, falling back to full-log folding when projections are unavailable. The view displays the cache hit rate and shows cumulative or single-step data in Turn and Step headings. -
Real-time refresh
The editor is based on reactive subscriptions. New messages, tool results, and turn boundaries trigger immediate updates without polling. -
Editability
Supports replacing, deleting, rolling back, recovering from snapshots, and undoing changes to the initial system prompt. It also supports manually overriding the validity score of content. Note that, except for the initial system prompt, system-injected content, tool results, and CTM placeholder markers are read-only in the UI. -
Validity scoring engine
Built-in automatic scoring engine that classifies content as “valid,” “redundant,” “stale,” or “injected” based on 2-gram similarity (LRU cache, 500-entry limit), and allows developers to manually override the verdict. -
Real Application
When “Real Application” is enabled, replace, delete, or rollback operations are no longer just UI-level previews; they are written to the session log through theagent/pre-stepflow, enabling interception and modification of the context. Tool call and result pairs are not split, and delete operations automatically balance the minimum scope of tool calls.
Installation and Activation¶
Obtain it from the DSH ecosystem catalog or the GitHub repository. After installation, register it in the DSH interface to use it.
Typical Usage¶
-
Test system prompt variants
In the Context tab, replace the initial system prompt and observe how the model behaves under different instructions or constraints, without restarting the session. -
Intercept and modify context
Enable the “Real Application” toggle to intercept and modify the context before it is logged, ensuring that the context ultimately sent to the model meets expectations. -
View performance metrics
View the KPI strip in the Context tab to monitor cache hit rate and token usage, helping you optimize context length.
Use Cases and Notes¶
- Note: Segment-level token counts are heuristic estimates and are for reference only.
- Note: System-injected content is read-only in the UI.
- Note: Tool call/result pairs are not split.
- Note: Undo only works for the most recent operation.
- Note: The plugin runs with the permissions of the current DSH process. Please review the source code and license before installing.
Short Conclusion¶
dsh-ctm provides a closed context management loop from “seeing” to “editing” to “scoring,” suitable for DSH users who need fine-grained debugging of context flow or optimization of prompt effects. For more details, see the plugin catalog or the GitHub repository.