|
|
| ## Mind Memory Architecture |
|
|
| ## Overview |
|
|
| The Mind system uses three complementary storage layers: |
|
|
| mind.db β Source of Truth |
| knowledge.pt β Portable Export |
| knowledge.faiss β Vector Search Index |
|
|
| Each component has a specific responsibility. |
|
|
| βΈ» |
|
|
| Component Responsibilities |
|
|
| 1. mind.db |
|
|
| Purpose: Permanent storage of all memory data. |
|
|
| SQLite is the authoritative database and contains the complete memory graph. |
|
|
| Stores |
| β’ Captures |
| β’ Events |
| β’ Concepts |
| β’ Metadata |
| β’ Tags |
| β’ URLs |
| β’ Related IDs |
| β’ Lifecycle State |
| β’ Enrichment Data |
| |
| Example |
|
|
| { |
| "id": "capture_123", |
| "title": "SQLite Optimization", |
| "url": "https://example.com", |
| "tags": ["sqlite", "database"], |
| "related_ids": ["capture_456"], |
| "content": "Full article text..." |
| } |
| |
| Characteristics |
| β’ Human-readable data |
| β’ Structured metadata |
| β’ Editable |
| β’ Persistent |
| β’ Source of truth |
| |
| βΈ» |
| |
| 2. knowledge.pt |
| |
| Purpose: Portable snapshot of embeddings and lookup information. |
| |
| Generated from mind.db. |
| |
| Stores |
| |
| { |
| "version": 1, |
| "embed_model": "BAAI/bge-base-en-v1.5", |
| "count": 1234, |
| "ids": [...], |
| "embeddings": tensor(...) |
| } |
| |
| Future versions may also contain: |
|
|
| { |
| "records": [...], |
| "texts": [...], |
| "metadata": [...] |
| } |
| |
| Characteristics |
| β’ Fast to load |
| β’ Portable |
| β’ Easy to share |
| β’ Useful for backups |
| β’ Useful for debugging |
| |
| Does NOT Replace SQLite |
|
|
| knowledge.pt is an export. |
|
|
| If deleted, it can be regenerated from mind.db. |
|
|
| βΈ» |
|
|
| 3. knowledge.faiss |
|
|
| Purpose: High-speed semantic search. |
|
|
| Generated from embeddings. |
|
|
| Stores |
|
|
| Vector 0 |
| Vector 1 |
| Vector 2 |
| ... |
| Vector N |
|
|
| Characteristics |
| β’ Extremely fast similarity search |
| β’ Optimized for vector retrieval |
| β’ Contains no business data |
| β’ Contains no content text |
| β’ Contains no metadata |
| |
| Does NOT Store |
| β’ Titles |
| β’ URLs |
| β’ Tags |
| β’ Concepts |
| β’ Content |
| |
| It stores vectors only. |
|
|
| βΈ» |
|
|
| Retrieval Flow |
|
|
| User Query |
|
|
| Example: |
|
|
| How do I convert Gemma models to GGUF? |
|
|
| Step 1 |
|
|
| Generate query embedding. |
|
|
| Question |
| β |
| Embedding Model |
| β |
| Query Vector |
| |
|
|
| βΈ» |
|
|
| Step 2 |
|
|
| Search FAISS. |
|
|
| Query Vector |
| β |
| knowledge.faiss |
| β |
| Top Matching Vectors |
| |
| Example: |
|
|
| Vector 42 Score 0.95 |
| Vector 17 Score 0.88 |
| Vector 88 Score 0.81 |
|
|
|
|
| βΈ» |
|
|
| Step 3 |
|
|
| Resolve IDs using knowledge.pt. |
|
|
| Vector 42 |
| β |
| knowledge.pt |
| β |
| capture_123 |
| |
|
|
| βΈ» |
|
|
| Step 4 |
|
|
| Retrieve full memory. |
|
|
| capture_123 |
| β |
| mind.db |
| β |
| Full Record |
| |
| Example: |
| |
| { |
| "id": "capture_123", |
| "title": "Gemma GGUF Conversion", |
| "content": "Detailed conversion instructions..." |
| } |
|
|
|
|
| βΈ» |
|
|
| Why Three Layers? |
|
|
| SQLite |
|
|
| Best for: |
| β’ Storage |
| β’ Metadata |
| β’ Updates |
| β’ Relationships |
| |
| PT |
|
|
| Best for: |
| β’ Portability |
| β’ Snapshots |
| β’ Backup |
| β’ Debugging |
| |
| FAISS |
|
|
| Best for: |
| β’ Semantic Search |
| β’ Similarity Matching |
| β’ Fast Retrieval |
| |
| βΈ» |
|
|
| Architecture Diagram |
|
|
| ββββββββββββββββββββ |
| β User Question β |
| βββββββββββ¬βββββββββ |
| β |
| βΌ |
| ββββββββββββββββββββ |
| β BGE Embedding β |
| βββββββββββ¬βββββββββ |
| β |
| βΌ |
| ββββββββββββββββββββ |
| β knowledge.faiss β |
| β Vector Search β |
| βββββββββββ¬βββββββββ |
| β |
| βΌ |
| ββββββββββββββββββββ |
| β knowledge.pt β |
| β Vector β ID Map β |
| βββββββββββ¬βββββββββ |
| β |
| βΌ |
| ββββββββββββββββββββ |
| β mind.db β |
| β Full Memory Data β |
| ββββββββββββββββββββ |
| |
|
|
| βΈ» |
|
|
| Current State |
|
|
| mind.db |
| β Full Memory Storage |
| |
| knowledge.pt |
| β Embeddings |
| β IDs |
| |
| knowledge.faiss |
| β Semantic Search |
| |
|
|
| βΈ» |
|
|
| Future Enhancements |
|
|
| Possible upgrades: |
| β’ Store metadata inside knowledge.pt |
| β’ Store content snapshots inside knowledge.pt |
| β’ Incremental FAISS updates |
| β’ HNSW FAISS indexes for larger datasets |
| β’ Hybrid keyword + vector search |
| β’ Multi-model embedding support |
| β’ Automatic synchronization between SQLite and exports |
| |
| βΈ» |
|
|
| Summary |
|
|
| The architecture separates responsibilities: |
| β’ mind.db stores the memories. |
| β’ knowledge.faiss finds similar memories. |
| β’ knowledge.pt maps vectors back to memory IDs. |
| |
| This design keeps storage, retrieval, and search independent while allowing fast semantic memory lookup at scale. |
| ::: |
|
|
| This document should give future contributors a clear understanding of why all three files exist and how they work together. |