๐ v5.0: NO API KEYS REQUIRED! Run entirely on local models with CLIP, LLaVA, and LM Studio. Complete privacy, zero monthly costs, unlimited usage.
Second Brain is your personal AI-powered knowledge management system that runs 100% locally on your machine. Store, search, and synthesize all your documents, images, and ideas using state-of-the-art AI models - without sending a single byte to the cloud.
- LM Studio (port 1234): Text generation with LLaVA 1.6 Mistral 7B
- CLIP Service (port 8002): Image embeddings and similarity search
- LLaVA Service (port 8003): Advanced vision understanding and OCR
- Nomic Embeddings: Fast text embeddings (768 dimensions)
- Search by text, image, or both simultaneously
- Semantic understanding of documents and images
- Sub-100ms query performance
- Hybrid search combining vectors and full-text
- OAuth 2.0 authentication
- Stream files using Google Drive API - no storage required
- Automatic document synchronization
- Process Google Docs, Sheets, PDFs, and images
- Maintain folder structure and metadata
- Automatic relationship discovery
- Interactive visualization
- Topic clustering and analysis
- Memory consolidation and deduplication
- No API keys - ever
- No cloud dependencies
- No tracking or telemetry
- Works fully offline
- Your data stays yours
- Docker Desktop (required) - Download
- 16GB+ RAM recommended
- 20GB+ free disk space
git clone https://github.com/raold/second-brain.git
cd second-brain
# Copy environment file
cp .env.example .env
# Auto-configure for your platform
./setup-platform.sh # Mac/Linux
# OR
setup-platform.bat # Windows (coming soon)
# Quick start with platform-specific script:
./start-dev.sh # Mac/Linux
./start-dev.bat # Windows
# OR manually with Docker:
docker-compose up -d
- Main App: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Photo Pipeline: http://localhost:8000/static/photo-pipeline.html
- Database Admin: http://localhost:8080
For GPU-accelerated vision features:
# Start GPU services with Docker
docker-compose -f docker-compose.gpu.yml up -d
graph TB
subgraph "Local Services"
LM[LM Studio<br/>:1234]
CLIP[CLIP Service<br/>:8002]
LLAVA[LLaVA Service<br/>:8003]
end
subgraph "Core"
API[FastAPI<br/>:8000]
PG[(PostgreSQL<br/>+ pgvector<br/>:5432)]
end
subgraph "Data Sources"
GD[Google Drive]
LOCAL[Local Files]
end
API --> LM
API --> CLIP
API --> LLAVA
API --> PG
GD --> API
LOCAL --> API
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/secondbrain
# Local Model Services (no API keys!)
LM_STUDIO_URL=http://127.0.0.1:1234/v1
CLIP_SERVICE_URL=http://127.0.0.1:8002
LLAVA_SERVICE_URL=http://127.0.0.1:8003
# Google Drive (optional)
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://127.0.0.1:8000/api/v1/gdrive/callback
Component | Default | Source | Approx Size |
---|---|---|---|
Text/Vision (LLaVA) | llava-1.6-mistral-7b Q6_K | LM Studio | ~5โ7 GB |
Text Embeddings | nomic-embed-text | Hugging Face | ~300 MB |
CLIP | ViT-L/14 | Hugging Face | ~1 GB |
Tested on RTX 4090:
Operation | Performance | Conditions |
---|---|---|
Text Embedding | ~100ms/doc | batch=16 |
Image Embedding | ~300ms/image | 4090, fp16 |
Vision Analysis | 2โ5s/image | 1024px |
Vector Search | <50ms | top_k=10 |
Hybrid Search | <100ms | rerank enabled |
Doc Processing | 200 docs/min | avg 1 KB chunks |
POST /api/v1/memories
- Create memoryGET /api/v1/memories
- List memoriesGET /api/v1/memories/{id}
- Get memoryPUT /api/v1/memories/{id}
- Update memoryDELETE /api/v1/memories/{id}
- Delete memory
POST /api/v1/search
- Semantic searchPOST /api/v1/search/hybrid
- Hybrid searchPOST /api/v1/search/image
- Image similarity searchGET /api/v1/knowledge-graph
- Get knowledge graph
GET /api/v1/gdrive/auth
- Initiate OAuthGET /api/v1/gdrive/files
- List filesPOST /api/v1/gdrive/sync
- Sync folder
POST /clip/embed-text
- Text embeddingsPOST /clip/embed-image
- Image embeddingsPOST /llava/analyze
- Vision analysisPOST /llava/extract-text
- OCR
Create a memory:
curl -X POST http://localhost:8000/api/v1/memories \
-H "Content-Type: application/json" \
-d '{"type":"text","content":"Graph neural nets paper notes","tags":["gnn","research"]}'
Semantic search:
curl -X POST http://localhost:8000/api/v1/search \
-H "Content-Type: application/json" \
-d '{"query":"recent notes about vision transformers","limit":5}'
Image similarity:
curl -X POST http://localhost:8000/api/v1/search/image \
-F file=@example.jpg
- Personal Knowledge Base: Store and search all your notes, documents, and ideas
- Research Assistant: Analyze papers, extract insights, build connections
- Document Management: OCR, categorization, and intelligent search
- Learning System: Track learning progress, discover patterns
- Creative Projects: Manage inspiration, references, and iterations
- Code Documentation: Understand codebases with multimodal analysis
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- LM Studio - Excellent local LLM inference
- Hugging Face - Model repository and tools
- PostgreSQL & pgvector - Robust vector database
- FastAPI - Modern Python web framework
- The open-source AI community
- Apple Silicon optimization
- Ollama integration
- Web UI improvements
- Mobile apps
- Voice input/output
- Self-supervised learning
- Automated model optimization
- Multi-user support
- Federated learning
Built with โค๏ธ for privacy and self-sovereignty
No cloud. No tracking. No API keys. Just you and your second brain.