Skip to content

2am-dev/Second-Brain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Second Brain Banner


Python License: MIT Ollama Local AI PRs Welcome


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.


πŸ“Έ Preview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 🧠 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...

_


πŸ€” Why Second Brain?

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

✨ Features

πŸ“₯ Multi-Format Ingestion

Ingest PDFs, web pages, raw text notes, or any auto-detected file. The pipeline chunks, cleans, and embeds everything automatically.

πŸ” Semantic Search

Find information by meaning, not keywords. Ask vague questions and still get the right answer.

πŸ’¬ Conversational Q&A

Ask natural language questions grounded entirely in your own ingested knowledge base.

πŸ“ Smart Summaries

Generate structured, bullet-pointed summaries for any topic or specific document in your library.

πŸ”— Knowledge Graph

Automatically map how concepts connect across your entire library. Visualize your mental model.

πŸ’‘ Daily Insights

Surface surprising, non-obvious connections between random pieces of your knowledge.

πŸ–₯️ Rich Interactive CLI

A full REPL with command history, inline help, and over 20 built-in commands.

πŸ”’ 100% Local & Private

Powered by Ollama. No API keys, no cloud, no telemetry β€” ever.


πŸ—οΈ Architecture

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

πŸš€ Quick Start

1 Β· Prerequisites

- Python 3.10+
- Ollama installed and running

2 Β· Pull Models

ollama pull mistral:7b
ollama pull nomic-embed-text

3 Β· Install

git clone https://github.com/2am-dev/Second-Brain.git
cd Second-Brain
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

4 Β· Run

python 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.txt

5 Β· Troubleshooting and Pinpointing

Use the check.ipynb that makes it easier to see where the actual error lies during execution of the code


πŸ“– CLI Reference

πŸ“₯ Ingestion

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

πŸ” Queries & Insights

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

🧠 Knowledge Graph

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

πŸ› οΈ Utilities

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

βš™οΈ Configuration

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",
)

πŸ—ΊοΈ Roadmap

  • 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!

About

Second Brain serves as a local system to store and compile all your sensitive and private files which might be too large for your reading and too sensitive for cloud.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors