om-memory-system 3.4.0-next.23 → 3.4.0-next.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +21 -7
  2. package/dist/adapters/opencode/backfill-models.js +5 -1
  3. package/dist/adapters/opencode/backfill-startup.d.ts +6 -0
  4. package/dist/adapters/opencode/backfill-startup.js +5 -0
  5. package/dist/adapters/opencode/import-command.js +1 -0
  6. package/dist/adapters/opencode/user-prompt.d.ts +2 -1
  7. package/dist/adapters/opencode/user-prompt.js +2 -9
  8. package/dist/adapters/pi/backfill-models.d.ts +4 -0
  9. package/dist/adapters/pi/backfill-models.js +3 -0
  10. package/dist/adapters/pi/capture.d.ts +1 -1
  11. package/dist/adapters/pi/capture.js +1 -1
  12. package/dist/adapters/pi/extension.js +7 -0
  13. package/dist/adapters/pi/import-command.js +1 -0
  14. package/dist/cli/index.js +13 -1
  15. package/dist/config.d.ts +11 -4
  16. package/dist/config.js +29 -6
  17. package/dist/core/internal-prompt.d.ts +6 -0
  18. package/dist/core/internal-prompt.js +11 -0
  19. package/dist/importer/auto-backfill.d.ts +5 -0
  20. package/dist/importer/auto-backfill.js +29 -10
  21. package/dist/importer/backfill-controls.d.ts +37 -0
  22. package/dist/importer/backfill-controls.js +119 -0
  23. package/dist/importer/backfill-lock.d.ts +1 -0
  24. package/dist/importer/backfill-lock.js +2 -2
  25. package/dist/importer/backfill-model.d.ts +1 -1
  26. package/dist/importer/backfill-model.js +2 -0
  27. package/dist/importer/external-api-test.d.ts +18 -0
  28. package/dist/importer/external-api-test.js +50 -0
  29. package/dist/importer/external-backfill-models.d.ts +15 -0
  30. package/dist/importer/external-backfill-models.js +14 -0
  31. package/dist/importer/import-path-maps.d.ts +14 -0
  32. package/dist/importer/import-path-maps.js +49 -0
  33. package/dist/importer/import-progress.d.ts +27 -0
  34. package/dist/importer/import-progress.js +38 -0
  35. package/dist/importer/import-runs.d.ts +43 -0
  36. package/dist/importer/import-runs.js +141 -0
  37. package/dist/importer/import-sessions.js +9 -9
  38. package/dist/importer/importer.d.ts +2 -1
  39. package/dist/importer/importer.js +2 -2
  40. package/dist/importer/map-suggestions.d.ts +39 -0
  41. package/dist/importer/map-suggestions.js +133 -0
  42. package/dist/importer/opencode-import.d.ts +2 -1
  43. package/dist/{adapters/pi/conversation.d.ts → importer/pi-conversation.d.ts} +1 -1
  44. package/dist/importer/profile-import.js +3 -2
  45. package/dist/importer/run-import.d.ts +21 -3
  46. package/dist/importer/run-import.js +82 -2
  47. package/dist/importer/session-loader.d.ts +1 -1
  48. package/dist/importer/web-import-api.d.ts +3 -0
  49. package/dist/importer/web-import-api.js +3 -0
  50. package/dist/importer/web-import-jobs.js +1 -0
  51. package/dist/index.js +9 -4
  52. package/dist/services/ai/live-model-choice.d.ts +4 -1
  53. package/dist/services/ai/live-model-choice.js +18 -0
  54. package/dist/services/api-handlers.d.ts +6 -1
  55. package/dist/services/api-handlers.js +71 -62
  56. package/dist/services/backfill-state.d.ts +30 -0
  57. package/dist/services/backfill-state.js +47 -0
  58. package/dist/services/capture-diagnostics.d.ts +2 -8
  59. package/dist/services/capture-diagnostics.js +3 -49
  60. package/dist/services/global-config-writer.d.ts +2 -0
  61. package/dist/services/global-config-writer.js +37 -6
  62. package/dist/services/global-version.d.ts +31 -0
  63. package/dist/services/global-version.js +78 -0
  64. package/dist/services/memory-key-source.d.ts +35 -0
  65. package/dist/services/memory-key-source.js +123 -0
  66. package/dist/services/package-version.d.ts +2 -0
  67. package/dist/services/package-version.js +21 -0
  68. package/dist/services/private-path.d.ts +13 -0
  69. package/dist/services/private-path.js +54 -0
  70. package/dist/services/settings-snapshot.d.ts +17 -0
  71. package/dist/services/settings-snapshot.js +51 -14
  72. package/dist/services/turso/vector-search.d.ts +1 -1
  73. package/dist/services/turso/vector-search.js +5 -2
  74. package/dist/services/web-server.d.ts +2 -0
  75. package/dist/services/web-server.js +74 -1
  76. package/dist/web/assets/index-DvZhF1BJ.css +2 -0
  77. package/dist/web/assets/index-jqmX5i_i.js +124 -0
  78. package/dist/web/index.html +2 -2
  79. package/package.json +6 -1
  80. package/dist/web/assets/index-B-_gMSn9.js +0 -124
  81. package/dist/web/assets/index-D5ak5KsI.css +0 -2
  82. /package/dist/{adapters/pi/conversation.js → importer/pi-conversation.js} +0 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # OMMS — Opinionated Modular Memory System
1
+ # OMMS: Opinionated Modular Memory System
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/om-memory-system.svg)](https://www.npmjs.com/package/om-memory-system)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/om-memory-system.svg)](https://www.npmjs.com/package/om-memory-system)
@@ -26,7 +26,8 @@ the other. Everything is stored locally on your machine.
26
26
  OpenCode v1.
27
27
  - **Learns your preferences.** A user profile of your habits builds up over
28
28
  time and follows you across projects.
29
- - **Imports your past sessions.** Pi and OpenCode import older history after startup. A command provides a preview and manual control.
29
+ - **Imports your past sessions.** Pi and OpenCode import older history after
30
+ startup. A command gives you a preview and manual control.
30
31
  - **Lets you look and edit.** A local web page shows every memory and your
31
32
  profile.
32
33
  - **Keeps private things private.** Text inside `<private>` tags is never
@@ -74,6 +75,14 @@ pi install npm:om-memory-system
74
75
 
75
76
  Restart Pi. You can install OMMS in both agents; they share the same memory.
76
77
 
78
+ **Terminal command (optional, recommended).** A global install lets the login
79
+ web app and the `om-memory-system` terminal commands run without `npx`:
80
+
81
+ ```bash
82
+ npm i -g om-memory-system # or: bun add -g om-memory-system
83
+ om-memory-system --version
84
+ ```
85
+
77
86
  ### 2. Choose which model writes memories (optional)
78
87
 
79
88
  With no settings, OMMS uses the model of the session you are working in. To
@@ -91,18 +100,22 @@ config file yet, OMMS creates this one with comments on first start.
91
100
  }
92
101
  ```
93
102
 
94
- You can also use any OpenAI-compatible or Anthropic API with your own key.
95
- See [Configuration](docs/configuration.md#choosing-the-model).
103
+ You can also use any OpenAI-compatible or Anthropic API with your own key, set
104
+ up on the Settings page's **External API** card, and choose `"external"` as a
105
+ host's model. See [Configuration](docs/configuration.md#choosing-the-model).
96
106
 
97
107
  ### 3. Check it works
98
108
 
99
109
  Work normally for a few turns, then open `http://127.0.0.1:4747` in your
100
- browser. OpenCode or the login web app serves this page. New memories appear on the timeline.
101
- You can also ask the agent: "search memory for what we changed today".
110
+ browser. OpenCode or the login web app serves this page. New memories appear
111
+ on the timeline. You can also ask the agent: "search memory for what we changed today".
102
112
 
103
113
  ## Import your past history
104
114
 
105
- Older sessions import automatically after a host starts. This makes model calls. To opt out, set `"autoBackfill": false` in `~/.config/omms/omms.jsonc` before starting. For a manual import or custom source, preview inside the agent:
115
+ Older sessions import automatically after a host starts. This makes model
116
+ calls. To turn it off, set `"autoBackfill": false` in
117
+ `~/.config/omms/omms.jsonc` before you start the agent. For a manual import or
118
+ a custom source, preview it inside the agent:
106
119
 
107
120
  ```text
108
121
  /memory-import-opencode-history --dry-run
@@ -134,6 +147,7 @@ backup first. See [Updating and upgrading](docs/upgrading.md) and
134
147
  | [Using memory day to day](docs/using-memory.md) | How capture and recall work, the `memory` tool, the user profile |
135
148
  | [Configuration](docs/configuration.md) | Settings, choosing the model, embeddings, troubleshooting |
136
149
  | [Web UI](docs/web-ui.md) | The memory explorer, opening it on a network safely |
150
+ | [Settings page](docs/web-ui-settings.md) | Every card and control on the web Settings page |
137
151
  | [Moving projects](docs/moving-projects.md) | Nested repositories, moved folders, backup and restore |
138
152
  | [Updating and upgrading](docs/upgrading.md) | Updates, pinning a version, older stores |
139
153
  | [OpenCode adapter](docs/opencode-adapter.md) | How the OpenCode plugin hooks in |
@@ -1,11 +1,15 @@
1
1
  import { CONFIG } from "../../config.js";
2
2
  import { parseBackfillModel } from "../../importer/backfill-model.js";
3
+ import { resolveExternalBackfillModels } from "../../importer/external-backfill-models.js";
3
4
  import { selectImportModel } from "../../importer/model-selection.js";
4
5
  import { getAutoCaptureProviderStatus } from "../../services/ai/live-model-choice.js";
5
6
  import { createOpencodeImportModels, } from "../../services/ai/opencode-import-models.js";
6
7
  /** Apply the live-model rule when inherit is selected; named models need sign-in. */
7
8
  export async function resolveOpencodeBackfillModels(config = CONFIG, context) {
8
9
  const choice = parseBackfillModel(config, "opencode");
10
+ if (choice === "external") {
11
+ return resolveExternalBackfillModels("opencode", config, context.externalModels);
12
+ }
9
13
  let ref;
10
14
  if (choice === "inherit") {
11
15
  const live = getAutoCaptureProviderStatus(config);
@@ -24,7 +28,7 @@ export async function resolveOpencodeBackfillModels(config = CONFIG, context) {
24
28
  if (!selected)
25
29
  throw new Error("OpenCode backfill: no configured default model");
26
30
  const parsed = parseBackfillModel({ opencodeBackfillModel: selected }, "opencode");
27
- if (parsed === "inherit")
31
+ if (typeof parsed === "string")
28
32
  throw new Error("OpenCode backfill: no configured default model");
29
33
  ref = { providerID: parsed.provider, modelID: parsed.model };
30
34
  }
@@ -5,3 +5,9 @@ export declare function startOpencodeBackfill(input: {
5
5
  configModel: () => Promise<string | null>;
6
6
  notify: (message: string) => void;
7
7
  }): Promise<void>;
8
+ /** Let Run now on a Settings page served by this process use OpenCode's models. */
9
+ export declare function registerOpencodeBackfillModels(input: {
10
+ directory: string;
11
+ connected: string[];
12
+ configModel: () => Promise<string | null>;
13
+ }): void;
@@ -1,5 +1,6 @@
1
1
  import { CONFIG } from "../../config.js";
2
2
  import { scheduleAutoBackfill } from "../../importer/auto-backfill.js";
3
+ import { registerHostBackfillModels } from "../../importer/backfill-controls.js";
3
4
  import { resolveOpencodeBackfillModels } from "./backfill-models.js";
4
5
  /** Start after connected providers load, without delaying plugin initialisation. */
5
6
  export function startOpencodeBackfill(input) {
@@ -10,3 +11,7 @@ export function startOpencodeBackfill(input) {
10
11
  notify: input.notify,
11
12
  });
12
13
  }
14
+ /** Let Run now on a Settings page served by this process use OpenCode's models. */
15
+ export function registerOpencodeBackfillModels(input) {
16
+ registerHostBackfillModels("opencode", () => resolveOpencodeBackfillModels(CONFIG, input));
17
+ }
@@ -68,6 +68,7 @@ export async function runOpencodeImportCommand(input) {
68
68
  const report = await runHistoryImport("opencode", parsed, {
69
69
  cwd: input.directory,
70
70
  models,
71
+ track: { surface: "slash" },
71
72
  onProgress: (processed, total, promptPreview) => {
72
73
  if (processed - lastProgress >= 25 || processed === total) {
73
74
  lastProgress = processed;
@@ -1,4 +1,5 @@
1
- export declare function isStructuredSummaryPromptMessage(userMessage: string): boolean;
1
+ import { isStructuredSummaryPromptMessage } from "../../core/internal-prompt.js";
2
+ export { isStructuredSummaryPromptMessage };
2
3
  /** True when a prompt is omms's own internal traffic and must not be recorded or searched. */
3
4
  export declare function isInternalPrompt(sessionID: string, userMessage: string): boolean;
4
5
  /**
@@ -1,14 +1,7 @@
1
+ import { isStructuredSummaryPromptMessage } from "../../core/internal-prompt.js";
1
2
  import { isInternalStructuredSession } from "../../services/ai/opencode-provider.js";
2
3
  import { userPromptManager } from "../../services/user-prompt/user-prompt-manager.js";
3
- export function isStructuredSummaryPromptMessage(userMessage) {
4
- // This is the plugin's own structured-summary or profile-analysis request.
5
- // OpenCode echoes it through chat.message like a normal user message, but
6
- // capturing it would create self-referential memories / an infinite learning loop.
7
- if (userMessage.includes("# User Profile Analysis")) {
8
- return true;
9
- }
10
- return userMessage.includes("Analyze this conversation.") && userMessage.includes('type="skip"');
11
- }
4
+ export { isStructuredSummaryPromptMessage };
12
5
  /** True when a prompt is omms's own internal traffic and must not be recorded or searched. */
13
6
  export function isInternalPrompt(sessionID, userMessage) {
14
7
  return isStructuredSummaryPromptMessage(userMessage) || isInternalStructuredSession(sessionID);
@@ -3,6 +3,10 @@ import { type PiModelContext } from "./provider.js";
3
3
  /** Resolve the Pi backfill independently of the manual import's session-model rule. */
4
4
  export declare function resolvePiBackfillModels(ctx: PiModelContext, config?: {
5
5
  piBackfillModel?: string;
6
+ memoryProvider?: string;
7
+ memoryModel?: string;
8
+ memoryApiUrl?: string;
9
+ memoryApiKey?: string;
6
10
  }): Promise<{
7
11
  model: string;
8
12
  models: HistoryImportModels;
@@ -1,11 +1,14 @@
1
1
  import { CONFIG } from "../../config.js";
2
2
  import { parseBackfillModel } from "../../importer/backfill-model.js";
3
+ import { resolveExternalBackfillModels } from "../../importer/external-backfill-models.js";
3
4
  import { createPiLiveModels } from "./live-model.js";
4
5
  import { adaptPiProfileModel } from "./profile.js";
5
6
  import { createPiCaptureProvider, resolveImportModel } from "./provider.js";
6
7
  /** Resolve the Pi backfill independently of the manual import's session-model rule. */
7
8
  export async function resolvePiBackfillModels(ctx, config = CONFIG) {
8
9
  const choice = parseBackfillModel(config, "pi");
10
+ if (choice === "external")
11
+ return resolveExternalBackfillModels("pi", config);
9
12
  if (choice === "inherit") {
10
13
  const live = createPiLiveModels(ctx);
11
14
  const profile = live.profile();
@@ -1,5 +1,5 @@
1
1
  import type { CaptureSummaryProvider } from "../../core/host.js";
2
- import { type PiSessionEntry } from "./conversation.js";
2
+ import { type PiSessionEntry } from "../../importer/pi-conversation.js";
3
3
  export interface PiCaptureState {
4
4
  /** User entry IDs terminally handled by a settled capture for this session. */
5
5
  handledUserEntries: Set<string>;
@@ -2,7 +2,7 @@ import { CONFIG } from "../../config.js";
2
2
  import { captureConversation } from "../../core/capture.js";
3
3
  import { log } from "../../services/logger.js";
4
4
  import { memoryClient } from "../../services/client.js";
5
- import { extractPiConversation } from "./conversation.js";
5
+ import { extractPiConversation } from "../../importer/pi-conversation.js";
6
6
  export function createPiCaptureState() {
7
7
  return { handledUserEntries: new Set(), running: false };
8
8
  }
@@ -111,6 +111,13 @@ export default function ommsPiExtension(pi) {
111
111
  code: error instanceof Error ? error.name : "unknown",
112
112
  }));
113
113
  }
114
+ // Run now on a Settings page served by this process can use Pi's signed-in models.
115
+ void Promise.all([
116
+ import("../../importer/backfill-controls.js"),
117
+ import("./backfill-models.js"),
118
+ ])
119
+ .then(([{ registerHostBackfillModels }, { resolvePiBackfillModels }]) => registerHostBackfillModels("pi", () => resolvePiBackfillModels(ctx)))
120
+ .catch(() => { });
114
121
  const globalScope = globalThis;
115
122
  const sessionId = ctx.sessionManager.getSessionId();
116
123
  if (isConfigured() &&
@@ -90,6 +90,7 @@ export function registerPiHistoryImportCommand(pi, getExtensionContext) {
90
90
  let lastProgressNotify = 0;
91
91
  const report = await runHistoryImport("pi", parsed, {
92
92
  cwd: ctx.cwd,
93
+ track: { surface: "slash" },
93
94
  models: selectedModel && !parsed.dryRun
94
95
  ? {
95
96
  capture: createPiCaptureProvider(() => selectedModel),
package/dist/cli/index.js CHANGED
@@ -14,6 +14,9 @@ Commands:
14
14
  web Start the web app in the foreground
15
15
  web install|uninstall|status Manage the web app login item
16
16
 
17
+ Options:
18
+ --version, -v Print the installed version
19
+
17
20
  Import commands take the same options; run one with --help to see them.
18
21
  Inside a session, /memory-import-opencode-history and /memory-import-pi-history
19
22
  use that session's model instead of an API key.`;
@@ -28,6 +31,11 @@ export function parseImportArgs(argv) {
28
31
  return { host, args };
29
32
  }
30
33
  export async function runCli(argv) {
34
+ if (argv[0] === "--version" || argv[0] === "-v") {
35
+ const { packageVersion } = await import("../services/package-version.js");
36
+ console.log(packageVersion());
37
+ return 0;
38
+ }
31
39
  if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
32
40
  console.log(usage);
33
41
  return 0;
@@ -73,7 +81,11 @@ export async function runCli(argv) {
73
81
  console.log(`Import model: ${model}`);
74
82
  }
75
83
  const { formatHistoryImportReport, historyImportFailed, runHistoryImport } = await import("../importer/run-import.js");
76
- const report = await runHistoryImport(host, args, { cwd: process.cwd(), models });
84
+ const report = await runHistoryImport(host, args, {
85
+ cwd: process.cwd(),
86
+ models,
87
+ track: { surface: "cli" },
88
+ });
77
89
  console.log(formatHistoryImportReport(host, report, model));
78
90
  return historyImportFailed(report) ? 1 : 0;
79
91
  }
package/dist/config.d.ts CHANGED
@@ -23,7 +23,7 @@ interface OmmsConfig {
23
23
  autoCaptureMaxRetries?: number;
24
24
  autoCaptureMaxContextBytes?: number;
25
25
  autoCaptureLanguage?: string;
26
- memoryProvider?: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter";
26
+ memoryProvider?: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "google-gemini";
27
27
  memoryModel?: string;
28
28
  memoryApiUrl?: string;
29
29
  memoryApiKey?: string;
@@ -45,6 +45,11 @@ interface OmmsConfig {
45
45
  autoBackfill?: boolean;
46
46
  opencodeBackfillModel?: string;
47
47
  piBackfillModel?: string;
48
+ /** Saved directory maps for every history import. Global config only. */
49
+ importPathMaps?: Array<{
50
+ from: string;
51
+ to: string;
52
+ }>;
48
53
  webServerAutoStart?: boolean;
49
54
  webServerEnabled?: boolean;
50
55
  webServerPort?: number;
@@ -93,7 +98,7 @@ interface OmmsConfig {
93
98
  injectOn?: "first" | "always";
94
99
  };
95
100
  }
96
- export declare const CONFIG_TEMPLATE = "{\n // ============================================\n // omms (Opinionated Modular Memory System) Configuration\n // ============================================\n \n // Storage location for the vector database. Leave unset to use the\n // default ~/.omms/data (a legacy ~/.opencode-mem/data store is migrated\n // there automatically on first start; see docs/omms-migration.md).\n // \"storagePath\": \"~/.omms/data\",\n\n \"userEmailOverride\": \"\",\n \"userNameOverride\": \"\",\n \n // ============================================\n // Embedding Model (for similarity search)\n // ============================================\n // Local = Hugging Face / ONNX via @huggingface/transformers (not Apple MLX).\n // Remote = set BOTH embeddingApiUrl and embeddingApiKey (OpenAI-compatible /embeddings).\n \n // Default: Nomic Embed v1 (768 dimensions, 8192 context, multilingual)\n \"embeddingModel\": \"Xenova/nomic-embed-text-v1\",\n\n // Opt-in Nomic task prefixes (search_document: / search_query:). After enabling,\n // re-index existing memories so store and query vectors stay aligned.\n // \"embeddingUseTaskPrefixes\": true,\n \n // Auto-detected dimensions (no need to set manually)\n // \"embeddingDimensions\": 768,\n \n // Other recommended local models:\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-base-en\", // 768 dims, English-only, 8192 context\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-small-en\", // 512 dims, faster, 8192 context\n // \"embeddingModel\": \"Xenova/all-MiniLM-L6-v2\", // 384 dims, very fast, 512 context\n // \"embeddingModel\": \"Xenova/all-mpnet-base-v2\", // 768 dims, good quality, 512 context\n \n // Optional: OpenAI-compatible API for embeddings (both URL and key required)\n // \"embeddingApiUrl\": \"https://api.openai.com/v1\",\n // \"embeddingApiKey\": \"env://OPENAI_API_KEY\", // or \"sk-...\" / \"file:///path/to/key\"\n // \"embeddingModel\": \"text-embedding-3-small\", // 1536 dims, auto-detected\n \n // ============================================\n // Web Server Settings\n // ============================================\n \n // Start a background import of past chats on each host's next start.\n \"autoBackfill\": true,\n // \"piBackfillModel\": \"inherit\", // or \"provider/model\"\n // \"opencodeBackfillModel\": \"inherit\", // or \"provider/model\"\n\n // Register the web app to start when you log in.\n \"webServerAutoStart\": true,\n // Enable web UI for managing memories (accessible at http://localhost:4747)\n \"webServerEnabled\": true,\n \n // Port for web UI server\n \"webServerPort\": 4747,\n \n // Host address for web UI (use 127.0.0.1 for local only, 0.0.0.0 for network access)\n \"webServerHost\": \"127.0.0.1\",\n\n // Optional HTTP Basic Auth for the web UI. Accepts literal, env://, or file:// secrets.\n // \"webServerAuthPassword\": \"\",\n // \"webServerAuthUsername\": \"\",\n\n // Required when webServerHost is not loopback. Protects /api/* with Bearer / X-Opencode-Mem-Token.\n // \"webServerApiToken\": \"env://OMMS_WEB_TOKEN\",\n \n // ============================================\n // Database Settings\n // ============================================\n \n // Maximum vectors per database shard (auto-creates new shard when limit reached)\n \"maxVectorsPerShard\": 50000,\n \n // Automatically delete old memories based on retention period\n \"autoCleanupEnabled\": true,\n \n // Days to keep memories before auto-cleanup (only if autoCleanupEnabled is true)\n \"autoCleanupRetentionDays\": 30,\n \n // Automatically detect and remove duplicate memories\n \"deduplicationEnabled\": true,\n \n // Similarity threshold (0-1) for detecting duplicates (higher = stricter)\n \"deduplicationSimilarityThreshold\": 0.90,\n \n // ============================================\n // Memory Scope Settings\n // ============================================\n\n // Default scope for memory list/search queries\n // \"project\" keeps queries within the current project, \"all-projects\" searches across all project shards\n \"memory\": {\n \"defaultScope\": \"project\"\n },\n\n // ============================================\n // Model for auto-capture and profile learning (same rule in OpenCode and Pi)\n // ============================================\n\n // Which model summarises your work, in this order:\n // 1. The host model below: opencodeProvider/opencodeModel in OpenCode,\n // piProvider/piModel in Pi. Set the model to \"inherit\" to follow\n // whatever model the session is using.\n // 2. If no host model is set: the external API (memoryModel/memoryApiUrl/\n // memoryApiKey further down).\n // 3. If neither is set: the session's own model.\n // If the host model fails and the external API is configured, the external\n // API is used instead.\n //\n // Host models go through OpenCode's or Pi's own sign-in (OAuth like Claude\n // Pro/Max, GitHub Copilot, ChatGPT, or your own key there), so no separate API\n // key is needed here.\n //\n // Examples (OpenCode names from 'opencode providers list'; Pi names from its model list):\n // \"opencodeProvider\": \"anthropic\", \"opencodeModel\": \"claude-haiku-4-5-20251001\"\n // \"opencodeProvider\": \"openai\", \"opencodeModel\": \"inherit\"\n // \"piProvider\": \"openai-codex\", \"piModel\": \"gpt-5.6-luna\"\n //\n // \"opencodeProvider\": \"anthropic\",\n // \"opencodeModel\": \"claude-haiku-4-5-20251001\",\n // \"piProvider\": \"openai-codex\",\n // \"piModel\": \"gpt-5.6-luna\",\n\n // ============================================\n // Auto-Capture Settings\n // ============================================\n \n // Auto-capture runs in the background without blocking your main session.\n // Note: Ollama may not support tool calling. Use OpenAI, Anthropic, or Groq for best results.\n \n \"autoCaptureEnabled\": true,\n \n // Provider type: \"openai-chat\" | \"openai-responses\" | \"anthropic\" | \"minimax\" | \"orcarouter\"\n // Note: \"openai-chat\" is a generic OpenAI API-compatible mode.\n // Any service that follows the OpenAI Chat Completions API can use it via custom \"memoryApiUrl\".\n \"memoryProvider\": \"openai-chat\",\n \n // External API (step 2 above, and the fallback when a host model fails).\n // Uncomment all 3 lines and replace memoryApiKey before use:\n // \"memoryModel\": \"gpt-4o-mini\",\n // \"memoryApiUrl\": \"https://api.openai.com/v1\",\n // \"memoryApiKey\": \"sk-...\",\n\n // API Key Formats:\n // Direct value: \"sk-...\"\n // From file: \"file://~/.config/litellm-key.txt\"\n // From env variable: \"env://LITELLM_API_KEY\"\n \n // Examples for different providers:\n // Any OpenAI-compatible endpoint can use the \"openai-chat\" provider pattern below.\n // Common examples: DeepSeek, Qwen (via Alibaba Cloud ModelStudio),\n // Zhipu GLM (BigModel platform), and Kimi (Moonshot AI platform).\n\n // OpenAI Chat Completion (default, backward compatible):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"gpt-4o-mini\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n\n // DeepSeek (OpenAI-compatible example):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"deepseek-chat\"\n // \"memoryApiUrl\": \"https://api.deepseek.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // OpenAI Responses API (recommended, with session support):\n // \"memoryProvider\": \"openai-responses\"\n // \"memoryModel\": \"gpt-4o\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // Anthropic (with session support):\n // \"memoryProvider\": \"anthropic\"\n // \"memoryModel\": \"claude-3-5-haiku-20241022\"\n // \"memoryApiUrl\": \"https://api.anthropic.com/v1\"\n // \"memoryApiKey\": \"sk-ant-...\"\n\n // MiniMax (Anthropic Messages-compatible endpoint, with session support):\n // \"memoryProvider\": \"minimax\"\n // \"memoryModel\": \"MiniMax-M3\"\n // \"memoryApiUrl\": \"https://api.minimax.io\" // global endpoint\n // \"memoryApiKey\": \"<MiniMax API key>\"\n // // China endpoint: \"memoryApiUrl\": \"https://api.minimaxi.com\"\n // // Optional adaptive thinking for MiniMax-M3:\n // \"memoryExtraParams\": { \"thinking\": { \"type\": \"adaptive\" } }\n\n // OrcaRouter (OpenAI-compatible gateway, namespaced model IDs, with session support):\n // \"memoryProvider\": \"orcarouter\"\n // \"memoryApiKey\": \"<OrcaRouter API key>\"\n // // memoryApiUrl and memoryModel are optional \u2014 they default to\n // // https://api.orcarouter.ai/v1 and \"orcarouter/auto\" (a routing alias).\n // // OrcaRouter rejects bare model names, so if you set memoryModel, use a\n // // namespaced ID such as \"openai/gpt-5.5\" or \"deepseek/deepseek-v4-flash\".\n // \"memoryModel\": \"openai/gpt-5.5\"\n\n // Groq (OpenAI-compatible, use openai-chat provider):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"llama-3.3-70b-versatile\"\n // \"memoryApiUrl\": \"https://api.groq.com/openai/v1\"\n // \"memoryApiKey\": \"gsk_...\"\n \n // Maximum iterations for multi-turn AI analysis (for openai-responses, anthropic, and minimax)\n \"autoCaptureMaxIterations\": 5,\n \n // Timeout per iteration in milliseconds (30 seconds default)\n \"autoCaptureIterationTimeout\": 30000,\n\n // Maximum number of times to retry capturing a prompt if it fails (due to network, API errors, etc.)\n \"autoCaptureMaxRetries\": 3,\n\n // Maximum UTF-8 bytes for the auto-capture markdown context sent to the summary model.\n // Prevents HTTP 400 context overflows on models with ~131K token windows (e.g. Groq Llama).\n // Rough guide: tokens \u2248 bytes / 4 for mixed code/prose.\n \"autoCaptureMaxContextBytes\": 131072,\n \n // Days to keep AI session history before cleanup\n \"aiSessionRetentionDays\": 7,\n\n // Capture diagnostics: every capture attempt always writes one metadata line\n // (model, stop reason, sizes, outcome) to ~/.omms/omms.log, with no\n // conversation text. Set captureTrace to true to also write each attempt's\n // prompt and raw reply to ~/.omms/traces/ for debugging. Traces can contain\n // conversation content: <private> text and common API key formats are\n // redacted, files are readable only by you, and they are deleted after\n // captureTraceRetentionDays. Only this global file can turn tracing on.\n // \"captureTrace\": false,\n // \"captureTraceRetentionDays\": 7,\n // \"captureAttemptRetentionDays\": 30,\n\n // Temperature for AI API requests (set to false to omit parameter for models that don't support it)\n // Some reasoning models (like o1, o3, gpt-5) don't support temperature parameter\n // Set to false and add \"memoryTemperature\": false in config when using such models\n \"memoryTemperature\": 0.3,\n\n // Extra parameters to include in API request body\n // Useful for local inference servers (e.g. llama-server with --jinja) that support\n // additional parameters like disabling thinking/reasoning mode\n // Example for Qwen3 models: { \"enable_thinking\": false }\n // \"memoryExtraParams\": {},\n\n // Language for auto-capture summaries (default: \"auto\" for auto-detection)\n // Options: \"auto\", \"en\", \"id\", \"zh\", \"ja\", \"es\", \"fr\", \"de\", \"ru\", \"pt\", \"ar\", \"ko\"\n // \"autoCaptureLanguage\": \"auto\",\n\n // ============================================\n // Toast Notifications\n // ============================================\n\n // Show toast when memory is auto-captured\n \"showAutoCaptureToasts\": true,\n\n // Show toast when user profile is updated\n \"showUserProfileToasts\": true,\n\n // Show toast for error messages\n \"showErrorToasts\": true,\n\n // ============================================\n // User Profile System\n // ============================================\n\n // Analyze user prompts every N prompts to build/update your user profile\n // When N uncaptured prompts accumulate, AI will analyze them to identify:\n // - User preferences (code style, communication style, tool preferences)\n // - User patterns (recurring topics, problem domains, technical interests)\n // - User workflows (development habits, sequences, learning style)\n // - Skill level (overall and per-domain assessment)\n \"userProfileAnalysisInterval\": 10,\n\n // Days before inactive items (all types) are eligible for removal\n \"userProfileStaleDays\": 2,\n\n // Number of preferences shown in UI\n \"userProfileDisplayPreferences\": 20,\n \n // Number of patterns shown in UI\n \"userProfileDisplayPatterns\": 15,\n \n // Number of workflows shown in UI\n \"userProfileDisplayWorkflows\": 10,\n \n // Number of preferences injected into LLM conversation context\n // Keep this small \u2014 the strongest signals are enough; more dilute LLM attention\n \"userProfileInjectPreferences\": 5,\n \n // Number of patterns injected into LLM conversation context\n \"userProfileInjectPatterns\": 5,\n \n // Number of workflows injected into LLM conversation context\n \"userProfileInjectWorkflows\": 3,\n \n // Days before preference confidence starts to decay (if not reinforced)\n // Preferences that aren't seen again will gradually lose confidence and be removed\n \"userProfileConfidenceDecayDays\": 30,\n \n // Number of profile versions to keep in changelog (for rollback/debugging)\n // Older versions are automatically cleaned up\n \"userProfileChangelogRetentionCount\": 5,\n\n // Minimum evidence count for a preference/pattern to survive confidence decay\n // Items confirmed fewer times are more likely to be pruned when confidence decays\n \"userProfileMinEvidenceForRetention\": 3,\n\n // Periodically merge duplicate or irrelevant profile items with the configured AI provider\n \"userProfileAutoCleanupEnabled\": true,\n // Number of analyzed user prompts between automatic AI cleanup runs\n \"userProfileAutoCleanupInterval\": 100,\n\n // Enable LLM validation of existing preferences against recent behavior.\n // When enabled, each analysis round checks if top-5 preferences still match recent prompts.\n // Experimental \u2014 disabled by default.\n \"userProfileValidationEnabled\": false,\n\n // ============================================\n // Search Settings\n // ============================================\n \n // Minimum similarity score (0-1) for memory search results\n \"similarityThreshold\": 0.6,\n\n // Maximum number of memories to return in search results\n \"maxMemories\": 10,\n\n // ============================================\n // Advanced Settings\n // ============================================\n \n // Inject user profile into AI context (preferences, patterns, workflows)\n \"injectProfile\": true\n}\n";
101
+ export declare const CONFIG_TEMPLATE = "{\n // ============================================\n // omms (Opinionated Modular Memory System) Configuration\n // ============================================\n \n // Storage location for the vector database. Leave unset to use the\n // default ~/.omms/data (a legacy ~/.opencode-mem/data store is migrated\n // there automatically on first start; see docs/omms-migration.md).\n // \"storagePath\": \"~/.omms/data\",\n\n \"userEmailOverride\": \"\",\n \"userNameOverride\": \"\",\n \n // ============================================\n // Embedding Model (for similarity search)\n // ============================================\n // Local = Hugging Face / ONNX via @huggingface/transformers (not Apple MLX).\n // Remote = set BOTH embeddingApiUrl and embeddingApiKey (OpenAI-compatible /embeddings).\n \n // Default: Nomic Embed v1 (768 dimensions, 8192 context, multilingual)\n \"embeddingModel\": \"Xenova/nomic-embed-text-v1\",\n\n // Opt-in Nomic task prefixes (search_document: / search_query:). After enabling,\n // re-index existing memories so store and query vectors stay aligned.\n // \"embeddingUseTaskPrefixes\": true,\n \n // Auto-detected dimensions (no need to set manually)\n // \"embeddingDimensions\": 768,\n \n // Other recommended local models:\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-base-en\", // 768 dims, English-only, 8192 context\n // \"embeddingModel\": \"Xenova/jina-embeddings-v2-small-en\", // 512 dims, faster, 8192 context\n // \"embeddingModel\": \"Xenova/all-MiniLM-L6-v2\", // 384 dims, very fast, 512 context\n // \"embeddingModel\": \"Xenova/all-mpnet-base-v2\", // 768 dims, good quality, 512 context\n \n // Optional: OpenAI-compatible API for embeddings (both URL and key required)\n // \"embeddingApiUrl\": \"https://api.openai.com/v1\",\n // \"embeddingApiKey\": \"env://OPENAI_API_KEY\", // or \"sk-...\" / \"file:///path/to/key\"\n // \"embeddingModel\": \"text-embedding-3-small\", // 1536 dims, auto-detected\n \n // ============================================\n // Web Server Settings\n // ============================================\n \n // Start a background import of past chats on each host's next start.\n \"autoBackfill\": true,\n // \"piBackfillModel\": \"inherit\", // or \"external\", or \"provider/model\"\n // \"opencodeBackfillModel\": \"inherit\", // or \"external\", or \"provider/model\"\n // Directory maps for history recorded in moved or deleted directories.\n // \"importPathMaps\": [{ \"from\": \"~/code/app-feat-x\", \"to\": \"~/code/app\" }],\n\n // Register the web app to start when you log in.\n \"webServerAutoStart\": true,\n // Enable web UI for managing memories (accessible at http://localhost:4747)\n \"webServerEnabled\": true,\n \n // Port for web UI server\n \"webServerPort\": 4747,\n \n // Host address for web UI (use 127.0.0.1 for local only, 0.0.0.0 for network access)\n \"webServerHost\": \"127.0.0.1\",\n\n // Optional HTTP Basic Auth for the web UI. Accepts literal, env://, or file:// secrets.\n // \"webServerAuthPassword\": \"\",\n // \"webServerAuthUsername\": \"\",\n\n // Required when webServerHost is not loopback. Protects /api/* with Bearer / X-Omms-Token (legacy X-Opencode-Mem-Token still works).\n // \"webServerApiToken\": \"env://OMMS_WEB_TOKEN\",\n \n // ============================================\n // Database Settings\n // ============================================\n \n // Maximum vectors per database shard (auto-creates new shard when limit reached)\n \"maxVectorsPerShard\": 50000,\n \n // Automatically delete old memories based on retention period\n \"autoCleanupEnabled\": true,\n \n // Days to keep memories before auto-cleanup (only if autoCleanupEnabled is true)\n \"autoCleanupRetentionDays\": 30,\n \n // Automatically detect and remove duplicate memories\n \"deduplicationEnabled\": true,\n \n // Similarity threshold (0-1) for detecting duplicates (higher = stricter)\n \"deduplicationSimilarityThreshold\": 0.90,\n \n // ============================================\n // Memory Scope Settings\n // ============================================\n\n // Default scope for memory list/search queries\n // \"project\" keeps queries within the current project, \"all-projects\" searches across all project shards\n \"memory\": {\n \"defaultScope\": \"project\"\n },\n\n // ============================================\n // Model for auto-capture and profile learning (same rule in OpenCode and Pi)\n // ============================================\n\n // Which model summarises your work, in this order:\n // 1. The host model below: opencodeProvider/opencodeModel in OpenCode,\n // piProvider/piModel in Pi. Set the model to \"inherit\" to follow\n // whatever model the session is using, or to \"external\" to send\n // every call to the external API below.\n // 2. If no host model is set: the external API (memoryModel/memoryApiUrl/\n // memoryApiKey further down).\n // 3. If neither is set: the session's own model.\n // If the host model fails and the external API is configured, the external\n // API is used instead.\n //\n // Host models go through OpenCode's or Pi's own sign-in (OAuth like Claude\n // Pro/Max, GitHub Copilot, ChatGPT, or your own key there), so no separate API\n // key is needed here.\n //\n // Examples (OpenCode names from 'opencode providers list'; Pi names from its model list):\n // \"opencodeProvider\": \"anthropic\", \"opencodeModel\": \"claude-haiku-4-5-20251001\"\n // \"opencodeProvider\": \"openai\", \"opencodeModel\": \"inherit\"\n // \"piProvider\": \"openai-codex\", \"piModel\": \"gpt-5.6-luna\"\n //\n // \"opencodeProvider\": \"anthropic\",\n // \"opencodeModel\": \"claude-haiku-4-5-20251001\",\n // \"piProvider\": \"openai-codex\",\n // \"piModel\": \"gpt-5.6-luna\",\n\n // ============================================\n // Auto-Capture Settings\n // ============================================\n \n // Auto-capture runs in the background without blocking your main session.\n // Note: Ollama may not support tool calling. Use OpenAI, Anthropic, or Groq for best results.\n \n \"autoCaptureEnabled\": true,\n \n // Provider type: \"openai-chat\" | \"openai-responses\" | \"anthropic\" | \"minimax\" | \"orcarouter\" | \"google-gemini\"\n // Note: \"openai-chat\" is a generic OpenAI API-compatible mode.\n // Any service that follows the OpenAI Chat Completions API can use it via custom \"memoryApiUrl\".\n \"memoryProvider\": \"openai-chat\",\n \n // External API (step 2 above, and the fallback when a host model fails).\n // Uncomment all 3 lines and replace memoryApiKey before use:\n // \"memoryModel\": \"gpt-4o-mini\",\n // \"memoryApiUrl\": \"https://api.openai.com/v1\",\n // \"memoryApiKey\": \"sk-...\",\n\n // API Key Formats:\n // Direct value: \"sk-...\"\n // From file: \"file://~/.config/litellm-key.txt\"\n // From env variable: \"env://LITELLM_API_KEY\"\n \n // Examples for different providers:\n // Any OpenAI-compatible endpoint can use the \"openai-chat\" provider pattern below.\n // Common examples: DeepSeek, Qwen (via Alibaba Cloud ModelStudio),\n // Zhipu GLM (BigModel platform), and Kimi (Moonshot AI platform).\n\n // OpenAI Chat Completion (default, backward compatible):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"gpt-4o-mini\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n\n // DeepSeek (OpenAI-compatible example):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"deepseek-chat\"\n // \"memoryApiUrl\": \"https://api.deepseek.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // OpenAI Responses API (recommended, with session support):\n // \"memoryProvider\": \"openai-responses\"\n // \"memoryModel\": \"gpt-4o\"\n // \"memoryApiUrl\": \"https://api.openai.com/v1\"\n // \"memoryApiKey\": \"sk-...\"\n \n // Anthropic (with session support):\n // \"memoryProvider\": \"anthropic\"\n // \"memoryModel\": \"claude-3-5-haiku-20241022\"\n // \"memoryApiUrl\": \"https://api.anthropic.com/v1\"\n // \"memoryApiKey\": \"sk-ant-...\"\n\n // MiniMax (Anthropic Messages-compatible endpoint, with session support):\n // \"memoryProvider\": \"minimax\"\n // \"memoryModel\": \"MiniMax-M3\"\n // \"memoryApiUrl\": \"https://api.minimax.io\" // global endpoint\n // \"memoryApiKey\": \"<MiniMax API key>\"\n // // China endpoint: \"memoryApiUrl\": \"https://api.minimaxi.com\"\n // // Optional adaptive thinking for MiniMax-M3:\n // \"memoryExtraParams\": { \"thinking\": { \"type\": \"adaptive\" } }\n\n // OrcaRouter (OpenAI-compatible gateway, namespaced model IDs, with session support):\n // \"memoryProvider\": \"orcarouter\"\n // \"memoryApiKey\": \"<OrcaRouter API key>\"\n // // memoryApiUrl and memoryModel are optional \u2014 they default to\n // // https://api.orcarouter.ai/v1 and \"orcarouter/auto\" (a routing alias).\n // // OrcaRouter rejects bare model names, so if you set memoryModel, use a\n // // namespaced ID such as \"openai/gpt-5.5\" or \"deepseek/deepseek-v4-flash\".\n // \"memoryModel\": \"openai/gpt-5.5\"\n\n // Groq (OpenAI-compatible, use openai-chat provider):\n // \"memoryProvider\": \"openai-chat\"\n // \"memoryModel\": \"llama-3.3-70b-versatile\"\n // \"memoryApiUrl\": \"https://api.groq.com/openai/v1\"\n // \"memoryApiKey\": \"gsk_...\"\n \n // Maximum iterations for multi-turn AI analysis (for openai-responses, anthropic, and minimax)\n \"autoCaptureMaxIterations\": 5,\n \n // Timeout per iteration in milliseconds (30 seconds default)\n \"autoCaptureIterationTimeout\": 30000,\n\n // Maximum number of times to retry capturing a prompt if it fails (due to network, API errors, etc.)\n \"autoCaptureMaxRetries\": 3,\n\n // Maximum UTF-8 bytes for the auto-capture markdown context sent to the summary model.\n // Prevents HTTP 400 context overflows on models with ~131K token windows (e.g. Groq Llama).\n // Rough guide: tokens \u2248 bytes / 4 for mixed code/prose.\n \"autoCaptureMaxContextBytes\": 131072,\n \n // Days to keep AI session history before cleanup\n \"aiSessionRetentionDays\": 7,\n\n // Capture diagnostics: every capture attempt always writes one metadata line\n // (model, stop reason, sizes, outcome) to ~/.omms/omms.log, with no\n // conversation text. Set captureTrace to true to also write each attempt's\n // prompt and raw reply to ~/.omms/traces/ for debugging. Traces can contain\n // conversation content: <private> text and common API key formats are\n // redacted, files are readable only by you, and they are deleted after\n // captureTraceRetentionDays. Only this global file can turn tracing on.\n // \"captureTrace\": false,\n // \"captureTraceRetentionDays\": 7,\n // \"captureAttemptRetentionDays\": 30,\n\n // Temperature for AI API requests (set to false to omit parameter for models that don't support it)\n // Some reasoning models (like o1, o3, gpt-5) don't support temperature parameter\n // Set to false and add \"memoryTemperature\": false in config when using such models\n \"memoryTemperature\": 0.3,\n\n // Extra parameters to include in API request body\n // Useful for local inference servers (e.g. llama-server with --jinja) that support\n // additional parameters like disabling thinking/reasoning mode\n // Example for Qwen3 models: { \"enable_thinking\": false }\n // \"memoryExtraParams\": {},\n\n // Language for auto-capture summaries (default: \"auto\" for auto-detection)\n // Options: \"auto\", \"en\", \"id\", \"zh\", \"ja\", \"es\", \"fr\", \"de\", \"ru\", \"pt\", \"ar\", \"ko\"\n // \"autoCaptureLanguage\": \"auto\",\n\n // ============================================\n // Toast Notifications\n // ============================================\n\n // Show toast when memory is auto-captured\n \"showAutoCaptureToasts\": true,\n\n // Show toast when user profile is updated\n \"showUserProfileToasts\": true,\n\n // Show toast for error messages\n \"showErrorToasts\": true,\n\n // ============================================\n // User Profile System\n // ============================================\n\n // Analyze user prompts every N prompts to build/update your user profile\n // When N uncaptured prompts accumulate, AI will analyze them to identify:\n // - User preferences (code style, communication style, tool preferences)\n // - User patterns (recurring topics, problem domains, technical interests)\n // - User workflows (development habits, sequences, learning style)\n // - Skill level (overall and per-domain assessment)\n \"userProfileAnalysisInterval\": 10,\n\n // Days before inactive items (all types) are eligible for removal\n \"userProfileStaleDays\": 2,\n\n // Number of preferences shown in UI\n \"userProfileDisplayPreferences\": 20,\n \n // Number of patterns shown in UI\n \"userProfileDisplayPatterns\": 15,\n \n // Number of workflows shown in UI\n \"userProfileDisplayWorkflows\": 10,\n \n // Number of preferences injected into LLM conversation context\n // Keep this small \u2014 the strongest signals are enough; more dilute LLM attention\n \"userProfileInjectPreferences\": 5,\n \n // Number of patterns injected into LLM conversation context\n \"userProfileInjectPatterns\": 5,\n \n // Number of workflows injected into LLM conversation context\n \"userProfileInjectWorkflows\": 3,\n \n // Days before preference confidence starts to decay (if not reinforced)\n // Preferences that aren't seen again will gradually lose confidence and be removed\n \"userProfileConfidenceDecayDays\": 30,\n \n // Number of profile versions to keep in changelog (for rollback/debugging)\n // Older versions are automatically cleaned up\n \"userProfileChangelogRetentionCount\": 5,\n\n // Minimum evidence count for a preference/pattern to survive confidence decay\n // Items confirmed fewer times are more likely to be pruned when confidence decays\n \"userProfileMinEvidenceForRetention\": 3,\n\n // Periodically merge duplicate or irrelevant profile items with the configured AI provider\n \"userProfileAutoCleanupEnabled\": true,\n // Number of analyzed user prompts between automatic AI cleanup runs\n \"userProfileAutoCleanupInterval\": 100,\n\n // Enable LLM validation of existing preferences against recent behavior.\n // When enabled, each analysis round checks if top-5 preferences still match recent prompts.\n // Experimental \u2014 disabled by default.\n \"userProfileValidationEnabled\": false,\n\n // ============================================\n // Search Settings\n // ============================================\n \n // Minimum similarity score (0-1) for memory search results\n \"similarityThreshold\": 0.6,\n\n // Maximum number of memories to return in search results\n \"maxMemories\": 10,\n\n // ============================================\n // Advanced Settings\n // ============================================\n \n // Inject user profile into AI context (preferences, patterns, workflows)\n \"injectProfile\": true\n}\n";
97
102
  export declare function normalizeAutoCaptureMaxContextBytes(value: number): number;
98
103
  export declare function normalizeAutoCleanupRetentionDays(value: number): number;
99
104
  declare function buildConfig(fileConfig: OmmsConfig): {
@@ -116,7 +121,7 @@ declare function buildConfig(fileConfig: OmmsConfig): {
116
121
  autoCaptureMaxRetries: number;
117
122
  autoCaptureMaxContextBytes: number;
118
123
  autoCaptureLanguage: string | undefined;
119
- memoryProvider: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter";
124
+ memoryProvider: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "google-gemini";
120
125
  memoryModel: string | undefined;
121
126
  memoryApiUrl: string | undefined;
122
127
  memoryApiKey: string | undefined;
@@ -134,6 +139,7 @@ declare function buildConfig(fileConfig: OmmsConfig): {
134
139
  autoBackfill: boolean;
135
140
  opencodeBackfillModel: string;
136
141
  piBackfillModel: string;
142
+ importPathMaps: import("./importer/importer.js").ImportPathMap[];
137
143
  webServerAutoStart: boolean;
138
144
  webServerEnabled: boolean;
139
145
  webServerPort: number;
@@ -208,7 +214,7 @@ export declare let CONFIG: {
208
214
  autoCaptureMaxRetries: number;
209
215
  autoCaptureMaxContextBytes: number;
210
216
  autoCaptureLanguage: string | undefined;
211
- memoryProvider: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter";
217
+ memoryProvider: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "google-gemini";
212
218
  memoryModel: string | undefined;
213
219
  memoryApiUrl: string | undefined;
214
220
  memoryApiKey: string | undefined;
@@ -226,6 +232,7 @@ export declare let CONFIG: {
226
232
  autoBackfill: boolean;
227
233
  opencodeBackfillModel: string;
228
234
  piBackfillModel: string;
235
+ importPathMaps: import("./importer/importer.js").ImportPathMap[];
229
236
  webServerAutoStart: boolean;
230
237
  webServerEnabled: boolean;
231
238
  webServerPort: number;
package/dist/config.js CHANGED
@@ -7,6 +7,7 @@ import { resolveSecretValue } from "./services/secret-resolver.js";
7
7
  import { isPlaceholderApiKey } from "./services/ai/api-key-placeholder.js";
8
8
  import { getAutoCaptureProviderStatus } from "./services/ai/live-model-choice.js";
9
9
  import { parseBackfillModel } from "./importer/backfill-model.js";
10
+ import { parseImportPathMaps } from "./importer/import-path-maps.js";
10
11
  import { resolveDefaultStoragePath, runLegacyStoreMigration, legacyMigrationPaths, } from "./services/legacy-migration.js";
11
12
  const OMMS_CONFIG_DIR = join(homedir(), ".config", "omms");
12
13
  const DATA_DIR = join(homedir(), ".omms");
@@ -55,6 +56,7 @@ const DEFAULTS = {
55
56
  autoBackfill: true,
56
57
  opencodeBackfillModel: "inherit",
57
58
  piBackfillModel: "inherit",
59
+ importPathMaps: [],
58
60
  webServerAutoStart: true,
59
61
  webServerEnabled: true,
60
62
  webServerPort: 4747,
@@ -198,8 +200,10 @@ export const CONFIG_TEMPLATE = `{
198
200
 
199
201
  // Start a background import of past chats on each host's next start.
200
202
  "autoBackfill": true,
201
- // "piBackfillModel": "inherit", // or "provider/model"
202
- // "opencodeBackfillModel": "inherit", // or "provider/model"
203
+ // "piBackfillModel": "inherit", // or "external", or "provider/model"
204
+ // "opencodeBackfillModel": "inherit", // or "external", or "provider/model"
205
+ // Directory maps for history recorded in moved or deleted directories.
206
+ // "importPathMaps": [{ "from": "~/code/app-feat-x", "to": "~/code/app" }],
203
207
 
204
208
  // Register the web app to start when you log in.
205
209
  "webServerAutoStart": true,
@@ -216,7 +220,7 @@ export const CONFIG_TEMPLATE = `{
216
220
  // "webServerAuthPassword": "",
217
221
  // "webServerAuthUsername": "",
218
222
 
219
- // Required when webServerHost is not loopback. Protects /api/* with Bearer / X-Opencode-Mem-Token.
223
+ // Required when webServerHost is not loopback. Protects /api/* with Bearer / X-Omms-Token (legacy X-Opencode-Mem-Token still works).
220
224
  // "webServerApiToken": "env://OMMS_WEB_TOKEN",
221
225
 
222
226
  // ============================================
@@ -255,7 +259,8 @@ export const CONFIG_TEMPLATE = `{
255
259
  // Which model summarises your work, in this order:
256
260
  // 1. The host model below: opencodeProvider/opencodeModel in OpenCode,
257
261
  // piProvider/piModel in Pi. Set the model to "inherit" to follow
258
- // whatever model the session is using.
262
+ // whatever model the session is using, or to "external" to send
263
+ // every call to the external API below.
259
264
  // 2. If no host model is set: the external API (memoryModel/memoryApiUrl/
260
265
  // memoryApiKey further down).
261
266
  // 3. If neither is set: the session's own model.
@@ -285,7 +290,7 @@ export const CONFIG_TEMPLATE = `{
285
290
 
286
291
  "autoCaptureEnabled": true,
287
292
 
288
- // Provider type: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter"
293
+ // Provider type: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "google-gemini"
289
294
  // Note: "openai-chat" is a generic OpenAI API-compatible mode.
290
295
  // Any service that follows the OpenAI Chat Completions API can use it via custom "memoryApiUrl".
291
296
  "memoryProvider": "openai-chat",
@@ -554,14 +559,29 @@ export function normalizeAutoCleanupRetentionDays(value) {
554
559
  }
555
560
  return value;
556
561
  }
562
+ /**
563
+ * The external API key, or undefined when its `env://` or `file://` source does
564
+ * not resolve in this process (a login web app does not see shell-profile
565
+ * variables). Readiness then reports the key as missing instead of the whole
566
+ * config failing to load.
567
+ */
568
+ function resolveMemoryApiKey(value) {
569
+ try {
570
+ return resolveSecretValue(value);
571
+ }
572
+ catch {
573
+ return undefined;
574
+ }
575
+ }
557
576
  function buildConfig(fileConfig) {
558
- const memoryApiKey = resolveSecretValue(fileConfig.memoryApiKey);
577
+ const memoryApiKey = resolveMemoryApiKey(fileConfig.memoryApiKey);
559
578
  const embeddingDimensions = fileConfig.embeddingDimensions ??
560
579
  getEmbeddingDimensions(fileConfig.embeddingModel ?? DEFAULTS.embeddingModel);
561
580
  const autoCaptureMaxContextBytes = normalizeAutoCaptureMaxContextBytes(fileConfig.autoCaptureMaxContextBytes ?? DEFAULTS.autoCaptureMaxContextBytes);
562
581
  const userProfileAutoCleanupInterval = fileConfig.userProfileAutoCleanupInterval ?? DEFAULTS.userProfileAutoCleanupInterval;
563
582
  parseBackfillModel(fileConfig, "pi");
564
583
  parseBackfillModel(fileConfig, "opencode");
584
+ const importPathMaps = parseImportPathMaps(fileConfig.importPathMaps);
565
585
  for (const key of ["autoBackfill", "webServerAutoStart"]) {
566
586
  if (fileConfig[key] !== undefined && typeof fileConfig[key] !== "boolean") {
567
587
  throw new Error(`Invalid ${key} config`);
@@ -612,6 +632,7 @@ function buildConfig(fileConfig) {
612
632
  autoCaptureProviderStatus: getAutoCaptureProviderStatus({
613
633
  opencodeProvider: fileConfig.opencodeProvider,
614
634
  opencodeModel: fileConfig.opencodeModel,
635
+ memoryProvider: fileConfig.memoryProvider,
615
636
  memoryModel: fileConfig.memoryModel,
616
637
  memoryApiUrl: fileConfig.memoryApiUrl,
617
638
  memoryApiKey,
@@ -623,6 +644,7 @@ function buildConfig(fileConfig) {
623
644
  autoBackfill: fileConfig.autoBackfill ?? DEFAULTS.autoBackfill,
624
645
  opencodeBackfillModel: fileConfig.opencodeBackfillModel ?? DEFAULTS.opencodeBackfillModel,
625
646
  piBackfillModel: fileConfig.piBackfillModel ?? DEFAULTS.piBackfillModel,
647
+ importPathMaps,
626
648
  webServerAutoStart: fileConfig.webServerAutoStart ?? DEFAULTS.webServerAutoStart,
627
649
  webServerEnabled: fileConfig.webServerEnabled ?? DEFAULTS.webServerEnabled,
628
650
  webServerPort: fileConfig.webServerPort ?? DEFAULTS.webServerPort,
@@ -777,6 +799,7 @@ export function initConfig(directory, options = {}) {
777
799
  delete projectOverrides.autoBackfill;
778
800
  delete projectOverrides.opencodeBackfillModel;
779
801
  delete projectOverrides.piBackfillModel;
802
+ delete projectOverrides.importPathMaps;
780
803
  delete projectOverrides.webServerAutoStart;
781
804
  delete projectOverrides.webServerEnabled;
782
805
  const merged = { ...globalConfig, ...projectOverrides };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * True when a prompt is omms's own structured-summary or profile-analysis
3
+ * request. Both hosts echo it back like a user message; recording or learning
4
+ * from it would create self-referential memories and a learning loop.
5
+ */
6
+ export declare function isStructuredSummaryPromptMessage(userMessage: string): boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * True when a prompt is omms's own structured-summary or profile-analysis
3
+ * request. Both hosts echo it back like a user message; recording or learning
4
+ * from it would create self-referential memories and a learning loop.
5
+ */
6
+ export function isStructuredSummaryPromptMessage(userMessage) {
7
+ if (userMessage.includes("# User Profile Analysis")) {
8
+ return true;
9
+ }
10
+ return userMessage.includes("Analyze this conversation.") && userMessage.includes('type="skip"');
11
+ }
@@ -1,5 +1,6 @@
1
1
  import type { BackfillHost } from "./backfill-model.js";
2
2
  import { runHistoryImport, type HistoryImportModels } from "./run-import.js";
3
+ import { type ImportSurface } from "./import-runs.js";
3
4
  type Run = typeof runHistoryImport;
4
5
  export interface AutoBackfillOptions {
5
6
  host: BackfillHost;
@@ -14,6 +15,10 @@ export interface AutoBackfillOptions {
14
15
  now?: () => number;
15
16
  enabled?: () => boolean;
16
17
  signal?: AbortSignal;
18
+ /** `web` for Run now and Resume on the Settings page. */
19
+ surface?: ImportSurface;
20
+ /** Skip the start-up delay and the autoBackfill switch: the user asked for this run. */
21
+ userStarted?: boolean;
17
22
  }
18
23
  /** Schedule one host's history import after startup; callers do not await it. */
19
24
  export declare function scheduleAutoBackfill(options: AutoBackfillOptions): Promise<void>;