Skip to content

BeastOfShadow/Cosmind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌌 Cosmind

Your second brain, mapped like a galaxy.

A fully local, privacy-first AI knowledge system. Drop in your messy Markdown notes β€” Cosmind's multi-agent pipeline turns them into linked atomic notes, lets you chat with your own archive (RAG), and renders the whole thing as a navigable 3D galaxy of ideas.

No cloud required. Your data never leaves your machine.

License: MIT Python Local-First RAG


Note

Why Cosmind? Most "chat with your notes" tools ship your private knowledge to someone else's servers. Cosmind runs the LLM, the embeddings, and the vector store entirely on your hardware (via Ollama + ChromaDB). Cloud models are optional, not required.

✨ Features

  • πŸ€– Multi-agent pipeline β€” a team of specialized AI agents (built on Agno) processes every note: a Splitter breaks text into atomic Zettelkasten notes, a Researcher enriches them from the web, a Vision agent reads images/screenshots, and a Lecturer writes literature-note summaries.
  • πŸ”’ Privacy-first & local β€” runs on Ollama (Qwen2.5, Llama3, Llama3.2-Vision). Set an OpenAI key only if you want cloud horsepower.
  • πŸ’¬ Chat with your vault (RAG) β€” ask questions; answers come only from your notes. If the answer isn't there, Cosmind offers to search the web instead.
  • 🌌 3D knowledge galaxy β€” explore your ideas in space. PCA for the 3D map, t-SNE for concept "islands", and a cosine-similarity knowledge graph that links related notes automatically.
  • 🧠 Atomic notes + knowledge graph β€” auto-generated derives from / leads to / similar links, Obsidian-compatible Markdown frontmatter.
  • ✍️ AI editor copilot β€” expand, fact-check, or "explain like a tutor" any selection, with web-cited sources.
  • πŸ–₯️ Web UI + CLI β€” a React/TypeScript frontend and FastAPI backend, or a simple terminal control panel.
  • 🐳 Dockerized β€” one command to spin up the whole stack.

πŸ›οΈ Architecture

                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   raw_notes/  ─────────▢│   Multi-Agent Pipeline    β”‚
   (your .md, images)    β”‚   (Agno)                  β”‚
                         β”‚  Splitter Β· Researcher Β·  β”‚
                         β”‚  Vision Β· Writer Β·        β”‚
                         β”‚  Lecturer                 β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚  atomic notes + embeddings
                                      β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Ollama /   │◀────────▢│   ChromaDB        │────────▢│  Visualizer        β”‚
   β”‚  OpenAI     β”‚  LLM +   β”‚  (vector store,   β”‚  PCA /  β”‚  3D galaxy Β· t-SNE β”‚
   β”‚             β”‚  embeds  β”‚   persistent)     β”‚  t-SNE  β”‚  Β· knowledge graph β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚   FastAPI backend      β”‚
                          β”‚   /api/chat Β· /process β”‚
                          β”‚   /visualize Β· /vault  β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚   React + TS frontend  β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quickstart

Option A β€” Local (Ollama)

# 1. Install Ollama and pull the models
ollama pull qwen2.5:14b
ollama pull llama3.2-vision   # for image notes
ollama pull nomic-embed-text  # local multilingual embeddings (RAG)

# 2. Configure
cp .env.example .env          # then edit if needed (LLM_MODEL=qwen2.5:14b)

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

# 4. Run the control panel
python main.py

Option B β€” Docker (full stack: API + web UI)

cp .env.example .env
docker compose up --build

Then open the frontend (Vite dev server / served container) and start dropping notes into raw_notes/.

Using cloud models (optional)

Set OPENAI_API_KEY in .env to route the agents through OpenAI instead of Ollama. Leave it empty to stay 100% local.

# .env
LLM_MODEL=qwen2.5:14b
EMBED_MODEL=nomic-embed-text # local embeddings β€” stays local even with OpenAI
CHUNK_SIZE=600               # words per chunk before embedding
CHUNK_OVERLAP=80             # word overlap between chunks
OPENAI_API_KEY=          # optional β€” leave blank for fully local
OPENAI_MODEL=gpt-4o-mini # used only if a key is set

Embeddings are always local. Even with an OpenAI key, notes are embedded via Ollama (EMBED_MODEL). Changing EMBED_MODEL changes the vector dimensionality β€” wipe .chroma_db (Docker volume chroma_data) and re-sync.

🧭 How to use

Run python main.py for the interactive panel:

Option What it does
πŸ“ Process notes Ingests raw_notes/, splits into atomic notes, links them, indexes into the vector DB
πŸ’¬ Chat with brain RAG query β€” answers grounded only in your notes, with sources
🌌 View 3D map Generates the interactive galaxy of your knowledge
πŸ”„ Sync database Reconciles the vector DB with the files on disk

πŸ”Œ API

The FastAPI backend exposes:

Method Endpoint Purpose
POST /api/chat RAG query over your vault
POST /api/chat/web-search Web-search fallback
POST /api/process Run the agent pipeline on raw_notes/
GET /api/visualize 3D / 2D / graph data
GET /api/vault Browse indexed chunks
GET/POST /api/notes List / create notes
POST /api/upload Upload images for the vision agent
POST /api/editor/ai Editor copilot (expand / validate / tutor)

πŸ› οΈ Tech stack

Python Β· Agno (agents) Β· Ollama Β· OpenAI Β· ChromaDB Β· scikit-learn (PCA / t-SNE) Β· FastAPI Β· TypeScript Β· React + Vite Β· Docker

πŸ—ΊοΈ Roadmap

  • Incremental indexing (only re-embed changed notes)
  • Local embedding models (drop the last cloud dependency)
  • Export the knowledge graph to Obsidian Canvas
  • Tests + CI

πŸ“„ License

MIT Β© 2026 Simone Negro