Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
CLAUDE_PLUGIN_ROOT | Set by Claude Code | Plugin installation directory |
CLAUDE_MEM_DATA_DIR | ~/.claude-mem/ | Data directory (production default) |
CLAUDE_CODE_PATH | Auto-detected | Path to Claude Code CLI (for Windows) |
CLAUDE_MEM_WORKER_PORT | 37777 | Worker service port |
CLAUDE_MEM_MODEL | claude-sonnet-4-5 | AI model for processing observations |
CLAUDE_MEM_CONTEXT_OBSERVATIONS | 50 | Number of observations to inject |
NODE_ENV | production | Environment mode |
FORCE_COLOR | 1 | Enable colored logs |
Model Configuration
Configure which AI model processes your observations.Available Models
claude-haiku-4-5- Fast, cost-efficientclaude-sonnet-4-5- Balanced (default)claude-opus-4- Most capableclaude-3-7-sonnet- Alternative version
Using the Interactive Script
CLAUDE_MEM_MODEL in ~/.claude/settings.json.
Manual Configuration
Edit~/.claude/settings.json:
Files and Directories
Data Directory Structure
The data directory location depends on the environment:- Production (installed plugin):
~/.claude-mem/(always, regardless of CLAUDE_PLUGIN_ROOT) - Development: Can be overridden with
CLAUDE_MEM_DATA_DIR
Plugin Directory Structure
Plugin Configuration
Hooks Configuration
Hooks are configured inplugin/hooks/hooks.json:
Search Configuration (v5.4.0+)
Migration Note: As of v5.4.0, Claude-Mem uses skill-based search instead of MCP tools. Previous (v5.3.x and earlier): MCP search server with 9 tools (~2,500 tokens per session) Current (v5.4.0+): Search skill with HTTP API (~250 tokens per session) No configuration required - the search skill is automatically available in Claude Code sessions. Search operations are now provided via:- Skill:
plugin/skills/search/SKILL.md(auto-invoked when users ask about past work) - HTTP API: 10 endpoints on worker service port 37777
- Progressive Disclosure: Full instructions loaded on-demand only when needed
PM2 Configuration
Worker service is managed by PM2 viaecosystem.config.cjs:
PM2 Settings
- instances: 1 (single instance)
- autorestart: true (auto-restart on crash)
- watch: false (no file watching)
- max_memory_restart: 1G (restart if memory exceeds 1GB)
Context Injection Configuration
CLAUDE_MEM_CONTEXT_OBSERVATIONS
Controls how many observations are injected into each new session for context continuity. Default: 50 observations What it does:- Fetches the most recent N observations from the database
- Injects them as context at SessionStart
- Allows Claude to maintain awareness of recent work across sessions
~/.claude/settings.json:
- Higher values = More context but slower SessionStart and more tokens used
- Lower values = Faster SessionStart but less historical awareness
- Default of 50 balances context richness with performance
Customization
Custom Data Directory
For development or testing, override the data directory:Custom Worker Port
If port 37777 is in use:Custom Model
Use a different AI model:Advanced Configuration
Hook Timeouts
Modify timeouts inplugin/hooks/hooks.json:
- SessionStart: 120s (needs time for smart install check and context retrieval)
- UserPromptSubmit: 60s
- PostToolUse: 120s (can process many observations)
- Stop: 60s
- SessionEnd: 60s
Worker Memory Limit
Modify PM2 memory limit inecosystem.config.cjs:
Logging Verbosity
Enable debug logging:Configuration Best Practices
- Use defaults: Default configuration works for most use cases
- Override selectively: Only change what you need
- Document changes: Keep track of custom configurations
- Test after changes: Verify worker restarts successfully
- Monitor logs: Check worker logs after configuration changes
Troubleshooting Configuration
Configuration Not Applied
-
Restart worker after changes:
-
Verify environment variables:
-
Check worker logs:
Invalid Model Name
If you specify an invalid model name, the worker will fall back toclaude-sonnet-4-5 and log a warning.
Valid models:
- claude-haiku-4-5
- claude-sonnet-4-5
- claude-opus-4
- claude-3-7-sonnet
Port Already in Use
If port 37777 is already in use:-
Set custom port:
-
Restart worker:
-
Verify new port:
Next Steps
- Architecture Overview - Understand the system
- Troubleshooting - Common issues
- Development - Building from source

