CooperZhuang/dsh-context-window0

dsh-context-window

DSH 插件:Codex 风格的上下文管理,包含 Token 预算提示、面向模型的 new_context 工具及交接重置。

AI 分析

核心用途是提供 Codex 风格的上下文窗口管理与 Token 消耗提示,支持通过 new_context 工具进行上下文重置。适合需要精细控制 Token 预算和上下文长度的复杂长对话任务。

包名
dsh-context-window
版本
0.0.1
许可证
MIT
最近更新
2026年9月9日

安装

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

配置

在挂载行或 profile 的 cordis.patch.yml 里写:

- id: context-window
  name: 'dsh-context-window'
  config:
    enabled: true
    resetMode: seam-region
    noticeThresholds: [25, 50, 75]
    effectiveContextWindowPercent: 95
    autoCompactTokenLimitRatio: 0.9
    fallbackBufferTokens: 8000
    reminderThresholdTokens: 16000
    bodyAfterPrefix: true
    toolEnabled: true
    toolName: new_context
字段默认说明
enabledfalse总开关;关闭时插件不注册任何东西
resetMode'seam-region'seam-region = 委托 compactRegion 替换整面;handoff = 未实现
noticeEnabledtrue是否注入窗口提示
noticeThresholds[25, 50, 75]消耗百分比阈值,每个窗口每档只发一次
effectiveContextWindowPercent95可用窗口占比(对齐 Codex)
autoCompactTokenLimitRatio0.9configuredLimit 的硬钳制(对齐 Codex)
configuredLimit未设显式 token 上限,受上一行钳制
fallbackBufferTokens8000阈值下为下一轮输出预留的空间
reminderThresholdTokens16000剩余降到此值时发一次换窗预告
resetReminderTemplateCodex 同款文案必须含 {n_remaining}
bodyAfterPrefixtrue只对窗口基线之上的增长计费
toolEnabled / toolNametrue / new_context模型可见的换窗工具

配置在加载时失败即报错:比例越界、resetMode 未知、模板缺占位符都会拒绝插件加载。