↑ resurface

Open Source · NOV 02, 2026 · 6 MIN READ

Ba-Chan: An On-Device AI Companion for Your Mac and iPhone


Ba-Chan is a tiny on-screen companion that lives in your Mac's menu bar and fills your iPhone screen. It has a cute animated face, hearing, a voice, an on-device brain, long-term memory, and eyes that can see your camera or your screen. No servos, no cloud, no API keys. It is inspired by the open-source M5Stack Stackchan desktop robot and reimplements its three charming software ideas — a procedural face, amplitude-driven lip-sync, and a small conversational loop — as pure software, then grows them into something that remembers and evolves.

Ba-Chan — an animated procedural face that blinks, breathes, and watches
fig. 01 — A face drawn from a handful of numbers: it blinks, breathes, and watches.
View Ba-Chan on GitHub ↗
MIT Licensed — native SwiftUI for macOS and iOS

A Face Drawn From Numbers

The face is drawn procedurally in a SwiftUI Canvas — not a single image asset. It blinks, breathes, wanders its gaze, dozes off, and reacts to touch: poke its eyes and it gets annoyed; pat its head and it blushes. Idle long enough and it reads a book, makes tea, hums, or falls asleep. Moods are driven by [mood] tags the model emits. On the Mac its eyes follow your pointer, and over days and weeks its resting look drifts a little — Ba-Chan slowly becomes its own.

Private by Default, at Every Layer

LayerHow It Works
VoiceMic → on-device speech-to-text → brain → text-to-speech, with lip-sync tracking the real loudness of the voice. Off by default; typing always works.
Brain (macOS)A local Ollama server, gemma3 by default
Brain (iOS)Gemma 3n on-device via MLX, or Apple FoundationModels on iOS 26+
FallbackA rule-based ScriptedBrain, so the loop runs with no model at all
MemoryApple NLEmbedding + cosine similarity + JSON, nightly distillation, and a time-aware conversation journal
EyesApple Vision for objects, scene, text, and faces; on macOS it can glance at your screen when you ask

Cloud brains — Claude, OpenAI, Gemini, OpenRouter — exist, but are opt-in and explicitly break the no-keys default; keys live only in the Keychain. The brain is a one-protocol seam, so adding a model is a single new file. On the Mac, Ba-Chan also speaks first: it notices the app you're in and how long you've been heads-down, says good morning, welcomes you back after a break, and nudges you to stretch.

The Garden: Habits That Live, Compete, and Die

On macOS, Ba-Chan's small behaviours — the shape of a morning greeting, the way a page gets summarised, when a memory is worth bringing up — are plain-text organisms. Each file carries its behaviour and its own copy instructions. The local model acts as the constructor: when an organism has earned enough energy, it reproduces with one deliberate variation, following the organism's own instructions, so how reproduction works is itself something that evolves.

The economy is honest. Energy enters only when Ba-Chan genuinely helps — a proactive line you actually answer, a conversation that keeps going — and everything costs: being alive, being used, reproducing. Each niche holds three organisms at most; a newborn displaces the weakest elder, juveniles are protected, and whatever starves is composted. Day one changes nothing — the founding seeds transcribe exactly what Ba-Chan already does — and every birth, earning, and death is written to a plain-text journal.

Then there is the sleep cycle. A host-side script, garden/consolidate.py, distils the habits that keep proving themselves into training examples and LoRA-tunes them into the local model with mlx-lm, gated by a fixed set of canary prompts: if the adapted model breaches the character's foundation, the adapter is discarded. What earns its keep in conversation slowly becomes instinct in the weights — delete the organism, and the habit remains.

Build and Run

bash
# Requires Xcode 26+. macOS brain: a local Ollama server
brew install --cask ollama-app
ollama pull gemma3:4b        # or gemma3:12b on a 24 GB+ Mac

open BaChan.xcodeproj         # pick "My Mac", then Run

Ba-Chan's face appears in the menu bar: left-click for the full face panel, right-click for Settings. On iPhone, pick a device and Run; the on-device Gemma model is a one-time confirmed download. Without Ollama running, Ba-Chan falls back to its scripted replies.

Why We Built It

Most of our work is enterprise agent infrastructure. Ba-Chan is the opposite end of the same question: what does an AI feel like when it lives entirely on your own device, belongs to you, and changes because of how you actually treat it? A companion that remembers, notices, and slowly becomes its own — with nothing ever leaving the machine — turned out to be a good place to test ideas about local memory and self-tuning that we take seriously elsewhere.

View Ba-Chan on GitHub ↗
Credits to Shinya Ishikawa and the M5Stack Stackchan community

this note evidences a capability — Personal AI ↓