pi-think-anchor 1.0.14 → 1.0.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.
- package/README.md +65 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="#zh"><img alt="中文" src="https://img.shields.io/badge/%E4%B8%AD%E6%96%87-%E4%B8%AD%E6%96%87-2F81F7?style=for-the-badge"></a>
|
|
3
|
+
<a href="#english"><img alt="English" src="https://img.shields.io/badge/English-EN-FF6B35?style=for-the-badge"></a>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<a id="zh"></a>
|
|
7
|
+
|
|
1
8
|
# pi-think-anchor
|
|
2
9
|
|
|
3
10
|
思维链锚定监测:读取 thinking 的词频指纹,判定专注 / 过渡 / 发散,发散时分级提示。
|
|
@@ -51,3 +58,61 @@ pi install npm:pi-think-anchor
|
|
|
51
58
|
## License
|
|
52
59
|
|
|
53
60
|
MIT
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
<a id="english"></a>
|
|
65
|
+
|
|
66
|
+
<h1 align="center">🌐 English Version ⬇️</h1>
|
|
67
|
+
|
|
68
|
+
Chain-of-thought drift monitor: reads a word-frequency fingerprint from thinking, classifies focused / mixed / reactive, and nudges when drifting.
|
|
69
|
+
|
|
70
|
+
## Install
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pi install npm:pi-think-anchor
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Configuration
|
|
77
|
+
|
|
78
|
+
Config file `~/.pi/think-anchor.json` (optional; defaults apply, invalid JSON falls back):
|
|
79
|
+
|
|
80
|
+
| Key | Default | Description |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| `enabled` | `true` | Master switch |
|
|
83
|
+
| `score.minHits` | `3` | Fewer hits in a turn: no scoring, no intervention |
|
|
84
|
+
| `score.spec` | `1.2` | Focused threshold |
|
|
85
|
+
| `score.react` | `0.5` | Reactive threshold |
|
|
86
|
+
| `score.alpha` | `1` | Alpha smoothing |
|
|
87
|
+
| `windowSize` | `5` | Window size in messages |
|
|
88
|
+
| `weights.beta` | `0.4` | Neutral-word weight in the numerator |
|
|
89
|
+
| `weights.eps` | `0.5` | Denominator floor |
|
|
90
|
+
| `intervention.l1CooldownMin` | `10` | L1 cooldown (minutes) |
|
|
91
|
+
| `intervention.l2CooldownMin` | `15` | L2 cooldown (minutes) |
|
|
92
|
+
| `intervention.maxL2` | `2` | Max L2 per session |
|
|
93
|
+
| `lexicon.positive/negative/neutral` | built-in Chinese lexicon (28 focus / 18 drift) | Lexicon override |
|
|
94
|
+
| `bands.spec/react` | `1.2 / 0.5` | Legacy keys (used when `score` is absent) |
|
|
95
|
+
|
|
96
|
+
Also: `THINK_ANCHOR=0` hard off; log `~/.pi/think-anchor.jsonl` (1 MiB truncation, tail-preserving).
|
|
97
|
+
|
|
98
|
+
## Commands
|
|
99
|
+
|
|
100
|
+
| Command | Purpose |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `/think-anchor` | Current band, hits, drift share, last intervention result |
|
|
103
|
+
| `/think-anchor stats` | Version, band distribution, actions, effectiveness, log size |
|
|
104
|
+
|
|
105
|
+
## What it does (source facts)
|
|
106
|
+
|
|
107
|
+
- `turn_end`: reads assistant thinking -> fingerprint (pos/neg/neu) -> sliding window -> band; when hits < `minHits` it only advances the window.
|
|
108
|
+
- State machine `healthy -> warning -> critical`; L1/L2 nudges are injected as `nextTurn` trailing messages.
|
|
109
|
+
- No escalation: when the previous `eff >= 0`, L2 degrades to L1.
|
|
110
|
+
- `session_start`: resets state, keeping only the last 3 samples and pending (cross-session settlement).
|
|
111
|
+
|
|
112
|
+
## Credits
|
|
113
|
+
|
|
114
|
+
Distilled from the DSH plugin [`dsh-anchored-monitor`](https://dsh-plugin.org/zh/plugins/aik358/dsh-anchored-monitor) 0.3.1: the mechanism is upstream, the code is not (turn-level, no separate process).
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
MIT
|