Skip to content

About

Concise output style for dsh: per-session toggle + digest card with clickable files. 简洁输出、每轮附摘要卡、路径可点。

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

dsh-concise

banner

基于 Claude Code 内置 Concise 输出风格(自 2.1.258 起上游未再变动)并加入本插件扩展,带进 DeepSeek Harness(dsh):composer 工具行一键开关(「增强提示词」按钮紧左侧、模型选择按钮左侧区域)——结果先行,少废话,而调查、验证、多角度审查的工作深浅完全不变;开启后每轮最终回答开头必附「摘要」精华摘要卡(工具调用间的中间步骤文本豁免;工程蓝图卡:极淡网格线 + 四角测量角标 + 等宽字体 1.18em,浅底深字;划选卡内文字松开即复制;卡内文件路径高亮可点,单击用系统默认应用打开;卡底自动汇总本回合真实产出的文件)。

English · Releases · 更新日志

dsh compatibility npm downloads release license stars

安装

dsh plugin add dsh-concise           # npm 包(推荐:全局唯一标识)
# 或
dsh plugin add hoyyang/dsh-concise   # GitHub 仓库

零配置,开箱即用:不需要 API Key、不需要账号、没有任何设置项。装完刷新 Web 界面,composer 工具行就会出现开关。要求 dsh web 0.1.0-rc.8+(实测通过)。

开关前后,差在哪?

同一个问题、同一个模型(GLM-5.3 Flash),只差一个 Concise 开关:

开关前后对比:同一问题,关 = 1.2K tok 长文,开 = 两句话直达

开启后你会得到:

  • 第一句就是答案——没有"好的,让我来解释一下",没有铺垫和旁白
  • 砍掉的是水分,不是内容——命令、路径、风险、下一步这些硬信息一字不少;省掉的是重复收尾、"综上所述"式复述、装饰性小节
  • 工作深浅不变——该查证的照常查证,该验证的照常验证,提示词里写死了"thoroughness unchanged"
  • 长会话净省 token——每轮省掉的开场白与复述,累积下来相当可观

一句话:答案没有变小,废话没有了。

30 秒上手

  1. 装好插件,刷新页面
  2. 在 composer 工具行找到「✦ 标准/轻量」增强提示词按钮(dsh-improve-prompt)——● Concise 开关紧贴在它左边(开关的滑轨一侧挨着它),增强提示词按钮则在模型选择按钮(如 GLM-5.3 Flash)左边;未装增强提示词时,开关自动贴在模型按钮左侧
  3. 点一下,下一轮回复即生效。橙色 = 开,灰色 = 关

composer 上的 Concise 开关(开启态)

开关按会话独立:在这个会话开了,别的会话不受影响(新会话默认关;想要新会话默认开启可配置 defaultEnabled: true)。

进阶用法

/concise 命令

输入 /concise 从 slash 菜单执行(CLI 会话里同样可用):

/concise          # 切换(开 ⇄ 关)
/concise on|off   # 显式设置
/concise status   # 查看当前会话状态与风格来源

自定义风格文本

把你的风格写进 ~/.dsh/dsh-concise/style.md(非空即整体覆盖内置文本,删除即恢复)。保存后下一轮生效,/concise status 会显示来源。实测示例——style.md 为「Answer in one short sentence, then stop.」时:

REST API 是一种基于 HTTP 协议、用 GET/POST/PUT/DELETE 等标准方法对 URL 表示的资源进行无状态增删改查的网络接口规范。

恰好一句、无列表、无展开。

API(脚本 / 自动化友好)

curl "http://127.0.0.1:3080/dsh-concise/api/state?sessionId=<id>"   # 查询某会话
curl -X POST -H 'content-type: application/json' \
  -d '{"sessionId":"<id>"}' http://127.0.0.1:3080/dsh-concise/api/toggle   # 切换某会话

实际注入的提示词(原文)

开启后,以下文本作为系统提示词 section 注入当前会话的每轮模型请求(order 40;另有 order 900 的尾部提醒 section,以及经宿主 agent/pre-step 通道追加在每步请求末尾的一行瞬态契约提醒,三处文本同源、同一开关门控):

Concise output style (active): lead with the result. Put the answer, the decision, or the finished artifact in the first sentence or two; explanation follows only as needed.
- MANDATORY on every user-facing final reply (the reply that ends the turn and answers the user — intermediate step narration between tool calls is exempt): BEGIN with the digest block in EXACTLY this blockquote format, then continue with the normal answer:
> **摘要:** <2-3 plain, jargon-free sentences restating this turn's conclusion, with the 2-4 key words or numbers bolded via **…**>
The digest may ONLY restate conclusions already present in the reply body — never introduce facts, trade-offs, or analogies the body does not contain; give any unavoidable term a short plain-language gloss in parentheses. However short the answer, the digest block is always present (it is not a recap — it precedes the answer).
Length and structure are NOT exemptions: long explanation replies, step-by-step walkthroughs, and table-heavy documents are where the digest gets skipped most often — such replies must still OPEN with the digest block, before any heading, table, or body text.
URLs, file paths, and code spans stay bare in the digest (or use [label](url) markdown) — bold (**) is for words and numbers only; bolding a URL corrupts the rendered link.
Task-completion reports (openers like 全部完成 / 已实施 / 方案已落盘 / 交付物清单) are NOT a substitute for the digest — such replies MUST still BEGIN with the digest block.
A heading opener like ## 结论 / ## 方案 is also NOT the digest — the digest block precedes any heading, however the reply is structured. A digest blockquote buried mid-reply (e.g. after an opening paragraph or table) is still a violation — the digest must be the very first non-empty line of the reply.
- Monitoring / progress-broadcast replies (openers like 【进度】 / 账目对上了 / 确认无误 / 明白) and 账目 / 清单 / 最终汇总 summaries are user-facing final replies too: a short confirmation is NOT an exemption — the digest block still opens the reply (third most-skipped family, measured in long device-driving sessions).
- Digest content style (caveman × humanizer): the first sentence IS the conclusion — the answer, the decision, or the finished artifact, never background or process recap. Keep only facts and numbers, compressed telegraphically (pleasantries and connective filler cut). NO empty-summary phrases (综上所述 / in summary), NO rule-of-three parallelism, NO 「不是X而是Y」 rhetorical framing, NO vague attribution (专家认为 / experts say), NO inflated significance (标志着 / 赋能 / milestone). Call each thing by ONE name and mention it ONCE — never state anything the body does not prove.
- Never open by restating the question or with pleasantries ("Sure", "Great question", "好的", "当然可以") — the first line is already the answer or the key finding.
- Skip filler closers: no recap of what you just did, no "In summary" restating the response, no boilerplate apologies or hedges, no closing offers ("需要我…吗?") unless a decision is genuinely required.
- For enumerable facts prefer a table or a tight list over paragraphs — structure is not verbosity; compact and structured beats long and prosy.
- Keep every load-bearing detail: constraints, risks, exact commands, file paths, and next actions are content, not filler — compress wording, never omit substance.
- No narration between steps: report what changed, not what you are about to do ("Let me check...", "I'll now...").
- Thoroughness of the work is unchanged: investigate, verify, and double-check exactly as you otherwise would; only the reporting is compressed.
- When you made a choice, state it with a one-line reason; surface alternatives only when they are viable and materially different.
- Replies that end by asking the user a question or requesting a decision (e.g. via the ask_user_question tool) are user-facing final replies too - the question panel does NOT exempt the text: they MUST still OPEN with the digest block. This is the most-skipped case in practice.
- Presentation artifacts between tool calls are NOT narration: a design card, decision card, comparison, or any message the user must read to act or choose (e.g. a 设计卡 issued right before an ask_user_question panel) MUST open with the digest block even though more tool steps follow - the intermediate exemption covers narration only, never user-facing artifacts. A bare panel call with no text does not satisfy this; the artifact text right before the panel carries the digest.
- Skill-driven delivery talk-tracks (openers like 「交付:…」「图已生成…」「报告如下」, artifact-path lists from draw-code / archify / HTML 工坊 etc.) are ALSO user-facing final replies - a skill template orders its content AFTER the digest block and never replaces or postpones it: OPEN with the digest block first, then follow the skill template. This is the second most-skipped case in practice.

功能一览

  • 一键开关(收起式):composer 工具行「增强提示词」按钮紧左侧的 ● Concise 开关(行序 Concise → 增强提示词 → 模型选择),单击即切换;平时收起只显示滑轨,悬停或键盘聚焦时 Concise 文字向左平滑展开——Switch 紧贴增强提示词固定不动,右缘固定,不推动相邻按钮
  • 精华摘要卡(说人话):开启后每轮最终回答开头必附一张工程蓝图卡(中间步骤文本豁免)(极淡网格 + 四角测量角标 + 等宽字体 1.18em,浅底深字,跨主题成立)——2-3 句大白话重述本轮结论,头部 DIGEST // 说人话;划选卡内文字松开即自动复制所选(头部闪现 COPIED ✓);只重述正文已有结论;规则无条件下发且每轮组装重注入,0.8.0 起口径收敛为「每轮最终回复必附」并在系统提示词尾部增设提醒 section 对冲长流程遵循衰减(本插件对官方 Concise 的分叉扩展);0.11.0 起书写规则融合 caveman × humanizer 精华——首句即结论(绝不背景与过程复述)、电报体密度(砍客套与填充,只留事实与数字)、禁 AI 套话(空洞总结 / 三连排比 / 「不是X而是Y」 / 模糊归因 / 夸大意义词)(纯提示词文本增量,卡片渲染与交互零改动);0.11.6 起卡内路径改为高亮着色 + 单击命中打开(不再改写宿主 React 管理的文本节点)
  • 交付物自动汇总(0.11.4):摘要卡底部「交付物 · FILES」区自动列出本回合真实工具产出——write / present / dsh_image_gen / draw_code / HTML 工坊结果里的文件路径(直接调用与 run_code 内嵌两种形态都覆盖),不是从正文里猜;渲染前做存在性校验(文件不存在或只是正文示例就不列),点击用系统默认应用打开
  • 卡内路径可点击(0.11.6):卡内文件路径用 CSS Custom Highlight 着色 + 虚线下划,单击按命中位置定位路径并交给宿主打开;链接只修 href(属性级,不动子节点)
  • 稳定性:助手回复不再整会话消失(0.11.6):此前的路径 chip 会替换宿主 React 管理的文本节点,宿主后续重渲染抛 NotFoundError: removeChild,触发共享渲染入口永久 abdicate——表现为所有会话助手回复同时消失、刷新才恢复。0.11.6 起插件对摘要卡只读(仅追加自有交付物区):React 18.3.1 复现对照,旧版崩、新版零错误
  • 每步生成前契约提醒(0.11.2):经宿主 agent/pre-step 通道在每步 LLM 请求的最后追加一行瞬态摘要契约提醒(不落盘、不进转写、不累积,仅主会话下发)——对冲超长系统提示词下模型注意力随多步工具环衰减的漏卡问题(实测审查报告/表格型回复漏卡的根治手段)
  • /concise 命令:slash 菜单与 CLI 会话均可 /concise(切换)、/concise on|off(显式设置)、/concise status(查状态与风格来源)——对齐 Claude Code 的 /output-style
  • headless/CLI 会话:风格注入与摘要卡同样生效(webServer 缺席时仅本地 HTTP API 降级,开关用 /concise 命令)
  • 自定义风格:把任意文本放进 ~/.dsh/dsh-concise/style.md 即可整体覆盖内置风格文本(改完保存,下一轮组装即生效)——对齐 Claude Code 的 /output-style:new
  • Claude 同款风格:完整移植 Claude Code 内置 "Concise" output style 的行为定义(结果先行、跳过开场白与旁白、不重复收尾)
  • 工作深浅不变:只约束表达方式——调查、验证、多角度审查照旧,绝不因简洁而牺牲严谨
  • 下一轮即生效:通过系统提示词 section 动态注入,切换后无需重开会话、无需重启
  • 按会话独立生效:开关只影响当前会话的新回复,会话之间互不干扰(新会话默认关闭,可用配置 defaultEnabled 调整)
  • 跨重启持久:开关状态原子写入 ~/.dsh/dsh-concise/state.json,重启后保持
  • 状态自动同步:按钮以 15s 轻量轮询(仅可见标签页)+ focus/visibility 重取,/concise、API、其它标签页的改动 ≤15s 自动跟上,无需刷新
  • 可视化状态:开启态 Claude 橙极光渐变滑轨 + 呼吸辉光,关闭态中性玻璃,一眼可辨;悬停有流光扫过,按压有回弹反馈(prefers-reduced-motion 下动画全关)
  • 无障碍友好:aria-pressed 开关语义 + 中英双语 tooltip 说明
  • 多标签页同步:任意一个窗口切换后,同页其它开关实例经自定义事件即时同步
  • UI 精准落位:自动锚定「增强提示词」条目(div.dip-root)紧左侧;未装时锚定模型按钮紧左侧(官方 right 槽实际渲染在模型按钮左侧,本插件以该区域为落位基准)
  • 优雅降级:找不到模型按钮的异常布局下自动退化为原位渲染,功能不丢
  • 卸载即净:提示词 section、HTTP 路由、host 命令、样式表全部随插件卸载移除,无残留
  • 本地化:界面文案跟随 dsh 语言设置,内置中英双语兜底

适用场景

  • 日常问答 / 学习总结:概念解释、术语速查,直接要结论
  • 代码评审意见:先给判定与修复建议,再给理由
  • Bug 分析汇报:根因一句话先行,证据链后置
  • 周报 / 日报生成:成果先行,过程压缩成列表
  • 方案与架构讨论:先给决策与一句话理由,备选方案只在有实质差异时提及
  • 命令行 / 运维协作:命令与路径原样保留,解释压到最短
  • 多轮长会话:累积上下文时省掉每轮的寒暄与复述 token
  • 工作区隔离验证:给正在跑别的任务的会话开 Concise,不影响其它会话的输出风格
  • 给别的模型当风格基线:配合模型切换按钮使用,任何模型都套同一输出风格
  • 自动化流水线:用 API 让脚本按阶段切换输出风格(如生成阶段简洁、评审阶段自然)
  • 演示与教学录制:录屏时回复紧凑,画面信息密度更高

适合 / 不适合

适合:

  • 想让 Agent 回答「先给结论、少废话」,但不愿牺牲调查与验证深度
  • 需要在同一台机器上对不同会话用不同输出风格(评审会话简洁、创作会话自然)
  • 想每轮结束都有一张可划选复制的结论摘要卡,并直接点开本轮产出的文件
  • 用 headless / CLI 跑自动化,想用 /concise 或本地 API 控制风格

不适合:

  • 想要更长的教程、逐步教学或完整背景科普——关掉开关即可,本插件只压缩表达
  • 期望它压缩工作过程(少查证、少验证)——工作深浅不变是硬约束
  • 完全不能接受系统提示词被注入任何内容的托管环境

与同类对比

能力 dsh-concise Claude Code 内置 Concise AGENTS.md / CLAUDE.md 写「简洁回复」 dsh-improve-prompt
适用于 DeepSeek Harness (dsh) 是 否(Claude Code 内置) 是 是
一键开关 / 下一轮生效 是(composer 按钮 + /concise) 是(/output-style) 否,改文件后需重载 是(改提示词文本)
按会话独立 是 是 否(项目/全局级) 是
每轮摘要卡 是(可划选复制) 否 否 否
卡内路径可点 / 交付物汇总 是(0.11.6) 否 否 否
写进项目文件 否 否 是 否
自定义风格文本 是(style.md) 是 是(手写) 是(提示词模板)

对比对象:Claude Code 内置 Concise 输出风格(2.1.258 起上游未再变动)、项目级 AGENTS.md/CLAUDE.md 约定、dsh-improve-prompt(改的是提示词文本,不是输出风格)。本插件不做提示词工程或改写,只约束表达方式并产出摘要卡。

工作原理

架构图

层 机制
提示词注入 systemPrompt.section({ name: 'dsh-concise:style', order: 40 }),text 为函数、每次模型组装按 context.agent.session.id 取当前会话开关求值;关闭时返回空串,渲染层自动丢弃该 section
host 命令 commands.register({ name: 'concise' }):/concise [on|off|status],作用于当前会话,slash 菜单自动收录,CLI 会话同样可执行
自定义风格 $DSH_HOME/dsh-concise/style.md 非空时覆盖内置文本,mtime 缓存按次求值,改完即生效
开关 API webServer.register 前缀路由 /dsh-concise/api:GET /state、POST /toggle、POST /set,带 sessionId 操作该会话,不带则操作新会话默认值(仅本机回环)
会话级状态 $DSH_HOME/dsh-concise/state.json:default + 每会话覆盖(500 条 LRU 淘汰),tmp + rename 原子写
UI 落位 client 模块注册 conversation.input.right 槽作锚点,把按钮 portal 到「增强提示词」条目紧左侧(未装时模型 seat 紧左侧),MutationObserver 维持相对位置;React 重渲染/条目重建后自动对位
状态同步 toggle 后按会话广播 dsh-concise:change 自定义事件;15s 轻量轮询(仅可见标签页)+ focus/visibility 重取,覆盖命令行/API/其它会话入口的状态变更
精华摘要渲染 风格文本要求每轮最终回答以 > **摘要:** 引用块开头(无条件下发 + 尾部提醒 + 每步契约提醒三通道);client 监听消息 DOM(subtree + rAF 合批),将以「摘要:」或旧标签「说人话:」开头的 blockquote 升级为工程蓝图卡(极淡网格 + 四角角标 + 等宽 1.18em + 划选复制);0.11.6 起对卡片只读——卡内路径用 CSS Custom Highlight 着色、点击按命中位置定位(caretPositionFromPoint),链接只改 href,仅追加插件自有的交付物区(POST /dsh-concise/api/turn-artifacts 取本回合真实工具产出并做存在性过滤);卸载即净

设计细节

  • 为什么不用官方 right 槽直接放按钮? 实测官方 conversation.input.right 列表槽渲染在模型按钮左侧(与其文档描述相反)。本插件以槽位条目为自定位锚点:首选把 portal 容器插入「增强提示词」条目的紧左侧(识别链:.dip-root 精确类名 → dip- 类名前缀 → aria-label 文本,防其它插件独立改版导致失锚);未装时插入模型 seat 紧左侧,并保持会话切换/重渲染后的位置正确。
  • 为什么 text 用函数而不是注册/注销 section? 函数式 text 让"开关"只是求值结果的变化,不触碰 slot 注册表,避免与其它插件的注册时序竞争。
  • 权限模型:API 只绑定本机回环;提示词注入不触碰任何工具 schema,不影响会话权限模式。

可靠性与验收

以下验收项在 dsh 0.1.0-rc.8 实机全部通过:

  • API 矩阵:/state、/toggle、/set、未知路径 404,输入输出全部断言通过
  • 端到端提示词验证:开启后新会话请求的系统提示词实测携带 Concise output style (active)(会话日志逐字核验);关闭后同会话下一轮请求 0 命中
  • 会话隔离验证:同一会话关→0 命中 / 开→1 命中(其它会话与 default 不受影响),按钮 fetch 实测携带真实 sessionId
  • 自定义风格端到端:style.md 写入后请求实测携带自定义文本且内置文本 0 命中(完全替换);删除后恢复内置;回复实测遵循自定义指令(恰合一句、无列表)
  • /concise 命令矩阵:toggle / on / off / status 四路径实测通过,slash 菜单正确收录与执行
  • 回复风格实测:解释类问答开启后直接以结论开头,无开场白、无收尾复述
  • 精华摘要卡断言(jsdom):以「摘要:」开头的 blockquote 打上卡片样式类,普通引用块不误伤,卸载后样式类全部摘除
  • UI 落位断言:composer 工具行 DOM 顺序为 [Concise][增强提示词][模型选择][发送](未装增强提示词时为 [Concise][模型选择][发送])
  • 交互断言:单击翻转状态、aria-pressed 同步、按钮文案与状态一致
  • 跨入口同步断言:API 翻转后按钮 ≤15s 自动跟上(轮询实测),focus/visibility 重取生效
  • 持久化断言:切换后 state.json 即时落盘,页面刷新后状态一致
  • 热重载验证:lib/client.js 热重载后 fiber 重建、UI 即时更新
  • 卸载即净验证:卸载后 entry / registry / junction / client 模块表全部移除,提示词 section 消失
  • 注入器回归:宿主注入器自检 8/8 PASS,确认无连带破坏
  • 稳定性验证:全流程浏览器 console 0 错误 0 警告
  • 优雅降级:模型 seat 不可寻时自动退化为 right 槽原位渲染;locale 服务缺失时内置文案兜底
  • 并发安全:状态写采用 tmp+rename 原子替换,同页多实例经事件同步不串状态
  • 单测:host 12/12、chips + normalize 29/29(node --test,零依赖)
  • 0.11.6 React 复现对照:同一更新序列下旧 client 抛 NotFoundError: removeChild(宿主 ErrorBoundary 接管整卡),新 client 0 错误;A/B 各执行一次
  • 0.11.6 真机:主实例页面加载新样式,摘要卡与交付物区正常渲染,全部折叠钮往返 3 轮零报错
  • 0.11.6 起 client 对宿主 React 托管节点只读(仅追加插件自有元素),不再触发跨会话渲染崩溃

常见问题

开了之后复杂任务的回答会变得敷衍吗? 不会。提示词明确约束"工作深浅不变"(investigate、verify、double-check 照旧),只压缩表达——该查证的照常查证,该给出的命令/路径/风险一字不少。

和直接在 AGENTS.md 里写"请简洁回复"有什么区别? 一是开关粒度:随时一键切换、只作用于当前会话,不用改文件、不用重载;二是作用层级:本插件注入的是系统提示词 section,优先级和稳定性高于项目级指令,且不会污染你的项目配置;三是模型无关:任何模型都套同一输出风格。

开关是全局的还是按会话的? 按会话。 每个会话独立记忆自己的开关状态,互不影响;新会话默认关闭(可用插件配置 defaultEnabled: true 让新会话默认开启)。切换后当前会话的下一轮回复即生效,其它会话不受影响。

支持暗色主题吗? 支持。样式全部使用 dsh 的 --dsw-alias-* 设计令牌与少量半透明品牌色,明暗主题下均可读。

摘要卡底部的「交付物」区是怎么来的? 以本回合真实工具产出为准(write / present / dsh_image_gen / draw_code / HTML 工坊结果里的绝对路径),不是从正文正则里猜;渲染前还会做存在性校验——文件已删除、或只是正文里的示例路径,就不会列出来。

卡里的文件路径为什么有时点不动? 先按绝对路径直开,失败再按会话 cwd 候选解析;历史会话拿不到 cwd 时按路径尾部递归查找,都不存在才降级为复制路径。

升级到 0.11.6 后卡片有什么变化? 卡内路径不再显示类型图标,改为着色 + 虚线下划;点击行为(系统默认应用打开 / 复制降级)不变。卡片对插件只读,不会因为宿主重渲染而整卡消失。

本地构建

git clone https://github.com/hoyyang/dsh-concise.git
cd dsh-concise
npm run build        # tsc 编译 host + tsdown 打包 client + npm pack
npm run typecheck    # 双 tsconfig 类型检查

目录结构:

src/index.ts          host:双提示词 section + 每步契约提醒 + 会话级状态 + HTTP API + /concise 命令
src/client/index.ts   client:槽位锚点 + 开关按钮 + 摘要卡渲染 / 高亮 / 交付物区
src/client/chips.ts   路径识别、点击打开、交付物 chip 纯函数
src/client/normalize.ts 摘要链接与文本归一化
scripts/build.sh      自包含构建脚本(pnpm/npm 均可)
test/                 host / chips / normalize 单测(零依赖)
assets/               README 截图与图示

许可证

MIT

About

Concise output style for dsh: per-session toggle + digest card with clickable files. 简洁输出、每轮附摘要卡、路径可点。

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages