claude-mem-lite 2.12.1 → 2.12.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.
@@ -10,7 +10,7 @@
10
10
  "plugins": [
11
11
  {
12
12
  "name": "claude-mem-lite",
13
- "version": "2.12.1",
13
+ "version": "2.12.2",
14
14
  "source": "./",
15
15
  "description": "Lightweight persistent memory system for Claude Code — FTS5 search, episode batching, error-triggered recall"
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-mem-lite",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "description": "Lightweight persistent memory system for Claude Code — FTS5 search, episode batching, error-triggered recall",
5
5
  "author": {
6
6
  "name": "sdsrss"
@@ -157,7 +157,7 @@ function detectAdoption(invocation, sessionEvents) {
157
157
 
158
158
  // Tier 2: Behavioral adoption — methodology patterns (10 min window)
159
159
  const resourceLower = resource_name.toLowerCase();
160
- const recTime = invocation.created_at ? new Date(invocation.created_at).getTime() : 0;
160
+ const recTime = invocation.created_at ? new Date(invocation.created_at).getTime() : null;
161
161
 
162
162
  // TDD pattern: Bash(test fail) → Edit → Bash(test pass)
163
163
  if (resourceLower.includes('tdd') || resourceLower.includes('test-driven')) {
@@ -365,7 +365,7 @@ function autodemoteZombies(db) {
365
365
  try {
366
366
  const demoted = db.prepare(`
367
367
  UPDATE resources SET recommendation_mode = 'on_request', updated_at = datetime('now')
368
- WHERE COALESCE(recommend_count, 0) > 5
368
+ WHERE COALESCE(recommend_count, 0) > 8
369
369
  AND (COALESCE(adopt_count, 0) + 1.0) / (COALESCE(recommend_count, 0) + 2.0) < 0.1
370
370
  AND COALESCE(recommendation_mode, 'proactive') = 'proactive'
371
371
  AND status = 'active'
package/hook-shared.mjs CHANGED
@@ -143,24 +143,6 @@ export function hasInjectionBudget() { return _injectionCount < MAX_INJECTIONS_P
143
143
  // ─── Previous Session Context (for user-prompt dispatch enrichment) ──────────
144
144
  // Session-start caches next_steps; first user-prompt reads+clears for richer dispatch.
145
145
 
146
- export function prevContextFile() {
147
- return join(RUNTIME_DIR, `prev-context-${inferProject()}`);
148
- }
149
-
150
- export function cachePrevContext(nextSteps) {
151
- try { writeFileSync(prevContextFile(), JSON.stringify({ nextSteps, ts: Date.now() })); } catch {}
152
- }
153
-
154
- export function readAndClearPrevContext() {
155
- const file = prevContextFile();
156
- try {
157
- const data = JSON.parse(readFileSync(file, 'utf8'));
158
- try { unlinkSync(file); } catch {}
159
- if (Date.now() - data.ts > 12 * 3600000) return null; // 12h expiry
160
- return data.nextSteps || null;
161
- } catch { return null; }
162
- }
163
-
164
146
  // ─── Tool Event Tracking (for dispatch feedback) ────────────────────────────
165
147
  // PostToolUse appends feedback-relevant tool events (Skill, Task, Edit, Write, Bash errors).
166
148
  // Stop handler reads them and passes to collectFeedback for adoption/outcome detection.
package/hook.mjs CHANGED
@@ -759,7 +759,6 @@ async function handleSessionStart() {
759
759
  // CLAUDE.md: slim (summary + handoff state — observations already in stdout)
760
760
  updateClaudeMd([...summaryLines, ...handoffLines].join('\n'));
761
761
 
762
- // Cache previous session context for user-prompt dispatch enrichment.
763
762
  // Background rescan: detect changed/new managed resources since last scan.
764
763
  // TTL-based (1h) — avoids redundant filesystem scans on every session.
765
764
  // Non-blocking: spawns detached worker, results available before first user prompt.
@@ -842,6 +841,9 @@ async function handleUserPrompt() {
842
841
  const promptText = hookData.prompt || hookData.user_prompt;
843
842
  if (!promptText || typeof promptText !== 'string') return;
844
843
 
844
+ // Skip internal Claude Code protocol messages — not real user input
845
+ if (promptText.startsWith('<task-notification>')) return;
846
+
845
847
  const sessionId = getSessionId();
846
848
  const db = openDb();
847
849
  if (!db) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-mem-lite",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "description": "Lightweight persistent memory system for Claude Code",
5
5
  "type": "module",
6
6
  "engines": {
@@ -83,7 +83,7 @@ function fallbackExtract(resource) {
83
83
 
84
84
  return {
85
85
  intent_tags: intentTags || resource.type,
86
- domain_tags: domainTags || 'general',
86
+ domain_tags: domainTags || '',
87
87
  action_type: resource.type === 'agent' ? 'analyze' : 'generate',
88
88
  trigger_patterns: `when user needs ${name.replace(/-/g, ' ')} functionality`,
89
89
  capability_summary: truncate(`${resource.type}: ${name.replace(/-/g, ' ')}`, 100),
@@ -246,7 +246,7 @@ const TEXT_QUERY_STOP_WORDS = new Set([
246
246
  export function buildQueryFromText(text) {
247
247
  if (!text || typeof text !== 'string') return null;
248
248
 
249
- const cleaned = text.replace(/[{}()[\]^~*:@#$%&]/g, ' ').trim();
249
+ const cleaned = text.replace(/[{}()[\]^~*:@#$%&"\\]/g, ' ').trim();
250
250
 
251
251
  // Extract CJK compound words before whitespace split (Chinese has no spaces)
252
252
  const cjkTokens = extractCJKTokens(cleaned);
@@ -220,7 +220,7 @@ export function scanAllResources(config = {}) {
220
220
  */
221
221
  export function diffResources(db, scanned) {
222
222
  const existing = new Map();
223
- const rows = db.prepare('SELECT id, type, name, file_hash, status FROM resources').all();
223
+ const rows = db.prepare('SELECT id, type, name, file_hash, local_path, status FROM resources').all();
224
224
  for (const r of rows) existing.set(`${r.type}:${r.name}`, r);
225
225
 
226
226
  const toIndex = [];
@@ -242,9 +242,12 @@ export function diffResources(db, scanned) {
242
242
  }
243
243
 
244
244
  // Resources in DB but not on filesystem → disable
245
+ // Only disable resources that have a local_path (filesystem-backed).
246
+ // Resources without local_path were imported via metadata/registry and
247
+ // cannot be validated by filesystem scan.
245
248
  const toDisable = [];
246
249
  for (const [key, row] of existing) {
247
- if (!scannedKeys.has(key) && row.status === 'active') {
250
+ if (!scannedKeys.has(key) && row.status === 'active' && row.local_path) {
248
251
  toDisable.push(row);
249
252
  }
250
253
  }