DSH Plugins Marketplace

DSH Plugins

Plugins

/

dsh-prompt-slim

w

dsh-prompt-slim

Discovered

DSH plugin: shrink the tool-definition block sent on every request (~39% fewer tokens) without changing tool behaviour

prompt-slim

压缩「每一步都重发给模型的工具定义」——不改工具行为,只砍说明文字。

DSH 在每次请求前把当前可见的 80+ 个工具(名称、描述、完整 JSON Schema)整体发给模型,实测约 65 KB。其中大部分是散文式描述,参数结构只占小头。prompt-slim 在 system-prompt/assemble 阶段重写这份工具块:

  • 保留:工具名、参数名、type / enum / const / required / items / oneOf 等一切会改变模型填参行为的字段,顺序不变。
  • 裁剪:每个描述只留开头的完整句子(在句号、分号处断开),参数描述各自限量;多余空白压成单空格。
  • 可逆:原始描述始终在注册表里,prompt_slim_help 可按名字随时取回完整定义。

效果(本机 81 个生效工具实测)

配置工具块节省
原始65492 B(≈18.2k tokens)—
保守档 200 / 6043651 B(≈12.1k tokens)33.3%
默认档 160 / 40 + workflow: 120039812 B(≈11.1k tokens)39.2%
120 / 3037072 B(≈10.3k tokens)43.4%
100 / 2034752 B(≈9.7k tokens)46.9%
60 / 0(丢弃参数描述)30000 B54.2%
0 / 0(只留名字和结构)26130 B60.1%

默认档砍掉的几乎都是示例、重复叮嘱和长尾细节:工具的第一句(它做什么、关键约束)和参数的短说明都还在,所以模型仍然知道每个工具干什么、必填什么。160 / 40 之后每往下一档,省下的 token 边际收益变小、误用风险变大;再狠就用 100 / 20,并且配合 prompt_slim_help 让模型按需查全文。

配置

写在 profile 的 cordis.patch.yml:

- insert:
    - id: prompt-slim
      name: dsh-prompt-slim
      config:
        toolDescriptionMax: 160      # 每个工具描述保留的字符数,0 = 全删
        parameterDescriptionMax: 40  # 每个参数描述保留的字符数
        keepTools: []                # 原样透传的工具名
        overrides:                   # 按工具单独放宽
          workflow: 1200
        minTools: 6                  # 可见工具少于这个数就不动
        helpTool: true               # 注册 prompt_slim_help
        logSavings: true             # 节省比例变化时写一条宿主日志
        mode: terse                  # off = 完全关掉

workflow 单独放宽,是因为它的描述本身就是脚本 API 文档(agent() / pipeline() / parallel() / phase()),压到 160 字符会丢掉用法。

安装

  1. 取到本目录,链进 profile:

    git clone https://github.com/wsxuyue/dsh-prompt-slim ~/dsh-prompt-slim
    ln -s ~/dsh-prompt-slim ~/.dsh/profiles/web/node_modules/dsh-prompt-slim
    
  2. 在 ~/.dsh/profiles/web/cordis.patch.yml 末尾加上面那段 insert。

  3. 依赖解析:本目录 node_modules/@deepseek-ai/* 是指向 DSH 安装目录 .pnpm 的符号链接(和 dsh-mobile-shizuku 的做法一致),换机器时重新指向即可。

改动 cordis.patch.yml 会被 loader 热加载,不需要重启 dsh web。

卸载

删掉 cordis.patch.yml 里的 prompt-slim 段即可;工具定义立刻恢复全量,无需重启。

设计取舍

  • 不做「延迟加载」网关:deferLoading 只对 Anthropic 有效,openai-compatible 适配器不看这个字段;用 tool_call 代理转发又会把工具调用渲染成嵌套 JSON、丢掉参数校验。压缩文本则是跨 provider 都成立的省法。
  • 固定点:压缩对自身输出幂等(已验证),同一份工具集每次产出完全相同的字节,不会因为描述抖动而破坏上游 prompt cache。
  • 失败即放行:重写包在 try/catch 里,插件自身出错时原样返回组装结果,绝不让一个提示词优化拖垮一次对话。

自测

node test/measure.mjs test/tools-captured.json   # 结构保真 + 节省比例
node test/plugin.test.mjs                        # 注册、重写、幂等、取回原文

Comments

Loading…

Similar plugins

prompt-optimizer-plugin

by naitoupi

DeepSeek Harness (DSH) plugin: ? optimize the composer draft with the current model. Installable bundle (dsh.bundle + dsh.client); Settings tab: on/off switch, generation params, editable system promp

Development & InfrastructureTerminal & ClientsSessions & MessagesManifest valid

★ 0

MIT

JavaScript

Sep 21, 2026

dsh plugin --profile web add prompt-optimizer-plugin

by dsh-plugin-db

Cut model-facing tokens out of tool output before it enters a request. A global DeepSeek Harness plugin: lossless normalization, annotated repetition collapse, and recoverable structure-aware trimming

Manifest valid

★ 0

JavaScript

Oct 16, 2026

dsh plugin --profile web add dsh-context-diet

DeepSeek Harness plugin that trims tool output (head/tail plus grep folding), adds optional prompt shaping (Caveman and Ponytail), instant local responses, RTK command-output compaction, context-press

Tools & CapabilitiesManifest valid

★ 1

MIT

TypeScript

dsh plugin --profile web add dsh-token-saver

by CECILIALOVE0616

DSH 提示词工作台:优化、多轮迭代、多模型对比测试 | Prompt Studio plugin for DeepSeek Harness — optimize, iterate, compare prompts

Terminal & ClientsManifest valid

★ 0

MIT

JavaScript

Oct 15, 2026

dsh plugin --profile web add dsh-prompt-studio

by lizhi00001

将简短或模糊的指令改写为结构化 Prompt

Sessions & MessagesManifest valid

★ 0

MIT

TypeScript

Aug 24, 2026

dsh plugin --profile web add dsh-tools-plugins

by vibe-any

A DeepSeek Harness (dsh) dynamic plugin that cuts token cost without cutting model intelligence

Models & ProvidersManifest valid

★ 36

↓ 1.2k/wk

MIT

JavaScript

Oct 24, 2026

dsh plugin --profile web add dsh-plugin-save-token