pi-think-anchor 1.0.24 → 1.0.26
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/README.md +180 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,91 @@ pi install npm:pi-think-anchor
|
|
|
56
56
|
| `bands.spec/react` | `1.2 / 0.5` | 旧版兼容(无 `score` 时生效) |
|
|
57
57
|
|
|
58
58
|
其他:日志 `~/.pi/think-anchor.jsonl`(1 MiB 截断,保留尾部整行)。
|
|
59
|
+
**词表覆盖规则(源码事实)**
|
|
60
|
+
|
|
61
|
+
- 三个键独立覆盖:只写想改的那个,其余保留默认(`lexicon` 按子键浅合并)。
|
|
62
|
+
- 数组是 **整体替换**,不是追加:写 `positive` 就会替换掉默认 28 词。
|
|
63
|
+
- 想在默认基础上加词 → 复制下面的完整数组再往里加。
|
|
64
|
+
- `neutral` 默认空数组,写进去才按 `weights.beta` 计入比率。
|
|
65
|
+
- 非法 JSON 整份配置回退默认。
|
|
66
|
+
|
|
67
|
+
完整配置(可直接复制到 `~/.pi/think-anchor.json`,含默认词表):
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"enabled": true,
|
|
72
|
+
"score": {
|
|
73
|
+
"minHits": 3,
|
|
74
|
+
"spec": 1.2,
|
|
75
|
+
"react": 0.5,
|
|
76
|
+
"alpha": 1
|
|
77
|
+
},
|
|
78
|
+
"windowSize": 5,
|
|
79
|
+
"weights": {
|
|
80
|
+
"beta": 0.4,
|
|
81
|
+
"eps": 0.5
|
|
82
|
+
},
|
|
83
|
+
"intervention": {
|
|
84
|
+
"l1CooldownMin": 10,
|
|
85
|
+
"l2CooldownMin": 15,
|
|
86
|
+
"maxL2": 2
|
|
87
|
+
},
|
|
88
|
+
"lexicon": {
|
|
89
|
+
"positive": [
|
|
90
|
+
"我们需要",
|
|
91
|
+
"我们将",
|
|
92
|
+
"我要",
|
|
93
|
+
"直接",
|
|
94
|
+
"下一步",
|
|
95
|
+
"关键是",
|
|
96
|
+
"结论",
|
|
97
|
+
"根本原因",
|
|
98
|
+
"失败原因",
|
|
99
|
+
"执行",
|
|
100
|
+
"验证",
|
|
101
|
+
"检查",
|
|
102
|
+
"核对",
|
|
103
|
+
"确认",
|
|
104
|
+
"修复",
|
|
105
|
+
"同步",
|
|
106
|
+
"提交",
|
|
107
|
+
"收尾",
|
|
108
|
+
"落盘",
|
|
109
|
+
"更新",
|
|
110
|
+
"测试",
|
|
111
|
+
"完成",
|
|
112
|
+
"清理",
|
|
113
|
+
"we need",
|
|
114
|
+
"we'll",
|
|
115
|
+
"we will",
|
|
116
|
+
"i will",
|
|
117
|
+
"next step"
|
|
118
|
+
],
|
|
119
|
+
"negative": [
|
|
120
|
+
"让我",
|
|
121
|
+
"来看看",
|
|
122
|
+
"也许",
|
|
123
|
+
"或许",
|
|
124
|
+
"可能",
|
|
125
|
+
"或者",
|
|
126
|
+
"要不",
|
|
127
|
+
"先试试",
|
|
128
|
+
"随便",
|
|
129
|
+
"不太确定",
|
|
130
|
+
"好像",
|
|
131
|
+
"不知道",
|
|
132
|
+
"let me",
|
|
133
|
+
"let's",
|
|
134
|
+
"maybe",
|
|
135
|
+
"perhaps",
|
|
136
|
+
"i guess",
|
|
137
|
+
"not sure"
|
|
138
|
+
],
|
|
139
|
+
"neutral": []
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
59
144
|
|
|
60
145
|
## 命令
|
|
61
146
|
|
|
@@ -77,12 +162,12 @@ pi install npm:pi-think-anchor
|
|
|
77
162
|
flowchart TD
|
|
78
163
|
A[turn_end<br/>读 assistant thinking] --> B[词频指纹 pos/neg/neu]
|
|
79
164
|
B --> C{本轮命中 >= minHits?}
|
|
80
|
-
C
|
|
165
|
+
C -->|否:只推进窗口| A
|
|
81
166
|
C -->|是| D[滑窗聚合 + alpha 平滑比率]
|
|
82
167
|
D --> E{波段}
|
|
83
|
-
E -->|spec
|
|
84
|
-
E -->|mixed
|
|
85
|
-
E -->|react| H[
|
|
168
|
+
E -->|spec:静默| A
|
|
169
|
+
E -->|mixed:观察| A
|
|
170
|
+
E -->|react| H[状态机 L1 / L2]
|
|
86
171
|
H -->|nextTurn 尾部消息| A
|
|
87
172
|
```
|
|
88
173
|
|
|
@@ -94,7 +179,7 @@ flowchart TD
|
|
|
94
179
|
flowchart TD
|
|
95
180
|
A[你说的话] --> B[教练看用词]
|
|
96
181
|
B --> C{清晰吗}
|
|
97
|
-
C -->|清晰|
|
|
182
|
+
C -->|清晰| A
|
|
98
183
|
C -->|有点散| E[轻提醒]
|
|
99
184
|
C -->|一直散| F[认真提醒]
|
|
100
185
|
E --> A
|
|
@@ -164,6 +249,91 @@ Config file `~/.pi/think-anchor.json` (optional; defaults apply, invalid JSON fa
|
|
|
164
249
|
| `bands.spec/react` | `1.2 / 0.5` | Legacy keys (used when `score` is absent) |
|
|
165
250
|
|
|
166
251
|
Also: log `~/.pi/think-anchor.jsonl` (1 MiB truncation, tail-preserving).
|
|
252
|
+
**Lexicon override rules (from source)**
|
|
253
|
+
|
|
254
|
+
- Keys merge independently: write only what you change; the rest keep defaults (`lexicon` merges per sub-key).
|
|
255
|
+
- An array is **replaced wholesale**, never appended: writing `positive` replaces all 28 defaults.
|
|
256
|
+
- To add words on top of the defaults, copy the full array below and insert yours.
|
|
257
|
+
- `neutral` defaults to empty; words you add count with `weights.beta`.
|
|
258
|
+
- Invalid JSON falls back to the whole default config.
|
|
259
|
+
|
|
260
|
+
Full config (copy-paste ready, includes the default lexicon):
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
{
|
|
264
|
+
"enabled": true,
|
|
265
|
+
"score": {
|
|
266
|
+
"minHits": 3,
|
|
267
|
+
"spec": 1.2,
|
|
268
|
+
"react": 0.5,
|
|
269
|
+
"alpha": 1
|
|
270
|
+
},
|
|
271
|
+
"windowSize": 5,
|
|
272
|
+
"weights": {
|
|
273
|
+
"beta": 0.4,
|
|
274
|
+
"eps": 0.5
|
|
275
|
+
},
|
|
276
|
+
"intervention": {
|
|
277
|
+
"l1CooldownMin": 10,
|
|
278
|
+
"l2CooldownMin": 15,
|
|
279
|
+
"maxL2": 2
|
|
280
|
+
},
|
|
281
|
+
"lexicon": {
|
|
282
|
+
"positive": [
|
|
283
|
+
"我们需要",
|
|
284
|
+
"我们将",
|
|
285
|
+
"我要",
|
|
286
|
+
"直接",
|
|
287
|
+
"下一步",
|
|
288
|
+
"关键是",
|
|
289
|
+
"结论",
|
|
290
|
+
"根本原因",
|
|
291
|
+
"失败原因",
|
|
292
|
+
"执行",
|
|
293
|
+
"验证",
|
|
294
|
+
"检查",
|
|
295
|
+
"核对",
|
|
296
|
+
"确认",
|
|
297
|
+
"修复",
|
|
298
|
+
"同步",
|
|
299
|
+
"提交",
|
|
300
|
+
"收尾",
|
|
301
|
+
"落盘",
|
|
302
|
+
"更新",
|
|
303
|
+
"测试",
|
|
304
|
+
"完成",
|
|
305
|
+
"清理",
|
|
306
|
+
"we need",
|
|
307
|
+
"we'll",
|
|
308
|
+
"we will",
|
|
309
|
+
"i will",
|
|
310
|
+
"next step"
|
|
311
|
+
],
|
|
312
|
+
"negative": [
|
|
313
|
+
"让我",
|
|
314
|
+
"来看看",
|
|
315
|
+
"也许",
|
|
316
|
+
"或许",
|
|
317
|
+
"可能",
|
|
318
|
+
"或者",
|
|
319
|
+
"要不",
|
|
320
|
+
"先试试",
|
|
321
|
+
"随便",
|
|
322
|
+
"不太确定",
|
|
323
|
+
"好像",
|
|
324
|
+
"不知道",
|
|
325
|
+
"let me",
|
|
326
|
+
"let's",
|
|
327
|
+
"maybe",
|
|
328
|
+
"perhaps",
|
|
329
|
+
"i guess",
|
|
330
|
+
"not sure"
|
|
331
|
+
],
|
|
332
|
+
"neutral": []
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
167
337
|
|
|
168
338
|
## Commands
|
|
169
339
|
|
|
@@ -185,14 +355,13 @@ Also: log `~/.pi/think-anchor.jsonl` (1 MiB truncation, tail-preserving).
|
|
|
185
355
|
flowchart TD
|
|
186
356
|
A[turn_end<br/>read assistant thinking] --> B[word fingerprint pos/neg/neu]
|
|
187
357
|
B --> C{hits >= minHits?}
|
|
188
|
-
C -->|no
|
|
358
|
+
C -->|no: window only| A
|
|
189
359
|
C -->|yes| D[sliding window + alpha-smoothed ratio]
|
|
190
360
|
D --> E{band}
|
|
191
|
-
E -->|spec
|
|
192
|
-
E -->|mixed|
|
|
193
|
-
E -->|react| H[state machine
|
|
361
|
+
E -->|spec: silent| A
|
|
362
|
+
E -->|mixed: watch| A
|
|
363
|
+
E -->|react| H[state machine L1 / L2]
|
|
194
364
|
H -->|nextTurn message| A
|
|
195
|
-
|
|
196
365
|
```
|
|
197
366
|
|
|
198
367
|
## How it works (plain words)
|
|
@@ -203,7 +372,7 @@ flowchart TD
|
|
|
203
372
|
flowchart TD
|
|
204
373
|
A[what you say] --> B[coach reads wording]
|
|
205
374
|
B --> C{focused?}
|
|
206
|
-
C -->|yes|
|
|
375
|
+
C -->|yes| A
|
|
207
376
|
C -->|slightly off| E[gentle nudge]
|
|
208
377
|
C -->|drifting| F[stronger nudge]
|
|
209
378
|
E --> A
|