Skip to content

About

SecondSelf is a local-first personal AI second brain that auto-organizes notes into PARA and answers Q&A using RAG.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 SecondSelf — Personal AI Second Brain

Capture anything. Organize automatically. Ask your own knowledge.

Live App Python Streamlit Groq License: MIT


SecondSelf is a local-first personal AI second brain that ingests your scattered notes, links, and files — automatically organizes them using the PARA framework, connects related concepts via sentence embeddings, and lets you ask plain-English questions answered from your own knowledge.

🏅 Badges Earned: The Archivist · The Librarian · The Cartographer · The Oracle


✨ Features

Feature Description
📥 Capture One command captures notes, URLs, or files with auto UUID + timestamp
🤖 AI Classification Groq LLM (Llama 3.3 70B) sorts everything into PARA — Projects, Areas, Resources, Archives
🔗 Auto-Linking sentence-transformers embeddings find related notes automatically — no manual tagging
🌐 Knowledge Graph Interactive force-directed vis-network graph colored by PARA category
💬 Ask Your Brain RAG pipeline retrieves relevant notes and synthesizes answers via Groq
⚙️ Pipeline UI Streamlit app to run the full pipeline, capture, and query — no terminal needed

🏗 Architecture

┌─────────────────────────────────────────────────────────┐
│                     SecondSelf Pipeline                  │
│                                                         │
│  capture.py   →   classify.py   →   link.py             │
│  (raw/ JSON)      (wiki/ PARA MD)   (embeddings.json)   │
│                        ↓                                │
│              build_graph.py  →  graph.json              │
│                        ↓                                │
│         ┌──────────────────────────────┐                │
│         │        app.py (Streamlit)     │                │
│         │  🌐 Graph | 💬 Ask | 📥 Capture │              │
│         └──────────────────────────────┘                │
│                  ask.py (RAG engine)                    │
│            Embed → Retrieve → Groq → Answer             │
└─────────────────────────────────────────────────────────┘

Data flow:

note/link/file → raw/*.json → wiki/<PARA>/*.md → graph.json → Streamlit UI
                                      ↓
                              embeddings.json → RAG Q&A

🚀 Quick Start (Local)

Prerequisites

Setup

# 1. Clone the repo
git clone https://github.com/koustavdatascience/Secondself-project.git
cd Secondself-project

# 2. Create virtual environment
python -m venv venv
venv\Scripts\activate        # Windows
# source venv/bin/activate   # macOS/Linux

# 3. Install dependencies
pip install -r requirements.txt

# 4. Configure your API key
cp .env.example .env
# Edit .env and add: GROQ_API_KEY=your_key_here

# 5. Verify API key works
python test_groq.py

# 6. Launch the app
streamlit run app.py

App opens at http://localhost:8501 🎉


📖 Usage Guide

Option A — Streamlit App (Recommended)

streamlit run app.py
Page What to do
🌐 Knowledge Graph Explore your notes visually — drag, zoom, click nodes
💬 Ask Your Brain Type any question, get an answer synthesized from your notes
📥 Capture Add new notes, links, or files directly in the browser
⚙️ Pipeline Run Classify → Link → Build Graph with one click

Option B — Command Line

# Capture
python capture.py note "My insight about..."
python capture.py link "https://example.com"
python capture.py file "/path/to/document.pdf"

# Run full pipeline
python classify.py       # AI classify all raw captures → wiki/
python link.py           # Compute embeddings + auto-link notes
python build_graph.py    # Build graph.json from wiki/

# Ask your brain
python ask.py "What is the PARA framework?"
python ask.py --top-k 3 --threshold 0.4 "What are my active projects?"

# View the standalone graph
python serve_graph.py    # Opens http://127.0.0.1:8765/graph.html

📁 Repository Structure

secondself/
├── raw/                 # Raw JSON captures (notes, links, files)
├── wiki/                # PARA-organized Markdown notes with YAML frontmatter
│   ├── Projects/
│   ├── Areas/
│   ├── Resources/
│   └── Archives/
├── capture.py           # CLI capture tool (note / link / file)
├── classify.py          # Groq LLM PARA classifier
├── link.py              # Sentence-transformer embedding auto-linker
├── build_graph.py       # Builds graph.json (nodes + edges)
├── graph.json           # Exported knowledge graph data
├── graph.html           # Standalone vis-network graph viewer
├── ask.py               # RAG retrieval + Groq synthesis engine
├── app.py               # Streamlit unified app
├── embeddings.json      # Cached note vectors (all-MiniLM-L6-v2)
├── requirements.txt     # Pinned Python dependencies
├── .env.example         # Environment variable template
└── README.md

🛠 Tech Stack

Layer Technology
LLM Groq API — Llama 3.3 70B Versatile
Embeddings sentence-transformers — all-MiniLM-L6-v2
Graph UI vis-network — force-directed graph
App Framework Streamlit 1.56+
Deployment Streamlit Community Cloud
Note Format Obsidian-compatible Markdown with YAML frontmatter
Language Python 3.10+

🔑 Environment Variables

Variable Where Description
GROQ_API_KEY .env (local) / Streamlit Secrets (cloud) Your Groq API key from console.groq.com

Security: .env is gitignored. Never commit your API key. On Streamlit Cloud, use the Secrets manager.


🛣 Roadmap

  • Phase 0: Project setup & scaffold
  • Phase 1: Capture pipeline (capture.py) — 🏅 The Archivist
  • Phase 2: AI Classification with Groq (classify.py)
  • Phase 3: Auto-Linking with Embeddings (link.py) — 🏅 The Librarian
  • Phase 4: Graph Data Model (build_graph.py)
  • Phase 5: Interactive Graph Visualization (graph.html) — 🏅 The Cartographer
  • Phase 6: Retrieval-Augmented Q&A (ask.py)
  • Phase 7: Unified Streamlit App + Deployment (app.py) — 🏅 The Oracle
  • Phase 8: Documentation & Final Verification — v1.0 Released 🎉

⚠️ Deployment Notes (Streamlit Cloud)

  • Ephemeral filesystem: New captures made in the cloud UI won't persist across restarts. Run the pipeline locally and commit raw/, wiki/, graph.json, embeddings.json to your repo to update the deployed app.
  • Starlette compatibility: Pin starlette<1.4.0 in requirements.txt — Starlette 1.4.0+ introduced a breaking change incompatible with Streamlit 1.61.0.
  • First load: The all-MiniLM-L6-v2 model (~120MB) is downloaded and cached on first startup — expect ~2 min cold start.

👤 Author

Koustav — koustavdatascience@gmail.com · GitHub


Built with 🧠 + Python + Groq + sentence-transformers + Streamlit

About

SecondSelf is a local-first personal AI second brain that auto-organizes notes into PARA and answers Q&A using RAG.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages