# gemkids275/aishortcuts architecture

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

- Interactive diagram: https://gitdiagram.com/gemkids275/aishortcuts
- Repository: https://github.com/gemkids275/aishortcuts

## Overview

AI Shortcuts is a cross-platform desktop writing assistant: users select text (or start a chat), invoke a hotkey, choose or compose a command, send the prompt and any attachments to a selected AI provider, then replace the selection or continue in a response window. Commands can be customized and imported/exported; settings cover providers, shortcuts, language, and secure API-key storage. The graph includes the documented Windows/Linux and macOS workflows. Some platform subsystem links rely on README descriptions because their implementation files were not sampled.

Main entry points: [`Windows_and_Linux/WritingToolApp.py`](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/WritingToolApp.py) (Windows/Linux app), [`macOS/WritingTools/App/CommandExecutionEngine.swift`](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/CommandExecutionEngine.swift) (Command execution), [`Windows_and_Linux/ui/CommandsManagerDialog.py`](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/CommandsManagerDialog.py) (Command manager UI), [`macOS/WritingTools/Services/WindowManager.swift`](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Services/WindowManager.swift) (macOS window manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_activation["Activation and UI"]
  node_win_app["Windows/Linux app<br/>[WritingToolApp.py]"]
  node_mac_windows["macOS window manager"]
end

subgraph group_commands["Command management"]
  node_win_commands_ui["Command manager UI"]
  node_win_command_editor["Command editor"]
  node_win_command_store["Command manager<br/>[command_manager.py]"]
  node_win_command["Command model<br/>[command.py]"]
  node_mac_commands["Command manager"]
  node_mac_command["Command model<br/>[CommandModel.swift]"]
end

subgraph group_execution["Prompt and providers"]
  node_mac_engine["Command execution"]
  node_win_providers["AI providers<br/>[aiprovider.py]"]
  node_mac_app_state["App state and providers<br/>[AppState.swift]"]
  node_mac_provider_api["Provider interface<br/>[AIProvider.swift]"]
end

subgraph group_results["Results and attachments"]
  node_win_response["Response window<br/>[ResponseWindow.py]"]
  node_win_attachment["Attachments<br/>[attachment.py]"]
  node_mac_response["Response window"]
  node_mac_attachments["Attachments and OCR<br/>[OCRManager.swift]"]
end

subgraph group_settings["Settings and security"]
  node_win_settings["Settings UI<br/>[SettingsWindow.py]"]
  node_win_key_store[("Secure key storage<br/>[secure_storage.py]")]
  node_mac_settings["App settings<br/>[AppSettings.swift]"]
  node_mac_keychain[("Keychain")]
end

node_user(("Desktop user"))

node_user -->|"invokes hotkey"| node_win_app
node_user -->|"invokes hotkey"| node_mac_windows
node_win_app -.->|"opens commands"| node_win_commands_ui
node_win_commands_ui -->|"edits commands"| node_win_command_editor
node_win_commands_ui -->|"manages commands"| node_win_command_store
node_win_command_store -->|"loads and saves"| node_win_command
node_mac_commands -->|"stores commands"| node_mac_command
node_user -->|"chooses command"| node_win_app
node_win_app -->|"sends prompt"| node_win_providers
node_user -->|"runs command"| node_mac_engine
node_mac_engine -->|"resolves input and provider"| node_mac_app_state
node_mac_app_state -->|"selects provider"| node_mac_provider_api
node_mac_engine -->|"sends prompt"| node_mac_provider_api
node_win_app -->|"shows result"| node_win_response
node_mac_engine -->|"opens response"| node_mac_response
node_user -->|"adds attachments"| node_win_attachment
node_user -->|"adds attachments"| node_mac_attachments
node_win_settings -->|"stores API keys"| node_win_key_store
node_mac_settings -->|"persists API keys"| node_mac_keychain
node_win_app -.->|"opens settings"| node_win_settings
node_mac_windows -->|"presents settings"| node_mac_settings

click node_win_app "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/WritingToolApp.py"
click node_mac_windows "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Services/WindowManager.swift"
click node_win_commands_ui "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/CommandsManagerDialog.py"
click node_win_command_editor "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/CommandEditorDialog.py"
click node_win_command_store "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/command_manager.py"
click node_win_command "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/command.py"
click node_mac_commands "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Services/CommandManager.swift"
click node_mac_command "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Models/CommandModel.swift"
click node_mac_engine "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/CommandExecutionEngine.swift"
click node_win_providers "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/aiprovider.py"
click node_mac_app_state "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/AppState.swift"
click node_mac_provider_api "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Models/Providers/AIProvider.swift"
click node_win_response "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/ResponseWindow.py"
click node_win_attachment "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/attachment.py"
click node_mac_response "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Views/Chat/ResponseWindow.swift"
click node_mac_attachments "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Services/OCRManager.swift"
click node_win_settings "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/SettingsWindow.py"
click node_win_key_store "https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/secure_storage.py"
click node_mac_settings "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/AppSettings.swift"
click node_mac_keychain "https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/KeychainManager.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_win_app,node_mac_windows,node_user toneBlue
class node_win_commands_ui,node_win_command_editor,node_win_command_store,node_win_command,node_mac_commands,node_mac_command toneAmber
class node_mac_engine,node_win_providers,node_mac_app_state,node_mac_provider_api toneMint
class node_win_response,node_win_attachment,node_mac_response,node_mac_attachments toneRose
class node_win_settings,node_win_key_store,node_mac_settings,node_mac_keychain toneIndigo
```

## Components

### Activation and UI

- [Windows/Linux app](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/WritingToolApp.py): `Windows_and_Linux/WritingToolApp.py`
- [macOS window manager](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Services/WindowManager.swift): `macOS/WritingTools/Services/WindowManager.swift`

### Command management

- [Command manager UI](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/CommandsManagerDialog.py): `Windows_and_Linux/ui/CommandsManagerDialog.py`
- [Command editor](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/CommandEditorDialog.py): `Windows_and_Linux/ui/CommandEditorDialog.py`
- [Command manager](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/command_manager.py): `Windows_and_Linux/models/command_manager.py`
- [Command model](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/command.py): `Windows_and_Linux/models/command.py`
- [Command manager](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Services/CommandManager.swift): `macOS/WritingTools/Services/CommandManager.swift`
- [Command model](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Models/CommandModel.swift): `macOS/WritingTools/Models/CommandModel.swift`

### Prompt and providers

- [Command execution](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/CommandExecutionEngine.swift): `macOS/WritingTools/App/CommandExecutionEngine.swift`
- [AI providers](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/aiprovider.py): `Windows_and_Linux/aiprovider.py`
- [App state and providers](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/AppState.swift): `macOS/WritingTools/App/AppState.swift`
- [Provider interface](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Models/Providers/AIProvider.swift): `macOS/WritingTools/Models/Providers/AIProvider.swift`

### Results and attachments

- [Response window](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/ResponseWindow.py): `Windows_and_Linux/ui/ResponseWindow.py`
- [Attachments](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/attachment.py): `Windows_and_Linux/models/attachment.py`
- [Response window](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Views/Chat/ResponseWindow.swift): `macOS/WritingTools/Views/Chat/ResponseWindow.swift`
- [Attachments and OCR](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/Services/OCRManager.swift): `macOS/WritingTools/Services/OCRManager.swift`

### Settings and security

- [Settings UI](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/ui/SettingsWindow.py): `Windows_and_Linux/ui/SettingsWindow.py`
- [Secure key storage](https://github.com/gemkids275/aishortcuts/blob/main/Windows_and_Linux/models/secure_storage.py): `Windows_and_Linux/models/secure_storage.py`
- [App settings](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/AppSettings.swift): `macOS/WritingTools/App/AppSettings.swift`
- [Keychain](https://github.com/gemkids275/aishortcuts/blob/main/macOS/WritingTools/App/KeychainManager.swift): `macOS/WritingTools/App/KeychainManager.swift`

### Other components

- **Desktop user**

## Connections

- Desktop user → Windows/Linux app: invokes hotkey (evidence: `README.md`)
- Desktop user → macOS window manager: invokes hotkey (evidence: `README.md`)
- Windows/Linux app → Command manager UI: opens commands
- Command manager UI → Command editor: edits commands (evidence: `Windows_and_Linux/ui/CommandsManagerDialog.py`)
- Command manager UI → Command manager: manages commands (evidence: `Windows_and_Linux/ui/CommandsManagerDialog.py`)
- Command manager → Command model: loads and saves (evidence: `Windows_and_Linux/models/command_manager.py`)
- Command manager → Command model: stores commands (evidence: `macOS/WritingTools/Services/CommandManager.swift`)
- Desktop user → Windows/Linux app: chooses command (evidence: `README.md`)
- Windows/Linux app → AI providers: sends prompt (evidence: `Windows_and_Linux/WritingToolApp.py`)
- Desktop user → Command execution: runs command (evidence: `README.md`)
- Command execution → App state and providers: resolves input and provider (evidence: `macOS/WritingTools/App/CommandExecutionEngine.swift`)
- App state and providers → Provider interface: selects provider (evidence: `macOS/WritingTools/App/AppState.swift`)
- Command execution → Provider interface: sends prompt (evidence: `macOS/WritingTools/App/CommandExecutionEngine.swift`)
- Windows/Linux app → Response window: shows result (evidence: `README.md`)
- Command execution → Response window: opens response (evidence: `macOS/WritingTools/App/CommandExecutionEngine.swift`)
- Desktop user → Attachments: adds attachments (evidence: `README.md`)
- Desktop user → Attachments and OCR: adds attachments (evidence: `README.md`)
- Settings UI → Secure key storage: stores API keys (evidence: `Windows_and_Linux/ui/SettingsWindow.py`)
- App settings → Keychain: persists API keys (evidence: `macOS/WritingTools/App/AppSettings.swift`)
- Windows/Linux app → Settings UI: opens settings (evidence: `Windows_and_Linux/WritingToolApp.py`)
- macOS window manager → App settings: presents settings (evidence: `macOS/WritingTools/Services/WindowManager.swift`)
