HiveMind Protocol - A Local-First, Privacy-Preserving Architecture for Agentic RAG
HiveMind Protocol - A Local-First, Privacy-Preserving Architecture for Agentic RAG
by Virtue_hearts (Darknet.ca Labs)
HiveMind is a local-first, edge-augmented RAG protocol that treats memory as portable, hot-swappable artifacts called EMUs (Encapsulated Memory Units) — instead of giant monolithic vector databases.
This repository is also the framework for HiveMind LLM 3.0 — a next-generation model designed to compete with xAI and OpenAI and push toward AGI. Explore the roadmap in Future_HiveMind_LLM.md.
npm)git clone https://github.com/virtuehearts/HiveMind.git
cd HiveMindnpm installcurl -fsSL https://ollama.com/install.sh | sh
# Smallest default: 1.5B parameters
ollama pull qwen2.5:1.5b-instructnpm run dev:servernpm run dev:webOPENROUTER_API_KEY in your environment (or .env) before running enrichment jobs so the backend can stream responses. You can override the default model with OPENROUTER_MODEL.Xenova/all-MiniLM-L6-v2. The first run downloads the model to your transformers cache; ensure the machine can reach the model hub or pre-seed the cache (e.g., via TRANSFORMERS_CACHE).HiveMind ScriptUse the bundled HiveMind shell script in the repo root to manage the full stack (Ollama, backend, and web UI). It stores PID files and logs under .hivemind/ so you can start/stop services cleanly.
# Install Ollama if needed, pull qwen2.5:1.5b-instruct, and start everything
./HiveMind install
# Start all services (assumes dependencies are already installed)
./HiveMind start
# Check process status (ollama / server / web)
./HiveMind status
# Stop everything
./HiveMind stopLogs live in .hivemind/logs/ for each component (Ollama, server, and web). Use ./HiveMind help to see all available commands.
ollama pull qwen2.5:1.5b-instruct.npm install (this sets up both the backend and the Vite frontend).npm run dev:server (default: http://localhost:4000).npm run dev:web (default: http://localhost:5173).The frontend uses the backend router endpoints (/api/route and /api/chat) to exercise the local Qwen2.5 1.5B router before the rest of the RAG stack is added. The compact default keeps RAM use low enough for 8GB laptops while still enabling routing and chat.
It is designed to run on: ✅ Consumer CPUs (8–16GB RAM) — Qwen2.5 1.5B stays under ~4GB RAM ✅ NVIDIA RTX GPUs (6GB VRAM) while delivering 40–50 tokens/sec using quantized SLMs.
/emus to list, /mount , /unmount , and /reset..emu under emus/, refresh, then mount and ask questions to see retrieved context in the preview panel.http://localhost:4000.HiveMind is the anti-enterprise RAG:
no lock-in, no cloud dependency, no surveillance, no massive vector silos.
Current enterprise RAG systems are fundamentally flawed:
❌ Privacy Risk — They transmit entire context windows (including PII) to cloud LLMs
❌ Latency — Remote vector DB round-trips slow the entire pipeline
❌ Cost — Tokens wasted on irrelevant noise
❌ Vendor Lock-In — Memory trapped inside proprietary cloud systems
❌ Monolithic Databases — Giant, static vector stores nobody can fork or share
Local memory. Cloud inference. Zero noise. Maximum privacy.
Your machine becomes the router, filter, and guardian at the gate.
Encapsulated Memory Units are portable, Git-friendly knowledge capsules:
my-dataset.emu/
├── vectors.lance # LanceDB file-based embeddings
├── metadata.json # Tags, attribution, version info
└── config.yaml # Embedding model + retriever settingsKnowledge becomes modular.
Knowledge becomes a file.
Knowledge becomes yours.
Runs entirely on CPU/GPU locally
Models: Qwen 2.5 (1.5B–3B) / Phi-3.5
Tasks:
Gemini / Claude / GPT / OpenRouter
because only relevant, cleaned, graded chunks make it upstream.
User Input
↓
intent_router (Local SLM)
↓ (Context Needed)
retriever (LanceDB Hybrid Search)
↓
grader (Local SLM, PII Filter, Relevancy Scoring)
↓
synthesizer (Cloud LLM)
↓
Client OutputA stategraph with conditional edges ensures deterministic routing and fine-grained agent control.
Before a cloud LLM sees anything, HiveMind:
✔ Runs intent classification locally
✔ Filters irrelevant retrievals
✔ Removes PII
✔ Compresses + rewrites chunks into minimal gold context
Cloud LLM only receives clean, tiny, relevant context.
Mount/unmount knowledge in real time:
hivemind mount poetry.emu
hivemind mount python-docs.emu
hivemind unmount legal-v1.emuNo monolithic DB.
No global vector mess.
Zero noise.
| Layer | Technology | Role |
|---|---|---|
| Workflow Engine | LangGraph | Agentic DAG pipeline |
| Local Inference | Ollama / vLLM | SLM execution |
| Vector Store | LanceDB | Serverless file-based memory |
| Router SLM | Qwen 2.5 / Phi-3.5 | Intent classification + routing |
| Cloud LLM | Gemini 3.0 / Claude / GPT | Final synthesis |
| Frontend | Web Console / API | Integration layer |
metadata:
name: "Classic English Poetry"
version: "v1.2"
creator: "John Doe"
timestamp: "2025-11-23T14:00:00Z"
embeddings:
model: "all-MiniLM-L6-v2"
dimension: 384
retriever_settings:
k_neighbors: 5
max_score_threshold: 0.82EMUs are zipped bundles that run locally, privately, offline.
| Status | Value |
|---|---|
| CPU/GPU Target | Consumer CPU or NVIDIA RTX (6GB) |
| Throughput | 40–50 tokens/sec (quantized SLM) |
| Architecture | Local-First / Edge-Augmented |
| Core Feature | EMU Capsules |
✅ EMU file format
✅ Python EMU mount/unmount
✅ HiveMind Console
✅ LangGraph integration
⬜ Public EMU Browser
⬜ EMU Registry
⬜ IPFS Distribution
⬜ Torrent-based Swarms
⬜ Community Knowledge Marketplace
⬜ Auto-build EMUs using Gemini
⬜ Domain-specific EMU builders
⬜ Self-healing “Teach HiveMind” loops
HiveMind is building the world’s first fully local-first Agentic RAG protocol:
Your data stays yours.
Your memory stays local.
Your agents become sovereign.
Created by Warren Kreklo
Darknet.ca Labs (Est. 2003)
[email protected]
@virtue_hearts
No open issues yet, or sync has not completed.