memorix 1.10.2 → 1.10.3
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/CHANGELOG.md +20 -0
- package/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/dist/cli/index.js +397 -215
- package/dist/cli/memcode.js +0 -0
- package/dist/index.js +150 -38
- package/dist/maintenance-runner.js +108 -22
- package/dist/media-audio-runner.js +108 -22
- package/dist/media-video-runner.js +108 -22
- package/dist/memcode-runtime/CHANGELOG.md +20 -0
- package/dist/sdk.js +149 -37
- package/dist/types.d.ts +1 -1
- package/dist/vector-backfill-runner.js +108 -22
- package/docs/CONFIGURATION.md +34 -0
- package/docs/DEVELOPMENT.md +1 -1
- package/docs/INTEGRATIONS.md +1 -1
- package/docs/README.md +2 -1
- package/docs/ROADMAP-1.9.12-2.0.md +1 -1
- package/docs/SETUP.md +19 -4
- package/package.json +1 -1
- package/plugins/antigravity/memorix/plugin.json +1 -1
- package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
- package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
- package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/copilot/memorix/plugin.json +1 -1
- package/plugins/gemini/memorix/gemini-extension.json +1 -1
- package/plugins/hermes/memorix/plugin.yaml +1 -1
- package/plugins/omp/memorix/package.json +1 -1
- package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/memorix/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/commands/agent-integrations.ts +1 -1
- package/src/cli/commands/background.ts +1 -1
- package/src/cli/commands/context.ts +3 -2
- package/src/cli/commands/doctor.ts +9 -0
- package/src/cli/commands/explain.ts +3 -2
- package/src/cli/commands/init.ts +6 -2
- package/src/cli/commands/setup.ts +9 -6
- package/src/cli/commands/uninstall.ts +15 -0
- package/src/cli/tui/App.tsx +9 -16
- package/src/cli/tui/ConfigureView.tsx +2 -0
- package/src/codegraph/auto-context.ts +1 -1
- package/src/codegraph/store.ts +37 -0
- package/src/codegraph/types.ts +3 -0
- package/src/config/dotenv-loader.ts +1 -0
- package/src/config/resolved-config.ts +7 -2
- package/src/config/toml-loader.ts +1 -0
- package/src/config/yaml-loader.ts +4 -2
- package/src/dashboard/server.ts +5 -6
- package/src/hooks/handler.ts +0 -1
- package/src/integrations/registry.ts +2 -1
- package/src/llm/provider.ts +2 -1
- package/src/memory/observations.ts +61 -17
- package/src/multimodal/image-loader.ts +2 -2
- package/src/runtime/open-browser.ts +25 -0
- package/src/server.ts +2 -2
- package/src/store/orama-store.ts +27 -3
- package/src/types.ts +1 -1
- package/src/workspace/mcp-adapters/pi.ts +58 -0
- package/plugins/pi/memorix/skills/memorix-git-memory/SKILL.md +0 -26
- package/plugins/pi/memorix/skills/memorix-memory/SKILL.md +0 -51
- package/plugins/pi/memorix/skills/memorix-mini-skills/SKILL.md +0 -31
- package/plugins/pi/memorix/skills/memorix-orchestrate/SKILL.md +0 -28
- package/plugins/pi/memorix/skills/memorix-reasoning/SKILL.md +0 -30
- package/plugins/pi/memorix/skills/memorix-sessions/SKILL.md +0 -25
- package/plugins/pi/memorix/skills/memorix-troubleshooting/SKILL.md +0 -27
|
@@ -2408,7 +2408,8 @@ function getResolvedConfig(options = {}) {
|
|
|
2408
2408
|
const isRequesty = memoryLlmProvider === "requesty";
|
|
2409
2409
|
const isApiRoute = memoryLlmProvider === "apiroute";
|
|
2410
2410
|
const isCheaperInference = memoryLlmProvider === "cheaperinference";
|
|
2411
|
-
const
|
|
2411
|
+
const isRuncrate = memoryLlmProvider === "runcrate";
|
|
2412
|
+
const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference || isRuncrate;
|
|
2412
2413
|
const memoryLlmApiKey = first(
|
|
2413
2414
|
process.env.MEMORIX_LLM_API_KEY,
|
|
2414
2415
|
process.env.MEMORIX_API_KEY,
|
|
@@ -2416,7 +2417,7 @@ function getResolvedConfig(options = {}) {
|
|
|
2416
2417
|
yaml.llm?.apiKey,
|
|
2417
2418
|
legacy.llm?.apiKey,
|
|
2418
2419
|
// Never borrow another provider's credentials for these gateway presets.
|
|
2419
|
-
isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : isCheaperInference ? process.env.CHEAPER_INFERENCE_API_KEY : process.env.OPENAI_API_KEY,
|
|
2420
|
+
isAtlasCloud ? process.env.ATLASCLOUD_API_KEY : isRequesty ? process.env.REQUESTY_API_KEY : isApiRoute ? process.env.API_ROUTE_API_KEY : isCheaperInference ? process.env.CHEAPER_INFERENCE_API_KEY : isRuncrate ? process.env.RUNCRATE_API_KEY : process.env.OPENAI_API_KEY,
|
|
2420
2421
|
usesPresetKeyOnly ? void 0 : process.env.ANTHROPIC_API_KEY,
|
|
2421
2422
|
usesPresetKeyOnly ? void 0 : openRouterMemoryLlmApiKey
|
|
2422
2423
|
);
|
|
@@ -2487,6 +2488,7 @@ function getResolvedConfig(options = {}) {
|
|
|
2487
2488
|
codegraph: {
|
|
2488
2489
|
excludePatterns: firstArray(toml.codegraph?.exclude_patterns, yaml.codegraph?.excludePatterns),
|
|
2489
2490
|
maxFileBytes: firstNumber(toml.codegraph?.max_file_bytes, yaml.codegraph?.maxFileBytes),
|
|
2491
|
+
autoRefresh: first(toml.codegraph?.auto_refresh, yaml.codegraph?.autoRefresh, "auto"),
|
|
2490
2492
|
externalContext: first(
|
|
2491
2493
|
normalizeExternalContext(process.env.MEMORIX_CODEGRAPH_EXTERNAL_CONTEXT),
|
|
2492
2494
|
toml.codegraph?.external_context,
|
|
@@ -2601,6 +2603,7 @@ function getEnvSourceNames() {
|
|
|
2601
2603
|
"REQUESTY_API_KEY",
|
|
2602
2604
|
"API_ROUTE_API_KEY",
|
|
2603
2605
|
"CHEAPER_INFERENCE_API_KEY",
|
|
2606
|
+
"RUNCRATE_API_KEY",
|
|
2604
2607
|
"ATLASCLOUD_API_KEY"
|
|
2605
2608
|
].filter((name) => process.env[name]);
|
|
2606
2609
|
}
|
|
@@ -5596,6 +5599,7 @@ var init_provider2 = __esm({
|
|
|
5596
5599
|
requesty: { baseUrl: "https://router.requesty.ai/v1", model: "openai/gpt-4.1-nano" },
|
|
5597
5600
|
apiroute: { baseUrl: "https://global.api-route.com/v1", model: "deepseek-v4.1-flash" },
|
|
5598
5601
|
cheaperinference: { baseUrl: "https://api.cheaperinference.com/v1", model: "gpt-5.4-mini" },
|
|
5602
|
+
runcrate: { baseUrl: "https://api.runcrate.ai/v1", model: "deepseek-ai/DeepSeek-V4.1-Flash" },
|
|
5599
5603
|
atlascloud: { baseUrl: "https://api.atlascloud.ai/v1", model: "deepseek-ai/deepseek-v3.2" },
|
|
5600
5604
|
custom: { baseUrl: "http://localhost:11434/v1", model: "llama3" }
|
|
5601
5605
|
};
|
|
@@ -7303,10 +7307,18 @@ __export(orama_store_exports, {
|
|
|
7303
7307
|
queueSemanticVector: () => queueSemanticVector,
|
|
7304
7308
|
removeObservation: () => removeObservation,
|
|
7305
7309
|
resetDb: () => resetDb,
|
|
7310
|
+
resolveSearchFuzzyTolerance: () => resolveSearchFuzzyTolerance,
|
|
7306
7311
|
searchObservations: () => searchObservations,
|
|
7307
7312
|
updateObservationMetadata: () => updateObservationMetadata
|
|
7308
7313
|
});
|
|
7309
7314
|
import { components, create, insert as insert2, insertMultiple, search, remove as remove2, update, count, getByID } from "@orama/orama";
|
|
7315
|
+
function resolveSearchFuzzyTolerance(query, quality) {
|
|
7316
|
+
if (quality === "fast") return void 0;
|
|
7317
|
+
const characters = [...query];
|
|
7318
|
+
const cjkCount = characters.filter((char) => /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]/u.test(char)).length;
|
|
7319
|
+
if (characters.length > 0 && cjkCount / characters.length > 0.3) return void 0;
|
|
7320
|
+
return query.length > 6 ? 2 : 1;
|
|
7321
|
+
}
|
|
7310
7322
|
function rememberSearchMode(key, value) {
|
|
7311
7323
|
if (!lastSearchModeByProject.has(key) && lastSearchModeByProject.size >= MAX_SEARCH_MODE_KEYS) {
|
|
7312
7324
|
const oldest = lastSearchModeByProject.keys().next().value;
|
|
@@ -7952,7 +7964,10 @@ async function searchObservations(options) {
|
|
|
7952
7964
|
// Fuzzy tolerance: allow 1-char typos for short queries, 2 for longer
|
|
7953
7965
|
// Fuzzy matching is useful for ordinary recall, but grows sharply with
|
|
7954
7966
|
// corpus size. The fast profile deliberately uses exact lexical matching.
|
|
7955
|
-
...hasQuery
|
|
7967
|
+
...hasQuery ? (() => {
|
|
7968
|
+
const tolerance = resolveSearchFuzzyTolerance(originalQuery, quality);
|
|
7969
|
+
return tolerance === void 0 ? {} : { tolerance };
|
|
7970
|
+
})() : {}
|
|
7956
7971
|
};
|
|
7957
7972
|
let queryVector = null;
|
|
7958
7973
|
let embeddingProviderForSearch = null;
|
|
@@ -8183,14 +8198,16 @@ async function searchObservations(options) {
|
|
|
8183
8198
|
filesModified: doc.filesModified?.split?.("\n") ?? (Array.isArray(doc.filesModified) ? doc.filesModified : [])
|
|
8184
8199
|
});
|
|
8185
8200
|
}
|
|
8201
|
+
const topScore = Math.max(...intermediate.map((entry) => entry.score));
|
|
8202
|
+
const affinityTieWindow = topScore * 0.92;
|
|
8186
8203
|
intermediate = intermediate.map((entry) => {
|
|
8187
8204
|
const memory = memoryContentMap.get(entry.id);
|
|
8188
8205
|
if (!memory) return entry;
|
|
8189
8206
|
const { score: affinityScore } = calculateProjectAffinity(memory, affinityContext);
|
|
8207
|
+
if (entry.score < affinityTieWindow) return entry;
|
|
8190
8208
|
return {
|
|
8191
8209
|
...entry,
|
|
8192
|
-
score: entry.score * affinityScore
|
|
8193
|
-
// Apply affinity as multiplier
|
|
8210
|
+
score: entry.score * (0.98 + affinityScore * 0.02)
|
|
8194
8211
|
};
|
|
8195
8212
|
});
|
|
8196
8213
|
intermediate.sort((a, b) => b.score - a.score);
|
|
@@ -10392,6 +10409,7 @@ var init_store = __esm({
|
|
|
10392
10409
|
recordCodeStateSnapshot(input) {
|
|
10393
10410
|
const id = randomUUID4();
|
|
10394
10411
|
let snapshot;
|
|
10412
|
+
let compactNeeded = false;
|
|
10395
10413
|
const tx = this.db.transaction(() => {
|
|
10396
10414
|
const previous = this.db.prepare(
|
|
10397
10415
|
"SELECT id, sourceEpoch FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT 1"
|
|
@@ -10435,6 +10453,26 @@ var init_store = __esm({
|
|
|
10435
10453
|
for (const file of snapshotFileRows) {
|
|
10436
10454
|
insertSnapshotFile.run(id, file.projectId, file.id, file.path, file.contentHash);
|
|
10437
10455
|
}
|
|
10456
|
+
const staleSymbolIds = this.db.prepare(
|
|
10457
|
+
"SELECT id FROM code_symbols WHERE projectId = ? AND stale = 1"
|
|
10458
|
+
).all(input.projectId).map((row) => row.id);
|
|
10459
|
+
if (staleSymbolIds.length > 0) {
|
|
10460
|
+
const placeholders = staleSymbolIds.map(() => "?").join(", ");
|
|
10461
|
+
this.db.prepare(
|
|
10462
|
+
`DELETE FROM code_edges WHERE projectId = ? AND (fromSymbolId IN (${placeholders}) OR toSymbolId IN (${placeholders}))`
|
|
10463
|
+
).run(input.projectId, ...staleSymbolIds, ...staleSymbolIds);
|
|
10464
|
+
this.db.prepare("DELETE FROM code_symbols WHERE projectId = ? AND stale = 1").run(input.projectId);
|
|
10465
|
+
compactNeeded = true;
|
|
10466
|
+
}
|
|
10467
|
+
const oldSnapshots = this.db.prepare(
|
|
10468
|
+
"SELECT id FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT -1 OFFSET 2"
|
|
10469
|
+
).all(input.projectId).map((row) => row.id);
|
|
10470
|
+
if (oldSnapshots.length > 0) {
|
|
10471
|
+
const placeholders = oldSnapshots.map(() => "?").join(", ");
|
|
10472
|
+
this.db.prepare(`DELETE FROM code_state_snapshot_files WHERE snapshotId IN (${placeholders})`).run(...oldSnapshots);
|
|
10473
|
+
this.db.prepare(`DELETE FROM code_state_snapshots WHERE id IN (${placeholders})`).run(...oldSnapshots);
|
|
10474
|
+
compactNeeded = true;
|
|
10475
|
+
}
|
|
10438
10476
|
snapshot = {
|
|
10439
10477
|
...input,
|
|
10440
10478
|
id,
|
|
@@ -10443,11 +10481,24 @@ var init_store = __esm({
|
|
|
10443
10481
|
};
|
|
10444
10482
|
});
|
|
10445
10483
|
tx();
|
|
10484
|
+
if (compactNeeded) this.compactStorage();
|
|
10446
10485
|
return snapshot;
|
|
10447
10486
|
}
|
|
10487
|
+
/** Reclaim WAL/free pages after a derived codegraph sweep. */
|
|
10488
|
+
compactStorage() {
|
|
10489
|
+
try {
|
|
10490
|
+
this.db.pragma("wal_checkpoint(TRUNCATE)");
|
|
10491
|
+
} catch {
|
|
10492
|
+
}
|
|
10493
|
+
try {
|
|
10494
|
+
this.db.exec("VACUUM");
|
|
10495
|
+
} catch {
|
|
10496
|
+
}
|
|
10497
|
+
}
|
|
10448
10498
|
status(projectId) {
|
|
10449
10499
|
const files = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ?`).get(projectId).count;
|
|
10450
10500
|
const symbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0`).get(projectId).count;
|
|
10501
|
+
const staleSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 1`).get(projectId).count;
|
|
10451
10502
|
const edges = this.db.prepare(`SELECT COUNT(*) AS count FROM code_edges WHERE projectId = ?`).get(projectId).count;
|
|
10452
10503
|
const refs = this.db.prepare(`SELECT COUNT(*) AS count FROM observation_code_refs WHERE projectId = ?`).get(projectId).count;
|
|
10453
10504
|
const semanticSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0 AND source = 'typescript-compiler'`).get(projectId).count;
|
|
@@ -10455,6 +10506,8 @@ var init_store = __esm({
|
|
|
10455
10506
|
const parserErrors = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ? AND parserError IS NOT NULL`).get(projectId).count;
|
|
10456
10507
|
const latest = this.db.prepare(`SELECT MAX(indexedAt) AS indexedAt FROM code_files WHERE projectId = ?`).get(projectId);
|
|
10457
10508
|
const latestSnapshot = this.latestSnapshot(projectId);
|
|
10509
|
+
const snapshots = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshots WHERE projectId = ?`).get(projectId).count;
|
|
10510
|
+
const snapshotFiles = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshot_files WHERE projectId = ?`).get(projectId).count;
|
|
10458
10511
|
return {
|
|
10459
10512
|
provider: "lite",
|
|
10460
10513
|
files,
|
|
@@ -10464,6 +10517,9 @@ var init_store = __esm({
|
|
|
10464
10517
|
semanticSymbols,
|
|
10465
10518
|
semanticEdges,
|
|
10466
10519
|
parserErrors,
|
|
10520
|
+
staleSymbols,
|
|
10521
|
+
snapshots,
|
|
10522
|
+
snapshotFiles,
|
|
10467
10523
|
...latest?.indexedAt ? { indexedAt: latest.indexedAt } : {},
|
|
10468
10524
|
...latestSnapshot ? { latestSnapshot } : {}
|
|
10469
10525
|
};
|
|
@@ -10669,10 +10725,22 @@ function resetObservationRuntime() {
|
|
|
10669
10725
|
loadedObservationStore = null;
|
|
10670
10726
|
embeddingWriteMode = "background";
|
|
10671
10727
|
embeddingWorkerProjectRoot = void 0;
|
|
10672
|
-
|
|
10728
|
+
clearVectorMissingIds();
|
|
10673
10729
|
vectorSchemaUpgradePromise = null;
|
|
10674
10730
|
embeddingFailureLogTimestamps.clear();
|
|
10675
10731
|
}
|
|
10732
|
+
function markVectorMissing(observationId2, projectId) {
|
|
10733
|
+
vectorMissingIds.add(observationId2);
|
|
10734
|
+
vectorMissingProjectIds.set(observationId2, projectId);
|
|
10735
|
+
}
|
|
10736
|
+
function clearVectorMissing(observationId2) {
|
|
10737
|
+
vectorMissingIds.delete(observationId2);
|
|
10738
|
+
vectorMissingProjectIds.delete(observationId2);
|
|
10739
|
+
}
|
|
10740
|
+
function clearVectorMissingIds() {
|
|
10741
|
+
vectorMissingIds.clear();
|
|
10742
|
+
vectorMissingProjectIds.clear();
|
|
10743
|
+
}
|
|
10676
10744
|
function logEmbeddingFailureOnce(key, message) {
|
|
10677
10745
|
const now3 = Date.now();
|
|
10678
10746
|
const last = embeddingFailureLogTimestamps.get(key) ?? 0;
|
|
@@ -10792,10 +10860,13 @@ function isVectorCompatibleWithCurrentIndex(embedding) {
|
|
|
10792
10860
|
}
|
|
10793
10861
|
async function upgradeVectorSchemaAfterFirstEmbedding(embedding) {
|
|
10794
10862
|
if (isVectorCompatibleWithCurrentIndex(embedding)) return true;
|
|
10795
|
-
if (
|
|
10863
|
+
if (!embedding.every(Number.isFinite)) return false;
|
|
10796
10864
|
const targetProjectDir = projectDir;
|
|
10797
10865
|
if (!vectorSchemaUpgradePromise) {
|
|
10798
|
-
vectorSchemaUpgradePromise =
|
|
10866
|
+
vectorSchemaUpgradePromise = getDb().then(async () => {
|
|
10867
|
+
if (getVectorDimensions() === null && observations.length > 0) await reindexObservations();
|
|
10868
|
+
return projectDir === targetProjectDir && isVectorCompatibleWithCurrentIndex(embedding);
|
|
10869
|
+
}).catch(() => false).finally(() => {
|
|
10799
10870
|
vectorSchemaUpgradePromise = null;
|
|
10800
10871
|
});
|
|
10801
10872
|
}
|
|
@@ -10835,9 +10906,9 @@ async function initObservations(dir, options = {}) {
|
|
|
10835
10906
|
}
|
|
10836
10907
|
function scheduleObservationEmbedding(input) {
|
|
10837
10908
|
const { observationId: observationId2, projectId, searchableText, doc } = input;
|
|
10838
|
-
|
|
10909
|
+
markVectorMissing(observationId2, projectId);
|
|
10839
10910
|
if (isEmbeddingExplicitlyDisabled()) {
|
|
10840
|
-
|
|
10911
|
+
clearVectorMissing(observationId2);
|
|
10841
10912
|
return;
|
|
10842
10913
|
}
|
|
10843
10914
|
if (embeddingWriteMode === "deferred") {
|
|
@@ -10872,13 +10943,13 @@ function scheduleObservationEmbedding(input) {
|
|
|
10872
10943
|
vector: embedding
|
|
10873
10944
|
});
|
|
10874
10945
|
}
|
|
10875
|
-
|
|
10946
|
+
clearVectorMissing(observationId2);
|
|
10876
10947
|
} catch {
|
|
10877
10948
|
console.error(`[memorix] Embedding index update failed for obs-${observationId2} (kept in backfill queue)`);
|
|
10878
10949
|
queueVectorBackfill(projectId);
|
|
10879
10950
|
}
|
|
10880
10951
|
} else if (isEmbeddingExplicitlyDisabled()) {
|
|
10881
|
-
|
|
10952
|
+
clearVectorMissing(observationId2);
|
|
10882
10953
|
} else {
|
|
10883
10954
|
queueVectorBackfill(projectId);
|
|
10884
10955
|
logEmbeddingFailureOnce(
|
|
@@ -11438,7 +11509,7 @@ async function reindexObservations() {
|
|
|
11438
11509
|
if (observations.length === 0) return 0;
|
|
11439
11510
|
await resetDb();
|
|
11440
11511
|
searchIndexPrepared = false;
|
|
11441
|
-
|
|
11512
|
+
clearVectorMissingIds();
|
|
11442
11513
|
let embeddings = observations.map(() => null);
|
|
11443
11514
|
const provider2 = await getEmbeddingProvider();
|
|
11444
11515
|
const canBatchEmbedAtStartup = provider2 !== null && !provider2.name.startsWith("api-");
|
|
@@ -11503,7 +11574,7 @@ async function reindexObservations() {
|
|
|
11503
11574
|
};
|
|
11504
11575
|
await insertObservation(doc);
|
|
11505
11576
|
if (!compatibleEmbedding && !isEmbeddingExplicitlyDisabled()) {
|
|
11506
|
-
|
|
11577
|
+
markVectorMissing(obs.id, obs.projectId);
|
|
11507
11578
|
}
|
|
11508
11579
|
count2++;
|
|
11509
11580
|
} catch (err) {
|
|
@@ -11520,7 +11591,17 @@ async function prepareSearchIndex(options = {}) {
|
|
|
11520
11591
|
if (!isEmbeddingExplicitlyDisabled()) {
|
|
11521
11592
|
const store = getObservationStore();
|
|
11522
11593
|
const projects = await store.listProjectIds?.() ?? [];
|
|
11523
|
-
|
|
11594
|
+
await getDb({ allowNetworkProbe: false }).catch(() => void 0);
|
|
11595
|
+
const persistedIds = projectDir ? await getPersistentSemanticVectorIds(projectDir).catch(() => null) : null;
|
|
11596
|
+
for (const projectId of projects) {
|
|
11597
|
+
const projectObservations = await store.loadByProject(projectId);
|
|
11598
|
+
for (const observation of projectObservations) {
|
|
11599
|
+
if (!persistedIds?.has(observation.id)) markVectorMissing(observation.id, observation.projectId);
|
|
11600
|
+
}
|
|
11601
|
+
if (projectObservations.some((observation) => !persistedIds?.has(observation.id))) {
|
|
11602
|
+
queueVectorBackfill(projectId);
|
|
11603
|
+
}
|
|
11604
|
+
}
|
|
11524
11605
|
}
|
|
11525
11606
|
return 0;
|
|
11526
11607
|
}
|
|
@@ -11534,13 +11615,13 @@ async function prepareSearchIndex(options = {}) {
|
|
|
11534
11615
|
const hydratedProjectDir = projectDir;
|
|
11535
11616
|
const queueMissingVectors = async () => {
|
|
11536
11617
|
if (!hydratedProjectDir || projectDir !== hydratedProjectDir) return;
|
|
11537
|
-
|
|
11618
|
+
clearVectorMissingIds();
|
|
11538
11619
|
if (!isEmbeddingExplicitlyDisabled()) {
|
|
11539
11620
|
const persistedSemanticIds = await getPersistentSemanticVectorIds(hydratedProjectDir).catch(() => null);
|
|
11540
11621
|
const projectsWithMissingVectors = /* @__PURE__ */ new Set();
|
|
11541
11622
|
for (const obs of observations) {
|
|
11542
11623
|
if (!hasObservationVector(obs.projectId, obs.id) && !persistedSemanticIds?.has(obs.id)) {
|
|
11543
|
-
|
|
11624
|
+
markVectorMissing(obs.id, obs.projectId);
|
|
11544
11625
|
projectsWithMissingVectors.add(obs.projectId);
|
|
11545
11626
|
}
|
|
11546
11627
|
}
|
|
@@ -11558,6 +11639,9 @@ async function prepareSearchIndex(options = {}) {
|
|
|
11558
11639
|
}
|
|
11559
11640
|
function getVectorMissingIds(projectId) {
|
|
11560
11641
|
if (!projectId) return [...vectorMissingIds];
|
|
11642
|
+
if (!corpusLoaded) {
|
|
11643
|
+
return [...vectorMissingIds].filter((id) => vectorMissingProjectIds.get(id) === projectId);
|
|
11644
|
+
}
|
|
11561
11645
|
const observationById = new Map(observations.map((observation) => [observation.id, observation]));
|
|
11562
11646
|
return [...vectorMissingIds].filter((id) => observationById.get(id)?.projectId === projectId);
|
|
11563
11647
|
}
|
|
@@ -11595,7 +11679,8 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
11595
11679
|
return { attempted: 0, succeeded: 0, failed: 0 };
|
|
11596
11680
|
}
|
|
11597
11681
|
vectorBackfillRunning = true;
|
|
11598
|
-
const
|
|
11682
|
+
const sourceObservations = corpusLoaded ? observations : options.projectId ? await getObservationStore().loadByProject(options.projectId, { status: "active" }) : await getObservationStore().loadAll();
|
|
11683
|
+
const observationById = new Map(sourceObservations.map((observation) => [observation.id, observation]));
|
|
11599
11684
|
const limit2 = Number.isFinite(options.limit) ? Math.max(1, Math.floor(options.limit)) : Number.POSITIVE_INFINITY;
|
|
11600
11685
|
const ids = [...vectorMissingIds].filter((id) => !options.projectId || observationById.get(id)?.projectId === options.projectId).slice(0, limit2);
|
|
11601
11686
|
let succeeded = 0;
|
|
@@ -11608,7 +11693,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
11608
11693
|
for (const id of ids) {
|
|
11609
11694
|
const observation = observationById.get(id);
|
|
11610
11695
|
if (!observation) {
|
|
11611
|
-
|
|
11696
|
+
clearVectorMissing(id);
|
|
11612
11697
|
continue;
|
|
11613
11698
|
}
|
|
11614
11699
|
candidates.push({
|
|
@@ -11626,7 +11711,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
11626
11711
|
const provider2 = await getEmbeddingProvider();
|
|
11627
11712
|
if (!provider2) {
|
|
11628
11713
|
if (isEmbeddingExplicitlyDisabled()) {
|
|
11629
|
-
for (const candidate of candidates)
|
|
11714
|
+
for (const candidate of candidates) clearVectorMissing(candidate.id);
|
|
11630
11715
|
} else {
|
|
11631
11716
|
recordFailure("embedding provider unavailable");
|
|
11632
11717
|
failed += candidates.length;
|
|
@@ -11703,7 +11788,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
11703
11788
|
vector: embedding
|
|
11704
11789
|
});
|
|
11705
11790
|
}
|
|
11706
|
-
|
|
11791
|
+
clearVectorMissing(id);
|
|
11707
11792
|
succeeded++;
|
|
11708
11793
|
} catch (error) {
|
|
11709
11794
|
recordFailure(vectorBackfillError(error));
|
|
@@ -11728,7 +11813,7 @@ async function backfillVectorEmbeddings(options = {}) {
|
|
|
11728
11813
|
...lastFailure ? { lastError: lastFailure } : {}
|
|
11729
11814
|
};
|
|
11730
11815
|
}
|
|
11731
|
-
var observations, nextId, projectDir, searchIndexPrepared, embeddingWriteMode, embeddingWorkerProjectRoot, corpusLoaded, largeCorpusLazyMode, loadedObservationStore, DEFAULT_ORAMA_HYDRATION_THRESHOLD, vectorMissingIds, vectorBackfillRunning, vectorSchemaUpgradePromise, lastVectorBackfill, embeddingFailureLogTimestamps, EMBEDDING_FAILURE_LOG_COOLDOWN_MS, MAX_EMBEDDING_FAILURE_KEYS;
|
|
11816
|
+
var observations, nextId, projectDir, searchIndexPrepared, embeddingWriteMode, embeddingWorkerProjectRoot, corpusLoaded, largeCorpusLazyMode, loadedObservationStore, DEFAULT_ORAMA_HYDRATION_THRESHOLD, vectorMissingIds, vectorMissingProjectIds, vectorBackfillRunning, vectorSchemaUpgradePromise, lastVectorBackfill, embeddingFailureLogTimestamps, EMBEDDING_FAILURE_LOG_COOLDOWN_MS, MAX_EMBEDDING_FAILURE_KEYS;
|
|
11732
11817
|
var init_observations = __esm({
|
|
11733
11818
|
"src/memory/observations.ts"() {
|
|
11734
11819
|
"use strict";
|
|
@@ -11753,6 +11838,7 @@ var init_observations = __esm({
|
|
|
11753
11838
|
loadedObservationStore = null;
|
|
11754
11839
|
DEFAULT_ORAMA_HYDRATION_THRESHOLD = 1e4;
|
|
11755
11840
|
vectorMissingIds = /* @__PURE__ */ new Set();
|
|
11841
|
+
vectorMissingProjectIds = /* @__PURE__ */ new Map();
|
|
11756
11842
|
vectorBackfillRunning = false;
|
|
11757
11843
|
vectorSchemaUpgradePromise = null;
|
|
11758
11844
|
lastVectorBackfill = null;
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -244,6 +244,33 @@ background memory processing. Embeddings and memcode's model registry are
|
|
|
244
244
|
unchanged. Image analysis requires explicitly selecting a vision-capable model;
|
|
245
245
|
the default is for text memory.
|
|
246
246
|
|
|
247
|
+
### Runcrate memory preset
|
|
248
|
+
|
|
249
|
+
[Runcrate](https://runcrate.ai) serves open-weight models through an
|
|
250
|
+
OpenAI-compatible API and is available in `memorix init` and the configuration
|
|
251
|
+
TUI as an optional memory LLM preset:
|
|
252
|
+
|
|
253
|
+
```toml
|
|
254
|
+
[memory.llm]
|
|
255
|
+
provider = "runcrate"
|
|
256
|
+
model = "deepseek-ai/DeepSeek-V4.1-Flash"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The preset uses `https://api.runcrate.ai/v1` and the existing
|
|
260
|
+
OpenAI-compatible chat completion transport. Set `RUNCRATE_API_KEY` or
|
|
261
|
+
`MEMORIX_LLM_API_KEY`, or store `api_key` in your private global config. Keep
|
|
262
|
+
credentials out of project TOML. Explicit `model` and `base_url` overrides
|
|
263
|
+
still apply; model IDs use the `vendor/model` form from the endpoint's
|
|
264
|
+
`/v1/models` catalog, for example `zai-org/GLM-5.3` or `Qwen/Qwen3.6-35B-A3B`.
|
|
265
|
+
Get a key at https://runcrate.ai/dashboard/api-keys.
|
|
266
|
+
|
|
267
|
+
`RUNCRATE_API_KEY` is used only when this memory preset is selected, and the
|
|
268
|
+
preset does not borrow OpenAI, Anthropic, OpenRouter, Requesty, API Route,
|
|
269
|
+
Cheaper Inference, or Atlas Cloud keys. Setting the key alone does not enable
|
|
270
|
+
paid background memory processing. Embeddings and memcode's model registry are
|
|
271
|
+
unchanged. Image analysis requires explicitly selecting a vision-capable model
|
|
272
|
+
such as `moonshotai/Kimi-K3`; the default is for text memory.
|
|
273
|
+
|
|
247
274
|
### OrcaRouter custom endpoint
|
|
248
275
|
|
|
249
276
|
OrcaRouter works through the generic OpenAI-compatible gateway path. Keep the
|
|
@@ -479,6 +506,7 @@ Common keys:
|
|
|
479
506
|
|
|
480
507
|
- `exclude_patterns = ["vendor/**", "third_party/**", "generated/**"]`
|
|
481
508
|
- `max_file_bytes = 2097152` (2 MiB per source file by default)
|
|
509
|
+
- `auto_refresh = "auto"` (`"always"` or `"never"` can force or disable built-in Code Memory scans)
|
|
482
510
|
- `external_context = "auto"` (`"off"` keeps the built-in Lite provider only)
|
|
483
511
|
- `external_command = "C:\\tools\\codegraph.cmd"` (optional path when CodeGraph is not on `PATH`)
|
|
484
512
|
- `external_timeout_ms = 3000` (bounded local semantic-query timeout; values are clamped to 5 seconds)
|
|
@@ -494,6 +522,12 @@ suggested reads. Files larger than `max_file_bytes` are also skipped so a
|
|
|
494
522
|
generated or minified source file cannot monopolize an incremental scan. Raise
|
|
495
523
|
the limit only for a repository where that file is intentional source.
|
|
496
524
|
|
|
525
|
+
Built-in CodeGraph keeps the latest two completed snapshots, removes stale
|
|
526
|
+
symbols and dependent edges after a successful refresh, and reclaims SQLite WAL
|
|
527
|
+
and free pages when derived data was removed. `auto_refresh = "never"` is useful
|
|
528
|
+
for large BM25-only stores that do not need code indexing; `memorix codegraph`
|
|
529
|
+
refresh remains available for an explicit scan.
|
|
530
|
+
|
|
497
531
|
`external_context = "auto"` is deliberately conservative. Memorix checks for
|
|
498
532
|
an already-initialized local `.codegraph` index and uses it only when its status
|
|
499
533
|
matches the current project and has no pending changes. It never runs
|
package/docs/DEVELOPMENT.md
CHANGED
|
@@ -13,7 +13,7 @@ Memorix is a TypeScript project built around:
|
|
|
13
13
|
|
|
14
14
|
## Current Development Baseline
|
|
15
15
|
|
|
16
|
-
The current release line is **1.10.
|
|
16
|
+
The current release line is **1.10.3** and package metadata is kept
|
|
17
17
|
synchronized with the root package and MCP Registry manifest. The next larger
|
|
18
18
|
feature phase follows the 1.11 relay-preview plan.
|
|
19
19
|
|
package/docs/INTEGRATIONS.md
CHANGED
|
@@ -85,7 +85,7 @@ Generated guidance also has scope:
|
|
|
85
85
|
| OpenClaw | `memorix setup --agent openclaw --global` | OpenClaw compatible bundle | `~/.openclaw/extensions/memorix` with `.mcp.json`, skills, and OpenClaw `HOOK.md`/`handler.ts` hook pack | Setup attempts `openclaw plugins install <path> --force` and `openclaw hooks enable memorix` when OpenClaw is available. |
|
|
86
86
|
| Hermes Agent | `memorix setup --agent hermes --global` | Hermes plugin | Hermes home (`%LOCALAPPDATA%\hermes` on native Windows, `~/.hermes` elsewhere, or `HERMES_HOME`), plugin enablement in `config.yaml`, and `mcp_servers.memorix` | The plugin registers hooks, a slash command, a CLI command, and skills through Hermes' plugin context. Existing YAML keys are preserved. |
|
|
87
87
|
| Oh-my-Pi | `memorix setup --agent omp --global` | Oh-my-Pi `omp.extensions` package | `.omp/packages/memorix` or `~/.omp/agent/packages/memorix`, plus `.omp/mcp.json` or `~/.omp/agent/mcp.json` | Setup attempts `omp plugin link <path>`. This target uses Oh-my-Pi's package/extension manifest, not Pi's legacy package manifest. |
|
|
88
|
-
| Pi | `memorix setup --agent pi --global` | Pi package
|
|
88
|
+
| Pi | `memorix setup --agent pi --global` | Pi package + native MCP (Pi 1.0+) | Extension and official skills registered through `pi install <path> --approve`, plus `~/.pi/agent/mcp.json` | Project setup writes `.pi/packages/memorix` and `.pi/mcp.json`; trust the project in Pi. Default stdio runs `memorix serve --mode lite`; `--mcp http` selects the shared endpoint. Run `pi mcp list`, then `/reload`. |
|
|
89
89
|
| Windsurf | `memorix setup --agent windsurf --global` | Windsurf MCP/rules/hooks config | stdio MCP config, `.windsurf/rules/memorix.md`, hook config | Uses Windsurf's current config surfaces. |
|
|
90
90
|
| Kiro | `memorix setup --agent kiro --global` | Kiro MCP/steering/hooks config | MCP config, `.kiro/steering/memorix.md`, `.kiro/hooks/*.kiro.hook` | Uses Kiro steering and hook files. |
|
|
91
91
|
| Antigravity | `memorix setup --agent antigravity --global` | **Primary supported target** | Plugin under `~/.gemini/config/plugins/memorix` or `.agents/plugins/memorix`, with `plugin.json`, `mcp_config.json`, `hooks.json`, rules, and skills | Uses Antigravity's official plugin layout. Dedicated MCP configs live at `~/.gemini/config/mcp_config.json` or `.agents/mcp_config.json`; legacy Gemini settings are read only for compatibility. |
|
package/docs/README.md
CHANGED
|
@@ -127,7 +127,8 @@ Historical/deep-reference documents may describe older designs. If they conflict
|
|
|
127
127
|
|
|
128
128
|
## Current Product Line
|
|
129
129
|
|
|
130
|
-
The current product line is **1.10.
|
|
130
|
+
The current product line is **1.10.3**; it includes the CodeGraph, lazy-vector,
|
|
131
|
+
search-regression, browser-launch, and Runcrate updates on top of the LanceDB
|
|
131
132
|
growth fix, derived-view receipts, and the optional Cheaper Inference preset.
|
|
132
133
|
Multi-device store sync is opt-in and keeps local SQLite canonical; existing
|
|
133
134
|
users do not upload anything until they configure a relay provider explicitly.
|
|
@@ -47,7 +47,7 @@ Memorix 已经超过“给 coding agent 加一个记忆工具”的阶段。当
|
|
|
47
47
|
|
|
48
48
|
### 1.1 当前事实
|
|
49
49
|
|
|
50
|
-
当前发布基线是 `v1.10.2
|
|
50
|
+
当前发布基线是 `v1.10.3`。1.10.2 修复了 LanceDB 语义索引无限增长;本补丁继续修复 CodeGraph、lazy vector、搜索回归和 CJK 性能;1.9.12 的 CJK 搜索、搜索回退、大库 alias 迁移、
|
|
51
51
|
Node 26 Pi hooks、Qwen hooks、API Route provider、session label、发布
|
|
52
52
|
provenance 收紧和后台更新脚本隔离,已经与 1.10 的可信上下文、检索收据、
|
|
53
53
|
真实矩阵评估和容量门禁一起发布。
|
package/docs/SETUP.md
CHANGED
|
@@ -85,7 +85,7 @@ What this does:
|
|
|
85
85
|
- Codex: installs a user-level Personal marketplace plugin under `~/plugins/memorix`, attempts `codex plugin add memorix@personal`, and keeps project-local `.codex` configuration untouched. The plugin owns its MCP server, skills, and optional hooks without changing your model, approval, or sandbox settings.
|
|
86
86
|
- GitHub Copilot CLI: installs a local plugin package and attempts `copilot plugin install <local-path>`.
|
|
87
87
|
- Cursor: writes Cursor MCP config, rules, skills, and hook guidance.
|
|
88
|
-
- Pi: installs the user-level Memorix Pi package
|
|
88
|
+
- Pi: installs the user-level Memorix Pi package, attempts `pi install <path> --approve`, and writes native MCP config to `~/.pi/agent/mcp.json` (Pi 1.0+). Project setup uses `.pi/packages/memorix` and `.pi/mcp.json`.
|
|
89
89
|
- Gemini CLI: installs a local extension package under `~/.gemini/extensions/memorix` with MCP, `GEMINI.md`, hooks, commands, and skills. Antigravity CLI has an official Gemini CLI migration path, but Memorix keeps Gemini CLI as its own active standalone target.
|
|
90
90
|
- OpenCode: installs a local plugin file, OpenCode skill, MCP config, and `AGENTS.md` guidance.
|
|
91
91
|
- Antigravity: installs a native plugin under `~/.gemini/config/plugins/memorix` for global setup or `.agents/plugins/memorix` for workspace setup. The plugin bundles `plugin.json`, `mcp_config.json`, `hooks.json`, rules, and skills.
|
|
@@ -459,13 +459,13 @@ Project config: `.kiro/settings/mcp.json`
|
|
|
459
459
|
|
|
460
460
|
### Pi
|
|
461
461
|
|
|
462
|
-
Pi
|
|
462
|
+
Requires [Pi 1.0+](https://github.com/earendil-works/pi/blob/v1.0.0/packages/coding-agent/docs/mcp.md). Setup installs both the extension/skills package and a native MCP server entry:
|
|
463
463
|
|
|
464
464
|
```bash
|
|
465
465
|
memorix setup --agent pi --global
|
|
466
466
|
```
|
|
467
467
|
|
|
468
|
-
This writes the user-level Memorix Pi package and registers it with:
|
|
468
|
+
This merges `mcpServers.memorix` into `~/.pi/agent/mcp.json`, preserving unrelated servers and settings. The default stdio entry runs `memorix serve --mode lite`. It also writes the user-level Memorix Pi package and registers it with:
|
|
469
469
|
|
|
470
470
|
```bash
|
|
471
471
|
pi install ~/.pi/agent/packages/memorix --approve
|
|
@@ -477,7 +477,22 @@ Check the loaded package resources with:
|
|
|
477
477
|
pi config --approve
|
|
478
478
|
```
|
|
479
479
|
|
|
480
|
-
You should see the Memorix extension and the official Memorix skills listed under the Pi package.
|
|
480
|
+
You should see the Memorix extension and the shared official Memorix skills listed under the Pi package. Setup generates the same skills used by other supported agents; Pi does not maintain a separate skill set. Native MCP supplies the tools, and lifecycle capture comes from the extension.
|
|
481
|
+
|
|
482
|
+
For project-local setup, run `memorix setup --agent pi` from the project root. This writes `.pi/mcp.json` and installs `.pi/packages/memorix` with `pi install <path> -l --approve`. Pi must trust the project before it loads project-local MCP configuration.
|
|
483
|
+
|
|
484
|
+
For an explicitly shared HTTP control plane:
|
|
485
|
+
|
|
486
|
+
```bash
|
|
487
|
+
memorix setup --agent pi --global --mcp http
|
|
488
|
+
memorix background start
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
This writes `mcpServers.memorix.url = "http://localhost:3211/mcp"` instead of a stdio command. In HTTP mode, bind the active repository with `memorix_session_start(projectRoot=...)`.
|
|
492
|
+
|
|
493
|
+
Use `--mcp none` to skip MCP configuration. Existing MCP configuration is left untouched.
|
|
494
|
+
|
|
495
|
+
After setup, run `pi mcp list` to check connections, then `/reload` in Pi (or restart it). Use `/mcp` to inspect servers in a session. Pi exposes MCP tools through codemode by default; tool discovery is not evidence that the server is missing. Extensions such as `pi-mcp-adapter` that replace Pi's built-in `/mcp` also replace native config loading; use Pi's built-in MCP support for this setup.
|
|
481
496
|
|
|
482
497
|
### Gemini CLI, OpenCode, Antigravity, Trae, OpenClaw, Hermes Agent, Oh-my-Pi, and other MCP clients
|
|
483
498
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memorix",
|
|
3
3
|
"mcpName": "io.github.AVIDS2/memorix",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.3",
|
|
5
5
|
"description": "Local-first shared memory layer for AI coding agents across MCP clients, Git history, reasoning context, and project sessions.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
package/server.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "https://github.com/AVIDS2/memorix",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "1.10.
|
|
10
|
+
"version": "1.10.3",
|
|
11
11
|
"websiteUrl": "https://mem.rglens.com",
|
|
12
12
|
"icons": [
|
|
13
13
|
{
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
{
|
|
23
23
|
"registryType": "npm",
|
|
24
24
|
"identifier": "memorix",
|
|
25
|
-
"version": "1.10.
|
|
25
|
+
"version": "1.10.3",
|
|
26
26
|
"runtimeHint": "npx",
|
|
27
27
|
"packageArguments": [
|
|
28
28
|
{
|
|
@@ -315,7 +315,7 @@ function capabilityParity(
|
|
|
315
315
|
function isMcpConfigAgent(agent: AgentName): agent is McpConfigAgent {
|
|
316
316
|
// Grok has a setup-only HTTP adapter. Doctor/repair skip it so a default
|
|
317
317
|
// host-owned Grok MCP is not reported as missing.
|
|
318
|
-
return agent !== '
|
|
318
|
+
return agent !== 'grok' && agent !== 'qwen';
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
function isActionableMcpRepairIssue(issue: string): boolean {
|
|
@@ -824,7 +824,7 @@ async function doStatus(asJson = false): Promise<void> {
|
|
|
824
824
|
console.log('');
|
|
825
825
|
}
|
|
826
826
|
|
|
827
|
-
async function doRestart(port: number): Promise<void> {
|
|
827
|
+
export async function doRestart(port: number): Promise<void> {
|
|
828
828
|
console.log('Restarting control plane...');
|
|
829
829
|
await doStop();
|
|
830
830
|
// Brief pause to let port release
|