linksee-memory 0.0.9 → 0.0.10

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.
Files changed (2) hide show
  1. package/dist/mcp/server.js +30 -10
  2. package/package.json +1 -1
@@ -276,16 +276,36 @@ function handleRecall(args) {
276
276
  ok: true,
277
277
  count: top.length,
278
278
  search: searchMethod,
279
- memories: top.map((r) => ({
280
- id: r.id,
281
- entity: { name: r.entity_name, kind: r.entity_kind, momentum: r.momentum_score },
282
- layer: r.layer,
283
- content: r.content,
284
- importance: r.importance,
285
- heat: Number(r.heat_score.toFixed(1)),
286
- band: r.heat_band,
287
- composite: Number(r.composite_score.toFixed(3)),
288
- })),
279
+ memories: top.map((r) => {
280
+ // `content` is stored as JSON stringify-ed so we can enforce schema per
281
+ // layer, but agents receiving it via MCP then have to parse it again —
282
+ // extra tokens and a round-trip. Try to pre-parse; if the stored value
283
+ // isn't JSON (legacy plaintext memory), fall back to the raw string.
284
+ // content_raw preserves backward compatibility for callers who depend
285
+ // on the stringified form.
286
+ let parsedContent = r.content;
287
+ try {
288
+ parsedContent = JSON.parse(r.content);
289
+ }
290
+ catch {
291
+ // leave as string
292
+ }
293
+ return {
294
+ id: r.id,
295
+ entity: {
296
+ name: r.entity_name,
297
+ kind: r.entity_kind,
298
+ momentum: r.momentum_score,
299
+ },
300
+ layer: r.layer,
301
+ content: parsedContent,
302
+ content_raw: r.content,
303
+ importance: r.importance,
304
+ heat: Number(r.heat_score.toFixed(1)),
305
+ band: r.heat_band,
306
+ composite: Number(r.composite_score.toFixed(3)),
307
+ };
308
+ }),
289
309
  });
290
310
  }
291
311
  function handleForget(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linksee-memory",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "mcpName": "io.github.michielinksee/linksee-memory",
5
5
  "description": "Local-first agent memory MCP — cross-agent brain with 6-layer structured memory + token-saving file diff cache",
6
6
  "type": "module",