# thansheer/obsidian-omnichat architecture

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

- Interactive diagram: https://gitdiagram.com/thansheer/obsidian-omnichat
- Repository: https://github.com/thansheer/obsidian-omnichat

## Overview

OmniChat is an Obsidian plugin that combines embedded web-based AI services with an agent chat studio. Users open the persistent chat view, choose a mode, then either use a web service or send a prompt to a CLI/API agent; agent chats can incorporate vault context and retain session history. The graph also includes settings and onboarding/feedback capabilities documented or referenced in the source index. Some links rely on README descriptions or import references; unsampled implementation details are not inferred.

Main entry points: [`src/main.ts`](https://github.com/thansheer/obsidian-omnichat/blob/main/src/main.ts) (Plugin lifecycle), [`src/views/AgentChatUI.ts`](https://github.com/thansheer/obsidian-omnichat/blob/main/src/views/AgentChatUI.ts) (Agent chat UI), [`src/views/AIChatView.ts`](https://github.com/thansheer/obsidian-omnichat/blob/main/src/views/AIChatView.ts) (Chat view), [`src/settings.ts`](https://github.com/thansheer/obsidian-omnichat/blob/main/src/settings.ts) (Settings and diagnostics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Plugin experience"]
  node_plugin["Plugin lifecycle<br/>[main.ts]"]
  node_commands["Commands<br/>[index.ts]"]
  node_chatview["Chat view<br/>[AIChatView.ts]"]
end

subgraph group_browser["Browser AI"]
  node_browser_services["Web AI services<br/>[constants.ts]"]
  node_webview_theme["Webview theming"]
end

subgraph group_agent["Agent studio"]
  node_agent_ui["Agent chat UI<br/>[AgentChatUI.ts]"]
  node_cli_service["CLI execution<br/>[AgentCliService.ts]"]
  node_api_service["Model APIs<br/>[AgentApiService.ts]"]
  node_agent_types["Agent engines<br/>[agent.ts]"]
end

subgraph group_vault["Vault context and history"]
  node_vault_query["Vault search"]
  node_context_picker["Context selection"]
  node_chat_history[("Chat history")]
end

subgraph group_config["Settings and support"]
  node_settings["Settings and diagnostics<br/>[settings.ts]"]
  node_welcome["Welcome and updates<br/>[WelcomeModal.ts]"]
  node_release_notes["Release notes<br/>[github.ts]"]
  node_update_modal["Update modal"]
  node_feedback["Feedback forms<br/>[FeedbackModal.ts]"]
end

node_user(("Obsidian user"))
node_web(("External AI websites"))
node_models(("External model APIs"))
node_cli_process(("Local CLI agents"))
node_vault[("Obsidian vault")]
node_github(("GitHub releases"))

node_user -->|"invokes"| node_commands
node_commands -->|"dispatches"| node_plugin
node_plugin -->|"registers view"| node_chatview
node_user -.->|"uses"| node_chatview
node_chatview -->|"selects service"| node_browser_services
node_chatview -->|"loads web interface"| node_web
node_chatview -->|"applies theme"| node_webview_theme
node_chatview -->|"hosts agent mode"| node_agent_ui
node_agent_ui -->|"uses engine definitions"| node_agent_types
node_agent_ui -->|"runs CLI prompt"| node_cli_service
node_agent_ui -->|"streams model requests"| node_api_service
node_cli_service -.->|"spawns process"| node_cli_process
node_api_service -.->|"calls model APIs"| node_models
node_agent_ui -->|"opens context search"| node_context_picker
node_agent_ui -->|"searches vault"| node_vault_query
node_vault_query -.->|"reads notes"| node_vault
node_chatview -.->|"stages note context"| node_vault
node_agent_ui -->|"loads and saves sessions"| node_chat_history
node_plugin -->|"loads store"| node_chat_history
node_plugin -->|"loads settings"| node_settings
node_settings -->|"detects CLI tools"| node_cli_service
node_plugin -->|"opens onboarding"| node_welcome
node_plugin -->|"fetches release notes"| node_release_notes
node_plugin -->|"shows updates"| node_update_modal
node_update_modal -->|"requests release data"| node_release_notes
node_settings -->|"opens feedback"| node_feedback
node_release_notes -->|"requests releases"| node_github

click node_plugin "https://github.com/thansheer/obsidian-omnichat/blob/main/src/main.ts"
click node_commands "https://github.com/thansheer/obsidian-omnichat/blob/main/src/commands/index.ts"
click node_chatview "https://github.com/thansheer/obsidian-omnichat/blob/main/src/views/AIChatView.ts"
click node_browser_services "https://github.com/thansheer/obsidian-omnichat/blob/main/src/constants.ts"
click node_webview_theme "https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/WebviewThemeService.ts"
click node_agent_ui "https://github.com/thansheer/obsidian-omnichat/blob/main/src/views/AgentChatUI.ts"
click node_cli_service "https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/AgentCliService.ts"
click node_api_service "https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/AgentApiService.ts"
click node_agent_types "https://github.com/thansheer/obsidian-omnichat/blob/main/src/types/agent.ts"
click node_vault_query "https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/VaultQueryService.ts"
click node_context_picker "https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/ContextSearchModal.ts"
click node_chat_history "https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/ChatHistoryService.ts"
click node_settings "https://github.com/thansheer/obsidian-omnichat/blob/main/src/settings.ts"
click node_welcome "https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/WelcomeModal.ts"
click node_release_notes "https://github.com/thansheer/obsidian-omnichat/blob/main/src/feedback/github.ts"
click node_update_modal "https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/UpdateNotesModal.ts"
click node_feedback "https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/FeedbackModal.ts"

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_plugin,node_commands,node_chatview,node_user toneBlue
class node_browser_services,node_webview_theme,node_vault toneAmber
class node_agent_ui,node_cli_service,node_api_service,node_agent_types,node_models toneMint
class node_vault_query,node_context_picker,node_chat_history toneRose
class node_settings,node_welcome,node_release_notes,node_update_modal,node_feedback,node_web,node_cli_process,node_github toneIndigo
```

## Components

### Plugin experience

- [Plugin lifecycle](https://github.com/thansheer/obsidian-omnichat/blob/main/src/main.ts): `src/main.ts`
- [Commands](https://github.com/thansheer/obsidian-omnichat/blob/main/src/commands/index.ts): `src/commands/index.ts`
- [Chat view](https://github.com/thansheer/obsidian-omnichat/blob/main/src/views/AIChatView.ts): `src/views/AIChatView.ts`

### Browser AI

- [Web AI services](https://github.com/thansheer/obsidian-omnichat/blob/main/src/constants.ts): `src/constants.ts`
- [Webview theming](https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/WebviewThemeService.ts): `src/services/WebviewThemeService.ts`

### Agent studio

- [Agent chat UI](https://github.com/thansheer/obsidian-omnichat/blob/main/src/views/AgentChatUI.ts): `src/views/AgentChatUI.ts`
- [CLI execution](https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/AgentCliService.ts): `src/services/AgentCliService.ts`
- [Model APIs](https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/AgentApiService.ts): `src/services/AgentApiService.ts`
- [Agent engines](https://github.com/thansheer/obsidian-omnichat/blob/main/src/types/agent.ts): `src/types/agent.ts`

### Vault context and history

- [Vault search](https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/VaultQueryService.ts): `src/services/VaultQueryService.ts`
- [Context selection](https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/ContextSearchModal.ts): `src/modals/ContextSearchModal.ts`
- [Chat history](https://github.com/thansheer/obsidian-omnichat/blob/main/src/services/ChatHistoryService.ts): `src/services/ChatHistoryService.ts`

### Settings and support

- [Settings and diagnostics](https://github.com/thansheer/obsidian-omnichat/blob/main/src/settings.ts): `src/settings.ts`
- [Welcome and updates](https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/WelcomeModal.ts): `src/modals/WelcomeModal.ts`
- [Release notes](https://github.com/thansheer/obsidian-omnichat/blob/main/src/feedback/github.ts): `src/feedback/github.ts`
- [Update modal](https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/UpdateNotesModal.ts): `src/modals/UpdateNotesModal.ts`
- [Feedback forms](https://github.com/thansheer/obsidian-omnichat/blob/main/src/modals/FeedbackModal.ts): `src/modals/FeedbackModal.ts`

### Other components

- **Obsidian user**
- **External AI websites**
- **External model APIs**
- **Local CLI agents**
- **Obsidian vault**
- **GitHub releases**

## Connections

- Obsidian user → Commands: invokes (evidence: `src/commands/index.ts`)
- Commands → Plugin lifecycle: dispatches (evidence: `src/commands/index.ts`)
- Plugin lifecycle → Chat view: registers view (evidence: `src/main.ts`)
- Obsidian user → Chat view: uses (evidence: `README.md`)
- Chat view → Web AI services: selects service (evidence: `src/views/AIChatView.ts`)
- Chat view → External AI websites: loads web interface (evidence: `README.md`)
- Chat view → Webview theming: applies theme (evidence: `src/views/AIChatView.ts`)
- Chat view → Agent chat UI: hosts agent mode (evidence: `src/views/AIChatView.ts`)
- Agent chat UI → Agent engines: uses engine definitions (evidence: `src/views/AgentChatUI.ts`)
- Agent chat UI → CLI execution: runs CLI prompt (evidence: `src/views/AgentChatUI.ts`)
- Agent chat UI → Model APIs: streams model requests (evidence: `src/views/AgentChatUI.ts`)
- CLI execution → Local CLI agents: spawns process
- Model APIs → External model APIs: calls model APIs (evidence: `README.md`)
- Agent chat UI → Context selection: opens context search (evidence: `src/views/AgentChatUI.ts`)
- Agent chat UI → Vault search: searches vault (evidence: `src/views/AgentChatUI.ts`)
- Vault search → Obsidian vault: reads notes (evidence: `README.md`)
- Chat view → Obsidian vault: stages note context (evidence: `README.md`)
- Agent chat UI → Chat history: loads and saves sessions (evidence: `src/views/AgentChatUI.ts`)
- Plugin lifecycle → Chat history: loads store (evidence: `src/main.ts`)
- Plugin lifecycle → Settings and diagnostics: loads settings (evidence: `src/main.ts`)
- Settings and diagnostics → CLI execution: detects CLI tools (evidence: `src/settings.ts`)
- Plugin lifecycle → Welcome and updates: opens onboarding (evidence: `src/main.ts`)
- Plugin lifecycle → Release notes: fetches release notes (evidence: `src/main.ts`)
- Plugin lifecycle → Update modal: shows updates (evidence: `src/main.ts`)
- Update modal → Release notes: requests release data (evidence: `src/modals/UpdateNotesModal.ts`)
- Settings and diagnostics → Feedback forms: opens feedback (evidence: `src/settings.ts`)
- Release notes → GitHub releases: requests releases (evidence: `src/feedback/github.ts`)
