claude-mem-lite 3.16.0 → 3.16.2
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/adopt-content.mjs +1 -1
- package/hook-optimize.mjs +13 -1
- package/mem-cli.mjs +26 -7
- package/package.json +1 -1
- package/registry-github.mjs +6 -1
- package/tool-schemas.mjs +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"plugins": [
|
|
11
11
|
{
|
|
12
12
|
"name": "claude-mem-lite",
|
|
13
|
-
"version": "3.16.
|
|
13
|
+
"version": "3.16.2",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. Hybrid FTS5 + TF-IDF 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)."
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-mem-lite",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.2",
|
|
4
4
|
"description": "Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. Hybrid FTS5 + TF-IDF 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
|
@@ -269,7 +269,7 @@ surface — reach them through the CLI column in the second table.
|
|
|
269
269
|
| `mem_maintain` | `claude-mem-lite maintain scan --ops dedup,decay` | dedup / decay / cleanup / rebuild_vectors (`scan` previews, `execute` applies). |
|
|
270
270
|
| `mem_optimize` | `claude-mem-lite optimize` | LLM-powered re-enrich / normalize / cluster-merge (preview default; `--run` to apply). |
|
|
271
271
|
| `mem_export` | `claude-mem-lite export` | JSON / JSONL dump, filters by project, type, date. |
|
|
272
|
-
| `mem_fts_check` | `claude-mem-lite fts-check
|
|
272
|
+
| `mem_fts_check` | `claude-mem-lite fts-check <check\|rebuild>` | FTS5 integrity + rebuild. |
|
|
273
273
|
| `mem_browse` | `claude-mem-lite browse` | Tier-grouped dashboard (working / active / archive). |
|
|
274
274
|
| `mem_registry` | `claude-mem-lite registry <action>` | List / search / import / remove skills + agents. |
|
|
275
275
|
| `mem_use` | _MCP only_ | Load a skill / agent from the registry by name. |
|
package/README.zh-CN.md
CHANGED
|
@@ -229,7 +229,7 @@ v2.34.0 起服务端注册 17 个工具,但 `tools/list` 只暴露 6 个 **核
|
|
|
229
229
|
| `mem_maintain` | `claude-mem-lite maintain scan --ops dedup,decay` | 去重 / decay / 清理 / 向量重建(`scan` 预览,`execute` 执行)。 |
|
|
230
230
|
| `mem_optimize` | `claude-mem-lite optimize` | LLM 深度优化:re-enrich / normalize / cluster-merge(默认 preview;`--run` 执行)。 |
|
|
231
231
|
| `mem_export` | `claude-mem-lite export` | JSON / JSONL 导出,支持项目/类型/日期过滤。 |
|
|
232
|
-
| `mem_fts_check` | `claude-mem-lite fts-check
|
|
232
|
+
| `mem_fts_check` | `claude-mem-lite fts-check <check\|rebuild>` | FTS5 完整性检查与重建。 |
|
|
233
233
|
| `mem_browse` | `claude-mem-lite browse` | 分层仪表盘(working / active / archive)。 |
|
|
234
234
|
| `mem_registry` | `claude-mem-lite registry <action>` | 列 / 搜索 / 导入 / 移除 skill / agent。 |
|
|
235
235
|
| `mem_use` | _MCP only_ | 从 registry 按名载入 skill / agent。 |
|
package/adopt-content.mjs
CHANGED
|
@@ -115,7 +115,7 @@ PreToolUse hook 在你 Read / Edit / Write 文件前已自动 \`mem_recall\` 该
|
|
|
115
115
|
| 清理过期记忆 | \`${CLI_INVOKE} maintain scan --ops purge_stale\` → \`maintain execute --ops purge_stale --confirm\`(删行必须 \`--confirm\`) |
|
|
116
116
|
| 深度优化(Haiku) | \`${CLI_INVOKE} optimize\`(默认 preview;\`--run\` 执行,\`--task re-enrich,normalize,cluster-merge,smart-compress\`) |
|
|
117
117
|
| 压缩旧条目 | \`${CLI_INVOKE} compress\`(默认 preview;\`--execute\` 执行,\`--age-days N\`) |
|
|
118
|
-
| FTS5 索引检查 / 重建 | \`${CLI_INVOKE} fts-check
|
|
118
|
+
| FTS5 索引检查 / 重建 | \`${CLI_INVOKE} fts-check <check\\|rebuild>\` |
|
|
119
119
|
| tier 分组浏览 | \`${CLI_INVOKE} browse [--tier active]\` |
|
|
120
120
|
| 导出 JSON/JSONL | \`${CLI_INVOKE} export [--format jsonl]\` |
|
|
121
121
|
| 统计总量 / 健康 | \`${CLI_INVOKE} stats [--days 30]\` |
|
package/hook-optimize.mjs
CHANGED
|
@@ -203,10 +203,22 @@ search_aliases: 2-6 alternative search terms (include CJK if applicable).`;
|
|
|
203
203
|
const NORMALIZE_GATE_FILE = join(RUNTIME_DIR, 'last-normalize.json');
|
|
204
204
|
const NORMALIZE_INTERVAL_MS = 7 * 86400000; // 7 days
|
|
205
205
|
|
|
206
|
+
// Pure gate decision (no IO) — exported for testing. Fail-OPEN on a
|
|
207
|
+
// malformed-but-valid-JSON gate: a missing/non-numeric `epoch` makes
|
|
208
|
+
// `now - epoch` NaN, and `NaN >= INTERVAL` is false — which would PERMANENTLY
|
|
209
|
+
// block normalize with no recovery, contradicting the catch-branch's fail-open
|
|
210
|
+
// intent (a corrupt file that fails JSON.parse already returns true). A future
|
|
211
|
+
// epoch (clock skew / NTP correction) is equally suspect → run.
|
|
212
|
+
export function _normalizeGateOpen(last, now) {
|
|
213
|
+
const epoch = last?.epoch;
|
|
214
|
+
if (typeof epoch !== 'number' || !Number.isFinite(epoch) || epoch > now) return true;
|
|
215
|
+
return now - epoch >= NORMALIZE_INTERVAL_MS;
|
|
216
|
+
}
|
|
217
|
+
|
|
206
218
|
export function shouldRunNormalize() {
|
|
207
219
|
try {
|
|
208
220
|
const last = JSON.parse(readFileSync(NORMALIZE_GATE_FILE, 'utf8'));
|
|
209
|
-
return Date.now()
|
|
221
|
+
return _normalizeGateOpen(last, Date.now());
|
|
210
222
|
} catch {
|
|
211
223
|
return true;
|
|
212
224
|
}
|
package/mem-cli.mjs
CHANGED
|
@@ -1636,12 +1636,26 @@ function cmdRestore(db, argv) {
|
|
|
1636
1636
|
const trimmed = raw.trim();
|
|
1637
1637
|
if (!trimmed) { out('[mem] Empty file — nothing to restore.'); return; }
|
|
1638
1638
|
let rows;
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1639
|
+
let parseFailures = 0;
|
|
1640
|
+
if (trimmed[0] === '[') {
|
|
1641
|
+
// Whole-array JSON is a single document — partial parse is impossible, so
|
|
1642
|
+
// a syntax error rejects the file (unchanged behavior).
|
|
1643
|
+
try { rows = JSON.parse(trimmed); }
|
|
1644
|
+
catch (e) { fail(`[mem] "${file}" is not valid export JSON/JSONL: ${e.message}`); return; }
|
|
1645
|
+
} else {
|
|
1646
|
+
// JSONL: tolerate per-line syntax errors so one corrupt line in a large
|
|
1647
|
+
// backup doesn't discard every valid row. Parse failures fold into the
|
|
1648
|
+
// malformed tally below (the loop already skips valid-JSON-but-wrong-shape
|
|
1649
|
+
// rows the same way) — a backup tool must recover what it can.
|
|
1650
|
+
rows = [];
|
|
1651
|
+
for (const line of trimmed.split('\n')) {
|
|
1652
|
+
if (!line.trim()) continue;
|
|
1653
|
+
try { rows.push(JSON.parse(line)); }
|
|
1654
|
+
catch { parseFailures++; }
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
if (!Array.isArray(rows) || (rows.length === 0 && parseFailures === 0)) { out('[mem] No observations in file.'); return; }
|
|
1658
|
+
if (rows.length === 0) { fail(`[mem] "${file}": all ${parseFailures} line(s) failed to parse as JSONL.`); return; }
|
|
1645
1659
|
|
|
1646
1660
|
const projOverride = flags.project ? resolveProject(db, flags.project) : null;
|
|
1647
1661
|
const dryRun = flags['dry-run'] === true || flags['dry-run'] === 'true';
|
|
@@ -1693,7 +1707,12 @@ function cmdRestore(db, argv) {
|
|
|
1693
1707
|
if (process.env.CLAUDE_MEM_DEBUG) process.stderr.write(`[mem] restore row failed: ${e.message}\n`);
|
|
1694
1708
|
}
|
|
1695
1709
|
}
|
|
1696
|
-
|
|
1710
|
+
// Fold JSONL per-line syntax failures into the malformed tally and the
|
|
1711
|
+
// denominator so the report reflects every non-blank input line, not just the
|
|
1712
|
+
// ones that parsed.
|
|
1713
|
+
const totalMalformed = malformed + parseFailures;
|
|
1714
|
+
const totalLines = rows.length + parseFailures;
|
|
1715
|
+
out(`[mem] Restore${dryRun ? ' (dry-run)' : ''}: ${restored} restored, ${skipped} duplicate(s) skipped, ${totalMalformed} malformed/failed from ${totalLines} row(s).`);
|
|
1697
1716
|
}
|
|
1698
1717
|
|
|
1699
1718
|
// ─── Compress ────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-mem-lite",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.2",
|
|
4
4
|
"description": "Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. Hybrid FTS5 + TF-IDF 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
|
"type": "module",
|
|
6
6
|
"packageManager": "npm@10.9.2",
|
package/registry-github.mjs
CHANGED
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export function parseGitHubUrl(url) {
|
|
11
11
|
if (!url || typeof url !== 'string') return null;
|
|
12
|
-
|
|
12
|
+
// Drop any query string / fragment (a copy-pasted "?tab=readme" or "#section"
|
|
13
|
+
// browser anchor) before matching. Otherwise it leaks into the captured branch
|
|
14
|
+
// ("main?x#y") and corrupts the GitHub API URL built from it, so the import
|
|
15
|
+
// fails with a confusing 404 on a URL that opens fine in the browser.
|
|
16
|
+
const clean = url.split(/[?#]/)[0];
|
|
17
|
+
const match = clean.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?(?:\/tree\/([^/]+)(\/.*)?)?$/);
|
|
13
18
|
if (!match) return null;
|
|
14
19
|
const [, owner, repo, branch, pathRaw] = match;
|
|
15
20
|
return {
|
package/tool-schemas.mjs
CHANGED
|
@@ -636,7 +636,7 @@ export const tools = [
|
|
|
636
636
|
' - After a crash, power loss, or manual DB edit\n' +
|
|
637
637
|
' - doctor / stats flags FTS integrity problems\n' +
|
|
638
638
|
'\n' +
|
|
639
|
-
'Equivalent CLI: ' + CLI_INVOKE + ' fts-check
|
|
639
|
+
'Equivalent CLI: ' + CLI_INVOKE + ' fts-check <check|rebuild>',
|
|
640
640
|
inputSchema: memFtsCheckSchema,
|
|
641
641
|
hidden: true,
|
|
642
642
|
},
|