memorix 1.9.1 → 1.9.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
@@ -3232,7 +3232,7 @@ ${import_picocolors.default.gray(m3)} ${s4}
3232
3232
 
3233
3233
  // src/cli/version.ts
3234
3234
  function getCliVersion() {
3235
- return true ? "1.9.1" : pkg.version;
3235
+ return true ? "1.9.2" : pkg.version;
3236
3236
  }
3237
3237
  var init_version = __esm({
3238
3238
  "src/cli/version.ts"() {
@@ -27498,7 +27498,8 @@ function clampCursor(afterId) {
27498
27498
  }
27499
27499
  async function loadConsolidationPage(projectId, options) {
27500
27500
  const limit2 = clampBatchSize(options.limit);
27501
- const page = await getObservationStore().loadByProject(projectId, {
27501
+ const store2 = options.store ?? getObservationStore();
27502
+ const page = await store2.loadByProject(projectId, {
27502
27503
  status: "active",
27503
27504
  afterId: clampCursor(options.afterId),
27504
27505
  limit: limit2 + 1
@@ -27558,7 +27559,7 @@ async function findConsolidationCandidates(_projectDir, projectId, opts) {
27558
27559
  return findClusters(page.observations, threshold);
27559
27560
  }
27560
27561
  async function executeConsolidation(_projectDir, projectId, opts) {
27561
- const store2 = getObservationStore();
27562
+ const store2 = opts?.store ?? getObservationStore();
27562
27563
  const page = await loadConsolidationPage(projectId, opts ?? {});
27563
27564
  const clusters = findClusters(page.observations, opts?.threshold ?? DEFAULT_SIMILARITY_THRESHOLD);
27564
27565
  if (clusters.length === 0) {
@@ -181365,7 +181366,7 @@ __export(lite_provider_exports, {
181365
181366
  refreshProjectLite: () => refreshProjectLite
181366
181367
  });
181367
181368
  import { createHash as createHash10 } from "crypto";
181368
- import { readdirSync as readdirSync2, readFileSync as readFileSync9, statSync as statSync4 } from "fs";
181369
+ import { existsSync as existsSync14, readdirSync as readdirSync2, readFileSync as readFileSync9, statSync as statSync4 } from "fs";
181369
181370
  import { join as join5, relative as relative2 } from "path";
181370
181371
  function hashText2(text3) {
181371
181372
  return createHash10("sha256").update(text3).digest("hex");
@@ -181382,6 +181383,9 @@ function resolveMaxFileBytes(value) {
181382
181383
  if (!Number.isFinite(value)) return DEFAULT_CODEGRAPH_MAX_FILE_BYTES;
181383
181384
  return Math.max(1, Math.floor(value));
181384
181385
  }
181386
+ function isPythonVirtualenvDir(dir) {
181387
+ return existsSync14(join5(dir, "pyvenv.cfg"));
181388
+ }
181385
181389
  function walk(root, exclude, maxFiles) {
181386
181390
  const out = [];
181387
181391
  const visit = (dir) => {
@@ -181399,6 +181403,7 @@ function walk(root, exclude, maxFiles) {
181399
181403
  if (entry.isDirectory()) {
181400
181404
  if (entry.name === ".git" || entry.name === ".worktrees" || entry.name === ".tmp" || entry.name === "node_modules") continue;
181401
181405
  if (rel === ".claude/worktrees" || rel.startsWith(".claude/worktrees/")) continue;
181406
+ if (isPythonVirtualenvDir(abs)) continue;
181402
181407
  visit(abs);
181403
181408
  if (out.length >= maxFiles) return;
181404
181409
  continue;
@@ -185295,7 +185300,7 @@ __export(vector_backfill_runner_exports, {
185295
185300
  import { spawn as spawn4 } from "child_process";
185296
185301
  import {
185297
185302
  closeSync,
185298
- existsSync as existsSync14,
185303
+ existsSync as existsSync15,
185299
185304
  mkdirSync as mkdirSync2,
185300
185305
  openSync,
185301
185306
  readFileSync as readFileSync10,
@@ -185423,7 +185428,7 @@ function releaseVectorBackfillLock(lockPath = process.env.MEMORIX_VECTOR_BACKFIL
185423
185428
  }
185424
185429
  function launchDetachedVectorBackfill(request, options = {}) {
185425
185430
  const runnerPath = options.runnerPath ?? resolveVectorBackfillRunnerPath();
185426
- const exists3 = options.exists ?? existsSync14;
185431
+ const exists3 = options.exists ?? existsSync15;
185427
185432
  if (!exists3(runnerPath)) return false;
185428
185433
  const lock = acquireVectorBackfillLock(request.dataDir, request.projectId, options.lockPath);
185429
185434
  if (!lock) return false;
@@ -192262,7 +192267,8 @@ var init_memory3 = __esm({
192262
192267
  case "deduplicate": {
192263
192268
  const query = asStringArg(args.query);
192264
192269
  const dryRun = !!args.dryRun || !!args["dry-run"];
192265
- const { isLLMEnabled: isLLMEnabled2 } = await Promise.resolve().then(() => (init_provider2(), provider_exports2));
192270
+ const { initLLM: initLLM2, isLLMEnabled: isLLMEnabled2 } = await Promise.resolve().then(() => (init_provider2(), provider_exports2));
192271
+ initLLM2({ scope: "memory", projectRoot: project.rootPath });
192266
192272
  if (!isLLMEnabled2()) {
192267
192273
  emitResult(
192268
192274
  { project, available: false, usedLLM: false },
@@ -192615,7 +192621,7 @@ __export(init_exports, {
192615
192621
  buildInitTomlConfig: () => buildInitTomlConfig,
192616
192622
  default: () => init_default5
192617
192623
  });
192618
- import { existsSync as existsSync15, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
192624
+ import { existsSync as existsSync16, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
192619
192625
  import { homedir as homedir8 } from "os";
192620
192626
  import path29 from "path";
192621
192627
  function buildInitTomlConfig(options) {
@@ -192764,7 +192770,7 @@ var init_init = __esm({
192764
192770
  const targetPath = path29.join(targetDir, isGlobal ? getInitConfigFilename() : getInitProjectConfigFilename());
192765
192771
  const envPath = path29.join(targetDir, ".env");
192766
192772
  v3.info(getInitScopeDescription(scope));
192767
- if (existsSync15(targetPath)) {
192773
+ if (existsSync16(targetPath)) {
192768
192774
  const overwrite = await me({
192769
192775
  message: `${targetPath} already exists. Overwrite it?`,
192770
192776
  initialValue: false
@@ -192872,10 +192878,10 @@ var init_init = __esm({
192872
192878
  v3.success(`Created ${targetPath}`);
192873
192879
  if (shouldOfferDotenv(scope)) {
192874
192880
  const envExamplePath = getEnvTemplateTarget(targetDir, {
192875
- hasDotenvExample: existsSync15(path29.join(targetDir, ".env.example"))
192881
+ hasDotenvExample: existsSync16(path29.join(targetDir, ".env.example"))
192876
192882
  });
192877
192883
  const envContent = envLines.join("\n");
192878
- if (existsSync15(envExamplePath)) {
192884
+ if (existsSync16(envExamplePath)) {
192879
192885
  const overwriteEnvTemplate = await me({
192880
192886
  message: `${envExamplePath} already exists. Overwrite it?`,
192881
192887
  initialValue: false
@@ -192887,7 +192893,7 @@ var init_init = __esm({
192887
192893
  }
192888
192894
  writeFileSync3(envExamplePath, envContent, "utf-8");
192889
192895
  v3.success(`Created ${envExamplePath}`);
192890
- const createEnv = !existsSync15(envPath) ? await me({
192896
+ const createEnv = !existsSync16(envPath) ? await me({
192891
192897
  message: `Create .env from ${path29.basename(envExamplePath)} now? (you can fill in keys later)`,
192892
192898
  initialValue: true
192893
192899
  }) : false;
@@ -196057,7 +196063,7 @@ __export(setup_exports, {
196057
196063
  tryInstallCodexPlugin: () => tryInstallCodexPlugin
196058
196064
  });
196059
196065
  import { spawnSync } from "child_process";
196060
- import { existsSync as existsSync16 } from "fs";
196066
+ import { existsSync as existsSync17 } from "fs";
196061
196067
  import { copyFile as copyFile2, mkdir as mkdir6, readFile as readFile6, readdir as readdir3, rm as rm2, writeFile as writeFile7 } from "fs/promises";
196062
196068
  import { homedir as homedir27 } from "os";
196063
196069
  import path32 from "path";
@@ -196102,7 +196108,7 @@ function buildSetupPlan(options) {
196102
196108
  function findPackageRoot(start = path32.dirname(fileURLToPath7(import.meta.url))) {
196103
196109
  let dir = start;
196104
196110
  for (let i4 = 0; i4 < 8; i4++) {
196105
- if (existsSync16(path32.join(dir, "package.json")) && existsSync16(path32.join(dir, "plugins"))) {
196111
+ if (existsSync17(path32.join(dir, "package.json")) && existsSync17(path32.join(dir, "plugins"))) {
196106
196112
  return dir;
196107
196113
  }
196108
196114
  const parent = path32.dirname(dir);
@@ -196388,8 +196394,8 @@ function isOwnedLegacyCodexHooks(content) {
196388
196394
  async function removeOwnedLegacyCodexPluginFolder(homeDir) {
196389
196395
  const canonicalPath2 = path32.join(homeDir, "plugins", "memorix");
196390
196396
  const legacyPath = path32.join(homeDir, ".codex", "plugins", "memorix");
196391
- if (!existsSync16(legacyPath)) return "missing";
196392
- if (!existsSync16(canonicalPath2)) return "preserved";
196397
+ if (!existsSync17(legacyPath)) return "missing";
196398
+ if (!existsSync17(canonicalPath2)) return "preserved";
196393
196399
  try {
196394
196400
  const manifest = JSON.parse(await readFile6(path32.join(legacyPath, ".codex-plugin", "plugin.json"), "utf-8"));
196395
196401
  const repository = String(manifest.repository ?? "");
@@ -196605,7 +196611,7 @@ async function installCodeBuddyPluginPackage(options = {}) {
196605
196611
  const home = options.homeDir ?? homedir27();
196606
196612
  const packageRoot = findPackageRoot();
196607
196613
  const source = path32.join(packageRoot, "plugins", "codebuddy", "memorix");
196608
- if (!existsSync16(source)) throw new Error(`CodeBuddy plugin template not found: ${source}`);
196614
+ if (!existsSync17(source)) throw new Error(`CodeBuddy plugin template not found: ${source}`);
196609
196615
  const marketplaceRoot = path32.join(home, ".codebuddy", "memorix-local");
196610
196616
  const marketplacePath = path32.join(marketplaceRoot, ".codebuddy-plugin", "marketplace.json");
196611
196617
  const pluginPath = path32.join(marketplaceRoot, "plugins", "memorix");
@@ -196626,7 +196632,7 @@ async function installPluginPackage(options) {
196626
196632
  const packageRoot = findPackageRoot();
196627
196633
  const source = path32.join(packageRoot, "plugins", options.agent, "memorix");
196628
196634
  const includeHooks = options.includeHooks ?? true;
196629
- if (!existsSync16(source)) {
196635
+ if (!existsSync17(source)) {
196630
196636
  throw new Error(`Plugin package template not found: ${source}`);
196631
196637
  }
196632
196638
  if (options.agent === "codex") {
@@ -196674,7 +196680,7 @@ async function installGeminiExtensionPackage(options = {}) {
196674
196680
  const home = options.homeDir ?? homedir27();
196675
196681
  const packageRoot = findPackageRoot();
196676
196682
  const source = path32.join(packageRoot, "plugins", "gemini", "memorix");
196677
- if (!existsSync16(source)) {
196683
+ if (!existsSync17(source)) {
196678
196684
  throw new Error(`Gemini extension template not found: ${source}`);
196679
196685
  }
196680
196686
  const extensionPath = path32.join(home, ".gemini", "extensions", "memorix");
@@ -196688,7 +196694,7 @@ async function installGeminiExtensionPackage(options = {}) {
196688
196694
  async function installAntigravityPluginPackage(options = {}) {
196689
196695
  const packageRoot = findPackageRoot();
196690
196696
  const source = path32.join(packageRoot, "plugins", "antigravity", "memorix");
196691
- if (!existsSync16(source)) {
196697
+ if (!existsSync17(source)) {
196692
196698
  throw new Error(`Antigravity plugin template not found: ${source}`);
196693
196699
  }
196694
196700
  const pluginPath = options.global === false ? path32.join(options.projectRoot ?? process.cwd(), ".agents", "plugins", "memorix") : path32.join(options.homeDir ?? homedir27(), ".gemini", "config", "plugins", "memorix");
@@ -196706,7 +196712,7 @@ async function installAntigravityPluginPackage(options = {}) {
196706
196712
  async function installPiPackage(options = {}) {
196707
196713
  const packageRoot = findPackageRoot();
196708
196714
  const source = path32.join(packageRoot, "plugins", "pi", "memorix");
196709
- if (!existsSync16(source)) {
196715
+ if (!existsSync17(source)) {
196710
196716
  throw new Error(`Pi package template not found: ${source}`);
196711
196717
  }
196712
196718
  const defaultRoot = options.global ? path32.join(options.homeDir ?? homedir27(), ".pi", "agent", "packages") : path32.join(process.cwd(), ".pi", "packages");
@@ -196724,7 +196730,7 @@ async function installOpenClawBundlePackage(options = {}) {
196724
196730
  const home = options.homeDir ?? homedir27();
196725
196731
  const packageRoot = findPackageRoot();
196726
196732
  const source = path32.join(packageRoot, "plugins", "openclaw", "memorix");
196727
- if (!existsSync16(source)) {
196733
+ if (!existsSync17(source)) {
196728
196734
  throw new Error(`OpenClaw bundle template not found: ${source}`);
196729
196735
  }
196730
196736
  const bundlePath = path32.join(home, ".openclaw", "extensions", "memorix");
@@ -196740,7 +196746,7 @@ async function installOpenClawBundlePackage(options = {}) {
196740
196746
  async function installHermesPluginPackage(options = {}) {
196741
196747
  const packageRoot = findPackageRoot();
196742
196748
  const source = path32.join(packageRoot, "plugins", "hermes", "memorix");
196743
- if (!existsSync16(source)) {
196749
+ if (!existsSync17(source)) {
196744
196750
  throw new Error(`Hermes plugin template not found: ${source}`);
196745
196751
  }
196746
196752
  const hermesHome = resolveHermesHome(options.homeDir);
@@ -196767,7 +196773,7 @@ async function installHermesPluginPackage(options = {}) {
196767
196773
  async function installOmpPackage(options = {}) {
196768
196774
  const packageRoot = findPackageRoot();
196769
196775
  const source = path32.join(packageRoot, "plugins", "omp", "memorix");
196770
- if (!existsSync16(source)) {
196776
+ if (!existsSync17(source)) {
196771
196777
  throw new Error(`Oh-my-Pi package template not found: ${source}`);
196772
196778
  }
196773
196779
  const defaultRoot = options.global ? path32.join(options.homeDir ?? homedir27(), ".omp", "agent", "packages") : path32.join(process.cwd(), ".omp", "packages");
@@ -196994,7 +197000,7 @@ ${hook.stdout || ""}`.toLowerCase();
196994
197000
  function resolveHermesCommand(hermesHome) {
196995
197001
  if (process.platform === "win32") {
196996
197002
  const localHermes = path32.join(hermesHome, "hermes-agent", "venv", "Scripts", "hermes.exe");
196997
- if (existsSync16(localHermes)) return localHermes;
197003
+ if (existsSync17(localHermes)) return localHermes;
196998
197004
  }
196999
197005
  return "hermes";
197000
197006
  }
@@ -198610,11 +198616,11 @@ __export(current_facts_exports, {
198610
198616
  formatGitFact: () => formatGitFact
198611
198617
  });
198612
198618
  import { execFileSync } from "child_process";
198613
- import { existsSync as existsSync17, readFileSync as readFileSync11 } from "fs";
198619
+ import { existsSync as existsSync18, readFileSync as readFileSync11 } from "fs";
198614
198620
  import path33 from "path";
198615
198621
  function readTextIfExists(filePath) {
198616
198622
  try {
198617
- if (!existsSync17(filePath)) return null;
198623
+ if (!existsSync18(filePath)) return null;
198618
198624
  return readFileSync11(filePath, "utf8");
198619
198625
  } catch {
198620
198626
  return null;
@@ -198905,7 +198911,7 @@ __export(external_provider_exports, {
198905
198911
  runExternalCodeGraphLifecycle: () => runExternalCodeGraphLifecycle
198906
198912
  });
198907
198913
  import { spawn as spawn5 } from "child_process";
198908
- import { existsSync as existsSync18, readFileSync as readFileSync12 } from "fs";
198914
+ import { existsSync as existsSync19, readFileSync as readFileSync12 } from "fs";
198909
198915
  import { delimiter, dirname as dirname5, extname, isAbsolute as isAbsolute4, join as join24, relative as relative4, resolve as resolve6, sep as sep2 } from "path";
198910
198916
  function boundedTimeout(value) {
198911
198917
  if (!Number.isFinite(value)) return DEFAULT_EXTERNAL_CODEGRAPH_TIMEOUT_MS;
@@ -198942,13 +198948,13 @@ function resolveCommandCandidates(command) {
198942
198948
  }
198943
198949
  function resolveLaunch(command) {
198944
198950
  for (const candidate2 of resolveCommandCandidates(command)) {
198945
- if (!existsSync18(candidate2)) continue;
198951
+ if (!existsSync19(candidate2)) continue;
198946
198952
  const extension3 = extname(candidate2).toLowerCase();
198947
198953
  if (extension3 === ".cmd") {
198948
198954
  const bundleRoot = resolve6(dirname5(candidate2), "..");
198949
198955
  const node = join24(bundleRoot, "node.exe");
198950
198956
  const entry = join24(bundleRoot, "lib", "dist", "bin", "codegraph.js");
198951
- if (existsSync18(node) && existsSync18(entry)) {
198957
+ if (existsSync19(node) && existsSync19(entry)) {
198952
198958
  return { executable: node, prefixArgs: ["--liftoff-only", entry] };
198953
198959
  }
198954
198960
  try {
@@ -198957,7 +198963,7 @@ function resolveLaunch(command) {
198957
198963
  if (match2?.[1]) {
198958
198964
  const base = dirname5(candidate2).endsWith(sep2) ? dirname5(candidate2) : dirname5(candidate2) + sep2;
198959
198965
  const entry2 = resolve6(match2[1].replace(/%(?:~)?dp0%?/gi, base));
198960
- if (existsSync18(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
198966
+ if (existsSync19(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
198961
198967
  }
198962
198968
  } catch {
198963
198969
  }
@@ -199105,7 +199111,7 @@ async function inspectExternalCodeGraph(input) {
199105
199111
  const health2 = { state: "disabled", reason: "External CodeGraph is disabled by configuration." };
199106
199112
  return { health: health2, quality: providerQuality({ mode, health: health2 }) };
199107
199113
  }
199108
- if (!existsSync18(join24(input.projectRoot, ".codegraph"))) {
199114
+ if (!existsSync19(join24(input.projectRoot, ".codegraph"))) {
199109
199115
  const health2 = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
199110
199116
  return { health: health2, quality: providerQuality({ mode, health: health2 }) };
199111
199117
  }
@@ -199141,7 +199147,7 @@ async function runExternalCodeGraphLifecycle(input) {
199141
199147
  };
199142
199148
  }
199143
199149
  const indexPath = join24(input.projectRoot, ".codegraph");
199144
- if (input.action === "sync" && !existsSync18(indexPath)) {
199150
+ if (input.action === "sync" && !existsSync19(indexPath)) {
199145
199151
  const health = { state: "not-detected", reason: "No local .codegraph index is present for this project." };
199146
199152
  return {
199147
199153
  action: input.action,
@@ -199151,7 +199157,7 @@ async function runExternalCodeGraphLifecycle(input) {
199151
199157
  quality: providerQuality({ mode, health })
199152
199158
  };
199153
199159
  }
199154
- if (input.action === "init" && existsSync18(indexPath)) {
199160
+ if (input.action === "init" && existsSync19(indexPath)) {
199155
199161
  const inspected2 = await inspectExternalCodeGraph(input);
199156
199162
  return {
199157
199163
  action: input.action,
@@ -201120,7 +201126,7 @@ __export(auto_context_exports, {
201120
201126
  formatAutoProjectContextSummary: () => formatAutoProjectContextSummary,
201121
201127
  formatLegacyAutoProjectContextPrompt: () => formatLegacyAutoProjectContextPrompt
201122
201128
  });
201123
- import { existsSync as existsSync19, statSync as statSync6 } from "fs";
201129
+ import { existsSync as existsSync20, statSync as statSync6 } from "fs";
201124
201130
  import path35 from "path";
201125
201131
  function activeProjectObservations(observations2, projectId) {
201126
201132
  return observations2.filter((obs) => obs.projectId === projectId && (obs.status ?? "active") === "active");
@@ -201466,7 +201472,7 @@ function existingLensCandidates(rootPath, lens) {
201466
201472
  for (const candidate2 of lensPathCandidates(lens)) {
201467
201473
  const absolute = path35.join(rootPath, candidate2);
201468
201474
  try {
201469
- if (!existsSync19(absolute)) continue;
201475
+ if (!existsSync20(absolute)) continue;
201470
201476
  const stat6 = statSync6(absolute);
201471
201477
  if (stat6.isFile()) out.push(candidate2);
201472
201478
  if (stat6.isDirectory()) out.push(candidate2.replace(/\\/g, "/"));
@@ -205105,7 +205111,7 @@ var engine_exports2 = {};
205105
205111
  __export(engine_exports2, {
205106
205112
  SkillsEngine: () => SkillsEngine
205107
205113
  });
205108
- import { existsSync as existsSync20, readFileSync as readFileSync13, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync3 } from "fs";
205114
+ import { existsSync as existsSync21, readFileSync as readFileSync13, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync3 } from "fs";
205109
205115
  import { join as join25 } from "path";
205110
205116
  import { homedir as homedir31 } from "os";
205111
205117
  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;
@@ -205186,7 +205192,7 @@ var init_engine4 = __esm({
205186
205192
  paths.push(join25(home, dir));
205187
205193
  }
205188
205194
  for (const skillsRoot of paths) {
205189
- if (!existsSync20(skillsRoot)) continue;
205195
+ if (!existsSync21(skillsRoot)) continue;
205190
205196
  try {
205191
205197
  const entries = readdirSync3(skillsRoot, { withFileTypes: true });
205192
205198
  for (const entry of entries) {
@@ -205194,7 +205200,7 @@ var init_engine4 = __esm({
205194
205200
  const name = entry.name;
205195
205201
  if (seen.has(name)) continue;
205196
205202
  const skillMd = join25(skillsRoot, name, "SKILL.md");
205197
- if (!existsSync20(skillMd)) continue;
205203
+ if (!existsSync21(skillMd)) continue;
205198
205204
  try {
205199
205205
  const content = readFileSync13(skillMd, "utf-8");
205200
205206
  const description = this.parseDescription(content);
@@ -206416,7 +206422,7 @@ var init_task_graph = __esm({
206416
206422
 
206417
206423
  // src/orchestrate/context-collector.ts
206418
206424
  import { execFileSync as execFileSync2 } from "child_process";
206419
- import { readFileSync as readFileSync14, existsSync as existsSync21 } from "fs";
206425
+ import { readFileSync as readFileSync14, existsSync as existsSync22 } from "fs";
206420
206426
  import { join as join26 } from "path";
206421
206427
  function normalizeEntryLimit(value, fallback) {
206422
206428
  if (!Number.isSafeInteger(value) || value < 1) return fallback;
@@ -206493,7 +206499,7 @@ function collectFileTree(projectDir2, maxEntries) {
206493
206499
  function collectDependencies(projectDir2) {
206494
206500
  try {
206495
206501
  const pkgPath = join26(projectDir2, "package.json");
206496
- if (!existsSync21(pkgPath)) return "";
206502
+ if (!existsSync22(pkgPath)) return "";
206497
206503
  const pkg = JSON.parse(readFileSync14(pkgPath, "utf-8"));
206498
206504
  const parts = [];
206499
206505
  if (pkg.dependencies && Object.keys(pkg.dependencies).length > 0) {
@@ -207543,7 +207549,7 @@ __export(receipt_service_exports, {
207543
207549
  formatHandoffReceipt: () => formatHandoffReceipt
207544
207550
  });
207545
207551
  import { createHash as createHash18 } from "crypto";
207546
- import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
207552
+ import { existsSync as existsSync23, readFileSync as readFileSync15 } from "fs";
207547
207553
  import path37 from "path";
207548
207554
  function sha256(value) {
207549
207555
  return `sha256:${createHash18("sha256").update(value).digest("hex")}`;
@@ -207574,7 +207580,7 @@ function safeJsonArray(value) {
207574
207580
  }
207575
207581
  async function loadReceiptObservations(dataDir, projectId) {
207576
207582
  const dbPath = path37.join(dataDir, "memorix.db");
207577
- if (existsSync22(dbPath)) {
207583
+ if (existsSync23(dbPath)) {
207578
207584
  try {
207579
207585
  const DB = loadBetterSqlite3();
207580
207586
  const db2 = new DB(dbPath, { readonly: true, fileMustExist: true });
@@ -207591,7 +207597,7 @@ async function loadReceiptObservations(dataDir, projectId) {
207591
207597
  }
207592
207598
  }
207593
207599
  const jsonPath = path37.join(dataDir, "observations.json");
207594
- if (!existsSync22(jsonPath)) return [];
207600
+ if (!existsSync23(jsonPath)) return [];
207595
207601
  try {
207596
207602
  const parsed = JSON.parse(readFileSync15(jsonPath, "utf-8"));
207597
207603
  if (!Array.isArray(parsed)) return [];
@@ -207829,7 +207835,7 @@ var init_tool_profile = __esm({
207829
207835
  function getMcpServerInfo() {
207830
207836
  return {
207831
207837
  name: "memorix",
207832
- version: true ? "1.9.1" : "1.0.1"
207838
+ version: true ? "1.9.2" : "1.0.1"
207833
207839
  };
207834
207840
  }
207835
207841
  function createMcpDiscoverResult(capabilities, serverInfo) {
@@ -221527,7 +221533,7 @@ var init_sanitizer = __esm({
221527
221533
  });
221528
221534
 
221529
221535
  // src/workspace/applier.ts
221530
- import { existsSync as existsSync23, mkdirSync as mkdirSync6, copyFileSync, writeFileSync as writeFileSync6, unlinkSync as unlinkSync2, renameSync } from "fs";
221536
+ import { existsSync as existsSync24, mkdirSync as mkdirSync6, copyFileSync, writeFileSync as writeFileSync6, unlinkSync as unlinkSync2, renameSync } from "fs";
221531
221537
  import { dirname as dirname6 } from "path";
221532
221538
  var WorkspaceSyncApplier;
221533
221539
  var init_applier = __esm({
@@ -221558,7 +221564,7 @@ var init_applier = __esm({
221558
221564
  for (const file2 of files) {
221559
221565
  try {
221560
221566
  const dir = dirname6(file2.filePath);
221561
- if (!existsSync23(dir)) {
221567
+ if (!existsSync24(dir)) {
221562
221568
  mkdirSync6(dir, { recursive: true });
221563
221569
  }
221564
221570
  } catch (err) {
@@ -221567,7 +221573,7 @@ var init_applier = __esm({
221567
221573
  }
221568
221574
  }
221569
221575
  for (const file2 of files) {
221570
- if (existsSync23(file2.filePath)) {
221576
+ if (existsSync24(file2.filePath)) {
221571
221577
  try {
221572
221578
  const backupPath = file2.filePath + `.backup-${Date.now()}`;
221573
221579
  copyFileSync(file2.filePath, backupPath);
@@ -221618,7 +221624,7 @@ var init_applier = __esm({
221618
221624
  cleanBackups(backups) {
221619
221625
  for (const backup of backups) {
221620
221626
  try {
221621
- if (existsSync23(backup.backupPath)) {
221627
+ if (existsSync24(backup.backupPath)) {
221622
221628
  unlinkSync2(backup.backupPath);
221623
221629
  }
221624
221630
  } catch {
@@ -221634,7 +221640,7 @@ var engine_exports3 = {};
221634
221640
  __export(engine_exports3, {
221635
221641
  WorkspaceSyncEngine: () => WorkspaceSyncEngine
221636
221642
  });
221637
- import { readFileSync as readFileSync16, readdirSync as readdirSync4, existsSync as existsSync24, cpSync, mkdirSync as mkdirSync7 } from "fs";
221643
+ import { readFileSync as readFileSync16, readdirSync as readdirSync4, existsSync as existsSync25, cpSync, mkdirSync as mkdirSync7 } from "fs";
221638
221644
  import { join as join28 } from "path";
221639
221645
  import { homedir as homedir32 } from "os";
221640
221646
  var WorkspaceSyncEngine;
@@ -221714,7 +221720,7 @@ var init_engine5 = __esm({
221714
221720
  }
221715
221721
  const merged = /* @__PURE__ */ new Map();
221716
221722
  for (const path50 of pathsToCheck) {
221717
- if (existsSync24(path50)) {
221723
+ if (existsSync25(path50)) {
221718
221724
  try {
221719
221725
  const content = readFileSync16(path50, "utf-8");
221720
221726
  const servers = adapter.parse(content);
@@ -221768,7 +221774,7 @@ var init_engine5 = __esm({
221768
221774
  const adapter = this.adapters.get(target);
221769
221775
  const configPath = adapter.getConfigPath(this.projectRoot);
221770
221776
  let configContent;
221771
- if (target === "antigravity" && existsSync24(configPath)) {
221777
+ if (target === "antigravity" && existsSync25(configPath)) {
221772
221778
  try {
221773
221779
  const existing = JSON.parse(readFileSync16(configPath, "utf-8"));
221774
221780
  const generated = JSON.parse(adapter.generate(result.mcpServers.scanned));
@@ -221844,13 +221850,13 @@ var init_engine5 = __esm({
221844
221850
  join28(home, dir)
221845
221851
  ];
221846
221852
  for (const skillsRoot of paths) {
221847
- if (!existsSync24(skillsRoot)) continue;
221853
+ if (!existsSync25(skillsRoot)) continue;
221848
221854
  try {
221849
221855
  const entries = readdirSync4(skillsRoot, { withFileTypes: true });
221850
221856
  for (const entry of entries) {
221851
221857
  if (!entry.isDirectory()) continue;
221852
221858
  const skillMd = join28(skillsRoot, entry.name, "SKILL.md");
221853
- if (!existsSync24(skillMd)) continue;
221859
+ if (!existsSync25(skillMd)) continue;
221854
221860
  let description = "";
221855
221861
  try {
221856
221862
  const content = readFileSync16(skillMd, "utf-8");
@@ -221899,7 +221905,7 @@ var init_engine5 = __esm({
221899
221905
  for (const skill2 of skills) {
221900
221906
  if (skill2.sourceAgent === target) continue;
221901
221907
  const dest = join28(targetDir, skill2.name);
221902
- if (existsSync24(dest)) {
221908
+ if (existsSync25(dest)) {
221903
221909
  skipped.push(`${skill2.name} (already exists in ${target})`);
221904
221910
  continue;
221905
221911
  }
@@ -221915,7 +221921,7 @@ var init_engine5 = __esm({
221915
221921
  scanWorkflows() {
221916
221922
  const workflows = [];
221917
221923
  const wfDir = join28(this.projectRoot, ".windsurf", "workflows");
221918
- if (!existsSync24(wfDir)) return workflows;
221924
+ if (!existsSync25(wfDir)) return workflows;
221919
221925
  try {
221920
221926
  const files = readdirSync4(wfDir).filter((f7) => f7.endsWith(".md"));
221921
221927
  for (const file2 of files) {
@@ -222194,7 +222200,7 @@ __export(behavior_exports, {
222194
222200
  getBehaviorConfig: () => getBehaviorConfig,
222195
222201
  resetBehaviorConfigCache: () => resetBehaviorConfigCache
222196
222202
  });
222197
- import { existsSync as existsSync25, readFileSync as readFileSync17 } from "fs";
222203
+ import { existsSync as existsSync26, readFileSync as readFileSync17 } from "fs";
222198
222204
  import { homedir as homedir33 } from "os";
222199
222205
  function isSessionInject(value) {
222200
222206
  return value === "full" || value === "minimal" || value === "silent";
@@ -222205,7 +222211,7 @@ function isFormationMode(value) {
222205
222211
  function legacyBehavior(homeDir) {
222206
222212
  const configPath = getLegacyConfigJsonPath(homeDir);
222207
222213
  try {
222208
- if (!existsSync25(configPath)) return {};
222214
+ if (!existsSync26(configPath)) return {};
222209
222215
  const parsed = JSON.parse(readFileSync17(configPath, "utf-8"));
222210
222216
  return parsed.behavior && typeof parsed.behavior === "object" && !Array.isArray(parsed.behavior) ? parsed.behavior : {};
222211
222217
  } catch {
@@ -222519,7 +222525,8 @@ async function executeDeduplicate(context, payload, token) {
222519
222525
  async function previewConsolidate(context) {
222520
222526
  const clusters = await findConsolidationCandidates(
222521
222527
  context.projectRoot ?? context.dataDir,
222522
- context.projectId
222528
+ context.projectId,
222529
+ { store: context.store }
222523
222530
  );
222524
222531
  const payload = { clusterIds: normalizeClusters(clusters.map((cluster) => cluster.ids)) };
222525
222532
  return {
@@ -222542,11 +222549,19 @@ async function executeConsolidate(context, payload, token) {
222542
222549
  const clusterIds = record2.clusterIds.map((ids, index) => payloadIds(ids, `clusterIds[${index}]`));
222543
222550
  const normalized = { clusterIds: normalizeClusters(clusterIds) };
222544
222551
  verify("consolidate", context.projectId, normalized, token);
222545
- const current = await findConsolidationCandidates(context.projectRoot ?? context.dataDir, context.projectId);
222552
+ const current = await findConsolidationCandidates(
222553
+ context.projectRoot ?? context.dataDir,
222554
+ context.projectId,
222555
+ { store: context.store }
222556
+ );
222546
222557
  if (JSON.stringify(normalized.clusterIds) !== JSON.stringify(normalizeClusters(current.map((cluster) => cluster.ids)))) {
222547
222558
  throw new DashboardMaintenanceError("Memory changed after the preview. Refresh before consolidating.", 409);
222548
222559
  }
222549
- const result = await executeConsolidation(context.projectRoot ?? context.dataDir, context.projectId);
222560
+ const result = await executeConsolidation(
222561
+ context.projectRoot ?? context.dataDir,
222562
+ context.projectId,
222563
+ { store: context.store }
222564
+ );
222550
222565
  return { action: "consolidate", projectId: context.projectId, ...result };
222551
222566
  }
222552
222567
  async function retentionCandidates(context) {
@@ -223703,7 +223718,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
223703
223718
  }
223704
223719
  case "/config": {
223705
223720
  const os10 = await import("os");
223706
- const { existsSync: existsSync35 } = await import("fs");
223721
+ const { existsSync: existsSync36 } = await import("fs");
223707
223722
  const { join: join35 } = await import("path");
223708
223723
  const configProjectRoot = effectiveProjectRoot;
223709
223724
  const resolved = getResolvedConfig({ projectRoot: configProjectRoot });
@@ -223731,7 +223746,7 @@ async function handleApi(req, res, dataDir, projectId, projectName, baseDir, pro
223731
223746
  if (fpath === null) {
223732
223747
  files[key] = { exists: false, path: "unavailable", unavailable: true };
223733
223748
  } else {
223734
- files[key] = { exists: existsSync35(fpath), path: fpath };
223749
+ files[key] = { exists: existsSync36(fpath), path: fpath };
223735
223750
  }
223736
223751
  }
223737
223752
  } catch {
@@ -264200,11 +264215,11 @@ __export(hooks_path_exports, {
264200
264215
  resolveGitDir: () => resolveGitDir,
264201
264216
  resolveHooksDir: () => resolveHooksDir
264202
264217
  });
264203
- import { existsSync as existsSync26, readFileSync as readFileSync18, statSync as statSync7, mkdirSync as mkdirSync8 } from "fs";
264218
+ import { existsSync as existsSync27, readFileSync as readFileSync18, statSync as statSync7, mkdirSync as mkdirSync8 } from "fs";
264204
264219
  import path42 from "path";
264205
264220
  function resolveGitDir(projectRoot) {
264206
264221
  const dotGit = path42.join(projectRoot, ".git");
264207
- if (!existsSync26(dotGit)) return null;
264222
+ if (!existsSync27(dotGit)) return null;
264208
264223
  const stat6 = statSync7(dotGit);
264209
264224
  if (stat6.isDirectory()) {
264210
264225
  return dotGit;
@@ -264216,7 +264231,7 @@ function resolveGitDir(projectRoot) {
264216
264231
  if (match2) {
264217
264232
  const gitdir = match2[1].trim();
264218
264233
  const resolved = path42.isAbsolute(gitdir) ? gitdir : path42.resolve(projectRoot, gitdir);
264219
- if (existsSync26(resolved)) {
264234
+ if (existsSync27(resolved)) {
264220
264235
  return resolved;
264221
264236
  }
264222
264237
  }
@@ -268809,10 +268824,10 @@ Preview: ${analysis.description.slice(0, 300)}${analysis.description.length > 30
268809
268824
  const { ensureHooksDir: ensureHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
268810
268825
  const resolved = ensureHooksDir2(project.rootPath);
268811
268826
  if (resolved) {
268812
- const { existsSync: existsSync35, readFileSync: readFileSync25, writeFileSync: writeFileSync13, chmodSync: chmodSync2 } = await import("fs");
268827
+ const { existsSync: existsSync36, readFileSync: readFileSync25, writeFileSync: writeFileSync13, chmodSync: chmodSync2 } = await import("fs");
268813
268828
  const { hookPath } = resolved;
268814
268829
  const HOOK_MARKER3 = "# [memorix-git-hook]";
268815
- const needsInstall = !existsSync35(hookPath) || !readFileSync25(hookPath, "utf-8").includes(HOOK_MARKER3);
268830
+ const needsInstall = !existsSync36(hookPath) || !readFileSync25(hookPath, "utf-8").includes(HOOK_MARKER3);
268816
268831
  if (needsInstall) {
268817
268832
  const hookScript = `#!/bin/sh
268818
268833
  ${HOOK_MARKER3}
@@ -268821,7 +268836,7 @@ if command -v memorix >/dev/null 2>&1; then
268821
268836
  memorix ingest commit --auto >/dev/null 2>&1 &
268822
268837
  fi
268823
268838
  `;
268824
- if (existsSync35(hookPath)) {
268839
+ if (existsSync36(hookPath)) {
268825
268840
  const existing = readFileSync25(hookPath, "utf-8");
268826
268841
  writeFileSync13(hookPath, existing.trimEnd() + `
268827
268842
 
@@ -272883,7 +272898,7 @@ var init_serve_http = __esm({
272883
272898
  if (apiPath === "/config") {
272884
272899
  const { projectId: configProjectId } = await resolveRequestProject(url2);
272885
272900
  const os10 = await import("os");
272886
- const { existsSync: existsSync35 } = await import("fs");
272901
+ const { existsSync: existsSync36 } = await import("fs");
272887
272902
  const { join: join35 } = await import("path");
272888
272903
  const { loadYamlConfig: loadYamlConfig2 } = await Promise.resolve().then(() => (init_yaml_loader(), yaml_loader_exports));
272889
272904
  const { loadFileConfig: loadFileConfig2, loadDotenv: loadDotenv2, getLoadedEnvFiles: getLoadedEnvFiles2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -272905,7 +272920,7 @@ var init_serve_http = __esm({
272905
272920
  "legacy config.json": join35(home, ".memorix", "config.json")
272906
272921
  };
272907
272922
  for (const [key, fpath] of Object.entries(paths)) {
272908
- files[key] = { exists: existsSync35(fpath), path: fpath };
272923
+ files[key] = { exists: existsSync36(fpath), path: fpath };
272909
272924
  }
272910
272925
  } else {
272911
272926
  files["project memorix.yml"] = { exists: false, path: "unavailable", unavailable: true };
@@ -272916,7 +272931,7 @@ var init_serve_http = __esm({
272916
272931
  "legacy config.json": join35(home, ".memorix", "config.json")
272917
272932
  };
272918
272933
  for (const [key, fpath] of Object.entries(userPaths)) {
272919
- files[key] = { exists: existsSync35(fpath), path: fpath };
272934
+ files[key] = { exists: existsSync36(fpath), path: fpath };
272920
272935
  }
272921
272936
  }
272922
272937
  const values = [];
@@ -273452,7 +273467,7 @@ var init_status = __esm({
273452
273467
  const { getProjectDataDir: getProjectDataDir2 } = await Promise.resolve().then(() => (init_persistence(), persistence_exports));
273453
273468
  const { getEmbeddingProvider: getEmbeddingProvider2 } = await Promise.resolve().then(() => (init_provider(), provider_exports));
273454
273469
  const { getResolvedConfig: getResolvedConfig2, getResolvedAgentLane: getResolvedAgentLane2 } = await Promise.resolve().then(() => (init_resolved_config(), resolved_config_exports));
273455
- const { existsSync: existsSync35, readFileSync: readFileSync25 } = await import("fs");
273470
+ const { existsSync: existsSync36, readFileSync: readFileSync25 } = await import("fs");
273456
273471
  const project = detectProject2();
273457
273472
  if (!project) {
273458
273473
  const message = "Memorix requires a git repo to establish project identity. Run `git init` in this workspace first.";
@@ -273535,7 +273550,7 @@ var init_status = __esm({
273535
273550
  try {
273536
273551
  const { resolveHooksDir: resolveHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
273537
273552
  const resolved2 = resolveHooksDir2(project.rootPath);
273538
- if (resolved2 && existsSync35(resolved2.hookPath)) {
273553
+ if (resolved2 && existsSync36(resolved2.hookPath)) {
273539
273554
  const hookContent = readFileSync25(resolved2.hookPath, "utf-8");
273540
273555
  if (hookContent.includes("# [memorix-git-hook]")) {
273541
273556
  diagLines.push(` Git hook: installed [OK]`);
@@ -279510,7 +279525,7 @@ var git_hook_install_exports = {};
279510
279525
  __export(git_hook_install_exports, {
279511
279526
  default: () => git_hook_install_default
279512
279527
  });
279513
- import { existsSync as existsSync27, readFileSync as readFileSync19, writeFileSync as writeFileSync7, chmodSync } from "fs";
279528
+ import { existsSync as existsSync28, readFileSync as readFileSync19, writeFileSync as writeFileSync7, chmodSync } from "fs";
279514
279529
  function generateHookScript() {
279515
279530
  return `${HOOK_MARKER}
279516
279531
  # Memorix: Auto-ingest git commits as memories
@@ -279557,7 +279572,7 @@ var init_git_hook_install = __esm({
279557
279572
  return;
279558
279573
  }
279559
279574
  const { hookPath } = resolved;
279560
- if (existsSync27(hookPath)) {
279575
+ if (existsSync28(hookPath)) {
279561
279576
  const existing = readFileSync19(hookPath, "utf-8");
279562
279577
  if (existing.includes(HOOK_MARKER)) {
279563
279578
  v3.warn("Memorix git hook is already installed.");
@@ -279607,7 +279622,7 @@ var git_hook_uninstall_exports = {};
279607
279622
  __export(git_hook_uninstall_exports, {
279608
279623
  default: () => git_hook_uninstall_default
279609
279624
  });
279610
- import { existsSync as existsSync28, readFileSync as readFileSync20, writeFileSync as writeFileSync8, unlinkSync as unlinkSync3 } from "fs";
279625
+ import { existsSync as existsSync29, readFileSync as readFileSync20, writeFileSync as writeFileSync8, unlinkSync as unlinkSync3 } from "fs";
279611
279626
  var HOOK_MARKER2, git_hook_uninstall_default;
279612
279627
  var init_git_hook_uninstall = __esm({
279613
279628
  "src/cli/commands/git-hook-uninstall.ts"() {
@@ -279639,7 +279654,7 @@ var init_git_hook_uninstall = __esm({
279639
279654
  return;
279640
279655
  }
279641
279656
  const { hookPath } = resolved;
279642
- if (!existsSync28(hookPath)) {
279657
+ if (!existsSync29(hookPath)) {
279643
279658
  v3.warn("No post-commit hook found.");
279644
279659
  fe2("Nothing to uninstall.");
279645
279660
  return;
@@ -280486,7 +280501,7 @@ __export(agent_integrations_exports, {
280486
280501
  repairAgentIntegrations: () => repairAgentIntegrations
280487
280502
  });
280488
280503
  import { spawnSync as spawnSync2 } from "child_process";
280489
- import { existsSync as existsSync30, realpathSync as realpathSync2 } from "fs";
280504
+ import { existsSync as existsSync31, realpathSync as realpathSync2 } from "fs";
280490
280505
  import { mkdir as mkdir9, readFile as readFile10, writeFile as writeFile10 } from "fs/promises";
280491
280506
  import { basename as basename5, dirname as dirname8, resolve as resolve7 } from "path";
280492
280507
  import { homedir as homedir35 } from "os";
@@ -280608,7 +280623,7 @@ async function inspectCodexPluginBundle() {
280608
280623
  const manifestPath = `${pluginPath}/.codex-plugin/plugin.json`;
280609
280624
  const hooksPath = `${pluginPath}/hooks/hooks.json`;
280610
280625
  const mcpPath = codexPluginMcpPath();
280611
- if (!existsSync30(pluginPath)) {
280626
+ if (!existsSync31(pluginPath)) {
280612
280627
  return {
280613
280628
  scope: "global",
280614
280629
  kind: "bundle",
@@ -280618,7 +280633,7 @@ async function inspectCodexPluginBundle() {
280618
280633
  issues: ["codex-plugin-bundle-missing"]
280619
280634
  };
280620
280635
  }
280621
- if (!existsSync30(manifestPath)) {
280636
+ if (!existsSync31(manifestPath)) {
280622
280637
  return {
280623
280638
  scope: "global",
280624
280639
  kind: "bundle",
@@ -280655,7 +280670,7 @@ async function inspectCodexPluginBundle() {
280655
280670
  const issues = [];
280656
280671
  if (version2 !== getCliVersion()) issues.push("codex-plugin-version-mismatch");
280657
280672
  if (manifest.hooks !== "./hooks/hooks.json") issues.push("codex-hook-manifest-missing");
280658
- if (!existsSync30(mcpPath)) {
280673
+ if (!existsSync31(mcpPath)) {
280659
280674
  issues.push("codex-plugin-mcp-manifest-missing");
280660
280675
  } else {
280661
280676
  try {
@@ -280669,7 +280684,7 @@ async function inspectCodexPluginBundle() {
280669
280684
  }
280670
280685
  }
280671
280686
  let declared = [];
280672
- if (!existsSync30(hooksPath)) {
280687
+ if (!existsSync31(hooksPath)) {
280673
280688
  issues.push("codex-hook-manifest-missing");
280674
280689
  } else {
280675
280690
  try {
@@ -280696,7 +280711,7 @@ async function inspectCodexPluginBundle() {
280696
280711
  }
280697
280712
  async function inspectCodexMarketplace() {
280698
280713
  const marketplacePath = codexMarketplacePath();
280699
- if (!existsSync30(marketplacePath)) {
280714
+ if (!existsSync31(marketplacePath)) {
280700
280715
  return {
280701
280716
  scope: "global",
280702
280717
  kind: "marketplace",
@@ -280786,7 +280801,7 @@ function inspectCodexPluginRuntime() {
280786
280801
  }
280787
280802
  async function inspectCodexHookTrust() {
280788
280803
  const configPath = codexConfigPath();
280789
- if (!existsSync30(configPath)) {
280804
+ if (!existsSync31(configPath)) {
280790
280805
  return {
280791
280806
  scope: "global",
280792
280807
  kind: "hook-trust",
@@ -280887,7 +280902,7 @@ function defaultClaudeProjectKey(projectRoot) {
280887
280902
  }
280888
280903
  function canonicalProjectPath(projectRoot) {
280889
280904
  const resolved = resolve7(projectRoot);
280890
- const canonical = existsSync30(resolved) ? realpathSync2(resolved) : resolved;
280905
+ const canonical = existsSync31(resolved) ? realpathSync2(resolved) : resolved;
280891
280906
  return canonical.replace(/\\/g, "/");
280892
280907
  }
280893
280908
  function getClaudeLocalConfigPath() {
@@ -280919,7 +280934,7 @@ function findClaudeLocalProject(config2, projectRoot) {
280919
280934
  }
280920
280935
  async function inspectClaudeLocalMcp(projectRoot) {
280921
280936
  const configPath = getClaudeLocalConfigPath();
280922
- if (!existsSync30(configPath)) {
280937
+ if (!existsSync31(configPath)) {
280923
280938
  return {
280924
280939
  scope: "local",
280925
280940
  path: configPath,
@@ -281007,7 +281022,7 @@ async function inspectCodexPluginMcp() {
281007
281022
  const runtime = inspectCodexPluginRuntime();
281008
281023
  if (!runtime.runtime?.installed || !runtime.runtime.enabled) return null;
281009
281024
  const mcpPath = codexPluginMcpPath();
281010
- if (!existsSync30(mcpPath)) {
281025
+ if (!existsSync31(mcpPath)) {
281011
281026
  return {
281012
281027
  scope: "global",
281013
281028
  path: mcpPath,
@@ -281075,7 +281090,7 @@ async function inspectMcp(agent, projectRoot, scope) {
281075
281090
  if (targetScope === "global" && configPath === adapter.getConfigPath(projectRoot) && scope === "all") {
281076
281091
  continue;
281077
281092
  }
281078
- if (!existsSync30(configPath)) {
281093
+ if (!existsSync31(configPath)) {
281079
281094
  checks.push({
281080
281095
  scope: targetScope,
281081
281096
  path: configPath,
@@ -281152,7 +281167,7 @@ async function inspectGuidance(agent, projectRoot, scope) {
281152
281167
  for (const targetScope of requestedGuidanceScopes(scope)) {
281153
281168
  const root = targetScope === "project" ? projectRoot : homedir35();
281154
281169
  const rulesPath = getAgentRulesPath(agent, root, targetScope === "global");
281155
- if (!existsSync30(rulesPath)) {
281170
+ if (!existsSync31(rulesPath)) {
281156
281171
  checks.push({
281157
281172
  scope: targetScope,
281158
281173
  path: rulesPath,
@@ -281430,7 +281445,7 @@ var init_doctor = __esm({
281430
281445
  }
281431
281446
  return;
281432
281447
  }
281433
- const { existsSync: existsSync35, readFileSync: readFileSync25 } = await import("fs");
281448
+ const { existsSync: existsSync36, readFileSync: readFileSync25 } = await import("fs");
281434
281449
  const { join: join35, basename: basename7 } = await import("path");
281435
281450
  const { homedir: homedir37 } = await import("os");
281436
281451
  const { execSync: execSync5 } = await import("child_process");
@@ -281501,7 +281516,7 @@ var init_doctor = __esm({
281501
281516
  let bgPid = 0;
281502
281517
  let backgroundHealthy = false;
281503
281518
  try {
281504
- if (existsSync35(bgStatePath)) {
281519
+ if (existsSync36(bgStatePath)) {
281505
281520
  const bgState = JSON.parse(readFileSync25(bgStatePath, "utf-8"));
281506
281521
  bgPid = bgState.pid;
281507
281522
  bgPort = bgState.port;
@@ -281616,7 +281631,7 @@ var init_doctor = __esm({
281616
281631
  }
281617
281632
  try {
281618
281633
  const cachePath = join35(memorixDir, "embedding-cache.json");
281619
- if (existsSync35(cachePath)) {
281634
+ if (existsSync36(cachePath)) {
281620
281635
  const cache5 = JSON.parse(readFileSync25(cachePath, "utf-8"));
281621
281636
  const cacheCount = Object.keys(cache5).length;
281622
281637
  lines.push(info2(`Cached embeddings: ${cacheCount}`));
@@ -281631,7 +281646,7 @@ var init_doctor = __esm({
281631
281646
  }
281632
281647
  lines.push("");
281633
281648
  lines.push("\u250C\u2500 Data Status \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
281634
- if (dataDir && existsSync35(dataDir)) {
281649
+ if (dataDir && existsSync36(dataDir)) {
281635
281650
  let obsCount = 0;
281636
281651
  let activeCount = 0;
281637
281652
  let ranCount = 0;
@@ -281819,7 +281834,7 @@ var init_doctor = __esm({
281819
281834
  let conflictsFound = false;
281820
281835
  if (dataDir) {
281821
281836
  const lockFile = join35(dataDir, ".memorix.lock");
281822
- if (existsSync35(lockFile)) {
281837
+ if (existsSync36(lockFile)) {
281823
281838
  try {
281824
281839
  const lockData = JSON.parse(readFileSync25(lockFile, "utf-8"));
281825
281840
  const lockAge = Date.now() - lockData.time;
@@ -284026,7 +284041,7 @@ var init_pipeline_trace = __esm({
284026
284041
 
284027
284042
  // src/orchestrate/worktree.ts
284028
284043
  import { execFileSync as execFileSync5 } from "child_process";
284029
- import { existsSync as existsSync32, rmSync as rmSync2 } from "fs";
284044
+ import { existsSync as existsSync33, rmSync as rmSync2 } from "fs";
284030
284045
  import { join as join33, basename as basename6 } from "path";
284031
284046
  function runGit4(cwd, args, timeout = 5e3) {
284032
284047
  return String(execFileSync5("git", args, {
@@ -284072,7 +284087,7 @@ function createWorktree(projectDir2, taskId, pipelineId) {
284072
284087
  const suffix = attempt === 1 ? "" : `-${attempt}`;
284073
284088
  const worktreePath = `${worktreeBase}${suffix}`;
284074
284089
  const branch = `${branchBase}${suffix}`;
284075
- if (existsSync32(worktreePath)) continue;
284090
+ if (existsSync33(worktreePath)) continue;
284076
284091
  if (!isBranchAvailable(projectDir2, branch)) continue;
284077
284092
  runGit4(projectDir2, ["worktree", "add", "-b", branch, worktreePath], 3e4);
284078
284093
  return { worktreePath, branch };
@@ -284123,7 +284138,7 @@ function removeWorktree(projectDir2, worktreePath, branch) {
284123
284138
  try {
284124
284139
  runGit4(projectDir2, ["worktree", "remove", worktreePath, "--force"], 1e4);
284125
284140
  } catch {
284126
- if (existsSync32(worktreePath)) {
284141
+ if (existsSync33(worktreePath)) {
284127
284142
  try {
284128
284143
  rmSync2(worktreePath, { recursive: true, force: true });
284129
284144
  } catch {
@@ -290064,10 +290079,10 @@ function WorkbenchApp({ version: version2, onExitForInteractive }) {
290064
290079
  }
290065
290080
  try {
290066
290081
  const { resolveHooksDir: resolveHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
290067
- const { existsSync: existsSync35, readFileSync: readFileSync25, writeFileSync: writeFileSync13, unlinkSync: unlinkSync5 } = await import("fs");
290082
+ const { existsSync: existsSync36, readFileSync: readFileSync25, writeFileSync: writeFileSync13, unlinkSync: unlinkSync5 } = await import("fs");
290068
290083
  const resolved = resolveHooksDir2(proj.rootPath);
290069
290084
  const hookMarker = "# [memorix-git-hook]";
290070
- if (!resolved || !existsSync35(resolved.hookPath)) {
290085
+ if (!resolved || !existsSync36(resolved.hookPath)) {
290071
290086
  setActionStatus("No post-commit hook found.");
290072
290087
  return;
290073
290088
  }
@@ -290222,7 +290237,7 @@ function WorkbenchApp({ version: version2, onExitForInteractive }) {
290222
290237
  break;
290223
290238
  }
290224
290239
  case "3": {
290225
- const { existsSync: existsSync35, readFileSync: readFileSync25, writeFileSync: writeFileSync13, chmodSync: chmodSync2 } = await import("fs");
290240
+ const { existsSync: existsSync36, readFileSync: readFileSync25, writeFileSync: writeFileSync13, chmodSync: chmodSync2 } = await import("fs");
290226
290241
  const { ensureHooksDir: ensureHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
290227
290242
  const hookMarker = "# [memorix-git-hook]";
290228
290243
  const resolved = ensureHooksDir2(cwd);
@@ -290236,7 +290251,7 @@ if command -v memorix >/dev/null 2>&1; then
290236
290251
  memorix ingest commit --auto >/dev/null 2>&1 &
290237
290252
  fi
290238
290253
  `;
290239
- if (existsSync35(resolved.hookPath)) {
290254
+ if (existsSync36(resolved.hookPath)) {
290240
290255
  if (readFileSync25(resolved.hookPath, "utf-8").includes(hookMarker)) {
290241
290256
  setActionStatus("Post-commit hook already installed.");
290242
290257
  break;
@@ -290256,11 +290271,11 @@ ${hookScript}`, "utf-8");
290256
290271
  break;
290257
290272
  }
290258
290273
  case "4": {
290259
- const { existsSync: existsSync35, readFileSync: readFileSync25, writeFileSync: writeFileSync13, unlinkSync: unlinkSync5 } = await import("fs");
290274
+ const { existsSync: existsSync36, readFileSync: readFileSync25, writeFileSync: writeFileSync13, unlinkSync: unlinkSync5 } = await import("fs");
290260
290275
  const { resolveHooksDir: resolveHooksDir2 } = await Promise.resolve().then(() => (init_hooks_path(), hooks_path_exports));
290261
290276
  const hookMarker = "# [memorix-git-hook]";
290262
290277
  const resolved = resolveHooksDir2(cwd);
290263
- if (!resolved || !existsSync35(resolved.hookPath)) {
290278
+ if (!resolved || !existsSync36(resolved.hookPath)) {
290264
290279
  setActionStatus("No post-commit hook found.");
290265
290280
  break;
290266
290281
  }
@@ -291072,6 +291087,14 @@ function printCliGuideForHelp(argv2 = process.argv.slice(2)) {
291072
291087
  return true;
291073
291088
  }
291074
291089
 
291090
+ // src/cli/default-mode.ts
291091
+ init_esm_shims();
291092
+ function shouldDefaultToMcp(options = {}) {
291093
+ const stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY;
291094
+ const stdoutIsTTY = options.stdoutIsTTY ?? process.stdout.isTTY;
291095
+ return stdinIsTTY !== true || stdoutIsTTY !== true;
291096
+ }
291097
+
291075
291098
  // src/cli/index.ts
291076
291099
  installCliPipeErrorGuard();
291077
291100
  var NO_GIT_MSG = "Memorix requires a git repo to establish project identity. Run `git init` in this workspace first.";
@@ -291382,6 +291405,11 @@ var main2 = defineCommand({
291382
291405
  ];
291383
291406
  if (firstArg && knownSubs.includes(firstArg)) return;
291384
291407
  if (!firstArg) {
291408
+ if (shouldDefaultToMcp()) {
291409
+ const serve = await Promise.resolve().then(() => (init_serve(), serve_exports));
291410
+ await serve.default.run?.({ args: {}, rawArgs: [], cmd: serve.default });
291411
+ return;
291412
+ }
291385
291413
  try {
291386
291414
  const { runCli } = await importBundledMemcode();
291387
291415
  await runCli(process.argv.slice(2));