Byte is an open-source, context-aware 3D desktop pet companion built natively for macOS using Swift and SceneKit. Operating as a transparent, interactive overlay above the macOS desktop, Byte interacts with your active windows, responds to physical gestures, listens to your voice offline, and exhibits dynamic emotional behaviors fine-tuned using local machine learning.
Unlike static desktop widgets, Byte runs a hybrid machine learning architecture:
- Q-Learning Action Brain (
ReinforcementLearningModel): Autonomous wandering, sleeping, perching, and idle state selections calculated via Bellman equation state-reward policies. - Local Empathy LLM (
byte-llm): Fine-tuned on 45,000+ open-source empathetic dialogue pairs (Meta AI's EmpatheticDialogues) using Apple Silicon MLX GPU acceleration. - On-Device Voice Subsystem: Offline speech recognition via Whisper STT and hyper-realistic speech synthesis via Kokoro TTS.
- Open-Source Fine-Tuning: Trained on 45,328 conversation pairs using Apple MLX Metal GPU LoRA fine-tuning.
- Dual Tag Output: Generates structured action-emotion predictions (
[ACTION: sitOnCorner] [EMOTION: cozy]) to seamlessly animate the 3D pet sprite alongside text dialogue. - Workplace Pacing: Detects deep coding sessions, long IDE typing, compiler errors, or evening hours to gently suggest hydration, stretch breaks, or posture checks.
- Speech-to-Text (STT): Local low-latency audio transcription using
faster-whisper(Port 9000). - Text-to-Speech (TTS): Natural speech output powered by Kokoro TTS (Port 8000).
- Privacy First: Zero cloud API dependencies; your voice audio and workspace state never leave your Mac.
- Custom Surface & Window Gravity: Byte walks along window frames, perches on the menu bar, and walks across the macOS Dock floor.
- Interactive Drag & Throw Physics: Click and toss Byte across your desktop with velocity, drag, friction, and bounce trajectory calculations.
- Camera Orbiting & Touch Controls: Rotate Byte 360ยฐ on the Y-axis using mouse trackpad scrolling or drag interactions.
- Accessibility API Integration (
AXUIElement): Reads active application names and window frame coordinates. - Media & Headphone Detection: Subscribes to
CoreAudioto detect output device changes and media playback (Apple Music, Spotify). - Real-Time Environment Adaptability: Synchronizes behavior with local weather and time of day (e.g. cozy night rest mode, rainy day umbrella state).
sequenceDiagram
autonumber
actor User
participant App as macOS DesktopPet App (Swift)
participant STT as Whisper Server (Port 9000)
participant LLM as Ollama byte-llm (Port 11434)
participant TTS as Kokoro TTS Server (Port 8000)
User->>App: Voice command or text interaction
alt Voice Input
App->>STT: Stream Audio Bytes
STT-->>App: Return Transcribed Text
end
App->>LLM: Send CONTEXT + USER SAID
LLM-->>App: Return "[ACTION: sitOnCorner] [EMOTION: love] I'm right here with you."
App->>App: Trigger 3D Sprite Animation & State Transition
App->>TTS: Synthesize Text to Audio
TTS-->>App: Return Audio Buffer
App->>User: Play Voice Output & Perform 3D Animation
For full technical specifications, read our Empathy AI & ML Architecture Guide.
- Dataset Size: 45,328 total items (
train.jsonl: 38,528 |valid.jsonl: 6,800). - Hardware Acceleration: Apple Silicon Metal GPU via
mlx-lm. - Validation Loss Improvement: Drop from
4.487โ2.151(>50% optimization). - Quantized Deployment: Exported to
./training/byte_fused_modeland served through Ollamabyte-llm.
- Offline Self-Reflection Engine (
ReflectionEngine): Background reflection pass during sleep mode analyzes user interactions and updates permanent rules inmemory_graph.json. - On-Device Q-Learning Reinforcement (
ReinforcementLearningModel): Physical movement and state transitions continuously update a local Q-table via Bellman reward signals. - Incremental LoRA Checkpoints: User interaction feedback is periodically merged back into
train.jsonlto re-tune model weights incrementally.
For a deep mathematical break-down, read our Empathy AI Architecture & Continuous Learning Guide.
- macOS 14.0 (Sonoma) or newer on Apple Silicon (M1/M2/M3/M4) or Intel Mac.
- Xcode 15+ installed.
- Python 3.9+ installed.
- Ollama installed.
git clone https://github.com/your-username/Byte.git
cd ByteRun the launcher script to automatically start Ollama, Whisper STT, Kokoro TTS, and launch DesktopPet.app:
chmod +x start.sh
./start.shpython3 training/download_and_build_master_dataset.pychmod +x training/train_mlx.sh
./training/train_mlx.shollama create byte-llm -f training/ByteModelfileByte/
โโโ DesktopPet/ # Native macOS Swift overlay app
โ โโโ AIEngine.swift # LLM prompt synthesis & response parsing
โ โโโ PetScene.swift # 3D SceneKit rendering & custom physics loop
โ โโโ PetBrain.swift # State machine & priority queue
โ โโโ ReinforcementLearningModel.swift # Swift Q-Learning engine
โโโ DesktopPet.xcodeproj # Xcode project configuration
โโโ docs/ # In-depth architectural & ML documentation
โ โโโ EMPATHY_TRAINING_AND_ML_ARCHITECTURE.md
โ โโโ CODE_FLOW_DIAGRAM.md
โโโ training/ # Machine learning fine-tuning suite
โ โโโ ByteModelfile # Ollama model definition
โ โโโ download_and_build_master_dataset.py # Open-source dataset converter
โ โโโ generate_1000_connective_dataset.py # Domain generator
โ โโโ train_mlx.sh # Apple Silicon LoRA fine-tuning script
โ โโโ train.jsonl # Master training dataset (38k+ pairs)
โ โโโ valid.jsonl # Validation dataset (6.8k pairs)
โโโ backend/ # Python microservices
โ โโโ whisper_server.py # Offline speech-to-text API
โ โโโ tts_server.py # Kokoro text-to-speech API
โโโ assets/ # Sprites, motion renders, and logos
โโโ start.sh # Universal background launcher script
Contributions are warmly welcomed! Please read our guidelines before submitting pull requests:
- Fork the project.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'feat: add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.






