toon-memory 2.10.0 → 2.11.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/mcp/server.js CHANGED
@@ -28296,6 +28296,7 @@ function importance(e) {
28296
28296
  return recency * 0.6 + freq * 0.4;
28297
28297
  }
28298
28298
  var tokenize = (s) => s.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[-_]/g, " ").toLowerCase().split(/\s+/).filter(Boolean);
28299
+ var isPrivate = (e) => e.tags.some((t) => t.toLowerCase() === "private");
28299
28300
 
28300
28301
  // src/mcp/entries.ts
28301
28302
  function generateId() {
@@ -28958,6 +28959,7 @@ function generateSystemPrimer(data) {
28958
28959
  if (entries.length === 0) return "Empty memory. No entries saved.";
28959
28960
  const byCategory = {};
28960
28961
  for (const e of entries) {
28962
+ if (isPrivate(e)) continue;
28961
28963
  if (!byCategory[e.category]) byCategory[e.category] = [];
28962
28964
  byCategory[e.category].push(e);
28963
28965
  }
@@ -28966,7 +28968,7 @@ function generateSystemPrimer(data) {
28966
28968
  `Entries: ${entries.length}`,
28967
28969
  ""
28968
28970
  ];
28969
- const top = [...entries].sort((a, b) => importance(b) - importance(a)).slice(0, 5);
28971
+ const top = [...entries].filter((e) => !isPrivate(e)).sort((a, b) => importance(b) - importance(a)).slice(0, 5);
28970
28972
  lines.push("Top memories:");
28971
28973
  for (const e of top) {
28972
28974
  const quality = qualityScore(
@@ -29638,7 +29640,7 @@ function formatRelevantEntries(data, task, limit = 6) {
29638
29640
  const cent = centrality(adjacency);
29639
29641
  const qTokens = tokenize(task);
29640
29642
  const expandedTokens = expandSynonyms(qTokens);
29641
- const scored = entries.filter((e) => !(e.ttl && isExpiredLocal(e.ttl))).map((e) => {
29643
+ const scored = entries.filter((e) => !(e.ttl && isExpiredLocal(e.ttl)) && !isPrivate(e)).map((e) => {
29642
29644
  const text = normalize(
29643
29645
  `${e.id} ${e.category} ${e.key} ${e.content} ${e.file} ${e.tags.join(" ")}`
29644
29646
  );
@@ -29669,7 +29671,7 @@ ${rendered}`;
29669
29671
  }
29670
29672
  function formatPatterns(data) {
29671
29673
  const entries = parseEntries(data);
29672
- const patterns = entries.filter((e) => e.category === "pattern").sort((a, b) => importance(b) - importance(a)).slice(0, 5);
29674
+ const patterns = entries.filter((e) => e.category === "pattern" && !isPrivate(e)).sort((a, b) => importance(b) - importance(a)).slice(0, 5);
29673
29675
  if (patterns.length === 0) return "";
29674
29676
  const lines = patterns.map(
29675
29677
  (e) => `- **${e.key}**: ${e.content.slice(0, 120)}`
@@ -29746,7 +29748,7 @@ function generateContextBrief(data, opts = {}) {
29746
29748
  function formatTopEntries(data, limit) {
29747
29749
  const entries = parseEntries(data);
29748
29750
  if (entries.length === 0) return "";
29749
- const top = [...entries].filter((e) => !(e.ttl && isExpiredLocal(e.ttl))).sort((a, b) => importance(b) - importance(a)).slice(0, limit);
29751
+ const top = [...entries].filter((e) => !(e.ttl && isExpiredLocal(e.ttl)) && !isPrivate(e)).sort((a, b) => importance(b) - importance(a)).slice(0, limit);
29750
29752
  if (top.length === 0) return "";
29751
29753
  const rendered = renderCompact(top);
29752
29754
  return `## Top memories
@@ -30001,6 +30003,7 @@ Date: ${today} | Entries: ${entries.length}
30001
30003
  }
30002
30004
  const byCategory = {};
30003
30005
  for (const e of entries) {
30006
+ if (isPrivate(e)) continue;
30004
30007
  if (!byCategory[e.category]) byCategory[e.category] = [];
30005
30008
  byCategory[e.category].push(e);
30006
30009
  }
@@ -30060,7 +30063,7 @@ function registerTools(server2) {
30060
30063
  "memory_remember",
30061
30064
  {
30062
30065
  title: "Save to Memory",
30063
- description: "Save a fact to the project's persistent memory (decisions, patterns, bugs, knowledge). Persists between sessions. To mark an entry as obsolete, save a new entry with tags containing 'superseded' (e.g. tags: 'superseded;zod').",
30066
+ description: "Save a fact to the project's persistent memory (decisions, patterns, bugs, knowledge). Persists between sessions. Tags: 'private' excludes from context injection; 'superseded' marks as obsolete.",
30064
30067
  inputSchema: {
30065
30068
  category: external_exports.enum(["decision", "pattern", "bug", "knowledge"]).describe("Category of the fact"),
30066
30069
  key: external_exports.string().describe("Short title in kebab-case (e.g. risk-engine-priority)"),
@@ -30151,7 +30154,7 @@ ${content}${ttlMsg}${inferredMsg}${archiveMsg}${mergeInfo}${relatedMsg}` }]
30151
30154
  "memory_recall",
30152
30155
  {
30153
30156
  title: "Search Memory",
30154
- description: "Search the project's persistent memory. Returns relevant entries. Use BEFORE reading files.",
30157
+ description: "Search the project's persistent memory. Returns relevant entries. Use BEFORE reading files. Pattern: recall \u2192 context_diff for recent changes \u2192 capture to save observations.",
30155
30158
  inputSchema: {
30156
30159
  query: external_exports.string().describe("Text to search for"),
30157
30160
  category: external_exports.string().optional().default("").describe("Filter by category (empty = all)"),
@@ -30344,7 +30347,7 @@ ${formatted}` }] };
30344
30347
  "memory_smart_recall",
30345
30348
  {
30346
30349
  title: "Smart Recall (Unified)",
30347
- description: "Unified retrieval: combines BM25 + graph + decay + quality in a single call. Use at the START of each task to get all relevant memory context.",
30350
+ description: "Unified retrieval: combines BM25 + graph + decay + quality in a single call. Use at the START of each task to get all relevant memory context. Then use context_diff for recent changes, context_focus for deep dives.",
30348
30351
  inputSchema: {
30349
30352
  intent: external_exports.string().describe("Describe what you need to know (e.g. 'database schema for backend')"),
30350
30353
  limit: external_exports.number().optional().default(8).describe("Maximum entries to return"),
@@ -30794,7 +30797,7 @@ function registerResources(server2) {
30794
30797
 
30795
30798
  // src/mcp/server.ts
30796
30799
  var server = new McpServer(
30797
- { name: "toon-memory", version: "2.10.0" },
30800
+ { name: "toon-memory", version: "2.11.0" },
30798
30801
  { capabilities: { tools: { listChanged: true }, resources: { listChanged: true } } }
30799
30802
  );
30800
30803
  registerResources(server);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "MCP server giving AI coding agents offline, token-efficient persistent memory — 21 tools, 80% fewer tool calls, recall decisions, patterns, and bugs across sessions. No LLM, no server; works with 15+ agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,7 @@ import { existsSync, readFileSync } from "fs"
17
17
  import { join } from "path"
18
18
  import { parseEntries, buildGraph, bm25Scores, centrality, renderCompact, type GraphEntry } from "./graph"
19
19
  import { qualityScore } from "./quality"
20
- import { normalize, isExpiredLocal, tokenize, importance } from "./utils"
20
+ import { normalize, isExpiredLocal, tokenize, importance, isPrivate } from "./utils"
21
21
  import { expandSynonyms } from "./synonyms"
22
22
  import { fuzzyMatch } from "./fuzzy"
23
23
  import { coordinationView, currentBranch, pruneSessions, listSessions } from "./sessions"
@@ -65,7 +65,7 @@ function formatRelevantEntries(data: string, task: string, limit: number = 6): s
65
65
  const expandedTokens = expandSynonyms(qTokens)
66
66
 
67
67
  const scored = entries
68
- .filter((e) => !(e.ttl && isExpiredLocal(e.ttl)))
68
+ .filter((e) => !(e.ttl && isExpiredLocal(e.ttl)) && !isPrivate(e))
69
69
  .map((e) => {
70
70
  const text = normalize(
71
71
  `${e.id} ${e.category} ${e.key} ${e.content} ${e.file} ${e.tags.join(" ")}`
@@ -111,7 +111,7 @@ function formatRelevantEntries(data: string, task: string, limit: number = 6): s
111
111
  function formatPatterns(data: string): string {
112
112
  const entries = parseEntries(data)
113
113
  const patterns = entries
114
- .filter((e) => e.category === "pattern")
114
+ .filter((e) => e.category === "pattern" && !isPrivate(e))
115
115
  .sort((a, b) => importance(b) - importance(a))
116
116
  .slice(0, 5)
117
117
 
@@ -251,7 +251,7 @@ function formatTopEntries(data: string, limit: number): string {
251
251
  if (entries.length === 0) return ""
252
252
 
253
253
  const top = [...entries]
254
- .filter((e) => !(e.ttl && isExpiredLocal(e.ttl)))
254
+ .filter((e) => !(e.ttl && isExpiredLocal(e.ttl)) && !isPrivate(e))
255
255
  .sort((a, b) => importance(b) - importance(a))
256
256
  .slice(0, limit)
257
257
 
@@ -618,9 +618,10 @@ export function generateContextExport(data: string, format: ExportFormat = "full
618
618
  return sections.join("\n")
619
619
  }
620
620
 
621
- // Group by category
621
+ // Group by category (exclude private entries)
622
622
  const byCategory: Record<string, GraphEntry[]> = {}
623
623
  for (const e of entries) {
624
+ if (isPrivate(e)) continue
624
625
  if (!byCategory[e.category]) byCategory[e.category] = []
625
626
  byCategory[e.category].push(e)
626
627
  }
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { parseEntries, buildGraph, bm25Scores, centrality, renderCompact, type GraphEntry } from "./graph"
11
- import { normalize, isExpiredLocal, tokenize, importance } from "./utils"
11
+ import { normalize, isExpiredLocal, tokenize, importance, isPrivate } from "./utils"
12
12
  import { expandSynonyms } from "./synonyms"
13
13
  import { fuzzyMatch } from "./fuzzy"
14
14
 
@@ -172,6 +172,7 @@ export function generateSystemPrimer(data: string): string {
172
172
 
173
173
  const byCategory: Record<string, GraphEntry[]> = {}
174
174
  for (const e of entries) {
175
+ if (isPrivate(e)) continue
175
176
  if (!byCategory[e.category]) byCategory[e.category] = []
176
177
  byCategory[e.category].push(e)
177
178
  }
@@ -184,6 +185,7 @@ export function generateSystemPrimer(data: string): string {
184
185
 
185
186
  // Top entries by importance (global)
186
187
  const top = [...entries]
188
+ .filter((e) => !isPrivate(e))
187
189
  .sort((a, b) => importance(b) - importance(a))
188
190
  .slice(0, 5)
189
191
  lines.push("Top memories:")
package/src/lib/utils.ts CHANGED
@@ -29,3 +29,7 @@ export const tokenize = (s: string): string[] =>
29
29
  .toLowerCase()
30
30
  .split(/\s+/)
31
31
  .filter(Boolean)
32
+
33
+ /** Check if an entry is marked as private (excluded from context injection). */
34
+ export const isPrivate = (e: { tags: string[] }): boolean =>
35
+ e.tags.some((t) => t.toLowerCase() === "private")
package/src/mcp/tools.ts CHANGED
@@ -28,7 +28,7 @@ server.registerTool(
28
28
  "memory_remember",
29
29
  {
30
30
  title: "Save to Memory",
31
- description: "Save a fact to the project's persistent memory (decisions, patterns, bugs, knowledge). Persists between sessions. To mark an entry as obsolete, save a new entry with tags containing 'superseded' (e.g. tags: 'superseded;zod').",
31
+ description: "Save a fact to the project's persistent memory (decisions, patterns, bugs, knowledge). Persists between sessions. Tags: 'private' excludes from context injection; 'superseded' marks as obsolete.",
32
32
  inputSchema: {
33
33
  category: z.enum(["decision", "pattern", "bug", "knowledge"]).describe("Category of the fact"),
34
34
  key: z.string().describe("Short title in kebab-case (e.g. risk-engine-priority)"),
@@ -126,7 +126,7 @@ server.registerTool(
126
126
  "memory_recall",
127
127
  {
128
128
  title: "Search Memory",
129
- description: "Search the project's persistent memory. Returns relevant entries. Use BEFORE reading files.",
129
+ description: "Search the project's persistent memory. Returns relevant entries. Use BEFORE reading files. Pattern: recall → context_diff for recent changes → capture to save observations.",
130
130
  inputSchema: {
131
131
  query: z.string().describe("Text to search for"),
132
132
  category: z.string().optional().default("").describe("Filter by category (empty = all)"),
@@ -357,7 +357,7 @@ server.registerTool(
357
357
  "memory_smart_recall",
358
358
  {
359
359
  title: "Smart Recall (Unified)",
360
- description: "Unified retrieval: combines BM25 + graph + decay + quality in a single call. Use at the START of each task to get all relevant memory context.",
360
+ description: "Unified retrieval: combines BM25 + graph + decay + quality in a single call. Use at the START of each task to get all relevant memory context. Then use context_diff for recent changes, context_focus for deep dives.",
361
361
  inputSchema: {
362
362
  intent: z.string().describe("Describe what you need to know (e.g. 'database schema for backend')"),
363
363
  limit: z.number().optional().default(8).describe("Maximum entries to return"),