Project Overview
Cosmo was Created by Gabriel S Passos.
Zenith Cosmo 42 is a local-first voice assistant runtime featuring:
- Event-driven architecture with asynchronous priority queue event bus.
- Offline speech recognition using Vosk (Kaldi) with Portuguese support.
- Persistent memory with SQLite-backed repositories for users, conversations, memories, events, and system state.
- Personality system with runtime parameter adjustment and YAML profile management.
- Local command handling for deterministic operations without LLM overhead.
- Provider-based TTS with Piper synthesis and experimental Espeak support.
- WebUI observability dashboard providing read-only runtime monitoring.
- Wakeword detection stabilized around exclusive microphone ownership by runtime mode.
- Experimental local vision pipeline with camera capture, image quality analysis, and baseline face detection.
- Prompt injection with persona, personality parameters, relevant memories, and conversation history.
- Concurrency protection for critical paths: wake word, capture, thinking, and speaking.
The system language and command vocabulary are primarily Brazilian Portuguese. The application entry point is cosmo/main.py, which calls bootstrap.start() inside asyncio.run().
Current Implementation Status
Implemented Features
- RuntimeStateManager with 7-state machine: idle -> wake_detected -> listening -> transcribing -> thinking -> speaking -> cooldown.
- Conversation/TTS concurrency protection with guard methods.
- Local fallbacks standardized across error paths.
- ConversationManager history limit of 10 messages.
- Safe handling of incomplete personality commands with fallback responses.
- Lightweight persona/personality parameter persistence through a JSON state file.
- Persistent memory with SQLite repositories for users, memories, conversations, events, faces, system_state, local_commands, and personality metadata.
- WebUI as read-only observability dashboard inside the Cosmo process.
- SQLite database layer with repository pattern for data access.
- Async event bus with priority queue and metrics collection.
- Wakeword energy optimization with idle sleep and silence grace.
- Logging to both console and SQLite.
- Event persistence to SQLite EventRepository.
- Diagnostics/runtime snapshots through DiagnosticsManager.
- Database-backed local commands with fallback phrases.
- Database-backed personality command aliases and number words.
- Provider-based TTS factory with Piper and Espeak implementations.
- Vosk wakeword detection with continuous monitoring.
- Vision system implemented as an experimental local camera pipeline.
CameraManagercamera capture with fresh frame reading, snapshot saving, and persistent camera session while auto-capture runs.- Auto-capture periodically captures, saves, and analyzes frames;
capture_intervalcontrols periodic processing, not video FPS. - Frame freshness uses buffer flushing through
frame_flush_readsandframe_flush_delay. VisionAnalyzercomputesbrightness_mean,brightness_std/ contrast,dark_ratio,bright_ratio,overexposed_ratio,blur_score,backlit_score,image_quality, andface_ready.FaceDetectoruses OpenCV Haar Cascade as a baseline detector with optional CLAHE preprocessing, geometric filters, eye validation, and raw/accepted/rejected detection counters.- WebUI
/visiondisplays the latest snapshot, image quality, face detection status, reject reason, and bounding boxes overlay.
Experimental / In Tuning
- Vision is active but experimental; quality classification and Haar-based detection are being tuned for lighting, distance, blur, pose, and false positives.
- Face detection reports raw faces, accepted faces, rejected faces, filter reasons, and the largest accepted face, but it is still a baseline detection stage.
Pending Features
- Face enrollment, face recognition, identity matching, and tracking are not implemented yet.
- Robotic abstraction layer.
- API, CLI, and WebSocket interfaces; placeholder directories exist.
- Task scheduler/planner; placeholder directories exist.

