dongsheng123132/dsh-cache-stabilizer

针对DeepSeek Harness的缓存前缀稳定性与基于证据的缓存指标

项目介绍Project Overview

dsh-cache-stabilizer 是 MIT 许可的 DSH 插件,通过把默认 persona 中的工作目录移到运行时上下文快照,并规范化工具 schema 的对象键顺序,提升 DeepSeek 提示缓存前缀复用概率;另提供仅人工可用的 /cache 查看缓存读取、未缓存输入和缓存写入 token。适合多项目会话想稳定缓存命中时使用;它不伪造命中,也不处理自定义 persona 中的 cwd 表述,缓存仍由服务商按精确前缀控制。

dsh-cache-stabilizer is an MIT-licensed DSH plugin that improves provider prompt-cache reuse by moving the working directory out of the default persona sentence into the runtime-context snapshot and canonicalizing object-key order in tool schemas. It also adds the human-only /cache command to report cache-read, uncached-input, and cache-write tokens. Use it when working across projects and wanting stable cache prefixes. It does not fabricate hits; provider caching still depends on exact prefix matching.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add dsh-cache-stabilizer

dongsheng123132/dsh-cache-stabilizer 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-cache-stabilizer

CI MIT license Node.js 22+ Awesome DSH Plugins

An MIT-licensed DeepSeek Harness plugin that improves the chance of provider prompt-cache reuse without hiding stale state.

It makes two semantics-preserving changes:

  • Moves the working directory out of DSH's known default persona sentence and into the runtime-context snapshot. Different projects can then share the same system-prompt prefix while each request still receives the correct cwd.
  • Canonicalizes object-key order inside tool schemas. Tool order itself is already deterministic in DSH.

It also adds /cache, a human-only command that reports the provider's durable cacheReadTokens, uncached inputTokens, and cache-write tokens. It never invents a cache hit.

Install

dsh plugin --profile web add dsh-cache-stabilizer

Restart DSH, send a few messages, then enter /cache in a command-capable client.

For a custom profile, replace web with its profile name. To disable either optimization in a profile patch:

- id: dsh-cache-stabilizer
  config:
    relocateCwd: false
    canonicalizeTools: false

Safety boundary

Only the exact sentence used by DSH's standard/headless coding persona is relocated. A custom persona that mentions {{cwd}} in another form is left unchanged because blindly moving arbitrary prose can change meaning. The plugin does not freeze tool catalogs, reuse stale context, proxy model responses, or implement a second cache.

DeepSeek's provider cache is automatic and depends on an exact prefix match from token zero. Storage and eviction remain provider-controlled.

Development

npm test
npm run check
上一个 Prev dsh-satori 下一个 Next dsh-fschannel