# brutal-45/nexus-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/brutal-45/nexus-assistant
- Repository: https://github.com/brutal-45/nexus-assistant

## Overview

Nexus is a cross-platform mobile AI assistant centered on downloading models, chatting with local or remote inference engines, and managing assistant personas. The graph also preserves documented web-search, page-reading, and voice capabilities. Several store, search-provider, and screen implementations are absent from the supplied tree or excerpts, so those links are left out rather than inferred.

Main entry points: [`src/screens/ChatScreen/ChatScreen.tsx`](https://github.com/brutal-45/nexus-assistant/blob/master/src/screens/ChatScreen/ChatScreen.tsx) (Chat screen), [`src/screens/OnboardingScreens/useOnboardingHandlers.ts`](https://github.com/brutal-45/nexus-assistant/blob/master/src/screens/OnboardingScreens/useOnboardingHandlers.ts) (Onboarding), [`App.tsx`](https://github.com/brutal-45/nexus-assistant/blob/master/App.tsx) (App shell), [`src/services/talents/WebSearchEngine.ts`](https://github.com/brutal-45/nexus-assistant/blob/master/src/services/talents/WebSearchEngine.ts) (Web search tool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_onboarding["Onboarding"]
  node_chat["Chat screen<br/>[ChatScreen.tsx]"]
  node_pal_ui["Pal interface<br/>[PalSheet.tsx]"]
  node_pal_hub["Pals Hub<br/>[index.ts]"]
end

subgraph group_models["Models and chat"]
  node_models_ui["Model discovery"]
  node_downloads["Model downloads<br/>[DownloadManager.ts]"]
  node_completion["Completion engines"]
  node_sessions["Chat sessions"]
  node_database[("App database<br/>[index.ts]")]
end

subgraph group_tools["Assistant tools"]
  node_web_search["Web search tool<br/>[WebSearchEngine.ts]"]
  node_read_url["Page reader<br/>[ReadUrlEngine.ts]"]
  node_tts_setup["Voice setup<br/>[TTSSetupSheet.tsx]"]
  node_tts_registry["Speech engines<br/>[engineRegistry.ts]"]
end

subgraph group_platform["Platform capabilities"]
  node_shortcuts["iOS shortcuts<br/>[AskPalIntent.swift]"]
  node_inference_engine["Shortcut inference"]
end

node_user(("User"))
node_search_provider{{"Search provider"}}
node_speech_runtime{{"Speech runtime"}}

node_user -->|"opens"| node_app
node_app -->|"presents"| node_onboarding
node_app -->|"navigates"| node_chat
node_user -->|"chooses setup"| node_onboarding
node_onboarding -->|"registers model"| node_models_ui
node_onboarding -->|"creates or updates"| node_pal_ui
node_user -->|"browses models"| node_models_ui
node_models_ui -->|"starts download"| node_downloads
node_user -->|"sends message"| node_chat
node_chat -->|"requests completion"| node_completion
node_chat -->|"loads and saves"| node_sessions
node_sessions -->|"reads and writes"| node_database
node_completion -.->|"uses local runtime"| node_inference_engine
node_chat -->|"invokes tool"| node_web_search
node_chat -->|"invokes tool"| node_read_url
node_web_search -->|"searches"| node_search_provider
node_read_url -->|"fetches page"| node_search_provider
node_web_search -->|"allows result URLs"| node_read_url
node_user -->|"configures voice"| node_tts_setup
node_tts_setup -->|"selects engine"| node_tts_registry
node_tts_registry -.->|"dispatches speech"| node_speech_runtime
node_user -->|"browses assistants"| node_pal_hub
node_user -->|"asks assistant"| node_shortcuts
node_shortcuts -->|"requests inference"| node_inference_engine

click node_app "https://github.com/brutal-45/nexus-assistant/blob/master/App.tsx"
click node_onboarding "https://github.com/brutal-45/nexus-assistant/blob/master/src/screens/OnboardingScreens/useOnboardingHandlers.ts"
click node_chat "https://github.com/brutal-45/nexus-assistant/blob/master/src/screens/ChatScreen/ChatScreen.tsx"
click node_pal_ui "https://github.com/brutal-45/nexus-assistant/blob/master/src/components/PalsSheets/PalSheet.tsx"
click node_pal_hub "https://github.com/brutal-45/nexus-assistant/blob/master/src/components/PalsHub/index.ts"
click node_models_ui "https://github.com/brutal-45/nexus-assistant/tree/master/src/screens"
click node_downloads "https://github.com/brutal-45/nexus-assistant/blob/master/src/services/downloads/DownloadManager.ts"
click node_completion "https://github.com/brutal-45/nexus-assistant/blob/master/src/api/completionEngines.ts"
click node_sessions "https://github.com/brutal-45/nexus-assistant/blob/master/src/repositories/ChatSessionRepository.ts"
click node_database "https://github.com/brutal-45/nexus-assistant/blob/master/src/database/index.ts"
click node_web_search "https://github.com/brutal-45/nexus-assistant/blob/master/src/services/talents/WebSearchEngine.ts"
click node_read_url "https://github.com/brutal-45/nexus-assistant/blob/master/src/services/talents/ReadUrlEngine.ts"
click node_tts_setup "https://github.com/brutal-45/nexus-assistant/blob/master/src/components/TTSSetupSheet/TTSSetupSheet.tsx"
click node_tts_registry "https://github.com/brutal-45/nexus-assistant/blob/master/src/services/tts/engineRegistry.ts"
click node_shortcuts "https://github.com/brutal-45/nexus-assistant/blob/master/ios/PocketPal/AppIntents/AskPalIntent.swift"
click node_inference_engine "https://github.com/brutal-45/nexus-assistant/blob/master/ios/PocketPal/AppIntents/LlamaInferenceEngine.swift"

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_app,node_onboarding,node_chat,node_pal_ui,node_pal_hub,node_user toneBlue
class node_models_ui,node_downloads,node_completion,node_sessions,node_database toneAmber
class node_web_search,node_read_url,node_tts_setup,node_tts_registry toneMint
class node_shortcuts,node_inference_engine toneRose
class node_search_provider,node_speech_runtime toneIndigo
```

## Components

### App experience

- [App shell](https://github.com/brutal-45/nexus-assistant/blob/master/App.tsx): `App.tsx`
- [Onboarding](https://github.com/brutal-45/nexus-assistant/blob/master/src/screens/OnboardingScreens/useOnboardingHandlers.ts): `src/screens/OnboardingScreens/useOnboardingHandlers.ts`
- [Chat screen](https://github.com/brutal-45/nexus-assistant/blob/master/src/screens/ChatScreen/ChatScreen.tsx): `src/screens/ChatScreen/ChatScreen.tsx`
- [Pal interface](https://github.com/brutal-45/nexus-assistant/blob/master/src/components/PalsSheets/PalSheet.tsx): `src/components/PalsSheets/PalSheet.tsx`
- [Pals Hub](https://github.com/brutal-45/nexus-assistant/blob/master/src/components/PalsHub/index.ts): `src/components/PalsHub/index.ts`

### Models and chat

- [Model discovery](https://github.com/brutal-45/nexus-assistant/tree/master/src/screens): `src/screens`
- [Model downloads](https://github.com/brutal-45/nexus-assistant/blob/master/src/services/downloads/DownloadManager.ts): `src/services/downloads/DownloadManager.ts`
- [Completion engines](https://github.com/brutal-45/nexus-assistant/blob/master/src/api/completionEngines.ts): `src/api/completionEngines.ts`
- [Chat sessions](https://github.com/brutal-45/nexus-assistant/blob/master/src/repositories/ChatSessionRepository.ts): `src/repositories/ChatSessionRepository.ts`
- [App database](https://github.com/brutal-45/nexus-assistant/blob/master/src/database/index.ts): `src/database/index.ts`

### Assistant tools

- [Web search tool](https://github.com/brutal-45/nexus-assistant/blob/master/src/services/talents/WebSearchEngine.ts): `src/services/talents/WebSearchEngine.ts`
- [Page reader](https://github.com/brutal-45/nexus-assistant/blob/master/src/services/talents/ReadUrlEngine.ts): `src/services/talents/ReadUrlEngine.ts`
- [Voice setup](https://github.com/brutal-45/nexus-assistant/blob/master/src/components/TTSSetupSheet/TTSSetupSheet.tsx): `src/components/TTSSetupSheet/TTSSetupSheet.tsx`
- [Speech engines](https://github.com/brutal-45/nexus-assistant/blob/master/src/services/tts/engineRegistry.ts): `src/services/tts/engineRegistry.ts`

### Platform capabilities

- [iOS shortcuts](https://github.com/brutal-45/nexus-assistant/blob/master/ios/PocketPal/AppIntents/AskPalIntent.swift): `ios/PocketPal/AppIntents/AskPalIntent.swift`
- [Shortcut inference](https://github.com/brutal-45/nexus-assistant/blob/master/ios/PocketPal/AppIntents/LlamaInferenceEngine.swift): `ios/PocketPal/AppIntents/LlamaInferenceEngine.swift`

### Other components

- **User**
- **Search provider**
- **Speech runtime**

## Connections

- User → App shell: opens
- App shell → Onboarding: presents
- App shell → Chat screen: navigates
- User → Onboarding: chooses setup
- Onboarding → Model discovery: registers model
- Onboarding → Pal interface: creates or updates
- User → Model discovery: browses models
- Model discovery → Model downloads: starts download
- User → Chat screen: sends message
- Chat screen → Completion engines: requests completion
- Chat screen → Chat sessions: loads and saves
- Chat sessions → App database: reads and writes
- Completion engines → Shortcut inference: uses local runtime
- Chat screen → Web search tool: invokes tool
- Chat screen → Page reader: invokes tool
- Web search tool → Search provider: searches
- Page reader → Search provider: fetches page
- Web search tool → Page reader: allows result URLs
- User → Voice setup: configures voice
- Voice setup → Speech engines: selects engine
- Speech engines → Speech runtime: dispatches speech
- User → Pals Hub: browses assistants
- User → iOS shortcuts: asks assistant
- iOS shortcuts → Shortcut inference: requests inference
