Overview
The Memory System stores:- Routing History: Every decision with outcomes and latency
- User Preferences: Learned model preferences per API key
- Provider Quirks: Known issues and workarounds
- Analytics: Performance trends and success rates
Quick Start
Initialize Memory System
Initialize the memory system before first use:Enable in Configuration
Add to yourconfig.yaml:
config.yaml
CLI Commands
The Memory System provides a comprehensive CLI for management:- Status
- History
- Preferences
- Export
- Reset
Check memory system health and disk usage:Example Output:
Directory Structure
The memory system creates the following structure:Routing Decision Schema
Each routing decision is stored in JSONL format:User Preferences
Preferences are learned automatically based on routing history:1
Model Preferences
Most frequently selected models for each intent category
2
Provider Bias
Relative preference scores based on success rates and user behavior
3
Custom Rules
Detected patterns like βalways use local models for security queriesβ
Configuration Options
Fine-tune memory system behavior inconfig.yaml:
config.yaml
Privacy Considerations
What is Stored
- Stored
- NOT Stored
- Hashed API keys (SHA-256)
- Model names and intents
- Routing tiers and confidence scores
- Latency and performance metrics
- Success/failure outcomes
Configuration for Privacy
config.yaml
Disk Usage Management
The memory system automatically manages disk usage:Automatic Cleanup
- Daily rotation: Logs are rotated daily and compressed
- Retention policy: Old data is deleted after configured retention period
- Size limits: Logs are rotated when they exceed max size
Manual Cleanup
Monitoring & Analytics
Statistics Query
Memory statistics are available via the management API:Weekly Reports
Whenweekly-reports: true, the system generates performance summaries:
analytics/weekly-summary.json
Troubleshooting
Memory system not initialized
Memory system not initialized
Error:
Memory system not initializedSolution:Permission denied on memory directory
Permission denied on memory directory
Error:
Permission denied: /Users/user/.switchailocal/memorySolution:Disk usage growing too fast
Disk usage growing too fast
Solutions:
-
Reduce retention period:
-
Enable compression:
-
Disable content storage:
Preferences not being learned
Preferences not being learned
Check:
-
Feedback collection is enabled:
- Sufficient history exists (minimum ~100 decisions)
- API key hash is consistent
Best Practices
1
Enable from Day One
Initialize memory system before production deployment to start learning immediately.
2
Regular Backups
Export memory data regularly:
3
Monitor Disk Usage
Check memory status weekly:
4
Set Appropriate Retention
Balance learning vs disk usage:
- Development: 30 days
- Production: 90 days
- Analytics: 180 days
5
Review Preferences Periodically
Check learned preferences to ensure they align with expectations:
Next Steps
Cortex Router
Learn about intelligent routing that uses memory data
Heartbeat Monitoring
Configure health checks and monitoring