Preface¶
The extension philosophy of DeepSeek Harness (dsh) is “Everything is a plugin”. For dsh users who need to frequently open, refresh, and switch sessions, the inspect, readFrom, list in the chat history loading path, as well as the projection cache disk write, directly affect the user experience.
dsh-better-chat-history is a DSH session I/O optimization plugin that optimizes chat history loading via read path caching and write merging. It does not modify the DSH core and takes effect after being mounted as a plugin. Below is an introduction to its features, installation methods, and precautions.
What is this¶
dsh-better-chat-history is maintained by echo-xianyu, current version is 0.1.0, license is MIT.
Its positioning in one sentence is: DeepSeek Harness (dsh) session I/O optimization plugin, optimizing chat history loading via read path caching and write merging.
In terms of implementation:
- Zero dependencies, pure JS ESM;
- Does not modify the DSH core;
- Takes effect by wrapping existing service instance methods + patch configuration overrides;
- Requires dsh >= 0.1.0-rc.6.
Core Features¶
Read Path Caching¶
The plugin implements three levels of caching for the read path:
- inspect: LRU cache, default 64 slots, TTL 60s, with concurrency deduplication;
- readFrom: Memory slicing upon cache hit, zero disk IO;
- list: 5s TTL cache to avoid scanning all session headers on every GUI open / refresh.
Session Warmup¶
After web startup, the plugin pre-inspects recently active sessions into the cache in the background, defaulting to 24.
This reduces the probability of hitting the full read path again when opening these sessions later.
Precise Invalidation¶
The plugin listens to the following events:
session/event
session/created
session/disposed
Once session logs change, the corresponding cache is immediately invalidated. Semantically, it is read path caching + event invalidation: it returns stale views at most, never erroneous data.
Write Merging¶
The plugin merges and writes the fail-soft projection cache, reducing fsync frequency by about 10x.
It is worth noting that authoritative data like workspace.json are not merged, preserving the original semantics.
Installation & Enablement¶
Method 1: Using a Local Release tarball¶
First, put dsh-better-chat-history-0.1.0.tgz in the command execution directory, then execute:
dsh plugin --profile <profile> add ./dsh-better-chat-history-0.1.0.tgz
Restart the corresponding profile after installation.
Method 2: Manual Mounting¶
If you don’t want to install via a plugin package, you can also mount the plugin files directly into the target profile. First mount the files, then append the configuration, and finally restart dsh.
- Put this package into the target profile’s directory:
node_modules\dsh-better-chat-history\
The package should contain:
lib\index.js
cordis.patch.yml
package.json
Zero dependencies, no extra install needed.
- Add to the
dependenciesin the profile’spackage.json:
"dsh-better-chat-history": "file:<local-package-path>"
- Append the following configuration items to the end of the profile’s
cordis.patch.yml:
session-persistence-jsonl
session-projection-cache
io-optimizer
- Restart dsh:
dsh web
Or:
dsh --profile <profile>
Verification¶
Execute after restart:
dsh --profile web --dump-config
You should see the session-persistence-jsonl line with:
preparedSessionCacheSize: 64
writeBatchMaxDelayMs: 2000
You should also see the io-optimizer line.
The plugin runs silently: it outputs no logs under normal conditions, only error level.
Applicable Scenarios & Notes¶
Suitable for users using dsh profile / dsh web to manage multiple sessions and wish to reduce repeated disk reads when reading chat history and reduce disk write frequency when writing projection cache.
Pre-installation notes:
- The plugin runs with the current dsh process permissions; check the source code and license before installing;
- Requires dsh >= 0.1.0-rc.6;
- The semantics of read path caching + event invalidation are: returns stale views at most, never erroneous data;
- Write merging only applies to the fail-soft projection cache; authoritative data like workspace.json are not merged, preserving original semantics;
- Crash window loss: recent ~2s log events and projection cache updates within the merge window;
- Part of the project code and documentation were generated with AI assistance, reviewed and tested by humans; open-sourced under MIT license for learning and reference only; users should evaluate the safety and compliance of the code themselves.
Get¶
Community directory page (independent site, no official affiliation with DeepSeek / Hyperbolic):
https://www.skillhub.cn/plugins/echo-xianyu/dsh-better-chat-history
GitHub repository:
https://github.com/echo-xianyu/dsh-better-chat-history