# ganeshvenkatesanofficial/deskmate architecture

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

- Interactive diagram: https://gitdiagram.com/ganeshvenkatesanofficial/deskmate
- Repository: https://github.com/ganeshvenkatesanofficial/deskmate

## Overview

DeskMate is a desktop AI copilot with a Flutter chat client and a locally hosted FastAPI backend. Users submit prompts in either File Explorer or Personal Agent mode; the backend dispatches to the corresponding tool-calling agent and returns a response to the client. The graph preserves the README’s documented integrations and capabilities. Several Flutter modules and backend routes were not sampled, so those links rely on README statements rather than inspected implementations.

Main entry points: [`deskmate_app/lib/screens/chat_screen.dart`](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/screens/chat_screen.dart) (Chat Screen), [`terminal-ai-agent/agent.py`](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/agent.py) (File Agent), [`terminal-ai-agent/personal_tools.py`](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/personal_tools.py) (Workspace Tools), [`terminal-ai-agent/backend.py`](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/backend.py) (FastAPI Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Flutter Client"]
  node_chat_ui["Chat Screen<br/>[chat_screen.dart]"]
  node_chat_provider["Chat Provider<br/>[chat_provider.dart]"]
  node_api_service["API Service<br/>[api_service.dart]"]
  node_chat_message["Chat Messages<br/>[chat_message.dart]"]
  node_chat_bubble["Chat Bubble<br/>[chat_bubble.dart]"]
  node_sidebar["Mode Sidebar<br/>[sidebar.dart]"]
  node_backend_manager["Backend Manager"]
  node_windows_host["Windows Flutter Host<br/>[flutter_window.cpp]"]
end

subgraph group_backend["Backend Runtime"]
  node_fastapi["FastAPI Routes<br/>[backend.py]"]
  node_model_choice["Model Selection<br/>[agent.py]"]
  node_ollama_client["Ollama Client<br/>[local_llm.py]"]
end

subgraph group_file["File Copilot"]
  node_file_agent["File Agent<br/>[agent.py]"]
  node_file_tools["Filesystem Tools<br/>[tools.py]"]
  node_rag_tools["Document RAG Tools<br/>[rag_tools.py]"]
  node_qdrant[("Qdrant Index")]
end

subgraph group_personal["Personal Workspace"]
  node_personal_agent["Personal Agent<br/>[personal_agent.py]"]
  node_personal_tools["Workspace Tools<br/>[personal_tools.py]"]
  node_local_store[("SQLite and FAISS")]
  node_google["Google Workspace"]
  node_web_services["Web Services"]
end

node_user(("Desktop User"))
node_gemini["Gemini API"]
node_ollama["Ollama Service"]

node_user -->|"enters prompt"| node_chat_ui
node_chat_ui -.->|"submits prompt"| node_chat_provider
node_chat_provider -.->|"sends request"| node_api_service
node_api_service -->|"posts prompt"| node_fastapi
node_fastapi -->|"runs agent"| node_file_agent
node_fastapi -->|"gets agent"| node_personal_agent
node_file_agent -->|"registers tools"| node_file_tools
node_file_agent -->|"registers tools"| node_rag_tools
node_rag_tools -->|"indexes and searches"| node_qdrant
node_file_tools -->|"uses semantic search"| node_qdrant
node_personal_agent -->|"registers tools"| node_personal_tools
node_personal_tools -->|"persists tasks and memory"| node_local_store
node_personal_tools -->|"uses OAuth services"| node_google
node_personal_tools -->|"queries web APIs"| node_web_services
node_file_agent -->|"selects model"| node_model_choice
node_personal_agent -.->|"selects model"| node_model_choice
node_model_choice -->|"uses with key"| node_gemini
node_model_choice -->|"falls back locally"| node_ollama_client
node_ollama_client -->|"sends generation request"| node_ollama
node_chat_ui -.->|"uses messages"| node_chat_message
node_chat_ui -.->|"renders messages"| node_chat_bubble
node_sidebar -->|"selects mode"| node_chat_provider
node_backend_manager -.->|"manages local process"| node_fastapi
node_windows_host -.->|"hosts Flutter app"| node_chat_ui

click node_chat_ui "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/screens/chat_screen.dart"
click node_chat_provider "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/providers/chat_provider.dart"
click node_api_service "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/services/api_service.dart"
click node_chat_message "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/models/chat_message.dart"
click node_chat_bubble "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/widgets/chat_bubble.dart"
click node_sidebar "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/widgets/sidebar.dart"
click node_backend_manager "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/services/backend_manager.dart"
click node_fastapi "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/backend.py"
click node_file_agent "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/agent.py"
click node_file_tools "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/tools.py"
click node_rag_tools "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/rag_tools.py"
click node_personal_agent "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/personal_agent.py"
click node_personal_tools "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/personal_tools.py"
click node_model_choice "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/agent.py"
click node_ollama_client "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/local_llm.py"
click node_windows_host "https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/windows/runner/flutter_window.cpp"

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_chat_ui,node_chat_provider,node_api_service,node_chat_message,node_chat_bubble,node_sidebar,node_backend_manager,node_windows_host,node_user toneBlue
class node_fastapi,node_model_choice,node_ollama_client toneAmber
class node_file_agent,node_file_tools,node_rag_tools,node_qdrant,node_gemini toneMint
class node_personal_agent,node_personal_tools,node_local_store,node_google,node_web_services toneRose
class node_ollama toneIndigo
```

## Components

### Flutter Client

- [Chat Screen](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/screens/chat_screen.dart): `deskmate_app/lib/screens/chat_screen.dart`
- [Chat Provider](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/providers/chat_provider.dart): `deskmate_app/lib/providers/chat_provider.dart`
- [API Service](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/services/api_service.dart): `deskmate_app/lib/services/api_service.dart`
- [Chat Messages](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/models/chat_message.dart): `deskmate_app/lib/models/chat_message.dart`
- [Chat Bubble](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/widgets/chat_bubble.dart): `deskmate_app/lib/widgets/chat_bubble.dart`
- [Mode Sidebar](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/widgets/sidebar.dart): `deskmate_app/lib/widgets/sidebar.dart`
- [Backend Manager](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/lib/services/backend_manager.dart): `deskmate_app/lib/services/backend_manager.dart`
- [Windows Flutter Host](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/deskmate_app/windows/runner/flutter_window.cpp): `deskmate_app/windows/runner/flutter_window.cpp`

### Backend Runtime

- [FastAPI Routes](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/backend.py): `terminal-ai-agent/backend.py`
- [Model Selection](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/agent.py): `terminal-ai-agent/agent.py`
- [Ollama Client](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/local_llm.py): `terminal-ai-agent/local_llm.py`

### File Copilot

- [File Agent](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/agent.py): `terminal-ai-agent/agent.py`
- [Filesystem Tools](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/tools.py): `terminal-ai-agent/tools.py`
- [Document RAG Tools](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/rag_tools.py): `terminal-ai-agent/rag_tools.py`
- **Qdrant Index**

### Personal Workspace

- [Personal Agent](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/personal_agent.py): `terminal-ai-agent/personal_agent.py`
- [Workspace Tools](https://github.com/ganeshvenkatesanofficial/deskmate/blob/main/terminal-ai-agent/personal_tools.py): `terminal-ai-agent/personal_tools.py`
- **SQLite and FAISS**
- **Google Workspace**
- **Web Services**

### Other components

- **Desktop User**
- **Gemini API**
- **Ollama Service**

## Connections

- Desktop User → Chat Screen: enters prompt (evidence: `README.md`)
- Chat Screen → Chat Provider: submits prompt (evidence: `README.md`)
- Chat Provider → API Service: sends request (evidence: `README.md`)
- API Service → FastAPI Routes: posts prompt (evidence: `README.md`)
- FastAPI Routes → File Agent: runs agent (evidence: `README.md`)
- FastAPI Routes → Personal Agent: gets agent (evidence: `README.md`)
- File Agent → Filesystem Tools: registers tools (evidence: `terminal-ai-agent/agent.py`)
- File Agent → Document RAG Tools: registers tools (evidence: `terminal-ai-agent/agent.py`)
- Document RAG Tools → Qdrant Index: indexes and searches (evidence: `terminal-ai-agent/rag_tools.py`)
- Filesystem Tools → Qdrant Index: uses semantic search (evidence: `README.md`)
- Personal Agent → Workspace Tools: registers tools (evidence: `terminal-ai-agent/personal_agent.py`)
- Workspace Tools → SQLite and FAISS: persists tasks and memory (evidence: `terminal-ai-agent/personal_tools.py`)
- Workspace Tools → Google Workspace: uses OAuth services (evidence: `README.md`)
- Workspace Tools → Web Services: queries web APIs (evidence: `README.md`)
- File Agent → Model Selection: selects model (evidence: `terminal-ai-agent/agent.py`)
- Personal Agent → Model Selection: selects model (evidence: `README.md`)
- Model Selection → Gemini API: uses with key (evidence: `README.md`)
- Model Selection → Ollama Client: falls back locally (evidence: `terminal-ai-agent/agent.py`)
- Ollama Client → Ollama Service: sends generation request (evidence: `terminal-ai-agent/local_llm.py`)
- Chat Screen → Chat Messages: uses messages
- Chat Screen → Chat Bubble: renders messages
- Mode Sidebar → Chat Provider: selects mode (evidence: `README.md`)
- Backend Manager → FastAPI Routes: manages local process (evidence: `README.md`)
- Windows Flutter Host → Chat Screen: hosts Flutter app (evidence: `README.md`)
