Skip to content

Configuration

Varun Pratap Bhardwaj edited this page Mar 16, 2026 · 1 revision

Configuration

Configuration options, environment variables, and performance tuning for SuperLocalMemory - Customize behavior, optimize performance, and adjust settings for your workflow.


Configuration Files

SuperLocalMemory uses multiple configuration files:

Global Configuration

Location: ~/.claude-memory/config.json

Purpose: System-wide settings affecting all profiles

Default:

{
  "version": "2.1.0",
  "default_profile": "default",
  "mcp_server_enabled": true,
  "shell_integration": true,
  "auto_build_graph": false,
  "pattern_learning_enabled": true,
  "telemetry": false
}

Profile Configuration

Location: ~/.claude-memory/profiles/<profile>/config.json

Purpose: Profile-specific settings

Default:

{
  "profile_name": "default",
  "description": "Default profile",
  "created_at": "2026-02-07T14:23:00",
  "settings": {
    "default_importance": 5,
    "auto_build_graph": false,
    "pattern_learning_threshold": 0.5,
    "search_min_score": 0.3,
    "compression_enabled": false
  }
}

MCP Server Configuration

Location: IDE-specific (see Quick Start Tutorial)

  • Cursor: ~/.cursor/mcp_settings.json
  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windsurf: ~/.windsurf/mcp_settings.json

Format:

{
  "mcpServers": {
    "superlocalmemory-v2": {
      "command": "python3",
      "args": ["/Users/username/.claude-memory/mcp_server.py"],
      "cwd": "/Users/username/.claude-memory",
      "env": {
        "PYTHONPATH": "/Users/username/.claude-memory"
      },
      "description": "SuperLocalMemory"
    }
  }
}

Environment Variables

Core Variables

SLM_PROFILE

Description: Override default profile

Usage:

export SLM_PROFILE=work
slm status  # Uses work profile

# Temporary override
SLM_PROFILE=personal slm recall "query"

SLM_DB_PATH

Description: Custom database location

Usage:

export SLM_DB_PATH=/custom/path/memory.db
slm remember "test"  # Saves to custom location

SLM_CONFIG_PATH

Description: Custom config file location

Usage:

export SLM_CONFIG_PATH=/custom/config.json

PYTHONPATH

Description: Python module search path (required for MCP server)

Usage:

export PYTHONPATH=$HOME/.claude-memory:$PYTHONPATH

Performance Variables

SLM_CACHE_SIZE

Description: In-memory cache size (MB)

Default: 50

Usage:

export SLM_CACHE_SIZE=100  # 100MB cache

SLM_MAX_WORKERS

Description: Parallel processing threads

Default: 4

Usage:

export SLM_MAX_WORKERS=8  # 8 threads for graph building

SLM_GRAPH_CHUNK_SIZE

Description: Memories per graph build chunk

Default: 1000

Usage:

export SLM_GRAPH_CHUNK_SIZE=500  # Smaller chunks = less memory usage

Debug Variables

SLM_DEBUG

Description: Enable debug logging

Usage:

export SLM_DEBUG=1
slm recall "query"  # Shows debug output

SLM_LOG_LEVEL

Description: Logging level

Values: DEBUG, INFO, WARNING, ERROR

Usage:

export SLM_LOG_LEVEL=DEBUG

SLM_LOG_FILE

Description: Log file location

Usage:

export SLM_LOG_FILE=/tmp/slm-debug.log

Configuration Options

Memory Settings

default_importance

Description: Default importance for new memories

Type: Integer (1-10)

Default: 5

Usage:

{
  "settings": {
    "default_importance": 7
  }
}

max_content_size

Description: Maximum memory content size (bytes)

Type: Integer

Default: 1048576 (1MB)

Usage:

{
  "settings": {
    "max_content_size": 2097152
  }
}

max_tags

Description: Maximum tags per memory

Type: Integer

Default: 50

Usage:

{
  "settings": {
    "max_tags": 20
  }
}

Search Settings

search_min_score

Description: Minimum relevance score for search results

Type: Float (0.0-1.0)

Default: 0.3

Usage:

{
  "settings": {
    "search_min_score": 0.5
  }
}

search_default_limit

Description: Default number of search results

Type: Integer

Default: 10

Usage:

{
  "settings": {
    "search_default_limit": 20
  }
}

search_methods

Description: Enabled search methods

Type: List of strings

Default: ["semantic", "fts", "graph"]

Usage:

{
  "settings": {
    "search_methods": ["semantic", "fts"]
  }
}

Graph Settings

auto_build_graph

Description: Automatically rebuild graph after N new memories

Type: Integer (0 = disabled)

Default: 0

Usage:

{
  "settings": {
    "auto_build_graph": 50
  }
}

graph_min_similarity

Description: Minimum similarity for graph edges

Type: Float (0.0-1.0)

Default: 0.3

Usage:

{
  "settings": {
    "graph_min_similarity": 0.4
  }
}

graph_max_edges_per_node

Description: Maximum edges per graph node

Type: Integer

Default: 50

Usage:

{
  "settings": {
    "graph_max_edges_per_node": 30
  }
}

clustering_enabled

Description: Enable Leiden clustering by default

Type: Boolean

Default: false

Usage:

{
  "settings": {
    "clustering_enabled": true
  }
}

clustering_resolution

Description: Leiden algorithm resolution parameter

Type: Float

Default: 1.0

Usage:

{
  "settings": {
    "clustering_resolution": 1.5
  }
}

Pattern Learning Settings

pattern_learning_enabled

Description: Enable pattern learning

Type: Boolean

Default: true

Usage:

{
  "settings": {
    "pattern_learning_enabled": true
  }
}

pattern_learning_threshold

Description: Minimum confidence threshold for patterns

Type: Float (0.0-1.0)

Default: 0.5

Usage:

{
  "settings": {
    "pattern_learning_threshold": 0.6
  }
}

pattern_min_frequency

Description: Minimum frequency to consider a pattern

Type: Integer

Default: 3

Usage:

{
  "settings": {
    "pattern_min_frequency": 5
  }
}

Compression Settings

compression_enabled

Description: Enable progressive compression (planned v2.2.0)

Type: Boolean

Default: false

Usage:

{
  "settings": {
    "compression_enabled": true
  }
}

compression_age_threshold_days

Description: Days before compression eligible

Type: Integer

Default: 90

Usage:

{
  "settings": {
    "compression_age_threshold_days": 180
  }
}

Performance Tuning

Optimize for Speed

For fast search (<100ms):

{
  "settings": {
    "search_min_score": 0.5,
    "search_methods": ["fts", "semantic"],
    "graph_max_edges_per_node": 20
  }
}

Environment:

export SLM_CACHE_SIZE=100
export SLM_MAX_WORKERS=8

Optimize for Memory Usage

For low memory systems (<4GB RAM):

{
  "settings": {
    "graph_max_edges_per_node": 10,
    "clustering_enabled": false
  }
}

Environment:

export SLM_CACHE_SIZE=10
export SLM_MAX_WORKERS=2
export SLM_GRAPH_CHUNK_SIZE=500

Optimize for Quality

For best search quality:

{
  "settings": {
    "search_min_score": 0.3,
    "search_methods": ["semantic", "fts", "graph"],
    "graph_min_similarity": 0.2,
    "clustering_enabled": true,
    "pattern_learning_threshold": 0.4
  }
}

Build graph regularly:

# Cron job: daily at 3 AM
0 3 * * * slm build-graph --clustering

Optimize for Large Databases (10K+ memories)

{
  "settings": {
    "auto_build_graph": 0,
    "graph_min_similarity": 0.4,
    "graph_max_edges_per_node": 30,
    "search_default_limit": 20
  }
}

Environment:

export SLM_CACHE_SIZE=200
export SLM_MAX_WORKERS=8
export SLM_GRAPH_CHUNK_SIZE=2000

Database Tuning

SQLite Optimization

Pragmas (applied automatically):

PRAGMA journal_mode = WAL;           -- Write-Ahead Logging
PRAGMA synchronous = NORMAL;         -- Balance safety/speed
PRAGMA cache_size = -64000;          -- 64MB cache
PRAGMA temp_store = MEMORY;          -- In-memory temp tables
PRAGMA mmap_size = 268435456;        -- 256MB memory-mapped I/O

Vacuum Database

Reclaim space after deletions:

sqlite3 ~/.claude-memory/memory.db "VACUUM;"

Analyze statistics:

sqlite3 ~/.claude-memory/memory.db "ANALYZE;"

Rebuild Indexes

sqlite3 ~/.claude-memory/memory.db "REINDEX;"

IDE-Specific Settings

Cursor

Config: ~/.cursor/mcp_settings.json

Recommendations:

{
  "mcpServers": {
    "superlocalmemory-v2": {
      "command": "/opt/homebrew/bin/python3",
      "args": ["/Users/username/.claude-memory/mcp_server.py"],
      "cwd": "/Users/username/.claude-memory",
      "env": {
        "PYTHONPATH": "/Users/username/.claude-memory",
        "SLM_LOG_LEVEL": "ERROR"
      }
    }
  }
}

Claude Desktop

Config: ~/Library/Application Support/Claude/claude_desktop_config.json

Recommendations:

{
  "mcpServers": {
    "superlocalmemory-v2": {
      "command": "python3",
      "args": ["/Users/username/.claude-memory/mcp_server.py"],
      "cwd": "/Users/username/.claude-memory",
      "env": {
        "PYTHONPATH": "/Users/username/.claude-memory"
      }
    }
  }
}

VS Code (Continue.dev)

Config: Command Palette → "MCP: Open User Configuration"

Recommendations:

{
  "servers": {
    "superlocalmemory-v2": {
      "type": "stdio",
      "command": "python3",
      "args": ["/Users/username/.claude-memory/mcp_server.py"]
    }
  }
}

Shell Integration

Bash Configuration

Add to ~/.bashrc:

# SuperLocalMemory
export PATH="$HOME/.claude-memory/bin:$PATH"
export PYTHONPATH="$HOME/.claude-memory:$PYTHONPATH"

# Default profile
export SLM_PROFILE=default

# Performance tuning
export SLM_CACHE_SIZE=100

# Auto-complete
source ~/.claude-memory/completions/slm.bash

# Profile prompt
slm_prompt() {
  echo "SLM: $(slm status | grep 'Current Profile' | cut -d: -f2)"
}
export PS1="\$(slm_prompt) $PS1"

Zsh Configuration

Add to ~/.zshrc:

# SuperLocalMemory
export PATH="$HOME/.claude-memory/bin:$PATH"
export PYTHONPATH="$HOME/.claude-memory:$PYTHONPATH"

# Auto-complete
source ~/.claude-memory/completions/slm.zsh

# Profile switching by directory
autoload -Uz add-zsh-hook
profile_switch() {
  case $PWD in
    */work/*) export SLM_PROFILE=work ;;
    */personal/*) export SLM_PROFILE=personal ;;
    *) export SLM_PROFILE=default ;;
  esac
}
add-zsh-hook chpwd profile_switch

Backup Configuration

Automated Backups

Daily backup script:

#!/bin/bash
# Save as: ~/bin/slm-backup.sh

BACKUP_DIR=~/backups/slm-$(date +%Y%m%d)
mkdir -p "$BACKUP_DIR"

# Backup all profiles
cp -r ~/.claude-memory/profiles/ "$BACKUP_DIR/"

# Backup config
cp ~/.claude-memory/config.json "$BACKUP_DIR/"

# Compress
tar czf "$BACKUP_DIR.tar.gz" -C ~/backups "$(basename $BACKUP_DIR)"
rm -rf "$BACKUP_DIR"

# Keep last 7 days
find ~/backups/ -name "slm-*.tar.gz" -mtime +7 -delete

Cron job:

# Daily at 2 AM
0 2 * * * ~/bin/slm-backup.sh

Restore from Backup

# Extract backup
tar xzf ~/backups/slm-20260207.tar.gz -C ~/backups/

# Restore profiles
cp -r ~/backups/slm-20260207/profiles/* ~/.claude-memory/profiles/

# Restore config
cp ~/backups/slm-20260207/config.json ~/.claude-memory/

# Rebuild graphs
slm build-graph --force

Security Configuration

File Permissions

Recommended permissions:

# Directory
chmod 700 ~/.claude-memory/

# Databases
chmod 600 ~/.claude-memory/profiles/*/memory.db

# Scripts
chmod 700 ~/.claude-memory/*.py

# Config
chmod 600 ~/.claude-memory/config.json

Network Security

MCP server binds to localhost only:

# In mcp_server.py
server = Server(host="127.0.0.1", port=0)  # Localhost only

No external connections:

  • Zero API calls
  • No telemetry
  • No cloud sync

Troubleshooting

"Config file not found"

Solution:

# Recreate default config
cd ~/path/to/SuperLocalMemoryV2
./install.sh

"Invalid JSON in config"

Solution:

# Validate JSON
python3 -m json.tool ~/.claude-memory/config.json

# Fix syntax errors or restore from backup
cp ~/.claude-memory/config.json.backup ~/.claude-memory/config.json

"Environment variable not working"

Solution:

# Verify variable is set
echo $SLM_PROFILE

# Restart shell
exec $SHELL

# Or source config
source ~/.bashrc  # or ~/.zshrc

Related Pages


Created by Varun Pratap Bhardwaj Solution Architect • SuperLocalMemory

GitHubIssuesWiki

Clone this wiki locally