claude-mem-lite 2.33.5 → 2.34.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +26 -11
- package/README.zh-CN.md +24 -11
- package/adopt-content.mjs +24 -5
- package/package.json +1 -1
- package/server.mjs +49 -0
- package/tool-schemas.mjs +22 -0
package/README.md
CHANGED
|
@@ -209,6 +209,15 @@ rm -rf ~/claude-mem-lite/ # pre-v0.5 unhidden (if not auto-moved)
|
|
|
209
209
|
|
|
210
210
|
### MCP Tools (used automatically by Claude)
|
|
211
211
|
|
|
212
|
+
As of v2.34.0, the server registers 17 tools in total but only the 6 **core**
|
|
213
|
+
tools appear in `tools/list`. The 11 **hidden** tools remain callable at the
|
|
214
|
+
protocol layer (`tools/call` by exact name still routes normally); they're
|
|
215
|
+
omitted from the list response so Claude Code sessions don't load 11 extra
|
|
216
|
+
tool schemas at startup. Hidden tools are the maintenance / admin / browser
|
|
217
|
+
surface — reach them through the CLI column in the second table.
|
|
218
|
+
|
|
219
|
+
**Core (6, exposed to Claude Code)**
|
|
220
|
+
|
|
212
221
|
| Tool | Description |
|
|
213
222
|
|------|-------------|
|
|
214
223
|
| `mem_search` | FTS5 full-text search with BM25 ranking. Filters by type, project, date range, importance level. |
|
|
@@ -217,16 +226,22 @@ rm -rf ~/claude-mem-lite/ # pre-v0.5 unhidden (if not auto-moved)
|
|
|
217
226
|
| `mem_timeline` | Browse observations chronologically around an anchor point. |
|
|
218
227
|
| `mem_get` | Retrieve full details for specific observation IDs (includes importance and related_ids). |
|
|
219
228
|
| `mem_save` | Manually save a memory/observation. |
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
|
224
|
-
|
|
225
|
-
| `
|
|
226
|
-
| `
|
|
227
|
-
| `
|
|
228
|
-
| `
|
|
229
|
-
| `
|
|
229
|
+
|
|
230
|
+
**Hidden-but-callable (11, CLI-routed)**
|
|
231
|
+
|
|
232
|
+
| Tool | CLI equivalent | Notes |
|
|
233
|
+
|------|----------------|-------|
|
|
234
|
+
| `mem_update` | `claude-mem-lite update <id>` | Edit an observation in place. |
|
|
235
|
+
| `mem_stats` | `claude-mem-lite stats` | Counts, type distribution, daily activity. |
|
|
236
|
+
| `mem_delete` | `claude-mem-lite delete <id>` | Preview / confirm workflow, FTS5 cleanup. |
|
|
237
|
+
| `mem_compress` | `claude-mem-lite compress --preview` | Roll up old low-value observations. |
|
|
238
|
+
| `mem_maintain` | `claude-mem-lite maintain --action scan` | dedup / decay / cleanup / rebuild_vectors. |
|
|
239
|
+
| `mem_optimize` | `claude-mem-lite optimize --action preview` | LLM-powered re-enrich / normalize / cluster-merge. |
|
|
240
|
+
| `mem_export` | `claude-mem-lite export` | JSON / JSONL dump, filters by project, type, date. |
|
|
241
|
+
| `mem_fts_check` | `claude-mem-lite fts-check [--rebuild]` | FTS5 integrity + rebuild. |
|
|
242
|
+
| `mem_browse` | `claude-mem-lite browse` | Tier-grouped dashboard (working / active / archive). |
|
|
243
|
+
| `mem_registry` | `claude-mem-lite registry <action>` | List / search / import / remove skills + agents. |
|
|
244
|
+
| `mem_use` | _MCP only_ | Load a skill / agent from the registry by name. |
|
|
230
245
|
|
|
231
246
|
### Skill Commands (in Claude Code chat)
|
|
232
247
|
|
|
@@ -399,7 +414,7 @@ Stop
|
|
|
399
414
|
|
|
400
415
|
### Resource Registry
|
|
401
416
|
|
|
402
|
-
The resource registry (`registry.mjs`, `registry-retriever.mjs`) indexes installed skills and agents into a searchable FTS5 database. Unlike the previous proactive dispatch system, the registry is now on-demand — Claude
|
|
417
|
+
The resource registry (`registry.mjs`, `registry-retriever.mjs`) indexes installed skills and agents into a searchable FTS5 database. Unlike the previous proactive dispatch system, the registry is now on-demand — it's reachable via the `claude-mem-lite registry` CLI (primary path for Claude Code since v2.34.0 hides the `mem_registry` MCP tool from `tools/list`) or by direct `tools/call mem_registry` for MCP clients that know the name.
|
|
403
418
|
|
|
404
419
|
```
|
|
405
420
|
Registry pipeline:
|
package/README.zh-CN.md
CHANGED
|
@@ -194,7 +194,14 @@ rm -rf ~/claude-mem-lite/ # v0.5 前的非隐藏目录(如未自动迁移)
|
|
|
194
194
|
|
|
195
195
|
## 使用方法
|
|
196
196
|
|
|
197
|
-
### MCP
|
|
197
|
+
### MCP 工具
|
|
198
|
+
|
|
199
|
+
v2.34.0 起服务端注册 17 个工具,但 `tools/list` 只暴露 6 个 **核心** 工具;其余
|
|
200
|
+
11 个 **隐藏** 工具仍然注册在 MCP 层(按名 `tools/call` 仍命中),只是不会出现
|
|
201
|
+
在列表响应里,以避免 Claude Code 会话启动时加载 11 份额外的工具 schema。隐藏
|
|
202
|
+
工具走下面表格的 CLI 入口。
|
|
203
|
+
|
|
204
|
+
**核心(6 个,暴露给 Claude Code)**
|
|
198
205
|
|
|
199
206
|
| 工具 | 描述 |
|
|
200
207
|
|------|------|
|
|
@@ -204,16 +211,22 @@ rm -rf ~/claude-mem-lite/ # v0.5 前的非隐藏目录(如未自动迁移)
|
|
|
204
211
|
| `mem_timeline` | 围绕锚点按时间顺序浏览观察。 |
|
|
205
212
|
| `mem_get` | 获取指定观察 ID 的完整详情(包含重要度和关联 ID)。 |
|
|
206
213
|
| `mem_save` | 手动保存记忆/观察。 |
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
|
211
|
-
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
| `
|
|
214
|
+
|
|
215
|
+
**隐藏但可按名调用(11 个,走 CLI)**
|
|
216
|
+
|
|
217
|
+
| 工具 | 对应 CLI | 说明 |
|
|
218
|
+
|------|----------|------|
|
|
219
|
+
| `mem_update` | `claude-mem-lite update <id>` | 原地更新某条观察。 |
|
|
220
|
+
| `mem_stats` | `claude-mem-lite stats` | 计数、类型分布、每日活动。 |
|
|
221
|
+
| `mem_delete` | `claude-mem-lite delete <id>` | 预览 / 确认流程,FTS5 自动清理。 |
|
|
222
|
+
| `mem_compress` | `claude-mem-lite compress --preview` | 压缩旧的低价值观察。 |
|
|
223
|
+
| `mem_maintain` | `claude-mem-lite maintain --action scan` | 去重 / decay / 清理 / 向量重建。 |
|
|
224
|
+
| `mem_optimize` | `claude-mem-lite optimize --action preview` | LLM 深度优化:re-enrich / normalize / cluster-merge。 |
|
|
225
|
+
| `mem_export` | `claude-mem-lite export` | JSON / JSONL 导出,支持项目/类型/日期过滤。 |
|
|
226
|
+
| `mem_fts_check` | `claude-mem-lite fts-check [--rebuild]` | FTS5 完整性检查与重建。 |
|
|
227
|
+
| `mem_browse` | `claude-mem-lite browse` | 分层仪表盘(working / active / archive)。 |
|
|
228
|
+
| `mem_registry` | `claude-mem-lite registry <action>` | 列 / 搜索 / 导入 / 移除 skill / agent。 |
|
|
229
|
+
| `mem_use` | _MCP only_ | 从 registry 按名载入 skill / agent。 |
|
|
217
230
|
|
|
218
231
|
### 技能命令(在 Claude Code 聊天中使用)
|
|
219
232
|
|
package/adopt-content.mjs
CHANGED
|
@@ -31,6 +31,9 @@ export function getDetailDoc() {
|
|
|
31
31
|
|
|
32
32
|
## 何时调用 MCP 工具
|
|
33
33
|
|
|
34
|
+
以下 6 个核心 MCP 工具在 \`tools/list\` 中默认暴露,覆盖了契约的热路径:
|
|
35
|
+
\`mem_search\` / \`mem_recent\` / \`mem_recall\` / \`mem_get\` / \`mem_save\` / \`mem_timeline\`。
|
|
36
|
+
|
|
34
37
|
| 时机 | 工具 | 关键参数 |
|
|
35
38
|
|------|------|----------|
|
|
36
39
|
| Edit / Write 前 | \`mem_recall\` | \`file="<路径>"\` —— 过往 bugfix 与教训 |
|
|
@@ -46,12 +49,28 @@ export function getDetailDoc() {
|
|
|
46
49
|
- "最近做了啥" → \`mem_recent\`
|
|
47
50
|
- "<文件> 有哪些记忆" → \`mem_recall\`
|
|
48
51
|
- "#NN 前后发生了啥" → \`mem_timeline\`
|
|
49
|
-
- "清理过期记忆" → \`mem_maintain\`
|
|
50
|
-
- "FTS 索引健康吗" → \`mem_fts_check\`
|
|
51
|
-
- "按 tier 浏览" → \`mem_browse\`
|
|
52
|
-
- "备份导出" → \`mem_export\`
|
|
53
52
|
|
|
54
|
-
## CLI
|
|
53
|
+
## 维护 / 管理类工具(走 CLI)
|
|
54
|
+
|
|
55
|
+
v2.34.0 起,以下 11 个工具从 \`tools/list\` 中隐藏以缩小启动上下文;它们仍注册在
|
|
56
|
+
MCP 层,按名 \`tools/call\` 仍可命中,但对 Claude Code 这类只读 tools/list 的
|
|
57
|
+
调用方只走下面的 CLI 入口:
|
|
58
|
+
|
|
59
|
+
| 场景 | CLI |
|
|
60
|
+
|------|-----|
|
|
61
|
+
| 清理过期记忆 | \`claude-mem-lite maintain --action scan\` → \`--action execute\` |
|
|
62
|
+
| 深度优化(Haiku) | \`claude-mem-lite optimize --action preview\` |
|
|
63
|
+
| 压缩旧条目 | \`claude-mem-lite compress --preview\` |
|
|
64
|
+
| FTS5 索引检查 / 重建 | \`claude-mem-lite fts-check [--rebuild]\` |
|
|
65
|
+
| tier 分组浏览 | \`claude-mem-lite browse [--tier active]\` |
|
|
66
|
+
| 导出 JSON/JSONL | \`claude-mem-lite export [--format jsonl]\` |
|
|
67
|
+
| 统计总量 / 健康 | \`claude-mem-lite stats [--days 30]\` |
|
|
68
|
+
| 删除某条 | \`claude-mem-lite delete <id>[,<id>]\` |
|
|
69
|
+
| 更新某条 | \`claude-mem-lite update <id> [--title ...]\` |
|
|
70
|
+
| 列 / 搜索 / 导入 skill-agent registry | \`claude-mem-lite registry <list\\|search\\|import>\` |
|
|
71
|
+
| 按 registry 名载入 skill/agent | (MCP only:\`mem_use\`;由用户主动请求时才使用) |
|
|
72
|
+
|
|
73
|
+
## CLI 速查(常用检索)
|
|
55
74
|
|
|
56
75
|
| 命令 | 用途 |
|
|
57
76
|
|------|------|
|
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
6
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
7
|
+
import { ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
7
8
|
import { jaccardSimilarity, truncate, typeIcon, sanitizeFtsQuery, relaxFtsQueryToOr, inferProject, computeMinHash, estimateJaccardFromMinHash, scrubSecrets, cjkBigrams, fmtDate, isoWeekKey, debugLog, debugCatch, COMPRESSED_PENDING_PURGE, OBS_BM25, SESS_BM25, TYPE_DECAY_CASE, TYPE_QUALITY_CASE, getCurrentBranch, DEFAULT_DECAY_HALF_LIFE_MS, isPathConfined, notLowSignalTitleClause, LOW_SIGNAL_TITLE } from './utils.mjs';
|
|
8
9
|
import { extractCjkLikePatterns } from './nlp.mjs';
|
|
9
10
|
import { resolveProject as _resolveProjectShared } from './project-utils.mjs';
|
|
@@ -2085,6 +2086,54 @@ server.registerTool(
|
|
|
2085
2086
|
})
|
|
2086
2087
|
);
|
|
2087
2088
|
|
|
2089
|
+
// ─── Hidden tool filter ─────────────────────────────────────────────────────
|
|
2090
|
+
// All 17 tools are registered (so `tools/call <name>` still resolves for
|
|
2091
|
+
// scripts and direct MCP clients), but only the 6 core tools appear in the
|
|
2092
|
+
// `tools/list` response. Hiding the 11 maintenance/admin tools keeps Claude
|
|
2093
|
+
// Code's startup context small while preserving the contract that the plugin
|
|
2094
|
+
// dogfoods (see CLAUDE.md §Mem usage contract and adopt-content.mjs).
|
|
2095
|
+
//
|
|
2096
|
+
// Safe because:
|
|
2097
|
+
// - Protocol-layer override: we replace the mcp.js default ListTools
|
|
2098
|
+
// handler on the underlying Server (setRequestHandler is a Map.set).
|
|
2099
|
+
// - `enabled` stays true, so `tools/call` keeps routing normally — per
|
|
2100
|
+
// mcp.js line 106, a `disabled` tool would reject calls too.
|
|
2101
|
+
|
|
2102
|
+
const HIDDEN_TOOL_NAMES = new Set(
|
|
2103
|
+
TOOL_DEFS.filter((t) => t.hidden === true).map((t) => t.name),
|
|
2104
|
+
);
|
|
2105
|
+
|
|
2106
|
+
// Opt-out: setting CLAUDE_MEM_ALL_TOOLS=1 restores pre-v2.34.0 behavior where
|
|
2107
|
+
// all 17 tools are visible in `tools/list`. Users who relied on Claude Code
|
|
2108
|
+
// autonomously invoking the now-hidden maintenance tools can use this as an
|
|
2109
|
+
// immediate escape hatch while adopting the CLI entry points documented in
|
|
2110
|
+
// adopt-content.mjs / README.
|
|
2111
|
+
const EXPOSE_ALL_TOOLS = process.env.CLAUDE_MEM_ALL_TOOLS === '1';
|
|
2112
|
+
|
|
2113
|
+
if (!EXPOSE_ALL_TOOLS) {
|
|
2114
|
+
// Force mcp.js to install its default ListTools/CallTools handlers before
|
|
2115
|
+
// we override; registerTool already did this, but keep the call explicit so
|
|
2116
|
+
// a future reorder of tool registration doesn't break the override.
|
|
2117
|
+
const originalHandler = server.server._requestHandlers.get('tools/list');
|
|
2118
|
+
if (typeof originalHandler !== 'function') {
|
|
2119
|
+
throw new Error('tools/list handler missing — server initialization order changed');
|
|
2120
|
+
}
|
|
2121
|
+
server.server.setRequestHandler(ListToolsRequestSchema, async (req, extra) => {
|
|
2122
|
+
const full = await originalHandler(req, extra);
|
|
2123
|
+
return { ...full, tools: full.tools.filter((t) => !HIDDEN_TOOL_NAMES.has(t.name)) };
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
// One-time discoverability banner (stderr only — Claude Code surfaces it on
|
|
2128
|
+
// session start). Skipped under MEM_QUIET_HOOKS=1 so CI / tests / hermeticity
|
|
2129
|
+
// harnesses stay silent.
|
|
2130
|
+
if (!effectiveQuiet()) {
|
|
2131
|
+
const status = EXPOSE_ALL_TOOLS
|
|
2132
|
+
? 'all 17 tools exposed via CLAUDE_MEM_ALL_TOOLS=1'
|
|
2133
|
+
: `tools/list narrowed to ${TOOL_DEFS.length - HIDDEN_TOOL_NAMES.size} core tools (${HIDDEN_TOOL_NAMES.size} hidden but callable by exact name; unset CLAUDE_MEM_ALL_TOOLS to keep, set =1 to restore all)`;
|
|
2134
|
+
process.stderr.write(`[claude-mem-lite v${PKG_VERSION}] ${status}\n`);
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2088
2137
|
// ─── WAL Checkpoint (periodic) ───────────────────────────────────────────────
|
|
2089
2138
|
|
|
2090
2139
|
// Checkpoint WAL every 5 minutes to prevent unbounded growth
|
package/tool-schemas.mjs
CHANGED
|
@@ -186,6 +186,17 @@ export const memBrowseSchema = {
|
|
|
186
186
|
// Research note: discouragement-style descriptions reduce over-invocation by
|
|
187
187
|
// 40-60% vs. encouragement-style ("use this to..."). See tests/tool-schemas.test.mjs
|
|
188
188
|
// for the invariants this list must satisfy.
|
|
189
|
+
//
|
|
190
|
+
// Core vs hidden (v2.34.0): only 6 tools are exposed via MCP `tools/list`. The
|
|
191
|
+
// remaining 11 stay registered — and are still callable by name at the MCP
|
|
192
|
+
// protocol level (`tools/call` by exact name) — but are omitted from the list
|
|
193
|
+
// response so they don't bloat every agent's startup context. The core set
|
|
194
|
+
// covers the hot paths the invited-memory contract promises (recall before
|
|
195
|
+
// Edit, save after bugfix, search/recent/timeline/get for retrieval). Hidden
|
|
196
|
+
// tools are either maintenance (compress/maintain/optimize/fts_check),
|
|
197
|
+
// admin/infra (stats/export/update/delete), or specialized browsers
|
|
198
|
+
// (browse/registry/use) — all of which have CLI equivalents documented in
|
|
199
|
+
// `adopt-content.mjs`.
|
|
189
200
|
// ────────────────────────────────────────────────────────────────────────────
|
|
190
201
|
|
|
191
202
|
export const tools = [
|
|
@@ -278,6 +289,7 @@ export const tools = [
|
|
|
278
289
|
'\n' +
|
|
279
290
|
'Equivalent CLI: claude-mem-lite delete <id>[,<id>,...] [--confirm]',
|
|
280
291
|
inputSchema: memDeleteSchema,
|
|
292
|
+
hidden: true,
|
|
281
293
|
},
|
|
282
294
|
{
|
|
283
295
|
name: 'mem_save',
|
|
@@ -314,6 +326,7 @@ export const tools = [
|
|
|
314
326
|
'\n' +
|
|
315
327
|
'Equivalent CLI: claude-mem-lite stats [--project X] [--days 30]',
|
|
316
328
|
inputSchema: memStatsSchema,
|
|
329
|
+
hidden: true,
|
|
317
330
|
},
|
|
318
331
|
{
|
|
319
332
|
name: 'mem_compress',
|
|
@@ -332,6 +345,7 @@ export const tools = [
|
|
|
332
345
|
'\n' +
|
|
333
346
|
'Equivalent CLI: claude-mem-lite compress [--preview] [--age-days 90]',
|
|
334
347
|
inputSchema: memCompressSchema,
|
|
348
|
+
hidden: true,
|
|
335
349
|
},
|
|
336
350
|
{
|
|
337
351
|
name: 'mem_maintain',
|
|
@@ -350,6 +364,7 @@ export const tools = [
|
|
|
350
364
|
'\n' +
|
|
351
365
|
'Equivalent CLI: claude-mem-lite maintain --action scan --operations dedup,decay',
|
|
352
366
|
inputSchema: memMaintainSchema,
|
|
367
|
+
hidden: true,
|
|
353
368
|
},
|
|
354
369
|
{
|
|
355
370
|
name: 'mem_optimize',
|
|
@@ -368,6 +383,7 @@ export const tools = [
|
|
|
368
383
|
'\n' +
|
|
369
384
|
'Equivalent CLI: claude-mem-lite optimize [--action preview|run|run_all] [--max-items N]',
|
|
370
385
|
inputSchema: memOptimizeSchema,
|
|
386
|
+
hidden: true,
|
|
371
387
|
},
|
|
372
388
|
{
|
|
373
389
|
name: 'mem_registry',
|
|
@@ -386,6 +402,7 @@ export const tools = [
|
|
|
386
402
|
'\n' +
|
|
387
403
|
'Equivalent CLI: claude-mem-lite registry <list|search|import|...> [args]',
|
|
388
404
|
inputSchema: memRegistrySchema,
|
|
405
|
+
hidden: true,
|
|
389
406
|
},
|
|
390
407
|
{
|
|
391
408
|
name: 'mem_use',
|
|
@@ -404,6 +421,7 @@ export const tools = [
|
|
|
404
421
|
'\n' +
|
|
405
422
|
'Equivalent CLI: MCP only (no CLI handler — use mem_registry to inspect)',
|
|
406
423
|
inputSchema: memUseSchema,
|
|
424
|
+
hidden: true,
|
|
407
425
|
},
|
|
408
426
|
{
|
|
409
427
|
name: 'mem_update',
|
|
@@ -422,6 +440,7 @@ export const tools = [
|
|
|
422
440
|
'\n' +
|
|
423
441
|
'Equivalent CLI: claude-mem-lite update <id> [--title ...] [--lesson ...]',
|
|
424
442
|
inputSchema: memUpdateSchema,
|
|
443
|
+
hidden: true,
|
|
425
444
|
},
|
|
426
445
|
{
|
|
427
446
|
name: 'mem_export',
|
|
@@ -440,6 +459,7 @@ export const tools = [
|
|
|
440
459
|
'\n' +
|
|
441
460
|
'Equivalent CLI: claude-mem-lite export [--format jsonl] [--project X] [--limit 500]',
|
|
442
461
|
inputSchema: memExportSchema,
|
|
462
|
+
hidden: true,
|
|
443
463
|
},
|
|
444
464
|
{
|
|
445
465
|
name: 'mem_recall',
|
|
@@ -476,6 +496,7 @@ export const tools = [
|
|
|
476
496
|
'\n' +
|
|
477
497
|
'Equivalent CLI: claude-mem-lite fts-check [--rebuild]',
|
|
478
498
|
inputSchema: memFtsCheckSchema,
|
|
499
|
+
hidden: true,
|
|
479
500
|
},
|
|
480
501
|
{
|
|
481
502
|
name: 'mem_browse',
|
|
@@ -494,5 +515,6 @@ export const tools = [
|
|
|
494
515
|
'\n' +
|
|
495
516
|
'Equivalent CLI: claude-mem-lite browse [--tier active] [--project X]',
|
|
496
517
|
inputSchema: memBrowseSchema,
|
|
518
|
+
hidden: true,
|
|
497
519
|
},
|
|
498
520
|
];
|