claude-memory-layer 1.0.16 → 1.0.18
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/dist/cli/index.js +52 -34
- package/dist/cli/index.js.map +2 -2
- package/dist/hooks/session-start.js +23 -13
- package/dist/hooks/session-start.js.map +2 -2
- package/memory/_index.md +2 -0
- package/memory/agent_response/uncategorized/2026-02-26.md +176 -0
- package/memory/session_summary/uncategorized/2026-02-26.md +13 -0
- package/memory/tool_observation/uncategorized/2026-02-26.md +9 -1
- package/memory/user_prompt/uncategorized/2026-02-26.md +16 -1
- package/package.json +1 -1
- package/src/cli/index.ts +55 -33
- package/src/hooks/session-start.ts +9 -3
|
@@ -5886,6 +5886,10 @@ function registerSession(sessionId, projectPath) {
|
|
|
5886
5886
|
}
|
|
5887
5887
|
saveSessionRegistry(registry);
|
|
5888
5888
|
}
|
|
5889
|
+
function getSessionProject(sessionId) {
|
|
5890
|
+
const registry = loadSessionRegistry();
|
|
5891
|
+
return registry.sessions[sessionId] || null;
|
|
5892
|
+
}
|
|
5889
5893
|
var MemoryService = class {
|
|
5890
5894
|
// Primary store: SQLite (WAL mode) - for hooks, always available
|
|
5891
5895
|
sqliteStore;
|
|
@@ -6934,21 +6938,22 @@ var MemoryService = class {
|
|
|
6934
6938
|
}
|
|
6935
6939
|
};
|
|
6936
6940
|
var serviceCache = /* @__PURE__ */ new Map();
|
|
6937
|
-
function
|
|
6938
|
-
const
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6941
|
+
function getLightweightMemoryService(sessionId) {
|
|
6942
|
+
const projectInfo = getSessionProject(sessionId);
|
|
6943
|
+
const key = projectInfo ? `lightweight_${projectInfo.projectHash}` : "lightweight_global";
|
|
6944
|
+
if (!serviceCache.has(key)) {
|
|
6945
|
+
const storagePath = projectInfo ? getProjectStoragePath(projectInfo.projectPath) : path3.join(os.homedir(), ".claude-code", "memory");
|
|
6946
|
+
serviceCache.set(key, new MemoryService({
|
|
6942
6947
|
storagePath,
|
|
6943
|
-
projectHash:
|
|
6944
|
-
projectPath,
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
analyticsEnabled: false
|
|
6948
|
-
|
|
6948
|
+
projectHash: projectInfo?.projectHash,
|
|
6949
|
+
projectPath: projectInfo?.projectPath,
|
|
6950
|
+
lightweightMode: true,
|
|
6951
|
+
// Skip embedder/vector/workers
|
|
6952
|
+
analyticsEnabled: false,
|
|
6953
|
+
sharedStoreConfig: { enabled: false }
|
|
6949
6954
|
}));
|
|
6950
6955
|
}
|
|
6951
|
-
return serviceCache.get(
|
|
6956
|
+
return serviceCache.get(key);
|
|
6952
6957
|
}
|
|
6953
6958
|
|
|
6954
6959
|
// src/hooks/session-start.ts
|
|
@@ -6956,7 +6961,7 @@ async function main() {
|
|
|
6956
6961
|
const inputData = await readStdin();
|
|
6957
6962
|
const input = JSON.parse(inputData);
|
|
6958
6963
|
registerSession(input.session_id, input.cwd);
|
|
6959
|
-
const memoryService =
|
|
6964
|
+
const memoryService = getLightweightMemoryService(input.session_id);
|
|
6960
6965
|
try {
|
|
6961
6966
|
await memoryService.startSession(input.session_id, input.cwd);
|
|
6962
6967
|
const recentEvents = await memoryService.getRecentEvents(10);
|
|
@@ -6978,6 +6983,11 @@ You have worked on this project before. Here are some relevant memories:
|
|
|
6978
6983
|
} catch (error) {
|
|
6979
6984
|
console.error("Memory hook error:", error);
|
|
6980
6985
|
console.log(JSON.stringify({ context: "" }));
|
|
6986
|
+
} finally {
|
|
6987
|
+
try {
|
|
6988
|
+
await memoryService.close();
|
|
6989
|
+
} catch {
|
|
6990
|
+
}
|
|
6981
6991
|
}
|
|
6982
6992
|
}
|
|
6983
6993
|
function readStdin() {
|