# amiantos/inneal architecture

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

- Interactive diagram: https://gitdiagram.com/amiantos/inneal
- Repository: https://github.com/amiantos/inneal

## Overview

Inneal is a native SwiftUI roleplay chat client for AI Horde. Users set up a persona, create or import character cards, open single- or multi-character chats, and generate replies; chat messages support alternate responses. The README also documents Auto Mode and CloudKit syncing. The graph follows the app’s shown navigation and generation calls; some broader UI and persistence behavior is represented from documented capabilities and the source index, since those implementations were not excerpted.

Main entry points: [`Inneal/Views/Chats/ChatsView.swift`](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chats/ChatsView.swift) (Chat List), [`Inneal/Views/Chat/ChatView.swift`](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/ChatView.swift) (Chat View), [`Inneal/Views/Characters/CharactersView.swift`](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Characters/CharactersView.swift) (Character Library), [`Inneal/Models/SwiftDataModels.swift`](https://github.com/amiantos/inneal/blob/main/Inneal/Models/SwiftDataModels.swift) (Chat Data Models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Navigation"]
  node_app["App Entry<br/>[InnealApp.swift]"]
  node_chatlist["Chat List<br/>[ChatsView.swift]"]
  node_setup["Introduction Setup"]
  node_preferences["Preferences<br/>[Preferences.swift]"]
  node_userprefs["User Settings"]
end

subgraph group_characters["Character Management"]
  node_characters["Character Library"]
  node_characteredit["Character Editor"]
  node_characterimport["Card Import"]
  node_tavern["Tavern Card Models<br/>[TavernModels.swift]"]
end

subgraph group_chat["Chat Experience"]
  node_createchat["Create Chat"]
  node_chatview["Chat View<br/>[ChatView.swift]"]
  node_chatsettings["Chat Settings"]
  node_messages["Message Presentation<br/>[MessageCell.swift]"]
  node_chatvm["Chat Generation<br/>[ViewModel.swift]"]
end

subgraph group_services["AI Services"]
  node_horde["Horde Client<br/>[HordeAPI.swift]"]
end

subgraph group_data["Domain Data"]
  node_models["Chat Data Models"]
  node_store[("SwiftData Store<br/>[InnealApp.swift]")]
end

node_user(("User"))
node_hordeservice{{"AI Horde"}}
node_cloudkit{{"CloudKit Sync"}}

node_user -->|"opens"| node_app
node_app -->|"shows"| node_chatlist
node_chatlist -->|"selects chat"| node_chatview
node_chatlist -->|"creates chat"| node_createchat
node_chatlist -->|"opens library"| node_characters
node_chatlist -->|"opens settings"| node_userprefs
node_chatlist -->|"presents setup"| node_setup
node_setup -->|"creates chats"| node_models
node_setup -->|"reads setup state"| node_preferences
node_characters -->|"edits character"| node_characteredit
node_characters -->|"imports cards"| node_characterimport
node_characters -->|"starts chat"| node_createchat
node_characterimport -.->|"decodes card"| node_tavern
node_createchat -.->|"creates chat"| node_models
node_chatview -->|"requests reply"| node_chatvm
node_chatview -.->|"renders messages"| node_messages
node_chatview -.->|"opens settings"| node_chatsettings
node_chatvm -->|"submits and polls"| node_horde
node_horde -->|"sends requests"| node_hordeservice
node_chatview -.->|"updates messages"| node_models
node_app -->|"configures container"| node_store
node_store -->|"stores records"| node_models
node_store -.->|"syncs records"| node_cloudkit

click node_app "https://github.com/amiantos/inneal/blob/main/Inneal/InnealApp.swift"
click node_chatlist "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chats/ChatsView.swift"
click node_setup "https://github.com/amiantos/inneal/blob/main/Inneal/Views/IntroductionView.swift"
click node_preferences "https://github.com/amiantos/inneal/blob/main/Inneal/Models/Preferences.swift"
click node_characters "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Characters/CharactersView.swift"
click node_characteredit "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Character/CharacterView.swift"
click node_characterimport "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Characters/ImportCharacterView.swift"
click node_tavern "https://github.com/amiantos/inneal/blob/main/Inneal/Models/TavernModels.swift"
click node_createchat "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chats/CreateChatView.swift"
click node_chatview "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/ChatView.swift"
click node_chatsettings "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/ChatSettingsView.swift"
click node_messages "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/MessageCell.swift"
click node_chatvm "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/ViewModel.swift"
click node_userprefs "https://github.com/amiantos/inneal/blob/main/Inneal/Views/Settings/UserSettingsView.swift"
click node_models "https://github.com/amiantos/inneal/blob/main/Inneal/Models/SwiftDataModels.swift"
click node_store "https://github.com/amiantos/inneal/blob/main/Inneal/InnealApp.swift"
click node_horde "https://github.com/amiantos/inneal/blob/main/Inneal/External%20APIs/Horde%20API/HordeAPI.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_chatlist,node_setup,node_preferences,node_userprefs,node_user toneBlue
class node_characters,node_characteredit,node_characterimport,node_tavern toneAmber
class node_createchat,node_chatview,node_chatsettings,node_messages,node_chatvm toneMint
class node_horde toneRose
class node_models,node_store,node_hordeservice,node_cloudkit toneIndigo
```

## Components

### App Navigation

- [App Entry](https://github.com/amiantos/inneal/blob/main/Inneal/InnealApp.swift): `Inneal/InnealApp.swift`
- [Chat List](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chats/ChatsView.swift): `Inneal/Views/Chats/ChatsView.swift`
- [Introduction Setup](https://github.com/amiantos/inneal/blob/main/Inneal/Views/IntroductionView.swift): `Inneal/Views/IntroductionView.swift`
- [Preferences](https://github.com/amiantos/inneal/blob/main/Inneal/Models/Preferences.swift): `Inneal/Models/Preferences.swift`
- [User Settings](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Settings/UserSettingsView.swift): `Inneal/Views/Settings/UserSettingsView.swift`

### Character Management

- [Character Library](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Characters/CharactersView.swift): `Inneal/Views/Characters/CharactersView.swift`
- [Character Editor](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Character/CharacterView.swift): `Inneal/Views/Character/CharacterView.swift`
- [Card Import](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Characters/ImportCharacterView.swift): `Inneal/Views/Characters/ImportCharacterView.swift`
- [Tavern Card Models](https://github.com/amiantos/inneal/blob/main/Inneal/Models/TavernModels.swift): `Inneal/Models/TavernModels.swift`

### Chat Experience

- [Create Chat](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chats/CreateChatView.swift): `Inneal/Views/Chats/CreateChatView.swift`
- [Chat View](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/ChatView.swift): `Inneal/Views/Chat/ChatView.swift`
- [Chat Settings](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/ChatSettingsView.swift): `Inneal/Views/Chat/ChatSettingsView.swift`
- [Message Presentation](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/MessageCell.swift): `Inneal/Views/Chat/MessageCell.swift`
- [Chat Generation](https://github.com/amiantos/inneal/blob/main/Inneal/Views/Chat/ViewModel.swift): `Inneal/Views/Chat/ViewModel.swift`

### AI Services

- [Horde Client](https://github.com/amiantos/inneal/blob/main/Inneal/External%20APIs/Horde%20API/HordeAPI.swift): `Inneal/External APIs/Horde API/HordeAPI.swift`

### Domain Data

- [Chat Data Models](https://github.com/amiantos/inneal/blob/main/Inneal/Models/SwiftDataModels.swift): `Inneal/Models/SwiftDataModels.swift`
- [SwiftData Store](https://github.com/amiantos/inneal/blob/main/Inneal/InnealApp.swift): `Inneal/InnealApp.swift`

### Other components

- **User**
- **AI Horde**
- **CloudKit Sync**

## Connections

- User → App Entry: opens (evidence: `Inneal/InnealApp.swift`)
- App Entry → Chat List: shows (evidence: `Inneal/InnealApp.swift`)
- Chat List → Chat View: selects chat (evidence: `Inneal/Views/Chats/ChatsView.swift`)
- Chat List → Create Chat: creates chat (evidence: `Inneal/Views/Chats/ChatsView.swift`)
- Chat List → Character Library: opens library (evidence: `Inneal/Views/Chats/ChatsView.swift`)
- Chat List → User Settings: opens settings (evidence: `Inneal/Views/Chats/ChatsView.swift`)
- Chat List → Introduction Setup: presents setup (evidence: `Inneal/Views/Chats/ChatsView.swift`)
- Introduction Setup → Chat Data Models: creates chats (evidence: `Inneal/Views/IntroductionView.swift`)
- Introduction Setup → Preferences: reads setup state (evidence: `Inneal/Views/IntroductionView.swift`)
- Character Library → Character Editor: edits character (evidence: `Inneal/Views/Characters/CharactersView.swift`)
- Character Library → Card Import: imports cards (evidence: `Inneal/Views/Characters/CharactersView.swift`)
- Character Library → Create Chat: starts chat (evidence: `Inneal/Views/Characters/CharactersView.swift`)
- Card Import → Tavern Card Models: decodes card
- Create Chat → Chat Data Models: creates chat
- Chat View → Chat Generation: requests reply (evidence: `Inneal/Views/Chat/ChatView.swift`)
- Chat View → Message Presentation: renders messages (evidence: `Inneal/Views/Chat/ChatView.swift`)
- Chat View → Chat Settings: opens settings (evidence: `Inneal/Views/Chat/ChatView.swift`)
- Chat Generation → Horde Client: submits and polls (evidence: `Inneal/Views/Chat/ViewModel.swift`)
- Horde Client → AI Horde: sends requests (evidence: `Inneal/External APIs/Horde API/HordeAPI.swift`)
- Chat View → Chat Data Models: updates messages
- App Entry → SwiftData Store: configures container (evidence: `Inneal/InnealApp.swift`)
- SwiftData Store → Chat Data Models: stores records (evidence: `Inneal/InnealApp.swift`)
- SwiftData Store → CloudKit Sync: syncs records (evidence: `README.md`)
