Skip to content

lore db

Commands for managing the Lore database: statistics, cleanup, and maintenance.

CommandDescription
lore db statsShow database statistics
lore db vacuumReclaim unused disk space
lore db pruneDelete old sessions
Terminal window
lore db stats
Database Statistics
Sessions: 142
Messages: 8934
Links: 67
File size: 12.45 MB
Date Range
Oldest: 2024-06-15 09:23
Newest: 2025-01-02 14:56
Sessions by Tool
claude-code: 98
aider: 31
gemini: 13

SQLite databases can accumulate unused space after deletions. Vacuum reclaims this space:

Terminal window
lore db vacuum
Vacuuming database...
Before: 15.23 MB
After: 12.45 MB
Reclaimed: 2.78 MB

Run vacuum after bulk deletions or prunes.

Delete sessions older than a specified duration:

Terminal window
# Preview what would be deleted
lore db prune --older-than 90d --dry-run
# Delete sessions older than 90 days
lore db prune --older-than 90d
# Skip confirmation prompt
lore db prune --older-than 90d --force
FormatExampleMeaning
Nd90d90 days
Nw12w12 weeks
Nm6m6 months
Ny1y1 year
Terminal window
$ lore db prune --older-than 6m --dry-run
Sessions older than 6 months:
ID STARTED MESSAGES TOOL DIRECTORY
a1b2c3d4 2024-06-15 09:23 234 claude-code myapp
e5f6g7h8 2024-06-20 14:30 567 aider backend
i9j0k1l2 2024-07-01 10:15 89 gemini frontend
Would delete 3 sessions (890 messages)
Run without --dry-run to delete these sessions.
Terminal window
$ lore db prune --older-than 6m
Sessions older than 6 months:
ID STARTED MESSAGES TOOL DIRECTORY
a1b2c3d4 2024-06-15 09:23 234 claude-code myapp
e5f6g7h8 2024-06-20 14:30 567 aider backend
i9j0k1l2 2024-07-01 10:15 89 gemini frontend
Delete 3 sessions (890 messages)? [y/N] y
Deleted 3 sessions

The database is stored at:

~/.lore/lore.db

You can back up this file directly. The database uses SQLite and can be inspected with any SQLite client:

Terminal window
sqlite3 ~/.lore/lore.db ".tables"
sqlite3 ~/.lore/lore.db "SELECT COUNT(*) FROM sessions"