claude-memory-layer 1.0.17 → 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 CHANGED
@@ -9261,7 +9261,7 @@ function getHooksConfig(pluginPath) {
9261
9261
  };
9262
9262
  }
9263
9263
  var program = new Command();
9264
- program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.17");
9264
+ program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.18");
9265
9265
  program.command("install").description("Install hooks into Claude Code settings").option("--path <path>", "Custom plugin path (defaults to auto-detect)").action(async (options) => {
9266
9266
  try {
9267
9267
  const pluginPath = options.path || getPluginPath();
@@ -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 getMemoryServiceForProject(projectPath, sharedStoreConfig) {
6938
- const hash = hashProjectPath(projectPath);
6939
- if (!serviceCache.has(hash)) {
6940
- const storagePath = getProjectStoragePath(projectPath);
6941
- serviceCache.set(hash, new MemoryService({
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: hash,
6944
- projectPath,
6945
- // Override shared store config - hooks don't need DuckDB
6946
- sharedStoreConfig: sharedStoreConfig ?? { enabled: false },
6947
- analyticsEnabled: false
6948
- // Hooks don't need DuckDB
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(hash);
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 = getMemoryServiceForProject(input.cwd);
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() {