Architecture · latest · 2026-04-18

Lyra — System Architecture

hub-and-spoke · Python 3.12 · asyncio · NATS three-process · Phase 1b complete

Runtime · Three-Process Mode

  • lyra_hub — MessagePipeline · Pool · Agent · Memory · LLM
  • lyra_telegram — aiogram v3 (long-poll + FastAPI)
  • lyra_discord — discord.py v2 (gateway + voice)
  • voicecli_tts / _stt — separate NATS daemons
  • supervisord + systemd user unit (lyra.service)
  • monitoring as oneshot systemd timer every 5 min

Data · Storage Layers

  • L0 working memory — compacts at 80% of 200k tokens
  • L1 TurnStore — ~/.lyra/turns.db raw log
  • L3 roxabi-vault — FTS5 + sqlite-vec hybrid
  • AgentStore~/.lyra/config.db + bot bindings
  • fastembed ONNX · nomic-embed-text (non-blocking)
  • aiosqlite mandatory — no sync SQLite on loop

Transport · NATS + Integrations

  • Topics: lyra.{inbound,outbound}.<plat>.<bot>
  • Embedded nats-server when NATS_URL unset
  • roxabi-nats — adapter_base · CB · readiness
  • roxabi-contractsschema_version ≤ expected
  • External: Anthropic · Telegram · Discord · GitHub
  • Phase 2 — Machine 2 LLM worker via NATS (#51)