ChatGPTClaudeGrok / X / CursorGemini

dsh-context-truth: A DSH plugin that backfills real context occupancy for DeepSeek Harness

deepseekv41flash/dsh-context-truth

Memory & ContextVerified
Listed on 2026-10-03
Page last updated 2026-10-31

Feeds host-measured context occupancy back to DeepSeek Harness each turn and stops false "context nearly exhausted" claims from being inherited by compaction summaries.

dsh-context-truth is a DSH plugin that writes the host's measured token usage back to the model every turn, so the model no longer guesses context pressure from conversation length. It also cuts the propagation chain of that misjudgment: rules are appended to the end of the compaction summarization instruction, forbidding any record of the model's own guesses about remaining context and of plans to stop or hand off work justified only by context pressure. All readings come from real host numbers, the same source as the Web UI context ring, with zero dependencies, zero tools, zero UI and no build step, needing no manual action once enabled.

How to Install

install
npmdsh plugin --profile web add dsh-context-truth
Category
Memory & Context
Platform
DSH Plugin
Author
deepseekv41flash
Distribution
Plugin

dsh-context-truth Key Features

Host-measured occupancy each turnFour-tier headroom phrasingCompaction prompt guard rulesReadings match the Web UI context ring
Listed on dsh-plugin.org

dsh-context-truth Repo Summary

What Does It Do?

Context Truth is a DSH plugin for DeepSeek Harness that writes the host's measured context occupancy back to the model on every turn and stops false "context is nearly exhausted" claims from being carried forward by compaction summaries. It solves the problem that DSH never tells the model its token usage, so the model guesses from conversation length and may declare the window nearly full at only 17% real occupancy. Maintained by deepseekv41flash under the MIT license, it has zero dependencies, zero tools, zero UI and needs no build step.

Core Features

  • Host-measured occupancy backfill: every turn renders a dynamic runtime-context line with used tokens, window size, the automatic compaction point and remaining headroom, declaring that line the only authority on context pressure and forbidding estimates from conversation length.
  • Four-band tone: readings fall into ample, moderate, tight and critical bands scaled to the automatic compaction threshold, with 5% hysteresis on downgrades; the ample band additionally declares all earlier "context is nearly full" statements, including those inside compaction checkpoints, void.
  • Compaction instruction patch: through the public llm/stream waterfall it appends two rules to the end of the summarization instruction, telling the summary never to record the model's own guesses about remaining context and never to record plans to stop or hand off work justified only by context pressure, touching only the tail and leaving the cached prefix intact.
  • Mis-patch guard: compaction calls are recognized by the caller's purpose marker, falling back to requiring the last message to start with the instruction, so tool results that merely quote the engine, log excerpts or grep hits are never rewritten.
  • Real host numbers only: used tokens come from the host's pricing of the next request, the window from the session request context, and the fallback from the provider-reported prompt-side usage, the same source as the Web UI context ring.

How to Use This Plugin?

After enabling it in DSH no manual action is needed: both capabilities are on by default, so the model receives a measured occupancy line each turn and compaction summaries automatically get the anti-error rules appended. The wording language can be switched between English and Chinese, and the master switch only turns off the occupancy backfill. Band boundaries, display quantum, compaction threshold and headroom reservation are all configurable, with defaults aligned to dsh-compaction-basic; band changes can optionally be logged. Because runtime-context snapshots are not resent while their bytes stay unchanged, readings are quantized to display steps, changing roughly fifty times over a full cycle with each occupancy line costing about a hundred tokens.

How to Troubleshoot This Plugin?

If a compaction summary still contains the model's own guesses about remaining context, first check whether the compaction call carries the purpose marker; when a deployment omits it the plugin falls back to requiring the last message to start with the instruction, so an unusual instruction format may be missed. If the occupancy line shows a stepped value such as "under 50K" instead of an exact number, that is the expected quantization by display step, and lowering the quantum refreshes it more often. If readings look wrong, verify the fallback source is available; that projection shares its origin with the Web UI context ring, so the two should agree.

This page is an independent rewrite of the plugin's official README — for authoritative documentation and the latest changes, refer to the source: deepseekv41flash/dsh-context-truth. The plugin is third-party code that runs on your machine once installed; inclusion does not imply endorsement — please review the source before installing.

Install, update, and uninstall this plugin in the Plugin Market of DeepSeek Harness's DSH Plugin Hub
ChatGPTClaudeGrok / X / CursorGemini

DSH Plugin FAQ