dsh-compaction-fidelity: Adding a Context Compression Fidelity Layer for DSH Long Sessions

Introduction

When working with long sessions, large repositories, or multi-module projects in DeepSeek Harness (DSH), context limits are eventually reached, and the system utilizes compaction to compress history into summaries to continue operation. Official compaction ensures session continuity, but summaries are essentially “lossy indexes” rather than complete transcripts; precise values, Chinese phrasing, and architectural constraints are prone to loss after compression. While existing community plugins focus on thresholds and checkpoints—emphasizing “when to compact”—if you are more concerned about “how much is retained after compression,” “whether lost information can be retrieved,” or “whether project structure can be re-inspected,” you require a backend specifically designed for fidelity and retrospective inquiry.

Below is an introduction to the community plugin dsh-compaction-fidelity (maintainer: TLNing260310, SkillHub Category: Memory). It integrates with DSH as a Profile Bundle, performing deterministic fingerprinting and compensation before and after compression, and stores project architecture indexes in the workspace under .dsh/compaction-fidelity/ to facilitate post-compaction retrieval.

What is this?

dsh-compaction-fidelity is a bilingual compaction backend for the DSH 0.2.0-rc.2 runtime: it performs fidelity diagnostics (lexical fidelity metrics), compensation injection, and project architecture retrospective anchoring while generating summaries. The SkillHub and repository descriptions summarize it as “A fidelity layer for DSH context compaction: cross-lingual fidelity fingerprinting, project architecture retrospective anchors, and a 350K default compaction line,” released under the MIT license.

The current directory page lists version v0.3.1 (updated approximately one week ago), with 0 GitHub stars. The plugin has passed installability verification on SkillHub (installability: verified). The DSH ecosystem advocates for “everything is a plugin”; SkillHub is an independent community directory site with no official affiliation with DeepSeek or Hig AI. Installation sources should be based on the directory page and repository documentation.

Core Features

The following capabilities are derived from the repository README (synchronized via the SkillHub API) and categorized by responsibility.

Dynamic Compaction Line and Default 350K

The plugin provides presets such as 256K, 350K, 512K, and 800K (official default), and allows setting custom thresholds in the composer (documented as 256 < value < 800 (K), where K represents 1000 tokens, consistent with the DSH ContextMeter). The plugin’s default compaction line is 350K; on a 1M window, 800K is subject to the official 80% window line constraint. The maintainer notes that 350K is a personal comfort setting, and users can override it with valid custom values.

Cross-Lingual Fidelity Fingerprinting and Compensation

Before compression, it freezes precise values, Chinese bigrams, and structure; after compression, it compares the generated summary and outputs L0–L3 levels. Missing precise values are written to the fidelity_compensation block; metrics are written to .dsh/compaction-fidelity/fingerprints/. The language strategy defaults to auto to follow the session language; in en mode, model prose uses English, but user original text and precise values are preserved.

Project Architecture Index and Retrospective Anchors

A persistent (optionally Git-versioned) .dsh/compaction-fidelity/ index contains module graphs, architecture-level files, commands, schema/migration anchors, etc. After file changes, relevant architecture neighbors/docs/tests are written to anchors.md and injected in the next step. The tools compaction-fidelity-brief, compaction-fidelity-lookup, and commands /compaction-fidelity brief, lookup are used for structural retrospective inquiry after compaction.

Architecture Refresh and Scope Management

Architecture refresh gating inspired by AOCI concepts: supports status / refresh, scope registration, Git and content hash change detection, etc. Glob rules can be managed via architecture include|exclude, with configuration stored in architecture-scopes.json.

Runtime Master Switch and Backend Relations

Installing the bundle enables the full suite of capabilities; removing it restores the built-in DSH preset. Within a session, /compaction-fidelity on|off can be used to toggle. The README explicitly states: this package overrides summarize() within the BasicCompactionEngine subclass, making it a compaction backend with an observability layer rather than a passive observer; combinations that occupy the compaction service row simultaneously with dsh-compaction-pro etc. are not verified and should not be assumed safe.

Installation and Activation

Before installing, please review the GitHub Repository source code, cordis.patch.yml, and the MIT license. The plugin runs with current dsh process permissions, reading and writing to the workspace .dsh/compaction-fidelity/ and patching the compaction lines of built-in presets within the bundle.

The README states compatibility with DSH Desktop 2.0.17 (bundled runtime 0.2.0-rc.2) and recommends installing tag v0.3.1. Desktop side example:

dsh plugin --profile desktop add 'github:TLNing260310/dsh-compaction-fidelity#v0.3.1'
dsh plugin --profile desktop remove dsh-compaction-fidelity

If using the CLI Web profile, replace desktop with web. The web profile installation plan (fixed commit) provided by SkillHub for this plugin is:

dsh plugin --profile web add github:tlning260310/dsh-compaction-fidelity#b417924e5086d055139e5fd54d0607aa9afc1af2

After installation, restart DSH according to your profile (e.g., dsh --profile web) and confirm the plugin line is mounted without startup errors. The bundle injects dsh-compaction-fidelity/engine into preset-standard, preset-cordis, preset-ptc, preset-minimal, etc.; new sessions use the patched preset, while already running sessions retain the original composition tree.

Optional: The repository provides a manual CJK token metering patch script that modifies your local DSH installation. This is not automatically executed during bundle installation and is not necessary for loading the bundle; only consider using it after confirming compatibility with your current DSH version.

Typical Usage

View Status and Adjust Compaction Line

/compaction-fidelity status
/compaction-fidelity threshold 350k
/compaction-fidelity language auto

Initialize Index and Architecture Checks

/compaction-fidelity init
/compaction-fidelity reindex
/compaction-fidelity architecture status
/compaction-fidelity architecture check <scope>

Post-Compaction Retrospective Inquiry

/compaction-fidelity brief
/compaction-fidelity lookup <query>
/compaction-fidelity anchors <file>

Fidelity Calibration (Requires Sample Accumulation)

View calibration summaries or import verified samples from JSON within the workspace:

/compaction-fidelity calibration summary
/compaction-fidelity calibration import trusted-samples.json

Calibration levels can be produced after each language group accumulates 8 samples; mixed Chinese-English sessions use the mixed:<dominant> group to avoid polluting pure zh/en statistics.

Use Cases and Notes

Who it is for: Developers using DSH Desktop with long sessions, large or multi-module repositories, workflows primarily in Chinese or bilingual Chinese-English, and where tool calls cause rapid context expansion.

Usage Notes:

  1. Unlike plugins that only adjust thresholds/checkpoints, this plugin replaces the summarization backend; do not stack it with compaction backends that have not been verified to coexist.
  2. The global injection budget injectionMaxTokens defaults to 16000 (CJK-aware); when truncation is triggered, the prompt records <compaction_fidelity_injection_budget>.
  3. Known boundaries listed in the README include: the correlation between calibration and downstream QA has not been measured, anchor weights are still fixed values, etc.; it is recommended to observe fingerprinting and compensation behavior in small-scale sessions before production use.
  4. Before installation, verify that peer dependencies (such as @deepseek-ai/dsh@0.2.0-rc.2) match your local DSH version.

Conclusion

dsh-compaction-fidelity treats compaction summaries as lossy indexes, utilizing cross-lingual fingerprints, compensation blocks, and local text indexes to preserve precise facts and project architecture retrospective inspectability within long sessions; the default 350K compaction line can be adjusted in the composer according to documentation rules. For further information, please visit the SkillHub directory page and GitHub repository:

  • Directory Page: https://www.skillhub.cn/plugins/TLNing260310/dsh-compaction-fidelity
  • GitHub: https://github.com/TLNing260310/dsh-compaction-fidelity
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye