A local RAG (Retrieval-Augmented Generation) system over your own notes, PDFs, and web pages. Ask natural-language questions and get answers grounded in your own documents — with all inference running locally via Ollama. No API keys. No data leaves your machine.
- Ingest — documents are split into overlapping chunks and embedded using
nomic-embed-text - Store — embeddings are persisted in a local Chroma vector database
- Query — your question is embedded, the closest chunks are retrieved, and
llama3.2synthesizes an answer
- Python 3.10+
- Ollama — local model runtime
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Windows — download from https://ollama.com/downloadollama pull llama3.2 # LLM for answering questions (~2 GB)
ollama pull nomic-embed-text # embedding model (~274 MB)Smaller/faster alternatives:
ollama pull llama3.2:1b(1 GB) orollama pull phi3(2.3 GB). SetLLM_MODEL=phi3in your.envto switch.
git clone https://github.com/loudowl/personal-brain.git
cd personal-brain
python3 -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows
pip install -r requirements.txt
cp .env.example .env # optional — defaults work out of the box# Make sure Ollama is running
ollama serve & # or start the Ollama desktop app
# Ingest the example document to verify your setup
python brain.py ingest examples/
# Ask a question
python brain.py query "How does retrieval work?"
# Show which documents were used
python brain.py query "What input types are supported?" --sources# A directory of notes (markdown, PDF, txt — recursive)
python brain.py ingest ~/notes/
# A single file
python brain.py ingest ~/Documents/paper.pdf
python brain.py ingest ~/notes/meeting_2026-05.md
# A web page
python brain.py ingest --url https://example.com/article
# Re-ingest after editing a document
python brain.py ingest ~/notes/ --forceSupported file types: .md, .txt, .pdf, .docx, .html, and more via LlamaIndex readers.
# Ask a question
python brain.py query "What are my key projects this quarter?"
# Show source documents alongside the answer
python brain.py query "Summarize my notes on machine learning" --sources
# Retrieve more context for complex or broad questions
python brain.py query "What decisions did we make in Q1?" --top-k 10python brain.py status # show model config, chunk count, and all ingested sources
python brain.py clear # wipe the index and start fresh (asks for confirmation)
python brain.py clear --yes # skip confirmationAll settings can be overridden in .env:
| Variable | Default | Description |
|---|---|---|
LLM_MODEL |
llama3.2 |
Ollama model used for answering |
EMBED_MODEL |
nomic-embed-text |
Ollama model used for embeddings |
OLLAMA_BASE_URL |
http://localhost:11434 |
Ollama server address |
CHUNK_SIZE |
512 |
Token chunk size for splitting docs |
CHUNK_OVERLAP |
64 |
Overlap between chunks |
TOP_K |
5 |
Chunks retrieved per query |
Ollama is not running
Start it with ollama serve, or launch the Ollama desktop app.
Slow first query The first query loads the model into memory — subsequent queries are much faster.
Answer seems incomplete or off-topic
Try --top-k 10 to retrieve more context. Also check python brain.py status to confirm the relevant source was ingested.
Re-ingesting after edits
Documents are skipped if their path is already in the index. Use --force to re-embed updated files.
PDF not loading
Make sure pypdf is installed: pip install pypdf.
- Ollama — local LLM and embedding inference
- LlamaIndex — document loading, chunking, and RAG pipeline
- Chroma — local persistent vector database
- nomic-embed-text — open-source embedding model
- llama3.2 — default local LLM
- Web UI (Gradio or Streamlit) for a chat-like interface
- Watch mode — auto-re-ingest when files in
data/change - Multi-collection support (separate indexes for work vs. personal notes)
- Hybrid search (vector + keyword BM25) for better recall
- Export answers to markdown with source citations
MIT