Architecture Overview

Two processes, one IPC channel, four AI providers, and one stateful per-project file tree. The shape of the system at a glance.

System diagram

flowchart LR
    subgraph Frontend
        UI[React 19 + Vite<br/>port 1420]
        Hooks[hooks/<br/>useChat, useSettings, useBonsai, ...]
        Stores[Zustand stores<br/>app, chat, projectSettings, bonsai, ui]
        UI --> Hooks
        UI --> Stores
    end

    subgraph Backend
        Rust[Rust commands<br/>44 in lib.rs]
        Agent[agent/ module<br/>loop, executor, tools]
        Sandbox[sandbox/<br/>landlock + seccomp + bwrap]
        Rust --> Agent
        Agent --> Sandbox
    end

    subgraph AI_Providers
        OllamaLocal[Ollama local<br/>localhost:11434]
        OllamaCloud[Ollama Cloud<br/>ollama.com]
        OpenAI[OpenAI<br/>api.openai.com]
        Claude[Claude<br/>api.anthropic.com]
    end

    FS[(Filesystem<br/>app data dir<br/>projects/&lt;id&gt;/<br/>assets/)]
    Store[(Tauri Store<br/>settings.json<br/>bonsai_config.json)]

    UI <-->|invoke + Channel| Rust
    Rust -->|HTTP| OllamaLocal
    Rust -->|HTTP| OllamaCloud
    Rust -->|HTTP| OpenAI
    Rust -->|HTTP| Claude
    Rust <--> FS
    Rust <--> Store

The frontend never talks to AI providers directly — every request flows through a Rust command. The Rust side owns the streaming channel, tool permission resolution, and ask_user / ask_user_form round-trips.

Sections

  • Frontend — React 19 + Vite, panel structure, hooks, state
  • Backend — all 44 Rust commands by group
  • IPC — Tauri invoke and Channel patterns
  • Data Persistence — settings, projects, assets, workflows
  • AI Streaming — the 8-variant CompletionEvent enum

Existing deep-dive reports