Skip to content

System Architecture

Gabriel S Passos edited this page Jun 3, 2026 · 1 revision

2. System Architecture

At runtime, Cosmo starts a lifecycle flag, registers listeners by importing listener modules, starts an async event bus, starts a wake word task, and waits in a main loop until shutdown.

flowchart TD

Main["cosmo/main.py"] --> Bootstrap["Bootstrap.start()"]

Bootstrap --> Lifecycle["Lifecycle running flag"]

Bootstrap --> SyncBus["EventBus: synchronous startup/shutdown events"]

Bootstrap --> AsyncBus["AsyncEventBus: priority queue and async listeners"]

Bootstrap --> Runtime["AsyncRuntime task registry"]

Runtime --> Wakeword["WakewordManager"]

Wakeword --> Capture["AudioCaptureManager"]

Capture --> STT["STTManager / Vosk"]

STT --> Transcript["TRANSCRIPT_READY"]

Transcript --> Conversation["ConversationPipeline"]

Conversation --> ResponseGen["ResponseGenerator"]

ResponseGen --> LocalCommands["Local commands"]

ResponseGen --> Personality["Personality state and prompt builder"]

ResponseGen --> Memory["MemoryManager"]

ResponseGen --> LLM["OpenRouter or Ollama provider"]

Conversation --> ResponseEvent["RESPONSE_GENERATED"]

ResponseEvent --> TTS["TTSPipeline / Piper / aplay"]

Memory --> SQLite["SQLite cosmo.db"]

Diagnostics["DiagnosticsManager"] --> Runtime

Diagnostics --> AsyncBus

Diagnostics --> ConversationHistory["ConversationManager"]

Diagnostics --> Personality

Loading

Clone this wiki locally