Tranquillitatis-Lab/dsh-live-compact
AI EngineeringA DSH plugin that compacts finished conversation turns in place while preserving the prefix cache.
What it does
A long agentic session accumulates tool output, logs and command results until the context window becomes the bottleneck. Live Compact is a DSH plugin that inspects each finished turn and shortens selected long outputs locally, without another model request. It replaces only a chosen span and leaves everything before the cut point untouched. Before cutting, the original text is written to a local shadow backup; if the backup fails, the turn is left as-is. The default minimum context before it starts looking for candidates is 20,000 tokens.
It is aimed at people running DSH sessions with cloud APIs such as DeepSeek or GLM, as well as local or intranet models. Provider detection distinguishes cloud from local: baseURL in the config wins, then official DeepSeek and the built-in catalog; public addresses count as cloud, loopback and private addresses as local. SPINE_ENGINE=cloud|local forces the choice.
Quick start
Install into each profile you use. Headless and web each need a separate install:
dsh plugin --profile headless add dsh-live-compact@1.1.4
dsh plugin --profile web add dsh-live-compact@1.1.4
To check the package version first:
npm install -g dsh-live-compact
dsh-live-compact --version
If npm is unreachable, the README also documents a mirror tarball install, including npm install -g --force of the same 1.1.4 tarball installation section. After installing, run a long task. A spine cut …ms line in the log confirms that a cut actually happened. Cumulative statistics are available via dsh-live-compact stats.
Configuration
Small-cut settings are exposed in the DSH plugin settings and can also be set through environment variables. Precedence is explicit config > valid environment variable > default. Key knobs include SPINE_MIN_TOKENS (default 20000, when the plugin starts looking), SPINE_KEEP_ROUNDS (default 3 ended tool rounds kept verbatim), SPINE_CHUNK_MIN (1000), SPINE_POINTER_TOKENS (default SPINE_CHUNK_MAX, 32000) and SPINE_SHADOW_DIR (default ~/.dsh/compaction-spine/shadow, or under DSH_HOME). The official large compaction parameters (SPINE_THRESHOLD_RATIO 0.8, SPINE_HEADROOM_TOKENS 65536, SPINE_RETAIN_TOKENS 8192) are separate and read at engine construction or preset load, so changes there require rebuilding the engine or session environment variables.
SPINE_THUNDER is an experimental model-summary mode and is off by default; it is not recommended for local models.
The cordis.patch.yml block is a static whole-block replacement and does not read those three environment variables, so headroomTokens must be edited directly in the block.
Constraints
Requires DSH >=0.2.0-rc.2 <0.3.0 installation. The DSH-TUI preset cannot be swapped to this plugin, so it is not supported there. Desktop is a separate profile; dsh plugin --profile desktop is rejected.
Cut text is backed up locally, capped at 256MB by default (SPINE_SHADOW_MAX_BYTES / SPINE_SHADOW_MAX_MB); when the limit approaches, the oldest backups are deleted first, and if no space can be freed the cut is skipped. On Unix the directory is 0700 and files are 0600. On Windows, backups are protected with a DACL allowing the current user, SYSTEM and Administrators; the write path uses a fixed System32 powershell.exe, and failures stop backup for the process rather than falling back to chmod. The single-process estimation shortcut requires a dedicated SPINE_SHADOW_DIR plus SPINE_SHADOW_SINGLE_PROCESS=1; default and shared directories scan every rotation.
Without a qualifying summary, the whole span is kept rather than sending a model request. Cards use spine-checkpoint; a cut stops when it reaches an existing card so the cached prefix is not rewritten. A single tool result over 32,000 tokens is reduced to a pointer. MIT licensed.
HotRepo's take
The repository appeared on the new-project board for JavaScript on 2026-11-10, recording 49 stars and 3 forks over roughly 24 hours against 200 stars in total. The hourly sampling between 2026-11-06 15:45 UTC and 2026-11-10 09:45 UTC shows a mostly flat stretch near 112–135 stars before a rapid climb from 161 to 200 in the final hours. That single board entry supports only the fact of that day's gain, not a longer trend.
The README spends most of its space on version-by-version engineering notes and reproducible benchmark descriptions, including the 31-turn long-log tests, the 150 short coding tasks and the 20-task long-chain comparison benchmark notes. Readers should treat the reported savings and cache figures as the author's test conditions, and reproduce them with npm run test:gate or the live-fill suite rather than assuming identical results.
Written by AI from the project's README, updated . The project's own docs are the source of truth.
You might also like
- csyangwen/dsh-memory-evolveA DeepSeek Harness plugin adding cross-session memory, self-evolving skills, multi-agent orchestration and external agent dispatch.
- huaguoxingkong/dsh-prompt-rewriterRewrites a draft prompt in place inside DeepSeek Harness, adding goal, format and limits without sending it.
- PC2005-cloud/dsh-petA transparent animated desktop pet that lives in DeepSeek Harness, with an AI-driven pipeline for generating your own pet assets.
- kingcharleslzy-ai/dsh-purgeA community fork of a DeepSeek Harness plugin that tunes how the coding agent responds, with self-checks and local backup rollback.
- SAOS-3624/dsh-see-nowA DSH plugin that turns screen, camera, or video input into change-filtered multi-frame contact sheets for vision models.