# shahin0964/ai-agent- architecture

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

- Interactive diagram: https://gitdiagram.com/shahin0964/ai-agent-
- Repository: https://github.com/shahin0964/ai-agent-

## Overview

Nexus AI is an Android personal assistant whose main workflow runs from user-facing chat, voice, or vision interfaces through agent/AI capabilities to a response or device action. It also supports background routines and companion features. The README documents these capabilities and broad architecture; source excerpts here contain only build configuration, so internal call ownership and several integrations cannot be verified. The graph therefore uses documented product relationships and the exact implementation paths available in the tree, omitting uncertain wiring.

Main entry points: [`app/src/main/java/com/example/core/orchestrator/AgentOrchestrator.kt`](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/orchestrator/AgentOrchestrator.kt) (Agent Orchestrator), [`app/src/main/java/com/example/ui/screens/MainAppScreen.kt`](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/MainAppScreen.kt) (Main Dashboard), [`app/src/main/java/com/example/core/tool/AndroidTools.kt`](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/tool/AndroidTools.kt) (Android Tools), [`app/src/main/java/com/example/ui/screens/VoiceScreen.kt`](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/VoiceScreen.kt) (Voice UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Assistant Interfaces"]
  node_main["App Shell<br/>[MainActivity.kt]"]
  node_appscreen["Main Dashboard<br/>[MainAppScreen.kt]"]
  node_chat["AI Chat<br/>[ChatScreen.kt]"]
  node_voiceui["Voice UI<br/>[VoiceScreen.kt]"]
  node_visionui["Vision Studio<br/>[VisionScreen.kt]"]
  node_town["Agent Town<br/>[AgentTownScreen.kt]"]
  node_automationui["Automation Builder"]
  node_voiceengine["Speech Recognition"]
  node_tts["Speech Output"]
end

subgraph group_agent["Agent And Device"]
  node_orchestrator["Agent Orchestrator"]
  node_controller["Agent Controller<br/>[AgentController.kt]"]
  node_parser["Command Parser<br/>[CommandParser.kt]"]
  node_tools["Android Tools<br/>[AndroidTools.kt]"]
  node_telemetry["Device Telemetry"]
  node_accessibility["Accessibility Bridge"]
end

subgraph group_intelligence["AI Intelligence"]
  node_router["AI Router"]
  node_providers["AI Providers<br/>[AIProvider.kt]"]
  node_vision["Vision Engine<br/>[VisionEngine.kt]"]
  node_memory["Conversation Memory<br/>[MemoryManager.kt]"]
end

subgraph group_automation["Automation"]
  node_automation["Automation Engine"]
  node_scheduler["Routine Scheduler"]
  node_store[("Automation Store<br/>[AutomationStore.kt]")]
end

subgraph group_presence["Background Presence"]
  node_companion["Companion Engine<br/>[CompanionEngine.kt]"]
  node_foreground["Foreground Service"]
end

node_user(("Operator"))
node_cloud{{"AI Service Providers"}}
node_android{{"Android Device"}}

node_user -->|"opens"| node_main
node_main -->|"shows"| node_appscreen
node_appscreen -->|"navigates"| node_chat
node_appscreen -->|"navigates"| node_voiceui
node_appscreen -->|"navigates"| node_visionui
node_appscreen -->|"navigates"| node_town
node_chat -->|"submits requests"| node_orchestrator
node_voiceui -->|"captures speech"| node_voiceengine
node_voiceui -->|"submits requests"| node_orchestrator
node_visionui -->|"requests analysis"| node_vision
node_orchestrator -->|"dispatches"| node_controller
node_controller -->|"parses commands"| node_parser
node_orchestrator -->|"requests AI"| node_router
node_router -->|"routes requests"| node_providers
node_providers -.->|"calls"| node_cloud
node_orchestrator -->|"uses context"| node_memory
node_orchestrator -->|"invokes tools"| node_tools
node_tools -->|"reads device state"| node_telemetry
node_tools -->|"uses accessibility"| node_accessibility
node_tools -->|"controls device"| node_android
node_voiceengine -->|"uses speech input"| node_android
node_tts -->|"speaks responses"| node_android
node_automationui -->|"configures routines"| node_automation
node_automation -->|"persists routines"| node_store
node_automation -->|"schedules execution"| node_scheduler
node_scheduler -->|"sets alarms"| node_android
node_foreground -->|"supports presence"| node_companion

click node_main "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/MainActivity.kt"
click node_appscreen "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/MainAppScreen.kt"
click node_chat "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/ChatScreen.kt"
click node_voiceui "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/VoiceScreen.kt"
click node_visionui "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/VisionScreen.kt"
click node_town "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/AgentTownScreen.kt"
click node_orchestrator "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/orchestrator/AgentOrchestrator.kt"
click node_controller "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/agent/AgentController.kt"
click node_parser "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/action/CommandParser.kt"
click node_tools "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/tool/AndroidTools.kt"
click node_telemetry "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/telemetry/AndroidSystemTelemetry.kt"
click node_accessibility "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/accessibility/AgentAccessibilityService.kt"
click node_router "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/router/AIIntelligenceRouter.kt"
click node_providers "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/provider/AIProvider.kt"
click node_vision "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/vision/VisionEngine.kt"
click node_memory "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/memory/MemoryManager.kt"
click node_automationui "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/AutomationBuilderScreen.kt"
click node_automation "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/automation/AutomationEngine.kt"
click node_scheduler "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/automation/scheduler/AutomationScheduler.kt"
click node_store "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/automation/store/AutomationStore.kt"
click node_companion "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/companion/CompanionEngine.kt"
click node_foreground "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/service/AgentForegroundService.kt"
click node_voiceengine "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/voice/AndroidSpeechRecognizerEngine.kt"
click node_tts "https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/tts/AndroidTextToSpeechEngine.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_main,node_appscreen,node_chat,node_voiceui,node_visionui,node_town,node_automationui,node_voiceengine,node_tts toneBlue
class node_orchestrator,node_controller,node_parser,node_tools,node_telemetry,node_accessibility toneAmber
class node_router,node_providers,node_vision,node_memory toneMint
class node_automation,node_scheduler,node_store toneRose
class node_companion,node_foreground,node_user,node_cloud,node_android toneIndigo
```

## Components

### Assistant Interfaces

- [App Shell](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/MainActivity.kt): `app/src/main/java/com/example/MainActivity.kt`
- [Main Dashboard](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/MainAppScreen.kt): `app/src/main/java/com/example/ui/screens/MainAppScreen.kt`
- [AI Chat](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/ChatScreen.kt): `app/src/main/java/com/example/ui/screens/ChatScreen.kt`
- [Voice UI](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/VoiceScreen.kt): `app/src/main/java/com/example/ui/screens/VoiceScreen.kt`
- [Vision Studio](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/VisionScreen.kt): `app/src/main/java/com/example/ui/screens/VisionScreen.kt`
- [Agent Town](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/AgentTownScreen.kt): `app/src/main/java/com/example/ui/screens/AgentTownScreen.kt`
- [Automation Builder](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/ui/screens/AutomationBuilderScreen.kt): `app/src/main/java/com/example/ui/screens/AutomationBuilderScreen.kt`
- [Speech Recognition](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/voice/AndroidSpeechRecognizerEngine.kt): `app/src/main/java/com/example/core/voice/AndroidSpeechRecognizerEngine.kt`
- [Speech Output](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/tts/AndroidTextToSpeechEngine.kt): `app/src/main/java/com/example/core/tts/AndroidTextToSpeechEngine.kt`

### Agent And Device

- [Agent Orchestrator](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/orchestrator/AgentOrchestrator.kt): `app/src/main/java/com/example/core/orchestrator/AgentOrchestrator.kt`
- [Agent Controller](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/agent/AgentController.kt): `app/src/main/java/com/example/core/agent/AgentController.kt`
- [Command Parser](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/action/CommandParser.kt): `app/src/main/java/com/example/core/action/CommandParser.kt`
- [Android Tools](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/tool/AndroidTools.kt): `app/src/main/java/com/example/core/tool/AndroidTools.kt`
- [Device Telemetry](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/telemetry/AndroidSystemTelemetry.kt): `app/src/main/java/com/example/core/telemetry/AndroidSystemTelemetry.kt`
- [Accessibility Bridge](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/accessibility/AgentAccessibilityService.kt): `app/src/main/java/com/example/core/accessibility/AgentAccessibilityService.kt`

### AI Intelligence

- [AI Router](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/router/AIIntelligenceRouter.kt): `app/src/main/java/com/example/core/ai/router/AIIntelligenceRouter.kt`
- [AI Providers](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/provider/AIProvider.kt): `app/src/main/java/com/example/core/ai/provider/AIProvider.kt`
- [Vision Engine](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/vision/VisionEngine.kt): `app/src/main/java/com/example/core/ai/vision/VisionEngine.kt`
- [Conversation Memory](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/ai/memory/MemoryManager.kt): `app/src/main/java/com/example/core/ai/memory/MemoryManager.kt`

### Automation

- [Automation Engine](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/automation/AutomationEngine.kt): `app/src/main/java/com/example/core/automation/AutomationEngine.kt`
- [Routine Scheduler](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/automation/scheduler/AutomationScheduler.kt): `app/src/main/java/com/example/core/automation/scheduler/AutomationScheduler.kt`
- [Automation Store](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/automation/store/AutomationStore.kt): `app/src/main/java/com/example/core/automation/store/AutomationStore.kt`

### Background Presence

- [Companion Engine](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/companion/CompanionEngine.kt): `app/src/main/java/com/example/core/companion/CompanionEngine.kt`
- [Foreground Service](https://github.com/shahin0964/ai-agent-/blob/main/app/src/main/java/com/example/core/service/AgentForegroundService.kt): `app/src/main/java/com/example/core/service/AgentForegroundService.kt`

### Other components

- **Operator**
- **AI Service Providers**
- **Android Device**

## Connections

- Operator → App Shell: opens
- App Shell → Main Dashboard: shows
- Main Dashboard → AI Chat: navigates
- Main Dashboard → Voice UI: navigates
- Main Dashboard → Vision Studio: navigates
- Main Dashboard → Agent Town: navigates
- AI Chat → Agent Orchestrator: submits requests
- Voice UI → Speech Recognition: captures speech
- Voice UI → Agent Orchestrator: submits requests
- Vision Studio → Vision Engine: requests analysis
- Agent Orchestrator → Agent Controller: dispatches
- Agent Controller → Command Parser: parses commands
- Agent Orchestrator → AI Router: requests AI
- AI Router → AI Providers: routes requests
- AI Providers → AI Service Providers: calls
- Agent Orchestrator → Conversation Memory: uses context
- Agent Orchestrator → Android Tools: invokes tools
- Android Tools → Device Telemetry: reads device state
- Android Tools → Accessibility Bridge: uses accessibility
- Android Tools → Android Device: controls device
- Speech Recognition → Android Device: uses speech input
- Speech Output → Android Device: speaks responses
- Automation Builder → Automation Engine: configures routines
- Automation Engine → Automation Store: persists routines
- Automation Engine → Routine Scheduler: schedules execution
- Routine Scheduler → Android Device: sets alarms
- Foreground Service → Companion Engine: supports presence
