$ show moeru-ai/airi
Project AIRI is a comprehensive multi-platform AI agent and virtual character platform. It functions as a desktop application (Electron), web interface (Vue.js), and mobile client (Capacitor), centered around an LLM-powered 'brain' that controls 3D avatars (Live2D, VRM, Spine) and interacts with the physical world via computer automation (MCP) and gaming bots (Minecraft). The system integrates speech-to-text, text-to-speech, and vision processing to create a conversational agent capable of real-time interaction. It features a robust backend server (Hono/PostgreSQL) for authentication, billing (Flux currency), and provider routing, alongside a plugin system allowing third-party extensions to inject functionality. Architecturally, it is a large monorepo managed by pnpm and Turbo, separating concerns into apps, packages, services, and plugins. The codebase demonstrates significant engineering effort in managing complex state across Electron IPC, WebSocket communication, and local-first data synchronization. It implements custom concurrency ledgers for billing, GPU resource coordination for model inference, and sandboxed execution environments for AI planning tasks. The system is actively developed with frequent commits and a large plugin ecosystem, though it relies heavily on bleeding-edge dependencies and beta libraries. The platform solves the problem of creating autonomous virtual characters with agency, moving beyond simple chatbots to agents that can control computers, play games, and maintain persistent memory. It exposes a standardized provider registry for AI models and a plugin SDK for extensibility. While the architecture is sophisticated, the reliance on rapidly evolving AI standards (MCP, LLM APIs) and bleeding-edge Node.js versions introduces technical debt and maintenance overhead.
The LLM identified 4 files worth highlighting for reuse:
Defines the core plugin host architecture and kit registry. It establishes a type-safe contract for extensions to register capabilities (kits, modules) and interact with the host environment. The pattern demonstrates a decoupled extension model where plugins can be hot-reloaded without restarting the main process, a critical feature for a desktop application.
Implements a custom 'Flux' currency system with a concurrency ledger using Redis Lua scripts. This component ensures atomic capacity gating across multiple server replicas, preventing billing exploits and race conditions during high-load inference requests. It demonstrates advanced distributed system patterns for financial integrity.
Implements the Model Context Protocol (MCP) tool registration system. It defines structured tool descriptors with metadata for approval, concurrency, and safety policies. This component enables the AI agent to safely interact with the operating system (terminal, browser, clipboard) through a standardized, validated interface.
Manages VRAM allocation and GPU pressure events for multiple AI models running concurrently. It tracks model loading states and coordinates memory release to prevent out-of-memory crashes. This component is essential for desktop applications running local inference alongside system UI processes.