claude-mem-lite 2.28.2 → 2.30.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/synonyms.mjs CHANGED
@@ -71,6 +71,43 @@ export const SYNONYM_PAIRS = [
71
71
  ['debug', 'troubleshoot'],
72
72
  ['error', 'failure'],
73
73
  ['migrate', 'migration'],
74
+ // ─── Concurrency & Async ───
75
+ ['promise', 'async'],
76
+ ['callback', 'handler'],
77
+ ['deadlock', 'race condition'],
78
+ ['mutex', 'lock'],
79
+ ['semaphore', 'lock'],
80
+ ['concurrent', 'parallel'],
81
+ ['thread', 'worker'],
82
+ ['await', 'async'],
83
+ // ─── Type System ───
84
+ ['interface', 'type'],
85
+ ['generic', 'generics'],
86
+ ['typedef', 'type'],
87
+ ['enum', 'enumeration'],
88
+ // ─── Testing ───
89
+ ['mock', 'stub'],
90
+ ['mock', 'fake'],
91
+ ['fixture', 'testdata'],
92
+ ['assert', 'assertion'],
93
+ ['jest', 'vitest'],
94
+ ['pytest', 'unittest'],
95
+ ['cypress', 'playwright'],
96
+ // ─── Networking ───
97
+ ['http', 'request'],
98
+ ['rest', 'api'],
99
+ ['grpc', 'rpc'],
100
+ ['timeout', 'deadline'],
101
+ ['retry', 'backoff'],
102
+ ['cors', 'cross origin'],
103
+ ['ssl', 'tls'],
104
+ ['throttle', 'rate limit'],
105
+ // ─── Build Tools ───
106
+ ['webpack', 'bundler'],
107
+ ['vite', 'bundler'],
108
+ ['rollup', 'bundler'],
109
+ ['esbuild', 'bundler'],
110
+ ['transpile', 'compile'],
74
111
  // ─── CJK ↔ EN cross-language synonyms ───
75
112
  // Authentication & Authorization
76
113
  ['认证', 'auth'], ['认证', 'authentication'], ['登录', 'login'], ['登录', 'auth'],
@@ -108,6 +145,16 @@ export const SYNONYM_PAIRS = [
108
145
  ['钩子', 'hook'], ['回调', 'callback'],
109
146
  ['异步', 'async'], ['同步', 'sync'],
110
147
  ['并发', 'concurrent'], ['线程', 'thread'],
148
+ ['竞态', 'race condition'], ['死锁', 'deadlock'], ['互斥', 'mutex'],
149
+ ['协程', 'coroutine'], ['事件循环', 'event loop'],
150
+ ['泛型', 'generic'], ['枚举', 'enum'],
151
+ ['断言', 'assert'], ['单元测试', 'unit test'], ['集成测试', 'integration test'],
152
+ ['模拟测试', 'mock'], ['测试覆盖', 'coverage'],
153
+ ['错误处理', 'error handling'], ['异常捕获', 'try catch'], ['堆栈跟踪', 'stack trace'],
154
+ ['容错', 'fault tolerance'],
155
+ ['跨域', 'cors'], ['限流', 'rate limit'], ['熔断', 'circuit breaker'],
156
+ ['负载均衡', 'load balancing'], ['心跳', 'heartbeat'],
157
+ ['请求', 'request'], ['失败', 'failure'], ['覆盖率', 'coverage'],
111
158
  // Performance
112
159
  ['性能', 'performance'], ['性能', 'perf'],
113
160
  ['内存', 'memory'], ['泄漏', 'leak'],
@@ -140,6 +187,23 @@ export const SYNONYM_PAIRS = [
140
187
  ['安装', 'install'], ['导入', 'import'],
141
188
  ['导出', 'export'], ['状态', 'state'],
142
189
  ['系统', 'system'], ['算法', 'algorithm'],
190
+ // Common dev terms (mined from real usage data)
191
+ ['文件', 'file'], ['代码', 'code'],
192
+ ['执行', 'execute'], ['执行', 'run'],
193
+ ['调用', 'call'], ['调用', 'invoke'],
194
+ ['运行', 'run'], ['运行', 'execute'],
195
+ ['检查', 'check'], ['检查', 'inspect'],
196
+ ['分析', 'analyze'], ['分析', 'analysis'],
197
+ ['项目', 'project'], ['流程', 'workflow'],
198
+ ['更新', 'update'], ['提示', 'prompt'],
199
+ ['查找', 'find'], ['记录', 'record'],
200
+ ['记录', 'log'], ['校验', 'validate'],
201
+ ['计算', 'compute'], ['计算', 'calculate'],
202
+ ['单元', 'unit'], ['资源', 'resource'],
203
+ ['问题', 'issue'], ['问题', 'problem'],
204
+ ['历史', 'history'], ['描述', 'description'],
205
+ ['推荐', 'recommend'], ['建议', 'suggestion'],
206
+ ['智能', 'smart'], ['智能', 'intelligent'],
143
207
  ];
144
208
 
145
209
  // ─── Bidirectional SYNONYM_MAP (case-insensitive) ──────────────────────────────
@@ -168,11 +232,25 @@ export const CJK_COMPOUNDS = new Set([
168
232
  '认证', '授权', '加密', '解密', '序列', '并发', '异步', '同步', '线程', '进程',
169
233
  '容器', '集群', '服务器', '中间件', '网关', '负载', '监控', '日志', '告警',
170
234
  '前端', '后端', '全栈', '响应式', '路由', '状态', '渲染', '样式', '布局',
235
+ '代码', '文件', '项目', '资源', '单元', '智能',
236
+ // concurrency & async (extended)
237
+ '竞态', '死锁', '互斥', '协程', '回调', '事件循环',
238
+ // type system
239
+ '泛型', '枚举', '联合类型', '类型推断', '类型守卫', '接口定义',
240
+ // testing (extended)
241
+ '单元测试', '集成测试', '端到端', '测试覆盖', '覆盖率', '模拟测试', '断言',
242
+ // error handling (extended)
243
+ '错误处理', '异常捕获', '堆栈跟踪', '错误码', '容错', '失败', '请求',
244
+ // networking
245
+ '跨域', '限流', '熔断', '负载均衡', '心跳',
171
246
  // actions
172
247
  '修复', '重构', '优化', '升级', '安装', '卸载', '导入', '导出', '上传', '下载',
173
248
  '提交', '推送', '合并', '发布', '上线', '回退', '审查', '审核', '评审',
249
+ '执行', '调用', '运行', '检查', '分析', '查找', '计算', '校验', '更新', '描述',
174
250
  // errors/issues
175
- '报错', '崩溃', '泄露', '溢出', '死锁', '超时', '中断', '异常', '故障',
251
+ '报错', '崩溃', '泄露', '溢出', '超时', '中断', '异常', '故障',
252
+ // general (tokenization only — keeps CJK segmentation clean)
253
+ '问题', '使用', '继续', '推荐', '建议', '历史', '记录', '中文', '提示', '流程',
176
254
  // architecture
177
255
  '架构', '设计', '方案', '规划', '文档', '注释', '版本', '分支', '依赖',
178
256
  '性能', '安全', '漏洞', '补丁', '系统', '算法',
package/tool-schemas.mjs CHANGED
@@ -41,6 +41,7 @@ export const memSearchSchema = {
41
41
  limit: coerceInt.pipe(z.number().int().min(1).max(100)).optional().describe('Max results (default 20)'),
42
42
  offset: coerceInt.pipe(z.number().int().min(0)).optional().describe('Offset for pagination'),
43
43
  sort: z.enum(['relevance', 'time', 'importance']).optional().describe('Sort order: relevance (default, BM25), time (newest first), importance (highest first)'),
44
+ include_noise: z.boolean().optional().describe('Include hook-llm fallback titles ("Modified X", "Worked on X", raw error logs) — hidden by default as they have ~3% access rate'),
44
45
  };
45
46
 
46
47
  export const memRecentSchema = {
@@ -74,6 +75,7 @@ export const memSaveSchema = {
74
75
  project: z.string().optional().describe('Project name (default: inferred from CWD)'),
75
76
  importance: coerceInt.pipe(z.number().int().min(1).max(3)).optional().describe('Importance level: 1=routine, 2=notable, 3=critical (default: 2 for explicit saves)'),
76
77
  files: z.array(z.string()).optional().describe('File paths associated with this observation'),
78
+ lesson_learned: z.string().max(500).optional().describe('Key lesson or takeaway (for bugfix: root cause & fix; for decision: rationale)'),
77
79
  };
78
80
 
79
81
  export const memStatsSchema = {
@@ -87,6 +89,15 @@ export const memCompressSchema = {
87
89
  project: z.string().optional().describe('Filter by project'),
88
90
  };
89
91
 
92
+ export const memOptimizeSchema = {
93
+ action: z.enum(['preview', 'run', 'run_all']).optional().default('preview')
94
+ .describe('preview=scan candidates, run=execute with limits, run_all=bypass gates'),
95
+ tasks: z.array(z.enum(['re-enrich', 'normalize', 'cluster-merge', 'smart-compress'])).optional()
96
+ .describe('Which optimization tasks to run (default: all)'),
97
+ max_items: coerceInt.pipe(z.number().int().min(1).max(100)).optional().default(15)
98
+ .describe('Maximum LLM calls across all tasks (default: 15)'),
99
+ };
100
+
90
101
  export const memMaintainSchema = {
91
102
  action: z.enum(['scan', 'execute']).describe('scan=analyze candidates, execute=apply changes'),
92
103
  operations: z.array(z.enum(['dedup', 'decay', 'cleanup', 'boost', 'purge_stale', 'rebuild_vectors'])).optional()
package/utils.mjs CHANGED
@@ -8,8 +8,8 @@ import { execSync } from 'child_process';
8
8
  // ─── Re-exports from extracted modules ──────────────────────────────────────
9
9
  // Backward compatibility: all consumers import from utils.mjs
10
10
 
11
- export { DECAY_HALF_LIFE_BY_TYPE, DEFAULT_DECAY_HALF_LIFE_MS, OBS_BM25, SESS_BM25, TYPE_DECAY_CASE, TYPE_QUALITY_CASE, OBS_FTS_COLUMNS } from './scoring-sql.mjs';
12
- export { cjkBigrams, extractCjkSynonymTokens, extractCjkKeywords, SYNONYM_MAP, expandToken, sanitizeFtsQuery, relaxFtsQueryToOr, FTS_STOP_WORDS, CJK_COMPOUNDS } from './nlp.mjs';
11
+ export { DECAY_HALF_LIFE_BY_TYPE, DEFAULT_DECAY_HALF_LIFE_MS, OBS_BM25, SESS_BM25, TYPE_DECAY_CASE, TYPE_QUALITY_CASE, OBS_FTS_COLUMNS, notLowSignalTitleClause } from './scoring-sql.mjs';
12
+ export { cjkBigrams, extractCjkSynonymTokens, extractCjkKeywords, extractCjkLikePatterns, SYNONYM_MAP, expandToken, sanitizeFtsQuery, relaxFtsQueryToOr, FTS_STOP_WORDS, CJK_COMPOUNDS } from './nlp.mjs';
13
13
  export { resolveProject, _resetProjectCache } from './project-utils.mjs';
14
14
  export { scrubSecrets, SECRET_PATTERNS } from './secret-scrub.mjs';
15
15
  export { truncate, typeIcon, fmtDate, fmtTime, isoWeekKey } from './format-utils.mjs';
@@ -89,7 +89,13 @@ export function clampImportance(val) {
89
89
  export const EDIT_TOOLS = new Set(['Edit', 'Write', 'NotebookEdit']);
90
90
 
91
91
  // Low-signal degraded title patterns — shared by hook-llm.mjs (dedup + importance cap) and hook-handoff.mjs (decision filter)
92
- export const LOW_SIGNAL_TITLE = /^(Error (while working|in)|Error: |Modified |Worked on |Reviewed \d+ files:|# |node |npm |npx |\(no description\)|\(error\)$)/;
92
+ // Two top-level alternatives:
93
+ // 1. ^(prefix1|prefix2|...) — title starts with one of the hook-llm fallback prefixes
94
+ // 2. \(error\)$ — title ends with '(error)' (Bug #2 fix: previously this was
95
+ // inside the prefix group with a meaningless $, so only the exact title '(error)' matched.
96
+ // Tool-fragment titles like 'gh release list ... (error)' leaked through.)
97
+ // Keep in sync with notLowSignalTitleClause() in scoring-sql.mjs.
98
+ export const LOW_SIGNAL_TITLE = /^(Error (while working|in)|Error: |Modified |Worked on |Reviewed \d+ files:|# |node |npm |npx |\(no description\))|\(error\)$/;
93
99
 
94
100
  export function computeRuleImportance(episode) {
95
101
  let importance = 1;
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Recall past observations for a file before editing. Use when: about to edit a file, investigating a file with past issues, or before refactoring to check for past lessons"
3
- argument-hint: <file_path>
4
- ---
5
-
6
- ## File Memory
7
- !`claude-mem-lite recall $ARGUMENTS 2>/dev/null || echo "No history found"`
8
-
9
- Consider these past observations before making changes.
@@ -1,7 +0,0 @@
1
- ---
2
- description: "Show recent memory observations. Use when: checking what happened recently, reviewing session progress, or verifying recent changes were captured"
3
- argument-hint: [count]
4
- ---
5
-
6
- ## Recent Observations
7
- !`claude-mem-lite recent $ARGUMENTS 2>/dev/null || echo "No observations"`
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Search memory for past bugfixes, decisions, discoveries. Use when: encountering a familiar error, investigating a module before changes, or looking for prior solutions to a similar problem"
3
- argument-hint: <query>
4
- ---
5
-
6
- ## Memory Search
7
- !`claude-mem-lite search $ARGUMENTS 2>/dev/null || echo "No results found"`
8
-
9
- Use `claude-mem-lite get <id>` via Bash for full details on any result.
@@ -1,7 +0,0 @@
1
- ---
2
- description: "Browse memory timeline around an observation. Use when: exploring what happened before/after a specific event, understanding the sequence of changes that led to a bug, or reviewing chronological context"
3
- argument-hint: <observation_id>
4
- ---
5
-
6
- ## Timeline
7
- !`claude-mem-lite timeline --anchor $ARGUMENTS 2>/dev/null || echo "Not found"`