Skip to content
ha466Public

About

On-device, hands-free personal AI companion voice system

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

iris_core

iris_core is an on-device, hands-free personal AI companion voice system running 100% locally on your hardware with sub-second response times, zero cloud dependencies, persistent multi-session memory, and emotional intelligence.


🌟 Key Features

  • Local MoE Language Model: Powered by Ling-3.0-tiny Q4_0 (7.9B total / 1.3B active MoE parameters) via llama-server with --jinja template parsing and Q8 KV caching. Clean spoken dialogue generation with disabled thinking mode to avoid TTS delays.
  • Sub-Second Voice Pipeline:
    • STT: Fast on-device transcription with Parakeet 110M GGUF via parakeet-server (~180ms latency).
    • TTS: High-fidelity speech synthesis with distilled Kokoro-7M (~0.095 RTF / 10.5x real-time on CPU).
    • VAD: Pipecat Silero VAD (ONNX runtime) with acoustic feedback gating and barge-in support.
  • Persistent SQLite Memory System:
    • Hybrid retrieval combining SQLite FTS5 full-text keyword matching and vector cosine similarity.
    • Multi-session conversation history that survives restarts.
    • Episodic memory summaries and soft-delete fact lifecycle.
    • Natural-language memory commands: "remember that...", "forget that...", "I changed my city to...", "what do you remember about me?", "keep this conversation private".
  • Emotional & Companion Intelligence:
    • Real-time emotional tone detection (frustration, stress, joy, sadness, curiosity) dynamically adjusting conversational warmth.
    • Adaptive spoken token budgeting (80 tokens for greetings, 160 tokens for conversational dialogue, 384 tokens for deep explanations or stories) preventing TTS rambling.
    • Non-blocking background fact extraction.

📁 Repository Structure

iris_core/
├── setup.py                  # Automated downloader for server binaries and models
├── config.py                 # Centralized configuration (ports, models, sampling, prompts)
├── main.py                   # Main entry point with hands-free terminal interface
├── benchmark.py              # End-to-end latency and synthesis benchmark script
├── pyproject.toml            # Python project dependencies
├── core/
│   ├── audio/                # Audio device management & stream handling
│   ├── mem/                  # SQLite schema, FTS5 triggers, MemoryManager & RuleMemory
│   │   ├── schema.sql        # Database schema for memories, FTS, conversations, episodes
│   │   ├── manager.py        # SQLite ACID manager with WAL mode and hybrid search
│   │   ├── memory.py         # Fast rule-based routing & retrieval
│   │   ├── extractor.py      # STT cleaning & fact extraction
│   │   └── memory_store.json # Initial empty store template
│   ├── pipeline/             # Companion brain, LLM streaming, STT client, VAD segmenter
│   │   ├── companion.py      # CompanionBrain with emotional detection and adaptive budgeting
│   │   ├── llm_client.py     # SSE streaming client for llama-server
│   │   ├── stt_client.py     # Parakeet STT HTTP client
│   │   ├── orchestrator.py   # Asynchronous audio orchestrator & TTS worker
│   │   └── chunker.py        # Streaming sentence chunker
│   ├── servers/              # Server process manager (llama-server & parakeet-server)
│   └── tts/                  # Kokoro-7M synthesizer & model loaders
└── tests/                    # Comprehensive unit and integration test suites
    ├── test_companion_intelligence.py
    ├── test_memory_intelligence.py
    ├── test_memory_sqlite.py
    └── test_components.py

🚀 Getting Started

1. Prerequisites

  • uv (Fast Python package and project manager)
  • Windows x64 (or Linux/macOS with appropriate binaries)

If uv is not yet installed on Windows:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

2. Environment Setup (Sync Dependencies)

Clone the repository and sync dependencies:

git clone https://github.com/ha466/iris_core.git
cd iris_core

# Automatically creates .venv and synchronizes all dependencies from uv.lock
uv sync

3. Automated Model & Binary Setup

Run the automated installer with uv run to download and configure core/bin server executables (llama-server.exe & parakeet-server.exe), core/modal speech/language models (Ling-3.0-tiny & Parakeet), and core/tts voice weights:

# Automatically download and unpack all required models and binaries
uv run setup.py

# Or verify asset status without downloading:
uv run setup.py --check

4. Running the Companion

Launch the hands-free voice companion:

uv run main.py

🧪 Testing & Benchmarks

Run the complete test suite directly with uv run:

# Unit & integration tests
uv run tests\test_companion_intelligence.py
uv run tests\test_memory_intelligence.py
uv run tests\test_memory_sqlite.py
uv run tests\test_components.py

# End-to-end performance benchmark
uv run benchmark.py

🧪 Performance Measurement

Run a repeatable local pipeline benchmark:

uv run benchmark.py --runs 3 --output latency-results.json

The benchmark starts the local inference servers, uses synthesized speech clips, and writes sample memory into a temporary database so it cannot alter the user's saved memories. It reports the first request separately, then warm p50/p90 results for STT, memory, LLM time-to-first-token, first generated PCM, and full response generation plus synthesis. It does not play audio through the speakers; the live app separately logs the first output-device callback.

The previous latency table was removed because its “first audio” timestamp was recorded after full synchronous synthesis and its memory/LLM timings did not match the current single-response path. Re-run the benchmark on the target machine before using absolute latency figures.

Latest local run

Recorded on 2026-10-25 with 8 logical CPU threads, llama.cpp at 4 threads, Kokoro at 1 thread, and 3 warm runs per scenario. The p90 is the maximum of these three samples.

Scenario Memory lookup p50 / p90 First generated PCM p50 / p90 Generation + synthesis p50 / p90
Personal memory 0.41 / 0.48 ms 1.885 / 1.971 s 2.064 / 2.122 s
Companion chat 0.38 / 0.45 ms 0.847 / 0.865 s 1.309 / 1.375 s
General chat 0.39 / 0.50 ms 1.163 / 1.489 s 2.140 / 3.167 s

The cold personal-memory sample took 2.355 s to first PCM and 3.186 s for generation plus synthesis. These figures exclude audio playback; the full raw run is in latency-results.json.

CPU thread controls

Defaults are chosen from the available logical CPU count. For local tuning, set one or more environment variables before launch:

Variable Controls
IRIS_LLAMA_THREADS llama.cpp token generation threads
IRIS_LLAMA_BATCH_THREADS llama.cpp prompt and batch processing threads
IRIS_LLAMA_PARALLEL llama.cpp request slots (default 1 for this single-user companion and reusable prompt cache)
IRIS_PARAKEET_THREADS Parakeet transcription threads
IRIS_TTS_THREADS Kokoro PyTorch CPU threads
IRIS_MEMORY_EMBED_THREADS Memory embedding threads

About

On-device, hands-free personal AI companion voice system

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages