@yottameta/yotta-memory 0.9.1 → 0.10.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/CHANGELOG.md CHANGED
@@ -1,4 +1,26 @@
1
- ## v0.9.1 (2026-09-03)
1
+ ## v0.10.0 (2026-09-02)
2
+
3
+ 压缩遗忘(S1)——consolidate 周期摘要 + 近重复自动合并 + 分类型衰减 + 批次回滚。
4
+
5
+ - **新增 `consolidate`(周期摘要压缩)**:把超龄(默认 ≥180 天)+ 长期闲置(默认 ≥90 天)+ 低效用(默认 ≤0.6)的同主题旧记忆聚类成**带溯源**的周期摘要并留在活跃区,原文整体移入 `.archive/`。默认 dry-run;`--apply` 执行;`--undo <batch>` 一键回滚(幂等拒绝重复);`--batches` 只读查批次审计。immutable / BOUND 豁免;活跃 / 高效用记忆不动;参数可调(--min-age / --min-idle / --max-utility / --min-group / --period / --type);`--model <cmd>` 可选本地模型提炼(仅 CLI,协议同 distill)。
6
+ - **近重复自动合并(maintain --dedup 增强)**:重复组带置信度分档(≥0.85 高置信 / 0.65–0.85 建议手动 / 其余忽略);`maintain --dedup --apply` 自动合并同归属高置信组(写批次审计可回滚)。**`--dedup` 与归档/遗忘互斥**:`--dedup [--apply]` 只查重 / 自动合并,不执行归档。
7
+ - **分类型衰减曲线**:效用分「时效」从全类型同一线性(365 天归零)改为**指数半衰** `0.5^(d/半衰)`——FACT 慢(默认 730 天)/ PREF 中(默认 365 天)/ COMMIT 任务类快(默认 90 天)/ BOUND 不衰减;半衰可用 `config set maintain_decay_halflife_<TYPE> <天>` 调整。
8
+ - **BOUND 归档豁免口径收口**:BOUND 永不归档 / 遗忘(行为对齐文档「immutable / BOUND 豁免」;此前代码只豁免遗忘)。
9
+ - **`.archive/` 路径带 owner**:公共 `.archive/facts/`;私密 `.archive/private/<owner>/<type>/`(archive / maintain / merge / consolidate 统一,修复跨 owner 同名撞名隐患;既有存量不迁移)。
10
+ - **`config set/get` 支持 maintain_* / consolidate_* 键**(此前文档写了但 CLI 写端只支持 3 个键)。
11
+ - **审计升级**:consolidate / 自动合并写批次审计(batch manifest + before/after 影像);`consolidate --batches` 可查、`--undo <batch>` 可回滚;`--purge` 硬删除维持不可回滚。
12
+ - **安全边界不变**:consolidate / undo / batches 属管理动作**不进 MCP**;maintain / archive 维持既有 MCP 暴露;自动合并全程受 owner 写权限约束,跨智能体只预览不执行。
13
+ - 测试:新增 `test/consolidate.test.js`(30 断言:dry-run / 公共与私密压缩 / immutable·BOUND 豁免 / 活跃与高效用保护 / min-group / undo 幂等 / 自动合并置信度 / 跨 owner 预览 / 归档互斥 / 衰减单元)+ `test/security-boundary.test.js` 扩至 9 断言(MCP 不暴露 consolidate / undo / batches);兼容回归 recall-context 4 断言全绿。
14
+ - 版本对齐:package.json / SKILL.md frontmatter / CHANGELOG / 引擎 VERSION / 插件 package.json = 0.10.0。
15
+
16
+ ## v0.9.2 (2026-09-02)
17
+
18
+ 发布日期修正。
19
+
20
+ - 修复 v0.9.1 SKILL.md 正文「最后更新」误写为 2026-09-03(实际发布日为 2026-09-02)的问题;校验工具同步新增「未来日期」拦截。
21
+ - 无功能变更。
22
+
23
+ ## v0.9.1 (2026-09-02)
2
24
 
3
25
  文档版本一致性修复。
4
26
 
package/README.md CHANGED
@@ -23,6 +23,8 @@
23
23
 
24
24
  > 📖 The user-facing operations manual lives in [USER_GUIDE.md](USER_GUIDE.md).
25
25
 
26
+ > 🆕 **v0.10.0**: compression & forgetting — `consolidate` turns old low-use memories on the same topic into one **provenance-carrying periodic summary** that stays searchable (originals archived; `consolidate --undo <batch>` restores everything); near-duplicate **auto-merge with confidence** (`maintain --dedup --apply`); **per-type decay curves** (FACT slow / PREF medium / COMMIT task-like fast / BOUND never decays); batch audit via `consolidate --batches`.
27
+
26
28
  > 🆕 **v0.9.0**: recall quality + context selection — optional local embedding plugin, `context --focus`, and `--explain` selection trace.
27
29
 
28
30
  > 🆕 **v0.8.5**: security hardening — MCP `distill` no longer accepts `--model`; MCP `export` / `import` paths are restricted to the memory root; CLI `distill --model` no longer shells out (allowlist-based).
@@ -36,6 +38,7 @@ Most memory solutions treat "remembering" as a black box: data goes into a datab
36
38
  - **Zero dependency, ready to use** — no daemon, no database, no vector store; just Node.js. Install and use; data stays on the machine; deployable anywhere.
37
39
  - **Grows smarter (v0.6.0)** — `profile` aggregates a user profile (the engine infers nothing; it only groups verbatim text) + `context` generates a one-shot start-of-work package (identity + profile + recent memory + boundaries + commitments); the SKILL "memory discipline" injects rule layers (type red lines / trigger signals / know the user / bottom lines / host isolation) — rules and mechanisms only, no personality data; zero data out of the box.
38
40
  - **Self-learning / self-evolving / self-improving (v0.8.0)** — `recall` semantic search (synonyms / pinyin full + initials / field weighting / fuzzy match, zero-dependency) with utility-score blended ranking; `feedback` explicit usage feedback loop (useful / useless adjusts weight / confidence / feedback_net); `maintain` rule-layer self-organization (unified utility score + age-based auto-archive / forget candidates / dedup, dry-run by default, immutable / BOUND exempt); `distill` psychological-log distillation (statistical summary / topic profile / knowledge map, optional `--model` external model enhancement).
41
+ - **Compression & forgetting (v0.10.0) — memory that never bloats** — `consolidate` summarizes old, low-use memories on the same topic into one **provenance-carrying periodic summary** that stays in active memory (every original file is listed as provenance; originals move to `.archive/`; `--undo <batch>` restores everything); `maintain --dedup` scores near-duplicates and `--apply` auto-merges high-confidence groups; the utility recency component now decays **per type** (FACT slow / PREF medium / COMMIT task-like fast / BOUND never) so durable facts are not wiped by time and stale commitments step aside quickly; every batch is auditable via `consolidate --batches`.
39
42
  - **Private-zone encryption (v0.7.0)** — private files AES-256-GCM envelope encrypted (passphrase-derived master key + recovery key + per-owner encrypted index); `yotta-memory view` user review platform (unlock with passphrase to see all AI memory).
40
43
 
41
44
  ### Memory types
@@ -91,13 +94,15 @@ Each agent has a globally unique agent ID: it is the ownership key for private m
91
94
  - **Root de-duplication (v0.6.5)**: when project and user roots point at the same directory, recall / context uniquify roots so a file shows once.
92
95
  - Hits accumulate `access_count` / `last_accessed` for lifecycle management.
93
96
 
94
- ### Lifecycle management (v0.8.0 rule-layer self-organization)
97
+ ### Lifecycle management (v0.8.0 rule-layer self-organization + v0.10.0 compression)
95
98
 
96
- - `maintain`: unified utility score (final score = confidence + usage + recency + type + structure) × weight; low-utility + over-age auto-archive; extreme low value listed as forget candidates (not really deleted by default; `--purge` deletes); `--dedup` dedup candidates; `--merge A,B` manual merge. Dry-run preview by default, `--apply` to execute; immutable / BOUND exempt; audit writes `.archive/audit-<date>.jsonl`.
97
- - `archive`: moves low-value old memory into `.archive/` by "unified utility score + age" (immutable excluded) so the store never grows without bound.
99
+ - **Per-type decay (v0.10.0)**: the recency component of the utility score is now `0.5^(days / half-life)` — FACT 730d (slow, facts do not age out), PREF 365d (medium), COMMIT 90d (task-like, fast), BOUND never decays (so boundaries are never auto-archived / forgotten). Tune with `config set maintain_decay_halflife_<TYPE> <days>`.
100
+ - `maintain`: unified utility score (confidence + usage + recency + type + structure) × weight; low-utility + over-age auto-archive candidates; extreme low value listed as forget candidates (not deleted by default; `--purge` deletes); `--dedup` now scores duplicates (≥0.85 high confidence auto-mergeable / 0.65–0.85 suggested / below ignored) and `--dedup --apply` auto-merges high-confidence groups of the same type + scope/owner (batch-audited, rollback-able; **`--dedup` is mutually exclusive with archiving** — it never silently archives); `--merge A,B` manual merge. Dry-run preview by default; immutable / BOUND exempt; audit writes `.archive/audit-<date>.jsonl`.
101
+ - `consolidate` (v0.10.0): **periodic-summary compression** — groups old (≥180d), idle (≥90d), low-utility (≤0.6) memories on the same topic into one summary entry (tags `consolidate` / `summary`, `source=consolidate`, body carries the full provenance list) that stays searchable, then archives the originals; dry-run by default; `--apply` writes a batch manifest + per-file before/after audit, `consolidate --undo <batch>` rolls the batch back (idempotent), `consolidate --batches` lists recent batches. Public summaries go to `facts/`, private to `private/<owner>/<type>/`.
102
+ - `archive`: moves low-value old memory into `.archive/` (public `.archive/facts/`, private `.archive/private/<owner>/<type>/`; immutable / BOUND exempt) by decay-blended utility + age, so the store never grows without bound.
98
103
  - `feedback`: explicit usage feedback loop — useful → weight ×1.2 (cap 3.0) + confidence +0.05 + feedback_net +1; useless → weight ×0.8 (floor 0.2) + confidence −0.05 + feedback_net −1; `--undo` rolls back; audit writes `.archive/feedback-<date>.jsonl`.
99
104
  - `distill`: psychological-log distillation — statistical summary (type / age / heat / feedback) + topic profile (clustered by subject) + knowledge map (type → tags); optional `--model <cmd>` external model stdin→stdout refinement (local CLI only; MCP distill does not expose `--model`); output to `private/<owner>/distills/` or `facts/distills/`.
100
- - `explain`: view a single memory's utility components and archive / forget status decision.
105
+ - `explain`: view the utility components (recency shows its half-life), archive / forget / BOUND-exempt status decision of a single memory.
101
106
  - `forget`: delete a single memory (by type-dir path or file name).
102
107
  - `reindex`: rebuild the index after manually editing `.md` files.
103
108
  - `export` / `import`: export the whole store to JSON / import from JSON; an intermediate format for migration and backup.
@@ -216,6 +221,18 @@ npm i -g @yottameta/yotta-memory
216
221
 
217
222
  **Upgrade the skill**: rerun your install command from the `## Install` section (e.g. `npx -y --package @yottameta/yotta-memory yotta-memory-install --agent <name>` or `bash install.sh --agent <name>`) to overwrite the old skill folder.
218
223
 
224
+ **v0.10.0 upgrade notes** — upgrading touches no data: no migration, no reindex, no re-init needed. v0.10.0 does not change the memory file format, the `facts/` / `private/<owner>/<type>/` layout, or the index version, so existing stores open as-is.
225
+
226
+ Behavior changes to be aware of:
227
+
228
+ - Recall / context ranking now decays the recency component **per type** (`0.5^(days / half-life)`: FACT 730d / PREF 365d / COMMIT 90d; BOUND never decays) — durable facts rank slightly higher, stale task-like commitments step aside faster.
229
+ - BOUND is now **never auto-archived or auto-forgotten** (previously the code only exempted it from forgetting, not archiving — this release closes the gap).
230
+ - `maintain --dedup` is now **mutually exclusive with archiving**: `--dedup [--apply]` only lists / auto-merges duplicates and never silently archives old single memories.
231
+ - Archive paths changed for **future operations only**: public → `.archive/facts/`, private → `.archive/private/<owner>/<type>/`; existing `.archive/` files are left in place (not migrated, not re-indexed).
232
+ - New commands are additive: `consolidate`, `consolidate --undo <batch>`, `consolidate --batches`.
233
+
234
+ Optional post-upgrade self-check: `yotta-memory config get` (confirm `memory_home` is unchanged) and `yotta-memory recall <keyword>` still finds old memories. Tune decay with `config set maintain_decay_halflife_<TYPE> <days>`.
235
+
219
236
  > Upgrades only affect commands and skill files — **they never touch your stored memories** (memory is independent of the install, kept in its own directory).
220
237
 
221
238
  ## CLI usage
@@ -228,15 +245,20 @@ npm i -g @yottameta/yotta-memory
228
245
  | `yotta-memory profile [--owner <id>]` | Generate a user profile (aggregates `private/<owner>` verbatim, zero inference, writes `profile.md`; cross-owner denied by default) |
229
246
  | `yotta-memory context [--limit N] [--owner <id>] [--budget N] [--focus <text>] [--explain] [--embedding <cmd>]` | Generate the start-of-work package (identity + multi-agent rules + profile + task-focused memory + recent memory + boundaries + commitments; --budget caps chars, --focus adds task relevance, --explain shows included/dropped) |
230
247
  | `yotta-memory forget <file>` | Delete a memory (by type-dir path or file name) |
231
- | `yotta-memory archive [--days 180] [--threshold 0.4]` | Archive old memory (final score + age; immutable excluded) |
248
+ | `yotta-memory archive [--days 180] [--threshold 0.4]` | Archive old memory (decay-blended utility + age; immutable / BOUND exempt; private to `.archive/private/<owner>/<type>/`) |
232
249
  | `yotta-memory reindex` | Rebuild the index (after manually editing .md) |
233
250
  | `yotta-memory export [--out f.json]` / `import <f.json>` | Export / import |
234
- | `yotta-memory config set memory_home <dir>` / `config get` | Persist / view the store location (`~/.yottamemory/config.json`) |
251
+ | `yotta-memory config set <key> <value>` / `config get` | Store location and engine tuning (`memory_home` / `embedding_cmd` / `embedding_timeout` / `maintain_archived_utility` / `maintain_decay_halflife_<TYPE>` / `consolidate_*`) |
235
252
  | `yotta-memory whoami` | Show the current agent identity and registration status |
236
253
  | `yotta-memory iam <id> [--name <name>] [--user <user>] [--relationship <rel>] [--force]` | Register this agent's unique identity and auto-write the self profile (`agents.json`, ID must be unique) |
237
254
  | `yotta-memory token new --agent <id> [--force]` / `token list` / `token revoke --agent <id>` | Create / list / revoke access tokens for agents (registered at `.server/tokens.json`) |
238
255
  | `yotta-memory serve [--host 0.0.0.0] [--port 8787] [--no-auth] [--stdio]` | Start the MCP memory engine (streamable HTTP LAN / --stdio local zero-process mode; Bearer token + X-Agent-Id auth) |
239
256
  | `yotta-memory lan enable [--onstart] / disable / status` | Autostart management (Windows: scheduled task, default ONLOGON, --onstart needs admin, non-admin auto-degrades to user-level Startup; Linux: systemd user unit, falls back to user crontab @reboot) |
257
+ | `yotta-memory maintain [--dry-run] [--apply] [--purge] [--threshold N] [--age N] [--dedup] [--dedup --apply] [--merge A,B]` | Self-organization: archive / forget candidates / confidence-scored dedup / auto-merge high-confidence groups; dry-run by default; `--dedup` is mutually exclusive with archiving |
258
+ | `yotta-memory consolidate [--min-age N] [--min-idle N] [--max-utility N] [--min-group N] [--period N] [--type T] [--model <cmd>] [--apply] [--undo <batch>] [--batches]` | Periodic-summary compression (v0.10.0): group old idle low-value memories into one traceable summary and archive the originals; dry-run by default; `--undo <batch>` rolls a batch back; `--batches` lists batches |
259
+ | `yotta-memory feedback <file> --useful|--useless [--reason <r>] [--undo]` | Usage feedback (useful/useless adjusts weight / confidence / feedback_net; --undo rolls back the last one) |
260
+ | `yotta-memory distill [--owner <id>] [--subject <topic>] [--model <cmd>] [--out <path>]` | Psychological-log distillation (stats / topic profile / knowledge map; optional local model, local CLI only) |
261
+ | `yotta-memory explain <file>` | Show the utility breakdown and archive / forget / BOUND-exempt status of one memory |
240
262
 
241
263
  Types: `FACT` (fact, public shared) / `PREF` (preference) / `BOUND` (boundary) / `COMMIT` (commitment).
242
264
 
package/README.zh-CN.md CHANGED
@@ -23,6 +23,8 @@
23
23
 
24
24
  > 📖 面向用户的操作手册见 [USER_GUIDE.md](USER_GUIDE.md)。
25
25
 
26
+ > 🆕 **v0.10.0**:压缩遗忘——`consolidate` 周期摘要压缩(同主题旧记忆 → 带溯源摘要 + 原文归档,`--undo <batch>` 一键回滚);近重复自动合并(`maintain --dedup` 置信度分档,`--apply` 批量执行);分类型衰减(FACT 慢 / PREF 中 / COMMIT 任务类快 / BOUND 不衰减);`consolidate --batches` 批次审计可查。
27
+
26
28
  > 🆕 **v0.9.0**:召回质量与上下文选择——可选本地 embedding 插件、`context --focus`、`--explain` 选择解释。
27
29
 
28
30
  > 🆕 **v0.8.5**:安全加固——MCP `distill` 不再接受 `--model`;MCP `export` / `import` 路径限记忆库内;CLI `distill --model` 不再走 shell(改为允许清单)。
@@ -40,6 +42,7 @@
40
42
  - **零依赖、即装即用**:无守护进程、无数据库、无向量库,只需 Node.js。安装即用,数据留在本机,任何机器都能部署。
41
43
  - **越用越懂(v0.6.0)**:`profile` 聚合用户画像(引擎零推断,只归组原文)+ `context` 一键生成开工上下文包(身份 + 画像 + 近期记忆 + 边界 + 承诺);SKILL「记忆守则」注入规则层(类型红线 / 触发信号 / 了解用户 / 底线 / 宿主隔离),只注入规则与机制、不注入人格数据,出厂零数据。
42
44
  - **自我学习 / 自我进化 / 自我提升(v0.8.0)**:`recall` 语义检索(同义词 / 拼音全拼+首字母 / 字段加权 / 模糊匹配,零依赖)+ 效用分融合排序;`feedback` 显式使用反馈闭环(useful / useless 调整 weight / confidence / feedback_net,越用越懂);`maintain` 规则层自组织(统一效用分 + 年龄自动归档 / 遗忘候选 / 去重,默认 dry-run,immutable / BOUND 豁免);`distill` 心理日志蒸馏(统计摘要 / 主题画像 / 知识地图,可选 `--model` 外部模型增强)。
45
+ - **压缩遗忘(v0.10.0)——记忆越用越精简**:`consolidate` 周期摘要压缩——把超龄 + 长期闲置 + 低效用的同主题旧记忆归纳成 **1 条带溯源的摘要**(每条原文路径都写在正文里)留在活跃区,原文整体进 `.archive/`,`--undo <batch>` 一键回滚;`maintain --dedup` 给近重复打分(≥0.85 高置信自动合并 / 0.65–0.85 建议手动),`--apply` 批量合并同归属重复组;时效分量改**分类型衰减**(FACT 慢 / PREF 中 / COMMIT 任务类快 / BOUND 永不衰减)——持久事实不被时间抹掉,过期承诺快速让位;每一步写批次审计(`--batches` 可查)。
43
46
  - **私密区加密(v0.7.0)**:私密区文件 AES-256-GCM 信封加密(口令派生主密钥 + 恢复钥匙 + 每 owner 加密索引);`yotta-memory view` 用户查看平台(口令解锁看全部 AI 记忆);`migrate` 明文→密文迁移;`--no-encrypt` 可降级。跨 AI 私密从「纪律层隔离」升级为「机制层不可解」。
44
47
  - **便携记忆盘**:记忆库本身就是记忆引擎——装在硬盘或主机上随盘走,局域网内其它主机上的智能体可远程读写;本地零进程与局域网常驻两种模式可并存,插上硬盘即恢复全部记忆。
45
48
 
@@ -54,6 +57,7 @@
54
57
  | **轻量零依赖** | 无 daemon / 无数据库 / 无向量库;Node.js 自带即跑,任何机器可部署 |
55
58
  | **双级存储** | 用户级 `~/.yottamemory/`(跨项目)+ 项目级 `.yottamemory/`(随项目共享 / 交接)|
56
59
  | **检索与生命周期** | 语义检索(v0.8.0:同义词 / 拼音 / 字段加权 / 模糊,零依赖)+ 效用分融合排序;统一效用分(盖棺分)规则层自动归档 / 遗忘候选 / 去重(`maintain`,默认 dry-run),记忆库越用越精简 |
60
+ | **压缩遗忘(v0.10.0)** | `consolidate` 周期摘要压缩(旧记忆 → 带溯源摘要 + 原文归档,可回滚)+ 近重复自动合并(置信度 + `--apply`)+ 分类型衰减(FACT 730 / PREF 365 / COMMIT 90 天半衰,BOUND 不衰减)+ 批次审计(`--batches` / `--undo`),长期使用不膨胀、主题不丢 |
57
61
  | **越用越懂(v0.6.0)** | `profile` 画像聚合(零推断)+ `context` 开工上下文包(身份 / 画像 / 近期记忆 / 边界 / 承诺)+ SKILL「记忆守则」规则层,记忆随使用成长 |
58
62
  | **生态分发** | GitHub + npm 双源同步发布;npx / git clone / Download ZIP / install.sh 四种安装方式,覆盖 17+ 类智能体目录 |
59
63
  | **便携记忆盘(随盘走)** | 记忆库即引擎:装在硬盘 / 主机上,插上即恢复全部记忆;引擎主机只需装 CLI 当存放点,无需装任何 AI 智能体 |
@@ -118,13 +122,15 @@
118
122
  - **根位置去重(v0.6.5)**:当项目级与用户级记忆库指向同一目录(如 cwd = home 或其父)时,`recall` / `context` 自动唯一化根,同一文件只展示一次。
119
123
  - 命中展示会累加 `access_count` / `last_accessed`,为生命周期管理提供依据。
120
124
 
121
- ### 生命周期管理(v0.8.0 规则层自组织)
125
+ ### 生命周期管理(v0.8.0 规则层自组织 + v0.10.0 压缩遗忘)
122
126
 
123
- - `maintain`(v0.8.0):规则层自组织——统一效用分(盖棺分 = confidence + 使用 + 时效 + 类型 + 结构)× weight,低效用 + 超龄自动归档;极端低价值列为遗忘候选(默认不真删,`--purge` 才删);`--dedup` 去重候选;`--merge A,B` 手动合并。默认 dry-run 预览,`--apply` 才执行;immutable / BOUND 豁免;审计写 `.archive/audit-<日期>.jsonl`。
124
- - `archive`:按「统一效用分 + 年龄」把低价值旧记忆移入 `.archive/`(`immutable` 除外),记忆库不会无限膨胀(v0.8.0 起底层用统一效用分)。
127
+ - **分类型衰减(v0.10.0)**:效用分「时效」分量 = `0.5^(已过天数 / 半衰)`——FACT 730 天(事实 / 知识慢衰减,不过时)、PREF 365 天(中速)、COMMIT 90 天(承诺 / 任务类快衰减)、BOUND 永不衰减(边界常驻,绝不自动归档 / 遗忘)。可用 `config set maintain_decay_halflife_<TYPE> <天>` 调整。
128
+ - `maintain`:规则层自组织——统一效用分(confidence + 使用 + 时效 + 类型 + 结构)× weight;低效用 + 超龄列为归档候选,极端低价值列为遗忘候选(默认不真删,`--purge` 才删);`--dedup` 现在给重复组打**置信度**(≥0.85 高置信可自动合并 / 0.65–0.85 建议手动 / 其余忽略),`--dedup --apply` 自动合并同归属高置信组(写批次审计可回滚;**与归档互斥**,不会顺手归档单条旧记忆);`--merge A,B` 手动合并。默认 dry-run;immutable / BOUND 豁免;审计写 `.archive/audit-<日期>.jsonl`。
129
+ - `consolidate`(v0.10.0):**周期摘要压缩**——把超龄(≥180 天)+ 长期闲置(≥90 天)+ 低效用(≤0.6)的同主题旧记忆归纳成 1 条带溯源摘要(tags `consolidate`/`summary`、正文列全溯源)并留在活跃区,原文整体进 `.archive/`;默认 dry-run,`--apply` 执行并写批次 manifest + 逐条 before/after,`--undo <batch>` 一键回滚(幂等),`--batches` 查近期批次。公共摘要进 `facts/`,私密进 `private/<owner>/<type>/`。
130
+ - `archive`:按「分类型衰减效用分 + 年龄」把低价值旧记忆移入 `.archive/`(公共 `.archive/facts/`,私密 `.archive/private/<owner>/<type>/`;immutable / BOUND 豁免),记忆库不会无限膨胀。
125
131
  - `feedback`(v0.8.0):显式使用反馈闭环——useful → weight ×1.2(上限 3.0)+ confidence +0.05 + feedback_net +1;useless → weight ×0.8(下限 0.2)+ confidence −0.05 + feedback_net −1;`--undo` 回滚;审计写 `.archive/feedback-<日期>.jsonl`。
126
132
  - `distill`(v0.8.0):心理日志蒸馏——统计摘要(类型 / 年龄 / 热度 / 反馈)+ 主题画像(按 subject 聚类合并)+ 知识地图(type → tags);可选 `--model <cmd>` 外部模型 stdin→stdout 提炼;产物入 `private/<owner>/distills/` 或 `facts/distills/`。
127
- - `explain`(v0.8.0):查看单条记忆效用分项与归档 / 遗忘状态判定。
133
+ - `explain`(v0.8.0 + v0.10.0):查看单条记忆效用分项(时效显示半衰)与归档 / 遗忘 / BOUND 豁免状态判定。
128
134
  - `forget`:删除单条记忆(按类型目录路径或文件名)。
129
135
  - `reindex`:手动改过 `.md` 后重建索引。
130
136
  - `export` / `import`:整库导出为 JSON / 从 JSON 导入,可作迁移与备份中间格式。
@@ -255,6 +261,19 @@ npm i -g @yottameta/yotta-memory
255
261
 
256
262
  **升级技能**:重跑「安装」节中的命令(如 `npx -y --package @yottameta/yotta-memory yotta-memory-install --agent <name>` 或 `bash install.sh --agent <name>`),覆盖旧版技能文件夹。
257
263
 
264
+ **v0.10.0 升级提示**——升级不碰数据:无需迁移 / reindex / 重新 init。v0.10.0 没有改记忆文件格式、`facts/` 与 `private/<owner>/<type>/` 布局,也没有改索引版本,旧库打开即用。
265
+
266
+ 需要知道的 4 条行为变化:
267
+
268
+ - 检索 / 上下文排序的「时效」分量改**分类型衰减**(`0.5^(已过天数/半衰)`:FACT 730 天 / PREF 365 天 / COMMIT 90 天;BOUND 永不衰减)——持久事实排序略靠前、过期任务类承诺更快让位。
269
+ - BOUND 现在**永不**被自动归档或遗忘(此前代码只豁免遗忘、没豁免归档——本版收口)。
270
+ - `maintain --dedup` 与归档**互斥**:`--dedup [--apply]` 只查重 / 自动合并,不会顺手把旧单条记忆归档。
271
+ - 归档路径只影响**今后**的操作:公共 → `.archive/facts/`,私密 → `.archive/private/<owner>/<type>/`;既有 `.archive/` 文件原地保留(不迁移、不进索引)。
272
+
273
+ 新增命令为纯新增:`consolidate` / `consolidate --undo <batch>` / `consolidate --batches`。
274
+
275
+ 可选升级后自检:`yotta-memory config get`(确认 `memory_home` 未变)+ `yotta-memory recall <关键词>` 仍能搜到旧记忆;想调衰减用 `config set maintain_decay_halflife_<TYPE> <天>`。
276
+
258
277
  > 升级只影响命令与技能文件,**不会动你已存的记忆**(记忆是独立于安装的文件,保留在原目录)。
259
278
 
260
279
  ## CLI 用法
@@ -268,15 +287,20 @@ npm i -g @yottameta/yotta-memory
268
287
  | `yotta-memory profile [--owner <id>]` | 生成用户画像(聚合 `private/<owner>/` 原文,零推断,写 `profile.md`;跨 owner 默认拒绝)|
269
288
  | `yotta-memory context [--limit N] [--owner <id>] [--budget N] [--focus <关键词>] [--explain] [--embedding <命令>]` | 生成开工上下文包(身份 + 多智能体铁律 + 画像 + 任务相关记忆 + 近期记忆 + 边界 + 承诺;--budget 字符预算;--focus 任务聚焦;--explain 输出 included/dropped 选择解释)|
270
289
  | `yotta-memory forget <文件>` | 删除一条记忆(按类型目录路径或文件名)|
271
- | `yotta-memory archive [--days 180] [--threshold 0.4]` | 归档旧记忆(盖棺分+年龄,immutable 除外)|
290
+ | `yotta-memory archive [--days 180] [--threshold 0.4]` | 归档旧记忆(分类型衰减效用分 + 年龄;immutable / BOUND 豁免;私密入 `.archive/private/<owner>/<type>/`)|
272
291
  | `yotta-memory reindex` | 重建索引(手动改 .md 后校正)|
273
292
  | `yotta-memory export [--out f.json]` / `import <f.json>` | 导出 / 导入 |
274
- | `yotta-memory config set memory_home <目录>` / `config get` | 持久记住 / 查看记忆库位置(`~/.yottamemory/config.json`)|
293
+ | `yotta-memory config set <键> <值>` / `config get` | 记忆库位置与引擎参数(`memory_home` / `embedding_cmd` / `embedding_timeout` / `maintain_archived_utility` / `maintain_decay_halflife_<TYPE>` / `consolidate_*` 等)|
275
294
  | `yotta-memory whoami` | 查看当前智能体身份与登记状态(读 `YOTTA_AGENT_ID` / `X-Agent-Id`,不猜不默认)|
276
295
  | `yotta-memory iam <id> [--name <显示名>] [--user <用户名>] [--relationship <关系>] [--force]` | 登记本智能体唯一身份并自动落自我档案(`agents.json`,ID 必须唯一;可选扩展显示名 / 用户 / 关系)|
277
296
  | `yotta-memory token new --agent <id> [--force]` / `token list` / `token revoke --agent <id>` | 为智能体生成 / 列出 / 吊销访问 token(登记于记忆库 `.server/tokens.json`;同 ID 已被其它来源占用需 `--force` 覆盖,防不同智能体合流)|
278
297
  | `yotta-memory serve [--host 0.0.0.0] [--port 8787] [--no-auth] [--stdio]` | 启动 MCP 记忆引擎(streamable HTTP 局域网 / --stdio 本地零进程模式;Bearer token + X-Agent-Id 鉴权)|
279
298
  | `yotta-memory lan enable [--onstart] / disable / status` | 开机自启管理(Windows:计划任务,默认 ONLOGON、--onstart 开机即启需管理员,非管理员自动降级用户级 Startup 静默自启;Linux:systemd 用户单元,不可用时自动降级用户 crontab @reboot)|
299
+ | `yotta-memory maintain [--dry-run] [--apply] [--purge] [--threshold N] [--age N] [--dedup] [--dedup --apply] [--merge A,B]` | 记忆自组织:归档 / 遗忘候选 / 置信度查重 / 自动合并高置信组;默认 dry-run;`--dedup` 与归档互斥 |
300
+ | `yotta-memory consolidate [--min-age N] [--min-idle N] [--max-utility N] [--min-group N] [--period N] [--type T] [--model <cmd>] [--apply] [--undo <batch>] [--batches]` | 周期摘要压缩(v0.10.0):同主题旧记忆 → 带溯源摘要 + 原文归档;默认 dry-run;`--undo <batch>` 回滚批次;`--batches` 查批次 |
301
+ | `yotta-memory feedback <文件|主题> --useful|--useless [--reason <原因>] [--undo]` | 使用反馈(useful/useless 调整 weight / confidence / feedback_net;`--undo` 回滚最近一次)|
302
+ | `yotta-memory distill [--owner <id>] [--subject <主题>] [--model <cmd>] [--out <路径>]` | 心理日志蒸馏(统计摘要 / 主题画像 / 知识地图;可选本地模型,仅 CLI)|
303
+ | `yotta-memory explain <文件|主题>` | 查看单条记忆效用分项与归档 / 遗忘 / BOUND 豁免状态 |
280
304
 
281
305
  类型:`FACT`(事实,公共共享)/ `PREF`(偏好)/ `BOUND`(边界)/ `COMMIT`(承诺)。
282
306
 
package/SKILL.md CHANGED
@@ -1,14 +1,13 @@
1
1
  ---
2
2
  name: yotta-memory
3
- description: "元忆 —— 有权限边界的文件式智能体记忆。文件式、零依赖、可 diff/可回滚:让任何 AI 智能体活过会话,开工 recall 恢复上下文、重要信息 remember 落盘、收工归档。类型体系 FACT(公共共享)/ PREF / BOUND / COMMIT(私密隔离)。触发:记住、别忘了、记一笔、记忆、remember、recall、跨会话、上次说到、续测、交接、归档、记忆盘、共享记忆、局域网记忆、画像、开工上下文、记忆守则、profile、context、越用越懂、语义检索、反馈、维护、蒸馏、feedback、maintain、distill、explain、自我学习、自我进化、自我提升、查看平台分页、recall 候选预过滤、任务相关记忆、--focus、--embedding"
4
- version: 0.9.1
3
+ description: "元忆 —— 有权限边界的文件式智能体记忆。文件式、零依赖、可 diff/可回滚:让任何 AI 智能体活过会话,开工 recall 恢复上下文、重要信息 remember 落盘、收工归档。类型体系 FACT(公共共享)/ PREF / BOUND / COMMIT(私密隔离)。触发:记住、别忘了、记一笔、记忆、remember、recall、跨会话、上次说到、续测、交接、归档、记忆盘、共享记忆、局域网记忆、画像、开工上下文、记忆守则、profile、context、越用越懂、语义检索、反馈、维护、蒸馏、feedback、maintain、distill、explain、自我学习、自我进化、自我提升、查看平台分页、recall 候选预过滤、任务相关记忆、--focus、--embedding、压缩遗忘、consolidate、周期摘要、自动合并、分类型衰减、回滚
4
+ version: 0.10.0
5
5
  license: MIT
6
6
  ---
7
7
 
8
8
  # yotta-memory(元忆)— 有权限边界的文件式智能体记忆
9
9
 
10
10
  > 一句话:元忆 —— 有权限边界的文件式智能体记忆(不注入、可 diff、能回滚;FACT 共享、PREF / BOUND / COMMIT 私密隔离)。
11
- > 版本:0.9.1 | 最后更新:2026-09-03
12
11
 
13
12
  ## 这是什么
14
13
 
@@ -19,6 +18,7 @@ license: MIT
19
18
  - **越用越懂**:`profile` 聚合用户画像(引擎零推断,只归组原文)+ `context` 一键生成开工上下文包(身份 + 画像 + 近期记忆 + 边界 + 承诺)+ SKILL「记忆守则」规则层;只注入规则与机制,不注入人格数据(出厂零数据)。
20
19
  - **自我学习 / 自我进化 / 自我提升(v0.8.0)**:`recall` 语义检索(同义词 / 拼音 / 字段加权 / 模糊匹配,零依赖);`feedback` 显式使用反馈闭环(useful / useless → weight / confidence / feedback_net 演化,越用越懂);`maintain` 规则层自组织(统一效用分 + 年龄自动归档 / 遗忘候选 / 去重,默认 dry-run,immutable / BOUND 豁免);`distill` 心理日志蒸馏(统计摘要 / 主题画像 / 知识地图,可选 `--model` 外部模型增强);`explain` 查看单条记忆效用分项。
21
20
  - **召回质量与上下文选择(v0.9.0)**:`recall` 支持可选本地 embedding 插件(`--embedding <command>` / `config set embedding_cmd <command>`);`context --focus <关键词>` 生成任务感知上下文;`--explain` 输出选择 trace,无插件时自动降级为词法检索。
21
+ - **压缩遗忘(v0.10.0)**:记忆库长期可用不膨胀——`consolidate` 周期摘要压缩(把超龄 + 低效用 + 长期闲置的同主题旧记忆归纳成**带溯源**的摘要,原文整体进 `.archive/`,`--undo` 一键回滚);`maintain --dedup` 近重复**自动合并**(置信度分档,`--apply` 批量执行高置信组);效用分时效改为**分类型衰减**(FACT 慢 / PREF 中 / COMMIT 任务类快 / BOUND 不衰减);`consolidate --batches` 批次审计可查。
22
22
 
23
23
  ## 何时使用(触发)
24
24
 
@@ -31,7 +31,7 @@ license: MIT
31
31
 
32
32
  1. **开工定向**:先按「开工第一步:确认记忆位置 + 智能体身份」检测记忆库与身份,再运行 `yotta-memory context`(主注入:身份 + 用户画像 + 近期记忆 + 边界 + 承诺)恢复上下文,需要细节再 `yotta-memory recall <关键词>`;若有明确任务关键词,用 `context --focus <关键词>` 获得任务相关记忆;项目级记忆优先,其次用户级。
33
33
  2. **进行中落盘**:重要信息立即 `yotta-memory remember <type> <subject> <statement>`,不攒到收工。
34
- 3. **收工归档**:写会话小结(COMMIT / 笔记),旧记录定期 `yotta-memory archive`。
34
+ 3. **收工归档**:写会话小结(COMMIT / 笔记);旧记录定期 `yotta-memory maintain --apply`(单条低效用归档)+ 记忆多了周期 `yotta-memory consolidate --apply`(同主题压缩成带溯源摘要,`--undo` 可回滚)。
35
35
  4. **多智能体纪律**:FACT 写入公共区,PREF / BOUND / COMMIT 只写本智能体私密区;不读取其他智能体私密区。**一切读写一律走 `yotta-memory` CLI / MCP 工具**——禁止用 shell(`Get-ChildItem` / `Get-Content` / `cat` / `ls` / `type` 等)直接读或改记忆库目录下的 `.md` / `index.json` / `tokens.json` / `agents.json` / `grants.json` 等文件,否则会绕过权限边界、读到别的智能体私密内容。
36
36
 
37
37
 
@@ -166,7 +166,7 @@ license: MIT
166
166
  | `yotta-memory profile [--owner <id>]` | 生成用户画像(聚合 `private/<owner>/` 原文,零推断,写 `profile.md`;跨 owner 默认拒绝)|
167
167
  | `yotta-memory context [--limit N] [--owner <id>] [--budget N] [--focus <关键词>] [--explain] [--embedding <command>]` | 生成开工上下文包(身份 + 多智能体铁律 + 画像 + 任务相关记忆 + 近期记忆 + 边界 + 承诺;--budget 字符预算,0=不限;--explain 输出 included / dropped 选择 trace)|
168
168
  | `yotta-memory forget <文件>` | 删除(按类型目录路径或文件名)|
169
- | `yotta-memory archive [--days 180] [--threshold 0.35]` | 归档旧记忆(v0.8.0 统一效用分+年龄,immutable 除外;阈值默认读 config `maintain_archived_utility`)|
169
+ | `yotta-memory archive [--days 180] [--threshold 0.35]` | 归档旧记忆(v0.8.0 统一效用分 + v0.10.0 分类型衰减;immutable / BOUND 豁免;私密归档入 `.archive/private/<owner>/<type>/`;阈值默认读 config `maintain_archived_utility`)|
170
170
  | `yotta-memory reindex` | 重建索引(手动改 .md 后校正)|
171
171
  | `yotta-memory export [--out f.json]` / `import <f.json>` | 导出 / 导入 |
172
172
  | `yotta-memory config set memory_home <目录>` / `config get` | 持久记住 / 查看记忆库位置(`~/.yottamemory/config.json`)|
@@ -176,7 +176,8 @@ license: MIT
176
176
  | `yotta-memory serve [--host 0.0.0.0] [--port 8787] [--no-auth] [--stdio]` | 启动 MCP 记忆引擎(streamable HTTP 局域网 / --stdio 本地零进程模式;Bearer token + X-Agent-Id 鉴权)|
177
177
  | `yotta-memory lan enable [--onstart] / disable / status` | 开机自启管理(Windows:计划任务,默认 ONLOGON、--onstart 开机即启需管理员,非管理员自动降级用户级 Startup 静默自启,v0.6.3 起 VBS 自愈不弹 80070002;Linux:systemd 用户单元,不可用时自动降级用户 crontab @reboot)|
178
178
  | `yotta-memory feedback <文件|主题> --useful|--useless [--reason <原因>] [--undo]` | 显式使用反馈(v0.8.0 自我学习闭环:useful → weight×1.2 / useless → weight×0.8,confidence / feedback_net 同步演化;`--undo` 回滚最近一次;审计写 `.archive/feedback-<日期>.jsonl`)|
179
- | `yotta-memory maintain [--dry-run] [--apply] [--purge] [--threshold N] [--age N] [--dedup] [--merge A,B]` | 记忆自组织(v0.8.0 自我进化:规则层归档 / 遗忘候选 / 去重;默认 dry-run 预览,`--apply` 执行归档,`--purge` 才真删遗忘候选;immutable / BOUND 豁免;审计写 `.archive/audit-<日期>.jsonl`)|
179
+ | `yotta-memory maintain [--dry-run] [--apply] [--purge] [--threshold N] [--age N] [--dedup] [--dedup --apply] [--merge A,B]` | 记忆自组织(v0.8.0 自我进化 + v0.10.0 自动合并):默认 dry-run 预览;`--apply` 执行归档(immutable / BOUND 豁免;私密归档入 `.archive/private/<owner>/<type>/`),`--purge` 才真删遗忘候选;`--dedup` 查重并给**置信度分档**(≥0.85 高置信 / 0.65–0.85 建议手动 / 其余忽略),`--dedup --apply` 自动合并同归属高置信组(写批次审计可回滚;与归档互斥,不误归档);`--merge A,B` 手动合并两条;审计写 `.archive/audit-<日期>.jsonl`)|
180
+ | `yotta-memory consolidate [--min-age N] [--min-idle N] [--max-utility N] [--min-group N] [--period N] [--type T] [--model <cmd>] [--apply] [--undo <batch>] [--batches]` | 周期摘要压缩(v0.10.0 压缩遗忘:把超龄 + 长期闲置 + 低效用的同主题旧记忆归纳成**带溯源**的周期摘要并留在活跃区,原文整体进 `.archive/`;默认 dry-run;immutable / BOUND 豁免,活跃 / 高效用记忆不动;`--apply` 执行并写批次审计,`--undo <batch>` 一键回滚(幂等),`--batches` 查近期批次;`--model` 仅本地 CLI)|
180
181
  | `yotta-memory distill [--owner <id>] [--subject <主题>] [--model <cmd>] [--out <路径>]` | 心理日志蒸馏(v0.8.0 自我提升:统计摘要 / 主题画像 / 知识地图;启发式零依赖,`--model` 可选外部模型 stdin→stdout 提炼;私密产物入 `private/<owner>/distills/`,公共入 `facts/distills/`)|
181
182
  | `yotta-memory explain <文件|主题>` | 查看单条记忆效用分项与归档 / 遗忘状态判定(v0.8.0)|
182
183
 
package/USER_GUIDE.md CHANGED
@@ -136,7 +136,7 @@ statement: 本周完成发布
136
136
 
137
137
  ## 3.6 自我学习 / 自我进化 / 自我提升(v0.8.0)
138
138
 
139
- 元忆 v0.8.0 让记忆系统「越用越懂」:语义检索、使用反馈闭环、规则层自组织、心理日志蒸馏,全部零依赖内置。
139
+ 元忆 v0.8.0 让记忆系统「越用越懂」:语义检索、使用反馈闭环、规则层自组织、心理日志蒸馏;v0.10.0 补齐「压缩遗忘」:周期摘要压缩、近重复自动合并、分类型衰减、批次回滚。全部零依赖内置。
140
140
 
141
141
  **语义检索(recall)**
142
142
 
@@ -161,11 +161,38 @@ statement: 本周完成发布
161
161
 
162
162
  **规则层自组织(maintain)**
163
163
 
164
- - `maintain`(默认 dry-run 预览):列出归档候选(统一效用分 < 0.35 且超 180 天)与遗忘候选(< 0.12 且超 365 天),immutable / BOUND 豁免。
165
- - `maintain --apply`:执行归档(移入 `.archive/`,可恢复)。
166
- - `maintain --apply --purge`:真删遗忘候选(谨慎,先确认)。
167
- - `maintain --dedup`:列出重复候选;`maintain --merge A,B` 合并两条相似记忆。
168
- - 阈值可用 `config set maintain_archived_utility 0.3` 等调整;审计在 `.archive/audit-<日期>.jsonl`。
164
+ - `maintain`(默认 dry-run 预览):列出归档候选与遗忘候选(v0.10.0 起按**分类型衰减后**的效用分 + 年龄判定;默认:utility < 0.35 且超 180 天 = 归档候选,utility < 0.12 且超 365 天 = 遗忘候选)。
165
+ - **immutable / BOUND 豁免**:红线与边界不参与任何自动归档 / 遗忘。
166
+ - `maintain --apply`:执行归档(公共 → `.archive/facts/`,私密 → `.archive/private/<owner>/<type>/`,可恢复)。
167
+ - `maintain --apply --purge`:真删遗忘候选(谨慎;硬删除不可回滚)。
168
+ - `maintain --dedup`:查重复候选并给**置信度分档**——≥0.85 高置信(可自动合并)/ 0.65–0.85 建议手动 / 其余忽略。
169
+ - `maintain --dedup --apply`:自动合并同归属(同类型 + 同 scope/owner)高置信组:保留 confidence 最高的一条,合并 tags / 使用次数 / 反馈,其余移入 `.archive/` 并写批次审计(可 `consolidate --undo <batch>` 回滚)。**注意 `--dedup` 与归档互斥**:`--dedup [--apply]` 只查重 / 自动合并,不会顺手归档单条旧记忆——要归档请单独跑 `maintain --apply`。
170
+ - `maintain --merge A,B`:手动合并两条相似记忆(保留高 confidence,低 confidence 归档)。
171
+ - 阈值与半衰可用 `config set maintain_archived_utility 0.3` / `config set maintain_decay_halflife_FACT 1000` 等调整(`config get` 查看);审计在 `.archive/audit-<日期>.jsonl`。
172
+
173
+ **分类型衰减曲线(v0.10.0)**
174
+
175
+ - 记忆「价值」由效用分衡量,其中「时效」分量按类型指数衰减:`时效 = 0.5^(已过天数 / 半衰期)`。
176
+ - 默认半衰期:**FACT 730 天**(事实 / 知识慢衰减,事实不过时)→ **PREF 365 天**(偏好中速)→ **COMMIT 90 天**(承诺 / 任务类快衰减,兑现或过期后快速让位)→ **BOUND 不衰减**(边界常驻,永不归档 / 遗忘)。
177
+ - 效果:`recall` / `context` 排序里,持久事实不会被时间一刀切遗忘;过期任务类承诺更快让位给新任务。
178
+ - 调整示例:`yotta-memory config set maintain_decay_halflife_COMMIT 180`(单位:天)。
179
+
180
+ **周期摘要压缩(consolidate,v0.10.0)**
181
+
182
+ - 干什么:记忆库长期使用后,同一主题会积累大量「又老又不常用」的旧条目。`consolidate` 把这类旧记忆归纳成 **1 条带溯源的周期摘要**(留在活跃区,recall 能搜到),原文整体进 `.archive/`——主题叙事不丢、记忆库不膨胀。
183
+ - 候选条件(全部满足才收):created 距今 ≥ 180 天(`--min-age`)∧ 长期闲置 ≥ 90 天(`--min-idle`,最近用过的不收)∧ 效用 ≤ 0.6(`--max-utility`,重要的不收);同主题 ≥ 2 条成组(`--min-group`)。**immutable / BOUND 永远豁免**。
184
+ - 用法:先 `yotta-memory consolidate` 看预览(列出每组摘要计划与影响条数),确认后 `yotta-memory consolidate --apply` 执行。
185
+ - 摘要形态:新记忆 `subject = 周期摘要 <主题>(<N>天窗)`、tags 含 `consolidate` / `summary`、正文含主题要点 + **溯源清单**(每条原文路径 / 日期 / confidence),statement 简短可检索。
186
+ - 归属:公共 FACT 摘要进 `facts/`;私密 PREF / COMMIT 摘要进 `private/<owner>/<type>/`(密文库自动加密)。
187
+ - 可选模型提炼:`consolidate --apply --model <命令>`(仅本机 CLI,stdin→stdout 协议同 distill;失败自动降级启发式)。
188
+ - 常用参数:`--min-age N` / `--min-idle N` / `--max-utility N` / `--min-group N` / `--period N`(摘要标称窗口)/ `--type FACT|PREF|COMMIT`。
189
+
190
+ **批次审计与回滚(v0.10.0)**
191
+
192
+ - 每次 `consolidate --apply` 与 `maintain --dedup --apply` 都写一个**批次**:`.archive/audit-<日期>.jsonl` 先写 manifest(batch id / 时间 / 命令 / 库位置),再逐条记录摘要新建、原文归档、自动合并的 before/after 影像。
193
+ - 反悔?`yotta-memory consolidate --undo <batch>` 一键回滚:删除生成的摘要、把原文从 `.archive/` 归位、还原被合并记忆的原始 frontmatter,并同步索引;重复 `--undo` 同一批次会被幂等拒绝。
194
+ - 查看近期批次:`yotta-memory consolidate --batches`(只读列出 batch id / 命令 / 库位置,`--limit N` 控制数量)。
195
+ - `--purge` 硬删除不可回滚——删之前先 `--batches` + `explain` 确认。
169
196
 
170
197
  **心理日志蒸馏(distill)**
171
198
 
@@ -175,7 +202,7 @@ statement: 本周完成发布
175
202
 
176
203
  **查看效用(explain)**
177
204
 
178
- - `explain <文件>`:显示单条记忆的效用分项(confidence / 使用 / 时效 / 类型 / 结构 × weight)与归档 / 遗忘状态判定,帮助理解为什么某条记忆靠前 / 被归档。
205
+ - `explain <文件>`:显示单条记忆的效用分项(confidence / 使用 / 时效(含半衰)/ 类型 / 结构 × weight)与归档 / 遗忘状态判定;BOUND 显示「豁免」,帮助理解为什么某条记忆靠前 / 被归档 / 被压缩。
179
206
 
180
207
  ## 3.7 查看平台分页与检索优化(v0.8.1)
181
208
 
@@ -319,17 +346,18 @@ yotta-memory remember FACT 主题 内容 # 智能体落盘
319
346
  | `yotta-memory profile [--owner <id>]` | 生成用户画像(零推断,写 `profile.md`)|
320
347
  | `yotta-memory context [--limit N] [--owner <id>] [--budget N] [--focus <关键词>] [--explain] [--embedding <命令>]` | 开工上下文包(身份+铁律+画像+任务相关记忆+近期记忆+边界+承诺;--focus 任务聚焦;--explain 输出 included/dropped 选择解释)|
321
348
  | `yotta-memory forget <文件>` | 删除一条记忆 |
322
- | `yotta-memory archive [--days 180] [--threshold 0.4]` | 归档旧记忆 |
349
+ | `yotta-memory archive [--days 180] [--threshold 0.4]` | 归档旧记忆(分类型衰减效用分 + 年龄;immutable / BOUND 豁免;私密入 `.archive/private/<owner>/<type>/`)|
323
350
  | `yotta-memory reindex` | 重建索引 |
324
351
  | `yotta-memory export [--out 文件.json]` / `import <文件.json>` | 导出 / 导入 |
325
- | `yotta-memory config set memory_home <目录>` / `config get` | 记忆库位置 |
352
+ | `yotta-memory config set <键> <值>` / `config get` | 记忆库位置与引擎参数(`memory_home` / `embedding_cmd` / `embedding_timeout` / `maintain_archived_utility` / `maintain_decay_halflife_<TYPE>` / `consolidate_*` 等)|
326
353
  | `yotta-memory whoami` | 查看当前智能体身份与登记状态(读 `YOTTA_AGENT_ID` / `X-Agent-Id`,不猜不默认)|
327
354
  | `yotta-memory iam <id> [--name <显示名>] [--user <用户名>] [--relationship <关系>] [--force]` | 登记本智能体唯一身份并自动落自我档案(`agents.json`,ID 必须唯一;可选扩展显示名 / 用户 / 关系)|
328
355
  | `yotta-memory token new --agent <id> [--force]` / `token list` / `token revoke --agent <id>` | 访问 token(同 ID 已被其它来源占用需 `--force` 覆盖)|
329
356
  | `yotta-memory serve [--port 8787] [--stdio] [--no-auth]` | 启动记忆引擎(--no-auth 关闭鉴权,仅限可信内网)|
330
357
  | `yotta-memory lan enable [--onstart] / disable / status` | 开机自启管理(Windows:计划任务/用户级 Startup 静默自启;Linux:systemd 用户单元/用户 crontab @reboot)|
331
358
  | `yotta-memory feedback <文件|主题> --useful|--useless [--reason <原因>] [--undo]` | 使用反馈(v0.8.0:useful/useless 调 weight/confidence/feedback_net;--undo 回滚)|
332
- | `yotta-memory maintain [--dry-run] [--apply] [--purge] [--threshold N] [--age N] [--dedup] [--merge A,B]` | 记忆自组织(v0.8.0:归档 / 遗忘候选 / 去重;默认 dry-run,--apply 执行,--purge 才真删)|
359
+ | `yotta-memory maintain [--dry-run] [--apply] [--purge] [--threshold N] [--age N] [--dedup] [--dedup --apply] [--merge A,B]` | 记忆自组织(v0.8.0 + v0.10.0 自动合并):归档 / 遗忘候选 / 置信度查重 / 自动合并;默认 dry-run,`--dedup` 与归档互斥 |
360
+ | `yotta-memory consolidate [--min-age N] [--min-idle N] [--max-utility N] [--min-group N] [--period N] [--type T] [--model <cmd>] [--apply] [--undo <batch>] [--batches]` | 周期摘要压缩(v0.10.0:同主题旧记忆 → 带溯源摘要 + 原文归档;默认 dry-run;`--undo <batch>` 回滚批次;`--batches` 查批次)|
333
361
  | `yotta-memory distill [--owner <id>] [--subject <主题>] [--model <cmd>] [--out <路径>]` | 心理日志蒸馏(v0.8.0:统计摘要 / 主题画像 / 知识地图)|
334
362
  | `yotta-memory explain <文件|主题>` | 查看单条记忆效用分项(v0.8.0)|
335
363