dsh-token-diet
DSH token-saving toolkit: proactively slim large text/JSON/CSV before they enter context (diet_text / diet_json / diet_csv / diet_estimate). Configurable compression presets (light/balanced/aggressive) + per-field overrides via settings. Zero-dependency pure functions.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:WODE25500/dsh-token-diet说明文档
阅读完整 README ↗压缩比例配置(settings)
插件注册 settings 命名空间 token-diet,在 Web UI 设置面板或 settings 文件中调整:
三档预设(preset,一键切换)
| 档位 | 适用场景 | headChars | maxKeys | maxSample | 压缩强度 |
|---|---|---|---|---|---|
light | 需要细节的任务(代码评审、精确引用) | 2000 | 25 | 6 | 轻 |
balanced(默认) | 大多数任务,骨架完整且 token 明显减少 | 800 | 12 | 3 | 中 |
aggressive | 极端省 token(长会话、批量处理) | 300 | 6 | 2 | 强 |
逐项覆盖(可选,覆盖档位默认值)
headChars / tailChars / maxKeywords / maxKeys / maxSample / maxDepth / maxSampleRows / maxColStats
## 使用示例
diet_estimate text: "" → {"chars":102400,"tokens":25600,"verdict":"必须瘦身"} diet_csv csv: "" → 列统计 + 5 行抽样 + 建议 diet_json json: "" → 结构骨架 + 抽样 diet_text text: "" → 头 800 字 + 尾 300 字 + 高频词