Skip to main content
Remove orphaned data and vacuum the database to reclaim disk space.

Usage

qmd cleanup

What Gets Cleaned

1

Clear LLM cache

Removes cached query expansion and reranking results from previous searches.
2

Remove orphaned embeddings

Deletes embedding chunks for documents that no longer exist.
3

Remove inactive documents

Removes document records marked as inactive (deleted from filesystem but still in index).
4

Vacuum database

Reclaims disk space by compacting the SQLite database file.

When to Use

Run qmd cleanup when:
  • You’ve removed files from collections and want to reclaim space
  • The cache has grown large and you want to clear it
  • The database file size seems larger than expected
  • After bulk deletions or collection removals
Cleanup is safe to run at any time. It only removes data that is no longer needed.

Example Output

$ qmd cleanup
 Cleared 247 cached API responses
 Removed 15 orphaned embedding chunks
 Removed 8 inactive document records
 Database vacuumed

Performance Impact

  • Clearing cache means next searches will be slower (query expansion/reranking not cached)
  • Embeddings will need to be regenerated if documents change
  • Vacuum can take a few seconds for large databases
Run qmd cleanup periodically to keep the index lean, especially if you frequently add/remove documents.

Build docs developers (and LLMs) love