claude-mem-lite 6.30.13 → 6.30.15
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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/secret-scrub.mjs +196 -3
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"plugins": [
|
|
10
10
|
{
|
|
11
11
|
"name": "claude-mem-lite",
|
|
12
|
-
"version": "6.30.
|
|
12
|
+
"version": "6.30.15",
|
|
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.30.
|
|
3
|
+
"version": "6.30.15",
|
|
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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-mem-lite",
|
|
3
|
-
"version": "6.30.
|
|
3
|
+
"version": "6.30.15",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "claude-mem-lite",
|
|
9
|
-
"version": "6.30.
|
|
9
|
+
"version": "6.30.15",
|
|
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.30.
|
|
3
|
+
"version": "6.30.15",
|
|
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",
|
package/secret-scrub.mjs
CHANGED
|
@@ -1546,9 +1546,8 @@ function scrubKeyTails(text) {
|
|
|
1546
1546
|
// this repo has twice decided the text matters more.
|
|
1547
1547
|
const MAX_SCRUB_PASSES = 32;
|
|
1548
1548
|
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
let result = stripPrivate(text);
|
|
1549
|
+
function runPatterns(text) {
|
|
1550
|
+
let result = text;
|
|
1552
1551
|
for (let pass = 1; ; pass++) {
|
|
1553
1552
|
const before = result;
|
|
1554
1553
|
for (const [pattern, replacement] of SECRET_PATTERNS) {
|
|
@@ -1558,3 +1557,197 @@ export function scrubSecrets(text) {
|
|
|
1558
1557
|
}
|
|
1559
1558
|
return result;
|
|
1560
1559
|
}
|
|
1560
|
+
|
|
1561
|
+
// ─── Escaped string literals (D#687, D#693, D#685) ────────────────────────
|
|
1562
|
+
//
|
|
1563
|
+
// A JSON string literal holds its text one escape level deep: a key's quotes are `\"` and a line break
|
|
1564
|
+
// is the two characters `\n`. The patterns above are written for text, so inside a literal a JSON key
|
|
1565
|
+
// never closes on a bare quote, a label never starts a line, and a label's value runs on over the
|
|
1566
|
+
// escaped breaks into the next line's label. What `aws secretsmanager get-secret-value --query
|
|
1567
|
+
// SecretString` prints (`"{\"password\":\"…\"}"`), a `.env` that `kubectl … | jq -c .data` prints as one
|
|
1568
|
+
// string, an escaped JSON literal in a source file or a `.env` value: all were stored. Two attempts that
|
|
1569
|
+
// taught the patterns about escaped line starts (D#663, D#668) were withdrawn at review: a pattern
|
|
1570
|
+
// that starts in a new place carries its value's run-on there.
|
|
1571
|
+
//
|
|
1572
|
+
// So each double-quoted literal on one line whose body holds an escape is decoded (as JSON; an escape
|
|
1573
|
+
// JSON does not know is kept as written) and scrubbed as text, MAX_LITERAL_DEPTH levels deep, and
|
|
1574
|
+
// rewritten, as the scrubbed text encoded as JSON, only when that scrub changed it: a literal it
|
|
1575
|
+
// leaves alone keeps every byte. A literal opens at a quote with an even number of backslashes before
|
|
1576
|
+
// it, and a text that ends inside one has it read to the end. Literals are found by a walk from stop
|
|
1577
|
+
// character to stop character: the regex it replaced pushed a backtrack frame per character of a body,
|
|
1578
|
+
// `(?:[^"\\\r\n]|\\[^\r\n])*`, and threw RangeError on a literal of millions of characters (v6.30.14
|
|
1579
|
+
// review r1).
|
|
1580
|
+
//
|
|
1581
|
+
// A rewritten literal keeps erased what the patterns erase in its escaped body: their run-on erases
|
|
1582
|
+
// the lines after a label up to a space, and the text reading keeps such a line when it has no label
|
|
1583
|
+
// of its own. Without that, 5-8 values in 20,000 generated texts that v6.30.13 erased were stored
|
|
1584
|
+
// (D#687 differential, 2026-11-02). The patterns then run over the whole text as before. A word is
|
|
1585
|
+
// erased from the rewritten literal when the body holds it and what the patterns leave of the body does
|
|
1586
|
+
// not, in either of two readings, and the rewritten literal is read both ways. As written, a word ends at
|
|
1587
|
+
// every escape. Joined, a run of backslashes followed by `/` or by `u` and four hex digits reads as that
|
|
1588
|
+
// one character: a rewritten literal holds the character itself, so PHP's `\/` and .NET's `\u002B` join
|
|
1589
|
+
// words there that the body split (read only as written, 266-715 of 20,000 generated `.env` texts at one
|
|
1590
|
+
// level kept such a word, v6.30.14 review r2; 220 of 329,366 generated values two and three levels in,
|
|
1591
|
+
// review r3). Read only joined, a word the inner level erased part of was gone and its pieces were new
|
|
1592
|
+
// (194 of 649,498 generated values, v6.30.15 review r1). Decoding literal by literal instead stored values
|
|
1593
|
+
// where the patterns had erased a backslash before a quote and so moved where a literal ends (75 of
|
|
1594
|
+
// 165,125 generated values, 2026-11-03).
|
|
1595
|
+
//
|
|
1596
|
+
// Bounds: MAX_LITERALS literals are decoded per text and level (real transcripts, 2026-11-02: at most
|
|
1597
|
+
// 133 in one text); with no bound, `"\"` repeated over 500,000 characters took 104x the patterns alone
|
|
1598
|
+
// (415 ms against 4). A rewritten literal can give the patterns a reading they did not have, so a text
|
|
1599
|
+
// that holds a backslash is scrubbed again until it no longer changes, MAX_LITERAL_ROUNDS times at
|
|
1600
|
+
// most; with one round, 23-42 of 20,000 generated texts changed on a second call (scrubSecrets is
|
|
1601
|
+
// idempotent by contract: import-jsonl's dedup and cmdRestore rely on it). A text the first round
|
|
1602
|
+
// leaves as it is is a fixed point already, and is not scrubbed again.
|
|
1603
|
+
const LITERAL_STOP_RE = /["\\\r\n]/g;
|
|
1604
|
+
const JSON_ESCAPE_RE = /\\(u[0-9a-fA-F]{4}|["\\/bfnrt])/g;
|
|
1605
|
+
const JSON_ESCAPES = { '"': '"', '\\': '\\', '/': '/', b: '\b', f: '\f', n: '\n', r: '\r', t: '\t' };
|
|
1606
|
+
const VALUE_TOKEN_RE = /[A-Za-z0-9+/=_.-]+/g;
|
|
1607
|
+
const HEX4_RE = /^[0-9a-fA-F]{4}$/;
|
|
1608
|
+
const MAX_LITERAL_DEPTH = 3;
|
|
1609
|
+
const MAX_LITERALS = 256;
|
|
1610
|
+
const MAX_LITERAL_ROUNDS = 4;
|
|
1611
|
+
|
|
1612
|
+
function decodeLiteral(body) {
|
|
1613
|
+
try {
|
|
1614
|
+
return JSON.parse(`"${body}"`);
|
|
1615
|
+
} catch {
|
|
1616
|
+
return body.replace(JSON_ESCAPE_RE, (_m, e) =>
|
|
1617
|
+
e[0] === 'u' ? String.fromCharCode(parseInt(e.slice(1), 16)) : JSON_ESCAPES[e],
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* text with every escape that decodes to one character, at any depth (a run of backslashes, then `/` or
|
|
1624
|
+
* `u` and four hex digits), read as that character; and where each such escape was: [index in the
|
|
1625
|
+
* reading, start, end in text], flat.
|
|
1626
|
+
*/
|
|
1627
|
+
function joinedReading(text) {
|
|
1628
|
+
let read = '';
|
|
1629
|
+
let last = 0;
|
|
1630
|
+
const units = [];
|
|
1631
|
+
for (let i = text.indexOf('\\'); i !== -1;) {
|
|
1632
|
+
let j = i;
|
|
1633
|
+
while (text.charCodeAt(j) === 92) j++;
|
|
1634
|
+
let end = -1;
|
|
1635
|
+
let ch;
|
|
1636
|
+
if (text[j] === '/') {
|
|
1637
|
+
end = j + 1;
|
|
1638
|
+
ch = '/';
|
|
1639
|
+
} else if (text[j] === 'u' && HEX4_RE.test(text.slice(j + 1, j + 5))) {
|
|
1640
|
+
end = j + 5;
|
|
1641
|
+
ch = String.fromCharCode(parseInt(text.slice(j + 1, end), 16));
|
|
1642
|
+
}
|
|
1643
|
+
if (end === -1) {
|
|
1644
|
+
i = text.indexOf('\\', j);
|
|
1645
|
+
continue;
|
|
1646
|
+
}
|
|
1647
|
+
read += text.slice(last, i);
|
|
1648
|
+
units.push(read.length, i, end);
|
|
1649
|
+
read += ch;
|
|
1650
|
+
last = end;
|
|
1651
|
+
i = text.indexOf('\\', end);
|
|
1652
|
+
}
|
|
1653
|
+
return [read + text.slice(last), units];
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
const joinedTokens = (text) => new Set(joinedReading(text)[0].match(VALUE_TOKEN_RE));
|
|
1657
|
+
|
|
1658
|
+
/** text with each value token in `erase`, as joinedReading reads it, replaced by `***`. */
|
|
1659
|
+
function eraseJoined(text, erase) {
|
|
1660
|
+
const [read, units] = joinedReading(text);
|
|
1661
|
+
let u = 0;
|
|
1662
|
+
let shift = 0;
|
|
1663
|
+
const at = (k) => {
|
|
1664
|
+
for (; u < units.length && units[u] < k; u += 3) shift += units[u + 2] - units[u + 1] - 1;
|
|
1665
|
+
return k + shift;
|
|
1666
|
+
};
|
|
1667
|
+
let out = '';
|
|
1668
|
+
let last = 0;
|
|
1669
|
+
for (const { 0: token, index } of read.matchAll(VALUE_TOKEN_RE)) {
|
|
1670
|
+
if (!erase.has(token)) continue;
|
|
1671
|
+
out += text.slice(last, at(index)) + '***';
|
|
1672
|
+
last = at(index + token.length);
|
|
1673
|
+
}
|
|
1674
|
+
return out + text.slice(last);
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* The first literal opening at or after `from`: [start, bodyEnd, end], the body being text[start + 1,
|
|
1679
|
+
* bodyEnd) and the closing quote, if any, text[bodyEnd, end). Null when there is none. A quote whose body
|
|
1680
|
+
* meets a line break, or a backslash before one or at the end of the text, opens no literal.
|
|
1681
|
+
*/
|
|
1682
|
+
function nextLiteral(text, from) {
|
|
1683
|
+
const n = text.length;
|
|
1684
|
+
for (let q = text.indexOf('"', from); q !== -1; q = text.indexOf('"', q + 1)) {
|
|
1685
|
+
if (backslashesBefore(text, q, 0) % 2 === 1) continue;
|
|
1686
|
+
let i = q + 1;
|
|
1687
|
+
for (;;) {
|
|
1688
|
+
LITERAL_STOP_RE.lastIndex = i;
|
|
1689
|
+
if (!LITERAL_STOP_RE.test(text)) return [q, n, n];
|
|
1690
|
+
i = LITERAL_STOP_RE.lastIndex - 1;
|
|
1691
|
+
const c = text.charCodeAt(i);
|
|
1692
|
+
if (c === 34) return [q, i, i + 1];
|
|
1693
|
+
if (c !== 92 || i + 1 === n) break;
|
|
1694
|
+
const d = text.charCodeAt(i + 1);
|
|
1695
|
+
if (d === 10 || d === 13) break;
|
|
1696
|
+
i += 2;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
return null;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/**
|
|
1703
|
+
* text with the body of each literal it decodes replaced by lit(body): a literal whose body holds an
|
|
1704
|
+
* escape, the first MAX_LITERALS of them, and none at MAX_LITERAL_DEPTH.
|
|
1705
|
+
*/
|
|
1706
|
+
function readLiterals(text, depth, lit) {
|
|
1707
|
+
if (depth >= MAX_LITERAL_DEPTH || !text.includes('\\')) return text;
|
|
1708
|
+
let budget = MAX_LITERALS;
|
|
1709
|
+
let out = '';
|
|
1710
|
+
let last = 0;
|
|
1711
|
+
for (let m = nextLiteral(text, 0); m && budget > 0; m = nextLiteral(text, m[2])) {
|
|
1712
|
+
const body = text.slice(m[0] + 1, m[1]);
|
|
1713
|
+
if (!body.includes('\\')) continue;
|
|
1714
|
+
budget--;
|
|
1715
|
+
out += text.slice(last, m[0] + 1) + lit(body);
|
|
1716
|
+
last = m[1];
|
|
1717
|
+
}
|
|
1718
|
+
return out + text.slice(last);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
function scrubEscapedLiterals(text, depth) {
|
|
1722
|
+
return readLiterals(text, depth, (body) => {
|
|
1723
|
+
const decoded = decodeLiteral(body);
|
|
1724
|
+
const scrubbed = scrubText(decoded, depth + 1);
|
|
1725
|
+
if (scrubbed === decoded) return body;
|
|
1726
|
+
const left = decodeLiteral(runPatterns(body));
|
|
1727
|
+
const erase = new Set();
|
|
1728
|
+
const keptJoined = joinedTokens(left);
|
|
1729
|
+
for (const token of joinedTokens(decoded)) if (!keptJoined.has(token)) erase.add(token);
|
|
1730
|
+
const keptAsWritten = new Set(left.match(VALUE_TOKEN_RE));
|
|
1731
|
+
for (const token of decoded.match(VALUE_TOKEN_RE) ?? []) if (!keptAsWritten.has(token)) erase.add(token);
|
|
1732
|
+
const out = eraseJoined(scrubbed, erase).replace(VALUE_TOKEN_RE, (token) =>
|
|
1733
|
+
erase.has(token) ? '***' : token,
|
|
1734
|
+
);
|
|
1735
|
+
return JSON.stringify(out).slice(1, -1);
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
function scrubText(text, depth) {
|
|
1740
|
+
return runPatterns(scrubEscapedLiterals(stripPrivate(text), depth));
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
export function scrubSecrets(text) {
|
|
1744
|
+
if (!text || typeof text !== 'string') return text || '';
|
|
1745
|
+
let result = scrubText(text, 0);
|
|
1746
|
+
if (result === text) return result;
|
|
1747
|
+
for (let round = 1; round < MAX_LITERAL_ROUNDS && result.includes('\\'); round++) {
|
|
1748
|
+
const next = scrubText(result, 0);
|
|
1749
|
+
if (next === result) break;
|
|
1750
|
+
result = next;
|
|
1751
|
+
}
|
|
1752
|
+
return result;
|
|
1753
|
+
}
|