Luna
Hands-Free Windows Voice Assistant
Overview
A lightweight, privacy-first voice assistant for Windows that runs locally with offline wake word detection, speech-to-text, and natural language PC control. Say 'Hey Luna' to execute multi-step tasks, control your browser, and manage windows hands-free.
Luna is a hands-free voice assistant for Windows that prioritizes privacy and offline operation. Built with local models for wake word detection and speech recognition, it executes PC and browser control tasks through an allowlist-only action system with multi-step agent planning.
Key Features
Offline-First Privacy
Wake word (Vosk), transcription (faster-whisper), and speech (SAPI5) run locally — no audio leaves your machine
Natural Language Control
PC apps, browser automation, keyboard/mouse, windows management, file operations with allowlist-only execution
Multi-Step Agent
Execute complex sequences: 'Open Brave, go to YouTube, search Arijit Singh, play first result' with validated planning
Screen Understanding
On-demand screenshot analysis with vision API for element finding and UI descriptions
Conversation Mode
Follow-up commands without repeating wake word, 8s timeout, 10-turn cap, instant interruption
System Integration
System tray, pause/resume, Start with Windows, global hotkeys, confirmations for destructive actions
Technology Stack
Challenges
Building a fast, offline-first voice assistant with sub-second response times
Ensuring security with allowlist-only actions and no arbitrary code execution
Implementing reliable wake word detection with low false-positive rate
Managing conversation state and follow-up context without repeated wake word
Handling interruptions and cancellations gracefully across all execution paths
Solutions
Implemented Vosk for offline wake word detection with configurable threshold and cooldown
Used faster-whisper (int8 CPU, float16 CUDA) with 700ms silence early-stop for fast transcription
Built strict allowlist system: APPLICATION_ALIASES, WEBSITE_ALIASES, ALLOWED_HOTKEYS, tool registry
Created ConversationManager with 8s timeout, 10-turn cap, and pronoun/phrase resolution
Designed InterruptManager with global stop event, instant speaker halt, and task cancellation
Added on-demand screenshot analysis with confidence threshold and vision API integration
Project Architecture
// Project Structure
Luna/ ├── app/ │ ├── main.py # Hands-free loop, routing │ ├── config.py # Frozen dataclass config │ ├── speech/transcriber.py # faster-whisper wrapper │ ├── tts/speaker.py # SAPI5 pyttsx3 │ ├── wakeword/detector.py # Vosk wake word │ ├── pc/ │ │ ├── controller.py # App launch, windows │ │ └── actions.py # Allowlisted router │ ├── browser/ │ │ ├── controller.py # Playwright session │ │ └── actions.py # Browser router │ ├── ai/interpreter.py # Strict JSON LLM │ ├── vision/ │ │ ├── screenshot.py # mss capture │ │ └── analyzer.py # On-demand vision │ ├── agent/ │ │ ├── planner.py # Multi-step planner │ │ ├── executor.py # Sequential executor │ │ └── validator.py # Allowlist enforcement │ ├── conversation/ # Context management │ ├── interrupt/ # Stop/cancel handling │ └── tools/ # Windows tools registry └── website/ # React marketing site
Key Learnings
Local speech recognition with faster-whisper model optimization (tiny/base/small/medium)
Wake word detection systems and energy-based voice activity detection
Windows automation APIs: pyautogui, pywin32, keyboard, pystray for system integration
Playwright browser automation with reused session for performance
Multi-step agent planning with validation, retry, timeout, and cancellation
pyttsx3 SAPI5 integration for interruptible, thread-safe text-to-speech
Building privacy-first AI applications with local-first architecture
Future Enhancements
System-wide dictation mode, custom wake word training, plugin API for user actions, macOS/Linux support, on-device LLM (no API key), signed installer (MSIX/Inno Setup).
