Turn your documents, web pages, and notes into a conversational AI knowledge base β that runs entirely on your machine.
π Quick Start Β· β¨ Features Β· π CLI Reference Β· βοΈ Configuration Β· πΊοΈ Roadmap
π Your data never leaves your machine. No API keys. No subscriptions. No cloud.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β π§ SECOND BRAIN β β Your Local AI Knowledge Base β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β Vector DB β 1,247 chunks across 14 documents β β β Knowledge Graph β 89 concepts Β· 214 connections β β β LLM Ready β mistral:7b via Ollama β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ask What connects the transformer architecture to attention theory?
π€ Thinking...
π‘ Based on your knowledge base: The transformer architecture fundamentally reimagines attention as a first-class computational primitive rather than an auxiliary mechanism. Across your 3 related documents, the key insight is...
_
Most AI tools require sending your data to the cloud. Second Brain is different.
| βοΈ Cloud AI Tools | π§ Second Brain | |
|---|---|---|
| Privacy | Data sent to remote servers | 100% local β never leaves your machine |
| Cost | Monthly subscriptions / API fees | Free forever |
| Knowledge Source | Generic world knowledge | Your documents and notes |
| Connectivity | Requires internet | Works fully offline |
| Customization | Limited | Fully open and configurable |
| Data Control | Vendor-dependent | You own everything |
Ingest PDFs, web pages, raw text notes, or any auto-detected file. The pipeline chunks, cleans, and embeds everything automatically.
Find information by meaning, not keywords. Ask vague questions and still get the right answer.
Ask natural language questions grounded entirely in your own ingested knowledge base.
Generate structured, bullet-pointed summaries for any topic or specific document in your library.
Automatically map how concepts connect across your entire library. Visualize your mental model.
Surface surprising, non-obvious connections between random pieces of your knowledge.
A full REPL with command history, inline help, and over 20 built-in commands.
Powered by Ollama. No API keys, no cloud, no telemetry β ever.
second_brain/
βββ ingestion/
β βββ __init__.py
β βββ pdf_processor.py
β βββ web_processor.py
β βββ text_processor.py
βββ storage/
β βββ __init__.py
β βββ vector_store.py
β βββ graph_store.py
β βββ summary_store.py
βββ agents/
β βββ __init__.py
β βββ query_agent.py
β βββ link_agent.py
β βββ insight_agent.py
βββ utils/
β βββ __init__.py
β βββ helpers.py
βββ brain.py
βββ main.py- Python 3.10+
- Ollama installed and runningollama pull mistral:7b
ollama pull nomic-embed-textgit clone https://github.com/2am-dev/Second-Brain.git
cd Second-Brain
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython main.py
python main.py --demo #For running demo no extra files
# Ingest a single file then exit
python main.py --ingest /path/to/paper.pdf
python main.py --ingest /path/to/notes.md
python main.py --ingest /path/to/book.txtUse the check.ipynb that makes it easier to see where the actual error lies during execution of the code
| Command | Description |
|---|---|
ingest pdf <path> |
Ingest a PDF file |
ingest url <url> |
Ingest a web page |
ingest text |
Type or paste a note (end with END) |
ingest file <path> |
Autoβdetect format and ingest |
| Command | Description |
|---|---|
ask <question> |
Ask anything about your knowledge base |
search <query> |
Raw semantic search |
summarize <topic> |
Summarise a concept or topic |
summarize doc <source> |
Summarise a specific ingested document |
compare <a> | <b> |
Compare two topics or documents |
questions |
Generate study questions from your data |
insights |
Generate daily crossβtopic insights |
| Command | Description |
|---|---|
graph build |
Build the concept graph from ingested content |
graph related <concept> |
Show concepts most related to the given one |
graph central |
Show the most central / important concepts |
graph connect <a> <b> |
Trace the connection between two concepts |
| Command | Description |
|---|---|
docs |
List all ingested documents |
stats |
Display knowledge base statistics |
history |
Show recent insights |
clear |
Clear current conversation context |
help |
Show the full command help |
quit / exit |
Exit the REPL |
from brain import SecondBrain
brain = SecondBrain(
db_path="./my_vector_db",
graph_path="./my_graph.pkl",
summary_db="./my_summaries.db",
llm_model="llama3.2:3b",
embed_model="nomic-embed-text",
)- Web UI
- Folder watcher
- Graph visualization
- Notion/Obsidian sync
- Plugin system
π€ Contributing
PRs welcome! Open an issue or discussion first.
π License
MIT License β see LICENSE file.
Built with β€οΈ by 2am-dev
β Star the repo if you find it useful!