A Local Cognitive Operating System for macOS
BrainLab OS is a local, privacy-first cognitive system designed to simulate key aspects of human thought — memory, reflection, and association. It runs entirely offline on macOS and leverages local LLM inference via Ollama (Llama 3.1). This project demonstrates how a personal AI agent can store, recall, and reason about experiences using modular memory systems and graph-based reflection.
| Module | Function |
|---|---|
| memory.py | Stores and retrieves memories using FAISS + SQLite |
| reflection.py | Performs LLM-based summarization and reasoning |
| graph_analysis.py | Visualizes semantic connections between stored memories |
| brain.py | Natural-language conversational interface |
| brain (CLI script) | Enables global terminal interaction: brain "..." |
- Memory Layer (Hippocampus): Encodes input text into vector embeddings using sentence-transformers and stores them in FAISS and SQLite.
- Reflection Layer (Cortex): Uses Llama 3.1 (via Ollama) to synthesize insights and summarize recent activity.
- Visualization Layer (Perceptual Network): Builds a similarity graph of ideas using NetworkX and Matplotlib.
- Interface Layer (Prefrontal Cortex): The brain.py interface allows users to converse naturally, with context from recent memories shaping LLM responses.
- macOS (tested on Apple Silicon M3 Pro)
- Python 3.9+
- Ollama installed (brew install ollama)
- Model pulled locally (ollama pull llama3.1)
git clone https://github.com/rohanbalixz/BrainLab.git
cd BrainLab
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtIf no requirements.txt yet, manually install:
pip install numpy==1.26.4 torch==2.1.0 faiss-cpu==1.7.4 transformers==4.35.2 sentence-transformers==2.2.2 huggingface-hub==0.19.4 matplotlib networkxRun the brain in natural language:
brain "hello"
brain "add I studied small-world networks"
brain "recall graph theory"
brain "reflect"
brain "visualize"Everything runs locally — no external API calls, no internet dependency.
$ brain "hello"
Hello. How have you been today?
$ brain "what's up"
Not much. I’ve been thinking about our last discussion on network theory.
$ brain "reflect"
I noticed your interests revolve around complex systems and AI design.
They seem deeply interconnected through ideas of modularity and resilience.This project was developed as a Master's in Data Science capstone to explore how symbolic cognition, neural embeddings, and local inference can form the foundation of a personal knowledge operating system.
- Add long-term memory consolidation (periodic compression of embeddings)
- Integrate emotion tagging and mood context
- Introduce event-driven reflection scheduling
- Add voice-based interface layer (macOS Speech APIs)
Rohan Bali
M.S. Data Science, University of Massachusetts Dartmouth
GitHub: rohanbalixz
LinkedIn: rohan-bali-301345293