Architecture

Also available: Markdown ยท Plain text

Architecture โ€” Gnomad Desktop Assistant

Version: 0.1.0-alpha
Last updated: June 2026


System context

Gnomad is a desktop-native AI assistant that combines a WebView UI with a Rust systems layer. Users invoke it from the menu bar or system tray; the app reads OS context (active window, clipboard), sends prompts to cloud or local LLMs, and executes approved shell and filesystem actions.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        Operating System                          โ”‚
โ”‚  (tray, shortcuts, keychain, windowing, clipboard, shell)      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Tauri 2 Runtime (Rust)                       โ”‚
โ”‚  lib.rs ยท window_manager ยท platform ยท context ยท keychain         โ”‚
โ”‚  shell_session ยท agent_runtime ยท agent_fs ยท privilege ยท audit    โ”‚
โ”‚  hitl_token ยท path_token ยท local_inference ยท shell_sandbox       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ invoke / events
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   React 19 SPA (TypeScript)                      โ”‚
โ”‚  App.tsx ยท agentLoop ยท llm ยท chatHistory ยท knowledge ยท settings  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ                             โ–ผ
      DeepSeek API                    Ollama HTTP
      (cloud + tools)               (local + tags/planner)

Layer responsibilities

Layer Owns Must not own
React UI Layout, chat UX, modals (Sudo/Path Gate), onboarding Direct shell spawn, raw secret storage
Tauri IPC Serialization, command dispatch, events Business copy in Rust-only paths where UI suffices
Rust backend PTY, FS sandbox, safety checks, keychain, audit, signed tokens LLM prompt styling (mostly frontend)
External LLM Inference Local file paths without agent layer

Window & lifecycle

Mode Behavior
Panel Anchored near tray/menu bar; compact chrome
Floating Movable always-on-top window
Windowed Native menus; may hide duplicate in-app toolbar
Fullscreen Maximized workspace

Lifecycle: App starts hidden โ†’ tray visible โ†’ global shortcut or tray click shows window โ†’ close hides to tray โ†’ Quit exits process.

macOS uses ActivationPolicy::Accessory for menu-bar-first presence.


IPC model

Communication uses Tauri invoke (request/response) and emit/listen (menu โ†’ UI events).

Event channels (UI subscribes)

Event Source Purpose
menu-new-chat Native menu / tray Reset composer session
menu-open-settings Tray Open settings pane
menu-open-knowledge Menu Open knowledge overlay
menu-cycle-theme Menu Theme rotation
window-mode-changed window_manager Sync mode chips
Shell output streams shell_session Live stdout in chat

Command domains

Domain Module(s) Examples
Platform platform, window_manager get_platform_info, set_window_mode
Context context get_active_window, clipboard
Secrets keychain, env_config save_credential, get_env_llm_config
LLM llm chat_completion, model listing
Chat store chat_history save_chat_session, load_chat_session
Agent agent_runtime, agent_fs, agent_settings Tool execution, workspace
Shell shell_session, shell_executor, privilege PTY run, safety check, elevation
Knowledge knowledge Index, upload, context bundle
Attachments attachments Stage files for prompts

Full command surface evolves with releases; grep #[tauri::command] in src-tauri/src/ for the authoritative list.


Agent execution flow

User message (UI)
      โ”‚
      โ–ผ
chatCompletion / runAgentLoop
      โ”‚
      โ”œโ”€โ”€ Cloud: tool_calls (shell_run, fs_*, workspace_info)
      โ”‚         โ””โ”€โ”€ invoke Rust agent_runtime (โ‰ค10 steps)
      โ”‚
      โ””โ”€โ”€ Local: <gnomad-run> tags or $ direct shell
                โ””โ”€โ”€ optional command_planner (Ollama)
      โ”‚
      โ–ผ
privilege::check_command_safety
      โ”‚
      โ”œโ”€โ”€ requires_hitl โ†’ Sudo Gate modal (UI) โ†’ approve/deny
      โ””โ”€โ”€ execute via shell_session (PTY)
      โ”‚
      โ–ผ
agent_audit.jsonl + chat thread update

Data locations

Data Path pattern
Chat sessions {app_data}/gnomad/chats/
Knowledge library {app_data}/gnomad/knowledge/
Agent audit {app_data}/gnomad/agent-audit.jsonl
Agent settings {app_data}/gnomad/agent-settings.json
API keys OS keychain (service scoped)

Cross-platform abstraction

platform::get_platform_info() returns capability flags consumed by React (tray labels, accessibility UI, title bar behavior). Platform-specific code lives in #[cfg(target_os = ...)] blocks inside context, privilege, and automation modules.


Built with โค๏ธ by Gnomad Studio ๐Ÿฆ™