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
| Setting | Type | Default | Description |
|---|---|---|---|
searchMode | string | "hybrid" | Default search mode: literal, semantic, or hybrid |
semanticSearchThreshold | number | 0.5 | Minimum similarity score for semantic results (0-1) |
defaultConfidence | number | 80 | Default confidence for new lores |
Environment Variables
All configuration can also be set via environment variables:
| Variable | Description | Default |
|---|---|---|
LOREHUB_DB | Database file location | ~/.lorehub/lorehub.db |
LOREHUB_SEARCH_MODE | Default search mode | hybrid |
Bash/Zsh
# Add to ~/.bashrc or ~/.zshrc
export LOREHUB_DB="$HOME/.lorehub/lorehub.db"
export LOREHUB_SEARCH_MODE="semantic"Search Configuration
Search Modes
-
Literal - Traditional substring matching
- Fast and precise
- Good for finding specific terms
- Case-insensitive
-
Semantic - AI-powered conceptual search
- Finds related concepts
- Uses embeddings for similarity
- Best for natural language queries
-
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 similarity1.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 directoryDatabase Schema
The SQLite database contains:
- realms - Tracked codebases
- lores - Knowledge entries
- lore_relations - Relationships between lores
- lores_vec - Embeddings for semantic search
- 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 lorehubAfter 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 --forceDatabase Optimization
SQLite is configured with:
- WAL mode for better concurrency
- Memory-mapped I/O for performance
- Full-text search indexes
Troubleshooting
Common Issues
-
Semantic search not working
# Generate missing embeddings lh migrate-embeddings -
Database locked errors
- Ensure only one LoreHub process is running
- Check file permissions:
ls -la ~/.lorehub/
-
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.backupRestore
# From export
lh import backup-20240115.json
# From database backup
cp ~/.lorehub/lorehub.db.backup ~/.lorehub/lorehub.dbBest Practices
- Search Mode: Start with hybrid mode and adjust based on your needs
- Confidence: Set
defaultConfidenceto match your team’s standards - Backups: Export regularly, especially before upgrades
- Embeddings: Regenerate after major version updates
- Threshold: Lower the semantic threshold if you’re missing relevant results