RikkaHub is a native Android LLM chat client designed for flexibility and power. It supports switching between multiple AI providers including OpenAI, Google (Gemini/Vertex AI), Anthropic (Claude), and any OpenAI-compatible API CLAUDE.md5-9 The application provides multimodal input (text, images, audio, video, PDF, Docx), assistant customization with system prompts, tool execution via MCP (Model Context Protocol), dual-mode memory systems, full-text search, message branching, and an embedded web server for multi-platform access README.md38-56
Sources: README.md1-56 CLAUDE.md5-25 AGENTS.md3-36
RikkaHub follows a clean layered architecture pattern with clear separation of concerns, managed through a robust Dependency Injection system using Koin app/src/main/java/me/rerere/rikkahub/RikkaHubApp.kt53-58
Diagram: Five-Layer Architecture with Code Entities
Sources: app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt46-55 app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt153-162 CLAUDE.md19-29
| Layer | Purpose | Key Components |
|---|---|---|
| Presentation | UI rendering, user interaction handling | RouteActivity, ChatPage, ChatInput |
| Business Logic | Application state, use cases, orchestration | ChatVM, ChatService, GenerationHandler, McpManager |
| Data | Persistence, data access, caching | SettingsStore, ConversationRepository, FilesManager, AppDatabase |
| Integration | External service connections | ProviderManager, SearchService, WebServerService |
| Foundation | Cross-cutting concerns | Koin DI, Navigation 3, Compose, QuickJS |
Sources: app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt46-162 CLAUDE.md19-29 app/src/main/java/me/rerere/rikkahub/RikkaHubApp.kt53-68
RikkaHub initializes via the RikkaHubApp class and handles navigation through a single activity architecture defined in RouteActivity app/src/main/AndroidManifest.xml67-96
Diagram: Application Initialization and Navigation Flow
Sources: app/src/main/java/me/rerere/rikkahub/RikkaHubApp.kt50-92 app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt46-50 app/src/main/AndroidManifest.xml67-96
The application performs initialization in the following sequence:
appModule, viewModelModule, dataSourceModule, and repositoryModule app/src/main/java/me/rerere/rikkahub/RikkaHubApp.kt53-58AppDatabase using Room, configuring WRITE_AHEAD_LOGGING and custom SQLite extensions like libsimple for FTS5 and jieba for Chinese word segmentation app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt51-101SimpleDictManager and sets up the message_fts virtual table for advanced search capabilities app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt58-85 app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt150-151DataStore, including provider configurations and assistant definitions app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt47-49PebbleEngine with a custom AssistantTemplateLoader for dynamic prompt generation and message formatting app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt104-113QuickJSLoader for local script execution and cleans up workspace temporary directories app/src/main/java/me/rerere/rikkahub/RikkaHubApp.kt68-77Sources: app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt46-116 app/src/main/java/me/rerere/rikkahub/RikkaHubApp.kt51-92
Managed by SettingsStore, this subsystem uses DataStore for persisting application-wide preferences. It tracks model selections, provider API keys, and UI settings app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt47-49 CLAUDE.md67-68
A unified abstraction layer for communicating with diverse LLM backends. It handles message serialization and streaming updates via ProviderManager. It supports OpenAI, Google, and Anthropic compatible APIs CLAUDE.md20 app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt156-162
Assistant configurations define system prompts, model parameters, and custom request headers. They support extensions like Lorebook prompt injections, quick messages, and tool availability (MCP/Local Tools like JavaScript engine) CLAUDE.md33-36 AGENTS.md33-36
The chat system coordinates Conversation instances and manages generation states. It handles tool execution, multi-step generation loops, and orchestrates the transformation pipeline for input and output messages CLAUDE.md38-52 app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt156-162
A robust pipeline processes messages before and after generation CLAUDE.md53-66
TemplateTransformer app/src/main/java/me/rerere/rikkahub/di/DataSourceModule.kt115 and prompt injections.<think> tag extraction for reasoning display CLAUDE.md53-66 AGENTS.md53-66| Category | Technology | Purpose |
|---|---|---|
| Language | Kotlin | Primary development language with JvmTarget 17 app/build.gradle.kts138-141 |
| UI Framework | Jetpack Compose | Material 3 UI with Expressive and Adaptive APIs app/build.gradle.kts107-119 app/build.gradle.kts154-162 |
| DI | Koin | Dependency injection and module management app/build.gradle.kts187-191 gradle/libs.versions.toml127 |
| Persistence | Room & DataStore | Relational database with FTS5 and reactive preferences app/build.gradle.kts175 gradle/libs.versions.toml29-31 |
| Networking | OkHttp & Retrofit | HTTP client with SSE support and REST API serialization gradle/libs.versions.toml25-26 app/build.gradle.kts196-200 |
| Serialization | Kotlinx Serialization | JSON handling for settings and API models app/build.gradle.kts10 gradle/libs.versions.toml32 |
| Navigation | Navigation 3 | Type-safe navigation framework app/build.gradle.kts164-168 gradle/libs.versions.toml19-23 |
Sources: app/build.gradle.kts7-15 app/build.gradle.kts144-210 gradle/libs.versions.toml1-69
Refresh this wiki