Skip to main content

Overview

The memory system stores routing decisions, learns user preferences, and provides analytics for intelligent model selection. All data is stored locally with optional compression.

Commands

init

Initialize the memory system and create required directory structure.
Output:
Run this command once before using other memory features. The server will also auto-initialize on first use.

status

Show memory system health, disk usage, and statistics.
Output:

history

View recent routing decisions with detailed outcome information.
integer
default:"100"
Maximum number of routing decisions to display.
string
Filter decisions by API key hash (specific user).
Output:

preferences

View learned user preferences for model selection.
string
API key to look up preferences. The key is hashed internally for security.
string
Pre-computed API key hash (SHA-256 format).
Either --api-key or --api-key-hash is required.
Output:
Preferences are learned automatically based on routing history. Higher confidence and success rates strengthen preferences.

reset

Permanently delete all memory data. Creates automatic backup before reset.
boolean
required
Confirmation flag required to prevent accidental data loss.
Without --confirm:
With --confirm:
This operation cannot be undone. All routing history, preferences, and analytics will be permanently deleted.

export

Create a compressed backup of all memory data.
string
Output filename for the backup archive. Defaults to switchailocal-memory-YYYYMMDD-HHMMSS.tar.gz.
Output:
Restore from backup:

Configuration

Memory settings are configured in config.yaml:
boolean
default:"true"
Enable or disable the memory system.
integer
default:"90"
Number of days to keep routing history before automatic cleanup.
integer
default:"100"
Maximum size of log files before rotation (MB).
boolean
default:"true"
Enable gzip compression for daily logs.
string
default:"~/.switchailocal/memory"
Base directory for all memory data.

Data Structure

The memory system organizes data as follows:

Troubleshooting

Check current disk usage:
Reduce retention period in config:
Ensure write permissions: