claude-memory-layer 1.0.15 → 1.0.17
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/README.md +3 -0
- package/dist/cli/index.js +105 -74
- package/dist/cli/index.js.map +2 -2
- package/dist/core/index.js +53 -40
- package/dist/core/index.js.map +2 -2
- package/dist/hooks/post-tool-use.js +53 -40
- package/dist/hooks/post-tool-use.js.map +2 -2
- package/dist/hooks/session-end.js +53 -40
- package/dist/hooks/session-end.js.map +2 -2
- package/dist/hooks/session-start.js +53 -40
- package/dist/hooks/session-start.js.map +2 -2
- package/dist/hooks/stop.js +53 -40
- package/dist/hooks/stop.js.map +2 -2
- package/dist/hooks/user-prompt-submit.js +72 -43
- package/dist/hooks/user-prompt-submit.js.map +2 -2
- package/dist/server/api/index.js +53 -40
- package/dist/server/api/index.js.map +2 -2
- package/dist/server/index.js +53 -40
- package/dist/server/index.js.map +2 -2
- package/dist/services/memory-service.js +53 -40
- package/dist/services/memory-service.js.map +2 -2
- package/memory/_index.md +3 -0
- package/memory/agent_response/uncategorized/2026-02-26.md +26 -0
- package/memory/tool_observation/uncategorized/2026-02-26.md +201 -0
- package/memory/user_prompt/uncategorized/2026-02-26.md +16 -0
- package/package.json +1 -1
- package/src/cli/index.ts +55 -33
- package/src/core/sqlite-event-store.ts +52 -40
- package/src/hooks/user-prompt-submit.ts +22 -3
package/dist/core/index.js
CHANGED
|
@@ -2616,49 +2616,62 @@ var SQLiteEventStore = class {
|
|
|
2616
2616
|
}
|
|
2617
2617
|
async getRecentRetrievalTraces(limit = 50) {
|
|
2618
2618
|
await this.initialize();
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2619
|
+
try {
|
|
2620
|
+
const rows = sqliteAll(
|
|
2621
|
+
this.db,
|
|
2622
|
+
`SELECT * FROM retrieval_traces ORDER BY created_at DESC LIMIT ?`,
|
|
2623
|
+
[limit]
|
|
2624
|
+
);
|
|
2625
|
+
return rows.map((row) => ({
|
|
2626
|
+
traceId: row.trace_id,
|
|
2627
|
+
sessionId: row.session_id || void 0,
|
|
2628
|
+
projectHash: row.project_hash || void 0,
|
|
2629
|
+
queryText: row.query_text,
|
|
2630
|
+
strategy: row.strategy || void 0,
|
|
2631
|
+
candidateEventIds: row.candidate_event_ids ? JSON.parse(row.candidate_event_ids) : [],
|
|
2632
|
+
selectedEventIds: row.selected_event_ids ? JSON.parse(row.selected_event_ids) : [],
|
|
2633
|
+
candidateDetails: row.candidate_details_json ? JSON.parse(row.candidate_details_json) : [],
|
|
2634
|
+
selectedDetails: row.selected_details_json ? JSON.parse(row.selected_details_json) : [],
|
|
2635
|
+
candidateCount: Number(row.candidate_count || 0),
|
|
2636
|
+
selectedCount: Number(row.selected_count || 0),
|
|
2637
|
+
confidence: row.confidence || void 0,
|
|
2638
|
+
fallbackTrace: row.fallback_trace ? JSON.parse(row.fallback_trace) : [],
|
|
2639
|
+
createdAt: toDateFromSQLite(row.created_at)
|
|
2640
|
+
}));
|
|
2641
|
+
} catch (err) {
|
|
2642
|
+
if (err?.message?.includes("no such table"))
|
|
2643
|
+
return [];
|
|
2644
|
+
throw err;
|
|
2645
|
+
}
|
|
2640
2646
|
}
|
|
2641
2647
|
async getRetrievalTraceStats() {
|
|
2642
2648
|
await this.initialize();
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2649
|
+
try {
|
|
2650
|
+
const row = sqliteGet(
|
|
2651
|
+
this.db,
|
|
2652
|
+
`SELECT
|
|
2653
|
+
COUNT(*) as total_queries,
|
|
2654
|
+
AVG(candidate_count) as avg_candidate_count,
|
|
2655
|
+
AVG(selected_count) as avg_selected_count,
|
|
2656
|
+
CASE
|
|
2657
|
+
WHEN SUM(candidate_count) > 0 THEN (SUM(selected_count) * 1.0 / SUM(candidate_count))
|
|
2658
|
+
ELSE 0
|
|
2659
|
+
END as selection_rate
|
|
2660
|
+
FROM retrieval_traces`,
|
|
2661
|
+
[]
|
|
2662
|
+
);
|
|
2663
|
+
return {
|
|
2664
|
+
totalQueries: Number(row?.total_queries || 0),
|
|
2665
|
+
avgCandidateCount: Number(row?.avg_candidate_count || 0),
|
|
2666
|
+
avgSelectedCount: Number(row?.avg_selected_count || 0),
|
|
2667
|
+
selectionRate: Number(row?.selection_rate || 0)
|
|
2668
|
+
};
|
|
2669
|
+
} catch (err) {
|
|
2670
|
+
if (err?.message?.includes("no such table")) {
|
|
2671
|
+
return { totalQueries: 0, avgCandidateCount: 0, avgSelectedCount: 0, selectionRate: 0 };
|
|
2672
|
+
}
|
|
2673
|
+
throw err;
|
|
2674
|
+
}
|
|
2662
2675
|
}
|
|
2663
2676
|
/**
|
|
2664
2677
|
* Close database connection
|