# friuns2/openclaude-android architecture

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

- Interactive diagram: https://gitdiagram.com/friuns2/openclaude-android
- Repository: https://github.com/friuns2/openclaude-android

## Overview

OpenClaude Mobile packages a coding-agent CLI for an embedded Linux environment, with an Android app as its advertised host. The main workflow is a user prompt entering the interactive REPL, passing through the query engine to an LLM, and invoking tools whose results feed the conversation. The README also documents MCP servers, multi-agent swarms, provider choices, session persistence, and headless gRPC operation. Several runtime links below are documented at capability level; unsampled implementation details are not inferred.

Main entry points: [`src/QueryEngine.ts`](https://github.com/friuns2/openclaude-android/blob/main/src/QueryEngine.ts) (Query engine), [`src/query.ts`](https://github.com/friuns2/openclaude-android/blob/main/src/query.ts) (Query loop), [`src/screens/REPL.tsx`](https://github.com/friuns2/openclaude-android/blob/main/src/screens/REPL.tsx) (Interactive REPL), [`src/services/mcp/MCPConnectionManager.tsx`](https://github.com/friuns2/openclaude-android/blob/main/src/services/mcp/MCPConnectionManager.tsx) (MCP connections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interaction"]
  node_repl["Interactive REPL<br/>[REPL.tsx]"]
  node_commands["Slash commands<br/>[commands.ts]"]
  node_grpc["gRPC server<br/>[server.ts]"]
end

subgraph group_agent["Agent runtime"]
  node_queryengine["Query engine<br/>[QueryEngine.ts]"]
  node_query["Query loop<br/>[query.ts]"]
  node_tools["Built-in tools<br/>[Tool.ts]"]
  node_swarm["Agent swarms"]
end

subgraph group_integrations["Providers and tools"]
  node_provider["Provider selection"]
  node_llm{{"LLM APIs"}}
  node_mcp["MCP connections"]
  node_plugins["Plugin management"]
  node_lsp["Language servers"]
end

subgraph group_state["State and services"]
  node_session[("Session persistence<br/>[sessionStorage.ts]")]
  node_bootstrap["Runtime state<br/>[state.ts]"]
  node_config["Configuration<br/>[config.ts]"]
  node_remote["Remote sessions"]
end

node_user(("User"))
node_mcpservers{{"MCP servers"}}
node_client(("gRPC client"))

node_user -->|"enters prompt"| node_repl
node_repl -.->|"submits input"| node_queryengine
node_queryengine -->|"runs query"| node_query
node_queryengine -->|"flushes session"| node_session
node_query -->|"dispatches tools"| node_tools
node_query -->|"streams requests"| node_llm
node_provider -->|"selects provider"| node_llm
node_query -->|"spawns agents"| node_swarm
node_query -->|"uses MCP tools"| node_mcp
node_mcp -->|"connects servers"| node_mcpservers
node_commands -.->|"provides commands"| node_repl
node_grpc -->|"invokes engine"| node_queryengine
node_client -->|"connects headless"| node_grpc
node_remote -.->|"manages sessions"| node_session
node_queryengine -->|"reads session state"| node_bootstrap
node_queryengine -->|"reads configuration"| node_config
node_plugins -.->|"supports MCP plugins"| node_mcp
node_lsp -.->|"assists coding"| node_query

click node_repl "https://github.com/friuns2/openclaude-android/blob/main/src/screens/REPL.tsx"
click node_commands "https://github.com/friuns2/openclaude-android/blob/main/src/commands.ts"
click node_queryengine "https://github.com/friuns2/openclaude-android/blob/main/src/QueryEngine.ts"
click node_query "https://github.com/friuns2/openclaude-android/blob/main/src/query.ts"
click node_tools "https://github.com/friuns2/openclaude-android/blob/main/src/Tool.ts"
click node_swarm "https://github.com/friuns2/openclaude-android/tree/main/src/tools/AgentTool"
click node_provider "https://github.com/friuns2/openclaude-android/blob/main/src/components/ProviderManager.tsx"
click node_mcp "https://github.com/friuns2/openclaude-android/blob/main/src/services/mcp/MCPConnectionManager.tsx"
click node_session "https://github.com/friuns2/openclaude-android/blob/main/src/utils/sessionStorage.ts"
click node_bootstrap "https://github.com/friuns2/openclaude-android/blob/main/src/bootstrap/state.ts"
click node_config "https://github.com/friuns2/openclaude-android/blob/main/src/utils/config.ts"
click node_grpc "https://github.com/friuns2/openclaude-android/blob/main/src/grpc/server.ts"
click node_remote "https://github.com/friuns2/openclaude-android/blob/main/src/remote/RemoteSessionManager.ts"
click node_plugins "https://github.com/friuns2/openclaude-android/blob/main/src/services/plugins/PluginInstallationManager.ts"
click node_lsp "https://github.com/friuns2/openclaude-android/blob/main/src/services/lsp/LSPServerManager.ts"

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_repl,node_commands,node_grpc,node_user,node_client toneBlue
class node_queryengine,node_query,node_tools,node_swarm toneAmber
class node_provider,node_llm,node_mcp,node_plugins,node_lsp,node_mcpservers toneMint
class node_session,node_bootstrap,node_config,node_remote toneRose
```

## Components

### User interaction

- [Interactive REPL](https://github.com/friuns2/openclaude-android/blob/main/src/screens/REPL.tsx): `src/screens/REPL.tsx`
- [Slash commands](https://github.com/friuns2/openclaude-android/blob/main/src/commands.ts): `src/commands.ts`
- [gRPC server](https://github.com/friuns2/openclaude-android/blob/main/src/grpc/server.ts): `src/grpc/server.ts`

### Agent runtime

- [Query engine](https://github.com/friuns2/openclaude-android/blob/main/src/QueryEngine.ts): `src/QueryEngine.ts`
- [Query loop](https://github.com/friuns2/openclaude-android/blob/main/src/query.ts): `src/query.ts`
- [Built-in tools](https://github.com/friuns2/openclaude-android/blob/main/src/Tool.ts): `src/Tool.ts`
- [Agent swarms](https://github.com/friuns2/openclaude-android/tree/main/src/tools/AgentTool): `src/tools/AgentTool`

### Providers and tools

- [Provider selection](https://github.com/friuns2/openclaude-android/blob/main/src/components/ProviderManager.tsx): `src/components/ProviderManager.tsx`
- **LLM APIs**
- [MCP connections](https://github.com/friuns2/openclaude-android/blob/main/src/services/mcp/MCPConnectionManager.tsx): `src/services/mcp/MCPConnectionManager.tsx`
- [Plugin management](https://github.com/friuns2/openclaude-android/blob/main/src/services/plugins/PluginInstallationManager.ts): `src/services/plugins/PluginInstallationManager.ts`
- [Language servers](https://github.com/friuns2/openclaude-android/blob/main/src/services/lsp/LSPServerManager.ts): `src/services/lsp/LSPServerManager.ts`

### State and services

- [Session persistence](https://github.com/friuns2/openclaude-android/blob/main/src/utils/sessionStorage.ts): `src/utils/sessionStorage.ts`
- [Runtime state](https://github.com/friuns2/openclaude-android/blob/main/src/bootstrap/state.ts): `src/bootstrap/state.ts`
- [Configuration](https://github.com/friuns2/openclaude-android/blob/main/src/utils/config.ts): `src/utils/config.ts`
- [Remote sessions](https://github.com/friuns2/openclaude-android/blob/main/src/remote/RemoteSessionManager.ts): `src/remote/RemoteSessionManager.ts`

### Other components

- **User**
- **MCP servers**
- **gRPC client**

## Connections

- User → Interactive REPL: enters prompt
- Interactive REPL → Query engine: submits input
- Query engine → Query loop: runs query (evidence: `src/QueryEngine.ts`)
- Query engine → Session persistence: flushes session (evidence: `src/QueryEngine.ts`)
- Query loop → Built-in tools: dispatches tools
- Query loop → LLM APIs: streams requests
- Provider selection → LLM APIs: selects provider
- Query loop → Agent swarms: spawns agents
- Query loop → MCP connections: uses MCP tools
- MCP connections → MCP servers: connects servers
- Slash commands → Interactive REPL: provides commands
- gRPC server → Query engine: invokes engine (evidence: `src/grpc/server.ts`)
- gRPC client → gRPC server: connects headless
- Remote sessions → Session persistence: manages sessions
- Query engine → Runtime state: reads session state (evidence: `src/QueryEngine.ts`)
- Query engine → Configuration: reads configuration (evidence: `src/QueryEngine.ts`)
- Plugin management → MCP connections: supports MCP plugins
- Language servers → Query loop: assists coding
