toon-memory 3.6.1 → 3.7.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.md +21 -3
- package/dist/cli/setup.js +14 -2
- package/mcp/server.js +527 -65
- package/package.json +3 -2
- package/src/lib/graph.ts +114 -11
- package/src/lib/quality.ts +44 -15
- package/src/mcp/tools.ts +458 -8
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Read [How toon-memory Makes Your AI Agent Smarter](https://luiggival08.github.io
|
|
|
65
65
|
|
|
66
66
|
## Features
|
|
67
67
|
|
|
68
|
-
- **
|
|
68
|
+
- **40 MCP tools** — Full memory management via Model Context Protocol, including `memory_smart_recall` (unified recall with session bias), `memory_sessions` for multi-session coordination, `context_*` tools for one-call context generation (briefing, diff, focus, health audit, export), `memory_compress` (LLM-powered compression), `memory_compress_all` (batch compression), `memory_primer` (auto-injected context), `memory_merge_sessions` (cross-session merge), `memory_pin`/`memory_unpin` (pin important entries with priority 1-5), `memory_checkpoint` (session snapshot with 7d TTL), `memory_search` (unified search with tag filters + session bias), `memory_tag` (batch tag operations), `memory_export_gist`/`memory_import_gist` (GitHub Gist sync), `memory_resolve` (restore soft-deleted entries), `memory_suppress` (mark entries as obsolete), `memory_reflect` (staleness/quality reflection), `memory_supersede` (replace an entry with a newer one, with `as_of` point-in-time recall), and `memory_promote` (auto-promote low-confidence drafts)
|
|
69
69
|
- **MCP Resources** — Read memory as context without tool invocations, including a System Primer (auto-generated knowledge map)
|
|
70
70
|
- **15 agents supported** — OpenCode, VS Code, Claude Code, Cursor, Windsurf, Cline, Continue, Codex CLI, Gemini CLI, Zed, Antigravity, Aider, KiloCode, OpenClaw, Kiro
|
|
71
71
|
- **Interactive installer** — Select which agents to configure from a menu
|
|
@@ -102,6 +102,11 @@ Read [How toon-memory Makes Your AI Agent Smarter](https://luiggival08.github.io
|
|
|
102
102
|
- **Origin Tracking** — Each entry tracks its origin (`human`, `agent`, `inferred`); human assertions get a quality boost
|
|
103
103
|
- **Soft Delete** — `memory_forget` soft-deletes by default (sets `status=obsolete`). Use `memory_resolve` to restore, `memory_suppress` to hide. Permanent deletion via `hard: true`
|
|
104
104
|
- **Enhanced Health Audit** — `context_health` now detects missing-evidence (path_scope without file) and stale-claims (overlapping content in same category)
|
|
105
|
+
- **Typed graph edges** — Edges carry types (`superseded_by`, `supersedes`, `relates`), written as `type:key` in the graph. Explicit `links` become `relates:key`, so you can tell *how* entries are related, not just that they are
|
|
106
|
+
- **RRF ranking** — Recall fuses BM25 (×3) and graph-centrality ranks with Reciprocal Rank Fusion and an adaptive `k = clamp(3..60, round(sqrt(n)))`. Benchmark (8 gold queries): nDCG 0.776, MRR 0.917 — exact parity with the previous linear scoring. Pass `rrf: false` to fall back
|
|
107
|
+
- **Memory reflect** — `memory_reflect` ranks entries by staleness, quality, and over-connection to surface what needs attention or cleanup. Deterministic, zero LLM
|
|
108
|
+
- **Memory supersede** — `memory_supersede` marks an entry as replaced by a newer one (`superseded_by` link + `supersededOn` date). `memory_recall({ as_of })` re-includes old entries for point-in-time queries before their supersession
|
|
109
|
+
- **Auto-promote** — `memory_promote` promotes low-confidence drafts to active entries deterministically (threshold 0.65, Jaccard dedup), with `dryRun` by default
|
|
105
110
|
|
|
106
111
|
---
|
|
107
112
|
|
|
@@ -1203,6 +1208,19 @@ Measured with `gpt-tokenizer` (cl100k_base) — see `scripts/bench-full-impact.m
|
|
|
1203
1208
|
|
|
1204
1209
|
> **Tip:** `memory_smart_recall` combines BM25 + graph + quality in one call, saving both tokens and tool-call overhead. Use it at the start of every task.
|
|
1205
1210
|
|
|
1211
|
+
### RRF ranking benchmark (measured)
|
|
1212
|
+
|
|
1213
|
+
Since v3.7.0, recall ranks results with **Reciprocal Rank Fusion** over BM25 (×3) and graph-centrality ranks, with an adaptive `k = clamp(3..60, round(sqrt(n)))`. Measured over 8 gold-standard queries with hand-labeled relevance (see `scripts/bench-rrf.mjs`, `npm run bench:rrf`):
|
|
1214
|
+
|
|
1215
|
+
```
|
|
1216
|
+
Metric linear (v3.6.x) RRF (v3.7.0)
|
|
1217
|
+
──────────── ───────────────── ────────────────
|
|
1218
|
+
nDCG@10 0.776 0.776 (parity)
|
|
1219
|
+
MRR 0.917 0.917 (parity)
|
|
1220
|
+
```
|
|
1221
|
+
|
|
1222
|
+
RRF matches the previous linear weighted score at **zero ranking cost**, while simplifying the scoring pipeline (BM25×3 + centrality, no importance/recency noise). Graph mode supersession is honored: obsolete entries stay excluded except for `as_of` point-in-time queries.
|
|
1223
|
+
|
|
1206
1224
|
---
|
|
1207
1225
|
|
|
1208
1226
|
## Troubleshooting
|
|
@@ -1295,8 +1313,8 @@ toon-memory/
|
|
|
1295
1313
|
│ │ ├── setup.ts # CLI commands
|
|
1296
1314
|
│ │ └── toon-memory.ts # CLI runner
|
|
1297
1315
|
│ ├── mcp/
|
|
1298
|
-
│ │ ├── server.ts # MCP server (
|
|
1299
|
-
│ │ ├── tools.ts # Tool registration (
|
|
1316
|
+
│ │ ├── server.ts # MCP server (40 tools + 4 resources + 1 prompt)
|
|
1317
|
+
│ │ ├── tools.ts # Tool registration (40 tools)
|
|
1300
1318
|
│ │ ├── resources.ts # Resource registration (4 resources)
|
|
1301
1319
|
│ │ ├── prompts.ts # Prompt registration (1 prompt)
|
|
1302
1320
|
│ │ ├── session-store.ts # Session layer (auto-promote, cleanup)
|
package/dist/cli/setup.js
CHANGED
|
@@ -1582,6 +1582,17 @@ function readMemory() {
|
|
|
1582
1582
|
}
|
|
1583
1583
|
|
|
1584
1584
|
// src/lib/graph.ts
|
|
1585
|
+
var DEFAULT_EDGE_TYPE = "related";
|
|
1586
|
+
function parseLinkToken(token) {
|
|
1587
|
+
const idx = token.lastIndexOf(":");
|
|
1588
|
+
if (idx === -1) return { type: DEFAULT_EDGE_TYPE, key: token };
|
|
1589
|
+
const type = token.slice(0, idx);
|
|
1590
|
+
const key = token.slice(idx + 1);
|
|
1591
|
+
return { type: type || DEFAULT_EDGE_TYPE, key: key || token };
|
|
1592
|
+
}
|
|
1593
|
+
function linkKey(token) {
|
|
1594
|
+
return parseLinkToken(token).key;
|
|
1595
|
+
}
|
|
1585
1596
|
var entryLines = (data) => data.split("\n").filter(
|
|
1586
1597
|
(l) => l.startsWith(" ") && l.includes("|") && !l.startsWith(" summaries:")
|
|
1587
1598
|
);
|
|
@@ -1606,7 +1617,8 @@ function parseEntries(data) {
|
|
|
1606
1617
|
priority: parts.length > 13 ? parseInt(parts[13]) || 0 : 0,
|
|
1607
1618
|
path_scope: parts.length > 14 ? parts[14] || "" : "",
|
|
1608
1619
|
origin: parts.length > 15 && parts[15] ? parts[15] : "agent",
|
|
1609
|
-
status: parts.length > 16 && parts[16] ? parts[16] : "active"
|
|
1620
|
+
status: parts.length > 16 && parts[16] ? parts[16] : "active",
|
|
1621
|
+
supersededOn: parts.length > 17 ? parts[17] || "" : ""
|
|
1610
1622
|
});
|
|
1611
1623
|
}
|
|
1612
1624
|
return out;
|
|
@@ -1626,7 +1638,7 @@ function buildGraph(entries) {
|
|
|
1626
1638
|
adj.get(b).add(a);
|
|
1627
1639
|
};
|
|
1628
1640
|
for (const e of entries) {
|
|
1629
|
-
for (const l of e.links) link(e.key, l);
|
|
1641
|
+
for (const l of e.links) link(e.key, linkKey(l));
|
|
1630
1642
|
const refs = e.content.match(/\[\[([\w-]+)\]\]/g) || [];
|
|
1631
1643
|
for (const r of refs) link(e.key, r.slice(2, -2));
|
|
1632
1644
|
}
|