Harvey is a polite, privacy-focused local AI assistant running completely offline on Apple Silicon (optimized for M4 MacBooks). It integrates a local Llama 3 LLM via MLX, a Retrieval-Augmented Generation (RAG) system powered by Chroma DB and local HuggingFace embeddings, and local Kokoro TTS voice synthesis.
The project consists of a Python FastAPI backend (harvey.py) and a native macOS SwiftUI frontend client (HarveyMacApp).
- Backend Framework: FastAPI & Uvicorn
- Language Model: Meta-Llama-3-8B-Instruct-4bit (executed natively on Apple Silicon via
mlx-lm) - Vector Database: Chroma DB (
./chroma_db) - Text Embeddings:
nomic-ai/nomic-embed-text-v1.5(vialangchain-huggingface) - Text-to-Speech (TTS): Kokoro ONNX local model (
kokoro-v1.0.onnx,voices-v1.0.bin) - Frontend App: Native macOS SwiftUI App (
HarveyMacApp)
harvey/
├── harvey.py # Main FastAPI backend server and MLX execution engine
├── ingest.py # RAG document ingestion script with file manifest tracking
├── fetch_docs.py # Utility script to download local developer documentation
├── data/ # Raw documentation sources (ignored by Git)
├── memories/ # Long-term user preferences and memory files (ignored by Git)
├── chroma_db/ # Persistent local vector database (ignored by Git)
├── ingested_manifest.json # Local file modification manifest (ignored by Git)
└── HarveyMacApp/ # Native SwiftUI macOS desktop interface
- macOS 14.0 or later (Apple Silicon recommended: M1/M2/M3/M4)
- Python 3.10+
- Xcode 15+ (for building the SwiftUI macOS app) or VS Code
Create and activate a Python virtual environment:
python3 -m venv .venv
source .venv/bin/activate
Install the required Python dependencies:
pip install --upgrade pip
pip install mlx mlx-lm fastapi uvicorn psutil soundfile kokoro-onnx \
langchain-huggingface langchain-chroma langchain-community \
langchain-text-splitters tqdm
Ensure the local voice synthesis files are present in the project root directory:
kokoro-v1.0.onnxvoices-v1.0.bin
(Note: These model binaries are ignored by Git due to file size).
To download offline copies of developer documentation (MDN, Python, FastAPI, Swift, etc.):
python fetch_docs.pyTo process text chunks and populate Chroma DB:
python ingest.pyingest.py tracks file timestamps in ingested_manifest.json to process only new or modified files on subsequent runs.
You can start the backend manually using Python:
python harvey.pyThe server runs locally at http://127.0.0.1:8000.
Open the HarveyMacApp project in Xcode:
- Open Xcode and select the
HarveyMacAppdirectory. - Build and run the project (
Cmd + R).
Note: The macOS application will automatically spawn and manage the harvey.py backend process upon launch if it is not already running.
GET /api/metrics: Returns system RAM, CPU usage, process memory, and Mac thermal state.POST /api/chat: Streams conversation completions using Server-Sent Events (SSE).POST /api/tts: Converts text input to WAV audio streams via local Kokoro TTS.
The backend explicitly sets HF_HUB_OFFLINE=1 and TRANSFORMERS_OFFLINE=1 to enforce complete network isolation during execution.
All vector searches, LLM inference, and voice synthesis happen 100% locally on device.