memorix 0.2.0 → 0.2.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.
package/dist/cli/index.js CHANGED
@@ -2547,6 +2547,7 @@ var server_exports = {};
2547
2547
  __export(server_exports, {
2548
2548
  createMemorixServer: () => createMemorixServer
2549
2549
  });
2550
+ import { watch } from "fs";
2550
2551
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2551
2552
  import { z } from "zod";
2552
2553
  async function createMemorixServer(cwd) {
@@ -2561,6 +2562,27 @@ async function createMemorixServer(cwd) {
2561
2562
  }
2562
2563
  console.error(`[memorix] Project: ${project.id} (${project.name})`);
2563
2564
  console.error(`[memorix] Data dir: ${projectDir2}`);
2565
+ const observationsFile = projectDir2 + "/observations.json";
2566
+ let reloadDebounce = null;
2567
+ try {
2568
+ watch(observationsFile, () => {
2569
+ if (reloadDebounce) clearTimeout(reloadDebounce);
2570
+ reloadDebounce = setTimeout(async () => {
2571
+ try {
2572
+ await resetDb();
2573
+ await initObservations(projectDir2);
2574
+ const count2 = await reindexObservations();
2575
+ if (count2 > 0) {
2576
+ console.error(`[memorix] Hot-reloaded ${count2} observations (external write detected)`);
2577
+ }
2578
+ } catch {
2579
+ }
2580
+ }, 500);
2581
+ });
2582
+ console.error(`[memorix] Watching for external writes (hooks hot-reload enabled)`);
2583
+ } catch {
2584
+ console.error(`[memorix] Warning: could not watch observations file for hot-reload`);
2585
+ }
2564
2586
  const server = new McpServer({
2565
2587
  name: "memorix",
2566
2588
  version: "0.1.0"
@@ -3062,6 +3084,7 @@ var init_server = __esm({
3062
3084
  init_esm_shims();
3063
3085
  init_graph();
3064
3086
  init_observations();
3087
+ init_orama_store();
3065
3088
  init_auto_relations();
3066
3089
  init_entity_extractor();
3067
3090
  init_engine();
@@ -3730,9 +3753,12 @@ async function runHook() {
3730
3753
  const { observation, output } = await handleHookEvent(input);
3731
3754
  if (observation) {
3732
3755
  try {
3733
- const { storeObservation: storeObservation2 } = await Promise.resolve().then(() => (init_observations(), observations_exports));
3756
+ const { storeObservation: storeObservation2, initObservations: initObservations2 } = await Promise.resolve().then(() => (init_observations(), observations_exports));
3734
3757
  const { detectProject: detectProject2 } = await Promise.resolve().then(() => (init_detector(), detector_exports));
3758
+ const { getProjectDataDir: getProjectDataDir2 } = await Promise.resolve().then(() => (init_persistence(), persistence_exports));
3735
3759
  const project = await detectProject2(input.cwd || process.cwd());
3760
+ const dataDir = await getProjectDataDir2(project.id);
3761
+ await initObservations2(dataDir);
3736
3762
  await storeObservation2({ ...observation, projectId: project.id });
3737
3763
  } catch {
3738
3764
  }
@@ -3855,7 +3881,7 @@ function getProjectConfigPath(agent, projectRoot) {
3855
3881
  case "copilot":
3856
3882
  return path5.join(projectRoot, ".github", "hooks", "memorix.json");
3857
3883
  case "windsurf":
3858
- return path5.join(projectRoot, ".windsurf", "cascade.json");
3884
+ return path5.join(projectRoot, ".windsurf", "hooks.json");
3859
3885
  case "cursor":
3860
3886
  return path5.join(projectRoot, ".cursor", "hooks.json");
3861
3887
  case "kiro":
@@ -3873,7 +3899,7 @@ function getGlobalConfigPath(agent) {
3873
3899
  case "copilot":
3874
3900
  return path5.join(home, ".claude", "settings.json");
3875
3901
  case "windsurf":
3876
- return path5.join(home, ".codeium", "windsurf", "cascade.json");
3902
+ return path5.join(home, ".codeium", "windsurf", "hooks.json");
3877
3903
  case "cursor":
3878
3904
  return path5.join(home, ".cursor", "hooks.json");
3879
3905
  default: