om-memory-system 4.23.0-next.144 → 4.24.0-next.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-template.d.ts +6 -0
- package/dist/config-template.js +385 -0
- package/dist/config.d.ts +18 -1
- package/dist/config.js +68 -382
- package/dist/services/client.js +32 -4
- package/dist/services/global-config-writer.js +54 -7
- package/dist/services/request-timeouts.d.ts +5 -0
- package/dist/services/request-timeouts.js +8 -0
- package/dist/services/reranker-test.d.ts +1 -0
- package/dist/services/reranker-test.js +94 -0
- package/dist/services/reranker.d.ts +45 -0
- package/dist/services/reranker.js +133 -0
- package/dist/services/retrieval-rerank.d.ts +43 -0
- package/dist/services/retrieval-rerank.js +42 -0
- package/dist/services/settings-snapshot.js +25 -4
- package/dist/services/web-server.js +3 -0
- package/dist/utils/memory-limits.d.ts +7 -8
- package/dist/utils/memory-limits.js +10 -4
- package/dist/utils/threshold-default.d.ts +12 -0
- package/dist/utils/threshold-default.js +22 -0
- package/dist/web/assets/index-B_2GCxJJ.js +127 -0
- package/dist/web/assets/index-JAZ-QY-Z.css +2 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-7385lY75.css +0 -2
- package/dist/web/assets/index-C9y78EH_.js +0 -127
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSONC template written to a new ~/.config/omms/omms.jsonc. Lived in
|
|
3
|
+
* src/config.ts until that file reached its size ceiling; the text is
|
|
4
|
+
* unchanged. Shared by config.ts and the global settings writer.
|
|
5
|
+
*/
|
|
6
|
+
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 embeddingApiUrl (OpenAI-compatible /embeddings); embeddingApiKey is optional.\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 (URL required; key only if the server needs one)\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 // Unresolved directories to hide on the Directory maps page. They stay unimported.\n // \"importIgnoredDirectories\": [\"/private/tmp/scratch\"],\n // Claude Code's folder, when it is not ~/.claude (like CLAUDE_CONFIG_DIR).\n // \"claudeConfigDir\": \"~/.claude-work\",\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 // Deprecated: imported once into the API token table, then no longer read.\n // Create API tokens on the Settings page (Keys and access) instead.\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 // Tries for one turn's capture, on Pi and OpenCode, 2 and 4 seconds apart. After the\n // last one fails, a turn the model could not reach goes to the capture retry queue.\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 // Capture retry queue: when a live capture fails because the model cannot be\n // reached (network error, timeout, HTTP 408, 429 or 5xx), OMMS keeps a copy of\n // the turn in ~/.omms/data and tries it again later. The copy has <private>\n // text and common API key formats removed. Turns are deleted when the retry\n // ends or after captureRetryRetentionHours (0 to 720). 0 turns the queue off.\n // Only this global file can set it.\n // \"captureRetryRetentionHours\": 72,\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 // Days before an inactive workflow is eligible for removal. A workflow seen\n // userProfileMinEvidenceForRetention times or more is kept.\n \"userProfileWorkflowStaleDays\": 30,\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 // Merge duplicate or vague profile items every N analysed prompts (about 1 model call per 100 items)\n \"userProfileAutoCleanupEnabled\": true,\n \"userProfileAutoCleanupInterval\": 500,\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. Leave unset to\n // follow the default for your embedding model: 0.5 for qwen3-embedding:0.6b\n // (the only model measured), 0.6 for every other embedder.\n // \"similarityThreshold\": 0.5,\n\n // Maximum number of memories to return in search results.\n // Manual searches can ask for fewer; prompt retrieval uses this ceiling.\n \"maxMemories\": 10,\n\n // ============================================\n // Memory Context Controls\n // ============================================\n\n // Recent memories added at fresh session start (OpenCode V1 and Claude Code).\n // Pi and OpenCode V2 search the store with each prompt instead.\n \"chatMessage\": {\n \"enabled\": true,\n // Recent memories injected at session start.\n \"maxMemories\": 3,\n \"excludeCurrentSession\": true,\n // When to inject: \"first\" message of a session or \"always\".\n // \"injectOn\": \"first\",\n },\n\n // OpenCode profile-learning input limit, in UTF-8 bytes. Smaller values can\n // omit prompts from that input. Does not limit Pi or Claude Code profile input.\n \"userProfileMaxContextBytes\": 32768,\n\n // Shared budget for automatic memory context (profile text, memories, and\n // formatting) across all hosts, in approximate tokens: ceil(UTF-8 bytes / 4).\n // Covers prompt retrieval, recent-memory injection, and session-memory\n // restoration. Not an exact provider token limit or a spending limit.\n \"retrievalMaxTokens\": 2000,\n\n // ============================================\n // Advanced Settings\n // ============================================\n \n // Inject user profile into AI context (preferences, patterns, workflows)\n \"injectProfile\": true\n}\n";
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSONC template written to a new ~/.config/omms/omms.jsonc. Lived in
|
|
3
|
+
* src/config.ts until that file reached its size ceiling; the text is
|
|
4
|
+
* unchanged. Shared by config.ts and the global settings writer.
|
|
5
|
+
*/
|
|
6
|
+
export const CONFIG_TEMPLATE = `{
|
|
7
|
+
// ============================================
|
|
8
|
+
// omms (Opinionated Modular Memory System) Configuration
|
|
9
|
+
// ============================================
|
|
10
|
+
|
|
11
|
+
// Storage location for the vector database. Leave unset to use the
|
|
12
|
+
// default ~/.omms/data (a legacy ~/.opencode-mem/data store is migrated
|
|
13
|
+
// there automatically on first start; see docs/omms-migration.md).
|
|
14
|
+
// "storagePath": "~/.omms/data",
|
|
15
|
+
|
|
16
|
+
"userEmailOverride": "",
|
|
17
|
+
"userNameOverride": "",
|
|
18
|
+
|
|
19
|
+
// ============================================
|
|
20
|
+
// Embedding Model (for similarity search)
|
|
21
|
+
// ============================================
|
|
22
|
+
// Local = Hugging Face / ONNX via @huggingface/transformers (not Apple MLX).
|
|
23
|
+
// Remote = set embeddingApiUrl (OpenAI-compatible /embeddings); embeddingApiKey is optional.
|
|
24
|
+
|
|
25
|
+
// Default: Nomic Embed v1 (768 dimensions, 8192 context, multilingual)
|
|
26
|
+
"embeddingModel": "Xenova/nomic-embed-text-v1",
|
|
27
|
+
|
|
28
|
+
// Opt-in Nomic task prefixes (search_document: / search_query:). After enabling,
|
|
29
|
+
// re-index existing memories so store and query vectors stay aligned.
|
|
30
|
+
// "embeddingUseTaskPrefixes": true,
|
|
31
|
+
|
|
32
|
+
// Auto-detected dimensions (no need to set manually)
|
|
33
|
+
// "embeddingDimensions": 768,
|
|
34
|
+
|
|
35
|
+
// Other recommended local models:
|
|
36
|
+
// "embeddingModel": "Xenova/jina-embeddings-v2-base-en", // 768 dims, English-only, 8192 context
|
|
37
|
+
// "embeddingModel": "Xenova/jina-embeddings-v2-small-en", // 512 dims, faster, 8192 context
|
|
38
|
+
// "embeddingModel": "Xenova/all-MiniLM-L6-v2", // 384 dims, very fast, 512 context
|
|
39
|
+
// "embeddingModel": "Xenova/all-mpnet-base-v2", // 768 dims, good quality, 512 context
|
|
40
|
+
|
|
41
|
+
// Optional: OpenAI-compatible API for embeddings (URL required; key only if the server needs one)
|
|
42
|
+
// "embeddingApiUrl": "https://api.openai.com/v1",
|
|
43
|
+
// "embeddingApiKey": "env://OPENAI_API_KEY", // or "sk-..." / "file:///path/to/key"
|
|
44
|
+
// "embeddingModel": "text-embedding-3-small", // 1536 dims, auto-detected
|
|
45
|
+
|
|
46
|
+
// ============================================
|
|
47
|
+
// Web Server Settings
|
|
48
|
+
// ============================================
|
|
49
|
+
|
|
50
|
+
// Start a background import of past chats on each host's next start.
|
|
51
|
+
"autoBackfill": true,
|
|
52
|
+
// "piBackfillModel": "inherit", // or "external", or "provider/model"
|
|
53
|
+
// "opencodeBackfillModel": "inherit", // or "external", or "provider/model"
|
|
54
|
+
// Directory maps for history recorded in moved or deleted directories.
|
|
55
|
+
// "importPathMaps": [{ "from": "~/code/app-feat-x", "to": "~/code/app" }],
|
|
56
|
+
// Unresolved directories to hide on the Directory maps page. They stay unimported.
|
|
57
|
+
// "importIgnoredDirectories": ["/private/tmp/scratch"],
|
|
58
|
+
// Claude Code's folder, when it is not ~/.claude (like CLAUDE_CONFIG_DIR).
|
|
59
|
+
// "claudeConfigDir": "~/.claude-work",
|
|
60
|
+
|
|
61
|
+
// Register the web app to start when you log in.
|
|
62
|
+
"webServerAutoStart": true,
|
|
63
|
+
// Enable web UI for managing memories (accessible at http://localhost:4747)
|
|
64
|
+
"webServerEnabled": true,
|
|
65
|
+
|
|
66
|
+
// Port for web UI server
|
|
67
|
+
"webServerPort": 4747,
|
|
68
|
+
|
|
69
|
+
// Host address for web UI (use 127.0.0.1 for local only, 0.0.0.0 for network access)
|
|
70
|
+
"webServerHost": "127.0.0.1",
|
|
71
|
+
|
|
72
|
+
// Optional HTTP Basic Auth for the web UI. Accepts literal, env://, or file:// secrets.
|
|
73
|
+
// "webServerAuthPassword": "",
|
|
74
|
+
// "webServerAuthUsername": "",
|
|
75
|
+
|
|
76
|
+
// Deprecated: imported once into the API token table, then no longer read.
|
|
77
|
+
// Create API tokens on the Settings page (Keys and access) instead.
|
|
78
|
+
// "webServerApiToken": "env://OMMS_WEB_TOKEN",
|
|
79
|
+
|
|
80
|
+
// ============================================
|
|
81
|
+
// Database Settings
|
|
82
|
+
// ============================================
|
|
83
|
+
|
|
84
|
+
// Maximum vectors per database shard (auto-creates new shard when limit reached)
|
|
85
|
+
"maxVectorsPerShard": 50000,
|
|
86
|
+
|
|
87
|
+
// Automatically delete old memories based on retention period
|
|
88
|
+
"autoCleanupEnabled": true,
|
|
89
|
+
|
|
90
|
+
// Days to keep memories before auto-cleanup (only if autoCleanupEnabled is true)
|
|
91
|
+
"autoCleanupRetentionDays": 30,
|
|
92
|
+
|
|
93
|
+
// Automatically detect and remove duplicate memories
|
|
94
|
+
"deduplicationEnabled": true,
|
|
95
|
+
|
|
96
|
+
// Similarity threshold (0-1) for detecting duplicates (higher = stricter)
|
|
97
|
+
"deduplicationSimilarityThreshold": 0.90,
|
|
98
|
+
|
|
99
|
+
// ============================================
|
|
100
|
+
// Memory Scope Settings
|
|
101
|
+
// ============================================
|
|
102
|
+
|
|
103
|
+
// Default scope for memory list/search queries
|
|
104
|
+
// "project" keeps queries within the current project, "all-projects" searches across all project shards
|
|
105
|
+
"memory": {
|
|
106
|
+
"defaultScope": "project"
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
// ============================================
|
|
110
|
+
// Model for auto-capture and profile learning (same rule in OpenCode and Pi)
|
|
111
|
+
// ============================================
|
|
112
|
+
|
|
113
|
+
// Which model summarises your work, in this order:
|
|
114
|
+
// 1. The host model below: opencodeProvider/opencodeModel in OpenCode,
|
|
115
|
+
// piProvider/piModel in Pi. Set the model to "inherit" to follow
|
|
116
|
+
// whatever model the session is using, or to "external" to send
|
|
117
|
+
// every call to the external API below.
|
|
118
|
+
// 2. If no host model is set: the external API (memoryModel/memoryApiUrl/
|
|
119
|
+
// memoryApiKey further down).
|
|
120
|
+
// 3. If neither is set: the session's own model.
|
|
121
|
+
// If the host model fails and the external API is configured, the external
|
|
122
|
+
// API is used instead.
|
|
123
|
+
//
|
|
124
|
+
// Host models go through OpenCode's or Pi's own sign-in (OAuth like Claude
|
|
125
|
+
// Pro/Max, GitHub Copilot, ChatGPT, or your own key there), so no separate API
|
|
126
|
+
// key is needed here.
|
|
127
|
+
//
|
|
128
|
+
// Examples (OpenCode names from 'opencode providers list'; Pi names from its model list):
|
|
129
|
+
// "opencodeProvider": "anthropic", "opencodeModel": "claude-haiku-4-5-20251001"
|
|
130
|
+
// "opencodeProvider": "openai", "opencodeModel": "inherit"
|
|
131
|
+
// "piProvider": "openai-codex", "piModel": "gpt-5.6-luna"
|
|
132
|
+
//
|
|
133
|
+
// "opencodeProvider": "anthropic",
|
|
134
|
+
// "opencodeModel": "claude-haiku-4-5-20251001",
|
|
135
|
+
// "piProvider": "openai-codex",
|
|
136
|
+
// "piModel": "gpt-5.6-luna",
|
|
137
|
+
|
|
138
|
+
// ============================================
|
|
139
|
+
// Auto-Capture Settings
|
|
140
|
+
// ============================================
|
|
141
|
+
|
|
142
|
+
// Auto-capture runs in the background without blocking your main session.
|
|
143
|
+
// Note: Ollama may not support tool calling. Use OpenAI, Anthropic, or Groq for best results.
|
|
144
|
+
|
|
145
|
+
"autoCaptureEnabled": true,
|
|
146
|
+
|
|
147
|
+
// Provider type: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "google-gemini"
|
|
148
|
+
// Note: "openai-chat" is a generic OpenAI API-compatible mode.
|
|
149
|
+
// Any service that follows the OpenAI Chat Completions API can use it via custom "memoryApiUrl".
|
|
150
|
+
"memoryProvider": "openai-chat",
|
|
151
|
+
|
|
152
|
+
// External API (step 2 above, and the fallback when a host model fails).
|
|
153
|
+
// Uncomment all 3 lines and replace memoryApiKey before use:
|
|
154
|
+
// "memoryModel": "gpt-4o-mini",
|
|
155
|
+
// "memoryApiUrl": "https://api.openai.com/v1",
|
|
156
|
+
// "memoryApiKey": "sk-...",
|
|
157
|
+
|
|
158
|
+
// API Key Formats:
|
|
159
|
+
// Direct value: "sk-..."
|
|
160
|
+
// From file: "file://~/.config/litellm-key.txt"
|
|
161
|
+
// From env variable: "env://LITELLM_API_KEY"
|
|
162
|
+
|
|
163
|
+
// Examples for different providers:
|
|
164
|
+
// Any OpenAI-compatible endpoint can use the "openai-chat" provider pattern below.
|
|
165
|
+
// Common examples: DeepSeek, Qwen (via Alibaba Cloud ModelStudio),
|
|
166
|
+
// Zhipu GLM (BigModel platform), and Kimi (Moonshot AI platform).
|
|
167
|
+
|
|
168
|
+
// OpenAI Chat Completion (default, backward compatible):
|
|
169
|
+
// "memoryProvider": "openai-chat"
|
|
170
|
+
// "memoryModel": "gpt-4o-mini"
|
|
171
|
+
// "memoryApiUrl": "https://api.openai.com/v1"
|
|
172
|
+
// "memoryApiKey": "sk-..."
|
|
173
|
+
|
|
174
|
+
// DeepSeek (OpenAI-compatible example):
|
|
175
|
+
// "memoryProvider": "openai-chat"
|
|
176
|
+
// "memoryModel": "deepseek-chat"
|
|
177
|
+
// "memoryApiUrl": "https://api.deepseek.com/v1"
|
|
178
|
+
// "memoryApiKey": "sk-..."
|
|
179
|
+
|
|
180
|
+
// OpenAI Responses API (recommended, with session support):
|
|
181
|
+
// "memoryProvider": "openai-responses"
|
|
182
|
+
// "memoryModel": "gpt-4o"
|
|
183
|
+
// "memoryApiUrl": "https://api.openai.com/v1"
|
|
184
|
+
// "memoryApiKey": "sk-..."
|
|
185
|
+
|
|
186
|
+
// Anthropic (with session support):
|
|
187
|
+
// "memoryProvider": "anthropic"
|
|
188
|
+
// "memoryModel": "claude-3-5-haiku-20241022"
|
|
189
|
+
// "memoryApiUrl": "https://api.anthropic.com/v1"
|
|
190
|
+
// "memoryApiKey": "sk-ant-..."
|
|
191
|
+
|
|
192
|
+
// MiniMax (Anthropic Messages-compatible endpoint, with session support):
|
|
193
|
+
// "memoryProvider": "minimax"
|
|
194
|
+
// "memoryModel": "MiniMax-M3"
|
|
195
|
+
// "memoryApiUrl": "https://api.minimax.io" // global endpoint
|
|
196
|
+
// "memoryApiKey": "<MiniMax API key>"
|
|
197
|
+
// // China endpoint: "memoryApiUrl": "https://api.minimaxi.com"
|
|
198
|
+
// // Optional adaptive thinking for MiniMax-M3:
|
|
199
|
+
// "memoryExtraParams": { "thinking": { "type": "adaptive" } }
|
|
200
|
+
|
|
201
|
+
// OrcaRouter (OpenAI-compatible gateway, namespaced model IDs, with session support):
|
|
202
|
+
// "memoryProvider": "orcarouter"
|
|
203
|
+
// "memoryApiKey": "<OrcaRouter API key>"
|
|
204
|
+
// // memoryApiUrl and memoryModel are optional — they default to
|
|
205
|
+
// // https://api.orcarouter.ai/v1 and "orcarouter/auto" (a routing alias).
|
|
206
|
+
// // OrcaRouter rejects bare model names, so if you set memoryModel, use a
|
|
207
|
+
// // namespaced ID such as "openai/gpt-5.5" or "deepseek/deepseek-v4-flash".
|
|
208
|
+
// "memoryModel": "openai/gpt-5.5"
|
|
209
|
+
|
|
210
|
+
// Groq (OpenAI-compatible, use openai-chat provider):
|
|
211
|
+
// "memoryProvider": "openai-chat"
|
|
212
|
+
// "memoryModel": "llama-3.3-70b-versatile"
|
|
213
|
+
// "memoryApiUrl": "https://api.groq.com/openai/v1"
|
|
214
|
+
// "memoryApiKey": "gsk_..."
|
|
215
|
+
|
|
216
|
+
// Maximum iterations for multi-turn AI analysis (for openai-responses, anthropic, and minimax)
|
|
217
|
+
"autoCaptureMaxIterations": 5,
|
|
218
|
+
|
|
219
|
+
// Timeout per iteration in milliseconds (30 seconds default)
|
|
220
|
+
"autoCaptureIterationTimeout": 30000,
|
|
221
|
+
|
|
222
|
+
// Tries for one turn's capture, on Pi and OpenCode, 2 and 4 seconds apart. After the
|
|
223
|
+
// last one fails, a turn the model could not reach goes to the capture retry queue.
|
|
224
|
+
"autoCaptureMaxRetries": 3,
|
|
225
|
+
|
|
226
|
+
// Maximum UTF-8 bytes for the auto-capture markdown context sent to the summary model.
|
|
227
|
+
// Prevents HTTP 400 context overflows on models with ~131K token windows (e.g. Groq Llama).
|
|
228
|
+
// Rough guide: tokens ≈ bytes / 4 for mixed code/prose.
|
|
229
|
+
"autoCaptureMaxContextBytes": 131072,
|
|
230
|
+
|
|
231
|
+
// Days to keep AI session history before cleanup
|
|
232
|
+
"aiSessionRetentionDays": 7,
|
|
233
|
+
|
|
234
|
+
// Capture diagnostics: every capture attempt always writes one metadata line
|
|
235
|
+
// (model, stop reason, sizes, outcome) to ~/.omms/omms.log, with no
|
|
236
|
+
// conversation text. Set captureTrace to true to also write each attempt's
|
|
237
|
+
// prompt and raw reply to ~/.omms/traces/ for debugging. Traces can contain
|
|
238
|
+
// conversation content: <private> text and common API key formats are
|
|
239
|
+
// redacted, files are readable only by you, and they are deleted after
|
|
240
|
+
// captureTraceRetentionDays. Only this global file can turn tracing on.
|
|
241
|
+
// "captureTrace": false,
|
|
242
|
+
// "captureTraceRetentionDays": 7,
|
|
243
|
+
// "captureAttemptRetentionDays": 30,
|
|
244
|
+
|
|
245
|
+
// Capture retry queue: when a live capture fails because the model cannot be
|
|
246
|
+
// reached (network error, timeout, HTTP 408, 429 or 5xx), OMMS keeps a copy of
|
|
247
|
+
// the turn in ~/.omms/data and tries it again later. The copy has <private>
|
|
248
|
+
// text and common API key formats removed. Turns are deleted when the retry
|
|
249
|
+
// ends or after captureRetryRetentionHours (0 to 720). 0 turns the queue off.
|
|
250
|
+
// Only this global file can set it.
|
|
251
|
+
// "captureRetryRetentionHours": 72,
|
|
252
|
+
|
|
253
|
+
// Temperature for AI API requests (set to false to omit parameter for models that don't support it)
|
|
254
|
+
// Some reasoning models (like o1, o3, gpt-5) don't support temperature parameter
|
|
255
|
+
// Set to false and add "memoryTemperature": false in config when using such models
|
|
256
|
+
"memoryTemperature": 0.3,
|
|
257
|
+
|
|
258
|
+
// Extra parameters to include in API request body
|
|
259
|
+
// Useful for local inference servers (e.g. llama-server with --jinja) that support
|
|
260
|
+
// additional parameters like disabling thinking/reasoning mode
|
|
261
|
+
// Example for Qwen3 models: { "enable_thinking": false }
|
|
262
|
+
// "memoryExtraParams": {},
|
|
263
|
+
|
|
264
|
+
// Language for auto-capture summaries (default: "auto" for auto-detection)
|
|
265
|
+
// Options: "auto", "en", "id", "zh", "ja", "es", "fr", "de", "ru", "pt", "ar", "ko"
|
|
266
|
+
// "autoCaptureLanguage": "auto",
|
|
267
|
+
|
|
268
|
+
// ============================================
|
|
269
|
+
// Toast Notifications
|
|
270
|
+
// ============================================
|
|
271
|
+
|
|
272
|
+
// Show toast when memory is auto-captured
|
|
273
|
+
"showAutoCaptureToasts": true,
|
|
274
|
+
|
|
275
|
+
// Show toast when user profile is updated
|
|
276
|
+
"showUserProfileToasts": true,
|
|
277
|
+
|
|
278
|
+
// Show toast for error messages
|
|
279
|
+
"showErrorToasts": true,
|
|
280
|
+
|
|
281
|
+
// ============================================
|
|
282
|
+
// User Profile System
|
|
283
|
+
// ============================================
|
|
284
|
+
|
|
285
|
+
// Analyze user prompts every N prompts to build/update your user profile
|
|
286
|
+
// When N uncaptured prompts accumulate, AI will analyze them to identify:
|
|
287
|
+
// - User preferences (code style, communication style, tool preferences)
|
|
288
|
+
// - User patterns (recurring topics, problem domains, technical interests)
|
|
289
|
+
// - User workflows (development habits, sequences, learning style)
|
|
290
|
+
// - Skill level (overall and per-domain assessment)
|
|
291
|
+
"userProfileAnalysisInterval": 10,
|
|
292
|
+
|
|
293
|
+
// Days before inactive items (all types) are eligible for removal
|
|
294
|
+
"userProfileStaleDays": 2,
|
|
295
|
+
|
|
296
|
+
// Days before an inactive workflow is eligible for removal. A workflow seen
|
|
297
|
+
// userProfileMinEvidenceForRetention times or more is kept.
|
|
298
|
+
"userProfileWorkflowStaleDays": 30,
|
|
299
|
+
|
|
300
|
+
// Number of preferences shown in UI
|
|
301
|
+
"userProfileDisplayPreferences": 20,
|
|
302
|
+
|
|
303
|
+
// Number of patterns shown in UI
|
|
304
|
+
"userProfileDisplayPatterns": 15,
|
|
305
|
+
|
|
306
|
+
// Number of workflows shown in UI
|
|
307
|
+
"userProfileDisplayWorkflows": 10,
|
|
308
|
+
|
|
309
|
+
// Number of preferences injected into LLM conversation context
|
|
310
|
+
// Keep this small — the strongest signals are enough; more dilute LLM attention
|
|
311
|
+
"userProfileInjectPreferences": 5,
|
|
312
|
+
|
|
313
|
+
// Number of patterns injected into LLM conversation context
|
|
314
|
+
"userProfileInjectPatterns": 5,
|
|
315
|
+
|
|
316
|
+
// Number of workflows injected into LLM conversation context
|
|
317
|
+
"userProfileInjectWorkflows": 3,
|
|
318
|
+
|
|
319
|
+
// Days before preference confidence starts to decay (if not reinforced)
|
|
320
|
+
// Preferences that aren't seen again will gradually lose confidence and be removed
|
|
321
|
+
"userProfileConfidenceDecayDays": 30,
|
|
322
|
+
|
|
323
|
+
// Number of profile versions to keep in changelog (for rollback/debugging)
|
|
324
|
+
// Older versions are automatically cleaned up
|
|
325
|
+
"userProfileChangelogRetentionCount": 5,
|
|
326
|
+
|
|
327
|
+
// Minimum evidence count for a preference/pattern to survive confidence decay
|
|
328
|
+
// Items confirmed fewer times are more likely to be pruned when confidence decays
|
|
329
|
+
"userProfileMinEvidenceForRetention": 3,
|
|
330
|
+
|
|
331
|
+
// Merge duplicate or vague profile items every N analysed prompts (about 1 model call per 100 items)
|
|
332
|
+
"userProfileAutoCleanupEnabled": true,
|
|
333
|
+
"userProfileAutoCleanupInterval": 500,
|
|
334
|
+
|
|
335
|
+
// Enable LLM validation of existing preferences against recent behavior.
|
|
336
|
+
// When enabled, each analysis round checks if top-5 preferences still match recent prompts.
|
|
337
|
+
// Experimental — disabled by default.
|
|
338
|
+
"userProfileValidationEnabled": false,
|
|
339
|
+
|
|
340
|
+
// ============================================
|
|
341
|
+
// Search Settings
|
|
342
|
+
// ============================================
|
|
343
|
+
|
|
344
|
+
// Minimum similarity score (0-1) for memory search results. Leave unset to
|
|
345
|
+
// follow the default for your embedding model: 0.5 for qwen3-embedding:0.6b
|
|
346
|
+
// (the only model measured), 0.6 for every other embedder.
|
|
347
|
+
// "similarityThreshold": 0.5,
|
|
348
|
+
|
|
349
|
+
// Maximum number of memories to return in search results.
|
|
350
|
+
// Manual searches can ask for fewer; prompt retrieval uses this ceiling.
|
|
351
|
+
"maxMemories": 10,
|
|
352
|
+
|
|
353
|
+
// ============================================
|
|
354
|
+
// Memory Context Controls
|
|
355
|
+
// ============================================
|
|
356
|
+
|
|
357
|
+
// Recent memories added at fresh session start (OpenCode V1 and Claude Code).
|
|
358
|
+
// Pi and OpenCode V2 search the store with each prompt instead.
|
|
359
|
+
"chatMessage": {
|
|
360
|
+
"enabled": true,
|
|
361
|
+
// Recent memories injected at session start.
|
|
362
|
+
"maxMemories": 3,
|
|
363
|
+
"excludeCurrentSession": true,
|
|
364
|
+
// When to inject: "first" message of a session or "always".
|
|
365
|
+
// "injectOn": "first",
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
// OpenCode profile-learning input limit, in UTF-8 bytes. Smaller values can
|
|
369
|
+
// omit prompts from that input. Does not limit Pi or Claude Code profile input.
|
|
370
|
+
"userProfileMaxContextBytes": 32768,
|
|
371
|
+
|
|
372
|
+
// Shared budget for automatic memory context (profile text, memories, and
|
|
373
|
+
// formatting) across all hosts, in approximate tokens: ceil(UTF-8 bytes / 4).
|
|
374
|
+
// Covers prompt retrieval, recent-memory injection, and session-memory
|
|
375
|
+
// restoration. Not an exact provider token limit or a spending limit.
|
|
376
|
+
"retrievalMaxTokens": 2000,
|
|
377
|
+
|
|
378
|
+
// ============================================
|
|
379
|
+
// Advanced Settings
|
|
380
|
+
// ============================================
|
|
381
|
+
|
|
382
|
+
// Inject user profile into AI context (preferences, patterns, workflows)
|
|
383
|
+
"injectProfile": true
|
|
384
|
+
}
|
|
385
|
+
`;
|
package/dist/config.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ interface OmmsConfig {
|
|
|
14
14
|
embeddingUseTaskPrefixes?: boolean;
|
|
15
15
|
similarityThreshold?: number;
|
|
16
16
|
maxMemories?: number;
|
|
17
|
+
/** Opt-in reranker (global only): reorder search candidates with an external server. */
|
|
18
|
+
rerankerEnabled?: boolean;
|
|
19
|
+
rerankerApiUrl?: string;
|
|
20
|
+
rerankerModel?: string;
|
|
21
|
+
rerankerApiKey?: string;
|
|
22
|
+
rerankerTimeoutMs?: number;
|
|
17
23
|
/** Shared budget for automatic memory context in approximate tokens (ceil(UTF-8 bytes / 4)). */
|
|
18
24
|
retrievalMaxTokens?: number;
|
|
19
25
|
maxProfileItems?: number;
|
|
@@ -107,7 +113,8 @@ interface OmmsConfig {
|
|
|
107
113
|
injectOn?: "first" | "always";
|
|
108
114
|
};
|
|
109
115
|
}
|
|
110
|
-
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 embeddingApiUrl (OpenAI-compatible /embeddings); embeddingApiKey is optional.\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 (URL required; key only if the server needs one)\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 // Unresolved directories to hide on the Directory maps page. They stay unimported.\n // \"importIgnoredDirectories\": [\"/private/tmp/scratch\"],\n // Claude Code's folder, when it is not ~/.claude (like CLAUDE_CONFIG_DIR).\n // \"claudeConfigDir\": \"~/.claude-work\",\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 // Deprecated: imported once into the API token table, then no longer read.\n // Create API tokens on the Settings page (Keys and access) instead.\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 // Tries for one turn's capture, on Pi and OpenCode, 2 and 4 seconds apart. After the\n // last one fails, a turn the model could not reach goes to the capture retry queue.\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 // Capture retry queue: when a live capture fails because the model cannot be\n // reached (network error, timeout, HTTP 408, 429 or 5xx), OMMS keeps a copy of\n // the turn in ~/.omms/data and tries it again later. The copy has <private>\n // text and common API key formats removed. Turns are deleted when the retry\n // ends or after captureRetryRetentionHours (0 to 720). 0 turns the queue off.\n // Only this global file can set it.\n // \"captureRetryRetentionHours\": 72,\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 // Days before an inactive workflow is eligible for removal. A workflow seen\n // userProfileMinEvidenceForRetention times or more is kept.\n \"userProfileWorkflowStaleDays\": 30,\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 // Merge duplicate or vague profile items every N analysed prompts (about 1 model call per 100 items)\n \"userProfileAutoCleanupEnabled\": true,\n \"userProfileAutoCleanupInterval\": 500,\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 // Manual searches can ask for fewer; prompt retrieval uses this ceiling.\n \"maxMemories\": 10,\n\n // ============================================\n // Memory Context Controls\n // ============================================\n\n // Recent memories added at fresh session start (OpenCode V1 and Claude Code).\n // Pi and OpenCode V2 search the store with each prompt instead.\n \"chatMessage\": {\n \"enabled\": true,\n // Recent memories injected at session start.\n \"maxMemories\": 3,\n \"excludeCurrentSession\": true,\n // When to inject: \"first\" message of a session or \"always\".\n // \"injectOn\": \"first\",\n },\n\n // OpenCode profile-learning input limit, in UTF-8 bytes. Smaller values can\n // omit prompts from that input. Does not limit Pi or Claude Code profile input.\n \"userProfileMaxContextBytes\": 32768,\n\n // Shared budget for automatic memory context (profile text, memories, and\n // formatting) across all hosts, in approximate tokens: ceil(UTF-8 bytes / 4).\n // Covers prompt retrieval, recent-memory injection, and session-memory\n // restoration. Not an exact provider token limit or a spending limit.\n \"retrievalMaxTokens\": 2000,\n\n // ============================================\n // Advanced Settings\n // ============================================\n \n // Inject user profile into AI context (preferences, patterns, workflows)\n \"injectProfile\": true\n}\n";
|
|
116
|
+
import { CONFIG_TEMPLATE } from "./config-template.js";
|
|
117
|
+
export { CONFIG_TEMPLATE };
|
|
111
118
|
export declare function normalizeAutoCaptureMaxContextBytes(value: number): number;
|
|
112
119
|
/** Whole hours from 0 to 720. A value that is not a number gives the default. */
|
|
113
120
|
export declare function normalizeCaptureRetryRetentionHours(value: unknown): number;
|
|
@@ -122,6 +129,11 @@ declare function buildConfig(fileConfig: OmmsConfig): {
|
|
|
122
129
|
embeddingApiUrl: string | undefined;
|
|
123
130
|
embeddingApiKey: string | undefined;
|
|
124
131
|
similarityThreshold: number;
|
|
132
|
+
rerankerEnabled: boolean;
|
|
133
|
+
rerankerApiUrl: string | undefined;
|
|
134
|
+
rerankerModel: string | undefined;
|
|
135
|
+
rerankerApiKey: string | undefined;
|
|
136
|
+
rerankerTimeoutMs: number;
|
|
125
137
|
maxMemories: number;
|
|
126
138
|
retrievalMaxTokens: number;
|
|
127
139
|
maxProfileItems: number;
|
|
@@ -220,6 +232,11 @@ export declare let CONFIG: {
|
|
|
220
232
|
embeddingApiUrl: string | undefined;
|
|
221
233
|
embeddingApiKey: string | undefined;
|
|
222
234
|
similarityThreshold: number;
|
|
235
|
+
rerankerEnabled: boolean;
|
|
236
|
+
rerankerApiUrl: string | undefined;
|
|
237
|
+
rerankerModel: string | undefined;
|
|
238
|
+
rerankerApiKey: string | undefined;
|
|
239
|
+
rerankerTimeoutMs: number;
|
|
223
240
|
maxMemories: number;
|
|
224
241
|
retrievalMaxTokens: number;
|
|
225
242
|
maxProfileItems: number;
|