Skip to content

newcoder789/VectorMind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 VectorMind β€” Local-First AI Study Assistant

Write notes. VectorMind watches you, understands what you wrote, compares it against everything you've studied, and tells you instantly β€” what's right, what's wrong, and what's missing.


✨ Features

πŸ”΄ Live Study Agent (flagship feature)

The most powerful feature β€” a real-time AI tutor that watches your notes folder and gives you structured feedback every time you save a .txt file.

What it does How it helps you
Already-studied detector "You covered this in ML/week2.txt β€” don't re-learn it, connect it!"
Correctness check Flags factual errors or vague definitions you wrote
Incompleteness detector Points out what's missing from your notes
Smart suggestions Tells you what to study next based on your vault
Encouragement A short motivational message after every save

The Live Agent tab auto-refreshes every 5 seconds β€” just write in any editor (VS Code, Notepad, Obsidian…) and watch the feedback appear.


πŸ“š Knowledge Vault

  • Semantic search across all your notes using local embeddings (no API key needed)
  • Notes are embedded automatically into LanceDB on every file save
  • Near-duplicate detection prevents redundant indexing

πŸ•ΈοΈ Knowledge Graph

  • Interactive force-directed graph of your entire vault
  • Nodes = notes, edges = semantic similarity
  • Color-coded by top-level topic folder
  • Drag, zoom, hover β€” powered by PyVis

πŸ“– Study Room

On-demand AI actions (button-click, no background processing):

  • Summarize β€” 3-5 sentence summary + key terms
  • Generate quiz β€” 4 Q&A pairs grounded in your notes
  • Explain simply β€” beginner-friendly re-explanation
  • Flashcards β€” JSON export for Anki/other tools
  • Structured notes β€” full standalone HTML page with sections, quizzes, and toggles
  • Reactive notes lab β€” AI generates typed blocks (text, list, quiz, image, reference) you can iteratively refine

✍️ Writer

Built-in note editor that saves directly into the notes/ hierarchy and triggers the watcher immediately.

πŸ“Š Insights

Stats about your vault: indexed count, most recent saves, topics by frequency.

🌳 Library

Notion-style sidebar view of your notes/ folder tree.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 notes/*.txt                  β”‚  ← You write here (any editor)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ file save
                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           watcher.py  (watchdog)             β”‚  ← Detects every .txt save
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ index (no LLM)            β”‚ analyze (background)
       β–Ό                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  ingest.py  β”‚             β”‚  live_agent.py   β”‚
β”‚ embed+store β”‚             β”‚ diff + vault RAG β”‚
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜             β”‚ β†’ Ollama (llama)  β”‚
      β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β–Ό                             β”‚ review JSON
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LanceDB   │◄────────────│  event queue     β”‚
β”‚  (vector   β”‚             β”‚  (deque, max 50) β”‚
β”‚   store)   β”‚             β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚ poll every 5s
                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚    ui.py (Gradio) β”‚  ← You see feedback here
                           β”‚  πŸ”΄ Live Agent tabβ”‚
                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

All AI runs locally β€” Ollama serves the llama3.2:1b model, BGE-small embeddings run via sentence-transformers. No data leaves your machine.


⚑ Quick Start

1. Prerequisites

  • Python 3.12+
  • Ollama installed and running
  • uv package manager (recommended) or pip

2. Install Ollama and pull the model

# Install Ollama from https://ollama.com/download (Windows/Mac/Linux)
ollama serve                    # start the Ollama server (leave running)
ollama pull llama3.2:1b         # download the model (~1 GB)

You can use a larger model (e.g. llama3.2:3b, mistral) by changing OLLAMA_MODEL in ai_engine.py and live_agent.py.

3. Clone and install dependencies

git clone <your-repo-url>
cd study-assistant

# Option A: uv (fast, recommended)
pip install uv
uv sync

# Option B: plain pip
pip install -r requirements.txt   # or: pip install gradio lancedb sentence-transformers watchdog requests pyvis pandas

4. Run

# With uv
uv run python main.py

# With plain Python
python main.py

The app will open at http://localhost:7860 in your browser.


πŸ“‚ Project Structure

study-assistant/
β”œβ”€β”€ main.py              # Entry point β€” starts watcher thread + Gradio UI
β”œβ”€β”€ watcher.py           # Watchdog observer β€” detects .txt saves, triggers indexing + live agent
β”œβ”€β”€ live_agent.py        # πŸ”΄ Live Study Agent β€” diff, vault RAG, Ollama review, event queue
β”œβ”€β”€ ai_engine.py         # On-demand RAG functions (summarize, quiz, explain, flashcards, …)
β”œβ”€β”€ prompts.py           # Prompt templates for all LLM calls
β”œβ”€β”€ ingest.py            # Clean β†’ embed β†’ LanceDB (no LLM)
β”œβ”€β”€ processor.py         # Text cleaning utilities
β”œβ”€β”€ ui.py                # Gradio dashboard (all 7 tabs)
β”œβ”€β”€ graph_viz.py         # Knowledge graph builder (PyVis)
β”œβ”€β”€ library_tree.py      # Folder tree renderer
β”œβ”€β”€ memory/
β”‚   β”œβ”€β”€ embedding.py     # BGE-small sentence-transformers wrapper
β”‚   └── vector_store.py  # LanceDB CRUD + search + insights
β”œβ”€β”€ notes/               # ← Write your .txt notes HERE (auto-created)
β”‚   └── Topic/
β”‚       └── Chapter/
β”‚           └── page.txt
β”œβ”€β”€ db/                  # LanceDB vector database (auto-created)
β”œβ”€β”€ output/              # Exported files (graph.html, flashcards.json, …)
└── pyproject.toml       # Dependencies

πŸ”΄ Using the Live Agent

  1. Start the app (python main.py) β€” the watcher starts automatically.
  2. Open the πŸ”΄ Live Agent tab in the Gradio UI.
  3. Edit any .txt file in the notes/ folder using your favourite editor.
  4. Save the file (Ctrl+S).
  5. Within ~10–30 seconds, the Live Agent tab will show a review card:
πŸ“„ `my_note.txt` Β· 14:32:07 Β· ✏️ +42 chars
πŸ”— Related vault notes: `ML/week2.txt`, `CS101/arrays.txt`

#### πŸ“š You've already studied this!
- Binary Search Trees (from `CS101/trees.txt`) β€” you covered AVL rotations here

#### βœ… What looks correct
- The definition of a node is accurate
- Time complexity of search is correctly stated as O(log n)

#### ⚠️ Wrong or incomplete
- ❌ Insertion complexity stated as O(1)
  - πŸ’¬ Fix: Insertion in a BST is O(log n) average, O(n) worst case

#### πŸ’‘ Next steps
- Add a comparison with AVL trees and Red-Black trees
- Cover the deletion algorithm with all 3 cases

> 🌟 Great progress β€” your understanding of tree fundamentals is solid!

The feed auto-refreshes every 5 seconds. Use Refresh now for instant update.


βš™οΈ Configuration

Setting File Default Description
LLM model ai_engine.py, live_agent.py llama3.2:1b Any Ollama-served model
Ollama URL ai_engine.py, live_agent.py http://localhost:11434 Change if Ollama runs remotely
Embedding model memory/embedding.py BAAI/bge-small-en-v1.5 Any sentence-transformers model
Notes directory ingest.py notes/ Relative to project root
Debounce delay watcher.py 2.5s Wait time after last file write
Agent feed size live_agent.py 50 events Max events kept in memory
UI refresh rate ui.py 5s gr.Timer interval

πŸ§‘β€πŸ’» Development

# Run just the watcher (no UI)
python watcher.py

# Run just the UI (no live-agent)
python -c "from ui import launch_ui; launch_ui()"

# Manually trigger the live agent on a file
python -c "
from live_agent import analyze_note_change
r = analyze_note_change('notes/test.txt', open('notes/test.txt').read())
import json; print(json.dumps(r, indent=2))
"

πŸ“‹ Dependencies

Package Purpose
gradio Web UI
watchdog File system monitoring
lancedb Local vector database
sentence-transformers BGE-small embeddings (local)
requests Ollama HTTP API
pyvis Knowledge graph visualization
pandas Data manipulation for LanceDB

πŸš€ Roadmap

  • Multi-file diff view in Live Agent
  • Spaced repetition scheduler based on vault history
  • Export vault to Anki deck (.apkg)
  • Support for .md and .pdf notes
  • Live Agent webhook / desktop notification

πŸ“„ License

MIT β€” use it, fork it, learn from it.


Built with ❀️ for learners who take notes. Powered by local AI β€” your data never leaves your machine.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages