Skip to Content
LoreHub is now in open beta! 🎉
DocsConfiguration

Configuration

LoreHub can be configured through environment variables and a configuration file.

Configuration File

Location: ~/.lorehub/config.json

{ "searchMode": "hybrid", "semanticSearchThreshold": 0.5, "defaultConfidence": 80 }

Available Settings

SettingTypeDefaultDescription
searchModestring"hybrid"Default search mode: literal, semantic, or hybrid
semanticSearchThresholdnumber0.5Minimum similarity score for semantic results (0-1)
defaultConfidencenumber80Default confidence for new lores

Environment Variables

All configuration can also be set via environment variables:

VariableDescriptionDefault
LOREHUB_DBDatabase file location~/.lorehub/lorehub.db
LOREHUB_SEARCH_MODEDefault search modehybrid
# Add to ~/.bashrc or ~/.zshrc export LOREHUB_DB="$HOME/.lorehub/lorehub.db" export LOREHUB_SEARCH_MODE="semantic"

Search Configuration

Search Modes

  1. Literal - Traditional substring matching

    • Fast and precise
    • Good for finding specific terms
    • Case-insensitive
  2. Semantic - AI-powered conceptual search

    • Finds related concepts
    • Uses embeddings for similarity
    • Best for natural language queries
  3. Hybrid - Combined approach (default)

    • 30% weight on literal matches
    • 70% weight on semantic similarity
    • Best overall results

Semantic Search Threshold

The semanticSearchThreshold controls how similar a lore must be to appear in semantic search results:

  • 0.0 - Show all results (not recommended)
  • 0.5 - Moderate similarity (default)
  • 0.7 - High similarity
  • 1.0 - Exact matches only

File Locations

LoreHub stores all data locally:

~/.lorehub/ ├── lorehub.db # SQLite database with all lores ├── config.json # User configuration └── exports/ # Export directory

Database Schema

The SQLite database contains:

  1. realms - Tracked codebases
  2. lores - Knowledge entries
  3. lore_relations - Relationships between lores
  4. lores_vec - Embeddings for semantic search
  5. change_log - Change tracking for sync

MCP Server Configuration

When using LoreHub with AI assistants like Claude Desktop, configure the MCP server:

Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{ "mcpServers": { "lorehub": { "command": "node", "args": ["/path/to/global/node_modules/lorehub/dist/mcp/index.js"] } } }

To find the correct path:

npm list -g lorehub

After updating Claude Desktop configuration, restart the application for changes to take effect.

Performance Tuning

Embeddings

LoreHub uses the all-MiniLM-L6-v2 model for semantic search embeddings. This provides a good balance of:

  • Size: ~80MB model
  • Speed: Fast inference
  • Quality: Good semantic understanding

To regenerate embeddings after changes:

lh migrate-embeddings --force

Database Optimization

SQLite is configured with:

  • WAL mode for better concurrency
  • Memory-mapped I/O for performance
  • Full-text search indexes

Troubleshooting

Common Issues

  1. Semantic search not working

    # Generate missing embeddings lh migrate-embeddings
  2. Database locked errors

    • Ensure only one LoreHub process is running
    • Check file permissions: ls -la ~/.lorehub/
  3. MCP connection issues

    • Verify the path in Claude Desktop config
    • Check that LoreHub is installed globally
    • Restart Claude Desktop

Debug Mode

Enable debug logging by setting:

export DEBUG=lorehub:*

This will show detailed logs for troubleshooting.

Backup and Restore

Backup

Regular backups are recommended:

# Export all lores lh export --output backup-$(date +%Y%m%d).json # Or backup the entire database cp ~/.lorehub/lorehub.db ~/.lorehub/lorehub.db.backup

Restore

# From export lh import backup-20240115.json # From database backup cp ~/.lorehub/lorehub.db.backup ~/.lorehub/lorehub.db

Best Practices

  1. Search Mode: Start with hybrid mode and adjust based on your needs
  2. Confidence: Set defaultConfidence to match your team’s standards
  3. Backups: Export regularly, especially before upgrades
  4. Embeddings: Regenerate after major version updates
  5. Threshold: Lower the semantic threshold if you’re missing relevant results
Last updated on