claude-mem-lite 6.34.0 → 6.35.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 +17 -2
- package/README.zh-CN.md +12 -2
- package/hook-llm.mjs +20 -57
- package/install.mjs +44 -7
- package/lib/fast-summary.mjs +49 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"plugins": [
|
|
10
10
|
{
|
|
11
11
|
"name": "claude-mem-lite",
|
|
12
|
-
"version": "6.
|
|
12
|
+
"version": "6.35.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.
|
|
3
|
+
"version": "6.35.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
|
@@ -239,6 +239,19 @@ rm -rf ~/claude-mem-lite/ # unhidden data dir from before the first release (n
|
|
|
239
239
|
repos/ # Shallow-cloned source repos
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
+
## Upgrading to 6.35.0
|
|
243
|
+
|
|
244
|
+
**The Last Session line names the session's main outcome more often; nothing to run, and the
|
|
245
|
+
schema version stays 49.** To go back, pin `claude-mem-lite@6.34.0`.
|
|
246
|
+
|
|
247
|
+
- **The session summary prompt's rule for the session's replies asks the model to order the work
|
|
248
|
+
it lists as completed by importance**, so the Last Session line SessionStart shows, cut to 120
|
|
249
|
+
characters, starts with the session's main finished outcome more often. The Completed field is
|
|
250
|
+
longer than before.
|
|
251
|
+
- **`uninstall --purge` no longer says `Done!` when `~/.claude-mem-lite` is a symbolic link.** The
|
|
252
|
+
purge then removes nothing and names the link.
|
|
253
|
+
- See CHANGELOG.md.
|
|
254
|
+
|
|
242
255
|
## Upgrading to 6.34.0
|
|
243
256
|
|
|
244
257
|
**The session summary reads every turn's last reply; nothing to run, and the schema version stays
|
|
@@ -957,7 +970,7 @@ Each observation includes type, title, narrative, concepts, facts, importance (1
|
|
|
957
970
|
# git clone install:
|
|
958
971
|
node install.mjs install # Install and configure
|
|
959
972
|
node install.mjs uninstall # Remove (keep data)
|
|
960
|
-
node install.mjs uninstall --purge # Remove and delete
|
|
973
|
+
node install.mjs uninstall --purge # Remove and delete the data (see Uninstall)
|
|
961
974
|
node install.mjs status # Show current status
|
|
962
975
|
node cli.mjs doctor # Diagnose issues (cli.mjs, not install.mjs — see note)
|
|
963
976
|
node cli.mjs repair # Recover a broken install from the latest signed release
|
|
@@ -1058,13 +1071,15 @@ After it finishes, `~/.claude-mem-lite/` is back in sync with the latest release
|
|
|
1058
1071
|
# git clone:
|
|
1059
1072
|
cd claude-mem-lite
|
|
1060
1073
|
node install.mjs uninstall # Keeps ~/.claude-mem-lite/ data
|
|
1061
|
-
node install.mjs uninstall --purge # Deletes ~/.claude-mem-lite/ and
|
|
1074
|
+
node install.mjs uninstall --purge # Deletes ~/.claude-mem-lite/ and its data
|
|
1062
1075
|
|
|
1063
1076
|
# npx:
|
|
1064
1077
|
npx claude-mem-lite uninstall
|
|
1065
1078
|
npx claude-mem-lite uninstall --purge
|
|
1066
1079
|
```
|
|
1067
1080
|
|
|
1081
|
+
When `~/.claude-mem-lite` is a symbolic link, `--purge` removes nothing and names the link.
|
|
1082
|
+
|
|
1068
1083
|
Data in `~/.claude-mem-lite/` is preserved by default. Delete manually if needed:
|
|
1069
1084
|
```bash
|
|
1070
1085
|
rm -rf ~/.claude-mem-lite/
|
package/README.zh-CN.md
CHANGED
|
@@ -201,6 +201,14 @@ rm -rf ~/claude-mem-lite/ # 首个发布版之前的非隐藏目录(不是
|
|
|
201
201
|
repos/ # 浅克隆的源代码仓库
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
+
## 升级到 6.35.0
|
|
205
|
+
|
|
206
|
+
**Last Session 那一行更常写出会话最重要的结果;不用执行任何操作,schema 版本仍是 49。** 想退回,请固定 `claude-mem-lite@6.34.0`。
|
|
207
|
+
|
|
208
|
+
- **会话摘要提示里讲会话回复的那条规则,要求模型按重要性排列 completed 里的完成事项**,所以 SessionStart 显示的、截到 120 字符的 Last Session 那一行,更常以会话最重要的完成结果开头。Completed 字段比以前长。
|
|
209
|
+
- **`~/.claude-mem-lite` 是符号链接时,`uninstall --purge` 不再打印 `Done!`。** 这时 purge 什么都不删,并说明是哪个链接。
|
|
210
|
+
- 详见 CHANGELOG.md。
|
|
211
|
+
|
|
204
212
|
## 升级到 6.34.0
|
|
205
213
|
|
|
206
214
|
**会话摘要会读每一轮的最后回复;不用执行任何操作,schema 版本仍是 49。** 想退回,请固定 `claude-mem-lite@6.33.0`,并删掉数据目录里的 `runtime/turn-replies-*.json`:6.33.0 不读它们。
|
|
@@ -738,7 +746,7 @@ Episode 缓冲区 -> 刷新为 JSON -> claude -p --model haiku -> 结构化观
|
|
|
738
746
|
# git clone 安装:
|
|
739
747
|
node install.mjs install # 安装并配置
|
|
740
748
|
node install.mjs uninstall # 移除(保留数据)
|
|
741
|
-
node install.mjs uninstall --purge #
|
|
749
|
+
node install.mjs uninstall --purge # 移除并删除数据(见「卸载」)
|
|
742
750
|
node install.mjs status # 显示当前状态
|
|
743
751
|
node cli.mjs doctor # 诊断问题(用 cli.mjs 而非 install.mjs,见下方说明)
|
|
744
752
|
node cli.mjs repair # 从最新签名发布恢复损坏的安装
|
|
@@ -804,13 +812,15 @@ T=$(mktemp -d) && U=$(curl -sL https://api.github.com/repos/sdsrss/claude-mem-li
|
|
|
804
812
|
# git clone:
|
|
805
813
|
cd claude-mem-lite
|
|
806
814
|
node install.mjs uninstall # 保留 ~/.claude-mem-lite/ 数据
|
|
807
|
-
node install.mjs uninstall --purge # 删除 ~/.claude-mem-lite/
|
|
815
|
+
node install.mjs uninstall --purge # 删除 ~/.claude-mem-lite/ 及其数据
|
|
808
816
|
|
|
809
817
|
# npx:
|
|
810
818
|
npx claude-mem-lite uninstall
|
|
811
819
|
npx claude-mem-lite uninstall --purge
|
|
812
820
|
```
|
|
813
821
|
|
|
822
|
+
`~/.claude-mem-lite` 是符号链接时,`--purge` 什么都不删,并说明是哪个链接。
|
|
823
|
+
|
|
814
824
|
数据默认保留在 `~/.claude-mem-lite/` 中。如需删除:
|
|
815
825
|
```bash
|
|
816
826
|
rm -rf ~/.claude-mem-lite/
|
package/hook-llm.mjs
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import { acquireLLMSlot, releaseLLMSlot, LLM_SEM_TIMEOUT } from './hook-semaphore.mjs';
|
|
27
27
|
import { BG_LLM_TIMEOUT_MS } from './haiku-client.mjs';
|
|
28
28
|
import { scrubRecord, scrubFilePaths } from './lib/scrub-record.mjs';
|
|
29
|
-
import { mergeModelSummary, summarySuperseded } from './lib/fast-summary.mjs';
|
|
29
|
+
import { mergeModelSummary, modelSummaryFields, summarySuperseded } from './lib/fast-summary.mjs';
|
|
30
30
|
import { recordMetric } from './lib/metrics.mjs';
|
|
31
31
|
import { readTurnReplies } from './lib/turn-replies.mjs';
|
|
32
32
|
import { DB_DIR } from './schema.mjs';
|
|
@@ -1754,6 +1754,16 @@ export const SUMMARY_TURN_TAIL = 300;
|
|
|
1754
1754
|
export const SUMMARY_TURNS_FIRST = 4;
|
|
1755
1755
|
export const SUMMARY_TURNS_LAST = 8;
|
|
1756
1756
|
|
|
1757
|
+
/**
|
|
1758
|
+
* D26 (D#845) — the last sentence of both reply rules: `completed` ordered by importance, so the
|
|
1759
|
+
* Last Session line SessionStart cuts to 120 characters starts with the session's main finished
|
|
1760
|
+
* outcome. That line left it out in 23 of 60 calls without this sentence and 11 of 60 with it;
|
|
1761
|
+
* no other count rose by more than 1 (docs/audits/20261112-d26-reading.md). The prompt without
|
|
1762
|
+
* a reply does not carry it.
|
|
1763
|
+
*/
|
|
1764
|
+
export const SUMMARY_COMPLETED_ORDER =
|
|
1765
|
+
"Order completed by importance: begin with the session's most important finished outcome, the one a person picking this work up next most needs to know (such as a release published, a deploy live, a fix merged or a measurement's verdict), then list every other finished item. This changes only the order: keep every item and detail you would otherwise include, and an item's state is still the one given by the latest reply that mentions it.";
|
|
1766
|
+
|
|
1757
1767
|
/**
|
|
1758
1768
|
* The final reply as the summary prompt carries it: scrubbed whole first, so a secret
|
|
1759
1769
|
* straddling a cut is never half-kept, then cut to head + tail with the omitted length named.
|
|
@@ -1813,8 +1823,9 @@ export function mergeSummaryRows(observations, events) {
|
|
|
1813
1823
|
* The session summary prompt. `observations` are {type, title, narrative} newest first,
|
|
1814
1824
|
* `userPrompts` the raw prompt texts in order; both are cut here. `finalReply`, when given, is
|
|
1815
1825
|
* the session's last assistant message (D19): it goes into the user part behind the same input
|
|
1816
|
-
* guard, and the system part says the outcome it reports wins
|
|
1817
|
-
*
|
|
1826
|
+
* guard, and the system part says the outcome it reports wins and that completed is ordered by
|
|
1827
|
+
* importance (SUMMARY_COMPLETED_ORDER, D26). Without one the prompt is the one shipped before D19,
|
|
1828
|
+
* byte for byte. `turnReplies` (D22), each turn's last reply oldest
|
|
1818
1829
|
* first, replaces the final reply when it holds two or more turns with text (its last one IS
|
|
1819
1830
|
* the final reply); with fewer the prompt is the D19 one.
|
|
1820
1831
|
*/
|
|
@@ -1838,10 +1849,10 @@ lessons: Only genuinely non-obvious insights (debugging discoveries, gotchas, ar
|
|
|
1838
1849
|
key_decisions: Only decisions with lasting impact (library choices, architecture, data model). Include reasoning. Empty array if none.${
|
|
1839
1850
|
turns
|
|
1840
1851
|
? `
|
|
1841
|
-
Replies: the user message ends with the assistant's last reply of each turn, oldest first; the last one is the session's final reply. These are the assistant's own account of the outcome. completed lists the main work the replies report as done in every turn, not only the last. Work a reply reports as done (tests passed, saved, committed, fixed) is completed — never list it in remaining_items or next_steps. An item's state is the one given by the latest reply that mentions it. What is still unfinished, failed or left for later belongs in remaining_items
|
|
1852
|
+
Replies: the user message ends with the assistant's last reply of each turn, oldest first; the last one is the session's final reply. These are the assistant's own account of the outcome. completed lists the main work the replies report as done in every turn, not only the last. Work a reply reports as done (tests passed, saved, committed, fixed) is completed — never list it in remaining_items or next_steps. An item's state is the one given by the latest reply that mentions it. What is still unfinished, failed or left for later belongs in remaining_items. ${SUMMARY_COMPLETED_ORDER}`
|
|
1842
1853
|
: reply
|
|
1843
1854
|
? `
|
|
1844
|
-
Final reply: the user message ends with the session's final reply, the assistant's own account of the outcome. Work it reports as done (tests passed, saved, committed, fixed) is completed — never list it in remaining_items or next_steps. What it reports as unfinished, failed or left for later belongs in remaining_items
|
|
1855
|
+
Final reply: the user message ends with the session's final reply, the assistant's own account of the outcome. Work it reports as done (tests passed, saved, committed, fixed) is completed — never list it in remaining_items or next_steps. What it reports as unfinished, failed or left for later belongs in remaining_items. ${SUMMARY_COMPLETED_ORDER}`
|
|
1845
1856
|
: ''
|
|
1846
1857
|
}`;
|
|
1847
1858
|
const user = `Project: ${project}${promptCtx}
|
|
@@ -1953,65 +1964,17 @@ export async function handleLLMSummary() {
|
|
|
1953
1964
|
releaseLLMSlot();
|
|
1954
1965
|
}
|
|
1955
1966
|
|
|
1956
|
-
//
|
|
1957
|
-
//
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
// JSON.stringify'd separately below.)
|
|
1961
|
-
const asText = (v) =>
|
|
1962
|
-
Array.isArray(v)
|
|
1963
|
-
? v.filter((x) => typeof x === 'string' && x.trim()).join('; ')
|
|
1964
|
-
: typeof v === 'string'
|
|
1965
|
-
? v
|
|
1966
|
-
: '';
|
|
1967
|
-
|
|
1968
|
-
// Persist when ANY meaningful field is present — not just `request`. Gating on `request`
|
|
1969
|
-
// alone dropped the whole INSERT/UPDATE (losing the session's highest-value fields:
|
|
1970
|
-
// lessons + key_decisions) whenever Haiku returned an empty request string but a rich
|
|
1971
|
-
// `{completed, lessons, key_decisions}` — a common degraded shape. Downstream tolerates an
|
|
1972
|
-
// empty request: INSERT writes '' and the UPDATE keeps the row's own request (or an older row's)
|
|
1973
|
-
// when the reply's is empty. Use asText in the gate so a non-string / empty-array field can't falsely
|
|
1974
|
-
// trigger it.
|
|
1975
|
-
// Items are kept only when they are non-empty strings. Array.isArray alone stored a reply of
|
|
1976
|
-
// [123, null, {…}, "real lesson"] as-is, and SessionStart then injected
|
|
1977
|
-
// "Lessons: 123; ; [object Object]", pushing the real lesson out of its 3-item window.
|
|
1978
|
-
const textItems = (v) =>
|
|
1979
|
-
Array.isArray(v) ? v.filter((x) => typeof x === 'string' && x.trim()).map((x) => x.trim()) : [];
|
|
1980
|
-
const lessons = llmParsed ? textItems(llmParsed.lessons) : [];
|
|
1981
|
-
const keyDecisions = llmParsed ? textItems(llmParsed.key_decisions) : [];
|
|
1982
|
-
const hasSummaryContent =
|
|
1983
|
-
llmParsed &&
|
|
1984
|
-
(asText(llmParsed.request) ||
|
|
1985
|
-
asText(llmParsed.completed) ||
|
|
1986
|
-
asText(llmParsed.remaining_items) ||
|
|
1987
|
-
asText(llmParsed.next_steps) ||
|
|
1988
|
-
lessons.length > 0 ||
|
|
1989
|
-
keyDecisions.length > 0);
|
|
1990
|
-
if (hasSummaryContent) {
|
|
1967
|
+
// The reply's fields, coerced and scrubbed (lib/fast-summary.mjs), or null with nothing to
|
|
1968
|
+
// write.
|
|
1969
|
+
const safe = modelSummaryFields(llmParsed);
|
|
1970
|
+
if (safe) {
|
|
1991
1971
|
const now = new Date();
|
|
1992
|
-
const lessonsJson = lessons.length > 0 ? JSON.stringify(lessons) : null;
|
|
1993
|
-
const decisionsJson = keyDecisions.length > 0 ? JSON.stringify(keyDecisions) : null;
|
|
1994
|
-
|
|
1995
1972
|
// Upgrade the session's summary row instead of creating another. This worker runs after
|
|
1996
1973
|
// EVERY Stop (one per assistant turn) and again from SessionStart's /clear path; selecting
|
|
1997
1974
|
// only a `notes = 'fast'` row found nothing once the first run had upgraded it, and each
|
|
1998
1975
|
// later turn INSERTed (one live session: 37 rows in 65 minutes). mergeModelSummary lands
|
|
1999
1976
|
// on the session's newest row and keeps a report's Done / Not done over the model's
|
|
2000
1977
|
// (lib/fast-summary.mjs).
|
|
2001
|
-
//
|
|
2002
|
-
// Scrub LLM-output text fields at the write boundary. lessons / key_decisions are
|
|
2003
|
-
// JSON.stringify(array<string>); scrubSecrets uses opaque placeholders that preserve
|
|
2004
|
-
// JSON structure, so the JSON string is scrubbed whole.
|
|
2005
|
-
const safe = scrubRecord('session_summaries', {
|
|
2006
|
-
request: asText(llmParsed.request),
|
|
2007
|
-
investigated: asText(llmParsed.investigated),
|
|
2008
|
-
learned: asText(llmParsed.learned),
|
|
2009
|
-
completed: asText(llmParsed.completed),
|
|
2010
|
-
next_steps: asText(llmParsed.next_steps),
|
|
2011
|
-
remaining_items: asText(llmParsed.remaining_items),
|
|
2012
|
-
lessons: lessonsJson,
|
|
2013
|
-
key_decisions: decisionsJson,
|
|
2014
|
-
});
|
|
2015
1978
|
if (mergeModelSummary(db, { sessionId, project, fields: safe, now, spawnEpoch })) {
|
|
2016
1979
|
outcome('written');
|
|
2017
1980
|
} else {
|
package/install.mjs
CHANGED
|
@@ -1973,10 +1973,47 @@ async function uninstall() {
|
|
|
1973
1973
|
let purgeIncomplete = false; // reported, and not followed by "Done!" and exit 0
|
|
1974
1974
|
if (flags.has('--purge')) {
|
|
1975
1975
|
const homeDir = join(homedir(), '.claude-mem-lite');
|
|
1976
|
-
//
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1976
|
+
// D#829: with ~/.claude-mem-lite a link, rmSync took the link alone and the run said
|
|
1977
|
+
// "Data purged" and "Done!" with the store left behind it. The target may be a directory the
|
|
1978
|
+
// user chose, and it holds the code too, so nothing is removed through the link. Nothing is
|
|
1979
|
+
// removed at all: removing the link first and leaving the rest to the relocated purge ended in
|
|
1980
|
+
// "Done!" with the store left when CLAUDE_MEM_DIR named the target by another spelling
|
|
1981
|
+
// (`<link>/`), and telling that spelling apart needs resolved paths, whose failures were read
|
|
1982
|
+
// as "the target is gone" (D#811 reviews r1 F1, r2 R2-1). One lstat decides; the link stays as
|
|
1983
|
+
// the record of where the store is.
|
|
1984
|
+
let homeIsLink = false;
|
|
1985
|
+
try {
|
|
1986
|
+
homeIsLink = lstatSync(DATA_DIR).isSymbolicLink();
|
|
1987
|
+
} catch {
|
|
1988
|
+
/* absent, or not lstat-able: existsSync below decides, as before */
|
|
1989
|
+
}
|
|
1990
|
+
if (homeIsLink) {
|
|
1991
|
+
let to = '';
|
|
1992
|
+
try {
|
|
1993
|
+
to = ` to ${readlinkSync(DATA_DIR)}`;
|
|
1994
|
+
} catch {
|
|
1995
|
+
/* raced away */
|
|
1996
|
+
}
|
|
1997
|
+
warn(
|
|
1998
|
+
`~/.claude-mem-lite is a link${to}. --purge does not delete through a link, so it removed nothing` +
|
|
1999
|
+
(MEM_DATA_DIR !== homeDir ? ` (CLAUDE_MEM_DIR ${MEM_DATA_DIR} included).` : '.'),
|
|
2000
|
+
);
|
|
2001
|
+
purgeIncomplete = true;
|
|
2002
|
+
} else if (existsSync(DATA_DIR) && DATA_DIR === homeDir) {
|
|
2003
|
+
// Always remove the homedir code/install dir (guarded to the canonical path). An entry it
|
|
2004
|
+
// may not remove threw out of here uncaught, and the relocated purge below never ran (D#815).
|
|
2005
|
+
try {
|
|
2006
|
+
rmSync(DATA_DIR, { recursive: true, force: true });
|
|
2007
|
+
// D#835 (D#829 review r2 X1): with another process deleting files in it, rmSync returned
|
|
2008
|
+
// normally and the directory, store included, was still there (7 of 12 runs on Node 26).
|
|
2009
|
+
if (existsSync(DATA_DIR)) {
|
|
2010
|
+
warn('Could not remove ~/.claude-mem-lite: it was still there when the removal returned.');
|
|
2011
|
+
purgeIncomplete = true;
|
|
2012
|
+
} else ok('Data purged (~/.claude-mem-lite/)');
|
|
2013
|
+
} catch (e) {
|
|
2014
|
+
warn(`Could not remove ~/.claude-mem-lite (${e.code || e.message}).`);
|
|
2015
|
+
purgeIncomplete = true;
|
|
2016
|
+
}
|
|
1980
2017
|
} else if (existsSync(DATA_DIR)) {
|
|
1981
2018
|
fail('DATA_DIR path mismatch, refusing to purge for safety: ' + DATA_DIR);
|
|
1982
2019
|
}
|
|
@@ -1984,8 +2021,8 @@ async function uninstall() {
|
|
|
1984
2021
|
// claude-mem-lite.db), so a mistyped CLAUDE_MEM_DIR is never touched. Even then only what
|
|
1985
2022
|
// claude-mem-lite writes there goes: the directory may be one the user keeps other files in,
|
|
1986
2023
|
// and removing it whole took those too (R32 E2E install F1, P0). It is removed only once
|
|
1987
|
-
// nothing else is left in it.
|
|
1988
|
-
if (MEM_DATA_DIR !== homeDir) {
|
|
2024
|
+
// nothing else is left in it. Not when ~/.claude-mem-lite is a link (above).
|
|
2025
|
+
if (MEM_DATA_DIR !== homeDir && !homeIsLink) {
|
|
1989
2026
|
// Not existsSync: it is false on EACCES too, so a store it could not look for was reported
|
|
1990
2027
|
// absent, then "Done!" (R32 depth-2 review M1).
|
|
1991
2028
|
let storeLookup = null;
|
|
@@ -5104,7 +5141,7 @@ Usage:
|
|
|
5104
5141
|
node install.mjs install Install (copy files to ~/.claude-mem-lite/)
|
|
5105
5142
|
node install.mjs install --dev Install dev mode (symlinks to dev dir)
|
|
5106
5143
|
node install.mjs uninstall Remove (keep data)
|
|
5107
|
-
node install.mjs uninstall --purge Remove and delete
|
|
5144
|
+
node install.mjs uninstall --purge Remove and delete the data
|
|
5108
5145
|
node install.mjs status Show current status (use --json for structured output)
|
|
5109
5146
|
node install.mjs doctor Diagnose issues (use --json for structured output)
|
|
5110
5147
|
node install.mjs cleanup Remove stale temp/staging files (use --dry-run to preview)
|
package/lib/fast-summary.mjs
CHANGED
|
@@ -456,6 +456,55 @@ export function summarySuperseded(db, sessionId, spawnEpoch) {
|
|
|
456
456
|
return Number.isFinite(latest) && latest > spawnEpoch;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
/**
|
|
460
|
+
* The summary model's parsed reply as mergeModelSummary's `fields`, or null when it has nothing
|
|
461
|
+
* to write. Moved here from hook-llm.mjs's worker so a ruler replays the same cleaning.
|
|
462
|
+
* - A prose field is coerced to a string: the model sometimes returns a LIST for completed /
|
|
463
|
+
* next_steps / remaining_items, and binding a non-string to SQL threw ("Too many parameter
|
|
464
|
+
* values") and dropped the WHOLE summary, lessons and key_decisions included. Array items
|
|
465
|
+
* are joined; anything else is ''.
|
|
466
|
+
* - lessons / key_decisions keep only non-empty strings: a reply of [123, null, {…}, "real
|
|
467
|
+
* lesson"] stored as-is was injected as "Lessons: 123; ; [object Object]", pushing the real
|
|
468
|
+
* lesson out of its 3-item window.
|
|
469
|
+
* - Any meaningful field is enough, not just `request`: gating on it dropped the session's
|
|
470
|
+
* lessons and key_decisions whenever the model returned an empty request with a rich
|
|
471
|
+
* `{completed, lessons, key_decisions}`, a common degraded shape. An empty request is
|
|
472
|
+
* tolerated downstream.
|
|
473
|
+
* - Scrubbed at the write boundary. lessons / key_decisions are JSON.stringify(array<string>),
|
|
474
|
+
* scrubbed whole: the placeholders keep the JSON's structure.
|
|
475
|
+
*/
|
|
476
|
+
export function modelSummaryFields(parsed) {
|
|
477
|
+
if (!parsed) return null;
|
|
478
|
+
const asText = (v) =>
|
|
479
|
+
Array.isArray(v)
|
|
480
|
+
? v.filter((x) => typeof x === 'string' && x.trim()).join('; ')
|
|
481
|
+
: typeof v === 'string'
|
|
482
|
+
? v
|
|
483
|
+
: '';
|
|
484
|
+
const textItems = (v) =>
|
|
485
|
+
Array.isArray(v) ? v.filter((x) => typeof x === 'string' && x.trim()).map((x) => x.trim()) : [];
|
|
486
|
+
const lessons = textItems(parsed.lessons);
|
|
487
|
+
const keyDecisions = textItems(parsed.key_decisions);
|
|
488
|
+
const hasContent =
|
|
489
|
+
asText(parsed.request) ||
|
|
490
|
+
asText(parsed.completed) ||
|
|
491
|
+
asText(parsed.remaining_items) ||
|
|
492
|
+
asText(parsed.next_steps) ||
|
|
493
|
+
lessons.length > 0 ||
|
|
494
|
+
keyDecisions.length > 0;
|
|
495
|
+
if (!hasContent) return null;
|
|
496
|
+
return scrubRecord('session_summaries', {
|
|
497
|
+
request: asText(parsed.request),
|
|
498
|
+
investigated: asText(parsed.investigated),
|
|
499
|
+
learned: asText(parsed.learned),
|
|
500
|
+
completed: asText(parsed.completed),
|
|
501
|
+
next_steps: asText(parsed.next_steps),
|
|
502
|
+
remaining_items: asText(parsed.remaining_items),
|
|
503
|
+
lessons: lessons.length > 0 ? JSON.stringify(lessons) : null,
|
|
504
|
+
key_decisions: keyDecisions.length > 0 ? JSON.stringify(keyDecisions) : null,
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
|
|
459
508
|
const MODEL_TEXT_FIELDS = ['request', 'investigated', 'learned', 'next_steps'];
|
|
460
509
|
const MODEL_JSON_FIELDS = ['lessons', 'key_decisions'];
|
|
461
510
|
const SUMMARY_COLUMNS = [...MODEL_TEXT_FIELDS, 'completed', 'remaining_items', ...MODEL_JSON_FIELDS];
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-mem-lite",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.35.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "claude-mem-lite",
|
|
9
|
-
"version": "6.
|
|
9
|
+
"version": "6.35.0",
|
|
10
10
|
"os": [
|
|
11
11
|
"darwin",
|
|
12
12
|
"linux",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-mem-lite",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.35.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
|
"type": "module",
|
|
6
6
|
"packageManager": "npm@10.9.2",
|