{
// ============================================
// OpenCode Memory Plugin Configuration
// ============================================
// Storage location for vector database
"storagePath": "~/.opencode-mem/data",
"userEmailOverride": "",
"userNameOverride": "",
// ============================================
// Embedding Model (for similarity search)
// ============================================
// Default: Nomic Embed v1 (768 dimensions, 8192 context, multilingual)
"embeddingModel": "Xenova/nomic-embed-text-v1",
// Auto-detected dimensions (no need to set manually)
// "embeddingDimensions": 768,
// Other recommended 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: Use OpenAI-compatible API for embeddings
// "embeddingApiUrl": "https://api.openai.com/v1",
// "embeddingApiKey": "sk-...",
// "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",
// HTTP Basic Auth for the web UI (recommended whenever webServerHost != 127.0.0.1).
// Leave webServerAuthPassword unset to keep the UI open (the previous default).
// When set, the server demands HTTP Basic Auth credentials on every request.
// The browser's native Basic Auth dialog handles the prompt; closing the
// browser discards the cached credentials, so reopening requires signing in again.
// Accepts the same secret formats as memoryApiKey:
// "literal-value" direct plaintext
// "env://SOME_ENV_VAR" resolved from an environment variable
// "file:///path/to/secret" read from a file (chmod 600 recommended)
// "webServerAuthPassword": "",
// "webServerAuthUsername": "",
// ============================================
// 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": "opencode",
"opencodeModel": "inherit",
// ============================================
// 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"
// 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-..."
// 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 and anthropic)
"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,
// 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,
// 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
}
|