-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopencode-mem.jsonc
More file actions
307 lines (238 loc) · 12.8 KB
/
Copy pathopencode-mem.jsonc
File metadata and controls
307 lines (238 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
{
// ============================================
// OpenCode Memory Plugin Configuration
// ============================================
// Storage location for vector database
"storagePath": "~/.opencode-mem/data",
"userEmailOverride": "",
"userNameOverride": "",
// ============================================
// Embedding Model (for similarity search)
// ============================================
// Local = Hugging Face / ONNX via @huggingface/transformers (not Apple MLX).
// Remote = set BOTH embeddingApiUrl and embeddingApiKey (OpenAI-compatible /embeddings).
// Default: Nomic Embed v1 (768 dimensions, 8192 context, multilingual)
"embeddingModel": "Xenova/nomic-embed-text-v1",
// Opt-in Nomic task prefixes (search_document: / search_query:). After enabling,
// re-index existing memories so store and query vectors stay aligned.
// "embeddingUseTaskPrefixes": true,
// Auto-detected dimensions (no need to set manually)
// "embeddingDimensions": 768,
// Other recommended local models:
// "embeddingModel": "Xenova/jina-embeddings-v2-base-en", // 768 dims, English-only, 8192 context
// "embeddingModel": "Xenova/jina-embeddings-v2-small-en", // 512 dims, faster, 8192 context
// "embeddingModel": "Xenova/all-MiniLM-L6-v2", // 384 dims, very fast, 512 context
// "embeddingModel": "Xenova/all-mpnet-base-v2", // 768 dims, good quality, 512 context
// Optional: OpenAI-compatible API for embeddings (both URL and key required)
// "embeddingApiUrl": "https://api.openai.com/v1",
// "embeddingApiKey": "env://OPENAI_API_KEY", // or "sk-..." / "file:///path/to/key"
// "embeddingModel": "text-embedding-3-small", // 1536 dims, auto-detected
// ============================================
// Web Server Settings
// ============================================
// Enable web UI for managing memories (accessible at http://localhost:4747)
"webServerEnabled": true,
// Port for web UI server
"webServerPort": 4747,
// Host address for web UI (use 127.0.0.1 for local only, 0.0.0.0 for network access)
"webServerHost": "127.0.0.1",
// Optional HTTP Basic Auth for the web UI. Accepts literal, env://, or file:// secrets.
// "webServerAuthPassword": "",
// "webServerAuthUsername": "",
// Required when webServerHost is not loopback. Protects /api/* with Bearer / X-Opencode-Mem-Token.
// "webServerApiToken": "env://OPENCODE_MEM_WEB_TOKEN",
// ============================================
// Database Settings
// ============================================
// Maximum vectors per database shard (auto-creates new shard when limit reached)
"maxVectorsPerShard": 50000,
// Automatically delete old memories based on retention period
"autoCleanupEnabled": true,
// Days to keep memories before auto-cleanup (only if autoCleanupEnabled is true)
"autoCleanupRetentionDays": 30,
// Automatically detect and remove duplicate memories
"deduplicationEnabled": true,
// Similarity threshold (0-1) for detecting duplicates (higher = stricter)
"deduplicationSimilarityThreshold": 0.90,
// ============================================
// Memory Scope Settings
// ============================================
// Default scope for memory list/search queries
// "project" keeps queries within the current project, "all-projects" searches across all project shards
"memory": {
"defaultScope": "project"
},
// ============================================
// OpenCode Provider Settings (RECOMMENDED)
// ============================================
// Use any provider that is already authenticated in opencode for auto-capture
// and user profile learning. The plugin calls opencode's session.prompt API
// (with structured output) instead of talking to provider HTTPS endpoints
// directly, so opencode owns the auth, token refresh, and provider routing.
//
// No separate API key is needed in this plugin — whatever you configured in
// opencode (OAuth like Claude Pro/Max, GitHub Copilot personal/business,
// bring-your-own API key, custom provider, ...) just works.
//
// If NOT set, falls back to the manual config (memoryApiKey/memoryApiUrl/memoryModel below).
//
// Examples (the provider name must be one returned by 'opencode providers list'):
// Anthropic (OAuth/API key): "opencodeProvider": "anthropic", "opencodeModel": "claude-haiku-4-5-20251001"
// OpenAI (API key): "opencodeProvider": "openai", "opencodeModel": "gpt-4o-mini"
// GitHub Copilot: "opencodeProvider": "github-copilot", "opencodeModel": "gpt-4o-mini"
//
// "opencodeProvider": "anthropic",
// "opencodeModel": "claude-haiku-4-5-20251001",
// ============================================
// Auto-Capture Settings
// ============================================
// IMPORTANT: Auto-capture only runs after either opencodeProvider/opencodeModel
// above is configured, or the manual fallback below is uncommented with real values.
// It runs in background without blocking your main session
// Note: Ollama may not support tool calling. Use OpenAI, Anthropic, or Groq for best results.
"autoCaptureEnabled": true,
// Provider type: "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter"
// Note: "openai-chat" is a generic OpenAI API-compatible mode.
// Any service that follows the OpenAI Chat Completions API can use it via custom "memoryApiUrl".
"memoryProvider": "openai-chat",
// Manual fallback. Uncomment all 3 lines and replace memoryApiKey before use:
// "memoryModel": "gpt-4o-mini",
// "memoryApiUrl": "https://api.openai.com/v1",
// "memoryApiKey": "sk-...",
// API Key Formats:
// Direct value: "sk-..."
// From file: "file://~/.config/litellm-key.txt"
// From env variable: "env://LITELLM_API_KEY"
// Examples for different providers:
// Any OpenAI-compatible endpoint can use the "openai-chat" provider pattern below.
// Common examples: DeepSeek, Qwen (via Alibaba Cloud ModelStudio),
// Zhipu GLM (BigModel platform), and Kimi (Moonshot AI platform).
// OpenAI Chat Completion (default, backward compatible):
// "memoryProvider": "openai-chat"
// "memoryModel": "gpt-4o-mini"
// "memoryApiUrl": "https://api.openai.com/v1"
// "memoryApiKey": "sk-..."
// DeepSeek (OpenAI-compatible example):
// "memoryProvider": "openai-chat"
// "memoryModel": "deepseek-chat"
// "memoryApiUrl": "https://api.deepseek.com/v1"
// "memoryApiKey": "sk-..."
// OpenAI Responses API (recommended, with session support):
// "memoryProvider": "openai-responses"
// "memoryModel": "gpt-4o"
// "memoryApiUrl": "https://api.openai.com/v1"
// "memoryApiKey": "sk-..."
// Anthropic (with session support):
// "memoryProvider": "anthropic"
// "memoryModel": "claude-3-5-haiku-20241022"
// "memoryApiUrl": "https://api.anthropic.com/v1"
// "memoryApiKey": "sk-ant-..."
// MiniMax (Anthropic Messages-compatible endpoint, with session support):
// "memoryProvider": "minimax"
// "memoryModel": "MiniMax-M3"
// "memoryApiUrl": "https://api.minimax.io" // global endpoint
// "memoryApiKey": "<MiniMax API key>"
// // China endpoint: "memoryApiUrl": "https://api.minimaxi.com"
// // Optional adaptive thinking for MiniMax-M3:
// "memoryExtraParams": { "thinking": { "type": "adaptive" } }
// OrcaRouter (OpenAI-compatible gateway, namespaced model IDs, with session support):
// "memoryProvider": "orcarouter"
// "memoryApiKey": "<OrcaRouter API key>"
// // memoryApiUrl and memoryModel are optional — they default to
// // https://api.orcarouter.ai/v1 and "orcarouter/auto" (a routing alias).
// // OrcaRouter rejects bare model names, so if you set memoryModel, use a
// // namespaced ID such as "openai/gpt-5.5" or "deepseek/deepseek-v4-flash".
// "memoryModel": "openai/gpt-5.5"
// Groq (OpenAI-compatible, use openai-chat provider):
// "memoryProvider": "openai-chat"
// "memoryModel": "llama-3.3-70b-versatile"
// "memoryApiUrl": "https://api.groq.com/openai/v1"
// "memoryApiKey": "gsk_..."
// Maximum iterations for multi-turn AI analysis (for openai-responses, anthropic, and minimax)
"autoCaptureMaxIterations": 5,
// Timeout per iteration in milliseconds (30 seconds default)
"autoCaptureIterationTimeout": 30000,
// Maximum number of times to retry capturing a prompt if it fails (due to network, API errors, etc.)
"autoCaptureMaxRetries": 3,
// Maximum UTF-8 bytes for the auto-capture markdown context sent to the summary model.
// Prevents HTTP 400 context overflows on models with ~131K token windows (e.g. Groq Llama).
// Rough guide: tokens ≈ bytes / 4 for mixed code/prose.
"autoCaptureMaxContextBytes": 131072,
// Days to keep AI session history before cleanup
"aiSessionRetentionDays": 7,
// Temperature for AI API requests (set to false to omit parameter for models that don't support it)
// Some reasoning models (like o1, o3, gpt-5) don't support temperature parameter
// Set to false and add "memoryTemperature": false in config when using such models
"memoryTemperature": 0.3,
// Extra parameters to include in API request body
// Useful for local inference servers (e.g. llama-server with --jinja) that support
// additional parameters like disabling thinking/reasoning mode
// Example for Qwen3 models: { "enable_thinking": false }
// "memoryExtraParams": {},
// Language for auto-capture summaries (default: "auto" for auto-detection)
// Options: "auto", "en", "id", "zh", "ja", "es", "fr", "de", "ru", "pt", "ar", "ko"
// "autoCaptureLanguage": "auto",
// ============================================
// Toast Notifications
// ============================================
// Show toast when memory is auto-captured
"showAutoCaptureToasts": true,
// Show toast when user profile is updated
"showUserProfileToasts": true,
// Show toast for error messages
"showErrorToasts": true,
// ============================================
// User Profile System
// ============================================
// Analyze user prompts every N prompts to build/update your user profile
// When N uncaptured prompts accumulate, AI will analyze them to identify:
// - User preferences (code style, communication style, tool preferences)
// - User patterns (recurring topics, problem domains, technical interests)
// - User workflows (development habits, sequences, learning style)
// - Skill level (overall and per-domain assessment)
"userProfileAnalysisInterval": 10,
// Days before inactive items (all types) are eligible for removal
"userProfileStaleDays": 2,
// Number of preferences shown in UI
"userProfileDisplayPreferences": 20,
// Number of patterns shown in UI
"userProfileDisplayPatterns": 15,
// Number of workflows shown in UI
"userProfileDisplayWorkflows": 10,
// Number of preferences injected into LLM conversation context
// Keep this small — the strongest signals are enough; more dilute LLM attention
"userProfileInjectPreferences": 5,
// Number of patterns injected into LLM conversation context
"userProfileInjectPatterns": 5,
// Number of workflows injected into LLM conversation context
"userProfileInjectWorkflows": 3,
// Days before preference confidence starts to decay (if not reinforced)
// Preferences that aren't seen again will gradually lose confidence and be removed
"userProfileConfidenceDecayDays": 30,
// Number of profile versions to keep in changelog (for rollback/debugging)
// Older versions are automatically cleaned up
"userProfileChangelogRetentionCount": 5,
// Minimum evidence count for a preference/pattern to survive confidence decay
// Items confirmed fewer times are more likely to be pruned when confidence decays
"userProfileMinEvidenceForRetention": 3,
// Periodically merge duplicate or irrelevant profile items with the configured AI provider
"userProfileAutoCleanupEnabled": true,
// Number of analyzed user prompts between automatic AI cleanup runs
"userProfileAutoCleanupInterval": 100,
// Enable LLM validation of existing preferences against recent behavior.
// When enabled, each analysis round checks if top-5 preferences still match recent prompts.
// Experimental — disabled by default.
"userProfileValidationEnabled": false,
// ============================================
// Search Settings
// ============================================
// Minimum similarity score (0-1) for memory search results
"similarityThreshold": 0.6,
// Maximum number of memories to return in search results
"maxMemories": 10,
// ============================================
// Advanced Settings
// ============================================
// Inject user profile into AI context (preferences, patterns, workflows)
"injectProfile": true
}