DeepSeek Harness plugin

dsh-better-chat-history

更好的聊天记录加载 —— DeepSeek Harness 会话 I/O 优化插件:读路径缓存(inspect/readFrom/list)消除切换会话时的 JSONL 全量冷读,投影缓存写合并减少磁盘写放大,延长 SSD 寿命。零依赖。

Jump to install

Source facts

Repository
echo-xianyu/dsh-better-chat-history
Latest update
Aug 14, 2026
Category
Memory
GitHub stars
2
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/echo-xianyu/dsh-better-chat-history
Plugin: dsh-better-chat-history
Author: echo-xianyu

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

⚡ dsh-better-chat-history

!License !Version !DSH !Dependencies

更好的聊天记录加载 —— DeepSeek Harness(dsh)会话 I/O 优化插件:消除多 Agent 切换会话时的 JSONL 全量冷读,合并投影缓存写放大,延长 SSD 寿命。

零依赖,纯 JS ESM,不修改 DSH 本体——通过包装既有服务实例方法 + patch 配置覆盖生效,静默运行。

✨ 特性

  • 读路径三级缓存

- inspect:LRU(默认 64 槽,TTL 60s)+ 并发去重(同 id 同时请求只读一次盘); - readFrom:缓存命中时直接内存截取,零磁盘 IO; - list:5s TTL 缓存,避免每次打开 GUI / 刷新都全盘扫描所有会话 header;

  • 会话预热器 —— web 启动后后台把最近活跃的会话(默认 24 个)预先 inspect 进缓存,让“初次点击”也命中缓存而不是全量冷读——解决首次打开卡顿的关键;
  • 精确失效 —— 监听 session/event / session/created / session/disposed,会话日志一旦变化立即弃对应缓存:最多返回陈旧视图,绝不产生错误数据;
  • 写合并 —— 对 fail-soft 的投影缓存做合并落盘(多次 put/delete 在合并窗口内只落盘一次),fsync 频率降低约 10 倍;workspace.json 等权威数据合并,保持原语义。

📦 安装

方式 A(推荐):Release tarball 安装

dsh plugin --profile <profile> add ./dsh-better-chat-history-0.1.0.tgz

包内 cordis.patch.yml 自动成为 bundle 层(含配置覆盖与插件挂载),重启后生效。

方式 B:手动挂载(零依赖,无需 pnpm)

1. 把本包放入目标 profile 的 node_modules\dsh-better-chat-history\(即 lib\index.js + cordis.patch.yml + package.json,零依赖无需 install); 2. 在 profile 的 package.json dependencies 加 "dsh-better-chat-history": "file:<本包路径>"; 3. 在 profile 的 cordis.patch.yml 末尾追加:

# 更好的聊天记录加载
- id: session-persistence-jsonl
  config:
    root: !!js dshHomePath('sessions')
    preparedSessionCacheSize: 64
    writeBatchMaxDelayMs: 2000

- id: session-projection-cache
  config:
    writeEveryEvents: 500
    writeIntervalMs: 15000

- insert:
    - id: io-optimizer
      name: 'dsh-better-chat-history'

4. 重启 dsh web(或 dsh --profile <profile>)。插件静默运行:正常时不输出任何日志(仅 error 级),生效与否看行为——切换 / 初次打开会话明显变快。

> 需要 dsh ≥ 0.1.0-rc.6。Release 资产见页面右侧 Releases

✅ 验证

dsh --profile web --dump-config
# 应看到 session-persistence-jsonl 行带 preparedSessionCacheSize: 64 / writeBatchMaxDelayMs: 2000,以及 io-optimizer 行

行为验证:重启后首次点开最近跑过的会话应接近秒开(预热命中);反复切换会话应无等待(读缓存命中)。

⚙️ 配置项

profile patch 中给 io-optimizer 行加 config 覆盖:

默认说明
inspectCacheSize64冷读 LRU 槽数
inspectCacheTtlMs60000冷读缓存 TTL
listCacheTtlMs5000会话列表缓存 TTL
coalesceUnits["session_projcache"]参与写合并的 storage 单元名
coalesceMs1500写合并窗口
warmSessions24启动后预热的最近会话数(0 关闭)
warmDelayMs10000预热开始延迟(避开启动高峰)
warmIntervalMs600每两个会话预热之间的间隔(普通批次)
warmFastCount5优先快速预热的前 N 个会话
warmFastIntervalMs150优先批次的预热间隔

🛡️ 语义安全

  • 只读路径缓存 + 事件失效:最多返回陈旧视图,绝不产生错误数据;
  • 写合并仅作用于 fail-soft 单元,权威数据原样直写;
  • 崩溃丢失窗口:最近 ~2s 的日志事件、合并窗口内的投影缓存更新——均符合原设计语义;
  • 插件可在 HMR / 重载时恢复原始方法(ctx.effect disposer + 防重复包装标志)。

🤖 AIGC 声明

本项目部分代码与文档由 AI 辅助生成,并经过人工审查与测试。项目按 MIT 许可证开源,仅供学习与参考;使用者请自行评估代码的安全性与合规性。

🔗 相关插件

📄 许可证

[MIT](./LICENSE) © 2026 dsh-better-chat-history contributors