Knowme / Rag.md
rahul7star's picture
Update Rag.md
a714b2e verified
|
Raw
History Blame Contribute Delete
5.21 kB
## 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.