claude-mem-lite 2.32.1 → 2.32.3
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +9 -0
- package/README.zh-CN.md +8 -0
- package/commands/adopt.md +16 -0
- package/commands/bug.md +57 -0
- package/commands/lesson.md +53 -0
- package/hook-optimize.mjs +724 -0
- package/lib/activity.mjs +114 -0
- package/lib/doctor-benchmark.mjs +153 -0
- package/lib/git-state.mjs +38 -0
- package/lib/plan-reader.mjs +43 -0
- package/lib/startup-dashboard.mjs +113 -0
- package/lib/task-reader.mjs +149 -0
- package/memdir.mjs +21 -3
- package/package.json +11 -1
- package/plugin-cache-guard.mjs +77 -0
package/README.md
CHANGED
|
@@ -279,6 +279,15 @@ Slash commands `/adopt` and `/unadopt` wrap the same CLI.
|
|
|
279
279
|
/ `Key Context` sections. `#ID` references and the `Recent` table still fire
|
|
280
280
|
so `mem_get` remains reachable.
|
|
281
281
|
|
|
282
|
+
**When does it take effect?**
|
|
283
|
+
- The MEMORY.md sentinel and the hook-layer trim (`File Lessons` / `Key Context` /
|
|
284
|
+
lesson suffix) apply on the **next SessionStart** (any new Claude Code session
|
|
285
|
+
in the adopted project).
|
|
286
|
+
- The MCP server instructions are built once at server boot and MCP has no
|
|
287
|
+
"push" protocol — the `WHEN TO USE` / `Decision rules` trim only applies
|
|
288
|
+
after Claude Code restarts and re-spawns the mem MCP server. A single
|
|
289
|
+
`/exit` + fresh session is enough. Same caveat applies to `unadopt`.
|
|
290
|
+
|
|
282
291
|
**Safety:**
|
|
283
292
|
- Hash-guarded: editing the sentinel body yourself blocks automatic rewrites
|
|
284
293
|
unless you pass `--force`.
|
package/README.zh-CN.md
CHANGED
|
@@ -264,6 +264,14 @@ Slash 命令 `/adopt` 和 `/unadopt` 是上述 CLI 的包装。
|
|
|
264
264
|
SessionStart 注入去掉 `File Lessons` / `Key Context`。`#ID` 引用与 `Recent`
|
|
265
265
|
表保留,`mem_get` 仍可随时展开。
|
|
266
266
|
|
|
267
|
+
**什么时候生效?**
|
|
268
|
+
- MEMORY.md sentinel 和 hook 层瘦身(`File Lessons` / `Key Context` / lesson
|
|
269
|
+
后缀)**下一次 SessionStart** 生效(adopt 的项目下任一新会话)。
|
|
270
|
+
- MCP server instructions 是**服务启动时构建一次**,MCP 协议无 "push" 机制,
|
|
271
|
+
所以 `WHEN TO USE` / `Decision rules` 两段的瘦身**只在 Claude Code 重启后**
|
|
272
|
+
才生效(mem MCP 服务被重新 spawn)。`/exit` 一次再开新会话即可。`unadopt`
|
|
273
|
+
同理。
|
|
274
|
+
|
|
267
275
|
**安全性:**
|
|
268
276
|
- Hash 守护:你手动改了 sentinel 段 → 下一次 adopt 报 `UserEditedError`,
|
|
269
277
|
除非显式 `--force`。
|
package/commands/adopt.md
CHANGED
|
@@ -41,4 +41,20 @@ Code versions. Post-adopt the MCP `WHEN TO USE` section + the `File Lessons` /
|
|
|
41
41
|
`Key Context` sections auto-trim since the sentinel line already carries the
|
|
42
42
|
triggers at higher authority.
|
|
43
43
|
|
|
44
|
+
## Restart required for MCP trim to take effect
|
|
45
|
+
|
|
46
|
+
The MCP server builds its instructions once at server boot and the protocol
|
|
47
|
+
has no way to push updated instructions to an already-connected Claude Code
|
|
48
|
+
session. After running `adopt`:
|
|
49
|
+
|
|
50
|
+
- The **MEMORY.md sentinel** appears on the **next SessionStart** automatically.
|
|
51
|
+
- Hook-layer trim (`File Lessons` / `Key Context` / lesson suffix) applies
|
|
52
|
+
on the next SessionStart.
|
|
53
|
+
- MCP-instructions trim (`WHEN TO USE` / `Decision rules` sections) only
|
|
54
|
+
takes effect after Claude Code itself restarts (or at least re-attaches
|
|
55
|
+
the mem MCP server). If you still see the verbose MCP instructions after
|
|
56
|
+
adopt, a `/exit` + fresh session is enough.
|
|
57
|
+
|
|
58
|
+
Same caveat applies in reverse for `/unadopt`.
|
|
59
|
+
|
|
44
60
|
!claude-mem-lite adopt $ARGUMENTS
|
package/commands/bug.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bug
|
|
3
|
+
description: "Use when: logging a known bug + repro steps you can't fix right now. Writes to the mem events table (NOT memdir). Skip for bugs you're actively fixing in the current turn — just fix them."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /bug
|
|
7
|
+
|
|
8
|
+
Record a known bug + reproduction steps. Writes to the mem `events` table
|
|
9
|
+
with `event_type='bug'`. Does NOT touch memdir. Useful for bugs you can't
|
|
10
|
+
fix immediately but want future sessions (or yourself after `/clear`) to
|
|
11
|
+
know about and avoid re-investigating.
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
- Bug is known but fix is blocked (waiting on upstream, needs discussion).
|
|
16
|
+
- Bug is intermittent / race condition; you want a repro recipe recorded.
|
|
17
|
+
- Edge case affecting only part of users; not priority now but must not
|
|
18
|
+
be silently re-discovered.
|
|
19
|
+
|
|
20
|
+
Don't use for bugs you're actively fixing in the current turn — just fix
|
|
21
|
+
them. Use `/lesson` afterward if there's a non-obvious root cause worth
|
|
22
|
+
recording.
|
|
23
|
+
|
|
24
|
+
## Arguments
|
|
25
|
+
|
|
26
|
+
- Positional text: short bug description.
|
|
27
|
+
- `--file <path>` or `--files f1,f2,...`: affected files. Triggers
|
|
28
|
+
pre-tool-recall warning when these files are edited later.
|
|
29
|
+
- `--repro "step1; step2; step3"`: reproduction steps, semicolon-separated.
|
|
30
|
+
- `--severity low|med|high`: maps to importance `1|2|3`. Default `med`.
|
|
31
|
+
|
|
32
|
+
## Execution
|
|
33
|
+
|
|
34
|
+
Map severity to importance:
|
|
35
|
+
|
|
36
|
+
- `low` → importance 1
|
|
37
|
+
- `med` → importance 2 (default)
|
|
38
|
+
- `high` → importance 3
|
|
39
|
+
|
|
40
|
+
Build the body as `<description>\n\nRepro:\n<repro-steps>` (or just
|
|
41
|
+
`<description>` if `--repro` is absent).
|
|
42
|
+
|
|
43
|
+
Run via Bash:
|
|
44
|
+
|
|
45
|
+
claude-mem-lite activity save \
|
|
46
|
+
--type bug \
|
|
47
|
+
--title "<first 60 chars of description>" \
|
|
48
|
+
--body "<body>" \
|
|
49
|
+
[--file <path> | --files f1,f2,...] \
|
|
50
|
+
--importance <1|2|3>
|
|
51
|
+
|
|
52
|
+
Confirm to user with: `Bug logged: activity #<id>`.
|
|
53
|
+
|
|
54
|
+
## Examples
|
|
55
|
+
|
|
56
|
+
- `/bug intermittent test flake when DB is under load --repro "run pnpm test -- --retry=0; fails ~1 in 20 runs when CPU is busy"`.
|
|
57
|
+
- `/bug --file src/auth.mjs --severity high "session refresh drops the X-Forwarded-For header"` — no repro steps, just a high-severity note.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lesson
|
|
3
|
+
description: "Use when: capturing a non-obvious lesson/gotcha/workaround after a tricky fix or surprising behavior. Writes to the mem events table (NOT memdir). Skip for typos, renames, or user-preference rules."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /lesson
|
|
7
|
+
|
|
8
|
+
Record a lesson / gotcha / workaround. Writes to the mem `events` table
|
|
9
|
+
with `event_type='lesson'`. Does NOT touch memdir — so lessons never end up
|
|
10
|
+
in the L1 system-prompt memory section and do not conflict with the
|
|
11
|
+
`WHAT_NOT_TO_SAVE` semantics sdscc enforces.
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
After you (or the user) solve a tricky bug or discover a non-obvious behavior:
|
|
16
|
+
|
|
17
|
+
- "you need to call X before Y or the test hangs"
|
|
18
|
+
- "don't use this import path — it shadows the real module"
|
|
19
|
+
- "the API returns null when you pass empty string, even though docs say it throws"
|
|
20
|
+
|
|
21
|
+
Don't use for trivial fixes (typos, renames), for rules that belong in memdir
|
|
22
|
+
(user preferences, project-wide conventions), or for general project notes
|
|
23
|
+
(use `/mem:memory` or `mem_save` instead).
|
|
24
|
+
|
|
25
|
+
## Arguments
|
|
26
|
+
|
|
27
|
+
- Positional text: the lesson description (what went wrong + root cause + fix).
|
|
28
|
+
- `--file <path>`: scope to a specific file. The lesson will surface via
|
|
29
|
+
pre-tool-recall the next time the file is opened via Edit/Write.
|
|
30
|
+
- `--files f1,f2,f3`: comma-separated list for multiple files.
|
|
31
|
+
- `--importance <1|2|3>`: default `2`. Use `3` for critical lessons you always
|
|
32
|
+
want surfaced; `1` for minor gotchas.
|
|
33
|
+
|
|
34
|
+
## Execution
|
|
35
|
+
|
|
36
|
+
Run via Bash — the CLI takes the lesson text as positional args and stores
|
|
37
|
+
the full text as the title (the `activity save` command uses title-as-body
|
|
38
|
+
when `--body` is absent):
|
|
39
|
+
|
|
40
|
+
claude-mem-lite activity save \
|
|
41
|
+
--type lesson \
|
|
42
|
+
--title "<first 60 chars of text>" \
|
|
43
|
+
--body "<full text>" \
|
|
44
|
+
[--file <path> | --files f1,f2,...] \
|
|
45
|
+
--importance <1|2|3>
|
|
46
|
+
|
|
47
|
+
Confirm to user with: `Lesson saved: activity #<id>`.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
- `/lesson fix a bug now` — stores a short lesson for the current project; no file scope.
|
|
52
|
+
- `/lesson --file src/auth.mjs "session cookies must be httpOnly or the e2e tests bleed across browsers"` — file-scoped.
|
|
53
|
+
- `/lesson --files src/a.mjs,src/b.mjs --importance 3 "both modules share a cache via WeakMap; clearing one invalidates the other"` — multi-file, high importance.
|