toon-memory 4.4.2 → 4.5.0
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.de.md +47 -9
- package/README.es.md +47 -9
- package/README.fr.md +47 -9
- package/README.ja.md +47 -9
- package/README.ko.md +47 -9
- package/README.md +9 -9
- package/README.pt-br.md +45 -9
- package/README.zh.md +47 -9
- package/bin/toon-memory.js +2 -0
- package/dist/cli/setup.js +261 -117
- package/mcp/server.js +112 -28
- package/package.json +5 -2
- package/src/bin/toon-memory.ts +2 -0
- package/src/cli/ambient.ts +4 -1
- package/src/cli/dense.ts +72 -18
- package/src/cli/setup.ts +1 -1
- package/src/lib/dense.ts +186 -25
- package/src/lib/quality.ts +2 -1
- package/src/mcp/config.ts +2 -0
- package/src/mcp/tools.ts +2 -1
package/README.md
CHANGED
|
@@ -771,7 +771,7 @@ Four opt-in sidecars extend recall without changing `data.toon`:
|
|
|
771
771
|
|---------|-----------|---------|
|
|
772
772
|
| `feedback.toon` | `memory_feedback` (always on for explicit signals) | Learned per-entry utility (`useful`, `irrelevant`, `outdated`, `wrong`) with decay. `wrong` also sets evidence to `conflict`. |
|
|
773
773
|
| `edges.toon` | `config.graph.activation = true` or `memory_edges(rebuild)` | Typed edges derived from `links` + feedback tasks. Spread activation boosts neighbours of top seeds. |
|
|
774
|
-
| `vectors.bin` | `toon-memory dense enable
|
|
774
|
+
| `vectors.bin` | `toon-memory dense enable --build` | Optional local embeddings via `toon-memory-dense`. Run `npx toon-memory dense install` locally in each project; the first build downloads a model into a cache. Falls back to BM25 when the module or model is unavailable. |
|
|
775
775
|
| `observations.toon` | capture hooks + `toon-memory sleep` | Opt-in end-of-session consolidation: promote observations, rebuild edges, prune expired signals, dedupe. |
|
|
776
776
|
|
|
777
777
|
`context_compile(task=...)` turns the retrieved memory into a compact packet with directives, constraints, a retrieval plan and exact `Hydrate` keys. `context_hydrate(keys=[...])` fetches only those entries.
|
|
@@ -927,7 +927,7 @@ npx toon-memory watch [options] # Auto-backup with options
|
|
|
927
927
|
npx toon-memory upgrade # Update to latest version
|
|
928
928
|
npx toon-memory sleep # Deterministic consolidation (opt-in)
|
|
929
929
|
npx toon-memory dense status # Optional embeddings status
|
|
930
|
-
npx toon-memory dense
|
|
930
|
+
npx toon-memory dense install --yes && npx toon-memory dense enable --build
|
|
931
931
|
npx toon-memory uninstall # Remove from all agents
|
|
932
932
|
```
|
|
933
933
|
|
|
@@ -1044,7 +1044,7 @@ All flags live in `.toon-memory/memory/config.json` and are optional:
|
|
|
1044
1044
|
- `feedback.implicit` is reserved; only explicit `memory_feedback` events affect ranking today.
|
|
1045
1045
|
- `graph.activation` enables spread activation over `edges.toon` (rebuild with `memory_edges(action="rebuild")`).
|
|
1046
1046
|
- `sleep.enabled` (or `TOON_MEMORY_SLEEP=1`) runs consolidation on session `Stop`.
|
|
1047
|
-
- `dense.enabled` enables `vectors.bin`;
|
|
1047
|
+
- `dense.enabled` enables `vectors.bin`; run `npx toon-memory dense install --yes` locally in each project (`--dry-run` previews the npm command). The optional embedder pulls native transitive dependencies: pin versions and review install scripts in restricted environments. `TOON_MEMORY_DENSE_MODULE` overrides the module path. If anything is missing, recall stays BM25-only.
|
|
1048
1048
|
|
|
1049
1049
|
### OpenCode
|
|
1050
1050
|
|
|
@@ -1310,7 +1310,7 @@ Since v3.7.0, recall ranks results with **Reciprocal Rank Fusion** over BM25 (×
|
|
|
1310
1310
|
```
|
|
1311
1311
|
Metric linear (v3.6.x) RRF (v3.7.0)
|
|
1312
1312
|
──────────── ───────────────── ────────────────
|
|
1313
|
-
nDCG@
|
|
1313
|
+
nDCG@5 0.776 0.776 (parity)
|
|
1314
1314
|
MRR 0.917 0.917 (parity)
|
|
1315
1315
|
```
|
|
1316
1316
|
|
|
@@ -1323,12 +1323,12 @@ Since v4.1.0, retrieval is benchmarked against a **frozen snapshot of real proje
|
|
|
1323
1323
|
```
|
|
1324
1324
|
Mode R@5 nDCG@5 MRR@5 answerable
|
|
1325
1325
|
───────────── ───── ───── ───── ──────────
|
|
1326
|
-
linear 0.643 0.
|
|
1327
|
-
rrf 0.
|
|
1328
|
-
smart (unified) 0.
|
|
1326
|
+
linear 0.643 0.650 0.766 81.0%
|
|
1327
|
+
rrf 0.655 0.652 0.770 83.3%
|
|
1328
|
+
smart (unified) 0.867 0.814 0.854 95.0%
|
|
1329
1329
|
```
|
|
1330
1330
|
|
|
1331
|
-
|
|
1331
|
+
`memory_smart_recall` is the top-ranked mode (0.867 R@5, 95.0% of queries answerable from the top-5) in a single call.
|
|
1332
1332
|
|
|
1333
1333
|
---
|
|
1334
1334
|
|
|
@@ -1448,7 +1448,7 @@ toon-memory/
|
|
|
1448
1448
|
│ ├── graph.test.ts # Memory graph tests
|
|
1449
1449
|
│ └── quality.test.ts # Quality scoring, merge-dedup, smart recall, system primer tests
|
|
1450
1450
|
├── .github/workflows/
|
|
1451
|
-
│ ├── ci.yml # CI (Node.js
|
|
1451
|
+
│ ├── ci.yml # CI (Node.js 22/24)
|
|
1452
1452
|
│ └── publish.yml # Auto-publish on release
|
|
1453
1453
|
├── package.json
|
|
1454
1454
|
├── tsconfig.json
|
package/README.pt-br.md
CHANGED
|
@@ -255,7 +255,9 @@ Adicione a `~/.codeium/windsurf/mcp_config.json`:
|
|
|
255
255
|
| `memory_export_gist` | Exporta entradas para um GitHub Gist (público ou privado). Usa GITHUB_TOKEN ou gh CLI |
|
|
256
256
|
| `memory_import_gist` | Importa entradas de um GitHub Gist. Mescla com entradas existentes (união de tags, confiança máxima) |
|
|
257
257
|
| `memory_graph_path` | Caminho BFS mais curto entre duas entradas no grafo de conhecimento. Mostra como os conceitos estão conectados |
|
|
258
|
-
| `context_brief` | **
|
|
258
|
+
| `context_brief` | **Handoff + briefing em uma chamada**: antepõe um pacote de handoff compacto (`identity`, `mcp_project`, `freshness`, diretrizes, armadilhas, ponteiros de arquivo) à memória + sessões + saúde. `handoff: false` retorna apenas o briefing legado. Zero LLM, puramente determinístico |
|
|
259
|
+
| `context_compile` | **Compilador de contexto orientado a tarefa**: diretrizes, restrições, memória recuperada, plano de recuperação, chaves `Hydrate`, arquivos e sessões em um único pacote. Use no INÍCIO de cada tarefa |
|
|
260
|
+
| `context_hydrate` | **Hidratar por chave**: busca entradas exatas de memória por chave/id e as marca como acessadas. Siga a lista `Hydrate` do `context_compile` |
|
|
259
261
|
| `context_generate` | **Briefing completo do projeto**: combina estrutura do projeto, estado do git, entradas de memória e sessões ativas em uma chamada. Substitui 5-6 chamadas manuais de ferramentas |
|
|
260
262
|
| `context_diff` | **Briefing incremental**: commits git + arquivos modificados + memória nova/atualizada + sessões ativas desde a última sessão |
|
|
261
263
|
| `context_focus` | **Briefing hiper-focado**: apenas memória relevante + arquivos fonte relacionados + chamadores + arquivos de teste para uma consulta |
|
|
@@ -265,6 +267,8 @@ Adicione a `~/.codeium/windsurf/mcp_config.json`:
|
|
|
265
267
|
| `memory_unpin` | **Desafixar entrada**: remove a flag de prioridade |
|
|
266
268
|
| `memory_search` | **Pesquisa unificada com filtros**: mesmo que `memory_recall` mais filtros `category`, `tags`, `from_date`, `to_date`. O filtro de tags usa lógica AND — todas as tags especificadas devem corresponder. `budget` controla a verbosidade da saída. `path_scope` filtra por padrão glob. `sessionBias` impulsiona entradas da branch git atual |
|
|
267
269
|
| `memory_tag` | **Operações em lote de tags**: `add`, `remove` ou `set` tags em uma ou mais entradas por key ou id |
|
|
270
|
+
| `memory_feedback` | **Feedback explícito** (`useful`/`irrelevant`/`outdated`/`wrong`) gravado em `feedback.toon`. Treina a utilidade por entrada; `wrong` também marca a evidência como `conflict` |
|
|
271
|
+
| `memory_edges` | **Sidecar de arestas tipadas** (`edges.toon`): lista arestas derivadas/aprendidas ou as reconstrói a partir de `links` + feedback. Habilita ativação por propagação (spread activation) no recall |
|
|
268
272
|
|
|
269
273
|
### Recursos MCP
|
|
270
274
|
|
|
@@ -738,6 +742,19 @@ O recall é determinístico e offline (sem embeddings, sem LLM). Cada entrada ca
|
|
|
738
742
|
|
|
739
743
|
No modo `graph`, o recall usa correspondências por palavras-chave como sementes, expande o subgrafo ego até `hops`, e retorna os top `limit` (padrão 6) por pontuação combinada. `memory_smart_recall` combina todos esses sinais em uma chamada.
|
|
740
744
|
|
|
745
|
+
### Ranking aprendido, arestas e recuperação densa opcional
|
|
746
|
+
|
|
747
|
+
Quatro sidecars opcionais ampliam o recall sem alterar `data.toon`:
|
|
748
|
+
|
|
749
|
+
| Sidecar | Ativado por | Finalidade |
|
|
750
|
+
|---------|------------|-----------|
|
|
751
|
+
| `feedback.toon` | `memory_feedback` (sempre ativo para sinais explícitos) | Utilidade aprendida por entrada (`useful`, `irrelevant`, `outdated`, `wrong`) com decaimento. `wrong` também define a evidência como `conflict`. |
|
|
752
|
+
| `edges.toon` | `config.graph.activation = true` ou `memory_edges(rebuild)` | Arestas tipadas derivadas de `links` + tarefas de feedback. A ativação por propagação reforça os vizinhos das melhores sementes. |
|
|
753
|
+
| `vectors.bin` | `toon-memory dense enable --build` | Embeddings locais opcionais via `toon-memory-dense`. Execute `npx toon-memory dense install` localmente em cada projeto; o primeiro build baixa o modelo para um cache. Recai para BM25 se o módulo ou modelo estiver ausente. |
|
|
754
|
+
| `observations.toon` | Hooks de captura + `toon-memory sleep` | Consolidação opcional ao fim da sessão: promover observações, reconstruir arestas, podar sinais expirados, deduplicar. |
|
|
755
|
+
|
|
756
|
+
`context_compile(task=...)` transforma a memória recuperada em um pacote compacto com diretrizes, restrições, plano de recuperação e chaves `Hydrate` exatas. `context_hydrate(keys=[...])` busca apenas essas entradas.
|
|
757
|
+
|
|
741
758
|
### Auto-tag de dependências do projeto
|
|
742
759
|
|
|
743
760
|
No `toon-memory init`, o CLI escaneia seus manifestos de dependências e escreve uma tabela `vocab` em `.toon-memory/memory/config.json`:
|
|
@@ -887,6 +904,9 @@ npx toon-memory viewer --export # Salve o visualizador como HTML estático
|
|
|
887
904
|
npx toon-memory viewer --port 3001 # Porta personalizada
|
|
888
905
|
npx toon-memory watch [options] # Backup automático com opções
|
|
889
906
|
npx toon-memory upgrade # Atualize para a versão mais recente
|
|
907
|
+
npx toon-memory sleep # Consolidação determinística (opt-in)
|
|
908
|
+
npx toon-memory dense status # Status dos embeddings opcionais
|
|
909
|
+
npx toon-memory dense install --yes && npx toon-memory dense enable --build
|
|
890
910
|
npx toon-memory uninstall # Remova de todos os agentes
|
|
891
911
|
```
|
|
892
912
|
|
|
@@ -987,7 +1007,23 @@ O instalador (requer um terminal) vai:
|
|
|
987
1007
|
|
|
988
1008
|
> Sem um terminal (CI/pipes) `npx toon-memory` imprime a ajuda de instalação não interativa. Use `npx toon-memory init [local|global]` para instalar sem perguntas. Comandos desconhecidos imprimem o uso e saem com erro.
|
|
989
1009
|
|
|
1010
|
+
### Flags de configuração da memória
|
|
1011
|
+
|
|
1012
|
+
Todas as flags ficam em `.toon-memory/memory/config.json` e são opcionais:
|
|
1013
|
+
|
|
1014
|
+
```json
|
|
1015
|
+
{
|
|
1016
|
+
"feedback": { "implicit": false },
|
|
1017
|
+
"graph": { "activation": false },
|
|
1018
|
+
"sleep": { "enabled": false },
|
|
1019
|
+
"dense": { "enabled": false, "model": "multilingual-e5-small" }
|
|
1020
|
+
}
|
|
1021
|
+
```
|
|
990
1022
|
|
|
1023
|
+
- `feedback.implicit` é reservado; hoje apenas eventos explícitos de `memory_feedback` afetam o ranking.
|
|
1024
|
+
- `graph.activation` habilita a ativação por propagação sobre `edges.toon` (reconstrua com `memory_edges(action="rebuild")`).
|
|
1025
|
+
- `sleep.enabled` (ou `TOON_MEMORY_SLEEP=1`) executa a consolidação no evento `Stop` da sessão.
|
|
1026
|
+
- `dense.enabled` habilita `vectors.bin`; execute `npx toon-memory dense install --yes` localmente em cada projeto (`--dry-run` mostra o comando npm). O embedder opcional traz dependências transitivas nativas: fixe versões e revise os scripts de instalação em ambientes restritos. `TOON_MEMORY_DENSE_MODULE` substitui o caminho do módulo. Se algo estiver ausente, o recall permanece apenas BM25.
|
|
991
1027
|
|
|
992
1028
|
### OpenCode
|
|
993
1029
|
|
|
@@ -1253,7 +1289,7 @@ Desde a v3.7.0, o recall classifica os resultados com **Reciprocal Rank Fusion**
|
|
|
1253
1289
|
```
|
|
1254
1290
|
Métrica linear (v3.6.x) RRF (v3.7.0)
|
|
1255
1291
|
──────────── ───────────────── ────────────────
|
|
1256
|
-
nDCG@
|
|
1292
|
+
nDCG@5 0.776 0.776 (paridade)
|
|
1257
1293
|
MRR 0.917 0.917 (paridade)
|
|
1258
1294
|
```
|
|
1259
1295
|
|
|
@@ -1266,12 +1302,12 @@ Desde a v4.1.0, a recuperação é avaliada contra um **snapshot congelado de me
|
|
|
1266
1302
|
```
|
|
1267
1303
|
Modo R@5 nDCG@5 MRR@5 respondíveis
|
|
1268
1304
|
───────────── ───── ───── ───── ──────────
|
|
1269
|
-
linear 0.643 0.
|
|
1270
|
-
rrf 0.
|
|
1271
|
-
smart (unified) 0.
|
|
1305
|
+
linear 0.643 0.650 0.766 81.0%
|
|
1306
|
+
rrf 0.655 0.652 0.770 83.3%
|
|
1307
|
+
smart (unified) 0.867 0.814 0.854 95.0%
|
|
1272
1308
|
```
|
|
1273
1309
|
|
|
1274
|
-
|
|
1310
|
+
`memory_smart_recall` é o modo com melhor ranking (0.867 R@5, 95.0% das consultas respondíveis a partir do top-5) em uma única chamada.
|
|
1275
1311
|
|
|
1276
1312
|
---
|
|
1277
1313
|
|
|
@@ -1365,8 +1401,8 @@ toon-memory/
|
|
|
1365
1401
|
│ │ ├── setup.ts # Comandos CLI
|
|
1366
1402
|
│ │ └── toon-memory.ts # Runner do CLI
|
|
1367
1403
|
│ ├── mcp/
|
|
1368
|
-
│ │ ├── server.ts # Servidor MCP (
|
|
1369
|
-
│ │ ├── tools.ts # Registro de ferramentas (
|
|
1404
|
+
│ │ ├── server.ts # Servidor MCP (42 ferramentas + 4 recursos + 1 prompt)
|
|
1405
|
+
│ │ ├── tools.ts # Registro de ferramentas (42 ferramentas)
|
|
1370
1406
|
│ │ ├── resources.ts # Registro de recursos (4 recursos)
|
|
1371
1407
|
│ │ ├── prompts.ts # Registro de prompts (1 prompt)
|
|
1372
1408
|
│ │ ├── session-store.ts # Camada de sessões (auto-promoção, limpeza)
|
|
@@ -1391,7 +1427,7 @@ toon-memory/
|
|
|
1391
1427
|
│ ├── graph.test.ts # Testes do grafo de memória
|
|
1392
1428
|
│ └── quality.test.ts # Testes de pontuação de qualidade, merge-dedup, recall inteligente, system primer
|
|
1393
1429
|
├── .github/workflows/
|
|
1394
|
-
│ ├── ci.yml # CI (Node.js
|
|
1430
|
+
│ ├── ci.yml # CI (Node.js 22/24)
|
|
1395
1431
|
│ └── publish.yml # Publicação automática no release
|
|
1396
1432
|
├── package.json
|
|
1397
1433
|
├── tsconfig.json
|
package/README.zh.md
CHANGED
|
@@ -256,7 +256,9 @@ memory_remember # 保存重要决策
|
|
|
256
256
|
| `memory_export_gist` | 将条目导出到 GitHub Gist(公开或私有)。使用 GITHUB_TOKEN 或 gh CLI |
|
|
257
257
|
| `memory_import_gist` | 从 GitHub Gist 导入条目。与现有条目合并(标签联合,最大置信度) |
|
|
258
258
|
| `memory_graph_path` | 知识图谱中两个条目之间的BFS最短路径 |
|
|
259
|
-
| `context_brief` |
|
|
259
|
+
| `context_brief` | **一键交接 + 简报**:在记忆 + 会话 + 健康状态前附加紧凑的交接包(`identity`、`mcp_project`、`freshness`、指令、陷阱、文件指针)。`handoff: false` 仅返回传统简报。零 LLM 开销,纯确定性 |
|
|
260
|
+
| `context_compile` | **任务驱动的上下文编译器**:将指令、约束、检索到的记忆、检索计划、`Hydrate` 键、文件和会话打包为单个数据包。在任务开始时调用 |
|
|
261
|
+
| `context_hydrate` | **按键水合**:按 key/id 精确获取记忆条目并标记为已访问。遵循 `context_compile` 返回的 `Hydrate` 列表 |
|
|
260
262
|
| `context_generate` | **完整项目简报**:一次调用整合项目结构、git 状态、记忆条目和活跃会话。替代 5-6 次手动调用 |
|
|
261
263
|
| `context_diff` | **增量简报**:自上次会话以来的 git 提交 + 修改文件 + 新增/更新记忆 + 活跃会话 |
|
|
262
264
|
| `context_focus` | **精准简报**:仅返回与查询相关的记忆 + 关联源文件 + 调用方 + 测试文件 |
|
|
@@ -266,6 +268,8 @@ memory_remember # 保存重要决策
|
|
|
266
268
|
| `memory_unpin` | **取消固定条目**:移除优先级标记 |
|
|
267
269
|
| `memory_search` | **带过滤器的统一搜索**:与 `memory_recall` 相同,加上 `category`、`tags`、`from_date`、`to_date` 过滤器。标签过滤器使用 AND 逻辑 — 所有指定的标签必须匹配。`budget` 控制输出详细程度。`path_scope` 按 glob 模式过滤。`sessionBias` 提升当前 git 分支的条目 |
|
|
268
270
|
| `memory_tag` | **批量标签操作**:按 key 或 id 在一个或多个条目上添加、删除或设置标签 |
|
|
271
|
+
| `memory_feedback` | **显式反馈**(`useful`/`irrelevant`/`outdated`/`wrong`)写入 `feedback.toon`。训练逐条记忆的效用;`wrong` 还会将证据标记为 `conflict` |
|
|
272
|
+
| `memory_edges` | **类型化边 sidecar**(`edges.toon`):列出派生/学习到的边,或从 `links` + 反馈重建。支持在召回中启用扩散激活 |
|
|
269
273
|
|
|
270
274
|
### MCP 资源
|
|
271
275
|
|
|
@@ -739,6 +743,19 @@ memory_recall({ query: "riesgo", mode: "graph", hops: 2, compact: true })
|
|
|
739
743
|
|
|
740
744
|
在 `graph` 模式下,召回先以关键词匹配为种子,展开自我子图至 `hops` 跳,然后按综合评分返回前 `limit` 条(默认 6)。`memory_smart_recall` 在一次调用中融合所有这些信号。
|
|
741
745
|
|
|
746
|
+
#### 学习排序、边与可选的稠密检索
|
|
747
|
+
|
|
748
|
+
四个可选 sidecar 在不修改 `data.toon` 的前提下扩展召回:
|
|
749
|
+
|
|
750
|
+
| Sidecar | 启用方式 | 用途 |
|
|
751
|
+
|---------|---------|------|
|
|
752
|
+
| `feedback.toon` | `memory_feedback`(显式信号始终启用) | 带衰减的逐条学习效用(`useful`、`irrelevant`、`outdated`、`wrong`)。`wrong` 还会将证据设为 `conflict`。 |
|
|
753
|
+
| `edges.toon` | `config.graph.activation = true` 或 `memory_edges(rebuild)` | 从 `links` + 反馈任务派生的类型化边。扩散激活会提升高分种子的邻居。 |
|
|
754
|
+
| `vectors.bin` | `toon-memory dense enable --build` | 通过 `toon-memory-dense` 实现可选本地嵌入。请在每个项目本地运行 `npx toon-memory dense install`;首次构建会把模型下载到缓存。缺少模块或模型时回退到 BM25。 |
|
|
755
|
+
| `observations.toon` | 捕获钩子 + `toon-memory sleep` | 会话结束时可选整合:提升观察、重建边、清理过期信号、去重。 |
|
|
756
|
+
|
|
757
|
+
`context_compile(task=...)` 将检索到的记忆转换为紧凑数据包,包含指令、约束、检索计划和精确的 `Hydrate` 键。`context_hydrate(keys=[...])` 仅获取这些条目。
|
|
758
|
+
|
|
742
759
|
#### 从项目依赖自动打标签
|
|
743
760
|
|
|
744
761
|
执行 `toon-memory init` 时,CLI 扫描依赖清单并将 `vocab` 表写入 `.toon-memory/memory/config.json`:
|
|
@@ -888,6 +905,9 @@ npx toon-memory viewer --export # 将查看器保存为静态 HTML
|
|
|
888
905
|
npx toon-memory viewer --port 3001 # 自定义端口
|
|
889
906
|
npx toon-memory watch [options] # 自动备份(可配置选项)
|
|
890
907
|
npx toon-memory upgrade # 更新到最新版本
|
|
908
|
+
npx toon-memory sleep # 确定性整合(需要启用)
|
|
909
|
+
npx toon-memory dense status # 查看可选嵌入状态
|
|
910
|
+
npx toon-memory dense install --yes && npx toon-memory dense enable --build
|
|
891
911
|
npx toon-memory uninstall # 从所有 Agent 中移除
|
|
892
912
|
```
|
|
893
913
|
|
|
@@ -988,6 +1008,24 @@ npx toon-memory
|
|
|
988
1008
|
|
|
989
1009
|
> 在没有终端的环境(CI/管道)中,`npx toon-memory` 会打印非交互式安装帮助。使用 `npx toon-memory init [local|global]` 进行无提示安装。未知命令会打印用法并以错误退出。
|
|
990
1010
|
|
|
1011
|
+
### 记忆配置标志
|
|
1012
|
+
|
|
1013
|
+
所有标志都位于 `.toon-memory/memory/config.json`,且均为可选项:
|
|
1014
|
+
|
|
1015
|
+
```json
|
|
1016
|
+
{
|
|
1017
|
+
"feedback": { "implicit": false },
|
|
1018
|
+
"graph": { "activation": false },
|
|
1019
|
+
"sleep": { "enabled": false },
|
|
1020
|
+
"dense": { "enabled": false, "model": "multilingual-e5-small" }
|
|
1021
|
+
}
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
- `feedback.implicit` 为预留项;目前只有显式 `memory_feedback` 事件会影响排序。
|
|
1025
|
+
- `graph.activation` 启用 `edges.toon` 上的扩散激活(使用 `memory_edges(action="rebuild")` 重建)。
|
|
1026
|
+
- `sleep.enabled`(或 `TOON_MEMORY_SLEEP=1`)在会话 `Stop` 事件时执行整合。
|
|
1027
|
+
- `dense.enabled` 启用 `vectors.bin`;请在每个项目本地运行 `npx toon-memory dense install --yes`(`--dry-run` 仅显示 npm 命令)。可选嵌入模块会引入原生传递依赖:在受限环境中请固定版本并审查安装脚本。`TOON_MEMORY_DENSE_MODULE` 可覆盖模块路径。如有任何缺失,召回将保持仅使用 BM25。
|
|
1028
|
+
|
|
991
1029
|
### OpenCode
|
|
992
1030
|
|
|
993
1031
|
添加到 `.opencode/opencode.json` 或 `~/.config/opencode/opencode.json`:
|
|
@@ -1252,7 +1290,7 @@ context_export (可注入 markdown) 1,178 218 81.5% 3 → 1
|
|
|
1252
1290
|
```
|
|
1253
1291
|
指标 linear (v3.6.x) RRF (v3.7.0)
|
|
1254
1292
|
──────────── ───────────────── ────────────────
|
|
1255
|
-
nDCG@
|
|
1293
|
+
nDCG@5 0.776 0.776 (一致)
|
|
1256
1294
|
MRR 0.917 0.917 (一致)
|
|
1257
1295
|
```
|
|
1258
1296
|
|
|
@@ -1265,12 +1303,12 @@ RRF 以**零排序代价**匹配了之前的线性加权评分,同时简化了
|
|
|
1265
1303
|
```
|
|
1266
1304
|
模式 R@5 nDCG@5 MRR@5 可回答
|
|
1267
1305
|
───────────── ───── ───── ───── ──────────
|
|
1268
|
-
linear 0.643 0.
|
|
1269
|
-
rrf 0.
|
|
1270
|
-
smart (unified) 0.
|
|
1306
|
+
linear 0.643 0.650 0.766 81.0%
|
|
1307
|
+
rrf 0.655 0.652 0.770 83.3%
|
|
1308
|
+
smart (unified) 0.867 0.814 0.854 95.0%
|
|
1271
1309
|
```
|
|
1272
1310
|
|
|
1273
|
-
|
|
1311
|
+
`memory_smart_recall` 是排名最高的模式(R@5 0.867,95.0% 的查询可从前 5 条中得到答案),只需一次调用。
|
|
1274
1312
|
|
|
1275
1313
|
---
|
|
1276
1314
|
|
|
@@ -1364,8 +1402,8 @@ toon-memory/
|
|
|
1364
1402
|
│ │ ├── setup.ts # CLI 命令
|
|
1365
1403
|
│ │ └── toon-memory.ts # CLI 运行器
|
|
1366
1404
|
│ ├── mcp/
|
|
1367
|
-
│ │ ├── server.ts # MCP 服务器(
|
|
1368
|
-
│ │ ├── tools.ts # 工具注册(
|
|
1405
|
+
│ │ ├── server.ts # MCP 服务器(42 个工具 + 4 个资源 + 1 个提示词)
|
|
1406
|
+
│ │ ├── tools.ts # 工具注册(42 个工具)
|
|
1369
1407
|
│ │ ├── resources.ts # 资源注册(4 个资源)
|
|
1370
1408
|
│ │ ├── prompts.ts # 提示词注册(1 个提示词)
|
|
1371
1409
|
│ │ ├── session-store.ts # 会话层(自动提升、清理)
|
|
@@ -1390,7 +1428,7 @@ toon-memory/
|
|
|
1390
1428
|
│ ├── graph.test.ts # 记忆图谱测试
|
|
1391
1429
|
│ └── quality.test.ts # 质量评分、合并去重、智能召回、系统知识图谱测试
|
|
1392
1430
|
├── .github/workflows/
|
|
1393
|
-
│ ├── ci.yml # CI(Node.js
|
|
1431
|
+
│ ├── ci.yml # CI(Node.js 22/24)
|
|
1394
1432
|
│ └── publish.yml # 发布时自动发布
|
|
1395
1433
|
├── package.json
|
|
1396
1434
|
├── tsconfig.json
|
package/bin/toon-memory.js
CHANGED
|
@@ -46,6 +46,8 @@ Commands:
|
|
|
46
46
|
doctor Check memory path, signals and injection channel
|
|
47
47
|
signal --type <t> --summary <s> Append one deterministic signal
|
|
48
48
|
promote Promote high-confidence signals into memory
|
|
49
|
+
sleep Deterministic end-of-session consolidation (opt-in)
|
|
50
|
+
dense <status|enable|disable|build|install> Optional local embeddings (BM25 fallback)
|
|
49
51
|
upgrade Upgrade to the latest version
|
|
50
52
|
|
|
51
53
|
Options:
|