$ show SimonSchubert/Kai
Kai is an open-source, cross-platform AI assistant application built with Kotlin Multiplatform and Compose Multiplatform. It provides a rich chat interface that integrates dozens of LLM providers (OpenAI, Anthropic, Gemini, Groq, DeepSeek, etc.) and supports on-device inference via LiteRT. The app goes beyond simple chat by offering persistent memory, tool calling (40+ tools including web search, email, SMS, shell commands, calendar, and MCP servers), a Linux sandbox for code execution (Android), scheduled heartbeat agents, skills/plugins, and dynamic AI-generated UI. It targets Android, iOS, desktop (Windows/Mac/Linux), and web (WASM). Architecturally, Kai follows a modular MVVM pattern with platform-specific implementations for features like sandbox, SMS, notifications, and clipboard. The shared code in `commonMain` contains the core logic: data repositories, tool execution, inference orchestration, markdown and math rendering, and a custom dynamic UI system (KaiUi) that renders AI-generated interactive elements inline. Persistence uses SQLDelight for conversations and a JSON-backed settings system for all other state. Dependencies are injected via Koin, and networking uses Ktor with kotlinx.serialization. The codebase is actively maintained (frequent commits, comprehensive CI/CD pipelines, 124 open issues suggesting active user engagement) and technically current with the Kotlin ecosystem. While the feature surface is large and introduces some platform complexity (many expect/actual stubs), the core abstractions are clean and test coverage is solid. Notable reusable components include a generic JSON settings list with corruption recovery, an animated gradient border modifier, and a complete dynamic UI node system that could be extracted for other AI-driven interfaces.
The LLM identified 3 files worth highlighting for reuse:
Provides generic `SettingsJsonList<T>` and `SettingsJsonValue<T>` classes that store typed JSON data in the app's platform settings. Includes memoization, corruption detection with automatic reset, and migration hooks. This is a self-contained persistence pattern applicable to any Kotlin Multiplatform app needing reliable JSON-backed storage with minimal boilerplate.
A Compose `Modifier` that applies an animated sweep-gradient border around any composable. Uses a no-allocation frame loop for smooth animation. Highly reusable in any Compose project that needs eye-catching visual feedback or loading state indicators. Isolated and depends only on standard Compose libraries.
A sealed class hierarchy defining over 30 UI node types (Column, Row, Card, Button, TextInput, Alert, Table, etc.) that the AI can emit as JSON to render interactive interfaces inline in the chat. Includes a tolerant JSON-to-node parser (`KaiUiParser`) and a renderer (`KaiUiRenderer`). This module is self-contained and demonstrates a flexible pattern for AI-driven UI generation that could be adopted in other assistant or chatbot projects.