memorix 1.10.1 → 1.10.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cli/index.js +416 -167
  3. package/dist/index.js +232 -106
  4. package/dist/maintenance-runner.js +167 -57
  5. package/dist/media-audio-runner.js +139 -29
  6. package/dist/media-video-runner.js +166 -56
  7. package/dist/memcode-runtime/CHANGELOG.md +14 -0
  8. package/dist/sdk.js +283 -106
  9. package/dist/vector-backfill-runner.js +166 -56
  10. package/docs/DEVELOPMENT.md +3 -4
  11. package/docs/PERFORMANCE.md +23 -0
  12. package/docs/README.md +2 -2
  13. package/docs/ROADMAP-1.9.12-2.0.md +2 -2
  14. package/package.json +1 -1
  15. package/plugins/antigravity/memorix/plugin.json +1 -1
  16. package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
  17. package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
  18. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  19. package/plugins/copilot/memorix/plugin.json +1 -1
  20. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  21. package/plugins/hermes/memorix/__init__.py +1 -2
  22. package/plugins/hermes/memorix/plugin.yaml +1 -1
  23. package/plugins/omp/memorix/package.json +1 -1
  24. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
  25. package/plugins/pi/memorix/package.json +1 -1
  26. package/server.json +2 -2
  27. package/src/cli/commands/repair.ts +17 -3
  28. package/src/compact/index-format.ts +1 -1
  29. package/src/knowledge/context-receipt.ts +6 -3
  30. package/src/memory/observations.ts +7 -5
  31. package/src/search/derived-view-receipt.ts +40 -0
  32. package/src/search/semantic-index.ts +149 -1
  33. package/src/server.ts +18 -3
  34. package/src/store/orama-store.ts +32 -16
package/dist/index.js CHANGED
@@ -7808,6 +7808,7 @@ var init_obs_store = __esm({
7808
7808
 
7809
7809
  // src/search/semantic-index.ts
7810
7810
  import { createHash as createHash4 } from "crypto";
7811
+ import { existsSync as existsSync8 } from "fs";
7811
7812
  import { createRequire as createRequire3 } from "module";
7812
7813
  import path11 from "path";
7813
7814
  function createSemanticIndexProfile(provider2) {
@@ -7906,17 +7907,80 @@ function queueOperation(key, operation) {
7906
7907
  writeQueues.set(key, run.catch(() => void 0));
7907
7908
  return run;
7908
7909
  }
7910
+ function positiveEnvInt(name, fallback) {
7911
+ const value = Number.parseInt(process.env[name] ?? "", 10);
7912
+ return Number.isSafeInteger(value) && value > 0 ? value : fallback;
7913
+ }
7914
+ function semanticWriteBatchSize() {
7915
+ return positiveEnvInt("MEMORIX_SEMANTIC_WRITE_BATCH_SIZE", DEFAULT_WRITE_BATCH_SIZE);
7916
+ }
7917
+ function semanticWriteFlushMs() {
7918
+ return positiveEnvInt("MEMORIX_SEMANTIC_WRITE_FLUSH_MS", DEFAULT_WRITE_FLUSH_MS);
7919
+ }
7920
+ function semanticOptimizeEvery() {
7921
+ return positiveEnvInt("MEMORIX_SEMANTIC_OPTIMIZE_EVERY", DEFAULT_OPTIMIZE_EVERY);
7922
+ }
7923
+ function semanticVersionRetentionMs() {
7924
+ return positiveEnvInt("MEMORIX_SEMANTIC_VERSION_RETENTION_MS", DEFAULT_VERSION_RETENTION_MS);
7925
+ }
7926
+ async function optimizeState(state) {
7927
+ if (!state.table || typeof state.table.optimize !== "function") return;
7928
+ await state.table.optimize({
7929
+ cleanupOlderThan: new Date(Date.now() - semanticVersionRetentionMs()),
7930
+ deleteUnverified: false
7931
+ });
7932
+ }
7909
7933
  async function mergeVectors(dataDir, profile, records) {
7910
7934
  if (records.length === 0) return;
7911
7935
  const state = await getState(dataDir, profile, records);
7912
7936
  if (!state?.table) return;
7913
7937
  const rows = records.map(toLanceRow);
7914
7938
  await state.table.mergeInsert("observation_id").whenMatchedUpdateAll().whenNotMatchedInsertAll().execute(rows);
7939
+ const key = stateKey(dataDir, profile);
7940
+ const mutationCount = (mutationCounts.get(key) ?? 0) + 1;
7941
+ if (mutationCount >= semanticOptimizeEvery()) {
7942
+ mutationCounts.set(key, 0);
7943
+ await optimizeState(state).catch(() => void 0);
7944
+ } else {
7945
+ mutationCounts.set(key, mutationCount);
7946
+ }
7915
7947
  void ensureSemanticIndex(dataDir, profile);
7916
7948
  }
7949
+ function flushPendingVectorBatch(key) {
7950
+ const pending = pendingVectorBatches.get(key);
7951
+ if (!pending) return Promise.resolve();
7952
+ if (pending.timer) clearTimeout(pending.timer);
7953
+ pendingVectorBatches.delete(key);
7954
+ const records = [...pending.records.values()];
7955
+ const waiters = pending.waiters.splice(0);
7956
+ return queueOperation(key, () => mergeVectors(pending.dataDir, pending.profile, records)).then(() => waiters.forEach((waiter) => waiter.resolve())).catch((error) => {
7957
+ waiters.forEach((waiter) => waiter.reject(error));
7958
+ });
7959
+ }
7960
+ function upsertSemanticVector(dataDir, profile, record80) {
7961
+ const key = stateKey(dataDir, profile);
7962
+ let pending = pendingVectorBatches.get(key);
7963
+ if (!pending) {
7964
+ pending = { dataDir, profile, records: /* @__PURE__ */ new Map(), waiters: [] };
7965
+ pendingVectorBatches.set(key, pending);
7966
+ }
7967
+ pending.records.set(`${record80.projectId}:${record80.observationId}`, record80);
7968
+ const promise = new Promise((resolve5, reject) => pending.waiters.push({ resolve: resolve5, reject }));
7969
+ if (pending.records.size >= semanticWriteBatchSize()) void flushPendingVectorBatch(key);
7970
+ else if (!pending.timer) pending.timer = setTimeout(() => {
7971
+ void flushPendingVectorBatch(key);
7972
+ }, semanticWriteFlushMs());
7973
+ return promise;
7974
+ }
7917
7975
  function upsertSemanticVectors(dataDir, profile, records) {
7918
7976
  return queueOperation(stateKey(dataDir, profile), () => mergeVectors(dataDir, profile, records));
7919
7977
  }
7978
+ async function listSemanticVectorIds(dataDir, profile) {
7979
+ const state = await getState(dataDir, profile);
7980
+ if (!state?.table) return null;
7981
+ const rows = await state.table.query().select(["observation_id"]).toArray();
7982
+ return new Set(rows.map((row) => Number(row.observation_id)).filter(Number.isSafeInteger));
7983
+ }
7920
7984
  function resolveIndexThreshold() {
7921
7985
  const raw = Number.parseInt(process.env.MEMORIX_SEMANTIC_INDEX_THRESHOLD ?? "", 10);
7922
7986
  return Number.isSafeInteger(raw) && raw > 0 ? raw : DEFAULT_INDEX_THRESHOLD;
@@ -7968,7 +8032,7 @@ async function searchSemanticVectors(options) {
7968
8032
  distance: Number(row._distance ?? Number.POSITIVE_INFINITY)
7969
8033
  })).filter((row) => Number.isFinite(row.distance));
7970
8034
  }
7971
- var SEMANTIC_INDEX_DIR, TABLE_PREFIX, DEFAULT_INDEX_THRESHOLD, MAX_INDEX_PARTITIONS, statePromises, writeQueues, indexBuilds, availability, requireFromHere2;
8035
+ var SEMANTIC_INDEX_DIR, TABLE_PREFIX, DEFAULT_INDEX_THRESHOLD, MAX_INDEX_PARTITIONS, DEFAULT_WRITE_BATCH_SIZE, DEFAULT_WRITE_FLUSH_MS, DEFAULT_OPTIMIZE_EVERY, DEFAULT_VERSION_RETENTION_MS, statePromises, writeQueues, indexBuilds, mutationCounts, pendingVectorBatches, availability, requireFromHere2;
7972
8036
  var init_semantic_index = __esm({
7973
8037
  "src/search/semantic-index.ts"() {
7974
8038
  "use strict";
@@ -7977,13 +8041,84 @@ var init_semantic_index = __esm({
7977
8041
  TABLE_PREFIX = "observations_";
7978
8042
  DEFAULT_INDEX_THRESHOLD = 1e4;
7979
8043
  MAX_INDEX_PARTITIONS = 32;
8044
+ DEFAULT_WRITE_BATCH_SIZE = 100;
8045
+ DEFAULT_WRITE_FLUSH_MS = 50;
8046
+ DEFAULT_OPTIMIZE_EVERY = 20;
8047
+ DEFAULT_VERSION_RETENTION_MS = 24 * 60 * 60 * 1e3;
7980
8048
  statePromises = /* @__PURE__ */ new Map();
7981
8049
  writeQueues = /* @__PURE__ */ new Map();
7982
8050
  indexBuilds = /* @__PURE__ */ new Map();
8051
+ mutationCounts = /* @__PURE__ */ new Map();
8052
+ pendingVectorBatches = /* @__PURE__ */ new Map();
7983
8053
  requireFromHere2 = createRequire3(import.meta.url);
7984
8054
  }
7985
8055
  });
7986
8056
 
8057
+ // src/memory/secret-filter.ts
8058
+ function applyRedaction(text3) {
8059
+ if (!text3) return text3;
8060
+ let out = text3;
8061
+ out = out.replace(
8062
+ /((?:password|passwd|pwd|secret|token|api[_-]?key|auth[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret)\s*[:=]\s*["']?)([^\s"',;\n]{6,})/gi,
8063
+ "$1[REDACTED]"
8064
+ );
8065
+ out = out.replace(
8066
+ /(Bearer\s+)([A-Za-z0-9._\-/+]{20,})/g,
8067
+ "$1[REDACTED]"
8068
+ );
8069
+ out = out.replace(/\b(?:ghp|ghs|gho|github_pat)_[A-Za-z0-9]{36,}\b/g, "[REDACTED]");
8070
+ out = out.replace(/\bsk-[A-Za-z0-9T-]{20,}\b/g, "[REDACTED]");
8071
+ out = out.replace(/\beyJ[A-Za-z0-9._-]{40,}\b/g, "[REDACTED]");
8072
+ return out;
8073
+ }
8074
+ function sanitizeCredentials(text3) {
8075
+ return applyRedaction(text3);
8076
+ }
8077
+ function redactCredentials(text3) {
8078
+ return applyRedaction(text3);
8079
+ }
8080
+ var init_secret_filter = __esm({
8081
+ "src/memory/secret-filter.ts"() {
8082
+ "use strict";
8083
+ init_esm_shims();
8084
+ }
8085
+ });
8086
+
8087
+ // src/search/derived-view-receipt.ts
8088
+ function sanitizeDerivedViewFailureReason(reason) {
8089
+ const safe = sanitizeCredentials(reason).replace(/(?:[A-Za-z]:[\\/]|\\\\[^\\/\s]+[\\/]|\/(?:home|Users|tmp|var|private|mnt|workspace|workspaces)\/)[^\s"'<>|]*/gi, "[path]").replace(/\s+/g, " ").trim();
8090
+ return safe.slice(0, 240) || "derived view failed";
8091
+ }
8092
+ function embeddingHealthReceipt(health, embeddingEnabled2) {
8093
+ if (health?.status === "disabled") {
8094
+ return { freshness: "current", rebuildStatus: "disabled" };
8095
+ }
8096
+ if (health?.status === "ready" || embeddingEnabled2) {
8097
+ return { freshness: "current", rebuildStatus: "idle" };
8098
+ }
8099
+ if (health?.status === "degraded") {
8100
+ return {
8101
+ freshness: "stale",
8102
+ rebuildStatus: "failed",
8103
+ ...health.failure ? {
8104
+ failureReason: `embedding ${health.failure.kind}; retry in ${health.failure.retryAfterMs}ms`
8105
+ } : { failureReason: "embedding provider degraded" }
8106
+ };
8107
+ }
8108
+ return {
8109
+ freshness: "unknown",
8110
+ rebuildStatus: "unavailable",
8111
+ failureReason: "embedding provider is not initialized"
8112
+ };
8113
+ }
8114
+ var init_derived_view_receipt = __esm({
8115
+ "src/search/derived-view-receipt.ts"() {
8116
+ "use strict";
8117
+ init_esm_shims();
8118
+ init_secret_filter();
8119
+ }
8120
+ });
8121
+
7987
8122
  // src/project/aliases.ts
7988
8123
  var aliases_exports = {};
7989
8124
  __export(aliases_exports, {
@@ -8592,6 +8727,7 @@ __export(orama_store_exports, {
8592
8727
  getLastSearchMode: () => getLastSearchMode,
8593
8728
  getObservationCount: () => getObservationCount,
8594
8729
  getObservationsByIds: () => getObservationsByIds,
8730
+ getPersistentSemanticVectorIds: () => getPersistentSemanticVectorIds,
8595
8731
  getSearchDerivedViews: () => getSearchDerivedViews,
8596
8732
  getTimeline: () => getTimeline,
8597
8733
  getVectorDimensions: () => getVectorDimensions,
@@ -8636,14 +8772,16 @@ function getSearchDerivedViews() {
8636
8772
  generation,
8637
8773
  freshness: "unknown",
8638
8774
  rebuildStatus: "unavailable",
8639
- failureReason: store.getBackendReason?.() ?? "persistent lexical index unavailable"
8775
+ failureReason: sanitizeDerivedViewFailureReason(
8776
+ store.getBackendReason?.() ?? "persistent lexical index unavailable"
8777
+ )
8640
8778
  };
8641
8779
  }
8642
8780
  } catch (error) {
8643
8781
  views.fts = {
8644
8782
  freshness: "unknown",
8645
8783
  rebuildStatus: "failed",
8646
- failureReason: error instanceof Error ? error.message.slice(0, 240) : String(error).slice(0, 240)
8784
+ failureReason: sanitizeDerivedViewFailureReason(error instanceof Error ? error.message : String(error))
8647
8785
  };
8648
8786
  }
8649
8787
  } else {
@@ -8659,18 +8797,12 @@ function getSearchDerivedViews() {
8659
8797
  rebuildStatus: "unavailable",
8660
8798
  failureReason: "Orama index is not initialized"
8661
8799
  };
8662
- const configuredEmbeddingMode = process.env.MEMORIX_EMBEDDING?.trim().toLowerCase();
8663
- if (configuredEmbeddingMode === "off") {
8664
- views.embedding = { freshness: "current", rebuildStatus: "disabled" };
8665
- } else if (embeddingEnabled) {
8666
- views.embedding = { freshness: "current", rebuildStatus: "idle" };
8667
- } else {
8668
- views.embedding = {
8669
- freshness: "unknown",
8670
- rebuildStatus: "unavailable",
8671
- failureReason: "embedding provider is not initialized"
8672
- };
8800
+ let embeddingHealth;
8801
+ try {
8802
+ embeddingHealth = getEmbeddingRuntimeHealth?.();
8803
+ } catch {
8673
8804
  }
8805
+ views.embedding = embeddingHealthReceipt(embeddingHealth, embeddingEnabled);
8674
8806
  return views;
8675
8807
  }
8676
8808
  function rememberSearchDiagnostics(key, value) {
@@ -8974,12 +9106,16 @@ function getVectorDimensions() {
8974
9106
  function getActiveSemanticIndexProfile() {
8975
9107
  return indexEmbeddingProvider ? createSemanticIndexProfile(indexEmbeddingProvider) : null;
8976
9108
  }
9109
+ async function getPersistentSemanticVectorIds(dataDir) {
9110
+ if (!indexEmbeddingProvider) return null;
9111
+ return listSemanticVectorIds(dataDir, createSemanticIndexProfile(indexEmbeddingProvider));
9112
+ }
8977
9113
  async function queueSemanticVector(dataDir, record80) {
8978
9114
  const provider2 = indexEmbeddingProvider ?? await getEmbeddingProvider();
8979
9115
  const profile = provider2 ? createSemanticIndexProfile(provider2) : null;
8980
9116
  if (!profile) return;
8981
9117
  try {
8982
- await upsertSemanticVectors(dataDir, profile, [record80]);
9118
+ await upsertSemanticVector(dataDir, profile, record80);
8983
9119
  } catch {
8984
9120
  }
8985
9121
  }
@@ -9041,6 +9177,7 @@ function isCompatibleCachedVector(vector) {
9041
9177
  async function attachCachedVectors(database, observations2) {
9042
9178
  const semanticDataDir = (await Promise.resolve().then(() => (init_observations(), observations_exports))).getObservationDataDir();
9043
9179
  const semanticProfile = getActiveSemanticIndexProfile();
9180
+ const persistedSemanticIds = semanticDataDir && semanticProfile ? await listSemanticVectorIds(semanticDataDir, semanticProfile).catch(() => null) : null;
9044
9181
  const batchSize = 200;
9045
9182
  for (let start = 0; start < observations2.length; start += batchSize) {
9046
9183
  const batch = observations2.slice(start, start + batchSize);
@@ -9051,7 +9188,7 @@ async function attachCachedVectors(database, observations2) {
9051
9188
  const vector = cachedVectors[index];
9052
9189
  if (!isCompatibleCachedVector(vector)) continue;
9053
9190
  const observation = batch[index];
9054
- if (semanticDataDir && semanticProfile) {
9191
+ if (semanticDataDir && semanticProfile && !persistedSemanticIds?.has(observation.id)) {
9055
9192
  semanticRecords.push({
9056
9193
  observationId: observation.id,
9057
9194
  projectId: observation.projectId,
@@ -9824,6 +9961,7 @@ var init_orama_store = __esm({
9824
9961
  init_mini_skills();
9825
9962
  init_visibility();
9826
9963
  init_provider();
9964
+ init_provider();
9827
9965
  init_project_affinity();
9828
9966
  init_intent_detector();
9829
9967
  init_query_expansion();
@@ -9831,6 +9969,7 @@ var init_orama_store = __esm({
9831
9969
  init_timeout();
9832
9970
  init_obs_store();
9833
9971
  init_semantic_index();
9972
+ init_derived_view_receipt();
9834
9973
  db = null;
9835
9974
  dbInitPromise = null;
9836
9975
  dbGeneration = 0;
@@ -9955,36 +10094,6 @@ var init_entity_extractor = __esm({
9955
10094
  }
9956
10095
  });
9957
10096
 
9958
- // src/memory/secret-filter.ts
9959
- function applyRedaction(text3) {
9960
- if (!text3) return text3;
9961
- let out = text3;
9962
- out = out.replace(
9963
- /((?:password|passwd|pwd|secret|token|api[_-]?key|auth[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret)\s*[:=]\s*["']?)([^\s"',;\n]{6,})/gi,
9964
- "$1[REDACTED]"
9965
- );
9966
- out = out.replace(
9967
- /(Bearer\s+)([A-Za-z0-9._\-/+]{20,})/g,
9968
- "$1[REDACTED]"
9969
- );
9970
- out = out.replace(/\b(?:ghp|ghs|gho|github_pat)_[A-Za-z0-9]{36,}\b/g, "[REDACTED]");
9971
- out = out.replace(/\bsk-[A-Za-z0-9T-]{20,}\b/g, "[REDACTED]");
9972
- out = out.replace(/\beyJ[A-Za-z0-9._-]{40,}\b/g, "[REDACTED]");
9973
- return out;
9974
- }
9975
- function sanitizeCredentials(text3) {
9976
- return applyRedaction(text3);
9977
- }
9978
- function redactCredentials(text3) {
9979
- return applyRedaction(text3);
9980
- }
9981
- var init_secret_filter = __esm({
9982
- "src/memory/secret-filter.ts"() {
9983
- "use strict";
9984
- init_esm_shims();
9985
- }
9986
- });
9987
-
9988
10097
  // src/runtime/maintenance-jobs.ts
9989
10098
  var maintenance_jobs_exports = {};
9990
10099
  __export(maintenance_jobs_exports, {
@@ -10835,7 +10944,7 @@ var init_maintenance_targets = __esm({
10835
10944
 
10836
10945
  // src/runtime/isolated-maintenance.ts
10837
10946
  import { spawn } from "child_process";
10838
- import { existsSync as existsSync8 } from "fs";
10947
+ import { existsSync as existsSync9 } from "fs";
10839
10948
  import os4 from "os";
10840
10949
  import path13 from "path";
10841
10950
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -10853,7 +10962,7 @@ function childError(prefix, detail) {
10853
10962
  }
10854
10963
  function isolatedMaintenanceCwd() {
10855
10964
  const tmp = os4.tmpdir();
10856
- return existsSync8(tmp) ? tmp : process.cwd();
10965
+ return existsSync9(tmp) ? tmp : process.cwd();
10857
10966
  }
10858
10967
  function resolveMaintenanceRunnerPath(moduleUrl = import.meta.url) {
10859
10968
  const moduleDir = path13.dirname(fileURLToPath2(moduleUrl));
@@ -10910,7 +11019,7 @@ function collectOutput(stream2, limit2, onOverflow) {
10910
11019
  async function runMaintenanceInChildProcess(request, options = {}) {
10911
11020
  validateRequest(request);
10912
11021
  const runnerPath = options.runnerPath ?? resolveMaintenanceRunnerPath();
10913
- if (!existsSync8(runnerPath)) {
11022
+ if (!existsSync9(runnerPath)) {
10914
11023
  throw new Error(`Maintenance runner is unavailable at ${runnerPath}. Reinstall or rebuild Memorix.`);
10915
11024
  }
10916
11025
  const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1e3, Math.floor(options.timeoutMs)) : DEFAULT_TIMEOUT_MS;
@@ -146065,7 +146174,7 @@ __export(video_jobs_exports, {
146065
146174
  runMiniMaxVideoGenerationJob: () => runMiniMaxVideoGenerationJob
146066
146175
  });
146067
146176
  import { spawn as spawn2 } from "child_process";
146068
- import { existsSync as existsSync9 } from "fs";
146177
+ import { existsSync as existsSync10 } from "fs";
146069
146178
  import path19 from "path";
146070
146179
  import { fileURLToPath as fileURLToPath3 } from "url";
146071
146180
  function safeError2(error) {
@@ -146313,7 +146422,7 @@ function resolveMediaVideoRunnerPath(moduleUrl = import.meta.url) {
146313
146422
  }
146314
146423
  function launchMediaVideoRunner(request, options = {}) {
146315
146424
  const runnerPath = options.runnerPath ?? resolveMediaVideoRunnerPath();
146316
- if (!existsSync9(runnerPath)) {
146425
+ if (!existsSync10(runnerPath)) {
146317
146426
  return { launched: false, reason: "Media video runner is unavailable until Memorix is built or reinstalled." };
146318
146427
  }
146319
146428
  try {
@@ -146358,7 +146467,7 @@ __export(audio_jobs_exports, {
146358
146467
  transcribeAudio: () => transcribeAudio
146359
146468
  });
146360
146469
  import { spawn as spawn3 } from "child_process";
146361
- import { existsSync as existsSync10 } from "fs";
146470
+ import { existsSync as existsSync11 } from "fs";
146362
146471
  import path20 from "path";
146363
146472
  import { fileURLToPath as fileURLToPath4 } from "url";
146364
146473
  function safeError3(error) {
@@ -146609,7 +146718,7 @@ function resolveMediaAudioRunnerPath(moduleUrl = import.meta.url) {
146609
146718
  }
146610
146719
  function launchMediaAudioRunner(request, options = {}) {
146611
146720
  const runnerPath = options.runnerPath ?? resolveMediaAudioRunnerPath();
146612
- if (!existsSync10(runnerPath)) return { launched: false, reason: "Audio runner is unavailable until Memorix is built or reinstalled." };
146721
+ if (!existsSync11(runnerPath)) return { launched: false, reason: "Audio runner is unavailable until Memorix is built or reinstalled." };
146613
146722
  try {
146614
146723
  const child = spawn3(process.execPath, [runnerPath, JSON.stringify(request)], {
146615
146724
  cwd: request.projectRoot,
@@ -149578,7 +149687,7 @@ __export(lite_provider_exports, {
149578
149687
  refreshProjectLite: () => refreshProjectLite
149579
149688
  });
149580
149689
  import { createHash as createHash11 } from "crypto";
149581
- import { existsSync as existsSync12, readdirSync as readdirSync2, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
149690
+ import { existsSync as existsSync13, readdirSync as readdirSync2, readFileSync as readFileSync8, statSync as statSync3 } from "fs";
149582
149691
  import { join as join4, relative as relative2 } from "path";
149583
149692
  function hashText2(text3) {
149584
149693
  return createHash11("sha256").update(text3).digest("hex");
@@ -149596,7 +149705,7 @@ function resolveMaxFileBytes(value) {
149596
149705
  return Math.max(1, Math.floor(value));
149597
149706
  }
149598
149707
  function isPythonVirtualenvDir(dir) {
149599
- return existsSync12(join4(dir, "pyvenv.cfg"));
149708
+ return existsSync13(join4(dir, "pyvenv.cfg"));
149600
149709
  }
149601
149710
  function walk(root, exclude, maxFiles) {
149602
149711
  const out = [];
@@ -153512,7 +153621,7 @@ __export(vector_backfill_runner_exports, {
153512
153621
  import { spawn as spawn4 } from "child_process";
153513
153622
  import {
153514
153623
  closeSync,
153515
- existsSync as existsSync13,
153624
+ existsSync as existsSync14,
153516
153625
  mkdirSync as mkdirSync2,
153517
153626
  openSync,
153518
153627
  readFileSync as readFileSync9,
@@ -153640,7 +153749,7 @@ function releaseVectorBackfillLock(lockPath = process.env.MEMORIX_VECTOR_BACKFIL
153640
153749
  }
153641
153750
  function launchDetachedVectorBackfill(request, options = {}) {
153642
153751
  const runnerPath = options.runnerPath ?? resolveVectorBackfillRunnerPath();
153643
- const exists = options.exists ?? existsSync13;
153752
+ const exists = options.exists ?? existsSync14;
153644
153753
  if (!exists(runnerPath)) return false;
153645
153754
  const lock = acquireVectorBackfillLock(request.dataDir, request.projectId, options.lockPath);
153646
153755
  if (!lock) return false;
@@ -154659,13 +154768,14 @@ async function prepareSearchIndex(options = {}) {
154659
154768
  return 0;
154660
154769
  }
154661
154770
  const hydratedProjectDir = projectDir;
154662
- const queueMissingVectors = () => {
154663
- if (projectDir !== hydratedProjectDir) return;
154771
+ const queueMissingVectors = async () => {
154772
+ if (!hydratedProjectDir || projectDir !== hydratedProjectDir) return;
154664
154773
  vectorMissingIds.clear();
154665
154774
  if (!isEmbeddingExplicitlyDisabled()) {
154775
+ const persistedSemanticIds = await getPersistentSemanticVectorIds(hydratedProjectDir).catch(() => null);
154666
154776
  const projectsWithMissingVectors = /* @__PURE__ */ new Set();
154667
154777
  for (const obs of observations) {
154668
- if (!hasObservationVector(obs.projectId, obs.id)) {
154778
+ if (!hasObservationVector(obs.projectId, obs.id) && !persistedSemanticIds?.has(obs.id)) {
154669
154779
  vectorMissingIds.add(obs.id);
154670
154780
  projectsWithMissingVectors.add(obs.projectId);
154671
154781
  }
@@ -154675,9 +154785,9 @@ async function prepareSearchIndex(options = {}) {
154675
154785
  };
154676
154786
  const cacheHydration = getDeferredCachedVectorHydration();
154677
154787
  if (cacheHydration) {
154678
- void cacheHydration.finally(queueMissingVectors);
154788
+ void cacheHydration.then(queueMissingVectors, queueMissingVectors).catch(() => void 0);
154679
154789
  } else {
154680
- queueMissingVectors();
154790
+ await queueMissingVectors();
154681
154791
  }
154682
154792
  searchIndexPrepared = true;
154683
154793
  return count2;
@@ -158614,7 +158724,7 @@ var init_sanitizer = __esm({
158614
158724
  });
158615
158725
 
158616
158726
  // src/workspace/applier.ts
158617
- import { existsSync as existsSync14, mkdirSync as mkdirSync3, copyFileSync, writeFileSync as writeFileSync3, unlinkSync as unlinkSync2, renameSync } from "fs";
158727
+ import { existsSync as existsSync15, mkdirSync as mkdirSync3, copyFileSync, writeFileSync as writeFileSync3, unlinkSync as unlinkSync2, renameSync } from "fs";
158618
158728
  import { dirname } from "path";
158619
158729
  var WorkspaceSyncApplier;
158620
158730
  var init_applier = __esm({
@@ -158645,7 +158755,7 @@ var init_applier = __esm({
158645
158755
  for (const file of files) {
158646
158756
  try {
158647
158757
  const dir = dirname(file.filePath);
158648
- if (!existsSync14(dir)) {
158758
+ if (!existsSync15(dir)) {
158649
158759
  mkdirSync3(dir, { recursive: true });
158650
158760
  }
158651
158761
  } catch (err) {
@@ -158654,7 +158764,7 @@ var init_applier = __esm({
158654
158764
  }
158655
158765
  }
158656
158766
  for (const file of files) {
158657
- if (existsSync14(file.filePath)) {
158767
+ if (existsSync15(file.filePath)) {
158658
158768
  try {
158659
158769
  const backupPath = file.filePath + `.backup-${Date.now()}`;
158660
158770
  copyFileSync(file.filePath, backupPath);
@@ -158705,7 +158815,7 @@ var init_applier = __esm({
158705
158815
  cleanBackups(backups) {
158706
158816
  for (const backup of backups) {
158707
158817
  try {
158708
- if (existsSync14(backup.backupPath)) {
158818
+ if (existsSync15(backup.backupPath)) {
158709
158819
  unlinkSync2(backup.backupPath);
158710
158820
  }
158711
158821
  } catch {
@@ -158717,7 +158827,7 @@ var init_applier = __esm({
158717
158827
  });
158718
158828
 
158719
158829
  // src/workspace/engine.ts
158720
- import { readFileSync as readFileSync10, readdirSync as readdirSync3, existsSync as existsSync15, cpSync, mkdirSync as mkdirSync4 } from "fs";
158830
+ import { readFileSync as readFileSync10, readdirSync as readdirSync3, existsSync as existsSync16, cpSync, mkdirSync as mkdirSync4 } from "fs";
158721
158831
  import { join as join19 } from "path";
158722
158832
  import { homedir as homedir21 } from "os";
158723
158833
  var WorkspaceSyncEngine;
@@ -158797,7 +158907,7 @@ var init_engine4 = __esm({
158797
158907
  }
158798
158908
  const merged = /* @__PURE__ */ new Map();
158799
158909
  for (const path38 of pathsToCheck) {
158800
- if (existsSync15(path38)) {
158910
+ if (existsSync16(path38)) {
158801
158911
  try {
158802
158912
  const content = readFileSync10(path38, "utf-8");
158803
158913
  const servers = adapter.parse(content);
@@ -158851,7 +158961,7 @@ var init_engine4 = __esm({
158851
158961
  const adapter = this.adapters.get(target);
158852
158962
  const configPath = adapter.getConfigPath(this.projectRoot);
158853
158963
  let configContent;
158854
- if (target === "antigravity" && existsSync15(configPath)) {
158964
+ if (target === "antigravity" && existsSync16(configPath)) {
158855
158965
  try {
158856
158966
  const existing = JSON.parse(readFileSync10(configPath, "utf-8"));
158857
158967
  const generated = JSON.parse(adapter.generate(result.mcpServers.scanned));
@@ -158927,13 +159037,13 @@ var init_engine4 = __esm({
158927
159037
  join19(home, dir)
158928
159038
  ];
158929
159039
  for (const skillsRoot of paths) {
158930
- if (!existsSync15(skillsRoot)) continue;
159040
+ if (!existsSync16(skillsRoot)) continue;
158931
159041
  try {
158932
159042
  const entries = readdirSync3(skillsRoot, { withFileTypes: true });
158933
159043
  for (const entry of entries) {
158934
159044
  if (!entry.isDirectory()) continue;
158935
159045
  const skillMd = join19(skillsRoot, entry.name, "SKILL.md");
158936
- if (!existsSync15(skillMd)) continue;
159046
+ if (!existsSync16(skillMd)) continue;
158937
159047
  let description = "";
158938
159048
  try {
158939
159049
  const content = readFileSync10(skillMd, "utf-8");
@@ -158982,7 +159092,7 @@ var init_engine4 = __esm({
158982
159092
  for (const skill2 of skills) {
158983
159093
  if (skill2.sourceAgent === target) continue;
158984
159094
  const dest = join19(targetDir, skill2.name);
158985
- if (existsSync15(dest)) {
159095
+ if (existsSync16(dest)) {
158986
159096
  skipped.push(`${skill2.name} (already exists in ${target})`);
158987
159097
  continue;
158988
159098
  }
@@ -158998,7 +159108,7 @@ var init_engine4 = __esm({
158998
159108
  scanWorkflows() {
158999
159109
  const workflows = [];
159000
159110
  const wfDir = join19(this.projectRoot, ".windsurf", "workflows");
159001
- if (!existsSync15(wfDir)) return workflows;
159111
+ if (!existsSync16(wfDir)) return workflows;
159002
159112
  try {
159003
159113
  const files = readdirSync3(wfDir).filter((f3) => f3.endsWith(".md"));
159004
159114
  for (const file of files) {
@@ -160444,7 +160554,7 @@ var init_request_context = __esm({
160444
160554
  function getMcpServerInfo() {
160445
160555
  return {
160446
160556
  name: "memorix",
160447
- version: true ? "1.10.1" : "1.0.1"
160557
+ version: true ? "1.10.2" : "1.0.1"
160448
160558
  };
160449
160559
  }
160450
160560
  function createMcpDiscoverResult(capabilities, serverInfo) {
@@ -160512,7 +160622,7 @@ __export(behavior_exports, {
160512
160622
  getBehaviorConfig: () => getBehaviorConfig,
160513
160623
  resetBehaviorConfigCache: () => resetBehaviorConfigCache
160514
160624
  });
160515
- import { existsSync as existsSync16, readFileSync as readFileSync11 } from "fs";
160625
+ import { existsSync as existsSync17, readFileSync as readFileSync11 } from "fs";
160516
160626
  import { homedir as homedir22 } from "os";
160517
160627
  function isSessionInject(value) {
160518
160628
  return value === "full" || value === "minimal" || value === "silent";
@@ -160523,7 +160633,7 @@ function isFormationMode(value) {
160523
160633
  function legacyBehavior(homeDir) {
160524
160634
  const configPath = getLegacyConfigJsonPath(homeDir);
160525
160635
  try {
160526
- if (!existsSync16(configPath)) return {};
160636
+ if (!existsSync17(configPath)) return {};
160527
160637
  const parsed = JSON.parse(readFileSync11(configPath, "utf-8"));
160528
160638
  return parsed.behavior && typeof parsed.behavior === "object" && !Array.isArray(parsed.behavior) ? parsed.behavior : {};
160529
160639
  } catch {
@@ -161969,11 +162079,11 @@ __export(current_facts_exports, {
161969
162079
  formatGitFact: () => formatGitFact
161970
162080
  });
161971
162081
  import { execFileSync } from "child_process";
161972
- import { existsSync as existsSync17, readFileSync as readFileSync12 } from "fs";
162082
+ import { existsSync as existsSync18, readFileSync as readFileSync12 } from "fs";
161973
162083
  import path29 from "path";
161974
162084
  function readTextIfExists(filePath) {
161975
162085
  try {
161976
- if (!existsSync17(filePath)) return null;
162086
+ if (!existsSync18(filePath)) return null;
161977
162087
  return readFileSync12(filePath, "utf8");
161978
162088
  } catch {
161979
162089
  return null;
@@ -162264,7 +162374,7 @@ __export(external_provider_exports, {
162264
162374
  runExternalCodeGraphLifecycle: () => runExternalCodeGraphLifecycle
162265
162375
  });
162266
162376
  import { spawn as spawn5 } from "child_process";
162267
- import { existsSync as existsSync18, readFileSync as readFileSync13 } from "fs";
162377
+ import { existsSync as existsSync19, readFileSync as readFileSync13 } from "fs";
162268
162378
  import { delimiter, dirname as dirname2, extname, isAbsolute as isAbsolute3, join as join20, relative as relative4, resolve as resolve3, sep } from "path";
162269
162379
  function boundedTimeout(value) {
162270
162380
  if (!Number.isFinite(value)) return DEFAULT_EXTERNAL_CODEGRAPH_TIMEOUT_MS;
@@ -162301,13 +162411,13 @@ function resolveCommandCandidates(command) {
162301
162411
  }
162302
162412
  function resolveLaunch(command) {
162303
162413
  for (const candidate of resolveCommandCandidates(command)) {
162304
- if (!existsSync18(candidate)) continue;
162414
+ if (!existsSync19(candidate)) continue;
162305
162415
  const extension3 = extname(candidate).toLowerCase();
162306
162416
  if (extension3 === ".cmd") {
162307
162417
  const bundleRoot = resolve3(dirname2(candidate), "..");
162308
162418
  const node = join20(bundleRoot, "node.exe");
162309
162419
  const entry = join20(bundleRoot, "lib", "dist", "bin", "codegraph.js");
162310
- if (existsSync18(node) && existsSync18(entry)) {
162420
+ if (existsSync19(node) && existsSync19(entry)) {
162311
162421
  return { executable: node, prefixArgs: ["--liftoff-only", entry] };
162312
162422
  }
162313
162423
  try {
@@ -162316,7 +162426,7 @@ function resolveLaunch(command) {
162316
162426
  if (match2?.[1]) {
162317
162427
  const base = dirname2(candidate).endsWith(sep) ? dirname2(candidate) : dirname2(candidate) + sep;
162318
162428
  const entry2 = resolve3(match2[1].replace(/%(?:~)?dp0%?/gi, base));
162319
- if (existsSync18(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
162429
+ if (existsSync19(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
162320
162430
  }
162321
162431
  } catch {
162322
162432
  }
@@ -162464,7 +162574,7 @@ async function inspectExternalCodeGraph(input) {
162464
162574
  const health2 = { state: "disabled", reason: "External CodeGraph is disabled by configuration." };
162465
162575
  return { health: health2, quality: providerQuality({ mode, health: health2 }) };
162466
162576
  }
162467
- if (!existsSync18(join20(input.projectRoot, ".codegraph"))) {
162577
+ if (!existsSync19(join20(input.projectRoot, ".codegraph"))) {
162468
162578
  const health2 = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
162469
162579
  return { health: health2, quality: providerQuality({ mode, health: health2 }) };
162470
162580
  }
@@ -162500,7 +162610,7 @@ async function runExternalCodeGraphLifecycle(input) {
162500
162610
  };
162501
162611
  }
162502
162612
  const indexPath = join20(input.projectRoot, ".codegraph");
162503
- if (input.action === "sync" && !existsSync18(indexPath)) {
162613
+ if (input.action === "sync" && !existsSync19(indexPath)) {
162504
162614
  const health = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
162505
162615
  return {
162506
162616
  action: input.action,
@@ -162510,7 +162620,7 @@ async function runExternalCodeGraphLifecycle(input) {
162510
162620
  quality: providerQuality({ mode, health })
162511
162621
  };
162512
162622
  }
162513
- if (input.action === "init" && existsSync18(indexPath)) {
162623
+ if (input.action === "init" && existsSync19(indexPath)) {
162514
162624
  const inspected2 = await inspectExternalCodeGraph(input);
162515
162625
  return {
162516
162626
  action: input.action,
@@ -163272,13 +163382,13 @@ function buildCodeGraphDerivedView(input) {
163272
163382
  ...snapshot.sourceEpoch !== void 0 ? { generation: snapshot.sourceEpoch } : {},
163273
163383
  freshness: snapshot.incomplete ? "stale" : "current",
163274
163384
  rebuildStatus: snapshot.incomplete ? "failed" : "idle",
163275
- ...snapshot.incomplete ? { failureReason: "latest CodeGraph snapshot is incomplete" } : externalFailure && provider2?.external.reason ? { failureReason: provider2.external.reason.slice(0, 240) } : {}
163385
+ ...snapshot.incomplete ? { failureReason: "latest CodeGraph snapshot is incomplete" } : externalFailure && provider2?.external.reason ? { failureReason: sanitizeDerivedViewFailureReason(provider2.external.reason) } : {}
163276
163386
  };
163277
163387
  }
163278
163388
  return {
163279
163389
  freshness: "unknown",
163280
163390
  rebuildStatus: externalFailure ? "failed" : "unavailable",
163281
- ...provider2?.external.reason ? { failureReason: provider2.external.reason.slice(0, 240) } : { failureReason: "CodeGraph snapshot is not initialized" }
163391
+ ...provider2?.external.reason ? { failureReason: sanitizeDerivedViewFailureReason(provider2.external.reason) } : { failureReason: "CodeGraph snapshot is not initialized" }
163282
163392
  };
163283
163393
  }
163284
163394
  function buildBoundedContextReceipt(input) {
@@ -163308,6 +163418,7 @@ var init_context_receipt = __esm({
163308
163418
  "src/knowledge/context-receipt.ts"() {
163309
163419
  "use strict";
163310
163420
  init_esm_shims();
163421
+ init_derived_view_receipt();
163311
163422
  }
163312
163423
  });
163313
163424
 
@@ -163924,7 +164035,7 @@ __export(auto_context_exports, {
163924
164035
  formatAutoProjectContextSummary: () => formatAutoProjectContextSummary,
163925
164036
  formatLegacyAutoProjectContextPrompt: () => formatLegacyAutoProjectContextPrompt
163926
164037
  });
163927
- import { existsSync as existsSync19, statSync as statSync5 } from "fs";
164038
+ import { existsSync as existsSync20, statSync as statSync5 } from "fs";
163928
164039
  import path30 from "path";
163929
164040
  function activeProjectObservations(observations2, projectId) {
163930
164041
  return observations2.filter((obs) => obs.projectId === projectId && (obs.status ?? "active") === "active");
@@ -164299,7 +164410,7 @@ function existingLensCandidates(rootPath, lens) {
164299
164410
  for (const candidate of lensPathCandidates(lens)) {
164300
164411
  const absolute = path30.join(rootPath, candidate);
164301
164412
  try {
164302
- if (!existsSync19(absolute)) continue;
164413
+ if (!existsSync20(absolute)) continue;
164303
164414
  const stat5 = statSync5(absolute);
164304
164415
  if (stat5.isFile()) out.push(candidate);
164305
164416
  if (stat5.isDirectory()) out.push(candidate.replace(/\\/g, "/"));
@@ -164823,7 +164934,7 @@ var engine_exports2 = {};
164823
164934
  __export(engine_exports2, {
164824
164935
  SkillsEngine: () => SkillsEngine
164825
164936
  });
164826
- import { existsSync as existsSync20, readFileSync as readFileSync14, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, readdirSync as readdirSync4 } from "fs";
164937
+ import { existsSync as existsSync21, readFileSync as readFileSync14, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, readdirSync as readdirSync4 } from "fs";
164827
164938
  import { join as join21 } from "path";
164828
164939
  import { homedir as homedir23 } from "os";
164829
164940
  var SKILLS_DIRS, SKILL_WORTHY_TYPES, MIN_OBS_FOR_SKILL, MIN_SCORE_FOR_SKILL, LOW_SIGNAL_TITLE_PATTERNS, LOW_SIGNAL_ENTITY_PATTERNS, COMMAND_TRACE_PATTERNS2, SkillsEngine;
@@ -164904,7 +165015,7 @@ var init_engine5 = __esm({
164904
165015
  paths.push(join21(home, dir));
164905
165016
  }
164906
165017
  for (const skillsRoot of paths) {
164907
- if (!existsSync20(skillsRoot)) continue;
165018
+ if (!existsSync21(skillsRoot)) continue;
164908
165019
  try {
164909
165020
  const entries = readdirSync4(skillsRoot, { withFileTypes: true });
164910
165021
  for (const entry of entries) {
@@ -164912,7 +165023,7 @@ var init_engine5 = __esm({
164912
165023
  const name = entry.name;
164913
165024
  if (seen.has(name)) continue;
164914
165025
  const skillMd = join21(skillsRoot, name, "SKILL.md");
164915
- if (!existsSync20(skillMd)) continue;
165026
+ if (!existsSync21(skillMd)) continue;
164916
165027
  try {
164917
165028
  const content = readFileSync14(skillMd, "utf-8");
164918
165029
  const description = this.parseDescription(content);
@@ -167936,7 +168047,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
167936
168047
  }
167937
168048
  case "/config": {
167938
168049
  const os6 = await import("os");
167939
- const { existsSync: existsSync23 } = await import("fs");
168050
+ const { existsSync: existsSync24 } = await import("fs");
167940
168051
  const { join: join26 } = await import("path");
167941
168052
  const configProjectRoot = effectiveProjectRoot;
167942
168053
  const resolved = getResolvedConfig({ projectRoot: configProjectRoot });
@@ -167964,7 +168075,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
167964
168075
  if (fpath === null) {
167965
168076
  files[key] = { exists: false, path: "unavailable", unavailable: true };
167966
168077
  } else {
167967
- files[key] = { exists: existsSync23(fpath), path: fpath };
168078
+ files[key] = { exists: existsSync24(fpath), path: fpath };
167968
168079
  }
167969
168080
  }
167970
168081
  } catch {
@@ -168776,7 +168887,7 @@ var init_task_graph = __esm({
168776
168887
 
168777
168888
  // src/orchestrate/context-collector.ts
168778
168889
  import { execFileSync as execFileSync2 } from "child_process";
168779
- import { readFileSync as readFileSync15, existsSync as existsSync21 } from "fs";
168890
+ import { readFileSync as readFileSync15, existsSync as existsSync22 } from "fs";
168780
168891
  import { join as join22 } from "path";
168781
168892
  function normalizeEntryLimit(value, fallback) {
168782
168893
  if (!Number.isSafeInteger(value) || value < 1) return fallback;
@@ -168853,7 +168964,7 @@ function collectFileTree(projectDir2, maxEntries) {
168853
168964
  function collectDependencies(projectDir2) {
168854
168965
  try {
168855
168966
  const pkgPath = join22(projectDir2, "package.json");
168856
- if (!existsSync21(pkgPath)) return "";
168967
+ if (!existsSync22(pkgPath)) return "";
168857
168968
  const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
168858
168969
  const parts = [];
168859
168970
  if (pkg.dependencies && Object.keys(pkg.dependencies).length > 0) {
@@ -171674,11 +171785,11 @@ __export(hooks_path_exports, {
171674
171785
  resolveGitDir: () => resolveGitDir,
171675
171786
  resolveHooksDir: () => resolveHooksDir
171676
171787
  });
171677
- import { existsSync as existsSync22, readFileSync as readFileSync16, statSync as statSync6, mkdirSync as mkdirSync6 } from "fs";
171788
+ import { existsSync as existsSync23, readFileSync as readFileSync16, statSync as statSync6, mkdirSync as mkdirSync6 } from "fs";
171678
171789
  import path35 from "path";
171679
171790
  function resolveGitDir(projectRoot) {
171680
171791
  const dotGit = path35.join(projectRoot, ".git");
171681
- if (!existsSync22(dotGit)) return null;
171792
+ if (!existsSync23(dotGit)) return null;
171682
171793
  const stat5 = statSync6(dotGit);
171683
171794
  if (stat5.isDirectory()) {
171684
171795
  return dotGit;
@@ -171690,7 +171801,7 @@ function resolveGitDir(projectRoot) {
171690
171801
  if (match2) {
171691
171802
  const gitdir = match2[1].trim();
171692
171803
  const resolved = path35.isAbsolute(gitdir) ? gitdir : path35.resolve(projectRoot, gitdir);
171693
- if (existsSync22(resolved)) {
171804
+ if (existsSync23(resolved)) {
171694
171805
  return resolved;
171695
171806
  }
171696
171807
  }
@@ -172898,7 +173009,18 @@ _Search mode: ${result.receipt.mode}_`;
172898
173009
  text: text3
172899
173010
  }
172900
173011
  ],
172901
- structuredContent: { retrieval: result.receipt }
173012
+ // Clients that surface only structuredContent (e.g. Claude Code) must
173013
+ // still see the results, not just the retrieval diagnostics.
173014
+ structuredContent: {
173015
+ results: result.entries.map((entry) => ({
173016
+ ref: formatEntryRef(entry),
173017
+ title: entry.title,
173018
+ type: entry.type,
173019
+ time: entry.time,
173020
+ tokens: entry.tokens
173021
+ })),
173022
+ retrieval: result.receipt
173023
+ }
172902
173024
  };
172903
173025
  }, { loadCorpus: false });
172904
173026
  }
@@ -174966,9 +175088,12 @@ ${s2.instruction}`.toLowerCase();
174966
175088
  }
174967
175089
  } catch {
174968
175090
  }
175091
+ const card = lines.filter(Boolean).join("\n");
174969
175092
  return {
174970
- content: [{ type: "text", text: lines.filter(Boolean).join("\n") }],
174971
- structuredContent: { binding: bindingReceipt }
175093
+ content: [{ type: "text", text: card }],
175094
+ // Clients that surface only structuredContent (e.g. Claude Code) must
175095
+ // still see the session card, not just the binding receipt.
175096
+ structuredContent: { card, binding: bindingReceipt }
174972
175097
  };
174973
175098
  }
174974
175099
  );
@@ -176398,10 +176523,10 @@ Preview: ${analysis.description.slice(0, 300)}${analysis.description.length > 30
176398
176523
  const { ensureHooksDir: ensureHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
176399
176524
  const resolved = ensureHooksDir2(project.rootPath);
176400
176525
  if (resolved) {
176401
- const { existsSync: existsSync23, readFileSync: readFileSync17, writeFileSync: writeFileSync5, chmodSync } = await import("fs");
176526
+ const { existsSync: existsSync24, readFileSync: readFileSync17, writeFileSync: writeFileSync5, chmodSync } = await import("fs");
176402
176527
  const { hookPath } = resolved;
176403
176528
  const HOOK_MARKER = "# [memorix-git-hook]";
176404
- const needsInstall = !existsSync23(hookPath) || !readFileSync17(hookPath, "utf-8").includes(HOOK_MARKER);
176529
+ const needsInstall = !existsSync24(hookPath) || !readFileSync17(hookPath, "utf-8").includes(HOOK_MARKER);
176405
176530
  if (needsInstall) {
176406
176531
  const hookScript = `#!/bin/sh
176407
176532
  ${HOOK_MARKER}
@@ -176410,7 +176535,7 @@ if command -v memorix >/dev/null 2>&1; then
176410
176535
  memorix ingest commit --auto >/dev/null 2>&1 &
176411
176536
  fi
176412
176537
  `;
176413
- if (existsSync23(hookPath)) {
176538
+ if (existsSync24(hookPath)) {
176414
176539
  const existing = readFileSync17(hookPath, "utf-8");
176415
176540
  writeFileSync5(hookPath, existing.trimEnd() + `
176416
176541
 
@@ -176576,6 +176701,7 @@ var init_server2 = __esm({
176576
176701
  init_graph_scope();
176577
176702
  init_visibility();
176578
176703
  init_engine3();
176704
+ init_index_format();
176579
176705
  init_graph_context();
176580
176706
  init_detector();
176581
176707
  init_launch_root();
@@ -177181,7 +177307,7 @@ var init_serve_shared = __esm({
177181
177307
 
177182
177308
  // src/cli/version.ts
177183
177309
  function getCliVersion() {
177184
- return true ? "1.10.1" : pkg.version;
177310
+ return true ? "1.10.2" : pkg.version;
177185
177311
  }
177186
177312
  var init_version3 = __esm({
177187
177313
  "src/cli/version.ts"() {