@mengyuly/dsh-ponytail 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,7 +4,65 @@ All notable changes to `@mengyuly/dsh-ponytail` are documented here.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
6
  ## Unreleased
7
+
8
+ ## [0.4.0] - 2026-10-08
9
+
10
+ ### Added
11
+
12
+ - Native Web settings card: default-mode selection, five optional-skill toggles,
13
+ atomic revision-fenced saves, panel-only reset, retained drafts on failure,
14
+ read-only guards, and Chinese/English help.
15
+ - Optional native `/ponytail` mode picker; status/reset/help run through the
16
+ existing command boundary without requesting a model turn.
17
+ - `/ponytail help` and detailed default-source status. DSH Settings persistence
18
+ is optional; legacy/headless deployments keep their config-file path.
19
+ - Browser interaction tests and downstream build/source hash provenance.
20
+
21
+ ### Fixed
22
+
23
+ - Normalize repository text line endings to LF so downstream SHA-256 build
24
+ provenance is reproducible across Windows and Linux checkouts.
25
+ - Mark bundled DSH host-contract peers as optional for package resolution,
26
+ retaining their version contracts and required host services. Plain npm/pnpm
27
+ installs now resolve only the two runtime externals instead of following the
28
+ host's transitive unpublished `dsh-type-meta` peer. Add clean pnpm 11 default
29
+ installation and runtime-load regression coverage.
30
+ - Restore the complete seven-rung ladder in every active prompt, mandatory
31
+ Lite alternatives, unnecessary-dependency and fewest-file guards, full-scope
32
+ acceptance without re-arguing, and upstream minimal-test limits. Full/Ultra
33
+ enforce the ladder; Lite leaves the scope choice to the user.
34
+ - Downstream builds now compile the instruction fragment from source, avoiding
35
+ stale rules in the installed bundle.
36
+ - Older DSH Web settings scopes now save through the host's atomic settings RPC,
37
+ preserving revision conflicts and surfacing write failures instead of calling
38
+ an unavailable `scope.mutate` method.
39
+ - Restore explicit upstream rules in every active level: all-caller root-cause
40
+ checks, same-size algorithm edge cases, shortcut ceiling/upgrade annotations,
41
+ hardware calibration, requested explanations, and coding-only scope.
42
+ - Debt scans now recognize block comments, keep source files under `lib`, and
43
+ exclude nested dependency/build output in both ripgrep and Git fallbacks.
44
+
45
+ ### Changed
46
+
47
+ - Review prompt budgets around required semantics instead of enforcing the old
48
+ compressed sizes. Update bilingual measurements without claiming model savings.
49
+ - Execute debt scan commands against controlled source/vendor/build fixtures;
50
+ verify exact installed/source prompt and skill parity in the pack smoke test.
51
+ These checks do not establish model compliance or performance.
7
52
 
53
+ ## [0.3.4] - 2026-10-07
54
+
55
+ ### Added
56
+
57
+ - English README and bilingual navigation (PR #1), included in the npm package.
58
+
59
+ ### Fixed
60
+
61
+ - Mode/default status notices now use non-waking injection instead of steering
62
+ an idle agent into an extra model turn (issue #2). Mode changes apply
63
+ immediately; notices reach the model on its next real step. Explicit
64
+ review/audit/debt/gain/help invocations still request an ordinary turn.
65
+
8
66
  ## [0.3.3] - 2026-09-09
9
67
 
10
68
  ### Changed
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-ponytail
2
2
 
3
+ [English](README_EN.md) | 简体中文
4
+
3
5
  ![CI](https://github.com/MengYuil/dsh-ponytail/actions/workflows/ci.yml/badge.svg)
4
6
  ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
5
7
  [![npm](https://img.shields.io/npm/v/@mengyuly/dsh-ponytail)](https://www.npmjs.com/package/@mengyuly/dsh-ponytail)
@@ -13,15 +15,15 @@
13
15
 
14
16
  - **最新版(latest)**:
15
17
  `https://github.com/MengYuil/dsh-ponytail/releases/latest/download/mengyuly-dsh-ponytail.tgz`
16
- - **固定版本 v0.3.2**(按 Tag 不可变):
17
- `https://github.com/MengYuil/dsh-ponytail/releases/download/v0.3.2/mengyuly-dsh-ponytail.tgz`
18
+ - **固定版本 v0.3.4**(按 Tag 不可变):
19
+ `https://github.com/MengYuil/dsh-ponytail/releases/download/v0.3.4/mengyuly-dsh-ponytail.tgz`
18
20
 
19
21
  说明:
20
22
 
21
23
  - **latest**:适合快速安装体验,会随最新 Release 更新;固定资产名
22
24
  `mengyuly-dsh-ponytail.tgz` 在每个 Release 中保持不变,因此该 URL
23
25
  不会因版本号变化而失效,**不适合作为不可变依赖**。
24
- - **固定版本**:适合可复现安装,URL 中固定 Tag(如 `v0.3.2`),按 Tag
26
+ - **固定版本**:适合可复现安装,URL 中固定 Tag(如 `v0.3.4`),按 Tag
25
27
  不可变;资产名同样为 `mengyuly-dsh-ponytail.tgz`。
26
28
  - npm 安装仍走 npm Registry 或 `dsh plugin` 命令。
27
29
  - 固定资产名由 `scripts/release-assets.mjs` 生成并验证(`node scripts/release-assets.mjs`,仅仓库维护者)。
@@ -54,28 +56,30 @@ dsh plugin --profile web add @mengyuly/dsh-ponytail
54
56
  ## 功能
55
57
 
56
58
  - **核心模式** `/ponytail` — 每轮注入结构化的懒惰开发者规则集,**三个档位是真实不同的 Prompt 片段**(不只是换一行):
57
- - **Common(所有非 off 档共享)**:先把请求转成可观察的完成条件;沿真实调用流取证,但决策阶梯是快速反射、不是研究项目;按“检查 → 修改 → 最窄有效验证 → 检查最终 diff”闭环执行;非平凡逻辑只留一个最小可执行检查,不额外搭测试框架或 fixtures;只汇报已验证结果。
59
+ - **Common(所有非 off 档共享)**:先把请求转成可观察的完成条件;沿真实调用流取证,但决策阶梯是快速反射、不是研究项目;按“检查 → 修改 → 最窄有效验证 → 检查最终 diff”闭环执行;非平凡逻辑只留一个最小可执行检查,不额外搭测试框架或 fixtures;只汇报已验证结果。
58
60
  - **Safety(任何档位都不可删)**:输入校验、防数据丢失的错误处理、安全措施、无障碍、明确验收项、先理解问题、「最小 diff ≠ 正确修复」。
59
- - **`lite`**:直接执行、减少仪式;完整交付明确要求;可以一句话指出更简方案,但**不挑战明确需求**。
61
+ - **`lite`**:直接执行、减少仪式;完整交付明确要求;可以一句话指出更简方案,但**不挑战明确需求**。
60
62
  - **`full`(默认)**:完整七级阶梯(YAGNI → 复用 → 标准库 → 原生 → 已装依赖 → 一行 → 最小实现),默认选最短正确实现,修根因而非症状。
61
- - **`ultra`**:新增代码前先要证据,优先删除或复用;主动质疑投机性功能/缓存/抽象/配置/新依赖;复杂需求先给最小正确版并说明扩大条件;**不是无脑拒绝**。
63
+ - **`ultra`**:新增代码前先要证据,优先删除或复用;主动质疑投机性功能/缓存/抽象/配置/新依赖;复杂需求先给最小正确版并说明扩大条件;**不是无脑拒绝**。
62
64
  - `off`:完全不注入。
63
65
  - 档位**会话级**(会话 A 不影响会话 B,会话结束自动释放)。
64
66
  - 裸 `/ponytail`:已启用时只报告;`off` 时恢复到有效默认档(默认也是 `off` 则回 `full`)。
65
- - `/ponytail status`:只查询、永不修改,并显示当前模式来自会话覆盖还是配置默认值。
66
- - `/ponytail reset`:清除当前会话覆盖,重新跟随有效配置默认值。
67
+ - `/ponytail status`:只查询、永不修改,并显示当前模式来自会话覆盖还是配置默认值。
68
+ - `/ponytail reset`:清除当前会话覆盖,重新跟随有效配置默认值。
67
69
  - `/ponytail lite|full|ultra|off`:显式切换。
68
- - `/ponytail default <mode>`:持久化默认值到**用户级配置文件**(env/Profile 仍优先,命令分别提示 saved 与 effective)。
70
+ - `/ponytail help`:直接显示操作帮助,不调用模型。
71
+ - `/ponytail default <mode>`:有 DSH Settings 时保存到宿主设置;没有时回退到用户级配置文件(env/Profile 仍优先,命令分别提示 saved 与 effective)。
72
+ - 状态操作立即生效,但不唤醒空闲 Agent;模型通知在下一次真实请求时接收,避免切档位额外触发模型调用。
69
73
  - **一次性技能**(用哪个载哪个,不进常驻 prompt):
70
- - `/ponytail-review` — 针对最近改动找过度工程;每条包含位置、替代方案和实际调用证据,不猜测精确收益。
71
- - `/ponytail-audit` — 全仓库过度工程审计;区分可安全删除与需要先验证的候选,最多返回 10 条高价值发现。
74
+ - `/ponytail-review` — 针对最近改动找过度工程;每条包含位置、替代方案和实际调用证据,不猜测精确收益。
75
+ - `/ponytail-audit` — 全仓库过度工程审计;区分可安全删除与需要先验证的候选,最多返回 10 条高价值发现。
72
76
  - `/ponytail-debt` — 收割所有 `ponytail:` 注释成债务账本。
73
77
  - `/ponytail-gain` — 上游 Benchmark 参考计分板(代码减少;Token/成本/延迟效果取决于模型与任务,**非本适配版保证**)。
74
78
  - `/ponytail-help` — 参考卡。
75
- - **停用**:说 `stop ponytail`、`normal mode`、`停止 ponytail`、`关闭 ponytail`、`普通模式` 或 `正常模式`(兼容中英文句末标点);随时 `/ponytail` 恢复。
79
+ - **停用**:说 `stop ponytail`、`normal mode`、`停止 ponytail`、`关闭 ponytail`、`普通模式` 或 `正常模式`(兼容中英文句末标点);随时 `/ponytail` 恢复。
76
80
  - **默认值优先级**(代码/测试/文档一致):
77
81
  ```
78
- 会话 override > PONYTAIL_DEFAULT_MODE > Profile config.defaultMode > 用户 config.json > full
82
+ 会话 override > PONYTAIL_DEFAULT_MODE > Profile config.defaultMode > DSH Settings > 用户 config.json > full
79
83
  ```
80
84
  - **Profile 级配置**(Cordis 官方插件配置 API,各 profile 可不同):
81
85
  ```yaml
@@ -91,6 +95,36 @@ dsh plugin --profile web add @mengyuly/dsh-ponytail
91
95
  - **子代理(如实边界)**:DSH 内置 `subagent` 工具是**隔离派生**,但全局 system-prompt section 默认也会参与子代理的独立组装;这不是父代理 Prompt 或会话状态继承。`PONYTAIL_SUBAGENT_MATCHER`(匹配子代理 `agentPreset` 的正则)只用于筛选能进入本 Prompt 管线的子代理,不是继承开关;无 preset 时不会被 matcher 排除。DSH 当前没有公开的父子 Prompt 继承 API,因此**不宣称父子 Prompt 继承**(有官方 API 后再考虑只读模式快照传播)。非法正则告警一次并 fail-open。
92
96
  - **配置错误**:非法 JSON / 非法 `defaultMode` / 读取失败 / 非法正则只告警一次(不刷屏);配置文件不存在属正常、不告警。
93
97
 
98
+ ## 图形操作
99
+
100
+ 支持原生 `settingsScope`/`settings.plugin.item` 接口的 DSH Web 中,打开
101
+ **设置 → 插件 → Ponytail**:选择默认模式、分别开关五个附加技能、保存设置,
102
+ 或一键恢复面板默认。选择「跟随现有配置」会沿用旧配置,不替用户覆盖环境变量或 Profile。
103
+ 面板默认值不是当前会话模式;已有会话覆盖不变,实际模式与来源用 `/ponytail status` 查询。
104
+ 附加技能开关不会移除常驻核心规则,只有 `off` 模式关闭规则注入。
105
+
106
+ 原生命令菜单支持时,裸 `/ponytail` 打开模式选择器,并提供状态、会话重置和帮助入口。
107
+ 有参数的命令、TUI/CLI 用法保持原样。没有这些界面服务的旧宿主保留命令与文件配置路径。
108
+ 保存失败不显示成功,面板保留修改;只读连接禁用写入。面板重置仅清除自身设置,
109
+ 不删除旧配置、不清除已有会话覆盖,也不请求模型工作。
110
+
111
+ 已在 WSL Debian 的真实 DSH checkout `b150a551` 上用隔离 profile 联调界面与文件设置。
112
+ 旧版仅有 `set/unset` 的 Settings scope 通过宿主原子 RPC 保存,仍保留版本冲突检查。
113
+ DSH 宿主契约 peer 保留版本声明,但标记为包管理器可选,由实际宿主提供;
114
+ `cordis` 与 `schemastery` 仍是必需的运行时 peer。正常安装不需要关闭自动 peer 安装,
115
+ 也不会为了安装本插件拉取整套 DSH 和尚未发布的 `dsh-type-meta`。
116
+ 「可选」仅指依赖解析:实际运行仍需要 DSH 的 systemPrompt、skills 等宿主服务,不能脱离 DSH 独立运行。
117
+
118
+ 开发者界面验证(工具安装在仓库外,不进入 npm 包):
119
+ ```powershell
120
+ $env:PONYTAIL_TOOL_ROOT = Join-Path $env:TEMP 'ponytail-ui-tools'
121
+ npm install --prefix $env:PONYTAIL_TOOL_ROOT --ignore-scripts typescript@6.0.3 esbuild@0.28.2 react@18.3.1 react-dom@18.3.1 jsdom@26.1.0
122
+ node scripts/build-ui.mjs
123
+ node scripts/test-ui.mjs
124
+ ```
125
+ `build-ui` 保留已有内联宿主依赖,编译下游规则片段、插件入口和浏览器界面,**不是权威 monorepo 完整重建**。
126
+ `dist-provenance.json` 中旧 `sourceCommit` 表示基线,`downstreamBuild` 记录当前修改的源码和产物 SHA-256。
127
+
94
128
  ## 效率(条件性收益,非保证)
95
129
 
96
130
  Ponytail 会给每次模型请求增加一小段固定规则。它的收益是**有条件的**:
@@ -104,14 +138,25 @@ prompt 与推理开销变得更贵。
104
138
 
105
139
  | 档位 | 字符数 | UTF-8 字节 | 说明 |
106
140
  |------|--------|-----------|------|
107
- | lite | 1915 | 1917 | 实测生成 |
108
- | full | 3022 | 3038 | 实测生成 |
109
- | ultra | 2797 | 2813 | 实测生成 |
141
+ | lite | 3911 | 3913 | 实测生成 |
142
+ | full | 4818 | 4834 | 实测生成 |
143
+ | ultra | 5034 | 5050 | 实测生成 |
110
144
  | off | 0 | 0 | 不注入 |
111
145
 
112
146
  这些是 **Prompt 体积测量,不是账单金额,也不是对所有模型成立的节省
113
147
  比例**(无统一 tokenizer,`measure:prompt` 输出中 `estimated_tokens` 为
114
- null;字符数/4 只是粗略估算)。同模式字节级稳定,KV-cache 前缀命中。
148
+ null;字符数/4 只是粗略估算)。同模式字节级稳定,有利于 Prompt 缓存,但不保证宿主或模型缓存命中。
149
+
150
+ 所有启用档位均保留上游边界:修复前检查所有调用方、同等大小方案优先边界正确性、
151
+ 有已知局限的捷径留下 `ponytail: <ceiling>, <upgrade path>` 注释、保留硬件校准,
152
+ 以及完整回答用户明确要求的解释。规则仅用于编码任务,不改写一般问答或翻译。
153
+ 所有启用档位包含完整七阶梯。Lite 必须用一句话指出更简单的替代方案,但由用户选定范围;
154
+ Full 执行阶梯;Ultra 执行阶梯并更积极质疑不必要的复杂度。几行代码足够时不得新增依赖,
155
+ 在正确完整的前提下触及最少文件;用户坚持完整版本后直接实现,不反复争辩。
156
+ 非平凡逻辑保留一个最小可运行检查,不擅自增加逐函数测试套件;简单一行代码不要求额外测试。
157
+ `ponytail-debt` 支持块注释和 `lib` 源码,两条扫描路径均跳过嵌套依赖与构建目录。
158
+ 验证覆盖规则内容、真实搜索命令及安装产物与源码的 Prompt/Skill 一致性;
159
+ 这些检查不代表模型遵循率或实际性能已经通过对照评测。
115
160
 
116
161
  **上游数据不是本 DSH 适配版的保证**:上游 Ponytail 的 single-shot
117
162
  (代码 −80~94%、成本 −42~75%、延迟 3.1–5.8×)与 agentic(LOC −54% 等)
@@ -144,7 +189,7 @@ Smoke Benchmark 只提供方向性证据(见 `docs/dsh-smoke-summary.md`)。
144
189
  ## 测试环境与权威关系
145
190
 
146
191
  - 本机(Linux,Node.js **v24.16.0**,deepseek-harness checkout 构建)与 CI 矩阵(**ubuntu-latest + windows-latest × Node 22/24**)上验证通过。与之精确匹配的已发布 DSH/Cordis 版本**待确认**——checkout 是预发布工作树,非发布 tag。
147
- - 权威源码在 deepseek-harness monorepo 的 `packages/community/ponytail`(`@deepseek-ai/dsh-ponytail`);本仓库(`@mengyuly/dsh-ponytail`)是**发行镜像**:随包附构建产物,不是独立真源。
192
+ - 历史宿主构建基线来自 deepseek-harness monorepo 的 `packages/community/ponytail`;当前 `@mengyuly/dsh-ponytail` 的下游适配修改以本仓库 `src/` 为准,随包附构建产物。
148
193
 
149
194
  ## 发行维护
150
195
 
@@ -154,7 +199,7 @@ Smoke Benchmark 只提供方向性证据(见 `docs/dsh-smoke-summary.md`)。
154
199
  > `scripts/` 命令(无维护脚本入口、无安装生命周期钩子),由
155
200
  > `node scripts/verify-pack.mjs` 回归检查强制。
156
201
 
157
- - **权威源码**:deepseek-harness monorepo 的 `packages/community/ponytail`(本仓库是发行镜像,只随包发布构建产物)。
202
+ - **构建来源**:monorepo 提供历史内联依赖基线;当前下游适配源码在本仓库。`build-ui` 与完整 `sync:dist` 的证据范围不同,不能混称。
158
203
  - **维护者命令**(源码仓库内直接运行 `node scripts/<script>.mjs`;快捷清单见
159
204
  `package.dev.json`):
160
205
  ```bash
@@ -162,8 +207,9 @@ Smoke Benchmark 只提供方向性证据(见 `docs/dsh-smoke-summary.md`)。
162
207
  node scripts/verify-dist.mjs # 静态一致性:src/d.ts 导出一致、关键签名、运行时导出、provenance
163
208
  node scripts/verify-pack.mjs # tarball 边界(含无 scripts/ 暴露回归检查)、版本、安装后 smoke
164
209
  node scripts/test-consumer.mjs # NodeNext + skipLibCheck:false 声明消费测试(对打包产物)
165
- node scripts/test-regressions.mjs # 验证工具自身的回归测试
166
- node scripts/test-core.mjs # 核心 Prompt 字节、安全边界、模式与 Skill 表面
210
+ node scripts/test-regressions.mjs # 验证工具自身的回归测试
211
+ node scripts/test-core.mjs # 核心 Prompt 字节、安全边界、模式与 Skill 表面
212
+ node scripts/test-install.mjs # pnpm 11 默认 peer 安装,无宿主源码树或规避配置
167
213
  node scripts/measure-prompt.mjs # 各模式 Prompt 段体积(依赖未发布的 src/)
168
214
  node scripts/check-release-links.mjs # README/CHANGELOG/docs 无版本化 latest 资产链接
169
215
  node scripts/check-release-consistency.mjs --version <v> # 四方发布一致性(git tag/npm/GitHub/provenance)
@@ -180,4 +226,4 @@ Smoke Benchmark 只提供方向性证据(见 `docs/dsh-smoke-summary.md`)。
180
226
 
181
227
  ## 许可
182
228
 
183
- MIT,© 2026 DietrichGebert(上游)+ MengYuil(移植)。详见 [LICENSE](LICENSE)。
229
+ MIT,© 2026 DietrichGebert(上游)+ MengYuil(移植)。详见 [LICENSE](LICENSE)。
package/README_EN.md ADDED
@@ -0,0 +1,366 @@
1
+ # dsh-ponytail
2
+
3
+ English | [简体中文](README.md)
4
+
5
+ ![CI](https://github.com/MengYuil/dsh-ponytail/actions/workflows/ci.yml/badge.svg)
6
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
7
+ [![npm](https://img.shields.io/npm/v/@mengyuly/dsh-ponytail)](https://www.npmjs.com/package/@mengyuly/dsh-ponytail)
8
+ [![dsh.so security](https://www.dsh.so/badge/dsh-ponytail-4.svg)](https://www.dsh.so/artifact/dsh-ponytail-4/)
9
+
10
+ Adapts the minimal-coding principles and skills of
11
+ [DietrichGebert/ponytail](https://github.com/DietrichGebert/ponytail) to
12
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): a YAGNI
13
+ decision ladder, session-level Lite / Full / Ultra / Off modes, and a set of
14
+ skills for code slimming, review, auditing, and technical-debt tracking.
15
+
16
+ This project aligns with the upstream core ideas and main workflows, but DSH's
17
+ model loop, prompt assembly, skill mechanism, and tool calls differ. **The
18
+ upstream benchmark is a reference only and does not imply that this port has
19
+ the same token, cost, or latency gains** (see “Efficiency (conditional gains,
20
+ not guarantees)”).
21
+
22
+ ## Download from GitHub Releases
23
+
24
+ - **Latest release**:
25
+ `https://github.com/MengYuil/dsh-ponytail/releases/latest/download/mengyuly-dsh-ponytail.tgz`
26
+ - **Pinned version v0.3.4** (immutable per tag):
27
+ `https://github.com/MengYuil/dsh-ponytail/releases/download/v0.3.4/mengyuly-dsh-ponytail.tgz`
28
+
29
+ Notes:
30
+
31
+ - **latest**: good for a quick install; it tracks the newest release. The fixed
32
+ asset name `mengyuly-dsh-ponytail.tgz` stays the same in every release, so
33
+ the URL never breaks on a version bump — which also means it is **not
34
+ suitable as an immutable dependency**.
35
+ - **Pinned version**: good for reproducible installs; the URL pins a tag
36
+ (e.g. `v0.3.4`) that is immutable per tag; the asset name is likewise
37
+ `mengyuly-dsh-ponytail.tgz`.
38
+ - npm installs still go through the npm Registry or the `dsh plugin` command.
39
+ - The fixed asset name is produced and verified by
40
+ `scripts/release-assets.mjs` (`node scripts/release-assets.mjs`, maintainers
41
+ only).
42
+
43
+ ## Installation
44
+
45
+ Install into a profile (replace `web` with `tui` or a custom name):
46
+
47
+ ```bash
48
+ # Option 1: local link (current dsh cores >= 0.1.x)
49
+ dsh plugin --profile web add link:$(pwd)
50
+
51
+ # Option 2: install straight from GitHub
52
+ dsh plugin --profile web add github:MengYuil/dsh-ponytail
53
+
54
+ # Option 3: Release tarball (download the tgz first — the latest fixed asset
55
+ # name never changes)
56
+ # https://github.com/MengYuil/dsh-ponytail/releases/latest/download/mengyuly-dsh-ponytail.tgz
57
+ dsh plugin --profile web add file:./mengyuly-dsh-ponytail.tgz
58
+
59
+ # Option 4: npm
60
+ dsh plugin --profile web add @mengyuly/dsh-ponytail
61
+ ```
62
+
63
+ Restart the profile after installing (`dsh web` / `dsh tui`) for it to take
64
+ effect. Once loaded, the session skill catalog shows 6 `ponytail*` skills; send
65
+ `/ponytail-help` to verify immediately.
66
+
67
+ > `lib/index.js` is a self-contained bundle (`dsh-llm` / `dsh-skill` are
68
+ > already inlined — npm has no compatible versions) with two published
69
+ > runtime peers: `@deepseek-ai/cordis` (4.0.1) and
70
+ > `@deepseek-ai/schemastery` (3.18.x). `schemastery` is deliberately kept
71
+ > external rather than inlined: its schema DSL compiles `callback` strings
72
+ > with `new Function`, so keeping it out means **the shipped artifact contains
73
+ > no dynamic code execution** (CI has a dedicated check). None of the three
74
+ > install paths — GitHub, tgz, npm — needs a dsh source tree.
75
+
76
+ > Note: `src/` is the source, `lib/` is the prebuilt artifact (loadable
77
+ > out of the box, no build step). The authoritative source lives in the
78
+ > deepseek-harness monorepo at `packages/community/ponytail`; after changing
79
+ > source, rebuild and sync the full `lib/` with
80
+ > `DSH_CHECKOUT=/path/to/deepseek-harness node scripts/sync-dist.mjs`
81
+ > (see “Release maintenance” below).
82
+
83
+ ## Features
84
+
85
+ - **Core mode** `/ponytail` — injects a structured lazy-developer ruleset
86
+ every turn; **the three levels are genuinely different prompt fragments**
87
+ (not just a swapped line):
88
+ - **Common (shared by every non-off level)**: turn the request into an
89
+ observable completion condition first; gather evidence along the real call
90
+ flow, but the decision ladder is a quick reflex, not a research project;
91
+ follow the “inspect → change → narrowest effective verification → inspect
92
+ the final diff” loop; non-trivial logic keeps exactly one minimal runnable
93
+ check, without standing up a test framework or fixtures; report only
94
+ verified results.
95
+ - **Safety (never removable in any level)**: input validation, error
96
+ handling that prevents data loss, security measures, accessibility,
97
+ explicit acceptance criteria, understanding the problem first, and
98
+ “minimal diff ≠ correct fix”.
99
+ - **`lite`**: execute directly, less ceremony; still complete explicit
100
+ deliverables; you may point out a simpler approach in one sentence, but
101
+ **do not challenge explicit requirements**.
102
+ - **`full`** (default): the full seven-rung ladder (YAGNI → reuse → stdlib
103
+ → native → installed dependencies → one line → minimal implementation);
104
+ pick the shortest correct implementation by default; fix root causes, not
105
+ symptoms.
106
+ - **`ultra`**: demand evidence before adding code; prefer deleting or
107
+ reusing; proactively question speculative features/caching/abstraction/
108
+ configuration/new dependencies; for complex requests deliver the minimal
109
+ correct version first and state the conditions for expanding — **not a
110
+ blanket refusal**.
111
+ - `off`: no injection at all.
112
+ - Levels are **session-scoped** (session A does not affect session B;
113
+ released automatically when the session ends).
114
+ - Bare `/ponytail`: when enabled it only reports; when `off` it restores the
115
+ effective default level (falling back to `full` if that default is also
116
+ `off`).
117
+ - `/ponytail status`: query only, never modifies, and shows whether the
118
+ current mode comes from a session override or the configured default.
119
+ - `/ponytail reset`: clears the current session override and follows the
120
+ effective configured default again.
121
+ - `/ponytail lite|full|ultra|off`: explicit switch.
122
+ - `/ponytail help`: displays command help without calling the model.
123
+ - `/ponytail default <mode>`: persists through DSH Settings when available,
124
+ otherwise the user-level config file (env/profile still take priority; the command reports both
125
+ `saved` and `effective`).
126
+ - Status changes take effect immediately without waking an idle agent.
127
+ Notices reach the model on its next real step, avoiding an extra model
128
+ turn just to switch levels.
129
+ - **One-shot skills** (load on demand, never part of the standing prompt):
130
+ - `/ponytail-review` — find over-engineering in recent changes; every
131
+ finding includes location, replacement, and actual call evidence; no
132
+ guessed savings numbers.
133
+ - `/ponytail-audit` — whole-repo over-engineering audit; distinguishes
134
+ safe-to-delete from verify-first candidates; at most 10 high-value
135
+ findings.
136
+ - `/ponytail-debt` — harvests all `ponytail:` comments into a debt ledger.
137
+ - `/ponytail-gain` — upstream benchmark reference scoreboard (less code;
138
+ token/cost/latency effects depend on model and task, **not guaranteed by
139
+ this port**).
140
+ - `/ponytail-help` — reference card.
141
+ - **Deactivation**: say `stop ponytail`, `normal mode`, `停止 ponytail`,
142
+ `关闭 ponytail`, `普通模式`, or `正常模式` (trailing Chinese/English
143
+ punctuation tolerated); `/ponytail` re-enables at any time.
144
+ - **Default priority** (consistent across code/tests/docs):
145
+ ```
146
+ session override > PONYTAIL_DEFAULT_MODE > Profile config.defaultMode > DSH Settings > user config.json > full
147
+ ```
148
+ - **Profile-level config** (official Cordis plugin config API; each profile
149
+ can differ):
150
+ ```yaml
151
+ # add config to the ponytail row in ~/.dsh/profiles/tui/cordis.patch.yml
152
+ - insert:
153
+ - id: ponytail
154
+ name: '@mengyuly/dsh-ponytail'
155
+ config:
156
+ defaultMode: lite
157
+ ```
158
+ Example: `web → full`, `tui → lite`, `automation → off`. Profile config is
159
+ read when the plugin initializes (Cordis has no public config-change
160
+ event), so **restart that profile after changing it**; an invalid value
161
+ warns once and falls back without breaking startup. The user `config.json`
162
+ stays hot-reloaded.
163
+ - **User config.json** (`~/.config/ponytail/config.json`, Windows
164
+ `%APPDATA%\ponytail\config.json`): `{"defaultMode": "lite"}`,
165
+ hot-reloaded (~1s polling); invalid content keeps the last valid value.
166
+ - **Subagents (honest boundaries)**: DSH's built-in `subagent` tool is an
167
+ **isolated fork**, but the global system-prompt section participates in each
168
+ subagent's own assembly by default; this is not parent-prompt or session
169
+ state inheritance. `PONYTAIL_SUBAGENT_MATCHER` (a regex matched against the
170
+ subagent's `agentPreset`) only filters which subagents can enter this prompt
171
+ pipeline — it is not an inheritance switch; without a preset nothing is
172
+ excluded by the matcher. DSH currently has no public parent→child prompt
173
+ inheritance API, so **no parent-child prompt inheritance is claimed** (a
174
+ read-only mode-snapshot propagation may follow once an official API
175
+ exists). An invalid regex warns once and fails open.
176
+ - **Config errors**: invalid JSON / invalid `defaultMode` / read failures /
177
+ invalid regex warn exactly once (no log spam); a missing config file is
178
+ normal and never warns.
179
+
180
+ ## Graphical controls
181
+
182
+ On DSH Web hosts with the native `settingsScope`/`settings.plugin.item` APIs,
183
+ open **Settings → Plugins → Ponytail** to select a default mode, toggle five
184
+ optional skills, save, or reset panel defaults. “Follow existing configuration”
185
+ preserves legacy configuration. Environment/profile values still take priority;
186
+ existing session overrides stay intact. Use `/ponytail status` for the actual
187
+ session mode and source. Optional-skill toggles never remove the core rules.
188
+
189
+ When supported, bare `/ponytail` opens a native picker with mode/status/reset/help
190
+ actions. Argued commands and TUI/CLI behavior remain unchanged. Older hosts
191
+ without these services keep the command/config-file paths. Failed saves retain
192
+ drafts; read-only connections cannot write. Panel reset clears only its own
193
+ overrides, not legacy files or session state, and requests no model work.
194
+
195
+ The native UI and file-backed settings were integration-tested in an isolated
196
+ profile on the real WSL Debian DSH checkout `b150a551`. Older Settings scopes
197
+ with only `set/unset` save through the host's atomic RPC with revision checks.
198
+ DSH contract peers retain their version ranges but are optional for package
199
+ resolution and supplied by the host. Cordis and schemastery remain required
200
+ runtime peers. Normal installation needs no auto-peer workaround and does not
201
+ fetch a second DSH or the unpublished `dsh-type-meta` peer. Optional metadata
202
+ does not make host services optional: runtime still requires DSH systemPrompt,
203
+ skills, and the other services used by the plugin.
204
+
205
+ Developer UI checks use isolated tools, excluded from the npm tarball:
206
+ ```powershell
207
+ $env:PONYTAIL_TOOL_ROOT = Join-Path $env:TEMP 'ponytail-ui-tools'
208
+ npm install --prefix $env:PONYTAIL_TOOL_ROOT --ignore-scripts typescript@6.0.3 esbuild@0.28.2 react@18.3.1 react-dom@18.3.1 jsdom@26.1.0
209
+ node scripts/build-ui.mjs
210
+ node scripts/test-ui.mjs
211
+ ```
212
+ `build-ui` retains baseline inlined host dependencies and compiles downstream
213
+ rule fragments and entry/UI code; it is **not an authoritative monorepo rebuild**. Provenance's
214
+ `sourceCommit` identifies the baseline; `downstreamBuild` records current source
215
+ and artifact hashes.
216
+
217
+ ## Efficiency (conditional gains, not guarantees)
218
+
219
+ Ponytail adds a small fixed ruleset to every model request. Its benefit is
220
+ **conditional**: when the agent tends to over-engineer, the reduced code,
221
+ tool calls, and rework may offset or exceed that overhead; when the task is
222
+ already simple, the gain may be near zero — or the extra input overhead may
223
+ lose outright. It is not a “save tokens switch” and does not guarantee savings
224
+ across models — some reasoning models may get more expensive due to prompt
225
+ and reasoning overhead.
226
+
227
+ Measured prompt-section sizes for this DSH port (`node
228
+ scripts/measure-prompt.mjs`, generated from the real
229
+ `getPonytailInstructions()`):
230
+
231
+ | Level | Characters | UTF-8 bytes | Notes |
232
+ |------|--------|-----------|------|
233
+ | lite | 3911 | 3913 | measured output |
234
+ | full | 4818 | 4834 | measured output |
235
+ | ultra | 5034 | 5050 | measured output |
236
+ | off | 0 | 0 | not injected |
237
+
238
+ These are **prompt-size measurements, not billing amounts, and not a savings
239
+ ratio that holds for every model** (there is no universal tokenizer;
240
+ `estimated_tokens` in `measure:prompt` output is null; characters/4 is only a
241
+ rough estimate). Same-mode output is byte-stable, which helps prompt caching,
242
+ but does not guarantee a host or model cache hit.
243
+
244
+ Every active level preserves upstream boundaries: check all callers before a
245
+ bug fix, prefer edge-case correctness between same-size options, annotate real
246
+ shortcuts with `ponytail: <ceiling>, <upgrade path>`, retain hardware calibration,
247
+ and give explicitly requested explanations in full. Rules apply to coding only,
248
+ not unrelated prose or translation. Debt scans support block comments and `lib`
249
+ sources; both scan paths exclude nested dependency and build directories.
250
+ Checks cover prompt contracts, actual scan commands, and exact installed/source
251
+ prompt and skill parity, not model compliance rates or measured performance.
252
+
253
+ Every active prompt contains the complete seven-rung ladder. Lite must name a
254
+ simpler alternative in one line while leaving scope to the user; Full enforces
255
+ the ladder; Ultra enforces it and challenges unnecessary complexity more actively.
256
+ Do not add dependencies for work a few lines can do; touch the fewest files that
257
+ deliver a correct complete fix. If the user insists on full scope, build it
258
+ without re-arguing. Non-trivial logic keeps one minimal runnable check, not an
259
+ unrequested per-function suite; trivial one-liners need no extra test.
260
+
261
+ **Upstream numbers are not a guarantee for this DSH port**: the upstream
262
+ Ponytail single-shot results (code −80–94%, cost −42–75%, latency 3.1–5.8×)
263
+ and agentic results (LOC −54% etc.) are references only; this DSH port has
264
+ **not** established stable token/cost/latency savings rates. The DSH smoke
265
+ benchmark provides directional evidence only (see
266
+ `docs/dsh-smoke-summary.md`).
267
+
268
+ ## Known limitations
269
+
270
+ - The levels differ in **rule semantics** (see above); the three prompt
271
+ sizes are similar (measured in the table above).
272
+ - The upstream Claude-only statusline badge has no DSH counterpart; the MCP
273
+ server was dropped because DSH has a first-class system-prompt injection
274
+ point.
275
+ - User `config.json` hot-reloads; `PONYTAIL_DEFAULT_MODE` and profile config
276
+ need a restart.
277
+ - The shipped `lib/` is a prebuilt artifact; to change behavior, rebuild in
278
+ the main repo and re-sync.
279
+
280
+ ## Compatibility matrix (measured, not fabricated)
281
+
282
+ | Component | Verified environment | Notes |
283
+ |---|---|---|
284
+ | Node.js | 22.x / 24.x | CI matrix, 4 combinations green |
285
+ | OS | ubuntu-latest / windows-latest | CI matrix |
286
+ | DSH | commit `b150a551` (build checkout) | exact mapping to an official release **TBD** |
287
+ | Cordis | 4.0.1 (build vendor) | same |
288
+ | web profile | verified | long-running on a real local profile + three isolated install-path tests (npm / GitHub / tgz) |
289
+ | tui profile | not verified | not started inside a tui profile |
290
+ | headless profile | not verified | not fully started; plugin unit tests run in a UI-less environment |
291
+ | npm tarball | verified | contents/version/post-install smoke/NodeNext consumer |
292
+
293
+ - `dist-provenance.json` records the actual build sources (checkout commit +
294
+ node/typescript/tsdown/cordis versions).
295
+ - Do not hide failures with `continue-on-error` — the matrix is green only if
296
+ every cell is green.
297
+
298
+ ## Test environments and source of truth
299
+
300
+ - Verified locally (Linux, Node.js **v24.16.0**, deepseek-harness checkout
301
+ build) and in the CI matrix (**ubuntu-latest + windows-latest × Node
302
+ 22/24**). The exact published DSH/Cordis release they correspond to is
303
+ **TBD** — the checkout is a prerelease working tree, not a release tag.
304
+ - The historical host build baseline is `packages/community/ponytail` in the
305
+ deepseek-harness monorepo. Current `@mengyuly/dsh-ponytail` downstream changes
306
+ are maintained in this repository's `src/`, alongside shipped artifacts.
307
+
308
+ ## Release maintenance
309
+
310
+ > **The commands below are for source-repository maintainers only.** The
311
+ > `scripts/` directory is deliberately **excluded from the npm tarball**, so
312
+ > these commands are unavailable after installing the published package — npm
313
+ > users never need to run maintenance checks; they exist for maintainers and
314
+ > CI before a release. The published `package.json` exposes no `scripts/`
315
+ > commands (no maintenance entry points, no install lifecycle hooks),
316
+ > enforced by a regression check in `node scripts/verify-pack.mjs`.
317
+
318
+ - **Build sources**: the monorepo supplies the historical inlined dependency
319
+ baseline; this repository owns current downstream source. `build-ui` and a
320
+ full `sync:dist` provide different evidence and must not be conflated.
321
+ - **Maintainer commands** (run `node scripts/<script>.mjs` inside the source
322
+ repository; see `package.dev.json` for the shortcut list):
323
+ ```bash
324
+ node scripts/check-bundle.mjs # bundle external-dependency allowlist + no new Function/eval
325
+ node scripts/verify-dist.mjs # static consistency: src/d.ts export parity, key signatures, runtime exports, provenance
326
+ node scripts/verify-pack.mjs # tarball boundary (incl. no scripts/ exposure regression), versions, post-install smoke
327
+ node scripts/test-consumer.mjs # NodeNext + skipLibCheck:false declaration consumer test (against the packed artifact)
328
+ node scripts/test-regressions.mjs # regression tests for the verification tooling itself
329
+ node scripts/test-core.mjs # core prompt bytes, safety boundaries, modes and skill surface
330
+ node scripts/test-install.mjs # pnpm 11 default peer installation, no host tree/workaround
331
+ node scripts/measure-prompt.mjs # prompt-section size per mode (depends on the unpublished src/)
332
+ node scripts/check-release-links.mjs # README/CHANGELOG/docs contain no versioned latest asset links
333
+ node scripts/check-release-consistency.mjs --version <v> # four-way release consistency (git tag/npm/GitHub/provenance)
334
+ ```
335
+ - **Fully regenerate and sync `lib/`** (JS and declarations must be synced as
336
+ one artifact; copying a single JS file is forbidden):
337
+ ```bash
338
+ DSH_CHECKOUT=/path/to/deepseek-harness node scripts/sync-dist.mjs
339
+ ```
340
+ This rebuilds inside the authoritative checkout (`tsc` for declarations +
341
+ `tsdown` for the runtime bundle), syncs `lib/index.js`, `lib/invariant.js`,
342
+ `lib/types/*.d.ts`, generates `dist-provenance.json` (recording the
343
+ authoritative checkout's real commit SHA and toolchain versions), and runs
344
+ the consistency checks automatically; it prompts you to commit when
345
+ artifacts changed. **Full build consistency is produced by this command in
346
+ the release process — the mirror repository's CI never rebuilds the
347
+ authoritative monorepo.**
348
+ - **CI capability boundary (honest)**: CI (ubuntu + windows matrix) runs the
349
+ static verification and pack/consumer tests above, but **does not rebuild
350
+ the authoritative monorepo**; `verify:dist` is an export-surface/signature/
351
+ runtime-export consistency check, **not** a byte-level equivalence proof
352
+ against the authoritative build — that is guaranteed by `sync:dist` in the
353
+ release process.
354
+ - `dist-provenance.json` ships with the npm package for build-source audits.
355
+ - When verifying locally, if `npm_execpath` points at another package manager
356
+ (e.g. a pnpm/yarn shim), the scripts fall back to `npm` on PATH; set
357
+ `PONYTAIL_VERIFY_KEEP_TEMP=1` to keep temp directories on failure.
358
+ - **Security**: `scripts/**` exists only for development/build/release
359
+ verification — **not in the npm tarball**, no install lifecycle hooks, not
360
+ referenced by the runtime entry point, and not exposed in the published
361
+ `package.json`; `child_process` warnings there are accepted development-tool
362
+ risk. See [SECURITY.md](SECURITY.md).
363
+
364
+ ## License
365
+
366
+ MIT, © 2026 DietrichGebert (upstream) + MengYuil (port). See [LICENSE](LICENSE).
package/cordis.patch.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  # dsh bundle patch: inserts the ponytail persona plugin into a profile's layer stack.
2
2
  - insert:
3
3
  - id: ponytail
4
- name: '@mengyuly/dsh-ponytail'
4
+ name: '@mengyuly/dsh-ponytail'
@@ -1,11 +1,26 @@
1
- {
2
- "sourceRepository": "https://github.com/deepseek-ai/deepseek-harness.git",
3
- "sourceCommit": "b150a551b8d465e31e418e1b2eaf5e79bbb7d28e",
4
- "sourcePackage": "packages/community/ponytail",
5
- "generatedBy": {
6
- "node": "v24.16.0",
7
- "typescript": "6.0.3",
8
- "tsdown": "0.22.2",
9
- "cordis": "4.0.1"
10
- }
11
- }
1
+ {
2
+ "sourceRepository": "https://github.com/deepseek-ai/deepseek-harness.git",
3
+ "sourceCommit": "b150a551b8d465e31e418e1b2eaf5e79bbb7d28e",
4
+ "sourcePackage": "packages/community/ponytail",
5
+ "generatedBy": {
6
+ "node": "v24.16.0",
7
+ "typescript": "6.0.3",
8
+ "tsdown": "0.22.2",
9
+ "cordis": "4.0.1"
10
+ },
11
+ "downstreamBuild": {
12
+ "method": "scripts/build-ui.mjs; retains baseline inlined host dependencies",
13
+ "node": "v24.15.0",
14
+ "typescript": "6.0.3",
15
+ "esbuild": "0.28.2",
16
+ "sha256": {
17
+ "src/index.ts": "8421733adf8c801c1578b070cf789b5bd77588acbe90403dd69ee5467375c955",
18
+ "src/client.ts": "7a2c941b8a85096d863da16982ba9c6b82c709cb0561057f1b221239bbb6688a",
19
+ "src/content.ts": "9dc57919da6cbfcf06ae26a19e81bb0299e44d2b9c016d3477572758d9ade375",
20
+ "src/instructions.ts": "d96deb078f6f633fffb0e3da2750eb9d3afb37bce4cea11145db045c8cceb935",
21
+ "src/modes.ts": "74b8b885d145759ce17007a054ab6adc295f726f47518f56a3d37de67bd14231",
22
+ "lib/index.js": "b5856ca9147b78111edcd9d43be3edec4c15295ddb7539f4bf48244fef7f6ffb",
23
+ "lib/client.js": "84ea84dc9a6148e822f9830999cca0229a27b3696ab000394a53cc2fef3454b4"
24
+ }
25
+ }
26
+ }