# abuzar-ansarii/pocketstrike architecture

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

- Interactive diagram: https://gitdiagram.com/abuzar-ansarii/pocketstrike
- Repository: https://github.com/abuzar-ansarii/pocketstrike

## Overview

PocketStrike is a Flutter AI workstation for mobile, combining chat, cloud and on-device models, tool-using agents, image generation, persistent memory, MCP, and Telegram relay. The principal workflow is a user prompt through the chat interface and controller to a configured model; agent requests can invoke tools and MCP services, while conversation state is managed locally. The README documents capabilities and broad relationships, but the sampled source does not include the Dart runtime implementation, so detailed call ownership and some subsystem links cannot be verified.

Main entry points: [`lib/features/chat/application/chat_controller.dart`](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/chat/application/chat_controller.dart) (Chat coordinator), [`lib/features/agent/data/agent_engine.dart`](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/agent/data/agent_engine.dart) (ReAct agent), [`lib/features/local_models/data/local_model_engine.dart`](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/local_models/data/local_model_engine.dart) (Local GGUF inference), [`lib/features/settings/ui`](https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/settings/ui) (Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App and routing"]
  node_chat["Chat interface"]
  node_chat_controller["Chat coordinator"]
  node_conversations["Conversation history"]
  node_settings["Settings"]
end

subgraph group_intelligence["Models and agents"]
  node_providers["Cloud providers"]
  node_local_models["Local GGUF inference"]
  node_agent["ReAct agent<br/>[agent_engine.dart]"]
  node_agent_tools["Built-in tools"]
  node_hermes["Hermes memory"]
  node_image_gallery["Image generation and gallery"]
end

subgraph group_integration["External integrations"]
  node_mcp["MCP connections"]
  node_telegram["Telegram relay"]
  node_downloads["Model downloads"]
end

subgraph group_state["Local state"]
  node_database[("SQLite database<br/>[app_database.dart]")]
  node_preferences["Preferences and keys"]
end

node_user(("User"))
node_model_host{{"Model service"}}
node_huggingface{{"Hugging Face"}}
node_mcp_servers{{"MCP servers"}}
node_telegram_service{{"Telegram"}}

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_chat
node_chat -.->|"submits prompts"| node_chat_controller
node_chat_controller -->|"requests cloud inference"| node_providers
node_chat_controller -->|"requests local inference"| node_local_models
node_chat_controller -->|"invokes agent"| node_agent
node_chat_controller -->|"requests image generation"| node_image_gallery
node_chat_controller -.->|"manages threads"| node_conversations
node_agent -->|"executes tools"| node_agent_tools
node_agent -->|"uses MCP transport"| node_mcp
node_agent -->|"uses persistent memory"| node_hermes
node_providers -->|"sends requests"| node_model_host
node_local_models -->|"downloads weights"| node_huggingface
node_mcp -->|"connects to"| node_mcp_servers
node_telegram -->|"relays prompts"| node_telegram_service
node_settings -.->|"configures"| node_preferences
node_chat_controller -.->|"persists conversations"| node_database
node_conversations -.->|"reads history"| node_database
node_local_models -->|"reports download progress"| node_downloads
node_settings -->|"configures servers"| node_mcp
node_settings -->|"manages models"| node_local_models

click node_app "https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/app"
click node_chat "https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/chat/ui"
click node_chat_controller "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/chat/application/chat_controller.dart"
click node_conversations "https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/conversations/application"
click node_settings "https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/settings/ui"
click node_providers "https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/providers/data"
click node_local_models "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/local_models/data/local_model_engine.dart"
click node_agent "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/agent/data/agent_engine.dart"
click node_agent_tools "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/agent/data/built_in_tools.dart"
click node_hermes "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/agent/data/hermes_memory_store.dart"
click node_image_gallery "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/gallery/application/gallery_controller.dart"
click node_mcp "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/mcp/data/mcp_connection_manager.dart"
click node_telegram "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/telegram/telegram_service.dart"
click node_downloads "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/core/services/notification_service.dart"
click node_database "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/core/db/app_database.dart"
click node_preferences "https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/core/storage/prefs_provider.dart"

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_chat,node_chat_controller,node_conversations,node_settings,node_user toneBlue
class node_providers,node_local_models,node_agent,node_agent_tools,node_hermes,node_image_gallery toneAmber
class node_mcp,node_telegram,node_downloads,node_mcp_servers toneMint
class node_database,node_preferences toneRose
class node_model_host,node_huggingface,node_telegram_service toneIndigo
```

## Components

### App experience

- [App and routing](https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/app): `lib/app`
- [Chat interface](https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/chat/ui): `lib/features/chat/ui`
- [Chat coordinator](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/chat/application/chat_controller.dart): `lib/features/chat/application/chat_controller.dart`
- [Conversation history](https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/conversations/application): `lib/features/conversations/application`
- [Settings](https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/settings/ui): `lib/features/settings/ui`

### Models and agents

- [Cloud providers](https://github.com/abuzar-ansarii/pocketstrike/tree/main/lib/features/providers/data): `lib/features/providers/data`
- [Local GGUF inference](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/local_models/data/local_model_engine.dart): `lib/features/local_models/data/local_model_engine.dart`
- [ReAct agent](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/agent/data/agent_engine.dart): `lib/features/agent/data/agent_engine.dart`
- [Built-in tools](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/agent/data/built_in_tools.dart): `lib/features/agent/data/built_in_tools.dart`
- [Hermes memory](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/agent/data/hermes_memory_store.dart): `lib/features/agent/data/hermes_memory_store.dart`
- [Image generation and gallery](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/gallery/application/gallery_controller.dart): `lib/features/gallery/application/gallery_controller.dart`

### External integrations

- [MCP connections](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/mcp/data/mcp_connection_manager.dart): `lib/features/mcp/data/mcp_connection_manager.dart`
- [Telegram relay](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/features/telegram/telegram_service.dart): `lib/features/telegram/telegram_service.dart`
- [Model downloads](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/core/services/notification_service.dart): `lib/core/services/notification_service.dart`

### Local state

- [SQLite database](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/core/db/app_database.dart): `lib/core/db/app_database.dart`
- [Preferences and keys](https://github.com/abuzar-ansarii/pocketstrike/blob/main/lib/core/storage/prefs_provider.dart): `lib/core/storage/prefs_provider.dart`

### Other components

- **User**
- **Model service**
- **Hugging Face**
- **MCP servers**
- **Telegram**

## Connections

- User → App and routing: opens (evidence: `README.md`)
- App and routing → Chat interface: routes to (evidence: `README.md`)
- Chat interface → Chat coordinator: submits prompts
- Chat coordinator → Cloud providers: requests cloud inference (evidence: `README.md`)
- Chat coordinator → Local GGUF inference: requests local inference (evidence: `README.md`)
- Chat coordinator → ReAct agent: invokes agent (evidence: `README.md`)
- Chat coordinator → Image generation and gallery: requests image generation (evidence: `README.md`)
- Chat coordinator → Conversation history: manages threads
- ReAct agent → Built-in tools: executes tools (evidence: `README.md`)
- ReAct agent → MCP connections: uses MCP transport (evidence: `README.md`)
- ReAct agent → Hermes memory: uses persistent memory (evidence: `README.md`)
- Cloud providers → Model service: sends requests (evidence: `README.md`)
- Local GGUF inference → Hugging Face: downloads weights (evidence: `README.md`)
- MCP connections → MCP servers: connects to (evidence: `README.md`)
- Telegram relay → Telegram: relays prompts (evidence: `README.md`)
- Settings → Preferences and keys: configures
- Chat coordinator → SQLite database: persists conversations
- Conversation history → SQLite database: reads history
- Local GGUF inference → Model downloads: reports download progress (evidence: `README.md`)
- Settings → MCP connections: configures servers (evidence: `README.md`)
- Settings → Local GGUF inference: manages models (evidence: `README.md`)
