claude-mem-lite 6.20.0 → 6.22.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.
Files changed (56) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +49 -12
  4. package/README.zh-CN.md +39 -13
  5. package/adopt-cli.mjs +361 -75
  6. package/claudemd.mjs +68 -5
  7. package/cli/common.mjs +11 -1
  8. package/commands/adopt.md +24 -14
  9. package/commands/unadopt.md +15 -12
  10. package/hook-context.mjs +14 -8
  11. package/hook-episode.mjs +75 -7
  12. package/hook-handoff.mjs +26 -0
  13. package/hook-llm.mjs +11 -10
  14. package/hook-memory.mjs +4 -8
  15. package/hook-optimize.mjs +27 -5
  16. package/hook-shared.mjs +91 -1
  17. package/hook-update.mjs +5 -2
  18. package/hook.mjs +331 -38
  19. package/install.mjs +187 -30
  20. package/lib/citation-tracker.mjs +71 -2
  21. package/lib/cooldown-path.mjs +13 -0
  22. package/lib/deferred-work.mjs +1 -1
  23. package/lib/delete-core.mjs +34 -5
  24. package/lib/export-columns.mjs +1 -0
  25. package/lib/handoff-constants.mjs +4 -0
  26. package/lib/hook-prune.mjs +53 -17
  27. package/lib/hook-stdin.mjs +7 -1
  28. package/lib/llm-provider-probe.mjs +50 -1
  29. package/lib/local-steering.mjs +744 -68
  30. package/lib/maintain-core.mjs +109 -38
  31. package/lib/mcp-ownership.mjs +23 -0
  32. package/lib/observation-write.mjs +6 -1
  33. package/lib/private-strip.mjs +31 -19
  34. package/lib/project-rekey.mjs +178 -0
  35. package/lib/prompt-admission.mjs +68 -0
  36. package/lib/quiet-scope.mjs +7 -1
  37. package/lib/recall-core.mjs +36 -7
  38. package/lib/save-nudge.mjs +3 -2
  39. package/lib/search-core.mjs +4 -0
  40. package/lib/tmp-fixture-sweep.mjs +2 -1
  41. package/lib/verify-apply-core.mjs +9 -2
  42. package/mem-cli.mjs +49 -20
  43. package/npm-shrinkwrap.json +15 -11
  44. package/package.json +4 -1
  45. package/project-utils.mjs +24 -4
  46. package/schema.mjs +32 -1
  47. package/scripts/post-tool-recall.js +5 -3
  48. package/scripts/post-tool-use.sh +46 -20
  49. package/scripts/pre-tool-recall.js +12 -5
  50. package/scripts/prompt-search-utils.mjs +5 -27
  51. package/scripts/setup.sh +7 -4
  52. package/search-scoring.mjs +13 -6
  53. package/server.mjs +58 -9
  54. package/source-files.mjs +5 -0
  55. package/tool-schemas.mjs +14 -1
  56. package/utils.mjs +13 -1
@@ -9,7 +9,7 @@
9
9
  "plugins": [
10
10
  {
11
11
  "name": "claude-mem-lite",
12
- "version": "6.20.0",
12
+ "version": "6.22.0",
13
13
  "source": "./",
14
14
  "homepage": "https://github.com/sdsrss/claude-mem-lite",
15
15
  "description": "Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. FTS5 BM25 keyword search with episode batching. Single SQLite DB, no external services. A lighter, lower-cost alternative to claude-mem (episode batching + a smaller model; cost savings are an internal estimate, not a measured benchmark)."
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-mem-lite",
3
- "version": "6.20.0",
3
+ "version": "6.22.0",
4
4
  "description": "Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. FTS5 BM25 keyword search with episode batching. Single SQLite DB, no external services. A lighter, lower-cost alternative to claude-mem (episode batching + a smaller model; cost savings are an internal estimate, not a measured benchmark).",
5
5
  "author": {
6
6
  "name": "sdsrss"
package/README.md CHANGED
@@ -88,7 +88,7 @@ How claude-mem-lite differs from the major neighbors in the LLM-memory space (ve
88
88
  - **Observation relations** -- Bidirectional links between related observations based on file overlap
89
89
  - **User prompt capture** -- Records user prompts via UserPromptSubmit hook for intent tracking
90
90
  - **Read file tracking** -- Tracks files read during sessions for richer episode context
91
- - **Zero data loss** -- If LLM fails, observations are saved with degraded (inferred) metadata instead of being discarded
91
+ - **Degraded fallback when the LLM fails** -- An episode the deterministic rules already rate notable (an error fixed, a config or schema file changed) is saved with inferred metadata instead of being discarded. A routine edit the rules rate as noise (`Modified a.js, b.js` with no lesson) is dropped — as it is when the model answers without a lesson — so a failing provider loses those episodes; `claude-mem-lite doctor` warns when the `claude` CLI it would call does not resolve
92
92
  - **Two-tier dedup** -- Jaccard similarity (5-minute window) + MinHash signatures (7-day cross-session window) prevent duplicates
93
93
  - **Synonym expansion** -- Abbreviations like `K8s`, `DB`, `auth` automatically expand to full forms in FTS5 search (100+ pairs including CJK↔EN cross-language mappings)
94
94
  - **CJK synonym extraction** -- Unsegmented Chinese text is scanned for known vocabulary words (数据库→database, 搜索→search, etc.) enabling cross-language memory recall
@@ -167,9 +167,9 @@ Plugin mode manages its own hooks/runtime. On session start it only **checks and
167
167
 
168
168
  > **The plugin install is complete on its own** — hooks, MCP tools, and the bundled slash commands (`/mem`, `/lesson`, `/bug`, `/adopt`) all run from the plugin with no second step. The slash commands invoke the bundled CLI by an absolute path resolved from the plugin directory (`node "${CLAUDE_PLUGIN_ROOT}/cli.mjs" <cmd>`), so they work without anything on your `PATH`. A global `claude-mem-lite` **shell** command (for running queries yourself in a terminal) is **optional** — `npm i -g claude-mem-lite` — and is a *separate* npm install: the plugin's auto-update does **not** refresh it, so re-run `npm i -g claude-mem-lite@latest` if you want that shell command kept in sync. You do **not** need it for the plugin to be fully functional.
169
169
 
170
- > **Auto-adopt no longer adds its block to your project's `CLAUDE.md` (next release after 6.19.4).** On every SessionStart the plugin delivers its steering text — the trigger table that boosts Claude's proactive use of `mem_recall` / `mem_save`. In a git repository that does not already carry the block it keeps a managed block in `CLAUDE.local.md` at the repository root (Claude Code loads that file like `CLAUDE.md`, subagents included) and adds the file to the repository's `.git/info/exclude` unless your ignore rules already cover it, so git does not list or commit it; you get a **one-time notice** the first time it is written. Claude Code reads instruction files before the plugin's startup hook runs, so the session that creates the file gets the text added to its context instead, once (its subagents do not see it). Outside git, in a repository rooted at `$HOME`, where `CLAUDE.local.md` is tracked or a symbolic link, or where the repository root is an npm package that `npm publish` would ship it with (no `"private": true`, no `files` list leaving it out, and without one no `.npmignore` naming it), nothing is written and the text is **injected** into each session's context, with a one-time notice suggesting `/adopt` (not at `$HOME`). The detail file the block points at lives in the plugin's data directory, named with a `~/` path. `.git/info/exclude` is read by git only: docker build contexts, archives and other packagers can pick `CLAUDE.local.md` up (a publishable npm package root does not keep it: a block written before the directory became a package is taken out at the next session start). Earlier versions added the block to your project's own `<cwd>/CLAUDE.md` (a file that is normally committed) plus a `<cwd>/.claude/plugin_claude_mem_lite.md` detail file, unasked, in every project you opened; those projects keep the block, and the first session of this version refreshes it because the text changed — to move one to the local file, run `claude-mem-lite unadopt` there and commit the removal. Why not inject everywhere: in our sandbox evaluation (one project, Claude Opus 5.5) the agent made 1.5 proactive memory saves per 8-session run with injected steering against 5.25 with the block in `CLAUDE.local.md` or `CLAUDE.md`, and subagents never saw injected text. It applies regardless of install path (npm, npx, `/plugin`, manual); silence both notices with `MEM_NO_ADOPT_HINT=1`.
170
+ > **Auto-adopt no longer adds its block to your project's `CLAUDE.md` (next release after 6.19.4).** On every SessionStart the plugin delivers its steering text — the trigger table that boosts Claude's proactive use of `mem_recall` / `mem_save`. In a git repository that does not already carry the block it keeps a managed block in `CLAUDE.local.md` at the repository root (Claude Code loads that file like `CLAUDE.md`, also in subagents that load project instructions; the built-in Explore and Plan agents load none) and adds the file to the repository's `.git/info/exclude` unless your ignore rules already cover it, so git does not list or commit it; you get a **one-time notice** the first time it is written. Claude Code reads instruction files before the plugin's startup hook runs, so the session that creates the file gets the text added to its context instead, once (its subagents do not see it). Where Claude Code reads an `AGENTS.md` as the project's instructions, it stops reading it once a `CLAUDE.md` or `CLAUDE.local.md` exists in the session's directory or above, so there nothing is written and the text is **injected** (subagents do not see it), with a one-time notice that names that `AGENTS.md`. With `CLAUDE_MEM_RULES_STEERING=1` the block goes to `.claude/rules/claude-mem-lite.md` at the repository root instead — excluded from git the same way, loaded by Claude Code as project instructions, also in subagents that load project instructions, and it leaves `AGENTS.md` loading — with its own one-time notice; it is not the default because in a pre-registered A/B it did not beat injection by the bar set in advance (`docs/audits/20261006-d212-ab.md`). Outside git, in a repository rooted at `$HOME`, where `CLAUDE.local.md` is tracked or a symbolic link, or where the repository root is an npm package that `npm publish` would ship it with (no `"private": true`, no `files` list leaving it out, and without one no `.npmignore` naming it), nothing is written and the text is **injected** into each session's context, with a one-time notice suggesting `/adopt` (not at `$HOME`). With the variable set, the same holds where the rules file cannot be written (a symbolic link on its path, a tracked or foreign file of that name, an npm package that would ship it). The notice beside an `AGENTS.md` names it, why there is no file, and the ways to a file that keep it loading, each only where it works: Project instructions = `claude-md-and-agents-md` in `/config`, after which `CLAUDE.local.md` is written (not where `CLAUDE.local.md` is refused too: a package root, or a file you removed), and `/adopt`, whose `CLAUDE.md` imports the `AGENTS.md` beside it (not offered when an `AGENTS.md` above that directory or in a subdirectory would stop loading). The detail file the block points at lives in the plugin's data directory, named with a `~/` path. `.git/info/exclude` is read by git only: docker build contexts, archives and other packagers can pick `CLAUDE.local.md` or the rules file up (a publishable npm package root does not keep `CLAUDE.local.md`: a block written before is taken out at the next session start; in a project whose `AGENTS.md` it would switch off, the block comes out and is injected, or, with `CLAUDE_MEM_RULES_STEERING=1`, moves to the rules file where that can be written). Earlier versions added the block to your project's own `<cwd>/CLAUDE.md` (a file that is normally committed) plus a `<cwd>/.claude/plugin_claude_mem_lite.md` detail file, unasked, in every project you opened; those projects keep the block, and the first session of this version refreshes it because the text changed — to move one to the local file, run `claude-mem-lite unadopt` there and commit the removal. Why not inject everywhere: in our sandbox evaluation (one project, Claude Opus 5.5) the agent made 1.5 proactive memory saves per 8-session run with injected steering against 5.25 with the block in `CLAUDE.local.md` or `CLAUDE.md`, and subagents never saw injected text. It applies regardless of install path (npm, npx, `/plugin`, manual); silence these notices with `MEM_NO_ADOPT_HINT=1`.
171
171
  >
172
- > **Want the block in `CLAUDE.md` instead** (for example to share it with your team)? Run `claude-mem-lite adopt`: it writes the slug-scoped managed block into `<cwd>/CLAUDE.md` plus the detail file, preserving everything outside the block, and removes the `CLAUDE.local.md` copy. A project that carries the block is kept in sync on **every SessionStart** — refreshed when the shipped template changes — and gets no local or injected copy on top of it, also in sessions started from a subdirectory. A `CLAUDE.local.md` block the plugin created and you deleted (or `claude-mem-lite unadopt` removed) is not written back — the text is injected instead — until `claude-mem-lite adopt --enable`. Turn steering off per project with `claude-mem-lite adopt --disable` (it also removes the `CLAUDE.local.md` block; a `CLAUDE.md` block stays until `unadopt`; `--enable` re-arms) or globally with `export MEM_NO_AUTO_ADOPT=1` (blocks already written stay and keep loading until `unadopt`); freeze the blocks against template refreshes with `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1`. `claude-mem-lite unadopt` removes the `CLAUDE.md` block, the detail file, and the `CLAUDE.local.md` block with its exclude entry.
172
+ > **Want the block in `CLAUDE.md` instead** (for example to share it with your team)? Run `claude-mem-lite adopt`: it writes the slug-scoped managed block into `<cwd>/CLAUDE.md` plus the detail file, preserving everything outside the block, and removes the auto-written local copy (`CLAUDE.local.md` or the rules file). Claude Code stops reading `AGENTS.md` once a `CLAUDE.md` exists, so a `CLAUDE.md` that adopt creates next to an `AGENTS.md` (or `.claude/AGENTS.md`) starts by importing it (`@AGENTS.md`, behind a marker comment Claude Code does not load), and that file keeps loading; an `AGENTS.md` above the directory or tracked below it cannot be imported that way and is named in adopt's output, with the setting that keeps it (Project instructions = `claude-md-and-agents-md`). Nothing is imported where a `CLAUDE.md` of yours already exists, since `AGENTS.md` was not being read there. `unadopt` deletes a `CLAUDE.md` that holds nothing but those lines and the block. A project that carries the block is kept in sync on **every SessionStart** — refreshed when the shipped template changes — and gets no local or injected copy on top of it, also in sessions started from a subdirectory. A `CLAUDE.md` holding nothing but the block (what an earlier version's auto-adopt wrote) gets the same `AGENTS.md` import at the next session started in its directory, with a one-time notice. Seen from a session started in a subdirectory, the import points outside the working directory, so Claude Code asks once to approve it. A local block (`CLAUDE.local.md` or the rules file) the plugin created and you deleted (or `claude-mem-lite unadopt` removed) is not written back — the text is injected instead — until `claude-mem-lite adopt --enable` (beside an `AGENTS.md` that `CLAUDE.local.md` would switch off, a file comes back only with `CLAUDE_MEM_RULES_STEERING=1` too). Turn steering off per project with `claude-mem-lite adopt --disable` (it also removes the local block; a `CLAUDE.md` block stays until `unadopt`; `--enable` re-arms) or globally with `export MEM_NO_AUTO_ADOPT=1` (blocks already written stay and keep loading until `unadopt`); freeze the blocks against template refreshes with `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1`. `claude-mem-lite unadopt` removes the `CLAUDE.md` block, the detail file, and the local block (`CLAUDE.local.md` or `.claude/rules/claude-mem-lite.md`) with its exclude entry.
173
173
 
174
174
  ### Method 2: npx (one-liner)
175
175
 
@@ -237,6 +237,35 @@ rm -rf ~/claude-mem-lite/ # pre-v0.5 unhidden (if not auto-moved)
237
237
  repos/ # Shallow-cloned source repos
238
238
  ```
239
239
 
240
+ ## Upgrading to 6.21.0
241
+
242
+ **Projects whose names are not plain ASCII get a new id, and what they stored moves once.** No
243
+ schema-version change: 6.20.0 still opens the database after this release has. Pin
244
+ `claude-mem-lite@6.20.0` before upgrading to avoid the move; after it, 6.20.0 names these
245
+ directories by their old ids again, so their moved rows are listed only with
246
+ `--project <new id>`.
247
+
248
+ - **Which projects.** Every character outside ASCII letters, digits and `_.-` used to become `-`,
249
+ so `~/projects/博客` and `~/projects/商城` were both `projects----` and shared one memory.
250
+ Letters, marks and digits of every script are now kept (`projects--博客`). An id whose parent
251
+ and directory names are both plain ASCII keeps its id byte for byte; a name with letters,
252
+ marks or digits of another script, or with a character outside the Basic Multilingual Plane
253
+ such as `🚀`, changes id.
254
+ - **At a project's first session start its data moves.** When no stored file path shows another
255
+ directory using the old id, the project takes everything under it, deferred items and session
256
+ history included. Otherwise only the memories whose file paths lie inside the directory move;
257
+ the rest stay under the old id. A one-time notice says what moved and how to list what stayed
258
+ (`claude-mem-lite recent 50 --project <old id>`).
259
+ - **Not in this release:** directories with the same parent and name in different repositories
260
+ (`~/a/packages/api` and `~/b/packages/api`) still share one id.
261
+ - **Also changed:** two sessions open in one project keep separate memory sessions (handoffs,
262
+ summaries and unsaved tool activity no longer mix); a session's follow-up prompts no longer
263
+ resume another session; maintenance hides idle memories for 7 days before queuing them for
264
+ deletion, in every project; an importance you set is no longer changed by reads, the access
265
+ boost or re-enrich; `recall` / `mem_recall` rank the current project and the exact path first
266
+ (`--project` / `project` keep one project); `<private>` fails closed on an unclosed, nested or
267
+ attributed tag. Full list: CHANGELOG.md.
268
+
240
269
  ## Upgrading to 6.19.0
241
270
 
242
271
  **Search output changes; no switch.** No schema change and no migration, so reverting is
@@ -548,7 +577,7 @@ claude-mem-lite adopt --status # list adopted/disabled projects + current ga
548
577
  claude-mem-lite adopt --dry-run # preview without writing
549
578
  claude-mem-lite adopt --disable # opt out of auto-adopt for current project (writes .mem-no-auto-adopt sentinel)
550
579
  claude-mem-lite adopt --enable # re-arm auto-adopt for current project (deletes the sentinel)
551
- claude-mem-lite unadopt # remove the CLAUDE.md block + doc, and the CLAUDE.local.md block (not written again)
580
+ claude-mem-lite unadopt # remove the CLAUDE.md block + doc, and the local block (CLAUDE.local.md or .claude/rules/; not written again)
552
581
  ```
553
582
 
554
583
  Slash commands `/adopt` and `/unadopt` wrap the same CLI.
@@ -580,8 +609,10 @@ Slash commands `/adopt` and `/unadopt` wrap the same CLI.
580
609
  `/exit` + fresh session is enough. Same caveat applies to `unadopt`.
581
610
 
582
611
  **Safety:**
583
- - Hash-guarded: editing the managed-block body yourself blocks automatic
584
- rewrites unless you pass `--force`.
612
+ - Regenerated, not hand-edit-safe: `adopt` rewrites the managed block to the shipped
613
+ template, and so does every SessionStart whenever the block differs from it — hand edits
614
+ included. Keep your own notes outside the `claude-mem-lite:begin…end` markers, or set
615
+ `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1` to freeze the block.
585
616
  - Slug-scoped & dedup-guarded: only the `claude-mem-lite:begin…end` region is
586
617
  ever rewritten, and duplicate / CRLF-orphaned copies are collapsed to one.
587
618
  Unlike the legacy `MEMORY.md` scheme there is no line-budget gate — `CLAUDE.md`
@@ -589,12 +620,17 @@ Slash commands `/adopt` and `/unadopt` wrap the same CLI.
589
620
  - **Auto-adopt runs on EVERY SessionStart, for any install path, and no longer adds
590
621
  the block to `CLAUDE.md` (next release after 6.19.4).** A git project without the
591
622
  block gets it in `CLAUDE.local.md` at the git root (kept out of git via
592
- `.git/info/exclude`), or in SessionStart context outside git; a project that
623
+ `.git/info/exclude`), or in SessionStart context where `CLAUDE.local.md` would stop
624
+ Claude Code reading the project's `AGENTS.md` (in `.claude/rules/claude-mem-lite.md`
625
+ with `CLAUDE_MEM_RULES_STEERING=1`), outside git, and where no file can be written; a project that
593
626
  carries the `CLAUDE.md` block (explicit `adopt`, or an older version's auto-adopt)
594
627
  has it kept in sync — refreshed when the shipped template changes (freeze with
595
628
  `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1`) — and gets no local or injected copy, also in
596
- sessions started from a subdirectory. A `CLAUDE.local.md` block the plugin created
597
- and you (or `unadopt`) removed is not written back; `adopt --enable` re-arms it.
629
+ sessions started from a subdirectory; a `CLAUDE.md` holding only the block also gets
630
+ adopt's `AGENTS.md` import when an `AGENTS.md` is beside it. A local block (`CLAUDE.local.md` or
631
+ the rules file) the plugin created and you (or `unadopt`) removed is not written back;
632
+ `adopt --enable` re-arms it (beside such an `AGENTS.md`, together with
633
+ `CLAUDE_MEM_RULES_STEERING=1`).
598
634
  Per-project opt-out: `claude-mem-lite adopt --disable` (writes a durable
599
635
  `<memdir>/.mem-no-auto-adopt` sentinel that survives marker deletion / plugin
600
636
  reinstalls; run at the repository root it also covers sessions started in its
@@ -708,7 +744,7 @@ Episodes are batched related operations (edits to the same file group) that get
708
744
  Episode buffer -> Flush to JSON -> claude -p --model haiku -> Structured observation -> SQLite
709
745
  ```
710
746
 
711
- Each observation includes type, title, narrative, concepts, facts, importance (1-3), and is automatically deduplicated via two tiers: Jaccard similarity (>70% within 5 minutes) and MinHash signatures (>80% within 7 days across sessions). If the LLM call fails, a degraded observation is saved with inferred metadata (zero data loss). Related observations are linked via `related_ids` based on FTS5 title similarity and file overlap.
747
+ Each observation includes type, title, narrative, concepts, facts, importance (1-3), and is automatically deduplicated via two tiers: Jaccard similarity (>70% within 5 minutes) and MinHash signatures (>80% within 7 days across sessions). If the LLM call fails, an episode the rules rate notable is saved with inferred metadata; a routine edit the rules rate as noise is dropped. Related observations are linked via `related_ids` based on FTS5 title similarity and file overlap.
712
748
 
713
749
  ## Management Commands
714
750
 
@@ -1025,8 +1061,8 @@ claude-mem-lite.
1025
1061
  | `CLAUDE_MEM_BASH_RECALL` | File recall before a Bash command that views (`cat`, `sed -n`, `head`…) or writes (`sed -i`, `cat > f`, a python patch…) a file, like the Read / Edit recall. A bash prefilter keeps Node from starting for other commands. `off` disables this leg only. | _(on)_ |
1026
1062
  | `CLAUDE_MEM_LESSON_GROUNDING` | An auto-captured event keeps its lesson only when the lesson quotes the window's own diagnosis (a failing output line, a comment the edit added, or the commit message); otherwise the row is kept without it at importance 1, below every injection face. `off` keeps unquoted lessons. | _(on)_ |
1027
1063
  | `CLAUDE_MEM_LESSON_OUTPUT_CAP` | An auto-captured lesson that shares four consecutive words with TOOL OUTPUT (a command's printed text or a tool's response, which whoever controls that output can write) is kept off the injection faces: an event keeps its row and lesson, searchable, at importance 1; a `change` observation, whose importance later reads can raise, loses the lesson, and the lesson-less row is then dropped like any other (kept only with `CLAUDE_MEM_KEEP_LOW_SIGNAL=1`). Four shared words of filler ("is not in the") count too, so a lesson quoting your own comment or commit message is demoted when it also happens to share such a run with output in the same window. The row's title is not checked. `off` restores the model's importance and the lesson. | _(on)_ |
1028
- | `MEM_NO_AUTO_ADOPT` | Global opt-out for auto-adopt (v2.82.0+). `1` stops auto-adopt across **all** projects — no injected steering, no new `CLAUDE.local.md`, and no sync of an existing `CLAUDE.md` or `CLAUDE.local.md` block (those stay, and keep loading, until `claude-mem-lite unadopt`). For per-project opt-out use `claude-mem-lite adopt --disable` instead (writes a durable `<memdir>/.mem-no-auto-adopt` sentinel that survives marker deletion). | _(disabled)_ |
1029
- | `MEM_NO_ADOPT_HINT` | Silences the one-time notices shown to you the first time a project gets `CLAUDE.local.md` or is steered by injection (the latter suggests `/adopt`, except at `$HOME`), and the one-line "Invited-memory 未启用:`claude-mem-lite adopt`…" hint that SessionStart appends when the current project hasn't been adopted. Since v2.82.1 auto-adopt runs on every SessionStart for any install path, so this hint typically surfaces only when you've explicitly opted out (`MEM_NO_AUTO_ADOPT=1` or `claude-mem-lite adopt --disable`). | _(disabled)_ |
1064
+ | `MEM_NO_AUTO_ADOPT` | Global opt-out for auto-adopt (v2.82.0+). `1` stops auto-adopt across **all** projects — no injected steering, no new local file (`CLAUDE.local.md` or `.claude/rules/claude-mem-lite.md`), and no sync of an existing `CLAUDE.md` or local block (those stay, and keep loading, until `claude-mem-lite unadopt`). For per-project opt-out use `claude-mem-lite adopt --disable` instead (writes a durable `<memdir>/.mem-no-auto-adopt` sentinel that survives marker deletion). | _(disabled)_ |
1065
+ | `MEM_NO_ADOPT_HINT` | Silences the one-time notices shown to you the first time a project gets `CLAUDE.local.md` or is steered by injection (the latter suggests `/adopt`, except at `$HOME`; in a project whose `AGENTS.md` the file would switch off it names that file and the setting too), the one-time notice that the guidance went to `.claude/rules/claude-mem-lite.md`, the one-time notice that SessionStart imported `AGENTS.md` into a `CLAUDE.md` holding only the block, and the one-line "Invited-memory 未启用:`claude-mem-lite adopt`…" hint that SessionStart appends when the current project hasn't been adopted. Since v2.82.1 auto-adopt runs on every SessionStart for any install path, so this hint typically surfaces only when you've explicitly opted out (`MEM_NO_AUTO_ADOPT=1` or `claude-mem-lite adopt --disable`). | _(disabled)_ |
1030
1066
 
1031
1067
  ### What gets injected into your context
1032
1068
 
@@ -1040,6 +1076,7 @@ claude-mem-lite.
1040
1076
  | `CLAUDE_MEM_PRETOOL_NUDGE` | `1` extends the pre-tool recall nudge from `Read` to other tools. | _(Read only)_ |
1041
1077
  | `CLAUDE_MEM_KEEP_LOW_SIGNAL` | `1` keeps low-signal observations that the deterministic filter would otherwise drop before dedup/vector work. | _(filtered)_ |
1042
1078
  | `CLAUDE_MEM_NO_TEMPLATE_REFRESH` | `1` stops SessionStart from refreshing the adopted `CLAUDE.md` managed block when the shipped template changes. | _(refreshes)_ |
1079
+ | `CLAUDE_MEM_RULES_STEERING` | `1` makes auto-adopt write its block to `.claude/rules/claude-mem-lite.md` (git-excluded) where `CLAUDE.local.md` would stop Claude Code reading the project's `AGENTS.md`, instead of injecting it; the file reaches subagents and leaves `AGENTS.md` loading. A file written while it was on stays the channel. Off by default: a pre-registered A/B showed no gain over injection that cleared the bar (`docs/audits/20261006-d212-ab.md`). | _(inject)_ |
1043
1080
  | `MEM_QUIET_HOOKS` | See Core above — the broadest injection-volume switch. | _(disabled)_ |
1044
1081
 
1045
1082
 
package/README.zh-CN.md CHANGED
@@ -67,7 +67,7 @@
67
67
  - **观察关联** -- 基于文件重叠自动建立观察之间的双向链接
68
68
  - **用户提示捕获** -- 通过 UserPromptSubmit 钩子记录用户提示,追踪用户意图
69
69
  - **Read 文件追踪** -- 追踪会话中读取的文件,丰富 episode 上下文
70
- - **零数据丢失** -- LLM 失败时,使用推断的元数据保存降级记录,而非丢弃
70
+ - **LLM 失败时的降级保存** -- 规则已判定为有价值的 episode(修掉了报错、改了配置或 schema 文件)用推断的元数据保存,而非丢弃;规则判为噪声的日常编辑(`Modified a.js, b.js` 且没有 lesson)会被丢掉——模型成功但没给 lesson 时也一样——所以 LLM 不可用期间这类 episode 会丢失。`claude-mem-lite doctor` 会在要调用的 `claude` CLI 不存在时告警
71
71
  - **两级去重** -- Jaccard 相似度(5 分钟窗口)+ MinHash 签名(7 天跨会话窗口)双重防重
72
72
  - **同义词扩展** -- 缩写如 `K8s`、`DB`、`auth` 在 FTS5 搜索时自动扩展为全称(48+ 对)
73
73
  - **伪相关反馈(PRF)** -- 首轮结果作为种子扩展查询,提升召回率
@@ -154,9 +154,9 @@ node install.mjs install
154
154
  1. **安装依赖** -- `npm install --omit=dev`(编译原生 `better-sqlite3`)
155
155
  2. **注册 MCP 服务器** -- `mem-lite` 服务器,包含 18 个工具(9 个核心通过 `tools/list` 暴露 + 9 个隐藏但可调;完整表见 Usage 段)。v2.78 前服务器名为通用的 `mem`,现已改名为 `mem-lite` 避免与用户其它 `.mcp.json` 冲突;工具名(`mem_search`/`mem_recall` 等)保持不变。
156
156
 
157
- > **自动 adopt 不再把托管块加进你项目的 `CLAUDE.md`(6.19.4 之后的下一个版本起)。** 每次 SessionStart,插件都会送达引导文本(提升 Claude 主动调用 `mem_recall` / `mem_save` 的触发表)。在还没有托管块的 git 仓库里,它把托管块写进仓库根目录的 `CLAUDE.local.md`(Claude Code 像加载 `CLAUDE.md` 一样加载它,子代理也能看到),并把这个文件加进仓库的 `.git/info/exclude`(你的 ignore 规则已覆盖时不加),所以 git 不列出、也不提交它;第一次写入时你会看到一条**一次性提示**。Claude Code 在插件的启动钩子运行之前就读取了指令文件,所以创建这个文件的那个会话改为在上下文里注入一次引导(该会话的子代理看不到)。不在 git 仓库里、仓库根是 `$HOME`、`CLAUDE.local.md` 已被 git 跟踪或是符号链接,或者仓库根是一个 `npm publish` 会把它带上的 npm 包(没有 `"private": true`,没有把它排除在外的 `files` 列表,没有 `files` 列表时也没有列出它的 `.npmignore`)时,什么都不写,改为每个会话把引导**注入**上下文,并一次性提示可以运行 `/adopt`(在 `$HOME` 下不提示)。托管块指向的详情文件放在插件自己的数据目录,以 `~/` 路径书写。`.git/info/exclude` 只对 git 生效:docker 构建上下文、归档和其他打包工具都可能把 `CLAUDE.local.md` 打进去(可发布的 npm 包根目录不会保留这个文件:目录变成 npm 包之前写入的托管块,会在下一次会话启动时移除)。旧版本会在你打开的每个项目里,未经询问就向项目自己的 `<cwd>/CLAUDE.md`(通常会进 git)写入托管块,外加 `<cwd>/.claude/plugin_claude_mem_lite.md` 详情文件;这些项目保留托管块,本版本的第一个会话会因为文本变化刷新它——想把某个项目迁到本地文件,在那里运行 `claude-mem-lite unadopt` 并提交这次删除。为什么不全部改成注入:沙箱实测中(一个项目,Claude Opus 5.5),8 个会话里模型主动记录的次数,注入时平均 1.5 次,写在 `CLAUDE.local.md` 或 `CLAUDE.md` 时 5.25 次;而且子代理完全看不到注入的文本。**任何安装路径都生效**(npm、npx、`/plugin`、手动);两条提示都可以用 `MEM_NO_ADOPT_HINT=1` 关闭。
157
+ > **自动 adopt 不再把托管块加进你项目的 `CLAUDE.md`(6.19.4 之后的下一个版本起)。** 每次 SessionStart,插件都会送达引导文本(提升 Claude 主动调用 `mem_recall` / `mem_save` 的触发表)。在还没有托管块的 git 仓库里,它把托管块写进仓库根目录的 `CLAUDE.local.md`(Claude Code 像加载 `CLAUDE.md` 一样加载它,加载项目指令的子代理也能看到;内置的 Explore 和 Plan 子代理不加载这类文件),并把这个文件加进仓库的 `.git/info/exclude`(你的 ignore 规则已覆盖时不加),所以 git 不列出、也不提交它;第一次写入时你会看到一条**一次性提示**。Claude Code 在插件的启动钩子运行之前就读取了指令文件,所以创建这个文件的那个会话改为在上下文里注入一次引导(该会话的子代理看不到)。Claude Code 把某个 `AGENTS.md` 当作项目指令读取时,会话目录或上层只要有 `CLAUDE.md` 或 `CLAUDE.local.md` 它就不再读 `AGENTS.md`,所以在这种仓库里什么都不写,改为**注入**引导(子代理看不到),并给一条点名那个 `AGENTS.md` 的一次性提示。设了 `CLAUDE_MEM_RULES_STEERING=1` 时,托管块改写进仓库根目录的 `.claude/rules/claude-mem-lite.md`:同样经 `.git/info/exclude` 排除在 git 之外,Claude Code 把它当作项目指令加载(加载项目指令的子代理也能看到),而且不会让 `AGENTS.md` 失效;第一次写入时有单独的一次性提示。它不是默认做法,因为在预先登记的 A/B 里它没有达到事先定下的、胜过注入的标准(`docs/audits/20261006-d212-ab.md`)。不在 git 仓库里、仓库根是 `$HOME`、`CLAUDE.local.md` 已被 git 跟踪或是符号链接,或者仓库根是一个 `npm publish` 会把它带上的 npm 包(没有 `"private": true`,没有把它排除在外的 `files` 列表,没有 `files` 列表时也没有列出它的 `.npmignore`)时,什么都不写,改为每个会话把引导**注入**上下文,并一次性提示可以运行 `/adopt`(在 `$HOME` 下不提示)。设了这个变量但 rules 文件写不了时(路径上有符号链接、同名文件被跟踪或是你自己的文件、npm 包会把它带上)同样改为注入。`AGENTS.md` 旁边的提示会说明是哪个 `AGENTS.md`、为什么没有文件,并只给出在这里行得通的、保留 `AGENTS.md` 又能写文件的做法:在 `/config` 里把 Project instructions 设为 `claude-md-and-agents-md`,之后就会写 `CLAUDE.local.md`(`CLAUDE.local.md` 也会被拒写时不提,比如 npm 包根,或你删过的文件);运行 `/adopt`,它写的 `CLAUDE.md` 会导入同目录的 `AGENTS.md`(上层目录或子目录里的 `AGENTS.md` 会因此失效时不提)。托管块指向的详情文件放在插件自己的数据目录,以 `~/` 路径书写。`.git/info/exclude` 只对 git 生效:docker 构建上下文、归档和其他打包工具都可能把 `CLAUDE.local.md` 打进去(rules 文件同样如此;可发布的 npm 包根目录不会保留 `CLAUDE.local.md`:之前写入的托管块会在下一次会话启动时移除;在这个文件会让 `AGENTS.md` 失效的项目里,托管块会被移除、改为注入;设了 `CLAUDE_MEM_RULES_STEERING=1` 时,在写得了的情况下移到 rules 文件)。旧版本会在你打开的每个项目里,未经询问就向项目自己的 `<cwd>/CLAUDE.md`(通常会进 git)写入托管块,外加 `<cwd>/.claude/plugin_claude_mem_lite.md` 详情文件;这些项目保留托管块,本版本的第一个会话会因为文本变化刷新它——想把某个项目迁到本地文件,在那里运行 `claude-mem-lite unadopt` 并提交这次删除。为什么不全部改成注入:沙箱实测中(一个项目,Claude Opus 5.5),8 个会话里模型主动记录的次数,注入时平均 1.5 次,写在 `CLAUDE.local.md` 或 `CLAUDE.md` 时 5.25 次;而且子代理完全看不到注入的文本。**任何安装路径都生效**(npm、npx、`/plugin`、手动);这些提示都可以用 `MEM_NO_ADOPT_HINT=1` 关闭。
158
158
  >
159
- > **想把托管块改写进 `CLAUDE.md`**(例如与团队共享)?运行 `claude-mem-lite adopt`:它向 `<cwd>/CLAUDE.md` 写入 slug 限定的托管块和详情文件,块以外的内容逐字保留,并删除 `CLAUDE.local.md` 里的那份。带托管块的项目在**每次 SessionStart** 都会同步,出货模板变了会刷新,且不会再叠加本地副本或注入,从子目录启动的会话也一样。插件创建过、又被你删掉(或被 `claude-mem-lite unadopt` 删掉)的 `CLAUDE.local.md` 托管块不会被写回,改为注入,直到运行 `claude-mem-lite adopt --enable`。关闭方式:项目级 `claude-mem-lite adopt --disable`(同时删除 `CLAUDE.local.md` 托管块;`CLAUDE.md` 托管块保留到 `unadopt`;重新启用用 `--enable`);全局 `export MEM_NO_AUTO_ADOPT=1`(已写入的托管块保留并继续加载,直到 `unadopt`);只冻结模板刷新用 `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1`。`claude-mem-lite unadopt` 会移除 `CLAUDE.md` 托管块、详情文件,以及 `CLAUDE.local.md` 托管块和它的 exclude 条目。
159
+ > **想把托管块改写进 `CLAUDE.md`**(例如与团队共享)?运行 `claude-mem-lite adopt`:它向 `<cwd>/CLAUDE.md` 写入 slug 限定的托管块和详情文件,块以外的内容逐字保留,并删除自动写入的那份本地副本(`CLAUDE.local.md` 或 rules 文件)。`CLAUDE.md` 一存在,Claude Code 就不再读 `AGENTS.md`,所以 adopt 在 `AGENTS.md`(或 `.claude/AGENTS.md`)旁边新建 `CLAUDE.md` 时,会在文件开头导入它(`@AGENTS.md`,前面一行是 Claude Code 不加载的标记注释),`AGENTS.md` 因此继续加载;上层目录里的、或 git 跟踪在子目录里的 `AGENTS.md` 不能这样导入,adopt 会在输出里列出它们,并给出保留它们的设置(Project instructions 设为 `claude-md-and-agents-md`)。已经有你自己的 `CLAUDE.md` 时不导入,因为那里本来就不读 `AGENTS.md`。`unadopt` 会删除只剩这些行和托管块的 `CLAUDE.md`。带托管块的项目在**每次 SessionStart** 都会同步,出货模板变了会刷新,且不会再叠加本地副本或注入,从子目录启动的会话也一样。只有托管块的 `CLAUDE.md`(旧版本自动 adopt 写的)会在下一次从它所在目录启动的会话里补上同样的 `AGENTS.md` 导入,并给一次性提示。从子目录启动的会话看来,这个导入指向工作目录之外,Claude Code 会请你批准一次。插件创建过、又被你删掉(或被 `claude-mem-lite unadopt` 删掉)的本地托管块(`CLAUDE.local.md` 或 rules 文件)不会被写回,改为注入,直到运行 `claude-mem-lite adopt --enable`(在 `CLAUDE.local.md` 会让 `AGENTS.md` 失效的仓库里,还要设 `CLAUDE_MEM_RULES_STEERING=1` 才会再写文件)。关闭方式:项目级 `claude-mem-lite adopt --disable`(同时删除本地托管块;`CLAUDE.md` 托管块保留到 `unadopt`;重新启用用 `--enable`);全局 `export MEM_NO_AUTO_ADOPT=1`(已写入的托管块保留并继续加载,直到 `unadopt`);只冻结模板刷新用 `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1`。`claude-mem-lite unadopt` 会移除 `CLAUDE.md` 托管块、详情文件,以及本地托管块(`CLAUDE.local.md` 或 `.claude/rules/claude-mem-lite.md`)和它的 exclude 条目。
160
160
  3. **配置钩子** -- 全部七个生命周期事件:`SessionStart`、`PreCompact`、`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`Stop`、`UserPromptSubmit`
161
161
  4. **创建数据目录** -- `~/.claude-mem-lite/`(隐藏目录),存放数据库与运行时文件
162
162
  5. **自动迁移** -- 自动检测 `~/.claude-mem/`(原版 claude-mem)或 `~/claude-mem-lite/`(v0.5 前的非隐藏目录),将数据库和运行时文件迁移到 `~/.claude-mem-lite/`,原目录保持不变
@@ -199,6 +199,27 @@ rm -rf ~/claude-mem-lite/ # v0.5 前的非隐藏目录(如未自动迁移)
199
199
  repos/ # 浅克隆的源代码仓库
200
200
  ```
201
201
 
202
+ ## 升级到 6.21.0
203
+
204
+ **名字不是纯 ASCII 的项目会换一个新标识,它们存下的内容会搬一次。** 没有 schema 版本变更:
205
+ 本版本打开过的数据库,6.20.0 仍能打开。想避免搬迁,请在**升级之前**固定 `claude-mem-lite@6.20.0`;
206
+ 升级之后再回退,6.20.0 会按旧标识称呼这些目录,搬走的行只能用 `--project <新标识>` 列出。
207
+
208
+ - **哪些项目。** 以前 ASCII 字母、数字和 `_.-` 以外的字符都变成 `-`,所以 `~/projects/博客` 和
209
+ `~/projects/商城` 都是 `projects----`,共用一份记忆。现在任何文字的字母、组合符和数字都会保留
210
+ (`projects--博客`)。父目录名和目录名都是纯 ASCII 的,标识逐字节不变;名字里有其他文字的字母、
211
+ 组合符或数字,或有基本多文种平面以外的字符(如 `🚀`)时,标识会变。
212
+ - **项目第一次启动会话时搬迁数据。** 如果旧标识下没有任何文件路径显示另一个同样使用该旧标识的目录,
213
+ 就把旧标识下的全部内容搬过来,包括待办和会话历史。否则只搬文件路径落在本目录里的记忆,其余留在
214
+ 旧标识下。会提示一次搬了什么,以及怎么列出留下的内容(`claude-mem-lite recent 50 --project <旧标识>`)。
215
+ - **本版本不包含:** 不同仓库里父目录和目录名都相同的目录(`~/a/packages/api` 与 `~/b/packages/api`)
216
+ 仍共用一个标识。
217
+ - **其他变化:** 同一项目同时开两个会话,各自的交接、摘要和未保存的工具记录不再混在一起;会话里的
218
+ 跟进提示不再续上别的会话;维护会先把闲置记忆隐藏 7 天,再排队删除,所有项目一致;你设置的 importance
219
+ 不再被读取、访问提升或 re-enrich 改动;`recall` / `mem_recall` 当前项目和完全匹配的路径排在前面
220
+ (`--project` / `project` 只看一个项目);`<private>` 在未闭合、嵌套或带属性时一律按私密处理。
221
+ 完整列表见 CHANGELOG.md。
222
+
202
223
  ## 升级到 6.19.0
203
224
 
204
225
  **搜索输出有变化,没有开关。** 没有 schema 变更、不需要迁移,回退只需固定 `claude-mem-lite@6.18.0`。
@@ -456,7 +477,7 @@ claude-mem-lite adopt --status # 列出已 adopt / 已禁用项目 + 当前
456
477
  claude-mem-lite adopt --dry-run # 只打印不写入
457
478
  claude-mem-lite adopt --disable # 当前项目关闭 auto-adopt(写 .mem-no-auto-adopt 哨兵)
458
479
  claude-mem-lite adopt --enable # 当前项目重新启用 auto-adopt(删哨兵)
459
- claude-mem-lite unadopt # 移除 CLAUDE.md 托管块和详情文档,以及 CLAUDE.local.md 托管块(之后不再写回)
480
+ claude-mem-lite unadopt # 移除 CLAUDE.md 托管块和详情文档,以及本地托管块(CLAUDE.local.md 或 .claude/rules/;之后不再写回)
460
481
  ```
461
482
 
462
483
  Slash 命令 `/adopt` 和 `/unadopt` 是上述 CLI 的包装。
@@ -479,16 +500,20 @@ Slash 命令 `/adopt` 和 `/unadopt` 是上述 CLI 的包装。
479
500
  同理。
480
501
 
481
502
  **安全性:**
482
- - Hash 守护:你手动改了 sentinel 段 → 下一次 adopt 报 `UserEditedError`,
483
- 除非显式 `--force`。
484
- - 预算门:MEMORY.md 已 >180 行时拒绝新增(避开 Claude Code 200 行截断)。
503
+ - 托管块会被重新生成,不保留手改:`adopt` 会把它改写成出货模板,每次 SessionStart
504
+ 只要它和模板不同也会改写——手动编辑的内容一样被覆盖。自己的笔记写在
505
+ `claude-mem-lite:begin…end` 标记之外,或设 `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1` 冻结。
506
+ - 按 slug 限定、去重:只改写 `claude-mem-lite:begin…end` 这一段,重复或 CRLF 残留的
507
+ 副本会合并成一份。旧的 `MEMORY.md` 方案才有行数预算,`CLAUDE.md` 没有截断上限。
485
508
  - **任何安装路径每次 SessionStart 都自动 adopt,且不再把托管块加进 `CLAUDE.md`(6.19.4
486
509
  之后的下一个版本起)。** 没有托管块的 git 项目,引导写进 git 根目录的 `CLAUDE.local.md`
487
- (经 `.git/info/exclude` 排除在 git 之外),不在 git 里时注入 SessionStart 上下文;带
510
+ (经 `.git/info/exclude` 排除在 git 之外);这个文件会让 Claude Code 不再读项目的 `AGENTS.md` 时
511
+ 注入 SessionStart 上下文(设 `CLAUDE_MEM_RULES_STEERING=1` 时改写进 `.claude/rules/claude-mem-lite.md`),
512
+ 不在 git 里、或文件写不了时也注入;带
488
513
  `CLAUDE.md` 托管块的项目(显式 adopt 或旧版本写入)保持同步,出货模板变化会刷新(用
489
514
  `CLAUDE_MEM_NO_TEMPLATE_REFRESH=1` 冻结),且不会再叠加本地副本或注入,从子目录启动的会话
490
- 也一样。插件创建过、又被你(或 `unadopt`)删掉的 `CLAUDE.local.md` 托管块不会被写回;
491
- `adopt --enable` 可重新启用。项目级关闭:`claude-mem-lite adopt --disable`(写
515
+ 也一样;只有托管块的 `CLAUDE.md` 旁边有 `AGENTS.md` 时,还会补上 adopt 的 `AGENTS.md` 导入。插件创建过、又被你(或 `unadopt`)删掉的本地托管块(`CLAUDE.local.md` 或 rules 文件)不会被写回;
516
+ `adopt --enable` 可重新启用(在这类 `AGENTS.md` 仓库里还要设 `CLAUDE_MEM_RULES_STEERING=1`)。项目级关闭:`claude-mem-lite adopt --disable`(写
492
517
  `<memdir>/.mem-no-auto-adopt` 哨兵,存活于 marker 删除 / 插件重装;在仓库根目录运行时,对从子目录启动的
493
518
  会话同样生效;并删除本地托管块)。全局关闭:`export MEM_NO_AUTO_ADOPT=1`(已写入的托管块保留,直到 `unadopt`)。
494
519
  - 保守 hook 层源码永不删——条件瘦身按"引导已送达"(有托管块或注入开启)做 runtime
@@ -579,7 +604,7 @@ Episode 是一批相关操作(对同一组文件的编辑),由后台 LLM w
579
604
  Episode 缓冲区 -> 刷新为 JSON -> claude -p --model haiku -> 结构化观察 -> SQLite
580
605
  ```
581
606
 
582
- 每条观察包含类型、标题、叙述、概念、事实和重要度(1-3),并通过两级机制自动去重:Jaccard 相似度(5 分钟内 >70%)和 MinHash 签名(7 天跨会话 >80%)。LLM 调用失败时,使用推断的元数据保存降级记录(零数据丢失)。相关观察通过 FTS5 标题相似度和文件重叠自动建立 `related_ids` 链接。
607
+ 每条观察包含类型、标题、叙述、概念、事实和重要度(1-3),并通过两级机制自动去重:Jaccard 相似度(5 分钟内 >70%)和 MinHash 签名(7 天跨会话 >80%)。LLM 调用失败时,规则判定有价值的 episode 用推断的元数据保存降级记录,规则判为噪声的日常编辑会被丢掉。相关观察通过 FTS5 标题相似度和文件重叠自动建立 `related_ids` 链接。
583
608
 
584
609
  ## 管理命令
585
610
 
@@ -788,8 +813,9 @@ npm run benchmark:gate # CI 门控:指标回退超过 5% 容差时失败
788
813
  | `CLAUDE_MEM_BASH_RECALL` | 在查看(`cat`、`sed -n`、`head`…)或写入(`sed -i`、`cat > f`、python 补丁…)文件的 Bash 命令执行前做文件召回,与 Read / Edit 召回相同。bash 预过滤让其他命令不启动 Node。设为 `off` 只关闭这一路。 | _(开启)_ |
789
814
  | `CLAUDE_MEM_LESSON_GROUNDING` | 自动捕获的 event 只有在教训引用了本窗口自己的诊断文字(失败输出行、编辑新增的注释或提交信息)时才保留教训;否则保留这一行但去掉教训,importance 降为 1,低于所有注入面的门槛。设为 `off` 保留未引用原文的教训。 | _(开启)_ |
790
815
  | `CLAUDE_MEM_LESSON_OUTPUT_CAP` | 自动捕获的教训如果和**工具输出**(命令打印的文字或工具返回的内容,能控制这段输出的人就能写它)有连续 4 个词相同,就不会进入注入面:event 保留这一行和教训、仍可搜索,importance 降为 1;`change` 类 observation 的 importance 之后会被读取次数抬高,所以改为去掉教训,没有教训的这一行随后会像其他同类行一样被丢弃(只有设了 `CLAUDE_MEM_KEEP_LOW_SIGNAL=1` 才保留)。连续 4 个虚词(例如 "is not in the")也算,所以引用你自己的注释或提交信息的教训,只要碰巧和同一窗口的输出共有这样一串词,也会被降级。这一行的标题不在检查范围内。设为 `off` 恢复模型给出的 importance 和教训。 | _(开启)_ |
791
- | `MEM_NO_AUTO_ADOPT` | auto-adopt 全局关闭开关(v2.82.0+)。设为 `1` 在**所有**项目停止自动 adopt——不注入引导文本、不新建 `CLAUDE.local.md`,也不同步已有的 `CLAUDE.md` 或 `CLAUDE.local.md` 托管块(这些托管块会保留并继续加载,直到 `claude-mem-lite unadopt`)。项目级关闭走 `claude-mem-lite adopt --disable`(写 `<memdir>/.mem-no-auto-adopt` 哨兵,存活于 marker 删除)。 | _(禁用)_ |
792
- | `MEM_NO_ADOPT_HINT` | 静音项目第一次得到 `CLAUDE.local.md`、或第一次以注入方式被引导时给你的一次性提示(后者建议运行 `/adopt`,在 `$HOME` 下除外),以及当前项目未 adopt 时 SessionStart 追加的那一行 "Invited-memory 未启用…" 提示。v2.82.1 起任何安装路径每次 SessionStart 都自动 adopt,所以该提示一般只在你显式 opt out(`MEM_NO_AUTO_ADOPT=1` 或 `claude-mem-lite adopt --disable`)的项目才会出现。 | _(禁用)_ |
816
+ | `MEM_NO_AUTO_ADOPT` | auto-adopt 全局关闭开关(v2.82.0+)。设为 `1` 在**所有**项目停止自动 adopt——不注入引导文本、不新建本地文件(`CLAUDE.local.md` 或 `.claude/rules/claude-mem-lite.md`),也不同步已有的 `CLAUDE.md` 或本地托管块(这些托管块会保留并继续加载,直到 `claude-mem-lite unadopt`)。项目级关闭走 `claude-mem-lite adopt --disable`(写 `<memdir>/.mem-no-auto-adopt` 哨兵,存活于 marker 删除)。 | _(禁用)_ |
817
+ | `MEM_NO_ADOPT_HINT` | 静音项目第一次得到 `CLAUDE.local.md`、或第一次以注入方式被引导时给你的一次性提示(后者建议运行 `/adopt`,在 `$HOME` 下除外;在这个文件会让 `AGENTS.md` 失效的项目里,还会说明 `AGENTS.md` 的情况和相应设置)、引导写进 `.claude/rules/claude-mem-lite.md` 时的一次性提示,SessionStart 给只有托管块的 `CLAUDE.md` 补上 `AGENTS.md` 导入时的一次性提示,以及当前项目未 adopt 时 SessionStart 追加的那一行 "Invited-memory 未启用…" 提示。v2.82.1 起任何安装路径每次 SessionStart 都自动 adopt,所以该提示一般只在你显式 opt out(`MEM_NO_AUTO_ADOPT=1` 或 `claude-mem-lite adopt --disable`)的项目才会出现。 | _(禁用)_ |
818
+ | `CLAUDE_MEM_RULES_STEERING` | 设为 `1` 时,在 `CLAUDE.local.md` 会让 Claude Code 不再读项目 `AGENTS.md` 的仓库里,自动 adopt 把托管块写进 `.claude/rules/claude-mem-lite.md`(排除在 git 之外)而不是注入;子代理能看到它,`AGENTS.md` 也继续加载。开着时写下的文件之后一直是引导渠道。默认关闭:预先登记的 A/B 没有显示出达到标准的、胜过注入的效果(`docs/audits/20261006-d212-ab.md`)。 | _(注入)_ |
793
819
 
794
820
  ## 许可证
795
821