X-Matrix/mnemosyne

Rust

0

98 commits

updated Aug 18, 2026

See the code

README

Mnemosyne

Mnemosyne

An intelligent, local-first file search and analysis system.

Rust Tauri SQLite MIT


About

Mnemosyne provides intelligent search and analysis for your local files:

  • Hybrid Search: Vector semantic search + FTS5 keyword search, fused with Reciprocal Rank Fusion (RRF).
  • Multi-Format: Text (txt/md/csv/json...), PDF, images, audio, video.
  • Multilingual Models: BGE-M3 (100+ languages) and Chinese CLIP for Chinese text-to-image search.
  • Multiple UIs: Desktop GUI (Tauri 2), CLI, REST API.
  • Real-time Updates: File watcher detects changes and updates the index incrementally. File deletions are automatically removed from the index.
  • Smart Directory Filtering: Automatically skips node_modules, .git, target, and 60+ other irrelevant directories.
  • Zero External Services: All data stored in a single SQLite file.

Features

FeatureStatus
Text File Indexing (txt/md/csv/json/py/rs...)✅ Fully Implemented
PDF Text Extraction✅ Fully Implemented
CLIP Image Embeddingsclip-backend feature
Whisper Audio Transcriptionwhisper-backend feature
FTS5 Keyword Search (BM25)✅ Fully Implemented
sqlite-vec KNN Vector Search (HNSW)✅ Dynamic Runtime Loading
Pure Rust HNSW Fallback✅ Fully Implemented
RRF Hybrid Search✅ Fully Implemented
Incremental Indexing (SHA-256 Change Detection)✅ Fully Implemented
Real-time File Watcher (incl. deletion sync)✅ Fully Implemented
Directory Ignore Filtering (60+ rules)✅ Fully Implemented
REST API Server (with Swagger UI)✅ Fully Implemented
CLI Tool✅ Fully Implemented
Desktop GUI (Tauri 2)✅ Full Implementation
BERT Text Embeddings (via candle)candle-backend feature
BGE-M3 Multilingual Embeddings (1024-dim)candle-backend feature
OpenAI CLIP (English image search)clip-backend feature
Chinese CLIP (Chinese image search)clip-backend feature
Apple Silicon Metal GPU Accelerationmetal-backend (auto-detected)

Architecture

┌─────────────────────────────────────────────┐
│                 UI Layer                    │
│  [Tauri2 GUI]  [CLI]  [REST API / axum]     │
└──────────────────┬──────────────────────────┘
                   │
┌──────────────────▼──────────────────────────┐
│         mnemosyne-retrieval                  │
│   SearchEngine · BackgroundIndexer           │
│   FileWatcher · IgnoreConfig                 │
└──┬────────────────┬────────────────┬────────┘
   │                │                │
┌──▼──────────┐  ┌──▼───────┐  ┌────▼──────────┐
│   model     │  │  parser  │  │    index       │
│BERT/BGE-M3  │  │Text/PDF/ │  │ HybridIndex    │
│CLIP/Whisper │  │Image/... │  │ Vector + FTS5  │
└─────────────┘  └──────────┘  └──────┬────────┘
                                        │
                               ┌────────▼────────┐
                               │    storage       │
                               │ SQLite + WAL     │
                               │ sqlite-vec (KNN) │
                               └─────────────────┘

Crate Dependency Graph

mnemosyne-core          ← Base types / traits / errors
  ← mnemosyne-storage   ← SQLite CRUD + sqlite-vec integration
  ← mnemosyne-model     ← Text / image / audio embeddings (Candle / Metal)
  ← mnemosyne-parser    ← File parsing plugins
  ← mnemosyne-index     ← Hybrid search engine
    ← mnemosyne-retrieval  ← SearchEngine facade + IgnoreConfig
      ← cli / api / src-tauri

Installation

Prerequisites

ToolVersionNotes
Rust≥ 1.75rustup update stable
Tauri CLI2.xcargo install tauri-cli (GUI only)
Node.js≥ 18GUI frontend build only

On macOS, you also need Xcode Command Line Tools:

xcode-select --install
git clone <repo-url> mnemosyne && cd mnemosyne

# Full ML backend + auto-download sqlite-vec
# Apple Silicon automatically enables Metal GPU acceleration
./scripts/build.sh --full --sqlite-vector

# Common options
./scripts/build.sh --candle              # BERT text only
./scripts/build.sh --full --no-metal     # Disable Metal, force CPU
./scripts/build.sh --full --gui          # Also build desktop GUI
./scripts/build.sh --dev                 # Debug profile (faster compile)

build.sh options:

OptionDescription
--release / --devRelease (default) or Debug profile
--candle / --clip / --whisper / --fullEnable ML backends
--guiAlso build Tauri desktop app
--sqlite-vectorAuto-download sqlite-vec to ~/.mnemosyne/lib/
--no-metalSuppress Metal auto-detection on Apple Silicon

Manual Cargo Build

# Full backend (add --features metal-backend for Apple Silicon)
cargo build --release -p mnemosyne-cli \
  --features "candle-backend,clip-backend,whisper-backend"

Build artifacts in target/release/: mnemosyne (CLI), mnemosyne-server (API)


Usage

CLI

# Index a directory (auto-skips node_modules/.git/etc.)
mnemosyne index ~/Documents

# Hybrid search
mnemosyne search "Rust memory safety"

# Keyword / vector search
mnemosyne search "async trait" --mode keyword --limit 20
mnemosyne search "machine learning papers" --mode vector

# Download embedding models
mnemosyne model-download BAAI/bge-m3                               # Multilingual (recommended)
mnemosyne model-download OFA-Sys/chinese-clip-vit-base-patch16    # Chinese image search
mnemosyne model-download openai/clip-vit-base-patch32             # English image search
mnemosyne model-download openai/whisper-tiny                      # Audio transcription

# Real-time watching (file deletions are auto-removed from index)
mnemosyne watch ~/Documents

# Stats / list / remove
mnemosyne stats
mnemosyne list --limit 50
mnemosyne remove <file-id>

# Start REST API
mnemosyne serve --port 8080

REST API

curl -X POST http://localhost:8080/api/search \
  -H "Content-Type: application/json" \
  -d '{"text": "machine learning", "mode": "hybrid", "limit": 10}'
MethodPathDescription
POST/api/searchHybrid / vector / keyword search
POST/api/indexIndex a directory
GET/api/statsStatistics
GET/api/filesList files
DELETE/api/files/:idDelete file record
GET/api/modelsDownloaded models
POST/api/models/downloadDownload a model
GET/api/docsSwagger UI
GET/healthHealth check

Desktop GUI Features

  • Hybrid / vector / keyword search mode; adjustable weights and score threshold
  • Directory management (add, re-index, real-time watching)
  • File browser and preview (text, PDF, images, audio)
  • Model management (download, switch BERT/CLIP/Whisper models)
  • HuggingFace mirror configuration (direct / hf-mirror.com / custom)
  • Proxy configuration
  • Built-in REST API server toggle (with Swagger UI link)
  • Real-time log viewer
  • Clear index database (requires typing a random obscure confirmation word to prevent accidents)

Embedding Models

Text Models (candle-backend)

ModelDimSizeLanguages
BAAI/bge-m310242.1 GBChinese / English / 100+ languages, CLS pooling
sentence-transformers/all-MiniLM-L6-v238487 MBEnglish, lightweight
sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2384458 MB50 languages
sentence-transformers/all-mpnet-base-v2768418 MBEnglish, high quality

Vision Models (clip-backend)

ModelDimSizeText Language
OFA-Sys/chinese-clip-vit-base-patch16512718 MBChinese (Chinese CLIP)
openai/clip-vit-base-patch32512579 MBEnglish (OpenAI CLIP)

Audio Models (whisper-backend)

ModelSizeUse Case
openai/whisper-tiny147 MBSpeed priority
openai/whisper-base280 MBBalanced quality/speed
openai/whisper-small~490 MBHigh quality, multilingual

sqlite-vec KNN Acceleration

Install asg017/sqlite-vec to enable HNSW KNN search:

# Automatic via build.sh
./scripts/build.sh --sqlite-vector

# Manual (macOS arm64)
mkdir -p ~/.mnemosyne/lib
curl -fsSL https://github.com/asg017/sqlite-vec/releases/latest/download/sqlite-vec-0.1.9-loadable-macos-aarch64.tar.gz \
  | tar -xzO vec0.dylib > ~/.mnemosyne/lib/vec0.dylib

Automatically detected at startup; silently falls back to pure Rust HNSW if absent.


Directory Filtering (IgnoreConfig)

The following directories are automatically skipped during indexing:

CategoryIncludes
Version control.git .svn .hg
JS/Nodenode_modules bower_components .npm .yarn
Python__pycache__ .venv venv .tox .pytest_cache
Rusttarget
Java/Android.gradle .m2 build
iOS/SwiftPods DerivedData
Frontend builddist out .next .nuxt .cache .parcel-cache
IDE.idea .vscode .vs
OS artefacts.Spotlight-V100 .Trashes $RECYCLE.BIN

Customizable via IgnoreConfig in mnemosyne-retrieval.


Data Storage

~/.mnemosyne/
  db.sqlite
    ├── files              # File metadata + SHA-256 hash
    ├── document_chunks    # Content chunks
    ├── fts_chunks         # FTS5 full-text index (BM25)
    ├── embeddings         # Vector BLOBs (f32 little-endian)
    ├── embedding_vec_384  # sqlite-vec HNSW (BERT 384-dim)
    ├── embedding_vec_512  # sqlite-vec HNSW (CLIP 512-dim)
    ├── embedding_vec_1024 # sqlite-vec HNSW (BGE-M3 1024-dim)
    └── model_registry     # Downloaded model records
  models/                  # Local model cache
  lib/vec0.dylib           # sqlite-vec extension (optional)

Development

cargo test -p mnemosyne-storage -p mnemosyne-retrieval
cargo check --workspace
cargo fmt --all
cargo clippy --workspace -- -D warnings

Tech Stack

ComponentChoice
LanguageRust 1.75+
GUITauri 2.x + HTML/CSS/JS
Async runtimeTokio 1.x
DatabaseSQLite (rusqlite bundled + WAL)
Full-text searchFTS5 (BM25, trigram tokenizer)
Vector KNNsqlite-vec (HNSW) + Rust HNSW fallback
Embedding inferenceHuggingFace Candle (CPU / Metal GPU)
Text modelsBERT / BGE-M3 (XLM-RoBERTa architecture)
Vision modelsOpenAI CLIP / Chinese CLIP
Audio modelsWhisper (via Candle)
HTTPAxum 0.8 + Tower
File watchingnotify-debouncer-mini (500ms debounce)

Contributors

junjiemao

96 commits

Copilot

2 commits

X-Matrix/mnemosyne

Rust

0

98 commits

updated Aug 18, 2026

See the code

README

Mnemosyne

Mnemosyne

An intelligent, local-first file search and analysis system.

Rust Tauri SQLite MIT


About

Mnemosyne provides intelligent search and analysis for your local files:

  • Hybrid Search: Vector semantic search + FTS5 keyword search, fused with Reciprocal Rank Fusion (RRF).
  • Multi-Format: Text (txt/md/csv/json...), PDF, images, audio, video.
  • Multilingual Models: BGE-M3 (100+ languages) and Chinese CLIP for Chinese text-to-image search.
  • Multiple UIs: Desktop GUI (Tauri 2), CLI, REST API.
  • Real-time Updates: File watcher detects changes and updates the index incrementally. File deletions are automatically removed from the index.
  • Smart Directory Filtering: Automatically skips node_modules, .git, target, and 60+ other irrelevant directories.
  • Zero External Services: All data stored in a single SQLite file.

Features

FeatureStatus
Text File Indexing (txt/md/csv/json/py/rs...)✅ Fully Implemented
PDF Text Extraction✅ Fully Implemented
CLIP Image Embeddingsclip-backend feature
Whisper Audio Transcriptionwhisper-backend feature
FTS5 Keyword Search (BM25)✅ Fully Implemented
sqlite-vec KNN Vector Search (HNSW)✅ Dynamic Runtime Loading
Pure Rust HNSW Fallback✅ Fully Implemented
RRF Hybrid Search✅ Fully Implemented
Incremental Indexing (SHA-256 Change Detection)✅ Fully Implemented
Real-time File Watcher (incl. deletion sync)✅ Fully Implemented
Directory Ignore Filtering (60+ rules)✅ Fully Implemented
REST API Server (with Swagger UI)✅ Fully Implemented
CLI Tool✅ Fully Implemented
Desktop GUI (Tauri 2)✅ Full Implementation
BERT Text Embeddings (via candle)candle-backend feature
BGE-M3 Multilingual Embeddings (1024-dim)candle-backend feature
OpenAI CLIP (English image search)clip-backend feature
Chinese CLIP (Chinese image search)clip-backend feature
Apple Silicon Metal GPU Accelerationmetal-backend (auto-detected)

Architecture

┌─────────────────────────────────────────────┐
│                 UI Layer                    │
│  [Tauri2 GUI]  [CLI]  [REST API / axum]     │
└──────────────────┬──────────────────────────┘
                   │
┌──────────────────▼──────────────────────────┐
│         mnemosyne-retrieval                  │
│   SearchEngine · BackgroundIndexer           │
│   FileWatcher · IgnoreConfig                 │
└──┬────────────────┬────────────────┬────────┘
   │                │                │
┌──▼──────────┐  ┌──▼───────┐  ┌────▼──────────┐
│   model     │  │  parser  │  │    index       │
│BERT/BGE-M3  │  │Text/PDF/ │  │ HybridIndex    │
│CLIP/Whisper │  │Image/... │  │ Vector + FTS5  │
└─────────────┘  └──────────┘  └──────┬────────┘
                                        │
                               ┌────────▼────────┐
                               │    storage       │
                               │ SQLite + WAL     │
                               │ sqlite-vec (KNN) │
                               └─────────────────┘

Crate Dependency Graph

mnemosyne-core          ← Base types / traits / errors
  ← mnemosyne-storage   ← SQLite CRUD + sqlite-vec integration
  ← mnemosyne-model     ← Text / image / audio embeddings (Candle / Metal)
  ← mnemosyne-parser    ← File parsing plugins
  ← mnemosyne-index     ← Hybrid search engine
    ← mnemosyne-retrieval  ← SearchEngine facade + IgnoreConfig
      ← cli / api / src-tauri

Installation

Prerequisites

ToolVersionNotes
Rust≥ 1.75rustup update stable
Tauri CLI2.xcargo install tauri-cli (GUI only)
Node.js≥ 18GUI frontend build only

On macOS, you also need Xcode Command Line Tools:

xcode-select --install
git clone <repo-url> mnemosyne && cd mnemosyne

# Full ML backend + auto-download sqlite-vec
# Apple Silicon automatically enables Metal GPU acceleration
./scripts/build.sh --full --sqlite-vector

# Common options
./scripts/build.sh --candle              # BERT text only
./scripts/build.sh --full --no-metal     # Disable Metal, force CPU
./scripts/build.sh --full --gui          # Also build desktop GUI
./scripts/build.sh --dev                 # Debug profile (faster compile)

build.sh options:

OptionDescription
--release / --devRelease (default) or Debug profile
--candle / --clip / --whisper / --fullEnable ML backends
--guiAlso build Tauri desktop app
--sqlite-vectorAuto-download sqlite-vec to ~/.mnemosyne/lib/
--no-metalSuppress Metal auto-detection on Apple Silicon

Manual Cargo Build

# Full backend (add --features metal-backend for Apple Silicon)
cargo build --release -p mnemosyne-cli \
  --features "candle-backend,clip-backend,whisper-backend"

Build artifacts in target/release/: mnemosyne (CLI), mnemosyne-server (API)


Usage

CLI

# Index a directory (auto-skips node_modules/.git/etc.)
mnemosyne index ~/Documents

# Hybrid search
mnemosyne search "Rust memory safety"

# Keyword / vector search
mnemosyne search "async trait" --mode keyword --limit 20
mnemosyne search "machine learning papers" --mode vector

# Download embedding models
mnemosyne model-download BAAI/bge-m3                               # Multilingual (recommended)
mnemosyne model-download OFA-Sys/chinese-clip-vit-base-patch16    # Chinese image search
mnemosyne model-download openai/clip-vit-base-patch32             # English image search
mnemosyne model-download openai/whisper-tiny                      # Audio transcription

# Real-time watching (file deletions are auto-removed from index)
mnemosyne watch ~/Documents

# Stats / list / remove
mnemosyne stats
mnemosyne list --limit 50
mnemosyne remove <file-id>

# Start REST API
mnemosyne serve --port 8080

REST API

curl -X POST http://localhost:8080/api/search \
  -H "Content-Type: application/json" \
  -d '{"text": "machine learning", "mode": "hybrid", "limit": 10}'
MethodPathDescription
POST/api/searchHybrid / vector / keyword search
POST/api/indexIndex a directory
GET/api/statsStatistics
GET/api/filesList files
DELETE/api/files/:idDelete file record
GET/api/modelsDownloaded models
POST/api/models/downloadDownload a model
GET/api/docsSwagger UI
GET/healthHealth check

Desktop GUI Features

  • Hybrid / vector / keyword search mode; adjustable weights and score threshold
  • Directory management (add, re-index, real-time watching)
  • File browser and preview (text, PDF, images, audio)
  • Model management (download, switch BERT/CLIP/Whisper models)
  • HuggingFace mirror configuration (direct / hf-mirror.com / custom)
  • Proxy configuration
  • Built-in REST API server toggle (with Swagger UI link)
  • Real-time log viewer
  • Clear index database (requires typing a random obscure confirmation word to prevent accidents)

Embedding Models

Text Models (candle-backend)

ModelDimSizeLanguages
BAAI/bge-m310242.1 GBChinese / English / 100+ languages, CLS pooling
sentence-transformers/all-MiniLM-L6-v238487 MBEnglish, lightweight
sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2384458 MB50 languages
sentence-transformers/all-mpnet-base-v2768418 MBEnglish, high quality

Vision Models (clip-backend)

ModelDimSizeText Language
OFA-Sys/chinese-clip-vit-base-patch16512718 MBChinese (Chinese CLIP)
openai/clip-vit-base-patch32512579 MBEnglish (OpenAI CLIP)

Audio Models (whisper-backend)

ModelSizeUse Case
openai/whisper-tiny147 MBSpeed priority
openai/whisper-base280 MBBalanced quality/speed
openai/whisper-small~490 MBHigh quality, multilingual

sqlite-vec KNN Acceleration

Install asg017/sqlite-vec to enable HNSW KNN search:

# Automatic via build.sh
./scripts/build.sh --sqlite-vector

# Manual (macOS arm64)
mkdir -p ~/.mnemosyne/lib
curl -fsSL https://github.com/asg017/sqlite-vec/releases/latest/download/sqlite-vec-0.1.9-loadable-macos-aarch64.tar.gz \
  | tar -xzO vec0.dylib > ~/.mnemosyne/lib/vec0.dylib

Automatically detected at startup; silently falls back to pure Rust HNSW if absent.


Directory Filtering (IgnoreConfig)

The following directories are automatically skipped during indexing:

CategoryIncludes
Version control.git .svn .hg
JS/Nodenode_modules bower_components .npm .yarn
Python__pycache__ .venv venv .tox .pytest_cache
Rusttarget
Java/Android.gradle .m2 build
iOS/SwiftPods DerivedData
Frontend builddist out .next .nuxt .cache .parcel-cache
IDE.idea .vscode .vs
OS artefacts.Spotlight-V100 .Trashes $RECYCLE.BIN

Customizable via IgnoreConfig in mnemosyne-retrieval.


Data Storage

~/.mnemosyne/
  db.sqlite
    ├── files              # File metadata + SHA-256 hash
    ├── document_chunks    # Content chunks
    ├── fts_chunks         # FTS5 full-text index (BM25)
    ├── embeddings         # Vector BLOBs (f32 little-endian)
    ├── embedding_vec_384  # sqlite-vec HNSW (BERT 384-dim)
    ├── embedding_vec_512  # sqlite-vec HNSW (CLIP 512-dim)
    ├── embedding_vec_1024 # sqlite-vec HNSW (BGE-M3 1024-dim)
    └── model_registry     # Downloaded model records
  models/                  # Local model cache
  lib/vec0.dylib           # sqlite-vec extension (optional)

Development

cargo test -p mnemosyne-storage -p mnemosyne-retrieval
cargo check --workspace
cargo fmt --all
cargo clippy --workspace -- -D warnings

Tech Stack

ComponentChoice
LanguageRust 1.75+
GUITauri 2.x + HTML/CSS/JS
Async runtimeTokio 1.x
DatabaseSQLite (rusqlite bundled + WAL)
Full-text searchFTS5 (BM25, trigram tokenizer)
Vector KNNsqlite-vec (HNSW) + Rust HNSW fallback
Embedding inferenceHuggingFace Candle (CPU / Metal GPU)
Text modelsBERT / BGE-M3 (XLM-RoBERTa architecture)
Vision modelsOpenAI CLIP / Chinese CLIP
Audio modelsWhisper (via Candle)
HTTPAxum 0.8 + Tower
File watchingnotify-debouncer-mini (500ms debounce)

Contributors

junjiemao

96 commits

Copilot

2 commits

Languages

Rust

71.0%

HTML

24.4%

Shell

4.6%