pi-think-anchor 1.0.29 → 1.0.30
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 +18 -4
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
# pi-think-anchor
|
|
9
9
|
|
|
10
|
+
> 适用 pi ≥ 0.74 · Node ≥ 20 · MIT · 无运行时依赖(仅 peer: @earendil-works/pi-coding-agent)
|
|
11
|
+
|
|
10
12
|
思维链锚定监测:读取 thinking 的词频指纹,判定专注 / 过渡 / 发散,发散时分级提示。
|
|
11
13
|
|
|
12
14
|
## 快速事实
|
|
@@ -14,7 +16,7 @@
|
|
|
14
16
|
| 项 | 说明 |
|
|
15
17
|
| --- | --- |
|
|
16
18
|
| 配置文件 | ~/.pi/think-anchor.json(可省略) |
|
|
17
|
-
| 命令行 | /think-anchor [on
|
|
19
|
+
| 命令行 | /think-anchor [on, off, reset, stats] |
|
|
18
20
|
| 调用方式 | **全自动**:turn_end 评估 + 条件注入。on/off 只改当前会话内存(不写文件),重启后回到配置文件的值 |
|
|
19
21
|
|
|
20
22
|
## 安装
|
|
@@ -139,7 +141,13 @@ pi install npm:pi-think-anchor
|
|
|
139
141
|
## 作用(源码事实)
|
|
140
142
|
|
|
141
143
|
- `turn_end`:取 assistant 消息 thinking → 指纹(pos/neg/neu)→ 滑窗聚合 → 判波段;本轮命中 < `minHits` 时只推进窗口。
|
|
142
|
-
- 状态机 `healthy → warning → critical`;L1/L2 干预以 `nextTurn`
|
|
144
|
+
- 状态机 `healthy → warning → critical`;L1/L2 干预以 `nextTurn` 尾部消息回灌(`display: false`),文本里带当前比率、命中量与触发阈值(如「比率 0.48 · 命中 22;react<0.5」)——让模型看到依据,而不是只收到一句指令。
|
|
145
|
+
**注入样例(示意,字段可能随版本增删)**
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
think-anchor 信号(词频启发式,非判据):连续偏离。动作:停止探索,立即执行一个具体动作。(比率 0.48 · 命中 22;L2 1/2)
|
|
149
|
+
```
|
|
150
|
+
|
|
143
151
|
- 无效不升级:上次 `eff >= 0` 时 L2 降为 L1。
|
|
144
152
|
- `session_start`:重置状态机,仅保留最近 3 条与 pending(跨会话结算)。
|
|
145
153
|
|
|
@@ -194,7 +202,7 @@ Chain-of-thought drift monitor: reads a word-frequency fingerprint from thinking
|
|
|
194
202
|
| Item | Description |
|
|
195
203
|
| --- | --- |
|
|
196
204
|
| Config file | ~/.pi/think-anchor.json (optional) |
|
|
197
|
-
| Commands | /think-anchor [on
|
|
205
|
+
| Commands | /think-anchor [on, off, reset, stats] |
|
|
198
206
|
| Automation | **Fully automatic**: evaluated on turn_end, injects only when needed. on/off changes in-memory state only (not written to disk); a restart falls back to the config file |
|
|
199
207
|
|
|
200
208
|
Full config (all keys and defaults):
|
|
@@ -321,7 +329,13 @@ Full config (copy-paste ready, includes the default lexicon):
|
|
|
321
329
|
## What it does (source facts)
|
|
322
330
|
|
|
323
331
|
- `turn_end`: reads assistant thinking -> fingerprint (pos/neg/neu) -> sliding window -> band; when hits < `minHits` it only advances the window.
|
|
324
|
-
- State machine `healthy -> warning -> critical`; L1/L2 nudges are
|
|
332
|
+
- State machine `healthy -> warning -> critical`; L1/L2 nudges are fed back as `nextTurn` trailing messages (`display: false`), carrying the current ratio, hit count and the triggering threshold (e.g. ratio 0.48, 22 hits, react<0.5) so the model sees the evidence, not just an order.
|
|
333
|
+
**Sample injection (illustrative; fields may change between versions)**
|
|
334
|
+
|
|
335
|
+
```text
|
|
336
|
+
think-anchor signal (heuristic, not a verdict): sustained drift. Action: stop exploring, execute one concrete step. (ratio 0.48 · 22 hits; L2 1/2)
|
|
337
|
+
```
|
|
338
|
+
|
|
325
339
|
- No escalation: when the previous `eff >= 0`, L2 degrades to L1.
|
|
326
340
|
- `session_start`: resets state, keeping only the last 3 samples and pending (cross-session settlement).
|
|
327
341
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-think-anchor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "Monitors thinking focus drift and nudges the model back on track.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
"pi",
|
|
9
9
|
"pi-extension",
|
|
10
10
|
"pi-coding-agent",
|
|
11
|
-
"pi-package"
|
|
11
|
+
"pi-package",
|
|
12
|
+
"chain-of-thought",
|
|
13
|
+
"focus",
|
|
14
|
+
"monitoring",
|
|
15
|
+
"drift"
|
|
12
16
|
],
|
|
13
17
|
"pi": {
|
|
14
18
|
"extensions": [
|
|
@@ -25,7 +29,7 @@
|
|
|
25
29
|
"@earendil-works/pi-coding-agent": "*"
|
|
26
30
|
},
|
|
27
31
|
"author": "15066212pp",
|
|
28
|
-
"homepage": "https://github.com/op15066212/pi-plugins-publish/tree/main/pi-think-anchor",
|
|
32
|
+
"homepage": "https://github.com/op15066212/pi-plugins-publish/tree/main/pi-think-anchor#readme",
|
|
29
33
|
"bugs": {
|
|
30
34
|
"url": "https://github.com/op15066212/pi-plugins-publish/issues"
|
|
31
35
|
},
|
|
@@ -36,5 +40,8 @@
|
|
|
36
40
|
},
|
|
37
41
|
"scripts": {
|
|
38
42
|
"prepublishOnly": "node ../publish-check.mjs"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20"
|
|
39
46
|
}
|
|
40
47
|
}
|