dsh-plain-talk 0.1.14 → 0.1.16

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.
@@ -1,281 +0,0 @@
1
- {
2
- "summary": {
3
- "versions": [
4
- "0.1.10",
5
- "0.1.11"
6
- ],
7
- "reps": 1,
8
- "questions": 12,
9
- "runs": 24,
10
- "model": "group/free",
11
- "arms": {
12
- "0.1.10": {
13
- "n": 12,
14
- "avgChars": 345,
15
- "avgLines": 5.9,
16
- "errors": 0,
17
- "warns": 10
18
- },
19
- "0.1.11": {
20
- "n": 12,
21
- "avgChars": 381,
22
- "avgLines": 7.7,
23
- "errors": 2,
24
- "warns": 15
25
- }
26
- },
27
- "pairs": {
28
- "0.1.10/0.1.11": {
29
- "n": 12,
30
- "charsDelta": 434,
31
- "warnsDelta": 5,
32
- "shorter": 4,
33
- "longer": 7,
34
- "avgCharsDelta": 36,
35
- "avgWarnsDelta": 0.42
36
- }
37
- }
38
- },
39
- "rows": [
40
- {
41
- "q": 1,
42
- "rep": 1,
43
- "version": "0.1.10",
44
- "chars": 666,
45
- "lines": 10,
46
- "errors": 0,
47
- "warns": 2,
48
- "firstLine": "**Liveness Probe(存活探针)**:判断容器是否**还活着**。失败 → kubelet **杀掉并重启*"
49
- },
50
- {
51
- "q": 1,
52
- "rep": 1,
53
- "version": "0.1.11",
54
- "chars": 963,
55
- "lines": 30,
56
- "errors": 0,
57
- "warns": 2,
58
- "firstLine": "一句话:liveness 探针决定\"要不要重启容器\",readiness 探针决定\"要不要把流量发给这个 Pod\"。"
59
- },
60
- {
61
- "q": 2,
62
- "rep": 1,
63
- "version": "0.1.10",
64
- "chars": 346,
65
- "lines": 9,
66
- "errors": 0,
67
- "warns": 0,
68
- "firstLine": "被拒绝是因为远程分支有本地没有的提交,直接推送会覆盖远程提交,Git 拒绝以防丢数据。"
69
- },
70
- {
71
- "q": 2,
72
- "rep": 1,
73
- "version": "0.1.11",
74
- "chars": 143,
75
- "lines": 1,
76
- "errors": 0,
77
- "warns": 0,
78
- "firstLine": "因为远端分支上有你本地没有的提交,导致推送会使历史出现非快进(non‑fast‑forward),git 为防止意外覆盖"
79
- },
80
- {
81
- "q": 3,
82
- "rep": 1,
83
- "version": "0.1.10",
84
- "chars": 28,
85
- "lines": 1,
86
- "errors": 0,
87
- "warns": 0,
88
- "firstLine": "它只在组件首次渲染时运行一次。后续的重新渲染不会触发它。"
89
- },
90
- {
91
- "q": 3,
92
- "rep": 1,
93
- "version": "0.1.11",
94
- "chars": 339,
95
- "lines": 4,
96
- "errors": 0,
97
- "warns": 1,
98
- "firstLine": "在 React 的 `useEffect` 中,如果你把第二个参数(依赖数组)留空,或者写成 `undefined`,它"
99
- },
100
- {
101
- "q": 4,
102
- "rep": 1,
103
- "version": "0.1.10",
104
- "chars": 214,
105
- "lines": 6,
106
- "errors": 0,
107
- "warns": 1,
108
- "firstLine": "MySQL 索引失效的常见原因有以下几类。 "
109
- },
110
- {
111
- "q": 4,
112
- "rep": 1,
113
- "version": "0.1.11",
114
- "chars": 408,
115
- "lines": 9,
116
- "errors": 0,
117
- "warns": 2,
118
- "firstLine": "MySQL 索引失效的常见原因:"
119
- },
120
- {
121
- "q": 5,
122
- "rep": 1,
123
- "version": "0.1.10",
124
- "chars": 201,
125
- "lines": 3,
126
- "errors": 0,
127
- "warns": 1,
128
- "firstLine": "**结论**:这行日志说明进程因为内存耗尽而被操作系统强制杀掉(OOMKilled),对应的退出码是 137,即 SIG"
129
- },
130
- {
131
- "q": 5,
132
- "rep": 1,
133
- "version": "0.1.11",
134
- "chars": 556,
135
- "lines": 9,
136
- "errors": 0,
137
- "warns": 2,
138
- "firstLine": "OOMKilled exit code 137 means the process was killed by the "
139
- },
140
- {
141
- "q": 6,
142
- "rep": 1,
143
- "version": "0.1.10",
144
- "chars": 71,
145
- "lines": 1,
146
- "errors": 0,
147
- "warns": 0,
148
- "firstLine": "第一步:运行 `vue-upgrade` 命令扫描你的 Vue 2 项目,它会生成一份报告,列出需要手动修复的兼容性问题"
149
- },
150
- {
151
- "q": 6,
152
- "rep": 1,
153
- "version": "0.1.11",
154
- "chars": 524,
155
- "lines": 11,
156
- "errors": 0,
157
- "warns": 1,
158
- "firstLine": "**第一步:跑通 `vue-migration-build`(迁移构建版),把所有兼容模式警告清零。**"
159
- },
160
- {
161
- "q": 7,
162
- "rep": 1,
163
- "version": "0.1.10",
164
- "chars": 420,
165
- "lines": 9,
166
- "errors": 0,
167
- "warns": 1,
168
- "firstLine": "结论:WebAssembly 目前最适合浏览器内的计算密集型任务,以及服务器端的轻量级沙箱与插件扩展;不适合替代 Jav"
169
- },
170
- {
171
- "q": 7,
172
- "rep": 1,
173
- "version": "0.1.11",
174
- "chars": 420,
175
- "lines": 7,
176
- "errors": 0,
177
- "warns": 2,
178
- "firstLine": "WebAssembly(Wasm)当前最适合以下场景:"
179
- },
180
- {
181
- "q": 8,
182
- "rep": 1,
183
- "version": "0.1.10",
184
- "chars": 803,
185
- "lines": 7,
186
- "errors": 0,
187
- "warns": 1,
188
- "firstLine": "按可能性从高到低排查:"
189
- },
190
- {
191
- "q": 8,
192
- "rep": 1,
193
- "version": "0.1.11",
194
- "chars": 98,
195
- "lines": 1,
196
- "errors": 0,
197
- "warns": 1,
198
- "firstLine": "CPU 100%可能性从高到低排序:1.后台进程/服务异常 2.恶意软件/病毒 3.驱动程序冲突/过时 4.应用程序死循"
199
- },
200
- {
201
- "q": 9,
202
- "rep": 1,
203
- "version": "0.1.10",
204
- "chars": 394,
205
- "lines": 8,
206
- "errors": 0,
207
- "warns": 1,
208
- "firstLine": "Postgres VACUUM 必须定期运行,因为它会回收已删除的行(dead tuple)、更新统计信息、防止表膨胀并"
209
- },
210
- {
211
- "q": 9,
212
- "rep": 1,
213
- "version": "0.1.11",
214
- "chars": 434,
215
- "lines": 6,
216
- "errors": 0,
217
- "warns": 2,
218
- "firstLine": "PostgreSQL 的 **VACUUM**(或自动化的 `autovacuum`)每隔一段时间运行,是为了清理死数据"
219
- },
220
- {
221
- "q": 10,
222
- "rep": 1,
223
- "version": "0.1.10",
224
- "chars": 61,
225
- "lines": 2,
226
- "errors": 0,
227
- "warns": 0,
228
- "firstLine": "没收到要修改的 SQL,所以没法给出改后的索引版本。"
229
- },
230
- {
231
- "q": 10,
232
- "rep": 1,
233
- "version": "0.1.11",
234
- "chars": 22,
235
- "lines": 1,
236
- "errors": 0,
237
- "warns": 0,
238
- "firstLine": "请把 SQL 贴过来,我直接给你改好的版本。"
239
- },
240
- {
241
- "q": 11,
242
- "rep": 1,
243
- "version": "0.1.10",
244
- "chars": 232,
245
- "lines": 3,
246
- "errors": 0,
247
- "warns": 1,
248
- "firstLine": "**502 Bad Gateway**:Nginx 作为代理,从上游服务器(比如后端应用、PHP-FPM)收到了一个它认"
249
- },
250
- {
251
- "q": 11,
252
- "rep": 1,
253
- "version": "0.1.11",
254
- "chars": 619,
255
- "lines": 9,
256
- "errors": 1,
257
- "warns": 1,
258
- "firstLine": "**502 Bad Gateway**:Nginx 作为反向代理,成功连上了上游,但上游返回的响应**不合法或无法解析*"
259
- },
260
- {
261
- "q": 12,
262
- "rep": 1,
263
- "version": "0.1.10",
264
- "chars": 707,
265
- "lines": 12,
266
- "errors": 0,
267
- "warns": 2,
268
- "firstLine": "**结论**:OpenTelemetry 通过统一标准和生态,能将埋点接入成本从“每个项目自建”降低到“统一接入”,适合"
269
- },
270
- {
271
- "q": 12,
272
- "rep": 1,
273
- "version": "0.1.11",
274
- "chars": 51,
275
- "lines": 4,
276
- "errors": 1,
277
- "warns": 1,
278
- "firstLine": "{"
279
- }
280
- ]
281
- }
package/test/bench.mjs DELETED
@@ -1,172 +0,0 @@
1
- // 可复现的效果对照:把 npm 上指定版本的规则正文拉下来,用同一组问题分别生成,配对比较。
2
- //
3
- // 用法:
4
- // node test/bench.mjs --versions 0.1.10,0.1.11 --reps 3
5
- // node test/bench.mjs --versions 0.1.10,0.1.12
6
- //
7
- // 需要本地模型网关(默认 http://127.0.0.1:3425/v1/chat/completions),可用 --endpoint 覆盖。
8
- import fs from 'node:fs';
9
- import path from 'node:path';
10
- import os from 'node:os';
11
- import { execFileSync } from 'node:child_process';
12
- import { analyze } from '../dsh/check.js';
13
-
14
- const args = process.argv.slice(2);
15
- const opt = (name, fallback) => {
16
- const i = args.indexOf('--' + name);
17
- return i >= 0 && args[i + 1] ? args[i + 1] : fallback;
18
- };
19
- const VERSIONS = opt('versions', '0.1.10,0.1.11').split(',').map((s) => s.trim()).filter(Boolean);
20
- const REPS = Number(opt('reps', '1'));
21
- const ENDPOINT = opt('endpoint', 'http://127.0.0.1:3425/v1/chat/completions');
22
- const MODEL = opt('model', 'group/free');
23
-
24
- const QUESTIONS = [
25
- 'Kubernetes 的 liveness 和 readiness 探针有什么区别?',
26
- '为什么 git push 会被拒绝 non-fast-forward?',
27
- 'React 的 useEffect 依赖数组留空会怎样?',
28
- 'MySQL 索引失效常见的原因有哪些?',
29
- '这段日志什么意思:OOMKilled exit code 137',
30
- '我要从 Vue2 迁到 Vue3,先做哪一步?',
31
- '调研一下 WebAssembly 现在适合用在什么场景。',
32
- '线上 CPU 突然打满,按可能性从高到低给我排查顺序。',
33
- 'Postgres 的 vacuum 为什么必须定期跑?',
34
- '帮我把这段 SQL 改成走索引,只给改后的语句。',
35
- 'Nginx 502 和 504 分别说明什么?',
36
- '调研一下 OpenTelemetry 相比自建埋点的取舍。',
37
- ];
38
-
39
- const BT = String.fromCharCode(96);
40
- const bodyOf = (src) => {
41
- const s = src.replace(/\r\n/g, '\n');
42
- const i = s.indexOf(BT);
43
- const j = s.indexOf(BT, i + 1);
44
- if (i < 0 || j <= i) throw new Error('rule body not found');
45
- return s.slice(i + 1, j);
46
- };
47
-
48
- // 取指定版本已发布的规则正文;本地未发布时用 --local <version> 直接读工作区
49
- function rulesOf(version) {
50
- const dir = path.join(os.tmpdir(), 'plain-talk-bench', version);
51
- const file = path.join(dir, 'rules.js');
52
- if (fs.existsSync(file)) return bodyOf(fs.readFileSync(file, 'utf8'));
53
- fs.mkdirSync(dir, { recursive: true });
54
- const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
55
- execFileSync(npm, ['pack', 'dsh-plain-talk@' + version, '--pack-destination', dir], {
56
- stdio: 'ignore',
57
- shell: process.platform === 'win32',
58
- });
59
- const tgz = fs.readdirSync(dir).find((f) => f.endsWith('.tgz'));
60
- if (!tgz) throw new Error('pack failed for ' + version);
61
- execFileSync('tar', ['-xzf', path.join(dir, tgz), '-C', dir], { stdio: 'ignore' });
62
- const inner = path.join(dir, 'package', 'dsh', 'rules.js');
63
- const body = bodyOf(fs.readFileSync(inner, 'utf8'));
64
- fs.writeFileSync(file, 'export const RULES = ' + BT + body + BT + ';\n', 'utf8');
65
- return body;
66
- }
67
-
68
- const call = async (system, user) => {
69
- const res = await fetch(ENDPOINT, {
70
- method: 'POST',
71
- headers: { 'content-type': 'application/json' },
72
- body: JSON.stringify({
73
- model: MODEL,
74
- temperature: 0,
75
- messages: [
76
- { role: 'system', content: system },
77
- { role: 'user', content: user },
78
- ],
79
- }),
80
- });
81
- if (!res.ok) throw new Error('http ' + res.status + ' ' + (await res.text()).slice(0, 160));
82
- const json = await res.json();
83
- const text = json.choices?.[0]?.message?.content;
84
- if (!text) throw new Error('empty completion');
85
- return text;
86
- };
87
-
88
- const score = (text) => {
89
- const r = analyze(text, { language: 'zh' });
90
- return {
91
- chars: r.stats.chars,
92
- lines: r.stats.lines,
93
- errors: r.issues.filter((i) => i.severity === 'error').length,
94
- warns: r.issues.filter((i) => i.severity === 'warn').length,
95
- firstLine: text.trim().split(/\n/)[0].slice(0, 60),
96
- };
97
- };
98
-
99
- const arms = VERSIONS.map((v) => ({ version: v, rules: rulesOf(v) }));
100
- const rows = [];
101
- for (let q = 0; q < QUESTIONS.length; q++) {
102
- for (let rep = 1; rep <= REPS; rep++) {
103
- for (const arm of arms) {
104
- try {
105
- rows.push({ q: q + 1, rep, version: arm.version, ...score(await call(arm.rules, QUESTIONS[q])) });
106
- } catch (e) {
107
- rows.push({ q: q + 1, rep, version: arm.version, error: e.message });
108
- }
109
- }
110
- process.stdout.write('.');
111
- }
112
- }
113
- process.stdout.write('\n');
114
-
115
- const agg = (version) => {
116
- const xs = rows.filter((r) => r.version === version && !r.error);
117
- if (!xs.length) return { n: 0 };
118
- const s = (k) => xs.reduce((p, b) => p + b[k], 0);
119
- return {
120
- n: xs.length,
121
- avgChars: Math.round(s('chars') / xs.length),
122
- avgLines: +(s('lines') / xs.length).toFixed(1),
123
- errors: s('errors'),
124
- warns: s('warns'),
125
- };
126
- };
127
-
128
- // 配对:同一题、同一轮次,比较字数与 warn
129
- const pairs = [];
130
- for (let q = 1; q <= QUESTIONS.length; q++) {
131
- for (let rep = 1; rep <= REPS; rep++) {
132
- const xs = rows.filter((r) => r.q === q && r.rep === rep && !r.error);
133
- if (xs.length < 2) continue;
134
- for (let i = 0; i < xs.length; i++) for (let j = i + 1; j < xs.length; j++) {
135
- pairs.push({
136
- pair: xs[i].version + '/' + xs[j].version,
137
- chars: xs[j].chars - xs[i].chars,
138
- warns: xs[j].warns - xs[i].warns,
139
- });
140
- }
141
- }
142
- }
143
- const pairSummary = {};
144
- for (const p of pairs) {
145
- const acc = (pairSummary[p.pair] = pairSummary[p.pair] || { n: 0, charsDelta: 0, warnsDelta: 0, shorter: 0, longer: 0 });
146
- acc.n++;
147
- acc.charsDelta += p.chars; // >0 表示后者更长
148
- acc.warnsDelta += p.warns;
149
- if (p.chars > 0) acc.longer++;
150
- else if (p.chars < 0) acc.shorter++;
151
- }
152
- for (const k of Object.keys(pairSummary)) {
153
- const a = pairSummary[k];
154
- a.avgCharsDelta = Math.round(a.charsDelta / a.n);
155
- a.avgWarnsDelta = +(a.warnsDelta / a.n).toFixed(2);
156
- }
157
-
158
- const summary = {
159
- versions: VERSIONS,
160
- reps: REPS,
161
- questions: QUESTIONS.length,
162
- runs: rows.filter((r) => !r.error).length,
163
- model: MODEL,
164
- arms: Object.fromEntries(VERSIONS.map((v) => [v, agg(v)]).filter(([, a]) => a.n)),
165
- pairs: pairSummary,
166
- };
167
- console.log('=== SUMMARY ===');
168
- console.log(JSON.stringify(summary, null, 1));
169
-
170
- const out = 'test/bench-result.json';
171
- fs.writeFileSync(out, JSON.stringify({ summary, rows }, null, 2), 'utf8');
172
- console.log('\nwritten ' + out);
@@ -1,21 +0,0 @@
1
- // 判定网关是否可复现:同一 system+user 连续调用 3 次,比较输出。
2
- const ENDPOINT = 'http://127.0.0.1:3425/v1/chat/completions';
3
- const sys = '读者只看这一条回复就要能做决定。先给结论,再给必要细节。默认不超过 12 行、300 字。';
4
- const user = 'Nginx 502 和 504 分别说明什么?';
5
-
6
- const call = async () => {
7
- const res = await fetch(ENDPOINT, {
8
- method: 'POST',
9
- headers: { 'content-type': 'application/json' },
10
- body: JSON.stringify({ model: 'group/free', temperature: 0, messages: [{ role: 'system', content: sys }, { role: 'user', content: user }] }),
11
- });
12
- const j = await res.json();
13
- return j.choices?.[0]?.message?.content ?? '';
14
- };
15
-
16
- const outs = [];
17
- for (let i = 0; i < 3; i++) outs.push(await call());
18
- console.log('lengths:', outs.map((o) => o.length).join(', '));
19
- console.log('identical:', outs[0] === outs[1] && outs[1] === outs[2]);
20
- console.log('unique outputs:', new Set(outs).size);
21
- for (const [i, o] of outs.entries()) console.log('--- run ' + (i + 1) + ' ---\n' + o.slice(0, 220));
package/test/noise.json DELETED
@@ -1,58 +0,0 @@
1
- {
2
- "data": {
3
- "v0.1.10": {
4
- "Nginx 502 和 504 分别说明什么?": [
5
- 345,
6
- 176,
7
- 326,
8
- 243
9
- ],
10
- "为什么 git push 会被拒绝 non-fast-forward?": [
11
- 352,
12
- 258,
13
- 319,
14
- 274
15
- ],
16
- "调研一下 WebAssembly 现在适合用在什么场景。": [
17
- 50,
18
- 364,
19
- 385,
20
- 382
21
- ],
22
- "线上 CPU 突然打满,按可能性从高到低给我排查顺序。": [
23
- 478,
24
- 508,
25
- 410,
26
- 496
27
- ]
28
- },
29
- "v0.1.11": {
30
- "Nginx 502 和 504 分别说明什么?": [
31
- 384,
32
- 361,
33
- 361,
34
- 346
35
- ],
36
- "为什么 git push 会被拒绝 non-fast-forward?": [
37
- 428,
38
- 225,
39
- 601,
40
- 724
41
- ],
42
- "调研一下 WebAssembly 现在适合用在什么场景。": [
43
- 741,
44
- 962,
45
- 862,
46
- 2143
47
- ],
48
- "线上 CPU 突然打满,按可能性从高到低给我排查顺序。": [
49
- 1104,
50
- 538,
51
- 691,
52
- 663
53
- ]
54
- }
55
- },
56
- "noiseFloor": 1402,
57
- "meanDiff": 256
58
- }
package/test/noise.mjs DELETED
@@ -1,77 +0,0 @@
1
- // 先量噪声底:同一规则、同一问题重复采样,看字数波动有多大;
2
- // 再比两版规则的中位数差,判断差异是否超过噪声。
3
- import fs from 'node:fs';
4
- import { analyze } from '../dsh/check.js';
5
-
6
- const bt = String.fromCharCode(96);
7
- const bodyOf = (p) => {
8
- const s = fs.readFileSync(p, 'utf8').replace(/\r\n/g, '\n');
9
- const i = s.indexOf(bt);
10
- const j = s.indexOf(bt, i + 1);
11
- return s.slice(i + 1, j);
12
- };
13
- const base = 'C:/Users/lizilong/AppData/Local/Temp/pt-verify';
14
- const ARMS = [
15
- ['v0.1.10', bodyOf(base + '/pkg-0.1.10/package/dsh/rules.js')],
16
- ['v0.1.11', bodyOf(base + '/pkg-0.1.11/package/dsh/rules.js')],
17
- ];
18
- const QUESTIONS = [
19
- 'Nginx 502 和 504 分别说明什么?',
20
- '为什么 git push 会被拒绝 non-fast-forward?',
21
- '调研一下 WebAssembly 现在适合用在什么场景。',
22
- '线上 CPU 突然打满,按可能性从高到低给我排查顺序。',
23
- ];
24
- const N = 4; // 每臂每题采样次数
25
-
26
- const call = async (system, user) => {
27
- const res = await fetch('http://127.0.0.1:3425/v1/chat/completions', {
28
- method: 'POST',
29
- headers: { 'content-type': 'application/json' },
30
- body: JSON.stringify({ model: 'group/free', temperature: 0, messages: [{ role: 'system', content: system }, { role: 'user', content: user }] }),
31
- });
32
- if (!res.ok) throw new Error('http ' + res.status);
33
- const j = await res.json();
34
- return j.choices?.[0]?.message?.content ?? '';
35
- };
36
- const chars = (t) => analyze(t, { language: 'zh' }).stats.chars;
37
-
38
- const data = {};
39
- for (const [armName, rules] of ARMS) {
40
- for (const q of QUESTIONS) {
41
- data[armName] = data[armName] || {};
42
- data[armName][q] = [];
43
- for (let i = 0; i < N; i++) data[armName][q].push(chars(await call(rules, q)));
44
- process.stdout.write('.');
45
- }
46
- }
47
- process.stdout.write('\n');
48
-
49
- const median = (xs) => {
50
- const s = [...xs].sort((a, b) => a - b);
51
- const m = Math.floor(s.length / 2);
52
- return s.length % 2 ? s[m] : Math.round((s[m - 1] + s[m]) / 2);
53
- };
54
- const spread = (xs) => Math.max(...xs) - Math.min(...xs);
55
-
56
- console.log('\nquestion\tarm\tsamples\tmedian\trange');
57
- let noiseFloor = 0;
58
- for (const q of QUESTIONS) {
59
- for (const [arm] of ARMS) {
60
- const xs = data[arm][q];
61
- const sp = spread(xs);
62
- noiseFloor = Math.max(noiseFloor, sp);
63
- console.log([q.slice(0, 18), arm, xs.join('/'), median(xs), sp].join('\t'));
64
- }
65
- }
66
- console.log('\nnoise floor (max within-arm range):', noiseFloor);
67
- console.log('\nBetween-arm median diff per question:');
68
- const diffs = [];
69
- for (const q of QUESTIONS) {
70
- const d = median(data[ARMS[1][0]][q]) - median(data[ARMS[0][0]][q]);
71
- diffs.push(d);
72
- console.log(' ' + q.slice(0, 18) + ' -> ' + d + ' chars');
73
- }
74
- const meanDiff = Math.round(diffs.reduce((a, b) => a + b, 0) / diffs.length);
75
- console.log('mean diff (0.1.11 - 0.1.10):', meanDiff, '| noise floor:', noiseFloor,
76
- '| verdict:', Math.abs(meanDiff) > noiseFloor ? 'difference exceeds noise' : 'INDISTINGUISHABLE from noise');
77
- fs.writeFileSync('test/noise.json', JSON.stringify({ data, noiseFloor, meanDiff }, null, 2), 'utf8');
package/test/rules-v4.mjs DELETED
@@ -1,36 +0,0 @@
1
- export const V4 = `# 说人话(回复优化)
2
-
3
- 读者只看这一条回复就要能做决定。先给结论,再给必要细节。信息不够就直说缺什么、要什么,别猜;要是有能自己跑的做法,就把命令给出来。别答得像已经查过。
4
-
5
- ## 长度
6
- - 写到把事说清为止:一句话够就别写三段,步骤多、要给证据就写长;别为短漏关键步骤,也别为长注水。结论始终在第一行。
7
- - 不写"好的/我来看看/让我先…/希望这有帮助";不复述问题;不汇报你准备怎么做。
8
- - 不写过程日记("我先…然后…")。只写结果、判断和可验证的事实。
9
- - 工具调用之间的进度说明同样适用:用用户的语言,一句话(≤2 行);不需要说明就直接调工具。
10
- - 列清单就一条一件事,最多 5 条,别用分号把三件事挤进一行。只给一个下一步,没有就不写。结尾不要问"还需要我做什么"。
11
-
12
- ## 自包含
13
- - 不用"上述/前面/之前提到的/上一轮/前者/后者/刚才";要指代就重说一遍。
14
- - 代号、任务号、版本号、提交号、模块名(如 EXP-7、DEV-1K、run-3)第一次出现时写清它是什么:EXP-7(把实例校验加进推理流程的实验编号)。之后可以直接用。
15
- - 但用户在本对话里用过的词、项目名、常见术语(arXiv、DOI、API、GPU 等)默认读者已经懂,不要解释,也不要改写成别的说法。
16
- - 用户让你"调研 / 研究 / 查一下 X"时,第一遍回复默认读者还不了解 X,先把它讲清楚;这条回复交付之后,X 才进入词汇清单。
17
- - 内部代号(EXP-7、DEV-1K、run-3 这类)不进入词汇清单:每次出现都按未知处理,第一次出现时解释。
18
- - 不出现会话号、子代理、父会话、工具名等内部信息。
19
-
20
- ## 引用与数字
21
- - 引用文件、日志、网页时直接贴出那几行原文;只给"文件名:行号"不算证据。
22
- - 数字给单位和对照:"61.2% → 63.8%",不写"明显提升"。
23
-
24
- ## 语言
25
- - 用用户最近一条消息的语言回复。思考过程可以用英文。
26
- - 代码、命令、路径、报错原文保持原样,不翻译、不缩写。
27
-
28
- ## 执行类回复
29
- 用户给过计划、任务清单或验收要求时,第一行给结论:达标 / 部分达标 / 未达标,并点明哪几条没达标。
30
- 验收标准只用用户原话,不自己发明。然后按顺序:做了什么 → 没做到什么 → 用户怎么自己确认(贴出应看到的内容)→ 一个下一步。
31
-
32
- ## 收尾自检
33
- 完成类回复或超过 12 行的回复,发送前调用 plain_talk_check;把 error 全部改掉,warn 逐条判断。
34
-
35
- ## 覆盖规则
36
- 用户说"展开讲/详细说明"时,保留结论先行,正文可以长。破坏性操作仍然先确认。harness 规则优先于本节。`;
package/test/rules-v4.txt DELETED
@@ -1,36 +0,0 @@
1
- # 说人话(回复优化)
2
-
3
- 读者只看这一条回复就要能做决定。先给结论,再给必要细节。信息不够就直说缺什么、要什么,别猜;要是有能自己跑的做法,就把命令给出来。别答得像已经查过。
4
-
5
- ## 长度
6
- - 写到把事说清为止:一句话够就别写三段,步骤多、要给证据就写长;别为短漏关键步骤,也别为长注水。结论始终在第一行。
7
- - 不写"好的/我来看看/让我先…/希望这有帮助";不复述问题;不汇报你准备怎么做。
8
- - 不写过程日记("我先…然后…")。只写结果、判断和可验证的事实。
9
- - 工具调用之间的进度说明同样适用:用用户的语言,一句话(≤2 行);不需要说明就直接调工具。
10
- - 列清单就一条一件事,最多 5 条,别用分号把三件事挤进一行。只给一个下一步,没有就不写。结尾不要问"还需要我做什么"。
11
-
12
- ## 自包含
13
- - 不用"上述/前面/之前提到的/上一轮/前者/后者/刚才";要指代就重说一遍。
14
- - 代号、任务号、版本号、提交号、模块名(如 EXP-7、DEV-1K、run-3)第一次出现时写清它是什么:EXP-7(把实例校验加进推理流程的实验编号)。之后可以直接用。
15
- - 但用户在本对话里用过的词、项目名、常见术语(arXiv、DOI、API、GPU 等)默认读者已经懂,不要解释,也不要改写成别的说法。
16
- - 用户让你"调研 / 研究 / 查一下 X"时,第一遍回复默认读者还不了解 X,先把它讲清楚;这条回复交付之后,X 才进入词汇清单。
17
- - 内部代号(EXP-7、DEV-1K、run-3 这类)不进入词汇清单:每次出现都按未知处理,第一次出现时解释。
18
- - 不出现会话号、子代理、父会话、工具名等内部信息。
19
-
20
- ## 引用与数字
21
- - 引用文件、日志、网页时直接贴出那几行原文;只给"文件名:行号"不算证据。
22
- - 数字给单位和对照:"61.2% → 63.8%",不写"明显提升"。
23
-
24
- ## 语言
25
- - 用用户最近一条消息的语言回复。思考过程可以用英文。
26
- - 代码、命令、路径、报错原文保持原样,不翻译、不缩写。
27
-
28
- ## 执行类回复
29
- 用户给过计划、任务清单或验收要求时,第一行给结论:达标 / 部分达标 / 未达标,并点明哪几条没达标。
30
- 验收标准只用用户原话,不自己发明。然后按顺序:做了什么 → 没做到什么 → 用户怎么自己确认(贴出应看到的内容)→ 一个下一步。
31
-
32
- ## 收尾自检
33
- 完成类回复或超过 12 行的回复,发送前调用 plain_talk_check;把 error 全部改掉,warn 逐条判断。
34
-
35
- ## 覆盖规则
36
- 用户说"展开讲/详细说明"时,保留结论先行,正文可以长。破坏性操作仍然先确认。harness 规则优先于本节。