Introduction¶
When performing long-range coding in DeepSeek Harness (DSH), sessions rarely fail abruptly. Instead, the context is compressed, details are folded, and the model starts repeatedly answering on the same skeleton, with quality only becoming “circular” after a period of cost accumulation. It is difficult to gauge “how much buffer remains” by intuition alone, nor is it easy to decide when to start a new session.
Below, I introduce the community plugin dsh-session-durability (maintainer yli42409-tech, category: Model Inference). It keeps a digital pill in the Composer dock, converting signals like context occupancy, compaction count, and intra-dialog repetition into a durability score of 5–100, and expands details upon clicking for easier viewing of wear trends in long sessions.
What is it¶
dsh-session-durability is a bundle plugin for DSH: it displays a composite score for the current session’s “usage level” in Composer, accompanied by panel information such as context occupancy, compression statistics, degeneracy rate, message and tool call counts.
Repository: https://github.com/yli42409-tech/dsh-session-durability
Community Directory: https://www.skillhub.cn/plugins/yli42409-tech/dsh-session-durability
Unlike “just looking at token counts” or discovering empty answers post-hoc, this plugin explicitly distinguishes four types of signals. Compression-related events come from session logs rather than the frontend-visible snapshots, so the implementation is divided into a Host half and a Client half.
Core Features¶
The Pill and Panel¶
After installation, a pill similar to the one below will always be visible in the Composer dock (example from README):
● 74 ← the pill, always visible in the composer dock
click it:
74 / 100 Good
██████████████░░░░░░
Context (after compaction) 52% · 520K
Compactions 3 (shed 180K)
Degeneracy 0.0%
assistant 210
Tool calls 260
Nodes 470
Healthy, keep going.
Level Text: Good ≥ 70, Tight 40–69, Replace < 40 (thresholds are calibrated values, not strictly derived).
Four Types of Wear Measured¶
The composite score is derived from three independent types of wear (history length also participates in the deduction), while compaction count is displayed but not penalized:
| Signal | Source | Function |
|---|---|---|
| Context occupancy | Host contextPressure projection |
True context window fill level; noticeable damage to score starts above ~70%. |
| Compaction count | Host durabilityCompaction projection |
Only counts actual summary generation compactions; used to show how many details have been folded, not to penalize the session. |
| Degeneracy | Dialog snapshot | Repetition within a single reasoning block; trailing concluding habits may account for a few percentage points, severe loops are recorded in the README’s failed sessions at around 22–24%. |
| History growth | Log maxSeq |
The “age” of the session at the log level, unrelated to the current loaded window. |
Host and Client Division of Labor¶
Compression events compaction/start, compaction/summary, compaction/prune, compaction/end are session log events and do not appear in dialog snapshots that clients can subscribe to. Therefore:
- Host (
index.js): Purely folds the logs to produce thedurabilityCompactionprojection; and reuses the existingcontextPressure(pressureTokens,contextWindow). - Client (
client.js): CallscomputeMetrics()viauseChat,useProjection('contextPressure'),useProjection('durabilityCompaction')to render the score, progress bar, and tooltip.
For unchanged sessions, the same state reference can be maintained during the fold to reduce Host-side overhead.
Score Formula (Adjustable Defaults)¶
score = 100 - contextPenalty - degeneracyPenalty - historyPenalty (clamped to 5..100)
contextPenalty = 0 below 70% occupancy, ramps to 70 points at a full window
degeneracyPenalty = 0 below 12% repetition, +5 per point above, capped at 60
historyPenalty = min(30, maxSeq / 300)
The compaction count is displayed on the panel but does not participate in the score deduction.
Compression Count and “Shed”¶
Implementation notes (from README and test coverage):
- Count successful compression via
compaction/summary, notcompaction/start(failed attempts show start + end errors without summary). - “Shed” refers to the volume replaced by the summary, not the prune tokens reported separately by
compaction/prune(the two can differ by several times).
Developers can use npm test (node --test test/fold.test.mjs) to verify the fold logic.
Localization and Tuning¶
DEFAULTS at the top of client.js are centrally adjustable: context fallback window, 70% soft start, 12% degeneracy floor, 300-seq history scale, recent nodes for degeneracy scan, etc.; refresh the page after changes.
Interface text is in the sibling STRINGS file; currently supports zh and en.
Installation and Usage¶
This plugin is a DSH bundle (containing cordis.patch.yml / dsh.bundle.patch), no runtime dependencies, no build required: client.js is loaded directly by the browser module loader. Version 0.1.0, License MIT.
Installation methods (please refer to official documentation, do not concatenate CLI commands based on the repo name):
- Install this directory in the Harness Plugins page; or
- Via the
install_bundleof theplugin_managertool, targeting this plugin directory.
After installation, the pill will appear in the Composer dock alongside other session indicators.
When installing the plugin on an already open session: Switch to another session and switch back. The Host only pushes when projections change; a new projection key needs to be re-seeded in the opened session store to appear (README notes this behavior applies to all new projection keys, not just this plugin).
Replacing a same-name installation via another path will report restart-required (reason package-moved), requiring a full app restart; the first installation has no such requirement.
Typical Usage¶
- Proceed with long coding conversations as normal, paying attention to the pill’s number and color semantics (Good / Tight / Replace) in the dock.
- Click the pill to view the Context occupancy percentage and token count, compaction count and shed volume, Degeneracy percentage, assistant / Tool calls / Nodes count, and the bottom health tip.
- When the score enters Tight or Replace, or Degeneracy continues to rise, consider starting a new session or proactively summarizing the context, rather than waiting for the answer to clearly spin its wheels.
- If team window sizes or language habits differ, make fine adjustments in
client.js’sDEFAULTS/STRINGSand reload.
Use Cases and Notes¶
Who is it for: Developers who frequently perform multi-round tool calls and long-context coding in the DSH Composer; those who need to observe session health before “continuing to pay”.
Permissions and Security: The plugin runs with the permissions of the current DSH process and can access session and projection data. Please read the repository source code and the MIT license before installing to ensure it meets your compliance requirements; the community directory site (SkillHub) is an independent ecosystem directory with no official affiliation with DeepSeek / Hypothesis.
Cognitive Boundaries (penalty table in README):
contextPenaltyindicates the window is indeed full; it does not directly equate to a decline in answer quality.degeneracyPenaltyindicates repetition within a block, a sign of detail loss; it does not mean the entire session has become unusable.historyPenaltyindicates the log is old and lengthy; it does not describe the content of the current loaded window.
Thresholds are derived from observable inflection points in long Chinese coding sessions and should be treated as starting points rather than hard scientific constants.
Conclusion¶
dsh-session-durability aggregates context pressure, compression history, and intra-dialog repetition into a visible score, filling the gap where “slowing down and going in circles” in long sessions is hard to quantify. If you are already using DSH for heavy Composer development, you can obtain the bundle via the community directory or GitHub, install it using the plugin manager’s install_bundle command, and use it directly in the dock.
- Directory Page: https://www.skillhub.cn/plugins/yli42409-tech/dsh-session-durability
- GitHub: https://github.com/yli42409-tech/dsh-session-durability