Skip to content
law4percentPublic

About

A local-first AI companion: hears you, remembers, reasons, feels, and speaks back. Runs entirely locally after the required models and dependencies are installed; no cloud APIs are used by the conversation pipeline.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

3 Commits

Folders and files

Repository files navigation

Bella

A local-first AI desktop companion: hears you, remembers, reasons, feels, and speaks back β€” entirely on your own machine.

Status: v0.1.0 is an experimental open-source release. This is a curated snapshot of the author's private daily-use instance, not a live mirror of it β€” some experimental work, personal history, and in-progress features are intentionally not published here. bella init asks for your name on first run and Bella addresses you by it from then on; the repo itself contains no person's name or example identity baked in.

Overview

Bella runs a full conversation loop β€” microphone in, speech out β€” using only local models and local services. No cloud APIs are used by the conversation pipeline: speech recognition, the language model, memory storage, and speech synthesis all run on your machine.

Features

  • Local LLM conversation via Ollama
  • Local speech-to-text (whisper.cpp) and text-to-speech (Qwen3-TTS/MLX)
  • Deterministic emotion and stage-direction handling β€” Bella's emotional state is read from explicit stage directions in her own reply, not inferred by a second model
  • Persistent personal memory (facts, preferences, relationships, experiences) with explicit remember/forget and automatic acquisition from natural statements β€” see Memory
  • Post-generation speech segmentation for lower time-to-first-audio (docs/v0.10-streaming-speech-design.md)
  • Microphone capture isolated into a killable child process, so a stuck recording can't hang the whole session (docs/v0.11.2-recording-worker-isolation.md)
  • A first real skill β€” grounded, real-clock "what time is it" answers instead of an LLM guess (docs/v0.12-first-skill-time.md)

Architecture

Overview: what Bella is made of

flowchart LR
    subgraph BELLA["BELLA β€” local AI companion"]
        direction LR

        subgraph Perception["🎀 PERCEPTION"]
            STT["Whisper.cpp<br/>base.en<br/><br/>sounddevice"]
        end

        subgraph Brain["🧠 BRAIN"]
            Mem["MemoryManager<br/>SQLite + Markdown"]
            LLM["Ollama<br/>llama3.1:8b"]
            Rules["EmotionEngine<br/>RuleEmotionDetector"]
        end

        subgraph Expression["πŸ—£οΈ EXPRESSION"]
            Resp["BellaResponse<br/>emotion Β· intensity<br/>expression Β· behavior"]
            TTS["Qwen3-TTS<br/>MLX Β· 0.6B Β· 8-bit<br/>voice=serena"]
        end

        Perception --> Brain --> Expression
    end
Loading

Stack at a glance

Layer Technology Role
🎀 Perception Python + sounddevice Captures microphone audio
🎀 Perception whisper.cpp + base.en Local speech-to-text
🧠 Brain Python Brain Orchestrates conversation
🧠 Brain SQLite + Markdown Persistent memory
🧠 Brain Ollama + llama3.1:8b Local language model
🧠 Brain EmotionEngine / RuleEmotionDetector Deterministic emotion detection
πŸ—£οΈ Expression BellaResponse Structured response contract
πŸ—£οΈ Expression Qwen3-TTS + MLX Local text-to-speech
πŸ—£οΈ Expression Serena voice + seed 123 Locked Bella voice

How it works internally β€” the precise data flow

flowchart LR
    subgraph LOCAL["Local machine β€” no cloud APIs in this path"]

        Mic(("🎀 Microphone"))
        SD["Python<br/>sounddevice"]
        WAV1["WAV audio"]

        STTP["WhisperCppProvider"]
        WS[["whisper-server<br/>whisper.cpp<br/>base.en<br/>localhost:8080"]]
        Text["Transcribed text"]

        subgraph BRAIN["🧠 Brain β€” Python"]
            Memory["MemoryManager<br/>SQLite + Markdown"]
            LLM[["Ollama :11434<br/>llama3.1:8b"]]
            Emotion["EmotionEngine<br/>RuleEmotionDetector"]
        end

        Resp[["BellaResponse<br/>speech Β· emotion Β· intensity<br/>expression Β· behavior Β· duration_ms"]]

        TTSP["MlxQwen3TTSProvider"]
        QTTS[["Qwen3-TTS<br/>MLX Β· 0.6B Β· 8-bit<br/>voice=serena Β· seed=123"]]

        WAV2["Generated WAV"]
        SD2["Python<br/>sounddevice"]
        Speaker(("πŸ”Š Speaker"))

        Mic --> SD --> WAV1 --> STTP
        STTP -->|"HTTP :8080"| WS
        WS --> Text
        Text --> BRAIN

        BRAIN --> Resp
        Resp --> TTSP
        TTSP --> QTTS --> WAV2 --> SD2 --> Speaker
    end
Loading

Runtime: Python / .venv with the bella CLI. Ollama and whisper-server run as local HTTP services; Qwen3-TTS runs in-process through MLX on Apple Silicon (docs/platform-portability.md). Nothing in the conversation pipeline requires a cloud API.

The bella start/status/stop/doctor/suggest runtime CLI is an orchestration layer outside the conversation pipeline β€” it manages starting Ollama and whisper-server, not part of the audio β†’ intelligence β†’ audio path itself.

Design principles

  • Every external capability sits behind a swappable interface β€” LLMProvider, STTProvider, TTSProvider, EmotionDetector, MemoryRetriever. Brain never knows which concrete implementation it's holding.
  • Deterministic where possible. Memory acquisition/retrieval, emotion detection, and query classification are regex/rule-based, not LLM calls β€” see Memory. The one place LLM-driven behavior is deliberately allowed to live is Bella's personality prompt (bella/personality.py).
  • Fails loudly, not silently. If a dependency Bella started crashes mid-conversation, she stops and points at bella status rather than silently reconnecting.

Memory

Bella has persistent personal memory in addition to temporary conversation context.

  • Session memory β€” conversation context exists only while that bella start process is running.
  • Persistent memory β€” facts, preferences, relationships, and experiences survive an application restart (data/bella.db + lei/knowledge/).
  • Explicit memory β€” "Bella, remember that ..." / "Bella, forget that ...".
  • Automatic acquisition β€” Bella recognizes certain natural first-person statements without an explicit remember command, e.g. "My phone is on the desk" or "I moved my phone to my bedroom."
  • Evolving facts β€” a later statement about the same subject replaces the active value while prior values are kept in history (e.g. phone_location: kitchen table β†’ bedroom β†’ desk).
  • Deterministic retrieval β€” acquisition and retrieval are both regex/keyword-based, not LLM calls. Bella does not currently use vector/semantic memory retrieval.
  • Memory-query grounding β€” when a question looks like a request to recall a specific fact ("where is my...", "do you remember...") and nothing matches, Bella is explicitly told no memory was found rather than being left free to guess. Ordinary conversation is unaffected.

Full design and real-Ollama verification (including a real restart between "tell Bella something" and "ask Bella about it"): docs/v0.11-memory-acquisition-design.md, docs/v0.11.1-memory-query-grounding-investigation.md.

Requirements

  • macOS on Apple Silicon, for the local text-to-speech engine (Qwen3-TTS via MLX only runs there) β€” everything else (Ollama, whisper.cpp, microphone/speaker, memory, conversation logic) is portable to Intel Mac/Windows/Linux, just without generated speech. See docs/platform-portability.md.
  • Python 3.12+
  • Ollama, with llama3.1:8b pulled
  • whisper.cpp's whisper-server, with the ggml-base.en.bin model

bella doctor (below) checks all of this for you and tells you exactly what's missing.

Bella v0.1.0 was developed and tested with Python 3.12.7. Other 3.12+ versions are expected to work but have not been individually validated.

Installation

python3 -m bella init

Creates .venv (if it doesn't already exist), installs Bella and her dependencies into it, and β€” first run only β€” asks for your name so Bella can address you and bind her memory to you. No need for .venv to exist yet, or for anything to be installed beforehand; it runs against bare system Python. Safe to re-run any time: it never touches system Python and never re-asks for your name once it's configured.

Verify it installed:

.venv/bin/bella --help

Activate the virtualenv (source .venv/bin/activate) to drop the .venv/bin/ prefix and just run bella ....

Quick Start

bella doctor   # check the environment β€” purely diagnostic
bella suggest  # if something's missing, tells you what to do about it
bella start    # starts Ollama/whisper-server if needed, launches Bella

bella start checks Ollama and whisper-server, starts whichever aren't already running, and launches the live conversation loop. You don't need separate terminals for Ollama, whisper-server, and Bella herself.

Add --streaming to speak each reply piece by piece as it's segmented, instead of waiting for one TTS call covering the whole reply β€” lower time to first audio (docs/v0.10-streaming-speech-design.md):

bella start --streaming

Other commands

Command What it does
bella init Creates .venv (if missing), installs Bella + dependencies (--dev for the test suite too), and asks for your name on first run
bella status Shows what's running and who owns it (Bella vs. started manually)
bella stop Stops only the services Bella itself started
bella doctor Diagnoses the environment
bella suggest Recommends next steps for anything failing

Every command has its own help (bella start --help, etc.), and bella --version prints the installed version.

Runtime ownership

Bella only ever stops processes it started itself β€” if you started ollama serve manually, bella stop leaves it running untouched. If a Bella-started dependency crashes mid-conversation, Bella fails loudly and points at bella status rather than silently restarting it. Full design: docs/v0.9-runtime-cli-design.md.

Moving Bella to another machine

bella doctor is the entry point for checking what a new machine supports before running Bella there β€” e.g. Bella's TTS currently requires Apple Silicon. A bella setup command for automatic platform-specific installation is intentionally not built yet.

Configuration

The only configuration is your name, collected once by bella init and stored at .bella/config.json (gitignored, never committed β€” see Installation). There's no config file to hand-edit: delete .bella/config.json and re-run bella init to reconfigure.

Extending Bella

Every external capability β€” the LLM, speech-to-text, text-to-speech, emotion detection, memory retrieval β€” sits behind a small interface (bella/llm/base.py, bella/stt/base.py, bella/tts/base.py, etc.), so a new implementation can be swapped in without changing Brain.

Bella currently has one real "skill" beyond conversation itself β€” grounded real-clock time answers (bella/skills/time.py). It's deliberately hardcoded rather than built behind a plugin registry: the project's own position is that a skill registry is worth building once a second and third real skill show what's actually shared between them, not speculatively from one data point. If you want to add a new skill, open an issue or PR to discuss the shape first β€” see Contributing.

Development

python3 -m bella init --dev
.venv/bin/python -m pytest -q

(--dev additionally installs requirements-dev.txt, i.e. pytest, on top of Bella's own dependencies.)

import bella
bella.respond("Bella, I'm tired.")

bella.respond() runs on a MockLLMProvider (bella/llm/mock.py) behind the LLMProvider interface (bella/llm/base.py) when no real provider is wired in. The live pipeline (bella start) uses OllamaLLMProvider, WhisperCppProvider, and MlxQwen3TTSProvider instead.

Roadmap

Shipped so far: stage-direction robustness, streaming speech (post-generation segmentation), memory acquisition/forget with query-grounding (no invented answers when nothing is stored), isolated recording capture, and a first real skill (grounded time answers).

Deliberately not built yet, not forgotten:

  • Semantic/vector memory retrieval β€” only if deterministic retrieval becomes an actual bottleneck
  • LLM-assisted memory-acquisition extraction β€” only once natural-language variants become numerous and genuinely hard to distinguish deterministically, not because the trigger rules grew
  • Structured LLM response output (JSON/IDs instead of prose markers) β€” only if the current prose-marker protocol shows real vocabulary growth or parsing collisions
  • A capability/skill registry β€” once a second and third real skill exist to show what's actually shared between them
  • Time-zone/composition capabilities, device integration (Android/Raspberry Pi/ESP32) β€” future

The guiding rule: wait for a pattern or a concrete failure before generalizing, rather than building ahead of evidence.

Contributing

Bug fixes, tests, documentation, and well-scoped improvements are welcome β€” see CONTRIBUTING.md for how to get set up and what to keep in mind before opening a PR.

Research and Citation

Bella is available for research, experimentation, and extension. Researchers may use, evaluate, modify, and build upon the project according to the repository license. If Bella contributes materially to your work, please cite the repository β€” see CITATION.cff.

Acknowledgements

Bella uses and builds upon the work of:

  • Ollama for local language-model serving
  • whisper.cpp for local speech recognition
  • MLX and Qwen3-TTS for local speech synthesis

Thanks to the developers and maintainers of these projects and the wider open-source community. Bella is not affiliated with any of them.

License

MIT β€” see LICENSE.

About

A local-first AI companion: hears you, remembers, reasons, feels, and speaks back. Runs entirely locally after the required models and dependencies are installed; no cloud APIs are used by the conversation pipeline.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages