pi-okf-memory 0.1.0 → 0.1.1
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.en.md +30 -0
- package/README.md +31 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.md) | English
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/pi-okf-memory)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://pi.dev)
|
|
8
|
+
[](package.json)
|
|
9
|
+
|
|
5
10
|
**Session memory → OKF knowledge. Make pi remember you across sessions.**
|
|
6
11
|
|
|
7
12
|
High-value content from your sessions is distilled into long-term memory as [OKF v0.1](https://github.com/open-knowledge-format) documents, and recalled automatically in later sessions. Every pick, skip and correction is a learning signal — recall gets sharper the longer you use it.
|
|
@@ -126,6 +131,31 @@ For frontend/backend/language/approach/config decisions:
|
|
|
126
131
|
3. You didn't name a technology but the message matches a dimension keyword (e.g. "frontend") → handle via that dimension's memory
|
|
127
132
|
4. You propose a new option / switch / config → **append** rather than overwrite (keeps the v1→vN trail)
|
|
128
133
|
|
|
134
|
+
## Design rationale: every mechanism traces to memory research
|
|
135
|
+
|
|
136
|
+
Weights, decay, archiving, retrieval-driven reinforcement — none of this is invented. Each piece maps onto a classic result in cognitive psychology or neuroscience.
|
|
137
|
+
|
|
138
|
+
| Mechanism | Reference | What this project actually does |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| **Forgetting curve** | Ebbinghaus (1885), *Über das Gedächtnis* | `decayFactor()`: after a 30-day grace period, power decay `0.9^((t−30)/30)` |
|
|
141
|
+
| **Memory availability tracks need probability** | Anderson & Schooler (1991), *Psychological Science* 2(6):396–408 | Weight = usage frequency (select +1.0 / read +0.1) + recency `1/(1+days/30)` |
|
|
142
|
+
| **Storage strength ≠ retrieval strength** | Bjork & Bjork (1992), *From Learning Processes to Cognitive Processes* | Archiving only sets `state: inactive` — **files are never deleted**, and re-use lifts the weight back |
|
|
143
|
+
| **Retrieval practice (testing effect)** | Roediger & Karpicke (2006), *Psychological Science* 17(3):249–255 | One `okf_read` writes a weight feedback |
|
|
144
|
+
| **Spreading activation** | Collins & Loftus (1975), *Psychological Review* 82(6):407–428 | `/okf graph` propagates a BFS highlight along cross-links on a search hit |
|
|
145
|
+
| **Half-life regression** | Settles & Meeder (2016), *ACL* pp.1848–1858 | `PARAMS` parameterises decay (`DECAY_DAYS` / `DECAY_FACTOR`) |
|
|
146
|
+
| **Long-term potentiation** | Bliss & Lømo (1973), *J. Physiol.* 232(2):331–356 | Weight rises on every use, capped at 10 |
|
|
147
|
+
|
|
148
|
+
### Where the analogy stops (no overclaiming)
|
|
149
|
+
|
|
150
|
+
The table above describes a **design analogy**, not "this plugin implements neuroscience". Concretely:
|
|
151
|
+
|
|
152
|
+
- **The weights are a JSON table** — not a spiking neural network. No neurons, synapses, or membrane potentials.
|
|
153
|
+
- **Cross-links come from an explicit `related` argument**, with no co-occurrence statistics — so this is **not** Hebbian auto-association.
|
|
154
|
+
- **Spreading activation is visualization only** — it never feeds back into weights.
|
|
155
|
+
- **The half-life is a fixed parameter** — there is no per-item fitting, which is precisely the core of Settles & Meeder.
|
|
156
|
+
|
|
157
|
+
We spell this out because "which results inspired the design" and "how much of them is implemented" are two different claims. Knowing the boundary is how you decide whether this fits your use case.
|
|
158
|
+
|
|
129
159
|
## Memory library layout
|
|
130
160
|
|
|
131
161
|
Defaults to `~/.pi/agent/okf-memory/` (override with `OKF_MEMORY_ROOT`):
|
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.md) | [English](README.en.md)
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/pi-okf-memory)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://pi.dev)
|
|
8
|
+
[](package.json)
|
|
9
|
+
|
|
5
10
|
**会话记忆 → OKF 知识沉淀。让 pi 跨会话记住你。**
|
|
6
11
|
|
|
7
12
|
把会话里高价值的内容按 [OKF v0.1](https://github.com/open-knowledge-format) 规范自动沉淀成长期记忆,下次开新会话自动唤起。每次选择、跳过、纠正都是学习信号 —— 用得越久,召回越准。
|
|
@@ -127,6 +132,32 @@ pi -e /path/to/pi-okf-memory/src/pi/index.ts # 试用,不写配置
|
|
|
127
132
|
3. 你未指定技术但命中维度关键词(如「前端」)→ 按该维度记忆处理
|
|
128
133
|
4. 你提出新方案/切换/配置 → **追加式更新**,不覆盖旧候选(保留 v1→vN 轨迹)
|
|
129
134
|
|
|
135
|
+
## 设计依据:每个机制都追得到记忆研究
|
|
136
|
+
|
|
137
|
+
权重、衰减、归档、检索强化 —— 这些不是拍脑袋定的,各自对应认知心理学与神经科学里的经典结论。
|
|
138
|
+
|
|
139
|
+
| 机制 | 文献 | 本项目实际怎么做 |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| **遗忘曲线** | Ebbinghaus (1885) *Über das Gedächtnis* | `decayFactor()`:30 天宽限期后按 `0.9^((t−30)/30)` 幂衰减 |
|
|
142
|
+
| **记忆可用性追踪「需要概率」** | Anderson & Schooler (1991), *Psychological Science* 2(6):396–408 | 权重 = 使用频率(选中 +1.0 / 精读 +0.1)+ 近因 `1/(1+days/30)` |
|
|
143
|
+
| **存储强度 ≠ 提取强度** | Bjork & Bjork (1992), *From Learning Processes to Cognitive Processes* | 归档只置 `state: inactive`,**文件不删**;再用可把权重抬回 |
|
|
144
|
+
| **提取练习效应(测试效应)** | Roediger & Karpicke (2006), *Psychological Science* 17(3):249–255 | `okf_read` 精读一次即写回权重反馈 |
|
|
145
|
+
| **激活扩散** | Collins & Loftus (1975), *Psychological Review* 82(6):407–428 | `/okf graph` 命中后沿交叉链接 BFS 传导点亮 |
|
|
146
|
+
| **半衰期回归** | Settles & Meeder (2016), *ACL* pp.1848–1858 | `PARAMS` 把衰减参数化(`DECAY_DAYS`/`DECAY_FACTOR`),可调 |
|
|
147
|
+
| **长时程增强(LTP)** | Bliss & Lømo (1973), *J. Physiol.* 232(2):331–356 | 每次使用权重递增,上限 10 |
|
|
148
|
+
|
|
149
|
+
### 边界说明(不吹)
|
|
150
|
+
|
|
151
|
+
上面是**设计类比**,不是「本插件实现了神经科学」。差别具体在哪:
|
|
152
|
+
|
|
153
|
+
- **权重是一张 JSON 表**,不是脉冲神经网络 —— 没有神经元、没有突触、没有膜电位
|
|
154
|
+
- **交叉链接靠写入时显式传 `related`**,不做共现自动统计 —— 所以**不是** Hebbian 自动联想
|
|
155
|
+
- **激活扩散只用于可视化**,不参与权重计算
|
|
156
|
+
- **半衰期是固定参数**,没做个性化拟合 —— 而 Settles & Meeder 那篇的核心恰恰是「拟合」
|
|
157
|
+
|
|
158
|
+
写清楚这些,是因为「参考了哪些研究的结论」和「实现了多少」是两件事。
|
|
159
|
+
知道边界在哪,你才能判断它适不适合你的场景。
|
|
160
|
+
|
|
130
161
|
## 记忆库结构
|
|
131
162
|
|
|
132
163
|
默认 `~/.pi/agent/okf-memory/`(环境变量 `OKF_MEMORY_ROOT` 可覆盖):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-okf-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "会话记忆 → OKF 知识沉淀的 pi 扩展。把会话中高价值内容按 OKF v0.1 规范自动沉淀为长期记忆,跨会话自动唤起,并基于权重持续学习。Session-to-OKF long-term memory for pi with predictive recall, uncertainty-driven capture and reinforcement feedback.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@12.4.1",
|