pi-think-anchor 1.0.23 → 1.0.25

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.
Files changed (2) hide show
  1. package/README.md +172 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -52,10 +52,95 @@ pi install npm:pi-think-anchor
52
52
  | `intervention.l1CooldownMin` | `10` | L1 冷却(分钟) |
53
53
  | `intervention.l2CooldownMin` | `15` | L2 冷却(分钟) |
54
54
  | `intervention.maxL2` | `2` | 每会话 L2 上限 |
55
- | `lexicon.positive/negative/neutral` | 内置中文词表(专注 28 词 / 发散 18 词) | 词表覆盖 |
55
+ | `lexicon.positive/negative/neutral` | 专注 28 词 / 发散 18 词 / 中性 **默认空** | 词表覆盖 |
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
 
@@ -160,10 +245,95 @@ Config file `~/.pi/think-anchor.json` (optional; defaults apply, invalid JSON fa
160
245
  | `intervention.l1CooldownMin` | `10` | L1 cooldown (minutes) |
161
246
  | `intervention.l2CooldownMin` | `15` | L2 cooldown (minutes) |
162
247
  | `intervention.maxL2` | `2` | Max L2 per session |
163
- | `lexicon.positive/negative/neutral` | built-in Chinese lexicon (28 focus / 18 drift) | Lexicon override |
248
+ | `lexicon.positive/negative/neutral` | 28 focus / 18 drift / neutral **empty by default** | Lexicon override |
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-think-anchor",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Monitors thinking focus drift and nudges the model back on track.",
5
5
  "type": "module",
6
6
  "license": "MIT",