@yottameta/yotta-memory 0.24.4 → 1.0.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 +13 -0
- package/README.md +93 -370
- package/README.zh-CN.md +94 -406
- package/SKILL.md +113 -628
- package/USER_GUIDE.md +254 -405
- package/bin/yotta-memory.js +71 -14
- package/package.json +5 -3
- package/references/cli-reference.md +113 -0
- package/references/lan-mode.md +128 -0
- package/references/trust-card.md +100 -0
- package/skill-manifest.json +2 -2
package/README.md
CHANGED
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
<h1 align="center">元忆 (Yuanyi / yotta-memory)</h1>
|
|
8
8
|
|
|
9
|
-
<p align="center">
|
|
10
|
-
<p align="center">
|
|
11
|
-
<p align="center">FACT is shared, PREF / BOUND / COMMIT are privately isolated — <b>who may read what is decided by mechanism, not by AI self-discipline</b>; one memory store can be shared across agents, travels with the disk, and can be shared over LAN.</p>
|
|
12
|
-
<p align="center">"Grows smarter the more you use it" (v0.14.0): <code>context</code> builds a one-shot start-of-work package with long-term summaries first (reusing <code>consolidate</code>) + a zero-inference <code>profile</code> + a time-ordered recent corridor + high-value backfill + boundaries + commitments + a session loop contract, turning memory from "storage" into "a memory system that grows".</p>
|
|
13
|
-
<p align="center"><b>Mechanism-level encryption for the private zone</b>: AES-256-GCM envelope encryption + passphrase-derived master key + recovery key; <code>yotta-memory view</code> is a user-facing review platform (unlock with passphrase to see all AI memory); <code>migrate</code> converts plaintext → encrypted; <code>--no-encrypt</code> can downgrade. Cross-agent privacy upgrades from "discipline-level isolation" to "mechanism-level unreadable".</p>
|
|
9
|
+
<p align="center"><b>The next-generation memory engine whose data never leaves your machine.</b></p>
|
|
10
|
+
<p align="center">File-based memory for AI agents: recall context at the start of work, remember what matters as you go, archive at wrap-up. Plain Markdown you can read, diff and roll back — no cloud, no account, no telemetry, no daemon, no database.</p>
|
|
14
11
|
|
|
15
12
|
<p align="center">
|
|
16
13
|
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue" /></a>
|
|
@@ -18,184 +15,67 @@
|
|
|
18
15
|
<a href="https://www.npmjs.com/package/@yottameta/yotta-memory"><img alt="npm package" src="https://img.shields.io/npm/v/@yottameta/yotta-memory" /></a>
|
|
19
16
|
<a href="https://github.com/YottaMeta/yotta-memory"><img alt="GitHub stars" src="https://img.shields.io/github/stars/YottaMeta/yotta-memory" /></a>
|
|
20
17
|
<a href="https://github.com/YottaMeta/yotta-memory/commits/main"><img alt="last commit" src="https://img.shields.io/github/last-commit/YottaMeta/yotta-memory" /></a>
|
|
21
|
-
<a href="https://github.com/YottaMeta/yotta-memory"><img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen" /></a>
|
|
22
18
|
</p>
|
|
23
19
|
|
|
24
|
-
##
|
|
20
|
+
## Why agents forget — and what changes here
|
|
25
21
|
|
|
26
|
-
**1. Stop
|
|
22
|
+
**1. Stop re-explaining the project every session.** The agent runs `yotta-memory context` and gets one package: identity, long-term summaries, a zero-inference profile, a recent corridor, boundaries, commitments and a session contract.
|
|
27
23
|
|
|
28
|
-
**2. Remember a decision the moment it is made.**
|
|
24
|
+
**2. Remember a decision the moment it is made.** `yotta-memory remember PREF "code style" "prefers short functions" --verify` writes it, reads it back, and keeps it in that agent's private zone.
|
|
29
25
|
|
|
30
|
-
**3. Wrap up without hand-carrying state.**
|
|
26
|
+
**3. Wrap up without hand-carrying state.** Write a COMMIT anchor before the session ends; `maintain` / `consolidate` keep the store small over time; `context --audit` checks whether anything important was lost when the host compacted the conversation.
|
|
31
27
|
|
|
32
|
-
##
|
|
28
|
+
## What you get
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
- **Memory is files** — Markdown + YAML frontmatter in your own directory. Any editor can read it; git versions it; copying the folder moves the memory.
|
|
31
|
+
- **Four types, two levels** — FACT is public and shared; PREF / BOUND / COMMIT are private per agent. User-level `~/.yottamemory/` is shared across projects; project-level `.yottamemory/` travels with the repo.
|
|
32
|
+
- **Permissions by mechanism** — private files are AES-256-GCM envelope-encrypted (passphrase-derived master key + per-agent owner key + offline recovery key). An agent without its `agent_key` cannot decrypt them; the owner ID alone is not a credential.
|
|
33
|
+
- **Grows with use** — semantic recall (synonyms, pinyin, field weighting, fuzzy match, optional local embedding plugin), explicit `feedback` that adjusts weight, and `explain` for every score.
|
|
34
|
+
- **Never bloats** — unified utility score with per-type decay, near-duplicate merge, and `consolidate` summaries that carry provenance; originals are archived and `--undo` restores them.
|
|
35
|
+
- **Recoverable** — overwrite-protected `init`, trash-based `forget`, independent-volume backups with verification and restore drills, transaction snapshots before destructive writes, `doctor` health checks, and `scan` for prompt injection / leaks in the store.
|
|
36
|
+
- **Shareable across machines** — put the store on any host or disk; local CLI connects directly, other machines join over LAN MCP (see `references/lan-mode.md`).
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
> 🆕 **v0.17.4 (rename)**: `yotta-memory rename <id> <YYYY-MM-DD-NNNN.md>` renames a single memory entry — the minimal fix for flat/layered same-sequence collisions. Identity is type + owner + file name, checked across both layouts; an occupied target or an existing file is refused (fail-closed). Runs through the destructive guard (doctor + independent backup + snapshot), rebuilds the index and writes a `rename` audit entry; `--dry-run` previews with zero writes. CLI only — the MCP tool list is unchanged.
|
|
42
|
-
> 🆕 **v0.17.3 (help readability)**: the top-level `--help` no longer repeats a "做什么:" label on every command and option — each entry starts straight with its description, while "什么时候用:" and "注意:" stay as-is. Help text only: commands, arguments and exit codes are unchanged.
|
|
43
|
-
> 🆕 **v0.17.2 (owner gate for private maintenance)**: `explain` now refuses entries owned by another agent instead of printing their subject/statement, and `archive` / `maintain` skip private entries the caller does not own (declare your identity with `--agent <id>`; only an explicit user `--unsafe` overrides). Installer hardening: symlinked targets are refused and no whole-directory delete is performed. Previous v0.17.1: a mismatched identity-confirmation ID in `view` now shows an immediate error instead of returning silently; cancel stays silent and the server-side confirmation and destructive-operation gates are unchanged.
|
|
44
|
-
> 🆕 **v0.17.0 (scale: year/month layout + doctor scale check + lazy index + bench)**: new entries are written into year/month folders — public `facts/<yyyy>/<mm>/`, private `private/<owner>/<type>/<yyyy>/<mm>/`. Flat files from v0.16 and earlier stay in place and remain readable; nothing is migrated automatically. Archiving keeps the year/month path, so same-named files from different months no longer overwrite each other. `doctor` gained a scale section (entry count / largest directory / index size / index cold start) with thresholds set through `config set scale_warn_entries` / `scale_warn_files_per_dir` / `scale_warn_index_bytes` / `scale_warn_cold_start_ms`; exceeding a threshold warns only and never locks destructive writes. Large stores can read only the shards of a given year: `recall --year <yyyy>` / `context --year <yyyy>` (repeatable; omitting it loads everything exactly as before). New `bench` command: deterministic auto sampling or `--evalset <file>` (evalset v1), reporting Recall@k / MRR / nDCG@k / HitRate with bootstrap 95% CI plus store and evalset fingerprints; `--gate <metric>=<value>` fits CI, and the same store + evalset + parameters always produce the same output. `bench` is read-only: it never rebuilds the index, never touches access counters and never calls an external embedding plugin. Previous v0.16.7: interactive `yotta-memory migrate --recovery-key-out` prompt, `YOTTA_MEMORY_PASS` for automation, and a `view` memory-home fingerprint before reusing a running server.
|
|
45
|
-
> 🆕 **v0.17.0 (recovery probe + memory-store scan)**: `doctor --baseline [--against <store>] [--template <file>]` and `backup drill --probe` run six read-only baseline probes (identity / recent / source-only diff / CJK / operation rules / owner scope) against the target store or restored copy. Entry identity keys are layout-independent, so an old flat store migrating into the year/month layout never reports false gaps; missing items are listed and exit non-zero (`doctor` exit 2 / `drill` fails). Probes never hard-code any memory and `--template` only tightens the verdict. New `scan` command: seven classes (malicious instruction / prompt injection / credential leak / data exfiltration / guardrail bypass / behaviour manipulation / privilege escalation), five severities and `file:line` evidence; report-only by default, zero network and zero dependencies. `--gate` exits 1 at or above the given severity; `--quarantine` needs `--yes` or interactive confirmation and backs up each original file byte-for-byte into `.memory-scan/quarantine/` before redacting hit lines, with `--restore` to roll back; credential snippets are always masked.
|
|
46
|
-
> 🆕 **v0.16.5 (doctor JSON contract)**: `doctor --json` now exposes stable top-level `schemaVersion`, `encryption`, and `migration_required` fields while preserving the existing `checks` / `warnings` / `identity` structure.
|
|
47
|
-
> 🆕 **v0.16.4 (agent-key prompt scope)**: a missing `--agent-key-file` no longer prints a global `stderr` warning for public or maintenance commands. Only real private-data access fails closed, with the missing path, `view` / `key bind`, and `key status` / `key claim` guidance. `whoami --json`, `doctor --json`, and `config get --json` expose structured `identity.mode` / `identity.agentKeyStatus` fields.
|
|
48
|
-
> 🆕 **v0.16.2 (first-boot fixes)**: an empty encrypted store can unlock `view` with the recovery key; non-TTY hosts can use `--password-stdin`; recovery keys can be written with `--recovery-key-out <file>`; a missing `--agent-key-file` degrades to unauthenticated public-only mode; an empty plaintext store can be migrated to encryption; `view` reports port reuse/conflicts clearly.
|
|
49
|
-
> 🆕 **v0.16.3 (migration quick path)**: convert a plaintext store to encryption with the interactive command
|
|
50
|
-
> `yotta-memory migrate --recovery-key-out "%USERPROFILE%\yotta-memory-recovery.key"`.
|
|
51
|
-
> Then authorize agents with `yotta-memory view`; `view` and `yotta-memory key bind <id>` are equivalent, followed by `key status` / `key claim`, then `reindex` with `--agent-key-file` and a `recall` verification.
|
|
52
|
-
> 🆕 **v0.16.0 (identity model + stable runtime)**: identity is no longer read from environment variables. HTTP / remote MCP uses request headers `Authorization` + `X-Agent-Id` + `X-Agent-Key`; stdio MCP uses explicit `--agent-id` + `--agent-key-file`; CLI uses `--agent` + `--agent-key` / `--agent-key-file`. The new `runtime install --from-current` / `use` / `rollback` / `status` commands create a stable `<runtimeRoot>/current` launcher so managed MCP, autostart and backup tasks do not pin a version directory. `doctor --runtime` checks CLI / current / MCP config / running server / skill-copy drift, and MCP `serverInfo` returns `runtimePath` / `identityMode` / `toolProfile`.
|
|
53
|
-
> 🆕 **v0.15.0 (MCP tool profiles)**: `serve --tools core|full` controls the exposed MCP surface. `core` keeps `context / recall / search / remember` resident; `full` keeps the existing 16 tools for diagnostics and maintenance. Omitting the flag keeps the previous `full` behavior for compatibility.
|
|
54
|
-
|
|
55
|
-
> 🆕 **v0.14.0 (grows smarter + CLI diagnostics)**: `context` now loads long-term `consolidate` summaries first, samples a time-ordered recent corridor, keeps a deduplicated high-value backfill, and ends with a session loop contract (load at start, `remember --verify` during work, review before wrap-up). Identity, summaries, rules, profile, boundaries, commitments and the contract are not truncated by `--budget`; storage, encryption, owner isolation and permission checks are unchanged. This release also includes the CLI diagnostics work: explicit `--agent` wins over an untrusted ambient `YOTTA_AGENT_ID`; only `YOTTA_MEMORY_TRUST_ENV_AGENT=1` makes an environment identity authoritative. `key status` / `key claim` share one AI_HOME discovery rule (explicit `--to` / `--agent-key-file`, then `YOTTA_MEMORY_AGENT_HOME` / `YOTTA_MEMORY_AGENT_KEY_FILE`, then the Codex / OpenCode / generic host default) and `key status` always prints `checked` + `discovery`. The usage text now documents `remember <type> <subject> <statement>` and `recall [关键词]` directly.
|
|
56
|
-
|
|
57
|
-
> 🆕 **v0.13.2 (security)**: owner ID is not an authentication credential. Private reads/writes now require an explicit `agent_key`; the user creates it through `yotta-memory view` (or by running `yotta-memory key bind <id>`), then configures MCP with `YOTTA_AGENT_ID` + `YOTTA_MEMORY_AGENT_KEY` + `YOTTA_MEMORY_TRUST_ENV_AGENT=1` (or CLI `--agent <id> --agent-key <key>` / `--agent-key-file <file>`). Authorization also writes a temporary `keys/pending/<id>.key`; a new AI session runs `key status <id>` / `key claim <id>` to store it at `<AI_HOME>/.yotta-memory-agent-key` and delete pending, while the popup key is the user's separate backup. Legacy `keys/cache/*.key` is no longer loaded. When an owner still needs rebinding, `key list` and failed private operations print `[YTM_MIGRATION_REQUIRED]` with the affected agent IDs; the AI relays the steps and the user re-authorizes in `yotta-memory view`, which shows the one-time `agent_key` and refuses to overwrite an existing binding until it is revoked; the old key then fails validation.
|
|
58
|
-
|
|
59
|
-
> 🆕 **v0.12.2**: reliability closure — `yotta-memory doctor` checks the store, key material, index, identity registry and latest backup; `maintain --apply`, `consolidate --apply`, `merge`, `archive` and `--purge` create a transaction snapshot before writing and refuse to proceed if the snapshot fails.
|
|
60
|
-
|
|
61
|
-
> 🆕 **v0.12.1**: installation and update docs now distinguish the engine CLI (`yotta-memory`) from the skill installer (`yotta-memory-install`), with copy-ready upgrade commands.
|
|
62
|
-
|
|
63
|
-
> 🆕 **v0.12.0**: reliability baseline — `init` refuses to overwrite an existing store (`--attach` to attach); `forget` moves entries into `.trash/`; `backup create / list / doctor / restore` provides independent-volume backups with SHA-256 manifests.
|
|
64
|
-
|
|
65
|
-
> 🆕 **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`.
|
|
66
|
-
|
|
67
|
-
> 🆕 **v0.9.0**: recall quality + context selection — optional local embedding plugin, `context --focus`, and `--explain` selection trace.
|
|
68
|
-
|
|
69
|
-
> 🆕 **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).
|
|
38
|
+
### Memory types
|
|
70
39
|
|
|
71
|
-
|
|
40
|
+
| Type | Meaning | Visibility |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `FACT` | facts / knowledge / experience | public zone, readable by all agents |
|
|
43
|
+
| `PREF` | preferences / habits | private zone, owning agent only |
|
|
44
|
+
| `BOUND` | boundaries / rules / bottom lines | private zone, owning agent only |
|
|
45
|
+
| `COMMIT` | commitments / anchors | private zone, owning agent only |
|
|
72
46
|
|
|
73
|
-
|
|
47
|
+
## Privacy in one page
|
|
74
48
|
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
- **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`.
|
|
81
|
-
- **Reliability baseline (v0.12.0 / v0.12.2)** — `init` refuses to overwrite an existing store and `--attach` attaches instead; `forget` moves entries to `.trash/` with an audit record; `backup create / list / doctor / restore` backs up the store to an independent volume with a SHA-256 manifest and restores only to a new directory; `yotta-memory doctor` checks the store, key material, index, identity registry and latest backup, and destructive writes take a transaction snapshot first.
|
|
82
|
-
- **Milestone hook declaration** — `skill-manifest.json` declares `after_milestone` / `remember_commit`; a milestone memory write is verified only with a real file-path record.
|
|
83
|
-
- **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).
|
|
49
|
+
- Public `FACT` is plaintext and auditable; `PREF` / `BOUND` / `COMMIT` are encrypted and split per owner.
|
|
50
|
+
- `yotta-memory view` unlocks with your passphrase and shows / exports **all** memory — you are the data owner.
|
|
51
|
+
- The engine makes no network calls. The only network access is what you run yourself (`npm i`) or a local provider subprocess you explicitly configure.
|
|
52
|
+
- The boundary is honest: this protects data at rest and isolates agents from each other. It does **not** claim to defend against a malicious process running as the same OS user.
|
|
53
|
+
- Full details: [`references/trust-card.md`](references/trust-card.md).
|
|
84
54
|
|
|
85
|
-
|
|
55
|
+
New stores are encrypted by default. To convert an existing plaintext store, run the interactive migration (non-ASCII passphrases must be typed at the prompt, not piped through a shell):
|
|
86
56
|
|
|
87
|
-
|
|
57
|
+
```bash
|
|
58
|
+
yotta-memory migrate --recovery-key-out "<recovery-key-file>"
|
|
59
|
+
```
|
|
88
60
|
|
|
89
|
-
|
|
90
|
-
|---|---|---|
|
|
91
|
-
| `FACT` | facts / knowledge / experience (verifiable, shareable) | public zone, readable by all agents |
|
|
92
|
-
| `PREF` | preferences / habits / likes | private zone, readable only by the owning agent by default |
|
|
93
|
-
| `BOUND` | boundaries / rules / bottom lines | private zone, readable only by the owning agent by default |
|
|
94
|
-
| `COMMIT` | commitments / anchors / agreements | private zone, readable only by the owning agent by default |
|
|
95
|
-
|
|
96
|
-
- **Two-level storage**: user-level `~/.yottamemory/` shares personal memory across projects; project-level `.yottamemory/` travels with the project — natural for handoff and team collaboration. recall prefers project-level.
|
|
97
|
-
- **Same-key auto-update**: rewriting the same subject + statement only updates `updated`, no duplicates.
|
|
98
|
-
- **Rich metadata**: each memory carries `confidence`, `tags`, `immutable`, `created/updated`, `access_count` and more for retrieval and lifecycle management.
|
|
99
|
-
|
|
100
|
-
### Permissions & isolation
|
|
101
|
-
|
|
102
|
-
- **Three read states**: public FACT always readable; own private always readable; other agents' private is denied by default (content not returned).
|
|
103
|
-
- **Physically isolated directories**: private memory lives at `private/<owner>/<type>/`; different agents' private files are physically separated; legacy flat `prefs/` `bounds/` `commits/` auto-migrate on `reindex`.
|
|
104
|
-
- **Three authorization gates** (any one grants reading another's private): 1. explicit grant in `grants.json`; 2. identity=user (`--agent user` / `--owner user`); 3. explicit `--unsafe` (user explicitly authorized). The caller must still present the matching `agent_key`.
|
|
105
|
-
- **Silent by default, explicit cross-read errors**: default recall silently skips other agents' private (no "there are N invisible private entries" leak); only explicit cross-agent reads (`--all` / `--owner <other>`) without authorization error / warn.
|
|
106
|
-
- **`--agent <other>` does not cross**: it only declares identity for display; reading other agents' private still needs grant / identity=user / `--unsafe`.
|
|
107
|
-
- **Isolation positioning**: scope: private guarantees semantic isolation between AIs; since v0.7 the private zone is mechanism-level confidentiality — files are AES-256-GCM envelope encrypted, so an AI without the owner key cannot decrypt them even if it reads the ciphertext; data sovereignty remains with the user, who can use `yotta-memory view` to unlock and view / export any memory file.
|
|
108
|
-
- **No direct shell reads/writes**: all memory reads/writes go through CLI / MCP tools; directly reading or editing library files with shell commands bypasses scope/owner boundaries.
|
|
109
|
-
|
|
110
|
-
### Agent identity (unique ID + self profile)
|
|
111
|
-
|
|
112
|
-
Each agent has a globally unique agent ID: it is the ownership key for private memory (PREF / BOUND / COMMIT) and the identity declaration for remote access (`X-Agent-Id`).
|
|
113
|
-
|
|
114
|
-
- **Register (must be unique)**: `yotta-memory iam <id>` writes `agents.json` at the memory root, **enforcing uniqueness** — denied if the ID is already used by another host / source (including remote token registration); `--force` only when you confirm it is the same agent.
|
|
115
|
-
- **Confirm identity**: `yotta-memory whoami` (remote MCP tool `agent_info`) reads the "declared identity of this session" — it never guesses or assumes.
|
|
116
|
-
- **Self profile (forced to disk)**: `iam` auto-writes a PREF `subject=自我接入档案` (owner=self) with `; `-separated key:value: `agent_id / host / memory_home / mcp_mode / engine_url / token` (token not stored locally). Start work with `recall "自我接入档案"` to recover identity and connection info.
|
|
117
|
-
- **No network token locally**: local CLI / stdio bypasses HTTP tokens, but private access still requires `agent_id + agent_key`; stdio MCP passes the key file with `--agent-id` + `--agent-key-file`, never through identity env.
|
|
118
|
-
- **Private memory requires an owner**: writing PREF / BOUND / COMMIT without declaring identity is rejected (public FACT is unaffected), mechanically preventing ID spoofing.
|
|
119
|
-
|
|
120
|
-
### Profile & start-of-work context (v0.6.0 + v0.9.0 + v0.14.0)
|
|
121
|
-
|
|
122
|
-
- **profile**: aggregates `private/<owner>/` PREF / BOUND / COMMIT verbatim, grouped by type + subject + tags, written to `profile.md`; the engine infers nothing — profile conclusions are formed internally by the AI per the "memory discipline", never pasted as labels.
|
|
123
|
-
- **context**: one-shot start-of-work package — multi-agent integration rules + identity + long-term summaries first (`consolidate` output) + user profile digest + optional task-focused memory (`--focus`) + time-ordered recent corridor + deduplicated high-value backfill + boundary reminders + commitments/anchors + session loop contract; supports `--budget` for dynamic memory and `--explain` selection trace. Optional local providers can add `memory.hook` filtering and, when `--budget` is explicit, `context.paging` ordering/paging; `context --json` returns `hook` and `paging` blocks.
|
|
124
|
-
- **Memory discipline**: SKILL.md embeds a rule layer (type red lines / proactive trigger capture / know-the-user three stages / psychological grounding & alignment / bottom lines / host isolation / anti-patterns).
|
|
125
|
-
|
|
126
|
-
### Retrieval: semantic search (v0.8.0 + v0.9.0 embedding)
|
|
127
|
-
|
|
128
|
-
- `remember` auto-builds the index (version 5 since v0.24.0; logical size > 4 MB or more than 5000 entries uses `index-<year>.json.gz` year shards while remaining v4-compatible; old indexes rebuild on first recall); recall defaults to semantic search — exact (field weighting: subject×3 / tags×2 / statement×1) + synonyms (built-in wordlist, extensible) + pinyin (full / initials, built-in 3755 common characters) + fuzzy (edit distance ≤ 2) + substring fallback, blended with utility score (0.65 × semantic + 0.35 × utility), zero-dependency.
|
|
129
|
-
- `recall --explain`: shows each hit's reason (exact / synonym / pinyin / fuzzy + field) and utility components.
|
|
130
|
-
- **Candidate pre-filtering (v0.8.1)**: before semantic scoring, index tokens coarsely filter the candidate set (exact / synonym / pinyin / substring / fuzzy length gate) — hit set identical to v0.8.0; the `view` platform paginates by offset, fetching only the current page.
|
|
131
|
-
- **Optional embedding plugin (v0.9.0)**: `recall --embedding <command>` or `config set embedding_cmd <command>` runs a local subprocess that accepts JSON on stdin and returns vectors on stdout; results are blended into the same ranking. Failures, timeouts, or malformed output automatically fall back to zero-dependency lexical recall.
|
|
132
|
-
- **Embedding cache**: vectors are cached under each memory root at `.embed/cache.json`, keyed by `sha256(command + text)`; only vectors are stored, not plaintext.
|
|
133
|
-
- The `tokens` field of `index.json` is a Chinese-tokenization term-frequency table (for TF scoring), **not** an access credential; auth tokens live at `.server/tokens.json`.
|
|
134
|
-
- Supports keywords, `--type` filter, `--limit` truncation, project-level priority.
|
|
135
|
-
- **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.
|
|
136
|
-
- Hits accumulate `access_count` / `last_accessed` for lifecycle management.
|
|
137
|
-
|
|
138
|
-
### Lifecycle management (v0.8.0 rule-layer self-organization + v0.10.0 compression)
|
|
139
|
-
|
|
140
|
-
- **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>`.
|
|
141
|
-
- `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`.
|
|
142
|
-
- `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>/`.
|
|
143
|
-
- `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.
|
|
144
|
-
- `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`.
|
|
145
|
-
- `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/`.
|
|
146
|
-
- `explain`: view the utility components (recency shows its half-life), archive / forget / BOUND-exempt status decision of a single memory.
|
|
147
|
-
- `forget`: delete a single memory (by type-dir path or file name).
|
|
148
|
-
- `reindex`: rebuild the index after manually editing `.md` files.
|
|
149
|
-
- `export` / `import`: export the whole store to JSON / import from JSON; an intermediate format for migration and backup.
|
|
150
|
-
- git: the whole store can be version-controlled — rollback / audit / team sync.
|
|
151
|
-
|
|
152
|
-
## FAQ (quick reference)
|
|
153
|
-
|
|
154
|
-
| Question | Answer (see references/faq.md) |
|
|
155
|
-
|---|---|
|
|
156
|
-
| Wrong memory type? | Hint only; forget and rewrite; --no-hint to disable |
|
|
157
|
-
| Private encryption? | init encrypts by default (master password + recovery key); migrate to encrypt a plaintext store |
|
|
158
|
-
| Multi-agent isolation? | FACT public; PREF/BOUND/COMMIT per-owner + per-agent `agent_key`; the user binds once via `view` (or `key bind`) |
|
|
159
|
-
| Memory not found? | config get -> reindex -> recall/search |
|
|
160
|
-
| Lost master password? | reset-password with recovery key |
|
|
161
|
-
| LAN connect? | lan enable + token new; client url+token |
|
|
162
|
-
| MCP not loaded? | Check mcpServers + restart; use CLI directly |
|
|
163
|
-
| Version mismatch? | Run `yotta-memory doctor --runtime` and apply the repair command for each drift |
|
|
164
|
-
| Where is the store? | config get; project-level .yottamemory |
|
|
165
|
-
| Cross-session resume? | Run context + recall at session start |
|
|
166
|
-
| Backup / migrate? | export / import |
|
|
167
|
-
|
|
168
|
-
## Comparison with other approaches
|
|
169
|
-
|
|
170
|
-
> Compared by solution type, not product names. Criteria: data sovereignty, deployment cost, permission boundaries, auditability, cross-agent ability.
|
|
171
|
-
|
|
172
|
-
| Dimension | Yuanyi (yotta-memory) | Database / embedded storage | Vector store / semantic retrieval | Cloud-hosted memory service |
|
|
173
|
-
|---|---|---|---|---|
|
|
174
|
-
| Storage form | Public FACT plaintext files; private zone encrypted (.md.enc); git-versionable | binary / structured database files | vector index + model dependency | vendor servers |
|
|
175
|
-
| Data sovereignty | fully local, readable/editable/deletable (private zone via view platform) | local, but needs dedicated tools | local or self-hosted; model extra | not in user's hands; TOS-bound |
|
|
176
|
-
| Permission boundaries | built-in: public/private zones + scope/owner + grants | usually none, DIY | usually none, DIY | account-level only, no memory-level granularity |
|
|
177
|
-
| Audit / rollback | public FACT plaintext auditable; private encrypted but user-decryptable via view; git rollback | needs export toolchain; complex rollback | snapshot/export dependent | platform export dependent |
|
|
178
|
-
| Deployment & deps | zero-dependency, runs on Node.js | needs database runtime / embedded dep | vector store + model, heavier | online + account, data leaves local |
|
|
179
|
-
| Cross-agent | Agent Skills standard; write once, multiple agents read | per-agent integration, no standard | per-agent integration, costly | platform coverage dependent |
|
|
180
|
-
|
|
181
|
-
**Conclusion**: Yuanyi's core differentiator is combining "data sovereignty + permission boundaries + zero dependency" — auditable files, mechanism-level read isolation, and no heavy dependencies. For "local-first, multi-agent collaboration, long-term accumulation", it is the lightest path.
|
|
61
|
+
Then authorize the agent in `yotta-memory view` (or `key bind`), let the agent `key claim`, and run `reindex` with `--agent-key-file`.
|
|
182
62
|
|
|
183
63
|
## Install
|
|
184
64
|
|
|
185
|
-
|
|
65
|
+
Yuanyi ships as a **CLI + skill** pair: `yotta-memory` reads and writes the store, and the skill teaches the agent the workflow. Pick one of four methods; skill files come from npm (GitHub can be slow without a proxy).
|
|
186
66
|
|
|
187
67
|
### Method 1: npm one-liner (recommended)
|
|
188
68
|
|
|
189
69
|
```text
|
|
190
70
|
# Optional China mirror: npm config set registry https://registry.npmmirror.com
|
|
191
|
-
npx -y --package @yottameta/yotta-memory yotta-memory-install --agent <agent-name>
|
|
192
|
-
npx -y --package @yottameta/yotta-memory yotta-memory-install --dir <your-skills-dir>
|
|
71
|
+
npx -y --package @yottameta/yotta-memory yotta-memory-install --agent <agent-name>
|
|
72
|
+
npx -y --package @yottameta/yotta-memory yotta-memory-install --dir <your-skills-dir>
|
|
193
73
|
```
|
|
194
74
|
|
|
195
|
-
- `--agent <name>` installs to that agent's default user-level directory; `--list` shows
|
|
196
|
-
- `--dir <path>` installs to
|
|
197
|
-
- If the mirror has not synced
|
|
198
|
-
- To read
|
|
75
|
+
- `--agent <name>` installs to that agent's default user-level directory; `--list` shows the presets.
|
|
76
|
+
- `--dir <path>` installs to any skills directory, including agents not in the preset list.
|
|
77
|
+
- If the mirror has not synced a new package (404), add `--registry=https://registry.npmjs.org/` or wait for the cache.
|
|
78
|
+
- To read and write memories, also install the CLI: `npm install -g @yottameta/yotta-memory`.
|
|
199
79
|
|
|
200
80
|
### Method 2: git clone (developers / git available)
|
|
201
81
|
|
|
@@ -205,253 +85,96 @@ git clone https://github.com/YottaMeta/yotta-memory.git <your-skills-dir>/yotta-
|
|
|
205
85
|
|
|
206
86
|
### Method 3: GitHub Download ZIP (manual / no git)
|
|
207
87
|
|
|
208
|
-
On
|
|
88
|
+
On `YottaMeta/yotta-memory`, click **Code → Download ZIP**, unzip it and put the `yotta-memory` folder into the agent's skills directory.
|
|
209
89
|
|
|
210
|
-
### Method 4: install.sh (multi-agent one-liner
|
|
90
|
+
### Method 4: install.sh (multi-agent one-liner)
|
|
211
91
|
|
|
212
92
|
```text
|
|
213
|
-
bash install.sh --agent <name> #
|
|
214
|
-
bash install.sh --dir <path> #
|
|
93
|
+
bash install.sh --agent <name> # default user-level directory
|
|
94
|
+
bash install.sh --dir <path> # explicit directory
|
|
215
95
|
bash install.sh --list # list agents -> default directories
|
|
216
96
|
```
|
|
217
97
|
|
|
218
98
|
### Two commands, two jobs
|
|
219
99
|
|
|
220
|
-
|
|
100
|
+
- `yotta-memory` — the engine CLI. `npx -y @yottameta/yotta-memory` only runs the engine temporarily; it does not install the skill.
|
|
101
|
+
- `yotta-memory-install` — the skill installer. It refuses symlinked targets (including Windows junctions) instead of writing through them.
|
|
221
102
|
|
|
222
|
-
|
|
223
|
-
- `yotta-memory-install` — the skill installer. Install or update the skill with `npx -y --package @yottameta/yotta-memory yotta-memory-install --agent <agent-name>` (or `--dir <skills-dir>`).
|
|
103
|
+
## Quick start
|
|
224
104
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
```text
|
|
233
|
-
Memory store initialized: ~/.yottamemory
|
|
234
|
-
Master password set; recovery key: xxxx-xxxx-xxxx-xxxx (keep it safe)
|
|
105
|
+
```bash
|
|
106
|
+
yotta-memory init # new stores are encrypted by default
|
|
107
|
+
yotta-memory config get # confirm where the store lives
|
|
108
|
+
yotta-memory context # start-of-work package
|
|
109
|
+
yotta-memory remember FACT "project" "uses npm workspaces" --verify
|
|
110
|
+
yotta-memory recall "workspaces"
|
|
235
111
|
```
|
|
236
112
|
|
|
237
|
-
|
|
113
|
+
Typical output (illustrative):
|
|
238
114
|
|
|
239
115
|
```text
|
|
240
|
-
Recorded: ~/.yottamemory/facts/2026-
|
|
241
|
-
[verify] read-back OK: facts/2026-
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
**recall**:
|
|
116
|
+
Recorded: ~/.yottamemory/facts/2026-11-28-0001.md
|
|
117
|
+
[verify] read-back OK: facts/2026-11-28-0001.md
|
|
245
118
|
|
|
246
|
-
```text
|
|
247
|
-
3 memories (top 3):
|
|
248
|
-
[FACT] subject: statement... (~/.yottamemory/facts/xxx.md)
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
**context**:
|
|
252
|
-
|
|
253
|
-
```text
|
|
254
119
|
# Start-of-work context (yotta-memory context)
|
|
255
120
|
## 1. Identity
|
|
256
121
|
## 2. User profile summary
|
|
257
|
-
##
|
|
258
|
-
##
|
|
259
|
-
##
|
|
260
|
-
##
|
|
261
|
-
##
|
|
262
|
-
##
|
|
122
|
+
## 3. Long-term understanding summaries
|
|
123
|
+
## 4. Recent corridor (time-ordered)
|
|
124
|
+
## 5. Recent high-value backfill
|
|
125
|
+
## 6. Boundaries (BOUND)
|
|
126
|
+
## 7. Commitments / anchors (COMMIT)
|
|
127
|
+
## 8. Session loop contract
|
|
263
128
|
```
|
|
264
129
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
Two upgrade paths match the two install paths:
|
|
268
|
-
|
|
269
|
-
**Upgrade the CLI** (rerun the install command; no version tag defaults to latest):
|
|
270
|
-
```bash
|
|
271
|
-
npm i -g @yottameta/yotta-memory
|
|
272
|
-
```
|
|
130
|
+
### Command map
|
|
273
131
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
```text
|
|
277
|
-
npx -y --package @yottameta/yotta-memory yotta-memory-install --agent <agent-name>
|
|
278
|
-
npx -y --package @yottameta/yotta-memory yotta-memory-install --dir <skills-dir>
|
|
279
|
-
bash install.sh --agent <agent-name>
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
If you installed the CLI globally, `npm i -g @yottameta/yotta-memory` updates both the engine and the `yotta-memory-install` command; then run `yotta-memory-install --agent <agent-name>` to refresh the skill.
|
|
283
|
-
|
|
284
|
-
After updating, verify `yotta-memory --version` and the installed `yotta-memory/SKILL.md` frontmatter `version:`.
|
|
285
|
-
|
|
286
|
-
> **v0.17.0 upgrade note**: run `yotta-memory reindex` once with the 0.17.0 engine after upgrading. Engines 0.16.7 and earlier do not understand the new year/month layout and will drop layered entries from a rebuilt index. `doctor` now reports flat/layered same-identity duplicates: identical copies are indexed once; conflicting copies stay readable and are listed with both paths, and new writes never reuse an occupied sequence number.
|
|
287
|
-
|
|
288
|
-
**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.
|
|
289
|
-
|
|
290
|
-
Behavior changes to be aware of:
|
|
291
|
-
|
|
292
|
-
- 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.
|
|
293
|
-
- BOUND is now **never auto-archived or auto-forgotten** (previously the code only exempted it from forgetting, not archiving — this release closes the gap).
|
|
294
|
-
- `maintain --dedup` is now **mutually exclusive with archiving**: `--dedup [--apply]` only lists / auto-merges duplicates and never silently archives old single memories.
|
|
295
|
-
- 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).
|
|
296
|
-
- New commands are additive: `consolidate`, `consolidate --undo <batch>`, `consolidate --batches`.
|
|
297
|
-
|
|
298
|
-
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>`.
|
|
299
|
-
|
|
300
|
-
> Upgrades only affect commands and skill files — **they never touch your stored memories** (memory is independent of the install, kept in its own directory).
|
|
301
|
-
|
|
302
|
-
## CLI usage
|
|
303
|
-
|
|
304
|
-
| Command | What it does |
|
|
132
|
+
| Task | Command |
|
|
305
133
|
|---|---|
|
|
306
|
-
|
|
|
307
|
-
| `
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
| `
|
|
312
|
-
|
|
|
313
|
-
| `yotta-memory archive [--days 180] [--threshold 0.4]` | Archive old memory (decay-blended utility + age; immutable / BOUND exempt; private to `.archive/private/<owner>/<type>/`) |
|
|
314
|
-
| `yotta-memory reindex` | Rebuild the index (after manually editing .md) |
|
|
315
|
-
| `yotta-memory identity remove <id> [--dry-run] [--yes] [--keep-memories] [--keep-identity] [--password <pass> \| --recovery-key <key>]` | Permanently delete one AI identity and its private memories (v0.17.0): identity registration, owner key, agent binding, pending key, plaintext cache, the whole `private/<id>/` tree, tokens and grant references, then rebuild the index and write an audit record. Public plaintext FACTs are kept and other AIs are untouched. User-only: an encrypted store requires the master password or recovery key, a plaintext store requires an explicit `--agent user`, and the unlocked `view` session counts as the user. Destructive gate = doctor + independent backup + transaction snapshot; `--dry-run` lists the plan only |
|
|
316
|
-
| `yotta-memory export [--out f.json]` / `import <f.json>` | Export / import |
|
|
317
|
-
| `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_*`) |
|
|
318
|
-
| `yotta-memory whoami` | Show the current agent identity and registration status |
|
|
319
|
-
| `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) |
|
|
320
|
-
| `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`) |
|
|
321
|
-
| `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 + X-Agent-Key auth) |
|
|
322
|
-
| `yotta-memory lan enable [--onstart] / disable / status` | Autostart management (Windows: scheduled task with an S4U principal — runs silently in the background with no console window; `--onstart` starts at boot without a logon session, registration needs admin; non-admin auto-degrades to user-level silent Startup; Linux: systemd user unit, falls back to user crontab @reboot). v0.24.1 persists a per-user `serve-profile.json`; `lan status` reports drift and old tasks lacking `--profile` |
|
|
323
|
-
| `yotta-memory serve --profile <file>` | Read the per-user service profile, pin memory/runtime/config roots, validate absolute paths and the Windows user, and fail closed before opening the MCP port when a path is missing |
|
|
324
|
-
| `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 |
|
|
325
|
-
| `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 |
|
|
326
|
-
| `yotta-memory feedback <file> --useful|--useless [--reason <r>] [--undo]` | Usage feedback (useful/useless adjusts weight / confidence / feedback_net; --undo rolls back the last one) |
|
|
327
|
-
| `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) |
|
|
328
|
-
| `yotta-memory explain <file>` | Show the utility breakdown and archive / forget / BOUND-exempt status of one memory |
|
|
329
|
-
| `yotta-memory bench [--evalset <file>] [--k N] [--seed N] [--bootstrap N] [--ablate] [--gate <metric>=<value>] [--timing] [--year <yyyy>] [--json] [--out <file>]` | Reproducible retrieval benchmark (v0.17.0): deterministic auto sampling from the store or an explicit evalset v1; reports Recall@k / MRR / nDCG@k / HitRate with bootstrap 95% CI plus store and evalset fingerprints, and writes no wall-clock data by default; `--ablate` compares lexical / semantic × fused / pure-score; `--gate` fails the run (exit 1) when a metric is below the threshold; `--timing` adds p50 / p95 and marks the report as not byte-reproducible. Read-only: no index rebuild, no access counters, no external embedding plugin |
|
|
330
|
-
| `yotta-memory scan [--path <dir>] [--gate <severity>] [--quarantine --yes] [--restore] [--id <batch>] [--json]` | Memory-store security scan (v0.17.0): seven classes = malicious instruction / prompt injection / credential leak / data exfiltration / guardrail bypass / behaviour manipulation / privilege escalation, five severities with `file:line` evidence and rule provenance; report-only by default, zero network and zero dependencies; `--gate` fails the run (exit 1) at or above the given severity; `--quarantine` needs `--yes` or interactive confirmation, backs each original file up byte-for-byte into `.memory-scan/quarantine/` and then redacts hit lines, and `--restore` rolls it back; credential snippets are always masked |
|
|
331
|
-
|
|
332
|
-
Types: `FACT` (fact, public shared) / `PREF` (preference) / `BOUND` (boundary) / `COMMIT` (commitment).
|
|
333
|
-
|
|
334
|
-
Example:
|
|
335
|
-
```bash
|
|
336
|
-
yotta-memory init
|
|
337
|
-
yotta-memory remember PREF 用户 偏好短回复,不要用表情
|
|
338
|
-
yotta-memory recall 偏好
|
|
339
|
-
yotta-memory profile
|
|
340
|
-
yotta-memory context --limit 10
|
|
341
|
-
yotta-memory recall --type FACT --limit 10
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
Environment variables:
|
|
345
|
-
- `YOTTA_MEMORY_HOME`: overrides the user-level store directory (default `~/.yottamemory/`).
|
|
346
|
-
- `YOTTA_MEMORY_AGENT_HOME` / `YOTTA_MEMORY_AGENT_KEY_FILE`: explicit AI host directory / key file overrides for `key status` and `key claim`; command-line `--to` / `--agent-key-file` take precedence.
|
|
134
|
+
| Start of work | `context [--focus <keyword>] [--budget N]` |
|
|
135
|
+
| Write / read | `remember <type> <subject> <statement> --verify` · `recall <keyword>` |
|
|
136
|
+
| Housekeeping | `maintain [--apply]` · `consolidate [--apply]` · `archive --dry-run` |
|
|
137
|
+
| Health | `doctor` · `backup create / doctor / drill` · `scan` |
|
|
138
|
+
| Identity | `iam <id>` · `whoami` · `key claim <id>` |
|
|
139
|
+
| Sharing | `serve --stdio --tools core` · `lan enable` · `token new --agent <id>` |
|
|
140
|
+
| Review | `view` (local web platform) |
|
|
347
141
|
|
|
348
|
-
|
|
142
|
+
Full option list: [`references/cli-reference.md`](references/cli-reference.md). Per-command help: `yotta-memory <command> --help`.
|
|
349
143
|
|
|
350
|
-
##
|
|
351
|
-
|
|
352
|
-
Once the skill is installed into an agent, SKILL.md teaches it the workflow automatically: start work with `recall` to restore context → `remember` important info as you go → archive at wrap-up. You can also just say "记住 XXX" / "上次说到哪了" in conversation.
|
|
353
|
-
|
|
354
|
-
## LAN multi-machine sharing (portable memory disk mode)
|
|
355
|
-
|
|
356
|
-
The store can live on any host or disk (= the memory engine) and be reached by agents on other LAN hosts:
|
|
357
|
-
|
|
358
|
-
- **Local direct**: CLI reads/writes directly, no token;
|
|
359
|
-
- **Remote**: the engine host runs `yotta-memory serve` (or registers `lan enable` autostart); remote agents connect via MCP with `url + token + agent_key`. Same-host / shared-filesystem agents use `key claim`; cross-host setups without a shared filesystem require the user to transfer the host key securely.
|
|
360
|
-
- **Local zero-process**: local MCP clients can use `serve --stdio --agent-id <id> --agent-key-file <path>` to launch the CLI on demand (no resident process).
|
|
361
|
-
|
|
362
|
-
```json
|
|
363
|
-
{
|
|
364
|
-
"mcpServers": {
|
|
365
|
-
"yotta-memory": {
|
|
366
|
-
"command": "node",
|
|
367
|
-
"args": [
|
|
368
|
-
"<runtimeRoot>/current/bin/yotta-memory.js",
|
|
369
|
-
"serve", "--stdio", "--tools", "core",
|
|
370
|
-
"--agent-id", "<this-agent-id>",
|
|
371
|
-
"--agent-key-file", "<AI_HOME>/.yotta-memory-agent-key"
|
|
372
|
-
]
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
### Engine side (the host where memory lives)
|
|
379
|
-
|
|
380
|
-
1. Initialize or attach to the store (see CLI usage).
|
|
381
|
-
2. Install or refresh the stable runtime entry:
|
|
382
|
-
```bash
|
|
383
|
-
yotta-memory runtime install --from-current
|
|
384
|
-
yotta-memory runtime status
|
|
385
|
-
yotta-memory doctor --runtime
|
|
386
|
-
```
|
|
387
|
-
> `lan enable` and backup scheduling call the same runtime preparation automatically and only register `<runtimeRoot>/current/bin/yotta-memory.js`.
|
|
388
|
-
3. Generate an independent token for each agent that needs access:
|
|
389
|
-
```bash
|
|
390
|
-
yotta-memory token new --agent <agent-id> # printed once, e.g. ytm_... (--force if the ID is taken by another source)
|
|
391
|
-
yotta-memory token list # list registered agents
|
|
392
|
-
yotta-memory token revoke --agent <agent-id> # revoke
|
|
393
|
-
```
|
|
394
|
-
> New tokens take effect immediately; no service restart needed.
|
|
395
|
-
4. Start the service (default listens on 0.0.0.0:8787, Bearer token + X-Agent-Id + X-Agent-Key auth) — temporary run or register autostart:
|
|
396
|
-
```bash
|
|
397
|
-
yotta-memory serve # temporary foreground
|
|
398
|
-
yotta-memory lan enable # register autostart (Windows: scheduled task / user-level Startup; Linux: systemd user unit / user crontab)
|
|
399
|
-
yotta-memory lan status # autostart status
|
|
400
|
-
```
|
|
401
|
-
> `lan enable` registers a silent S4U scheduled task (no console window); `--onstart` switches to start-at-boot without a logon session (registration needs admin); non-admin `lan enable` auto-degrades to user-level silent Startup; `lan disable` removes it.
|
|
402
|
-
|
|
403
|
-
> On first listen on 0.0.0.0, Windows / the system firewall may ask to allow it — allow it, or other LAN hosts cannot reach it; `--no-auth` disables auth for trusted intranets only.
|
|
404
|
-
|
|
405
|
-
### Client side (remote agent)
|
|
406
|
-
|
|
407
|
-
Before registering the connection, confirm the agent has claimed its key:
|
|
144
|
+
## Upgrade
|
|
408
145
|
|
|
409
146
|
```bash
|
|
410
|
-
yotta-memory
|
|
411
|
-
yotta-memory
|
|
147
|
+
npm i -g @yottameta/yotta-memory # upgrade the engine
|
|
148
|
+
npx -y --package @yottameta/yotta-memory yotta-memory-install --agent <agent-name> # refresh the skill
|
|
412
149
|
```
|
|
413
150
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
```json
|
|
417
|
-
{
|
|
418
|
-
"mcpServers": {
|
|
419
|
-
"yotta-memory": {
|
|
420
|
-
"url": "http://<engine-host-ip>:8787/mcp",
|
|
421
|
-
"headers": {
|
|
422
|
-
"Authorization": "Bearer <TOKEN>",
|
|
423
|
-
"X-Agent-Id": "<this-agent-id>",
|
|
424
|
-
"X-Agent-Key": "<agent_key from this agent's host key file>"
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
```
|
|
151
|
+
After upgrading, check that `yotta-memory --version` and the installed `SKILL.md` `version:` agree.
|
|
430
152
|
|
|
431
|
-
|
|
153
|
+
## LAN multi-machine sharing
|
|
432
154
|
|
|
433
|
-
|
|
155
|
+
The store can live on a desktop, a NAS or an external disk. Local agents use the CLI; other machines connect over MCP with a per-agent token and agent key. Setup, autostart and recovery steps: [`references/lan-mode.md`](references/lan-mode.md).
|
|
434
156
|
|
|
435
|
-
|
|
157
|
+
## Docs
|
|
436
158
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
159
|
+
| Document | What is inside |
|
|
160
|
+
|---|---|
|
|
161
|
+
| [`USER_GUIDE.md`](USER_GUIDE.md) | task-oriented user manual (install → daily use → LAN → troubleshooting) |
|
|
162
|
+
| [`references/trust-card.md`](references/trust-card.md) | where data lives, who can read it, how to delete, backup and failure playbook |
|
|
163
|
+
| [`references/cli-reference.md`](references/cli-reference.md) | full command table, first boot, plaintext → encrypted migration |
|
|
164
|
+
| [`references/lan-mode.md`](references/lan-mode.md) | portable memory disk / LAN mode in full |
|
|
165
|
+
| [`references/faq.md`](references/faq.md) | common questions and pitfalls |
|
|
166
|
+
| [`references/protocol.md`](references/protocol.md) | storage layout, index, encryption format, type rules |
|
|
167
|
+
| [`CHANGELOG.md`](CHANGELOG.md) | what changed in every release |
|
|
443
168
|
|
|
444
169
|
## Development & validation
|
|
445
170
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
## Changelog
|
|
171
|
+
```bash
|
|
172
|
+
npm test # node --test
|
|
173
|
+
node --test --test-concurrency=2 # on unstable hardware
|
|
174
|
+
```
|
|
452
175
|
|
|
453
|
-
|
|
176
|
+
Release gates (run from the YottaSkills workspace): `python tools/validate-skill.py yotta-memory`, `python tools/preflight-publish.py yotta-memory`, `python tools/check_delivery_integrity.py`.
|
|
454
177
|
|
|
455
178
|
## License
|
|
456
179
|
|
|
457
|
-
|
|
180
|
+
MIT — see [LICENSE](LICENSE).
|