toon-memory 4.3.5 → 4.4.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.de.md +2 -2
- package/README.es.md +2 -2
- package/README.fr.md +2 -2
- package/README.ja.md +2 -2
- package/README.ko.md +2 -2
- package/README.md +57 -11
- package/README.pt-br.md +2 -2
- package/README.zh.md +2 -2
- package/bin/toon-memory.js +4 -0
- package/dist/cli/capture.js +658 -26
- package/dist/cli/setup.js +1783 -110
- package/mcp/server.js +1369 -356
- package/package.json +3 -2
- package/src/bin/toon-memory.ts +4 -0
- package/src/cli/ambient.ts +117 -0
- package/src/cli/capture.ts +5 -2
- package/src/cli/constants.ts +19 -11
- package/src/cli/dense.ts +50 -0
- package/src/cli/instructions.ts +2 -2
- package/src/cli/opencode-plugin.ts +100 -95
- package/src/cli/setup.ts +51 -4
- package/src/cli/sleep.ts +45 -0
- package/src/lib/activation.ts +32 -0
- package/src/lib/compiler.ts +178 -0
- package/src/lib/dense.ts +123 -0
- package/src/lib/graph.ts +123 -36
- package/src/lib/handoff.ts +144 -0
- package/src/lib/ngrams.ts +68 -0
- package/src/lib/promoter.ts +140 -0
- package/src/lib/quality.ts +25 -10
- package/src/lib/utils.ts +17 -7
- package/src/mcp/args.ts +46 -0
- package/src/mcp/config.ts +20 -0
- package/src/mcp/edges.ts +99 -0
- package/src/mcp/entries.ts +34 -9
- package/src/mcp/feedback.ts +130 -0
- package/src/mcp/resources.ts +12 -9
- package/src/mcp/server.ts +13 -1
- package/src/mcp/tools.ts +271 -102
package/README.de.md
CHANGED
|
@@ -1186,13 +1186,13 @@ Die `context_*`-Werkzeuge ersetzen 3–6 separate Werkzeugaufrufe durch einen ei
|
|
|
1186
1186
|
```
|
|
1187
1187
|
Szenario Ohne Mit Gespart Werkzeuge
|
|
1188
1188
|
─────────────────────────────── ──────── ────── ─────── ────────
|
|
1189
|
-
context_generate (vollst.)
|
|
1189
|
+
context_generate (vollst.) 6,408 378 94,1% 6 → 1
|
|
1190
1190
|
context_diff (inkrementell) 533 152 71,5% 4 → 1
|
|
1191
1191
|
context_focus (gezielt) 413 225 45,5% 4 → 1
|
|
1192
1192
|
context_health (Prüfung) 322 246 23,6% 5 → 1
|
|
1193
1193
|
context_export (injizierbar md) 1,178 218 81,5% 3 → 1
|
|
1194
1194
|
─────────────────────────────── ──────── ────── ─────── ────────
|
|
1195
|
-
GESAMT 8,
|
|
1195
|
+
GESAMT 8,854 1,219 86,2% 22 → 5
|
|
1196
1196
|
```
|
|
1197
1197
|
|
|
1198
1198
|
**Was jedes Szenario misst:**
|
package/README.es.md
CHANGED
|
@@ -1139,13 +1139,13 @@ Las herramientas `context_*` reemplazan 3–6 llamadas separadas de herramientas
|
|
|
1139
1139
|
```
|
|
1140
1140
|
Escenario Sin Con Ahorro Herramientas
|
|
1141
1141
|
─────────────────────────────── ──────── ────── ─────── ────────────
|
|
1142
|
-
context_generate (briefing completo)
|
|
1142
|
+
context_generate (briefing completo) 6,408 378 94.1% 6 → 1
|
|
1143
1143
|
context_diff (incremental) 533 152 71.5% 4 → 1
|
|
1144
1144
|
context_focus (enfocado) 413 225 45.5% 4 → 1
|
|
1145
1145
|
context_health (auditoría) 322 246 23.6% 5 → 1
|
|
1146
1146
|
context_export (md inyectable) 1,178 218 81.5% 3 → 1
|
|
1147
1147
|
─────────────────────────────── ──────── ────── ─────── ────────────
|
|
1148
|
-
TOTAL 8,
|
|
1148
|
+
TOTAL 8,854 1,219 86.2% 22 → 5
|
|
1149
1149
|
```
|
|
1150
1150
|
|
|
1151
1151
|
**Qué mide cada escenario:**
|
package/README.fr.md
CHANGED
|
@@ -1185,13 +1185,13 @@ Les outils `context_*` remplacent 3 à 6 appels d'outils séparés par un seul a
|
|
|
1185
1185
|
```
|
|
1186
1186
|
Scénario Sans Avec Économie Outils
|
|
1187
1187
|
────────────────────────────── ──────── ────── ─────── ──────
|
|
1188
|
-
context_generate (briefing)
|
|
1188
|
+
context_generate (briefing) 6,408 378 94.1% 6 → 1
|
|
1189
1189
|
context_diff (incrémental) 533 152 71.5% 4 → 1
|
|
1190
1190
|
context_focus (ciblé) 413 225 45.5% 4 → 1
|
|
1191
1191
|
context_health (audit) 322 246 23.6% 5 → 1
|
|
1192
1192
|
context_export (md injectable) 1,178 218 81.5% 3 → 1
|
|
1193
1193
|
────────────────────────────── ──────── ────── ─────── ──────
|
|
1194
|
-
TOTAL 8,
|
|
1194
|
+
TOTAL 8,854 1,219 86.2% 22 → 5
|
|
1195
1195
|
```
|
|
1196
1196
|
|
|
1197
1197
|
**Ce que mesure chaque scénario :**
|
package/README.ja.md
CHANGED
|
@@ -1184,13 +1184,13 @@ memory_smart_recall ~850 -72%
|
|
|
1184
1184
|
```
|
|
1185
1185
|
シナリオ なし あり 節約 ツール数
|
|
1186
1186
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1187
|
-
context_generate (完全ブリーフィング)
|
|
1187
|
+
context_generate (完全ブリーフィング) 6,408 378 94.1% 6 → 1
|
|
1188
1188
|
context_diff (インクリメンタル) 533 152 71.5% 4 → 1
|
|
1189
1189
|
context_focus (ターゲット) 413 225 45.5% 4 → 1
|
|
1190
1190
|
context_health (監査) 322 246 23.6% 5 → 1
|
|
1191
1191
|
context_export (注入可能md) 1,178 218 81.5% 3 → 1
|
|
1192
1192
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1193
|
-
合計 8,
|
|
1193
|
+
合計 8,854 1,219 86.2% 22 → 5
|
|
1194
1194
|
```
|
|
1195
1195
|
|
|
1196
1196
|
**各シナリオの測定内容:**
|
package/README.ko.md
CHANGED
|
@@ -1186,13 +1186,13 @@ memory_smart_recall ~850 -72%
|
|
|
1186
1186
|
```
|
|
1187
1187
|
시나리오 없이 있음 절약 도구
|
|
1188
1188
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1189
|
-
context_generate (전체 브리핑)
|
|
1189
|
+
context_generate (전체 브리핑) 6,408 378 94.1% 6 → 1
|
|
1190
1190
|
context_diff (증분) 533 152 71.5% 4 → 1
|
|
1191
1191
|
context_focus (집중) 413 225 45.5% 4 → 1
|
|
1192
1192
|
context_health (감사) 322 246 23.6% 5 → 1
|
|
1193
1193
|
context_export (주입 가능 md) 1,178 218 81.5% 3 → 1
|
|
1194
1194
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1195
|
-
합계 8,
|
|
1195
|
+
합계 8,854 1,219 86.2% 22 → 5
|
|
1196
1196
|
```
|
|
1197
1197
|
|
|
1198
1198
|
**각 시나리오가 측정하는 것:**
|
package/README.md
CHANGED
|
@@ -153,15 +153,26 @@ The installer will:
|
|
|
153
153
|
|
|
154
154
|
### 3. Use it
|
|
155
155
|
|
|
156
|
-
That's it!
|
|
156
|
+
That's it! On OpenCode, `toon-memory brief` is injected automatically at session start: a compact handoff packet with `identity` (including the exact `mcp_project` slug), `freshness`, directives, traps, decisions and file pointers. No manual bootstrap call is needed.
|
|
157
|
+
|
|
158
|
+
When a task is known, use:
|
|
157
159
|
|
|
158
160
|
```bash
|
|
159
|
-
|
|
160
|
-
memory_recall
|
|
161
|
-
memory_remember
|
|
161
|
+
context_brief(task="...") # handoff packet + relevant memory + sessions
|
|
162
|
+
memory_recall(query=...) # drill into a path or concept before reading files
|
|
163
|
+
memory_remember(...) # save important decisions
|
|
162
164
|
```
|
|
163
165
|
|
|
164
|
-
|
|
166
|
+
CLI equivalents for hooks and debugging:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
toon-memory brief [task] # compact handoff packet
|
|
170
|
+
toon-memory doctor # memory path, freshness, injection channel, catalog mode
|
|
171
|
+
toon-memory signal ... # append one deterministic session signal
|
|
172
|
+
toon-memory promote # promote high-confidence signals into memory
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
> **Tip:** The brief is a handoff, not a search result: if its `freshness` marker says `stale-Nd`, treat older entries as historical context and verify before acting. Advanced tools are hidden by default; set `TOON_MEMORY_EXPERT_TOOLS=1` to expose the full catalog.
|
|
165
176
|
|
|
166
177
|
### MCP Client Quick Setup
|
|
167
178
|
|
|
@@ -265,7 +276,9 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
|
265
276
|
| `memory_export_global` | Write current project memory to the global file (`~/.toon-memory/memory/global.toon`). One-shot share of cross-project conventions |
|
|
266
277
|
| `memory_import_global` | Merge cross-project conventions from the global file into this project (one-shot, deterministic, offline). `merge: false` replaces instead |
|
|
267
278
|
| `memory_graph_path` | BFS shortest path between two entries in the knowledge graph. Shows how concepts are connected |
|
|
268
|
-
| `context_brief` | **One-call
|
|
279
|
+
| `context_brief` | **One-call handoff + briefing**: prepends a compact handoff packet (`identity`, `mcp_project`, `freshness`, directives, traps, file pointers) to memory + sessions + health. `handoff: false` returns the legacy briefing only. Zero LLM, deterministic |
|
|
280
|
+
| `context_compile` | **Task-driven context compiler**: directives, constraints, retrieved memory, retrieval plan, hydrate keys, files and sessions in one packet. Use at task start |
|
|
281
|
+
| `context_hydrate` | **Hydrate by key**: fetch exact memory entries by key/id and mark them accessed. Follow the `Hydrate` list from `context_compile` |
|
|
269
282
|
| `context_generate` | **Full project briefing**: combines project structure, git state, memory entries, and active sessions in one call. Replaces 5-6 manual tool calls |
|
|
270
283
|
| `context_diff` | **Incremental briefing**: git commits + modified files + new/updated memory + active sessions since last session |
|
|
271
284
|
| `context_focus` | **Hyper-focused briefing**: only relevant memory + related source files + callers + test files for a query |
|
|
@@ -273,8 +286,10 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
|
273
286
|
| `context_export` | **Export memory as markdown**: injectable context for system prompts (full or compact) |
|
|
274
287
|
| `memory_pin` | **Pin an entry with priority 1-5**: pinned entries always appear first in recall results sorted by priority, even without a keyword match |
|
|
275
288
|
| `memory_unpin` | **Unpin an entry**: remove the priority flag |
|
|
276
|
-
| `memory_search` | **Unified search with filters**: same as `memory_recall` plus `category`, `tags`, `from_date`, `to_date` filters. Tag filter uses AND logic — all specified tags must match. `budget` controls output verbosity. `path_scope` filters by glob pattern. `sessionBias` boosts entries from the current git branch |
|
|
289
|
+
| `memory_search` | **Unified search with filters**: same as `memory_recall` plus `category`, `tags`, `from_date`, `to_date` filters. Dates accept compact (`7d`) or natural forms (`ayer`, `la semana pasada`, `hace 3 dias`, `last 2 weeks`). Tag filter uses AND logic — all specified tags must match. `budget` controls output verbosity. `path_scope` filters by glob pattern. `sessionBias` boosts entries from the current git branch |
|
|
277
290
|
| `memory_tag` | **Batch tag operations**: `add`, `remove`, or `set` tags on one or more entries by key or id |
|
|
291
|
+
| `memory_feedback` | **Explicit feedback** (`useful`/`irrelevant`/`outdated`/`wrong`) written to `feedback.toon`. Trains per-entry utility; `wrong` also marks evidence as `conflict` |
|
|
292
|
+
| `memory_edges` | **Typed edge sidecar** (`edges.toon`): `list` derived/learned edges or `rebuild` them from `links` + feedback. Enables opt-in spread activation in recall |
|
|
278
293
|
|
|
279
294
|
### MCP Resources
|
|
280
295
|
|
|
@@ -748,6 +763,19 @@ Recall is deterministic and offline (no embeddings, no LLM). Each candidate entr
|
|
|
748
763
|
|
|
749
764
|
In `graph` mode, recall seeds on keyword matches, expands the ego-subgraph up to `hops`, and returns the top `limit` (default 6) by combined score. `memory_smart_recall` combines all these signals in one call.
|
|
750
765
|
|
|
766
|
+
### Learned ranking, edges and optional dense retrieval
|
|
767
|
+
|
|
768
|
+
Four opt-in sidecars extend recall without changing `data.toon`:
|
|
769
|
+
|
|
770
|
+
| Sidecar | Enabled by | Purpose |
|
|
771
|
+
|---------|-----------|---------|
|
|
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
|
+
| `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` + `build` | Optional local embeddings via `toon-memory-dense`. Falls back to BM25 when the module or model is unavailable. |
|
|
775
|
+
| `observations.toon` | capture hooks + `toon-memory sleep` | Opt-in end-of-session consolidation: promote observations, rebuild edges, prune expired signals, dedupe. |
|
|
776
|
+
|
|
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.
|
|
778
|
+
|
|
751
779
|
### Auto-tag from project dependencies
|
|
752
780
|
|
|
753
781
|
On `toon-memory init`, the CLI scans your dependency manifests and writes a `vocab` table into `.toon-memory/memory/config.json`:
|
|
@@ -897,6 +925,9 @@ npx toon-memory viewer --export # Save viewer as static HTML
|
|
|
897
925
|
npx toon-memory viewer --port 3001 # Custom port
|
|
898
926
|
npx toon-memory watch [options] # Auto-backup with options
|
|
899
927
|
npx toon-memory upgrade # Update to latest version
|
|
928
|
+
npx toon-memory sleep # Deterministic consolidation (opt-in)
|
|
929
|
+
npx toon-memory dense status # Optional embeddings status
|
|
930
|
+
npx toon-memory dense enable && npx toon-memory dense build
|
|
900
931
|
npx toon-memory uninstall # Remove from all agents
|
|
901
932
|
```
|
|
902
933
|
|
|
@@ -997,8 +1028,23 @@ The installer (requires a terminal) will:
|
|
|
997
1028
|
|
|
998
1029
|
> Sin una terminal (CI/pipes) `npx toon-memory` imprime la ayuda de instalación no interactiva. Usa `npx toon-memory init [local|global]` para instalar sin preguntas. Unknown commands print usage and exit with an error.
|
|
999
1030
|
|
|
1031
|
+
### Memory config flags
|
|
1000
1032
|
|
|
1033
|
+
All flags live in `.toon-memory/memory/config.json` and are optional:
|
|
1034
|
+
|
|
1035
|
+
```json
|
|
1036
|
+
{
|
|
1037
|
+
"feedback": { "implicit": false },
|
|
1038
|
+
"graph": { "activation": false },
|
|
1039
|
+
"sleep": { "enabled": false },
|
|
1040
|
+
"dense": { "enabled": false, "model": "multilingual-e5-small" }
|
|
1041
|
+
}
|
|
1042
|
+
```
|
|
1001
1043
|
|
|
1044
|
+
- `feedback.implicit` is reserved; only explicit `memory_feedback` events affect ranking today.
|
|
1045
|
+
- `graph.activation` enables spread activation over `edges.toon` (rebuild with `memory_edges(action="rebuild")`).
|
|
1046
|
+
- `sleep.enabled` (or `TOON_MEMORY_SLEEP=1`) runs consolidation on session `Stop`.
|
|
1047
|
+
- `dense.enabled` enables `vectors.bin`; install the embedder with `npx toon-memory dense install`. `TOON_MEMORY_DENSE_MODULE` overrides the module path. If anything is missing, recall stays BM25-only.
|
|
1002
1048
|
|
|
1003
1049
|
### OpenCode
|
|
1004
1050
|
|
|
@@ -1197,13 +1243,13 @@ The `context_*` tools replace 3–6 separate tool calls with a single call, savi
|
|
|
1197
1243
|
```
|
|
1198
1244
|
Scenario Without With Saved Tools
|
|
1199
1245
|
──────────────────────────────── ──────── ────── ─────── ──────
|
|
1200
|
-
context_generate (full briefing)
|
|
1246
|
+
context_generate (full briefing) 6,408 378 94.1% 6 → 1
|
|
1201
1247
|
context_diff (incremental) 533 152 71.5% 4 → 1
|
|
1202
1248
|
context_focus (targeted) 413 225 45.5% 4 → 1
|
|
1203
1249
|
context_health (audit) 322 246 23.6% 5 → 1
|
|
1204
1250
|
context_export (injectable md) 1,178 218 81.5% 3 → 1
|
|
1205
1251
|
──────────────────────────────── ──────── ────── ─────── ──────
|
|
1206
|
-
TOTAL 8,
|
|
1252
|
+
TOTAL 8,854 1,219 86.2% 22 → 5
|
|
1207
1253
|
```
|
|
1208
1254
|
|
|
1209
1255
|
**What each scenario measures:**
|
|
@@ -1376,8 +1422,8 @@ toon-memory/
|
|
|
1376
1422
|
│ │ ├── setup.ts # CLI commands
|
|
1377
1423
|
│ │ └── toon-memory.ts # CLI runner
|
|
1378
1424
|
│ ├── mcp/
|
|
1379
|
-
│ │ ├── server.ts # MCP server (
|
|
1380
|
-
│ │ ├── tools.ts # Tool registration (
|
|
1425
|
+
│ │ ├── server.ts # MCP server (core catalog + expert mode; 4 resources + 1 prompt)
|
|
1426
|
+
│ │ ├── tools.ts # Tool registration (TOON_MEMORY_EXPERT_TOOLS=1 exposes advanced tools)
|
|
1381
1427
|
│ │ ├── resources.ts # Resource registration (4 resources)
|
|
1382
1428
|
│ │ ├── prompts.ts # Prompt registration (1 prompt)
|
|
1383
1429
|
│ │ ├── session-store.ts # Session layer (auto-promote, cleanup)
|
package/README.pt-br.md
CHANGED
|
@@ -1186,13 +1186,13 @@ As ferramentas `context_*` substituem 3–6 chamadas de ferramentas separadas po
|
|
|
1186
1186
|
```
|
|
1187
1187
|
Cenário Sem Com Economia Ferramentas
|
|
1188
1188
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1189
|
-
context_generate (briefing)
|
|
1189
|
+
context_generate (briefing) 6,408 378 94.1% 6 → 1
|
|
1190
1190
|
context_diff (incremental) 533 152 71.5% 4 → 1
|
|
1191
1191
|
context_focus (direcionado) 413 225 45.5% 4 → 1
|
|
1192
1192
|
context_health (auditoria) 322 246 23.6% 5 → 1
|
|
1193
1193
|
context_export (md injetável) 1,178 218 81.5% 3 → 1
|
|
1194
1194
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1195
|
-
TOTAL 8,
|
|
1195
|
+
TOTAL 8,854 1,219 86.2% 22 → 5
|
|
1196
1196
|
```
|
|
1197
1197
|
|
|
1198
1198
|
**O que cada cenário mede:**
|
package/README.zh.md
CHANGED
|
@@ -1185,13 +1185,13 @@ memory_smart_recall ~850 -72%
|
|
|
1185
1185
|
```
|
|
1186
1186
|
场景 无工具 有工具 节省 工具调用
|
|
1187
1187
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1188
|
-
context_generate (完整简报)
|
|
1188
|
+
context_generate (完整简报) 6,408 378 94.1% 6 → 1
|
|
1189
1189
|
context_diff (增量简报) 533 152 71.5% 4 → 1
|
|
1190
1190
|
context_focus (精准简报) 413 225 45.5% 4 → 1
|
|
1191
1191
|
context_health (健康审计) 322 246 23.6% 5 → 1
|
|
1192
1192
|
context_export (可注入 markdown) 1,178 218 81.5% 3 → 1
|
|
1193
1193
|
─────────────────────────────── ──────── ────── ─────── ──────
|
|
1194
|
-
总计 8,
|
|
1194
|
+
总计 8,854 1,219 86.2% 22 → 5
|
|
1195
1195
|
```
|
|
1196
1196
|
|
|
1197
1197
|
**各场景衡量内容:**
|
package/bin/toon-memory.js
CHANGED
|
@@ -42,6 +42,10 @@ Commands:
|
|
|
42
42
|
viewer [--port <n>] Open the interactive graph viewer in a browser (auto-picks a free port)
|
|
43
43
|
uninstall Remove toon-memory from all agents
|
|
44
44
|
capture <on|off> Enable/disable activity capture hooks
|
|
45
|
+
brief [task] Print the compact handoff brief for session start
|
|
46
|
+
doctor Check memory path, signals and injection channel
|
|
47
|
+
signal --type <t> --summary <s> Append one deterministic signal
|
|
48
|
+
promote Promote high-confidence signals into memory
|
|
45
49
|
upgrade Upgrade to the latest version
|
|
46
50
|
|
|
47
51
|
Options:
|