# newo-ether/agora architecture

> Architecture diagram of the GitHub repository newo-ether/agora, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/newo-ether/agora
- Repository: https://github.com/newo-ether/agora

## Overview

Agora is an Android BYOK LLM client. The main workflow is: a user selects a model and sends a chat message; Agora routes generation to a configured provider, streams the response, and stores conversations locally. Agent runs can additionally invoke tools, retrieve memory or conversation context, and schedule Tasks or Loops. Other documented capabilities include local llama.cpp models, remote device control, portable import/export, and scheduled backups. The graph combines README-documented flows with sampled source references; unsampled implementation details are not assumed.

Main entry points: [`app/src/main/java/com/newoether/agora/tool/ToolProvider.kt`](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/tool/ToolProvider.kt) (Agent tools), [`app/src/main/java/com/newoether/agora/viewmodel`](https://github.com/newo-ether/agora/tree/master/app/src/main/java/com/newoether/agora/viewmodel) (Generation runtime), [`app/src/main/java/com/newoether/agora/automation/TaskExecutionEngine.kt`](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/automation/TaskExecutionEngine.kt) (Task execution), [`app/src/main/java/com/newoether/agora/data/repository/ConversationRepository.kt`](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/repository/ConversationRepository.kt) (Conversation repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Chat experience"]
  node_chat_ui["Chat UI<br/>[ChatApp.kt]"]
  node_activity["Android app<br/>[MainActivity.kt]"]
end

subgraph group_generation["Models and generation"]
  node_generation_runtime["Generation runtime"]
  node_provider_api["Provider API<br/>[HttpClient.kt]"]
  node_provider_adapters["Provider adapters"]
  node_local_models["Local models<br/>[LocalProvider.kt]"]
  node_llama_runtime["llama.cpp runtime<br/>[LlamaChatEngine.kt]"]
end

subgraph group_agents["Agent capabilities"]
  node_tools["Agent tools<br/>[ToolProvider.kt]"]
  node_mcp["MCP integration"]
  node_memory["Memory<br/>[MemoryManager.kt]"]
  node_rag["Conversation RAG<br/>[RagManager.kt]"]
  node_embedding_worker["Embedding indexer"]
  node_web_search["Web search"]
  node_image_generation["Image generation"]
end

subgraph group_data["Data and persistence"]
  node_conversation_repo["Conversation repository"]
  node_chat_database[("Chat database<br/>[ChatDatabase.kt]")]
  node_settings_repo["Settings repository"]
  node_settings_manager["Settings manager<br/>[SettingsManager.kt]"]
  node_portable_data["Portable archives<br/>[DataExporter.kt]"]
end

subgraph group_background["Automation and remote"]
  node_automation["Task execution"]
  node_scheduler["Task scheduler"]
  node_foreground_service["Foreground service"]
  node_remote_control["Remote control<br/>[FiloClient.kt]"]
  node_sandbox["Alpine sandbox"]
  node_backup["Scheduled backups"]
end

node_user(("User"))
node_provider_service(("Model providers"))

node_user -->|"sends message"| node_chat_ui
node_chat_ui -->|"starts generation"| node_generation_runtime
node_generation_runtime -->|"requests completion"| node_provider_api
node_provider_api -.->|"routes protocol"| node_provider_adapters
node_provider_adapters -->|"sends request"| node_provider_service
node_generation_runtime -->|"uses local model"| node_local_models
node_local_models -.->|"runs inference"| node_llama_runtime
node_generation_runtime -->|"persists conversation"| node_conversation_repo
node_conversation_repo -->|"stores messages"| node_chat_database
node_chat_ui -.->|"reads settings"| node_settings_repo
node_settings_repo -->|"publishes settings"| node_settings_manager
node_generation_runtime -->|"invokes tools"| node_tools
node_tools -->|"uses MCP"| node_mcp
node_tools -->|"accesses memory"| node_memory
node_tools -->|"retrieves context"| node_rag
node_rag -->|"schedules indexing"| node_embedding_worker
node_tools -->|"searches web"| node_web_search
node_tools -->|"generates images"| node_image_generation
node_automation -->|"runs generation"| node_generation_runtime
node_scheduler -.->|"schedules tasks"| node_automation
node_automation -->|"records executions"| node_conversation_repo
node_automation -.->|"keeps work active"| node_foreground_service
node_tools -->|"controls devices"| node_remote_control
node_tools -->|"runs sandbox commands"| node_sandbox
node_user -->|"imports or exports"| node_portable_data
node_portable_data -.->|"archives conversations"| node_conversation_repo
node_backup -.->|"creates backups"| node_portable_data

click node_chat_ui "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/ui/chat/ChatApp.kt"
click node_activity "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/MainActivity.kt"
click node_generation_runtime "https://github.com/newo-ether/agora/tree/master/app/src/main/java/com/newoether/agora/viewmodel"
click node_provider_api "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/api/HttpClient.kt"
click node_provider_adapters "https://github.com/newo-ether/agora/tree/master/app/src/main/java/com/newoether/agora/api/openai"
click node_local_models "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/api/local/LocalProvider.kt"
click node_llama_runtime "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/api/LlamaChatEngine.kt"
click node_conversation_repo "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/repository/ConversationRepository.kt"
click node_chat_database "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/local/ChatDatabase.kt"
click node_settings_repo "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/repository/SettingsRepository.kt"
click node_settings_manager "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/SettingsManager.kt"
click node_tools "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/tool/ToolProvider.kt"
click node_mcp "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/mcp/McpProtocolClient.kt"
click node_memory "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/MemoryManager.kt"
click node_rag "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/viewmodel/RagManager.kt"
click node_embedding_worker "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/service/EmbeddingCacheWorker.kt"
click node_web_search "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/tool/WebSearchToolProvider.kt"
click node_image_generation "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/tool/ImageGenToolProvider.kt"
click node_automation "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/automation/TaskExecutionEngine.kt"
click node_scheduler "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/automation/AutomationScheduler.kt"
click node_foreground_service "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/service/AgoraForegroundService.kt"
click node_remote_control "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/remote/FiloClient.kt"
click node_sandbox "https://github.com/newo-ether/agora/blob/master/app/src/fdroid/java/com/newoether/agora/sandbox/ProotSandboxManager.kt"
click node_portable_data "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/DataExporter.kt"
click node_backup "https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/AutoBackupManager.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chat_ui,node_activity,node_user toneBlue
class node_generation_runtime,node_provider_api,node_provider_adapters,node_local_models,node_llama_runtime toneAmber
class node_tools,node_mcp,node_memory,node_rag,node_embedding_worker,node_web_search,node_image_generation toneMint
class node_conversation_repo,node_chat_database,node_settings_repo,node_settings_manager,node_portable_data toneRose
class node_automation,node_scheduler,node_foreground_service,node_remote_control,node_sandbox,node_backup,node_provider_service toneIndigo
```

## Components

### Chat experience

- [Chat UI](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/ui/chat/ChatApp.kt): `app/src/main/java/com/newoether/agora/ui/chat/ChatApp.kt`
- [Android app](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/MainActivity.kt): `app/src/main/java/com/newoether/agora/MainActivity.kt`

### Models and generation

- [Generation runtime](https://github.com/newo-ether/agora/tree/master/app/src/main/java/com/newoether/agora/viewmodel): `app/src/main/java/com/newoether/agora/viewmodel`
- [Provider API](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/api/HttpClient.kt): `app/src/main/java/com/newoether/agora/api/HttpClient.kt`
- [Provider adapters](https://github.com/newo-ether/agora/tree/master/app/src/main/java/com/newoether/agora/api/openai): `app/src/main/java/com/newoether/agora/api/openai`
- [Local models](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/api/local/LocalProvider.kt): `app/src/main/java/com/newoether/agora/api/local/LocalProvider.kt`
- [llama.cpp runtime](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/api/LlamaChatEngine.kt): `app/src/main/java/com/newoether/agora/api/LlamaChatEngine.kt`

### Agent capabilities

- [Agent tools](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/tool/ToolProvider.kt): `app/src/main/java/com/newoether/agora/tool/ToolProvider.kt`
- [MCP integration](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/mcp/McpProtocolClient.kt): `app/src/main/java/com/newoether/agora/mcp/McpProtocolClient.kt`
- [Memory](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/MemoryManager.kt): `app/src/main/java/com/newoether/agora/data/MemoryManager.kt`
- [Conversation RAG](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/viewmodel/RagManager.kt): `app/src/main/java/com/newoether/agora/viewmodel/RagManager.kt`
- [Embedding indexer](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/service/EmbeddingCacheWorker.kt): `app/src/main/java/com/newoether/agora/service/EmbeddingCacheWorker.kt`
- [Web search](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/tool/WebSearchToolProvider.kt): `app/src/main/java/com/newoether/agora/tool/WebSearchToolProvider.kt`
- [Image generation](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/tool/ImageGenToolProvider.kt): `app/src/main/java/com/newoether/agora/tool/ImageGenToolProvider.kt`

### Data and persistence

- [Conversation repository](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/repository/ConversationRepository.kt): `app/src/main/java/com/newoether/agora/data/repository/ConversationRepository.kt`
- [Chat database](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/local/ChatDatabase.kt): `app/src/main/java/com/newoether/agora/data/local/ChatDatabase.kt`
- [Settings repository](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/repository/SettingsRepository.kt): `app/src/main/java/com/newoether/agora/data/repository/SettingsRepository.kt`
- [Settings manager](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/SettingsManager.kt): `app/src/main/java/com/newoether/agora/data/SettingsManager.kt`
- [Portable archives](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/DataExporter.kt): `app/src/main/java/com/newoether/agora/data/DataExporter.kt`

### Automation and remote

- [Task execution](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/automation/TaskExecutionEngine.kt): `app/src/main/java/com/newoether/agora/automation/TaskExecutionEngine.kt`
- [Task scheduler](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/automation/AutomationScheduler.kt): `app/src/main/java/com/newoether/agora/automation/AutomationScheduler.kt`
- [Foreground service](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/service/AgoraForegroundService.kt): `app/src/main/java/com/newoether/agora/service/AgoraForegroundService.kt`
- [Remote control](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/remote/FiloClient.kt): `app/src/main/java/com/newoether/agora/remote/FiloClient.kt`
- [Alpine sandbox](https://github.com/newo-ether/agora/blob/master/app/src/fdroid/java/com/newoether/agora/sandbox/ProotSandboxManager.kt): `app/src/fdroid/java/com/newoether/agora/sandbox/ProotSandboxManager.kt`
- [Scheduled backups](https://github.com/newo-ether/agora/blob/master/app/src/main/java/com/newoether/agora/data/AutoBackupManager.kt): `app/src/main/java/com/newoether/agora/data/AutoBackupManager.kt`

### Other components

- **User**
- **Model providers**

## Connections

- User → Chat UI: sends message (evidence: `README.md`)
- Chat UI → Generation runtime: starts generation (evidence: `README.md`)
- Generation runtime → Provider API: requests completion (evidence: `README.md`)
- Provider API → Provider adapters: routes protocol
- Provider adapters → Model providers: sends request (evidence: `README.md`)
- Generation runtime → Local models: uses local model (evidence: `README.md`)
- Local models → llama.cpp runtime: runs inference
- Generation runtime → Conversation repository: persists conversation (evidence: `README.md`)
- Conversation repository → Chat database: stores messages (evidence: `app/src/main/java/com/newoether/agora/data/repository/ConversationRepository.kt`)
- Chat UI → Settings repository: reads settings
- Settings repository → Settings manager: publishes settings (evidence: `app/src/main/java/com/newoether/agora/data/repository/SettingsRepository.kt`)
- Generation runtime → Agent tools: invokes tools (evidence: `README.md`)
- Agent tools → MCP integration: uses MCP (evidence: `README.md`)
- Agent tools → Memory: accesses memory (evidence: `README.md`)
- Agent tools → Conversation RAG: retrieves context (evidence: `README.md`)
- Conversation RAG → Embedding indexer: schedules indexing (evidence: `app/src/main/java/com/newoether/agora/viewmodel/RagManager.kt`)
- Agent tools → Web search: searches web (evidence: `README.md`)
- Agent tools → Image generation: generates images (evidence: `README.md`)
- Task execution → Generation runtime: runs generation (evidence: `app/src/main/java/com/newoether/agora/automation/TaskExecutionEngine.kt`)
- Task scheduler → Task execution: schedules tasks
- Task execution → Conversation repository: records executions (evidence: `app/src/main/java/com/newoether/agora/automation/TaskExecutionEngine.kt`)
- Task execution → Foreground service: keeps work active
- Agent tools → Remote control: controls devices (evidence: `README.md`)
- Agent tools → Alpine sandbox: runs sandbox commands (evidence: `README.md`)
- User → Portable archives: imports or exports (evidence: `README.md`)
- Portable archives → Conversation repository: archives conversations
- Scheduled backups → Portable archives: creates backups
