How alpha-tf141/second-brain-major-project works
Second Brain is an Electron/React desktop assistant backed by FastAPI: it captures activity, turns screenshots into searchable memories, and uses those memories for chat and voice responses. Its main knowledge workflow is capture → OCR → archive → semantic indexing/search → RAG chat. The README also documents integrations, graph/relationship features, research, and realtime voice. Several backend subsystems are represented at their exact directories because their implementation was not sampled; edges are limited to documented workflows or shown references.
Main entry points: routes FastAPI routes · AppRoutes.jsx React workspaces · memory.py Memory records · semantic_search Semantic memory
Components 23
Desktop experience
- Electron shell
electron/main.js - React workspaces
src/routes/AppRoutes.jsx - Backend context
src/context/BackendContext.jsx - API client
src/services/apiClient.js
Capture and archive
- Live capture
backend/app/routes/capture.py - Activity capture
backend/app/capture - OCR processing
backend/app/ocr - Memory archive
backend/app/memory - Memory records
backend/app/models/memory.py
Memory and reasoning
- Semantic memory
backend/app/semantic_search - Embedding indexer
backend/app/workers/embedding_worker.py - Vector store
backend/app/vectorstore/chroma_store.py - Keyword search
backend/app/search/memory_search.py - Adaptive research
backend/app/research - Knowledge graph
backend/app/graph
Assistant capabilities
- RAG chat
backend/app/rag/pipeline.py - LLM client
backend/app/llm/llm_client.py - Voice assistant
backend/app/voice - Mail and social
backend/app/agents
Backend platform
- FastAPI routes
backend/app/routes - SQLite models
backend/app/database/session.py - Live WebSockets
backend/app/websocket
Other components
- Desktop user
Connections 27
- Desktop user → React workspaces: uses workspaces
README.md - React workspaces → Electron shell: runs in shell
README.md - React workspaces → Backend context: mounts provider
- Backend context → API client: calls
src/context/BackendContext.jsx - Backend context → Live WebSockets: opens live socket
src/context/BackendContext.jsx - React workspaces → API client: requests API
- API client → FastAPI routes: calls documented endpoints
README.md - FastAPI routes → Live capture: routes capture APIs
README.md - Live capture → Activity capture: captures activity
README.md - Activity capture → OCR processing: feeds screenshots
README.md - OCR processing → Memory archive: provides chunks
README.md - Memory archive → Memory records: stores memories
README.md - Memory records → Embedding indexer: queues indexing
backend/app/workers/embedding_worker.py - Embedding indexer → Vector store: writes vectors
backend/app/workers/embedding_worker.py - Semantic memory → Vector store: queries vectors
backend/app/semantic_search/search_engine.py - Semantic memory → Keyword search: runs keyword search
backend/app/semantic_search/search_engine.py - Semantic memory → Memory records: hydrates results
backend/app/semantic_search/search_engine.py - Adaptive research → Vector store: retrieves candidates
backend/app/research/pipeline.py - Adaptive research → Memory records: ranks memories
backend/app/research/pipeline.py - RAG chat → Semantic memory: retrieves context
backend/app/rag/pipeline.py - RAG chat → LLM client: streams response
backend/app/rag/pipeline.py - RAG chat → Memory records: stores conversation
backend/app/rag/pipeline.py - FastAPI routes → RAG chat: serves chat APIs
README.md - FastAPI routes → Voice assistant: serves voice APIs
README.md - FastAPI routes → Mail and social: serves mail features
backend/app/agents/mail_ingestion_agent.py - React workspaces → Knowledge graph: offers graph workspace
README.md - FastAPI routes → SQLite models: persists application data
README.md