Back to directory

dsh-context-compression-improved

In a curated listMaintenance: Active

drscrewdriver/dsh-context-compression-improved

Improved fork of dsh-context-compression-selector with an orthogonal code-skeleton compression gate

View on GitHub
$ dsh plugin --profile web add dsh-context-compression-improved@latest

11

stars

1

forks

TypeScript

Language

MIT

License

2026-09-05

Created

2026-11-20

Last push

MIT-licensed DeepSeek Harness context-compression plugin — an improved fork of dsh-context-compression-selector adding an off-by-default code-skeleton gate, selectable compression profiles and auditable token-savings stats, installed through `dsh plugin add`.

DSH integration

Native runtime

Author-claimed

Safety audit

Unaudited

Last verified

2026-11-15

License

MIT

01What can it help you accomplish?

  • Keep a long-running DeepSeek Harness session inside its context budget by compressing the tool output it keeps accumulating

    Shorter tool-result context produced by selectable, auditable profiles (Fresh / Aggregate / History micro-compact / TailTrim / Native), plus a recorded decision log with stage, reducer, trigger, skip reason and exact token counts

    DSH users running long multi-turn coding tasks where tool output grows until the context window gives out

  • Reduce the first oversized source-code tool result to an imports-and-declarations skeleton instead of raw head pruning

    A skeleton that keeps imports and type / function / class declarations, elides function bodies with a marker, and preserves error lines inside elided bodies

    Teams that read large source files through `read_file`-style tool calls and fill the context window with a single result

02How to install into DeepSeek Harness

Prerequisites

  • Node `^22.19.0 || >=24` and pnpm `11.7.0` (the README states these requirements)
  • A DeepSeek Harness rc release from the generated supported-hosts block — 21 rc releases across lines 0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1
  • DeepSeek models only — lossless measurement and lossy compression depend on the bundled official DeepSeek tokenizers

Installation steps

  1. 01

    Install from npm into the target Harness profile: `dsh plugin --profile web add dsh-context-compression-improved@latest` (the README recommendation — one version covers every supported Harness line)

    $ dsh plugin --profile web add dsh-context-compression-improved@latest

  2. 02

    Print the profile config with `dsh --profile web --dump-config`

    $ dsh --profile web --dump-config

  3. 03

    Source alternative: `git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git`, then `pnpm install --frozen-lockfile` and `pnpm build`, then pack the selector package and add it to a Harness profile

    $ git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git

  4. 04

    In the selector settings section choose a compression profile, set the Auto Compact trigger level, and toggle code-skeleton compression (`codeSkeleton: { enabled: false }` is the shipped default)

Verify the integration

  • After installing, run `dsh --profile web --dump-config` (the README's post-install command) and check that the dumped profile config lists `dsh-context-compression-improved`
  • The settings toggle saves on change and shows the saved state on reload
  • Work through the verification walkthrough in the repository installation guide: `docs/installation.md` (the README points to its verification and uninstall steps)

Rollback

  • Uninstall steps are documented in the repository installation guide (`docs/installation.md` covers verification and uninstall)
  • Delete `~/.dsh/storages/dsh-context-compression/stats.sqlite` to reset the persisted stats completely

03DSH integration and capability boundaries

DSH integrationNative runtime

DeepSeek Harness plugin installed into a dsh profile with `dsh plugin --profile web add …`; it uses only public plugin and profile APIs and does not modify Harness core code

  • Code-skeleton compression gate

    an oversized fresh source-code tool result (for example a large `read_file`)→a skeleton of imports and type / function / class declarations, function bodies elided with a marker, error lines inside elided bodies preserved

    off by default — `codeSkeleton: { enabled: false }` until you turn it onfalls back to the original head pruning when the skeleton cannot be produced or verified
  • Compression profiles

    fresh and accumulated tool-result context→pre-compressed fresh segments, re-compressed aggregates, replaced old history results, optional TailTrim and the Harness-style Native trimming

  • Auditable decision log

    every compression decision the plugin makes→stage, reducer, trigger, skip reason and exact token counts where available

  • Compression monitor panel and `/ccip` command

    a running compression session→net/gross savings, offsets, context usage, cache-hit rate and cost estimate next to the context trend chart

    `/ccip` can resume or disable compression per session (`session <id|latest|off>`)
  • SQLite savings stats

    compression decisions and request boundaries→stock, cumulative and money-saved figures that survive host restarts, with historical sessions backfilled from on-disk records

    writes `~/.dsh/storages/dsh-context-compression/stats.sqlite`; a missing driver or write failure degrades to an in-memory fallbackrecords only counts, sequence numbers, session identifiers and enum component names — never original or free-form text

04Who is it for? When not to use it?

Good for

  • DSH users running long multi-turn coding tasks where tool output grows until the context window gives out
  • Teams that read large source files through `read_file`-style tool calls and fill the context window with a single result

Not for

  • The plugin supports DeepSeek models only: lossless measurement and lossy compression depend on the bundled official DeepSeek tokenizers (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Everything else fails open and keeps the original tool results.
  • The code-skeleton gate is measurement-gated: it requires the exact DeepSeek tokenizer, and without it the plugin fails open instead of compressing.
  • Settings are session-frozen: like all selector settings, changes affect newly observed sessions only, so the running session keeps its previous configuration.
  • `codeSkeleton` must be exactly `{ enabled: boolean }`; malformed values throw on the runtime side and show as unreadable in the browser UI.
  • The README recommends a custom OpenAI-compatible `/v1/responses` endpoint over the official-account Messages API route, because that route's resume-replay 400s cannot be repaired from the plugin side.

05Compatibility, maintenance and safety notes

  • The plugin supports DeepSeek models only: lossless measurement and lossy compression depend on the bundled official DeepSeek tokenizers (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Everything else fails open and keeps the original tool results.
  • The code-skeleton gate is measurement-gated: it requires the exact DeepSeek tokenizer, and without it the plugin fails open instead of compressing.
  • Settings are session-frozen: like all selector settings, changes affect newly observed sessions only, so the running session keeps its previous configuration.
  • `codeSkeleton` must be exactly `{ enabled: boolean }`; malformed values throw on the runtime side and show as unreadable in the browser UI.
  • The README recommends a custom OpenAI-compatible `/v1/responses` endpoint over the official-account Messages API route, because that route's resume-replay 400s cannot be repaired from the plugin side.
  • Node `^22.19.0 || >=24` and pnpm `11.7.0` are required for the source build and development workflow.
  • Unofficial community fork of WilliamShi666/dsh-context-compression-selector, not affiliated with or endorsed by DeepSeek; the upstream copyright notice is retained under MIT.
2026-09-052026-11-10v0.11.2

MIT · latest release v0.11.2 (2026-11-14T17:14:44Z)

06Frequently asked questions

Does enabling the code-skeleton gate change the compression profile I picked?

No. It is orthogonal and independent of the selected profile (`balanced`, `savings`, `cache-strict`, `adaptive`, `custom`, `off`, `native`) — all profiles get the gate. It is off by default, so nothing changes until you set `codeSkeleton.enabled` to true.

Does it work on models other than DeepSeek?

No. The project supports DeepSeek models only: lossless measurement and lossy compression depend on the bundled official DeepSeek tokenizers, and everything else fails open and keeps the original tool results.

Can the skeleton make my context worse than plain pruning?

The README says no: if the skeleton cannot be produced or verified, the result falls back to the original head pruning — the gate can never make context worse.

Do settings changes apply to the session I am running right now?

No. Like all selector settings the gate is session-frozen: changes affect newly observed sessions only.

Where do the token-savings stats live, and what do they store?

In SQLite at `~/.dsh/storages/dsh-context-compression/stats.sqlite`, across host restarts; deleting that file resets the stats completely. Records hold counts, sequence numbers, session identifiers and enum component names only — original and free-form text never enter the database.

08Data and sources

  • Author-claimedgithub.com82703d80c522…

    The plugin uses only public Harness extension APIs and does not modify Harness core code.

  • Author-claimedgithub.com82703d80c522…

    - Built and tested against the official DeepSeek Harness releases; peers declare the full supported-hosts enum

This page is generated from the project’s public documentation, repository metadata and a structured parse of DSH Plugins; last verified on 2026-11-15. Found an error? Submit a correction.

🏆

Best DeepSeek Harness Plugins

Twelve plugins worth installing first — picked from the whole catalog, across every category.

DSH Plugins is an independent community directory of DeepSeek Harness plugins. Not affiliated with or endorsed by DeepSeek. Third-party plugins are not security-audited — review the source before installing.

New DeepSeek Harness plugins, weekly. No spam.