deepseekv41flash/dsh-context-truth ↗★ 2

dsh-context-truth

DeepSeek Harness plugin: tells the model its real, host-measured context occupancy every turn — and keeps compaction summaries from carrying false "context is nearly exhausted" claims. 适合需要精确控制上下文、防止模型产生虚假耗尽声明的用户。

Package
dsh-context-truth
Compatibility
Unverified
Version
0.2.0
License
MIT
Last updated
Oct 12, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:deepseekv41flash/dsh-context-truth

配置(全部可选)

键默认说明
enabledtrue总开关(只关第 1 个能力)
languageenen / zh 文案语言
order100在 runtime-context 里的排序(沙箱 110、审批 115,所以在最前)
quantumPercent5显示台阶(窗口百分比),决定重发频率
paceEstimatetrue是否把余量换算成本会话节奏(tight/critical 档)
paceSamples16节奏取中位数的样本数(近 N 步增量)
paceMinSamples3少于此样本数不显示估算
paceMargin0.25向上换档需超出该档的比例(防抖,且不会卡死)
thresholdRatio0.8与 dsh-compaction-basic 对齐
headroomTokens65536同上
reservedCompletionTokensnull默认读路由请求自身的 maxTokens
moderateAt / tightAt0.5 / 0.85分档边界(相对自动压缩点)
hysteresis0.05降档迟滞
tightAdvicenonetight 档收尾句:none 不加(默认);inform 陈述后果;stop 用 0.1.3 的命令式
authoritativetrue是否附加"本行是唯一权威"那句
staleClaimClausetrue是否在 calm 档声明旧说法作废
foldClausetrue是否在 tight/critical 档定义"折叠是什么"
freeClausetrue是否报告"窗口还剩多少未使用"
logBandChangestrue分档变化时写一条 ctx.logger.info
patchCompactionPrompttrue是否给压缩指令补规则
compactionRules见上规则数组;[] 关闭本能力
foldAtIdlefalse是否启用第 3 个能力(空闲边界折叠)
foldAtIdleMarginPercent5余量 ≤ 窗口的百分之几时触发(1M 窗口 = 50K)
foldAtIdleMethodauto折叠请求通道:auto=先走该会话的 /compact(realm 视图)再回退到服务候选链;command/service 强制其一。service 是最可预测的一档(本 profile 用它)
foldAtIdleCooldownMs60000两次尝试之间的最小间隔(失败也不会反复撞引擎)

配置写在 profile patch 里(subagent 的 maxDepth、bash-terminal 的 defaultShell 都是这样生效的):

- id: context-truth            # 与 bundle patch 里的行 id 相同
  name: dsh-context-truth
  config:
    foldAtIdle: true
    foldAtIdleMarginPercent: 5

改动立即生效:宿主的 volatile 机制把新值直接写进运行中的配置引用(loader._commitVolatile), 不重载插件;插件因此每次使用时才解析选项,而不是挂载时快照。实测:改完 patch 无需重启,运行中的 foldAtIdle 立刻变成 true。

⚠️ 这个 DSH 版本没有"按 schema 自动生成插件设置表单"的机制。 官方插件(subagent、 bash-terminal/shell、agent-loop、web-search)的设置界面都是各自客户端包手写的卡片 (按条目 id 注册进 plugins.item 插槽),通用的 plugins.row.config 插槽全应用无人注册。 插件导出 Schemastery Config 会让宿主注册这个命名空间(实测 ns=context-truth、applies=live), 但没有任何 UI 会渲染第三方插件的通用表单——所以开关落在 profile patch 里。

想要一个真正的设置页面开关,就得给插件写一个客户端卡片包(照 @deepseek-ai/dsh-client-ui-settings-subagent 的样子:注册 plugins.item 插槽 + 一个绑定 settings 表单的 z.boolean() 控件)。宿主不会自动生成它。

enabled(总开关)用插件列表里的开关即可——那一个会重载插件。