@yottameta/yotta-memory 0.6.1 → 0.6.2

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/SKILL.md CHANGED
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: yotta-memory
3
3
  description: "元忆 —— 有权限边界的文件式智能体记忆。文件式、零依赖、可 diff/回滚:让任何 AI 智能体活过会话,开工 recall 恢复上下文、重要信息 remember 落盘、收工归档。类型体系 FACT(公共共享)/ PREF / BOUND / COMMIT(私密隔离)。触发:记住、别忘了、记一笔、记忆、remember、recall、跨会话、上次说到、续测、交接、归档、记忆盘、共享记忆、局域网记忆、画像、开工上下文、记忆守则、profile、context、越用越懂"
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  license: MIT
6
6
  ---
7
7
 
8
8
  # yotta-memory(元忆)— 有权限边界的文件式智能体记忆
9
9
 
10
10
  > 一句话:元忆 —— 有权限边界的文件式智能体记忆(不注入、可 diff、能回滚;FACT 共享、PREF / BOUND / COMMIT 私密隔离)。
11
- > 版本:0.6.1 | 最后更新:2026-08-25
11
+ > 版本:0.6.2 | 最后更新:2026-08-25
12
12
 
13
13
  ## 这是什么
14
14
 
@@ -7,6 +7,7 @@
7
7
  // v0.5.4 新增:lan enable 在非管理员(schtasks Access denied)时自动降级为用户级 Startup 静默自启(VBS sh.Run 窗口0 + autostart.cmd,node 路径 process.execPath 自动探测);lan disable/status 同时管理计划任务与 Startup 双机制
8
8
  // v0.6.0 新增:灵魂盘核心——profile(用户画像聚合,零推断)/ context(开工上下文包)/ iam 扩展(--name/--user/--relationship)/ remember --verify(写后回读)与 --no-hint(关闭类型启发式提示)+ SKILL「记忆守则」
9
9
  // v0.6.1 新增:灵魂盘机制精髓补齐——context --budget(token 预算,近记忆按剩余预算放行)/ context 内嵌「多智能体接入铁律」段 / remember --source/--weight(来源 + 重要性权重,去重 weight 取 max)/ 近期记忆排序融合 importance(confidence×recency+updated+weight+immutable)
10
+ // v0.6.2 修复:remember --verify 写后回读改为直查索引 + 权限判定 + 召回匹配性(不再依赖 recall top-N 排序,消除泛化 subject 下偶发误报「回读未命中」)
10
11
  'use strict';
11
12
 
12
13
  const fs = require('fs');
@@ -16,7 +17,7 @@ const crypto = require('crypto');
16
17
  const http = require('http');
17
18
  const child_process = require('child_process');
18
19
 
19
- const VERSION = '0.6.1';
20
+ const VERSION = '0.6.2';
20
21
  const TYPES = ['FACT', 'PREF', 'BOUND', 'COMMIT'];
21
22
  const TYPE_DIRS = { FACT: 'facts', PREF: 'prefs', BOUND: 'bounds', COMMIT: 'commits' };
22
23
  const PUBLIC_DIR = 'facts';
@@ -366,6 +367,24 @@ function classifyRead(entry, agent, ownerFilter, unsafe, selfAgent) {
366
367
  if (hasGrant(agent || selfAgent, owner)) return 'read';
367
368
  return 'denied';
368
369
  }
370
+ // verify 写后回读:直查索引 + 权限判定 + 召回匹配性,不依赖 recall top-N 排序
371
+ // (v0.6.2 修复:泛化 subject 下新条目被挤出前 N 条导致误报「回读未命中」)
372
+ function verifyWrittenReadable(root, rel, subj, agent) {
373
+ const entries = ensureIndex(root);
374
+ let target = null;
375
+ for (const e of entries) { if (e.file === rel) { target = e; break; } }
376
+ if (!target) return false;
377
+ if (classifyRead(target, agent, '', false, agent) !== 'read') return false;
378
+ const q = String(subj || '').toLowerCase();
379
+ const qtoks = tokenize(q);
380
+ let score = 0;
381
+ for (const tt of qtoks) { if (target.tokens && target.tokens[tt]) score += target.tokens[tt]; }
382
+ if (score === 0) {
383
+ const hay = ((target.subject || '') + ' ' + (target.statement || '') + ' ' + target.tags.join(' ')).toLowerCase();
384
+ if (hay.indexOf(q) !== -1) score = 1;
385
+ }
386
+ return score > 0;
387
+ }
369
388
 
370
389
  // ---- 命令 core(CLI 与 MCP 共用;返回 { error, exitCode, text },不 process.exit)----
371
390
  function initCore(opts) {
@@ -415,8 +434,7 @@ function rememberCore(type, subject, statement, opts) {
415
434
  }
416
435
  if (opts.verify) {
417
436
  const rel = path.relative(root, fp).replace(/\\/g, '/');
418
- const rr = recallCore(subj, { limit: 10, agent: selfAgent || opts.agent });
419
- const ok = rr.text.replace(/\\/g, '/').indexOf(rel) !== -1;
437
+ const ok = verifyWrittenReadable(root, rel, subj, selfAgent || opts.agent);
420
438
  text += '\n[verify] ' + (ok ? '已写回读 OK: ' + rel : '回读未命中,请检查: ' + rel);
421
439
  }
422
440
  return { error: false, text: text };
@@ -443,8 +461,7 @@ function rememberCore(type, subject, statement, opts) {
443
461
  }
444
462
  if (opts.verify) {
445
463
  const rel = path.relative(root, file).replace(/\\/g, '/');
446
- const rr = recallCore(subj, { limit: 10, agent: selfAgent || opts.agent });
447
- const ok = rr.text.replace(/\\/g, '/').indexOf(rel) !== -1;
464
+ const ok = verifyWrittenReadable(root, rel, subj, selfAgent || opts.agent);
448
465
  text += '\n[verify] ' + (ok ? '已写回读 OK: ' + rel : '回读未命中,请检查: ' + rel);
449
466
  }
450
467
  return { error: false, text: text };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yottameta/yotta-memory",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "元忆 —— 有权限边界的文件式智能体记忆。文件式、零依赖、可 diff/回滚;FACT/PREF/BOUND/COMMIT 四分类(公共共享/私密隔离),用户级+项目级双级存储。",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -1,4 +1,4 @@
1
- # yotta-memory 协议规范 v0.6.1
1
+ # yotta-memory 协议规范 v0.6.2
2
2
 
3
3
  > 本文件定义 yotta-memory 记忆标准:存储位置、目录结构、文件格式、类型体系与 CLI 命令参考。
4
4
  > 目标:任何支持 Agent Skills 开放标准的智能体,装完即可读写同一份记忆。